diff --git a/src/fs/320x240x16/media/spin32.bmp b/src/fs/320x240x16/media/spin32.bmp index 64c1c4204a..ac36917752 100644 Binary files a/src/fs/320x240x16/media/spin32.bmp and b/src/fs/320x240x16/media/spin32.bmp differ diff --git a/src/fs/320x240x16/media/spin64.bmp b/src/fs/320x240x16/media/spin64.bmp index df42f0f494..fa3cfdc088 100644 Binary files a/src/fs/320x240x16/media/spin64.bmp and b/src/fs/320x240x16/media/spin64.bmp differ diff --git a/src/fs/320x240x16/media/spin96.bmp b/src/fs/320x240x16/media/spin96.bmp index 3dede79491..e47bfb1e99 100644 Binary files a/src/fs/320x240x16/media/spin96.bmp and b/src/fs/320x240x16/media/spin96.bmp differ diff --git a/src/fs/320x240x16/media/spinp32.bmp b/src/fs/320x240x16/media/spinp32.bmp deleted file mode 100644 index 2c0203c5af..0000000000 Binary files a/src/fs/320x240x16/media/spinp32.bmp and /dev/null differ diff --git a/src/fs/320x240x16/media/spinp64.bmp b/src/fs/320x240x16/media/spinp64.bmp deleted file mode 100644 index ab24626d3c..0000000000 Binary files a/src/fs/320x240x16/media/spinp64.bmp and /dev/null differ diff --git a/src/fs/320x240x16/media/spinp96.bmp b/src/fs/320x240x16/media/spinp96.bmp deleted file mode 100644 index 0721fe8a69..0000000000 Binary files a/src/fs/320x240x16/media/spinp96.bmp and /dev/null differ diff --git a/src/gui/320x240x16/_gui.c b/src/gui/320x240x16/_gui.c index 7712e0cfee..0271404c13 100644 --- a/src/gui/320x240x16/_gui.c +++ b/src/gui/320x240x16/_gui.c @@ -13,6 +13,7 @@ along with Deviation. If not, see . */ +#if 0 const struct ImageMap image_map[] = { {"media/btn96_24" IMG_EXT, 96, 24, 0, 0}, /*FILE_BTN96_24 */ {"media/btn48_24" IMG_EXT, 48, 24, 0, 0}, /*FILE_BTN48_24 */ @@ -24,14 +25,29 @@ const struct ImageMap image_map[] = { {"media/spin96" IMG_EXT, 96, 16, 0, 0}, /*FILE_SPIN96 */ {"media/spin64" IMG_EXT, 64, 16, 0, 0}, /*FILE_SPIN64 */ {"media/spin32" IMG_EXT, 32, 16, 0, 0}, /*FILE_SPIN32 */ - {"media/spinp96" IMG_EXT, 96, 16, 0, 0}, /*FILE_SPINPRESS96 */ - {"media/spinp64" IMG_EXT, 64, 16, 0, 0}, /*FILE_SPINPRESS64 */ - {"media/spinp32" IMG_EXT, 32, 16, 0, 0}, /*FILE_SPINPRESS32 */ {"media/arrows16" IMG_EXT, 16, 16, 0, 0}, /*FILE_ARROW_16_UP */ {"media/arrows16" IMG_EXT, 16, 16, 16, 0}, /*FILE_ARROW_16_DOWN */ {"media/arrows16" IMG_EXT, 16, 16, 32, 0}, /*FILE_ARROW_16_RIGHT */ {"media/arrows16" IMG_EXT, 16, 16, 48, 0}, /*FILE_ARROW_16_LEFT */ }; +#else +const struct ImageMap image_map[] = { + {NULL, 96, 24, 0, 0}, /*FILE_BTN96_24 */ + {NULL, 48, 24, 0, 0}, /*FILE_BTN48_24 */ + {NULL, 96, 16, 0, 0}, /*FILE_BTN96_16 */ + {NULL, 64, 16, 0, 0}, /*FILE_BTN64_16 */ + {NULL, 48, 16, 0, 0}, /*FILE_BTN48_16 */ + {NULL, 32, 16, 0, 0}, /*FILE_BTN32_16 */ + {NULL,192, 16, 1, 0}, /*FILE_SPIN192 */ + {NULL, 96, 16, 1, 0}, /*FILE_SPIN96 */ + {NULL, 64, 16, 1, 0}, /*FILE_SPIN64 */ + {NULL, 32, 16, 1, 0}, /*FILE_SPIN32 */ + {NULL, 16, 16, 2, 1}, /*FILE_ARROW_16_UP */ + {NULL, 16, 16, 2, 2}, /*FILE_ARROW_16_DOWN */ + {NULL, 16, 16, 2, 3}, /*FILE_ARROW_16_RIGHT */ + {NULL, 16, 16, 2, 4}, /*FILE_ARROW_16_LEFT */ +}; +#endif void _gui_hilite_selected(struct guiObject *obj) { diff --git a/src/gui/320x240x16/_gui.h b/src/gui/320x240x16/_gui.h index fb72281845..95c9cad28a 100644 --- a/src/gui/320x240x16/_gui.h +++ b/src/gui/320x240x16/_gui.h @@ -23,9 +23,6 @@ enum ImageNames { FILE_SPIN96, FILE_SPIN64, FILE_SPIN32, - FILE_SPINPRESS96, - FILE_SPINPRESS64, - FILE_SPINPRESS32, FILE_ARROW_16_UP, FILE_ARROW_16_DOWN, FILE_ARROW_16_RIGHT, diff --git a/src/gui/320x240x16/_textsel.c b/src/gui/320x240x16/_textsel.c index b570bc33a0..d084da1590 100644 --- a/src/gui/320x240x16/_textsel.c +++ b/src/gui/320x240x16/_textsel.c @@ -24,7 +24,8 @@ void _DrawTextSelectHelper(struct guiTextSelect *select, const char *str) #if HAS_RTC if (select->type == TEXTSELECT_VERT_64) { GUI_DrawImageHelper(box->x, - box->y + ARROW_HEIGHT, select->button, DRAW_NORMAL); + box->y + ARROW_HEIGHT, select->button, + select->enable & 0x02 ? DRAW_PRESSED : DRAW_NORMAL); if (select->enable & 0x01) { GUI_DrawImageHelper(box->x + (box->width - ARROW_WIDTH) / 2, box->y, ARROW_UP, select->state & 0x02 ? DRAW_PRESSED : DRAW_NORMAL); @@ -36,7 +37,8 @@ void _DrawTextSelectHelper(struct guiTextSelect *select, const char *str) #endif { GUI_DrawImageHelper(box->x + ARROW_WIDTH, - box->y, select->button, DRAW_NORMAL); + box->y, select->button, + select->enable & 0x02 ? DRAW_PRESSED : DRAW_NORMAL); if (select->enable & 0x01) { GUI_DrawImageHelper(box->x, box->y, ARROW_LEFT, select->state & 0x01 ? DRAW_PRESSED : DRAW_NORMAL); diff --git a/src/gui/gui.c b/src/gui/gui.c index b22fce7c64..43bc7e3ab1 100644 --- a/src/gui/gui.c +++ b/src/gui/gui.c @@ -801,9 +801,110 @@ u8 GUI_ObjectNeedsRedraw(guiObject_t *obj) return OBJ_IS_DIRTY(obj); } +static void _DrawButtonBackground(u16 x, u16 y, const struct ImageMap *map, u8 idx) +{ + // determine size + + // draw border + LCD_DrawFastHLine(x + 1, y, map->width - 2, 0); + LCD_DrawFastHLine(x + 1, y + map->height - 1, map->width - 2, 0); + LCD_DrawFastVLine(x, y + 1, map->height - 2, 0); + LCD_DrawFastVLine(x + map->width - 1, y + 1, map->height - 2, 0); + + // draw up/down effect + u16 fillcolor = 0; + u16 uppercolor = 0; + u16 bottomcolor = 0; + + switch(map->x_off) { + case 0: + case 2: + { + // this is a button + if (idx) { + fillcolor = 0xffff; + uppercolor = 0xa534; + bottomcolor = 0xe73c; + } else { + fillcolor = 0xbdf7; + uppercolor = 0xe73c; + bottomcolor = 0xa534; + } + } + break; + + case 1: + { + // this is textself + if (!idx) { + fillcolor = 0xffff; + } else { + fillcolor = 0xbdf7; + } + } + break; + } + + if (map->x_off != 1) { + LCD_DrawFastHLine(x + 1, y + 1, map->width - 3, uppercolor); + LCD_DrawFastVLine(x + 1, y + 1, map->height - 3, uppercolor); + + LCD_DrawFastHLine(x + 2, y + map->height - 2, map->width - 3, bottomcolor); + LCD_DrawFastVLine(x + map->width - 2, y + 2, map->height - 3, bottomcolor); + + LCD_DrawPixelXY(x + 1, y + map->height - 2, 0xbdf7); + LCD_DrawPixelXY(x + map->width - 2, y + 1, 0xbdf7); + + LCD_FillRect(x + 2, y + 2, map->width - 4, map->height - 4, fillcolor); + } + else + { + LCD_FillRect(x + 1, y + 1, map->width - 2, map->height - 2, fillcolor); + } + + if (map->x_off != 2) + return; + + u16 color = idx ? 0xf800 : 0x0000; + u16 x_start, y_start, x_end, y_end; + u16 size = map->height - 1; + + // up coordinates + x_start = size / 4; + y_start = size / 3 * 2 - 1; + x_end = size / 2; + y_end = size / 3; + + // draw additional arrows + switch(map->y_off) + { + case 1: + LCD_DrawLine(x + x_start, y + y_start, x + x_end, y + y_end, color); + LCD_DrawLine(x + x_end + 1, y + y_end, x + size - x_start, y + y_start, color); + break; + case 2: + LCD_DrawLine(x + x_start, y + size - y_start, x + x_end, y + size - y_end, color); + LCD_DrawLine(x + x_end + 1, y + size - y_end, x + size - x_start, y + size - y_start, color); + break; + case 3: + LCD_DrawLine(x + size - y_start, y + x_start, x + size - y_end, y + x_end, color); + LCD_DrawLine(x + size - y_end, y + x_end + 1, x + size - y_start, y + size - x_start, color); + break; + case 4: + LCD_DrawLine(x + y_start, y + x_start, x + y_end, y + x_end, color); + LCD_DrawLine(x + y_end, y + x_end + 1, x + y_start, y + size - x_start, color); + break; + default: + return; + } +} + void GUI_DrawImageHelper(u16 x, u16 y, const struct ImageMap *map, u8 idx) { - LCD_DrawWindowedImageFromFile(x, y, map->file, map->width, map->height, + if (map->file == NULL) + _DrawButtonBackground(x, y, map, idx); + else + LCD_DrawWindowedImageFromFile(x, y, map->file, map->width, map->height, map->x_off, map->y_off + idx * map->height); } diff --git a/src/gui/textsel.c b/src/gui/textsel.c index a9d314372f..bfb42ea3e8 100644 --- a/src/gui/textsel.c +++ b/src/gui/textsel.c @@ -283,10 +283,10 @@ void GUI_TextSelectEnablePress(guiTextSelect_t *select, u8 enable) } enum ImageNames fileidx; switch (select->type) { - case TEXTSELECT_224: fileidx = FILE_SPIN192; /* enable ? FILE_SPIN192 : FILE_SPIN192;*/ break; - case TEXTSELECT_128: fileidx = enable ? FILE_SPINPRESS96 : FILE_SPIN96; break; - case TEXTSELECT_96: fileidx = enable ? FILE_SPINPRESS64 : FILE_SPIN64; break; - case TEXTSELECT_64: fileidx = enable ? FILE_SPINPRESS32 : FILE_SPIN32; break; + case TEXTSELECT_224: fileidx = FILE_SPIN192; break; + case TEXTSELECT_128: fileidx = FILE_SPIN96; break; + case TEXTSELECT_96: fileidx = FILE_SPIN64; break; + case TEXTSELECT_64: fileidx = FILE_SPIN32; break; default: fileidx = FILE_SPIN32; break; } if (select->button != &image_map[fileidx]) {