1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-27 16:17:12 +02:00

ubb-la.c/gui.c: show units in light blue to better separate them from numbers

This commit is contained in:
Werner Almesberger 2013-01-31 02:57:27 -03:00
parent 06c5f6b0fa
commit 159a128d28

View File

@ -33,6 +33,7 @@
#define YRES 240 /* canvas height */ #define YRES 240 /* canvas height */
#define TEXT_RGBA 0xffffffff /* general text */ #define TEXT_RGBA 0xffffffff /* general text */
#define UNIT_RGBA 0xb0e0ffff /* units */
#define MAP_BUF_RGBA 0x808080ff /* buffer in the map */ #define MAP_BUF_RGBA 0x808080ff /* buffer in the map */
#define MAP_VIEW_RGBA 0xffffffff /* current view in the map */ #define MAP_VIEW_RGBA 0xffffffff /* current view in the map */
#define LEVEL_RGBA 0xffff00ff /* constant level or single change */ #define LEVEL_RGBA 0xffff00ff /* constant level or single change */
@ -336,9 +337,10 @@ static void si_text(int x, int y, double v, const char *unit)
pfx = "n"; pfx = "n";
} }
if (v >= 10) if (v >= 10)
textf(x, y, TEXT_RGBA, "%3d%s%s", (int) (v+0.5), pfx, unit); textf(x, y, TEXT_RGBA, "%3d", (int) (v+0.5));
else else
textf(x, y, TEXT_RGBA, "%3.1f%s%s", v, pfx, unit); textf(x, y, TEXT_RGBA, "%3.1f", v);
textf(x+3*8, y, UNIT_RGBA, "%s%s", pfx, unit);
} }
@ -349,7 +351,8 @@ static void show_freq(double freq, int zoom)
si_text(FREQ_X, FREQ_Y, freq, "Sa/s"); si_text(FREQ_X, FREQ_Y, freq, "Sa/s");
si_text(INTERVAL_X, INTERVAL_Y, 1/freq, "s/Sa"); si_text(INTERVAL_X, INTERVAL_Y, 1/freq, "s/Sa");
div = (DIV_X >> MAX_ZOOM) << (MAX_ZOOM-zoom); div = (DIV_X >> MAX_ZOOM) << (MAX_ZOOM-zoom);
textf(DIV_SAMP_X, DIV_SAMP_Y, TEXT_RGBA, "%4dSa/div", div); textf(DIV_SAMP_X, DIV_SAMP_Y, TEXT_RGBA, "%4d", div);
textf(DIV_SAMP_X+4*8, DIV_SAMP_Y, UNIT_RGBA, "Sa/div", div);
si_text(DIV_INT_X, DIV_INT_Y, div/freq, "s/div"); si_text(DIV_INT_X, DIV_INT_Y, div/freq, "s/div");
} }