[Horus] Martin's design for buttons

This commit is contained in:
Bertrand Songis
2016-02-09 23:08:47 +01:00
parent 2037c33ce1
commit 65fc20ddde
20 changed files with 40 additions and 13 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ add_custom_target(ttf_horus_fonts DEPENDS ttf_horus_tinsize ttf_horus_smlsize tt
add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/bmp_*.png" 480 5/6/5)
add_bitmaps_target(horus_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/calibration/bmp_*.png" 480 5/6/5)
add_bitmaps_target(horus_button_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/button/bmp_*.png" 480 5/6/5)
add_bitmaps_target(horus_button_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/button/alpha_*.png" 480 5/6/5/8)
add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/alpha_*.png" 480 5/6/5/8)
add_bitmaps_target(horus_alpha_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/calibration/alpha_*.png" 480 5/6/5/8)
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

+9
View File
@@ -316,3 +316,12 @@ const uint8_t LBM_CARROUSSEL_RIGHT[] __DMA = {
#include "mask_carroussel_right.lbm"
};
const uint8_t LBM_BUTTON_ON[] __DMA = {
#include "alpha_button_on.lbm"
};
const uint8_t LBM_BUTTON_OFF[] __DMA = {
#include "alpha_button_off.lbm"
};
+4
View File
@@ -89,4 +89,8 @@ extern const uint8_t LBM_SLIDER_POINT_IN[];
extern const uint8_t LBM_CARROUSSEL_LEFT[];
extern const uint8_t LBM_CARROUSSEL_RIGHT[];
// Button bitmaps
extern const uint8_t LBM_BUTTON_ON[];
extern const uint8_t LBM_BUTTON_OFF[];
#endif // _BITMAPS_H_
+2 -4
View File
@@ -42,14 +42,12 @@
/* lcd common flags */
#define BLINK 0x01
/* lcd text flags */
/* lcdDrawText flags */
#define INVERS 0x02
#define LEFT 0x08 /* align left */
/* lcd puts flags */
#define ZCHAR 0x04
/* lcd outdez flags */
/* lcdDrawNumber flags */
#define LEADING0 0x10
#define PREC1 0x20
#define PREC2 0x30
+4 -4
View File
@@ -80,8 +80,8 @@ enum menuModelSetupItems {
#define FIELD_PROTOCOL_MAX 1
#define MODEL_SETUP_2ND_COLUMN 200
#define MODEL_SETUP_BIND_OFS 30
#define MODEL_SETUP_RANGE_OFS 60
#define MODEL_SETUP_BIND_OFS 40
#define MODEL_SETUP_RANGE_OFS 80
#define MODEL_SETUP_SET_FAILSAFE_OFS 100
void onModelSetupBitmapMenu(const char *result)
@@ -648,8 +648,8 @@ bool menuModelSetup(evt_t event)
if (attr && l_posHorz==0 && s_editMode>0) {
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], IS_MODULE_DSM2(moduleIdx) ? 20 : 63);
}
drawButton(MODEL_SETUP_2ND_COLUMN+xOffsetBind, y, STR_MODULE_BIND, l_posHorz==1 ? attr : 0);
drawButton(MODEL_SETUP_2ND_COLUMN+MODEL_SETUP_RANGE_OFS+xOffsetBind, y, STR_MODULE_RANGE, l_posHorz==2 ? attr : 0);
drawButton(MODEL_SETUP_2ND_COLUMN+xOffsetBind, y, STR_MODULE_BIND, (moduleFlag[moduleIdx] == MODULE_BIND ? BUTTON_ON : BUTTON_OFF) | (l_posHorz==1 ? attr : 0));
drawButton(MODEL_SETUP_2ND_COLUMN+MODEL_SETUP_RANGE_OFS+xOffsetBind, y, STR_MODULE_RANGE, (moduleFlag[moduleIdx] == MODULE_RANGECHECK ? BUTTON_ON : BUTTON_OFF) | (l_posHorz==2 ? attr : 0));
uint8_t newFlag = 0;
if (attr && l_posHorz>0 && s_editMode>0) {
if (l_posHorz == 1)
+1 -1
View File
@@ -181,7 +181,7 @@ bool menuSetupScreensView(evt_t event)
linesCount++;
}
SUBMENU_WITH_OPTIONS("Main views setup", LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR, { countRegisteredLayouts-1, ORPHAN_ROW, 0, 0, 0, 0 });
SUBMENU_WITH_OPTIONS("Main views setup", LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR, { uint8_t(countRegisteredLayouts-1), ORPHAN_ROW, 0, 0, 0, 0 });
for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i * FH;
+16 -3
View File
@@ -57,9 +57,22 @@ void drawStick(coord_t x, coord_t y, int16_t xval, int16_t yval)
void drawButton(coord_t x, coord_t y, const char * label, LcdFlags attr)
{
int width = getTextWidth(label, 0, attr);
lcdDrawSolidRect(x, y-1, width+16, 20, (attr & INVERS) ? TEXT_INVERTED_BGCOLOR : TEXT_COLOR);
lcdDrawSolidRect(x-1, y-2, width+18, 22, (attr & INVERS) ? TEXT_INVERTED_BGCOLOR : TEXT_COLOR);
lcdDrawText(x+8, y, label, (attr & INVERS) ? TEXT_INVERTED_BGCOLOR : TEXT_COLOR);
int padding = 0;
if (attr & (BUTTON_OFF|BUTTON_ON)) {
padding = 5;
}
lcdDrawSolidRect(x-1, y-1, padding+width+18+padding, 20, TEXT_COLOR);
if (attr & INVERS) {
lcdDrawSolidFilledRect(x, y, padding+width+16+padding, 18, TEXT_INVERTED_BGCOLOR);
lcdDrawText(x+padding+8, y, label, TEXT_INVERTED_COLOR);
}
else {
lcdDrawText(x+padding+8, y, label, TEXT_COLOR);
}
if (attr & BUTTON_OFF)
lcdDrawAlphaBitmap(x-6, y+3, LBM_BUTTON_OFF);
else if (attr & BUTTON_ON)
lcdDrawAlphaBitmap(x-6, y+3, LBM_BUTTON_ON);
}
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
+3
View File
@@ -43,6 +43,9 @@
void drawColumnHeader(const char * const * headers, uint8_t index);
void drawTopmenuDatetime();
void drawStick(coord_t x, coord_t y, int16_t xval, int16_t yval);
#define BUTTON_ON 0x10
#define BUTTON_OFF 0x20
void drawButton(coord_t x, coord_t y, const char * label, LcdFlags attr);
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);