mirror of
https://github.com/opentx/opentx.git
synced 2025-07-25 17:25:13 +03:00
Cosmetics
This commit is contained in:
parent
2ce2f082db
commit
aee6daf0d0
10 changed files with 47 additions and 16 deletions
|
@ -281,11 +281,11 @@ void drawStatusLine();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEXT_FILENAME_MAXLEN 40
|
#define TEXT_FILENAME_MAXLEN 40
|
||||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||||
void menuTextView(event_t event);
|
void menuTextView(event_t event);
|
||||||
void pushMenuTextView(const char *filename);
|
void pushMenuTextView(const char *filename);
|
||||||
void pushModelNotes();
|
void pushModelNotes();
|
||||||
void readModelNotes();
|
void readModelNotes();
|
||||||
|
|
||||||
#define LABEL(...) (uint8_t)-1
|
#define LABEL(...) (uint8_t)-1
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,16 @@ void chainMenu(MenuHandlerFunc newMenu);
|
||||||
void pushMenu(MenuHandlerFunc newMenu);
|
void pushMenu(MenuHandlerFunc newMenu);
|
||||||
void popMenu();
|
void popMenu();
|
||||||
|
|
||||||
|
inline bool isRadioMenuDisplayed()
|
||||||
|
{
|
||||||
|
return menuVerticalPositions[0] == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isModelMenuDisplayed()
|
||||||
|
{
|
||||||
|
return menuVerticalPositions[0] == 0;
|
||||||
|
}
|
||||||
|
|
||||||
inline MenuHandlerFunc lastPopMenu()
|
inline MenuHandlerFunc lastPopMenu()
|
||||||
{
|
{
|
||||||
return menuHandlers[menuLevel+1];
|
return menuHandlers[menuLevel+1];
|
||||||
|
|
|
@ -428,7 +428,7 @@ void menuModelSetup(event_t event)
|
||||||
NUM_STICKS + NUM_POTS + NUM_SLIDERS + NUM_ROTARY_ENCODERS - 1, // Center beeps
|
NUM_STICKS + NUM_POTS + NUM_SLIDERS + NUM_ROTARY_ENCODERS - 1, // Center beeps
|
||||||
0, // Global functions
|
0, // Global functions
|
||||||
|
|
||||||
isDefaultModelRegistrationID() ? HIDDEN_ROW : READONLY_ROW, // Registration ID
|
READONLY_ROW, // Registration ID
|
||||||
|
|
||||||
LABEL(InternalModule),
|
LABEL(InternalModule),
|
||||||
INTERNAL_MODULE_MODE_ROWS, // module mode (PXX(2) / None)
|
INTERNAL_MODULE_MODE_ROWS, // module mode (PXX(2) / None)
|
||||||
|
@ -1185,7 +1185,11 @@ void menuModelSetup(event_t event)
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
case ITEM_MODEL_REGISTRATION_ID:
|
case ITEM_MODEL_REGISTRATION_ID:
|
||||||
editSingleName(MODEL_SETUP_2ND_COLUMN, y, STR_REG_ID, g_model.modelRegistrationID, sizeof(g_model.modelRegistrationID), event, attr);
|
lcdDrawTextAlignedLeft(y, STR_REG_ID);
|
||||||
|
if (isDefaultModelRegistrationID())
|
||||||
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, "<default>");
|
||||||
|
else
|
||||||
|
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.modelRegistrationID, sizeof(g_model.modelRegistrationID), ZCHAR);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_MODEL_INTERNAL_MODULE_PXX2_MODEL_NUM:
|
case ITEM_MODEL_INTERNAL_MODULE_PXX2_MODEL_NUM:
|
||||||
|
|
|
@ -74,7 +74,7 @@ choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values
|
||||||
{
|
{
|
||||||
drawFieldLabel(x, y, label);
|
drawFieldLabel(x, y, label);
|
||||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||||
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,16 @@ void chainMenu(MenuHandlerFunc newMenu);
|
||||||
void pushMenu(MenuHandlerFunc newMenu);
|
void pushMenu(MenuHandlerFunc newMenu);
|
||||||
void popMenu();
|
void popMenu();
|
||||||
|
|
||||||
|
inline bool isRadioMenuDisplayed()
|
||||||
|
{
|
||||||
|
return menuVerticalPositions[0] == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isModelMenuDisplayed()
|
||||||
|
{
|
||||||
|
return menuVerticalPositions[0] == 0;
|
||||||
|
}
|
||||||
|
|
||||||
void onMainViewMenu(const char * result);
|
void onMainViewMenu(const char * result);
|
||||||
|
|
||||||
void menuFirstCalib(event_t event);
|
void menuFirstCalib(event_t event);
|
||||||
|
|
|
@ -134,7 +134,7 @@ choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values
|
||||||
{
|
{
|
||||||
drawFieldLabel(x, y, label);
|
drawFieldLabel(x, y, label);
|
||||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||||
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||||
v = zchar2char(v);
|
v = zchar2char(v);
|
||||||
}
|
}
|
||||||
name[editNameCursorPos] = v;
|
name[editNameCursorPos] = v;
|
||||||
storageDirty(menuVerticalPositions[0] == 0 ? EE_MODEL : EE_GENERAL);
|
storageDirty(isModelMenuDisplayed() ? EE_MODEL : EE_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdDrawSizedText(x, y, name, size, flags);
|
lcdDrawSizedText(x, y, name, size, flags);
|
||||||
|
|
|
@ -48,13 +48,20 @@ extern uint8_t menuVerticalPositions[4];
|
||||||
extern uint8_t menuLevel;
|
extern uint8_t menuLevel;
|
||||||
extern event_t menuEvent;
|
extern event_t menuEvent;
|
||||||
|
|
||||||
/// goto given Menu, but substitute current menu in menuStack
|
|
||||||
void chainMenu(MenuHandlerFunc newMenu);
|
void chainMenu(MenuHandlerFunc newMenu);
|
||||||
/// goto given Menu, store current menu in menuStack
|
|
||||||
void pushMenu(MenuHandlerFunc newMenu);
|
void pushMenu(MenuHandlerFunc newMenu);
|
||||||
/// return to last menu in menuStack
|
|
||||||
void popMenu();
|
void popMenu();
|
||||||
|
|
||||||
|
inline bool isRadioMenuDisplayed()
|
||||||
|
{
|
||||||
|
return menuVerticalPositions[0] == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isModelMenuDisplayed()
|
||||||
|
{
|
||||||
|
return menuVerticalPositions[0] == 0;
|
||||||
|
}
|
||||||
|
|
||||||
enum MenuIcons {
|
enum MenuIcons {
|
||||||
ICON_OPENTX,
|
ICON_OPENTX,
|
||||||
ICON_RADIO,
|
ICON_RADIO,
|
||||||
|
|
|
@ -46,7 +46,7 @@ void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags
|
||||||
|
|
||||||
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags attr, event_t event)
|
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags attr, event_t event)
|
||||||
{
|
{
|
||||||
if (attr & INVERS) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
if (attr & INVERS) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||||
else
|
else
|
||||||
mode = FIXEDWIDTH;
|
mode = FIXEDWIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdDrawSizedText(x, y, name, size, attr | mode);
|
lcdDrawSizedText(x, y, name, size, attr | mode);
|
||||||
coord_t backupNextPos = lcdNextPos;
|
coord_t backupNextPos = lcdNextPos;
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||||
|
|
||||||
if (c != v) {
|
if (c != v) {
|
||||||
name[cur] = v;
|
name[cur] = v;
|
||||||
storageDirty(menuVerticalPositions[0] == 0 ? EE_MODEL : EE_GENERAL);
|
storageDirty(isModelMenuDisplayed() ? EE_MODEL : EE_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr == ZCHAR) {
|
if (attr == ZCHAR) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue