From 7c49cb535cefcea45de545709255db19822e4b06 Mon Sep 17 00:00:00 2001 From: robijn Date: Sat, 18 May 2002 23:42:46 +0000 Subject: [PATCH] Added some icon definitions in lcd.h; Using ICON_BLOCK_FILLED now in titles. --- server/commands/widget_commands.c | 4 ++++ server/driver.c | 34 +++++++++++++++++++------------ server/drivers/lcd.h | 23 +++++++++++++++++---- server/render.c | 27 ++++++++++++++---------- 4 files changed, 60 insertions(+), 28 deletions(-) diff --git a/server/commands/widget_commands.c b/server/commands/widget_commands.c index 8728c17..5e9b484 100644 --- a/server/commands/widget_commands.c +++ b/server/commands/widget_commands.c @@ -33,6 +33,8 @@ #include "screen.h" #include "widget.h" +#include "drivers.h" + /************************************************************************* * Adds a widget to a screen, but doesn't give it a value @@ -340,6 +342,8 @@ widget_set_func (Client * c, int argc, char **argv) report( RPT_WARNING, "widget_set_func: Allocation error"); return -1; } + /* Set width too */ + w->width = display_props->width; debug (RPT_DEBUG, "Widget %s set to %s", wid, w->text); sock_send_string(c->sock, "success\n"); } diff --git a/server/driver.c b/server/driver.c index cd6768d..08cc3fa 100644 --- a/server/driver.c +++ b/server/driver.c @@ -436,25 +436,33 @@ driver_alt_heartbeat( Driver * drv, int state ) void driver_alt_icon( Driver * drv, int x, int y, int icon ) { - char ch; + char ch1 = '?'; + char ch2 = 0; if (!drv->chr) return; switch (icon) { - case ICON_HEART_OPEN: - ch = '-'; - break; - case ICON_HEART_FILLED: - ch = '#'; - break; - case ICON_BLOCK_FILLED: - ch = '#'; - break; - default: - ch = '?'; + case ICON_BLOCK_FILLED: ch1 = '#'; break; + case ICON_HEART_OPEN: ch1 = '-'; break; + case ICON_HEART_FILLED: ch1 = '#'; break; + case ICON_ARROW_UP: ch1 = '^'; break; + case ICON_ARROW_DOWN: ch1 = 'v'; break; + case ICON_ARROW_LEFT: ch1 = '<'; break; + case ICON_ARROW_RIGHT: ch1 = '>'; break; + case ICON_STOP: ch1 = '['; ch2 = ']'; break; + case ICON_PAUSE: ch1 = '|'; ch2 = '|'; break; + case ICON_PLAY: ch1 = '>'; ch2 = ' '; break; + case ICON_PLAYR: ch1 = '<'; ch2 = ' '; break; + case ICON_FF: ch1 = '>'; ch2 = '>'; break; + case ICON_FR: ch1 = '<'; ch2 = '<'; break; + case ICON_NEXT: ch1 = '>'; ch2 = '|'; break; + case ICON_PREV: ch1 = '|'; ch2 = '<'; break; + case ICON_REC: ch1 = '('; ch2 = ')'; break; } - drv->chr( drv, x, y, ch); + drv->chr( drv, x, y, ch1); + if (ch2) + drv->chr( drv, x+1, y, ch2); } void driver_alt_cursor( Driver * drv, int x, int y, int state ) diff --git a/server/drivers/lcd.h b/server/drivers/lcd.h index 62558f9..81e12c2 100644 --- a/server/drivers/lcd.h +++ b/server/drivers/lcd.h @@ -42,10 +42,25 @@ #define BACKLIGHT_WARNING 2 #define BACKLIGHT_RED_ALERT 3 -/* Icons for icon function */ -#define ICON_BLOCK_FILLED 0 -#define ICON_HEART_OPEN 8 -#define ICON_HEART_FILLED 9 +/* Icons below are one character wide */ +#define ICON_BLOCK_FILLED 0x100 +#define ICON_HEART_OPEN 0x108 +#define ICON_HEART_FILLED 0x109 +#define ICON_ARROW_UP 0x110 +#define ICON_ARROW_DOWN 0x111 +#define ICON_ARROW_LEFT 0x112 +#define ICON_ARROW_RIGHT 0x113 + +/* Icons below are two characters wide */ +#define ICON_STOP 0x200 /* should look like [] */ +#define ICON_PAUSE 0x201 /* should look like || */ +#define ICON_PLAY 0x202 /* should look like > */ +#define ICON_PLAYR 0x203 /* should llok like < */ +#define ICON_FF 0x204 /* should look like >> */ +#define ICON_FR 0x205 /* should look like << */ +#define ICON_NEXT 0x206 /* should look like >| */ +#define ICON_PREV 0x207 /* should look like |< */ +#define ICON_REC 0x208 /* should look like () */ /* Heartbeat data, taken from render.h */ /* ??? What does OPEN mean here ? */ diff --git a/server/render.c b/server/render.c index a6e07c9..c45b7c8 100644 --- a/server/render.c +++ b/server/render.c @@ -31,7 +31,6 @@ #include "shared/report.h" #include "shared/LL.h" -#include "drivers.h" #include "drivers.h" #include "screen.h" @@ -314,15 +313,15 @@ draw_frame (LinkedList * list, if (vis_width < 8) break; - /*memset (str, 255, width);*/ - memset (str, '*', vis_width); - /* TODO: Use icon function to draw the bar */ + drivers_icon (w->x, w->y, ICON_BLOCK_FILLED); + drivers_icon (w->x+1, w->y, ICON_BLOCK_FILLED); - str[2] = ' '; + str[0] = ' '; length = strlen (w->text); if (length <= vis_width - 6) { - memcpy (str + 3, w->text, length); - str[length + 3] = ' '; + memcpy (str + 1, w->text, length); + str[length + 1] = ' '; + x = length + 4; } else /* Scroll the title, if it doesn't fit...*/ { speed = 1; @@ -348,12 +347,18 @@ draw_frame (LinkedList * list, { x = (length - (vis_width - 6)) - x; } - strncpy (str + 3, w->text + x, (vis_width - 6)); - str[vis_width - 3] = ' '; + strncpy (str + 1, w->text + x, (vis_width - 6)); + str[vis_width - 5] = ' '; + x = vis_width - 2; } - str[vis_width] = 0; + str[vis_width-4] = 0; - drivers_string (1 + left, 1 + top, str); + drivers_string (3 + left, 1 + top, str); + + for (; xx+x, w->y, ICON_BLOCK_FILLED); + } + break; case WID_SCROLLER: /* FIXME: doesn't work in frames...*/ {