]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
convert all the magic numbers for buttons shown in the top surface
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 14 Nov 2023 17:03:41 +0000 (22:33 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 14 Nov 2023 17:03:41 +0000 (22:33 +0530)
screen.h
vfo.c

index 98fa9441799e6be5f04bd44c1c86c7fd15143544..6b82cc9df14c8ca7def743d99ea2dc71a3650499 100644 (file)
--- a/screen.h
+++ b/screen.h
 #define  NR_X       70
 #define  NR_Y       40
 
+#define  ANF_X      70
+#define  ANF_Y      20
+
+#define  SNB_X      115
+#define  SNB_Y      20
+
+#define  AGC_X      160
+#define  AGC_Y      20
+
+#define  MIDI_X     480
+#define  MIDI_Y     20
+
+#define  VOX_X      160
+#define  VOX_Y      40
+
+#define  LOCK_X      5
+#define  LOCK_Y      80
+
+#define  SPLIT_X     5
+#define  SPLIT_Y     20
+
+#define  CTUN_X      5
+#define  CTUN_Y      40
+
+#define  DUP_X       5
+#define  DUP_Y       60
+
 #endif // _SCREEN_H
diff --git a/vfo.c b/vfo.c
index 0577451703a3c92ddbc0fec0230ce5d92e505605..5805049c4768aa455b0c672a026c5e3b5278ed33 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -1242,88 +1242,88 @@ void vfo_update(void) {
             cairo_show_text(cr, "NR");
         }
 
-        cairo_move_to(cr, 70, 20);
+        cairo_move_to(cr, ANF_X, ANF_Y);
         if (active_receiver->anf) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
         }
         cairo_show_text(cr, "ANF");
 
-        cairo_move_to(cr, 115, 20);
+        cairo_move_to(cr, SNB_X, SNB_Y);
         if (active_receiver->snb) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
         }
         cairo_show_text(cr, "SNB");
 
-        cairo_move_to(cr, 160, 20);
+        cairo_move_to(cr, AGC_X, AGC_Y);
         switch (active_receiver->agc) {
         case AGC_OFF:
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
             cairo_show_text(cr, "AGC");
             break;
         case AGC_LONG:
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "AGC L");
             break;
         case AGC_SLOW:
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "AGC S");
             break;
         case AGC_MEDIUM:
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "AGC M");
             break;
         case AGC_FAST:
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "AGC F");
             break;
         }
 
 #ifdef MIDI
-        cairo_move_to(cr, 480, 20);
+        cairo_move_to(cr, MIDI_X, MIDI_Y);
         if (midi_enabled) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
         }
         cairo_show_text(cr, "MIDI");
 #endif
 
         if (can_transmit) {
-            cairo_move_to(cr, 160, 40);
+            cairo_move_to(cr, VOX_X, VOX_Y);
             if (vox_enabled) {
-                cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
+                cairo_set_source_rgb(cr, RED_R, RED_G, RED_B);
             } else {
-                cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+                cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
             }
             cairo_show_text(cr, "VOX");
         }
 
-        cairo_move_to(cr, 5, 80);
+        cairo_move_to(cr, LOCK_X, LOCK_Y);
         if (locked) {
-            cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
+            cairo_set_source_rgb(cr, RED_R, RED_G, RED_B);
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
         }
         cairo_show_text(cr, "LOCK");
 
-        cairo_move_to(cr, 5, 20);
+        cairo_move_to(cr, SPLIT_X, SPLIT_Y);
         if (split) {
-            cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
+            cairo_set_source_rgb(cr, RED_R, RED_G, RED_B);
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
         }
         cairo_set_font_size(cr, 16);
         cairo_show_text(cr, "SPLIT");
 
-        cairo_move_to(cr, 5, 40);
+        cairo_move_to(cr, CTUN_X, CTUN_Y);
         if (vfo[id].ctun) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
         }
         cairo_show_text(cr, "CTUN");
         /* if(sat_mode!=SAT_NONE) { */
@@ -1339,12 +1339,12 @@ void vfo_update(void) {
         /* } */
 
         if (duplex) {
-            cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
+            cairo_set_source_rgb(cr, RED_R, RED_G, RED_B);
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
         }
         sprintf(temp_text, "DUP");
-        cairo_move_to(cr, 5, 60);
+        cairo_move_to(cr, DUP_X, DUP_Y);
         cairo_set_font_size(cr, 16);
         cairo_show_text(cr, temp_text);