Issue #2806 fix start

This commit is contained in:
Bertrand Songis
2015-09-02 19:32:41 +02:00
parent f7c9da6826
commit 2274e6395d
+52 -27
View File
@@ -629,37 +629,62 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
} }
#if defined(CPUARM) #if defined(CPUARM)
if (l_posVert<1) { int linesCount = maxrow;
s_pgOfs=0;
} if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
else if (menuTab && horTab) { s_pgOfs = 0;
vertpos_t realPosVert = l_posVert; if (horTab) {
vertpos_t realPgOfs = s_pgOfs; linesCount = 0;
vertpos_t realMaxrow = maxrow; for (int i=0; i<maxrow; i++) {
for (vertpos_t i=1; i<=maxrow; i++) { if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
if (MAXCOL(i) == HIDDEN_ROW) { linesCount++;
realMaxrow--; }
if (i < l_posVert) }
realPosVert--;
if (i < s_pgOfs)
realPgOfs--;
} }
} }
if (realPosVert>(LCD_LINES-1)+realPgOfs) realPgOfs = realPosVert-(LCD_LINES-1); else if (horTab) {
else if (realPosVert<1+realPgOfs) realPgOfs = realPosVert-1; if (maxrow > NUM_BODY_LINES) {
s_pgOfs = realPgOfs; while (1) {
for (vertpos_t i=1; i<=realPgOfs; i++) { vertpos_t firstLine = 0;
if (MAXCOL(i) == HIDDEN_ROW) { for (int numLines=0; firstLine<maxrow && numLines<s_pgOfs; firstLine++) {
s_pgOfs++; if (firstLine>=horTabMax || horTab[firstLine+1] != HIDDEN_ROW) {
numLines++;
}
}
if (l_posVert <= firstLine) {
s_pgOfs--;
}
else {
vertpos_t lastLine = firstLine;
for (int numLines=0; lastLine<maxrow && numLines<NUM_BODY_LINES; lastLine++) {
if (lastLine>=horTabMax || horTab[lastLine+1] != HIDDEN_ROW) {
numLines++;
}
}
if (l_posVert > lastLine) {
s_pgOfs++;
}
else {
linesCount = s_pgOfs + NUM_BODY_LINES;
for (int i=lastLine; i<maxrow; i++) {
if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
linesCount++;
}
}
break;
}
}
}
}
}
else {
if (l_posVert>NUM_BODY_LINES+s_pgOfs) {
s_pgOfs = l_posVert-NUM_BODY_LINES;
}
else if (l_posVert<=s_pgOfs) {
s_pgOfs = l_posVert-1;
} }
} }
maxrow = realMaxrow;
}
else {
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max;
else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1;
}
#else #else
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2; uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
if (l_posVert<1) s_pgOfs=0; if (l_posVert<1) s_pgOfs=0;