]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
remove magic numbers from NB/NR rendering
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 14 Nov 2023 16:51:04 +0000 (22:21 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 14 Nov 2023 16:51:04 +0000 (22:21 +0530)
screen.h
vfo.c

index c07c84f31d96fe6731d514e6a572d862b94ff156..98fa9441799e6be5f04bd44c1c86c7fd15143544 100644 (file)
--- a/screen.h
+++ b/screen.h
@@ -58,6 +58,8 @@
 #define  PS_RENDER_FONT_SIZE        (12)
 #define  RIT_RENDER_FONT_SIZE       (16)
 #define  XIT_RENDER_FONT_SIZE       (16)
+#define  NB_RENDER_FONT_SIZE        (16)
+#define  NR_RENDER_FONT_SIZE        (16)
 
 // coordinates
 
 #define  XIT_X      220
 #define  XIT_Y      20
 
+#define  NB_X       115
+#define  NB_Y       40
+
+#define  NR_X       70
+#define  NR_Y       40
+
 #endif // _SCREEN_H
diff --git a/vfo.c b/vfo.c
index ee625a0f43922ebf5827f1e4b36fab98994f8fbe..0577451703a3c92ddbc0fec0230ce5d92e505605 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -1210,35 +1210,35 @@ void vfo_update(void) {
         // NB and NB2 are mutually exclusive, therefore
         // they are put to the same place in order to save
         // some space
-        cairo_move_to(cr, 115, 40);
-        cairo_set_font_size(cr, 16);
+        cairo_move_to(cr, NB_X, NB_Y);
+        cairo_set_font_size(cr, NB_RENDER_FONT_SIZE);
         if (active_receiver->nb) {
-            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, "NB");
         } else if (active_receiver->nb2) {
-            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, "NB2");
         } 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, "NB");
         }
 
         // NR, NR2, NR3 and NR4 are mutually exclusive
-        cairo_move_to(cr, 70, 40);
+        cairo_move_to(cr, NR_X, NR_Y);
         if (active_receiver->nr) {
-            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, "NR");
         } else if (active_receiver->nr2) {
-            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, "NR2");
         } else if (active_receiver->nr3) {
-            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, "NR3");
         } else if (active_receiver->nr4) {
-            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, "NR4");
         } 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, "NR");
         }