From acd9fd66739a748f35a1127f7c5b285a42d6f6c5 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 31 Jan 2013 01:09:42 -0300 Subject: [PATCH] ubb-la/gui.c: show horizontal divisions --- ubb-la/gui.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ubb-la/gui.c b/ubb-la/gui.c index d8d538e..f73c234 100644 --- a/ubb-la/gui.c +++ b/ubb-la/gui.c @@ -41,6 +41,7 @@ #define LEVEL_RGBA 0xffff00ff /* constant level or single change */ #define BOUNCE_RGBA 0xff8080ff /* bouncing signal */ #define LABEL_RGBA 0xffffffff /* channel label */ +#define DIV_RGBA 0x808080ff /* divisions */ #define XCENTER ((XRES+CH_XOFF)/2) @@ -54,6 +55,9 @@ #define CH_SKIP 16 #define CH_HEIGHT 8 +#define DIV_X 32 +#define DIV_Y 6 + #define MAX_ZOOM 3 #define FREQ_X 0 @@ -342,6 +346,20 @@ static void show_freq(double freq) } +/* ----- Show a divisions -------------------------------------------------- */ + + +static void show_divisions(void) +{ + int n = (XRES-CH_XOFF)/2/DIV_X; + int i; + + for (i = -n; i <= n; i++) + vlineColor(surf, XCENTER+i*DIV_X, + ch_y(0, 1)-DIV_Y, ch_y(3, 0)+DIV_Y, DIV_RGBA); +} + + /* ----- Main event loop --------------------------------------------------- */ @@ -366,6 +384,7 @@ void gui(const uint8_t *buf, int skip, int nibbles, double freq) clear(); for (i = 0; i != 4; i++) textf(0, ch_y(i, 1), LABEL_RGBA, "CH%d", i); + show_divisions(); show_buffer(buf, skip, nibbles, CH_XOFF, XRES, zoom, pos); show_freq(freq); update();