Re #2469: part1: Menu system renaming of variables and refactoring (ported #3087 from master commits 3186a5d99..94d8b8b0e8d)

This commit is contained in:
Damjan Adamic
2015-11-26 18:29:20 +01:00
parent ab99740e1b
commit 51b8f9b054
96 changed files with 2150 additions and 2167 deletions
+26 -26
View File
@@ -98,15 +98,15 @@ bool moveCurve(uint8_t index, int8_t shift)
void displayPresetChoice(uint8_t event)
{
displayWarning(event);
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*s_warning_input_value/4, LEFT|INVERS);
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS);
lcdDrawChar(lcdLastPos, WARNING_LINE_Y, '@', INVERS);
if (s_warning_result) {
s_warning_result = 0;
if (warningResult) {
warningResult = 0;
CurveInfo & crv = g_model.curves[s_curveChan];
int8_t * points = curveAddress(s_curveChan);
for (uint8_t i=0; i<5+crv.points; i++)
points[i] = (i-((5+crv.points)/2)) * s_warning_input_value * 50 / (4+crv.points);
points[i] = (i-((5+crv.points)/2)) * warningInputValue * 50 / (4+crv.points);
if (crv.type == CURVE_TYPE_CUSTOM) {
for (int i=0; i<3+crv.points; i++)
points[crv.points+i] = -100 + ((i+1)*200) / (4+crv.points);
@@ -150,9 +150,9 @@ void menuModelCurveOne(uint8_t event)
lcdDrawNumber(PSIZE(TR_MENUCURVE)*FW+1, 0, s_curveChan+1, INVERS|LEFT);
lcd_putsLeft(FH+1, STR_NAME);
editName(INDENT_WIDTH, 2*FH+1, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==0);
editName(INDENT_WIDTH, 2*FH+1, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, menuVerticalPosition==0);
uint8_t attr = (m_posVert==1 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
uint8_t attr = (menuVerticalPosition==1 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
lcd_putsLeft(3*FH+1, STR_TYPE);
lcdDrawTextAtIndex(INDENT_WIDTH, 4*FH+1, STR_CURVE_TYPES, crv.type, attr);
if (attr) {
@@ -169,7 +169,7 @@ void menuModelCurveOne(uint8_t event)
}
}
attr = (m_posVert==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
attr = (menuVerticalPosition==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
lcd_putsLeft(5*FH+1, STR_COUNT);
lcdDrawNumber(INDENT_WIDTH, 6*FH+1, 5+crv.points, LEFT|attr);
lcdDrawText(lcdLastPos, 6*FH+1, STR_PTS, attr);
@@ -192,8 +192,8 @@ void menuModelCurveOne(uint8_t event)
}
lcd_putsLeft(7*FH+1, STR_SMOOTH);
menu_lcd_onoff(7*FW, 7*FH+1, crv.smooth, m_posVert==3 ? INVERS : 0);
if (m_posVert==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
menu_lcd_onoff(7*FW, 7*FH+1, crv.smooth, menuVerticalPosition==3 ? INVERS : 0);
if (menuVerticalPosition==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
switch(event) {
case EVT_ENTRY:
@@ -201,12 +201,12 @@ void menuModelCurveOne(uint8_t event)
SET_SCROLLBAR_X(0);
break;
case EVT_KEY_LONG(KEY_ENTER):
if (m_posVert > 1) {
if (menuVerticalPosition > 1) {
killEvents(event);
MENU_ADD_ITEM(STR_CURVE_PRESET);
MENU_ADD_ITEM(STR_MIRROR);
MENU_ADD_ITEM(STR_CLEAR);
menuHandler = onCurveOneMenu;
POPUP_MENU_ADD_ITEM(STR_CURVE_PRESET);
POPUP_MENU_ADD_ITEM(STR_MIRROR);
POPUP_MENU_ADD_ITEM(STR_CLEAR);
popupMenuHandler = onCurveOneMenu;
}
break;
case EVT_KEY_LONG(KEY_MENU):
@@ -222,12 +222,12 @@ void menuModelCurveOne(uint8_t event)
point_t point = getPoint(i);
uint8_t selectionMode = 0;
if (crv.type==CURVE_TYPE_CUSTOM) {
if (m_posVert==4+2*i || (i==5+crv.points-1 && m_posVert==4+5+crv.points+5+crv.points-2-1))
if (menuVerticalPosition==4+2*i || (i==5+crv.points-1 && menuVerticalPosition==4+5+crv.points+5+crv.points-2-1))
selectionMode = 2;
else if (i>0 && m_posVert==3+2*i)
else if (i>0 && menuVerticalPosition==3+2*i)
selectionMode = 1;
}
else if (m_posVert == 4+i) {
else if (menuVerticalPosition == 4+i) {
selectionMode = 2;
}
@@ -260,23 +260,23 @@ void menuModelCurveOne(uint8_t event)
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t attr)
{
lcdDrawTextAtIndex(x, y, "\004DiffExpoFuncCstm", curve.type, m_posHorz==0 ? attr : 0);
if (attr && m_posHorz==0) {
lcdDrawTextAtIndex(x, y, "\004DiffExpoFuncCstm", curve.type, menuHorizontalPosition==0 ? attr : 0);
if (attr && menuHorizontalPosition==0) {
CHECK_INCDEC_MODELVAR_ZERO(event, curve.type, CURVE_REF_CUSTOM);
if (checkIncDec_Ret) curve.value = 0;
}
switch (curve.type) {
case CURVE_REF_DIFF:
case CURVE_REF_EXPO:
curve.value = GVAR_MENU_ITEM(x+5*FW, y, curve.value, -100, 100, m_posHorz==1 ? LEFT|attr : LEFT, 0, event);
curve.value = GVAR_MENU_ITEM(x+5*FW, y, curve.value, -100, 100, menuHorizontalPosition==1 ? LEFT|attr : LEFT, 0, event);
break;
case CURVE_REF_FUNC:
lcdDrawTextAtIndex(x+5*FW, y, STR_VCURVEFUNC, curve.value, m_posHorz==1 ? attr : 0);
if (attr && m_posHorz==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
lcdDrawTextAtIndex(x+5*FW, y, STR_VCURVEFUNC, curve.value, menuHorizontalPosition==1 ? attr : 0);
if (attr && menuHorizontalPosition==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
break;
case CURVE_REF_CUSTOM:
putsCurve(x+5*FW+2, y, curve.value, m_posHorz==1 ? attr : 0);
if (attr && m_posHorz==1) {
putsCurve(x+5*FW+2, y, curve.value, menuHorizontalPosition==1 ? attr : 0);
if (attr && menuHorizontalPosition==1) {
if (event==EVT_KEY_LONG(KEY_ENTER) && curve.value!=0) {
s_curveChan = (curve.value<0 ? -curve.value-1 : curve.value-1);
pushMenu(menuModelCurveOne);
@@ -293,7 +293,7 @@ void menuModelCurvesAll(uint8_t event)
{
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, MAX_CURVES);
int sub = m_posVert;
int sub = menuVerticalPosition;
switch (event) {
case EVT_KEY_BREAK(KEY_ENTER):
@@ -306,7 +306,7 @@ void menuModelCurvesAll(uint8_t event)
for (int i=0; i<LCD_LINES-1; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
int k = i + s_pgOfs;
int k = i + menuVerticalOffset;
LcdFlags attr = (sub == k ? INVERS : 0);
{
putsStrIdx(0, y, STR_CV, k+1, attr);