Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/fs/320x240x16/media/spin32.bmp
Binary file not shown.
Binary file modified src/fs/320x240x16/media/spin64.bmp
Binary file not shown.
Binary file modified src/fs/320x240x16/media/spin96.bmp
Binary file not shown.
Binary file removed src/fs/320x240x16/media/spinp32.bmp
Binary file not shown.
Binary file removed src/fs/320x240x16/media/spinp64.bmp
Binary file not shown.
Binary file removed src/fs/320x240x16/media/spinp96.bmp
Binary file not shown.
22 changes: 19 additions & 3 deletions src/gui/320x240x16/_gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
along with Deviation. If not, see <http://www.gnu.org/licenses/>.
*/

#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 */
Expand All @@ -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 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint Error:

41:  Missing space after ,  

{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)
{
Expand Down
3 changes: 0 additions & 3 deletions src/gui/320x240x16/_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions src/gui/320x240x16/_textsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
103 changes: 102 additions & 1 deletion src/gui/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint Error:

819:  Missing space before ( in switch(  

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint Error:

879:  Missing space before ( in switch(  

{
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);
}

Expand Down
8 changes: 4 additions & 4 deletions src/gui/textsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down