[Horus] Menu CurveOne improved
This commit is contained in:
@@ -46,7 +46,7 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
|||||||
|
|
||||||
#if !defined(CPUM64)
|
#if !defined(CPUM64)
|
||||||
#define DEFAULT_SCROLLBAR_X (LCD_W-1)
|
#define DEFAULT_SCROLLBAR_X (LCD_W-1)
|
||||||
void drawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SET_SCROLLBAR_X(x)
|
#define SET_SCROLLBAR_X(x)
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ const char * displayMenu(uint8_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s_menu_count > display_count) {
|
if (s_menu_count > display_count) {
|
||||||
drawScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(event) {
|
switch(event) {
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ void menuTextView(uint8_t event)
|
|||||||
lcd_invert_line(0);
|
lcd_invert_line(0);
|
||||||
|
|
||||||
if (lines_count > LCD_LINES-1) {
|
if (lines_count > LCD_LINES-1) {
|
||||||
drawScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
drawVerticalScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(CPUM64)
|
#if !defined(CPUM64)
|
||||||
void drawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||||
{
|
{
|
||||||
lcdDrawVerticalLine(x, y, h, DOTTED);
|
lcdDrawVerticalLine(x, y, h, DOTTED);
|
||||||
coord_t yofs = (h * offset) / count;
|
coord_t yofs = (h * offset) / count;
|
||||||
|
|||||||
@@ -68,9 +68,13 @@
|
|||||||
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
|
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
|
||||||
#define MENU_INIT_VPOS -1
|
#define MENU_INIT_VPOS -1
|
||||||
|
|
||||||
|
#define MENU_ICONS_SPACING 31
|
||||||
|
#define SUBMENU_LINE_WIDTH 230
|
||||||
|
|
||||||
void displaySplash();
|
void displaySplash();
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count);
|
void displayScreenIndex(uint8_t index, uint8_t count);
|
||||||
void drawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||||
|
void drawHorizontalScrollbar(coord_t x, coord_t y, coord_t w, uint16_t offset, uint16_t count, uint8_t visible);
|
||||||
void drawHeader(int index);
|
void drawHeader(int index);
|
||||||
void drawFooter();
|
void drawFooter();
|
||||||
#define drawStatusLine(...)
|
#define drawStatusLine(...)
|
||||||
|
|||||||
@@ -135,24 +135,35 @@ void onCurveOneMenu(const char *result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MODEL_CURVE_ONE_2ND_COLUMN 130
|
||||||
|
|
||||||
|
enum MenuModelCurveOneItems {
|
||||||
|
ITEM_CURVE_NAME,
|
||||||
|
ITEM_CURVE_TYPE,
|
||||||
|
ITEM_CURVE_POINTS,
|
||||||
|
ITEM_CURVE_SMOOTH,
|
||||||
|
ITEM_CURVE_COORDS1,
|
||||||
|
ITEM_CURVE_COORDS2,
|
||||||
|
};
|
||||||
|
|
||||||
bool menuModelCurveOne(evt_t event)
|
bool menuModelCurveOne(evt_t event)
|
||||||
{
|
{
|
||||||
static uint8_t pointsOfs = 0;
|
static uint8_t pointsOfs = 0;
|
||||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||||
int8_t * points = curveAddress(s_curveChan);
|
int8_t * points = curveAddress(s_curveChan);
|
||||||
|
|
||||||
SIMPLE_SUBMENU(STR_MENUCURVE, 4 + 5+crv.points + (crv.type==CURVE_TYPE_CUSTOM ? 5+crv.points-2 : 0), 0);
|
SUBMENU(STR_MENUCURVE, crv.type==CURVE_TYPE_CUSTOM ? 6 : 5, 0, { 0, 0, 0, 0, uint8_t(5+crv.points-1), uint8_t(5+crv.points-1) });
|
||||||
|
|
||||||
lcdDrawNumber(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+1, s_curveChan+1, LEFT|TEXT_COLOR);
|
lcdDrawNumber(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+1, s_curveChan+1, LEFT|TEXT_COLOR);
|
||||||
|
|
||||||
// Curve name
|
// Curve name
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, STR_NAME);
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, STR_NAME);
|
||||||
editName(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + FH, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==0);
|
editName(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==ITEM_CURVE_NAME);
|
||||||
|
|
||||||
// Curve type
|
// Curve type
|
||||||
LcdFlags attr = (m_posVert==1 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
LcdFlags attr = (m_posVert==ITEM_CURVE_TYPE ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, "Type");
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, "Type");
|
||||||
lcdDrawTextAtIndex(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + 3*FH, STR_CURVE_TYPES, crv.type, attr);
|
lcdDrawTextAtIndex(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP + FH, STR_CURVE_TYPES, crv.type, attr);
|
||||||
if (attr) {
|
if (attr) {
|
||||||
uint8_t newType = checkIncDecModelZero(event, crv.type, CURVE_TYPE_LAST);
|
uint8_t newType = checkIncDecModelZero(event, crv.type, CURVE_TYPE_LAST);
|
||||||
if (newType != crv.type) {
|
if (newType != crv.type) {
|
||||||
@@ -168,9 +179,9 @@ bool menuModelCurveOne(evt_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Curve points count
|
// Curve points count
|
||||||
attr = (m_posVert==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
attr = (m_posVert==ITEM_CURVE_POINTS ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, STR_COUNT);
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, STR_COUNT);
|
||||||
lcdDrawNumber(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + 5*FH, 5+crv.points, LEFT|attr, 0, NULL, STR_PTS);
|
lcdDrawNumber(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP + 2*FH, 5+crv.points, LEFT|attr, 0, NULL, STR_PTS);
|
||||||
if (attr) {
|
if (attr) {
|
||||||
int count = checkIncDecModel(event, crv.points, -3, 12); // 2pts - 17pts
|
int count = checkIncDecModel(event, crv.points, -3, 12); // 2pts - 17pts
|
||||||
if (checkIncDec_Ret) {
|
if (checkIncDec_Ret) {
|
||||||
@@ -190,16 +201,16 @@ bool menuModelCurveOne(evt_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Curve smooth
|
// Curve smooth
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 6*FH, STR_SMOOTH);
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, STR_SMOOTH);
|
||||||
drawCheckBox(lcdNextPos + 10, MENU_CONTENT_TOP + 6*FH, crv.smooth, m_posVert==3 ? INVERS : 0);
|
drawCheckBox(MODEL_CURVE_ONE_2ND_COLUMN, MENU_CONTENT_TOP + 3*FH, crv.smooth, m_posVert==ITEM_CURVE_SMOOTH ? INVERS : 0);
|
||||||
if (m_posVert==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
|
if (m_posVert==ITEM_CURVE_SMOOTH) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
|
||||||
|
|
||||||
switch(event) {
|
switch(event) {
|
||||||
case EVT_ENTRY:
|
case EVT_ENTRY:
|
||||||
pointsOfs = 0;
|
pointsOfs = 0;
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
if (m_posVert > 1) {
|
if (m_posVert > ITEM_CURVE_POINTS) {
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
MENU_ADD_ITEM(STR_CURVE_PRESET);
|
MENU_ADD_ITEM(STR_CURVE_PRESET);
|
||||||
MENU_ADD_ITEM(STR_MIRROR);
|
MENU_ADD_ITEM(STR_MIRROR);
|
||||||
@@ -212,35 +223,30 @@ bool menuModelCurveOne(evt_t event)
|
|||||||
killEvents(event);
|
killEvents(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_posVert >= 0) {
|
DrawCurve();
|
||||||
DrawCurve();
|
drawCurveHorizontalScale();
|
||||||
drawCurveHorizontalScale();
|
if (m_posVert < ITEM_CURVE_COORDS1) drawCurveVerticalScale(CURVE_CENTER_X-CURVE_SIDE_WIDTH-15);
|
||||||
if (m_posVert < 4) drawCurveVerticalScale(CURVE_CENTER_X-CURVE_SIDE_WIDTH-15);
|
|
||||||
}
|
|
||||||
|
|
||||||
coord_t posY = MENU_CONTENT_TOP;
|
coord_t posX = 47;
|
||||||
attr = (s_editMode > 0 ? INVERS|BLINK : INVERS);
|
attr = (s_editMode > 0 ? INVERS|BLINK : INVERS);
|
||||||
for (int i=0; i<5+crv.points; i++) {
|
for (int i=0; i<5+crv.points; i++) {
|
||||||
point_t point = getPoint(i);
|
point_t point = getPoint(i);
|
||||||
uint8_t selectionMode = 0;
|
uint8_t selectionMode = 0;
|
||||||
if (crv.type==CURVE_TYPE_CUSTOM) {
|
if (m_posHorz == i) {
|
||||||
if (m_posVert==4+2*i || (i==5+crv.points-1 && m_posVert==4+5+crv.points+5+crv.points-2-1))
|
if (m_posVert == ITEM_CURVE_COORDS2)
|
||||||
selectionMode = 2;
|
selectionMode = 2;
|
||||||
else if (i>0 && m_posVert==3+2*i)
|
else if (m_posVert == ITEM_CURVE_COORDS1)
|
||||||
selectionMode = 1;
|
selectionMode = 1;
|
||||||
}
|
}
|
||||||
else if (m_posVert == 4+i) {
|
|
||||||
selectionMode = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
int8_t x = -100 + 200*i/(5+crv.points-1);
|
int8_t x = -100 + 200*i/(5+crv.points-1);
|
||||||
if (crv.type==CURVE_TYPE_CUSTOM && i>0 && i<5+crv.points-1) x = points[5+crv.points+i-1];
|
if (crv.type==CURVE_TYPE_CUSTOM && i>0 && i<5+crv.points-1) x = points[5+crv.points+i-1];
|
||||||
|
|
||||||
if (i>=pointsOfs && i<pointsOfs+NUM_BODY_LINES) {
|
if (i>=pointsOfs && i<pointsOfs+5) {
|
||||||
lcdDrawNumber(120, posY, i+1, LEFT|TEXT_DISABLE_COLOR);
|
lcdDrawNumber(posX, MENU_CONTENT_TOP + 5*FH, i+1, TEXT_DISABLE_COLOR);
|
||||||
lcdDrawNumber(150, posY, x, LEFT|(selectionMode==1 ? attr : 0));
|
lcdDrawNumber(posX, MENU_CONTENT_TOP + 6*FH+2, x, (selectionMode==1 ? attr : 0));
|
||||||
lcdDrawNumber(200, posY, points[i], LEFT|(selectionMode==2 ? attr : 0));
|
lcdDrawNumber(posX, MENU_CONTENT_TOP + 7*FH+6, points[i], (selectionMode==2 ? attr : 0));
|
||||||
posY += FH;
|
posX += 45;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectionMode > 0) {
|
if (selectionMode > 0) {
|
||||||
@@ -281,15 +287,17 @@ bool menuModelCurveOne(evt_t event)
|
|||||||
}
|
}
|
||||||
if (i < pointsOfs)
|
if (i < pointsOfs)
|
||||||
pointsOfs = i;
|
pointsOfs = i;
|
||||||
else if (i > pointsOfs+NUM_BODY_LINES-1)
|
else if (i > pointsOfs+5-1)
|
||||||
pointsOfs = i-NUM_BODY_LINES+1;
|
pointsOfs = i-5+1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawCurvePoint(point.x-3, point.y-4, TEXT_COLOR);
|
drawCurvePoint(point.x-3, point.y-4, TEXT_COLOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drawScrollbar(240, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H+MENU_FOOTER_HEIGHT, pointsOfs, 5+crv.points, NUM_BODY_LINES+1);
|
lcdDrawHorizontalLine(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 6*FH - 1, SUBMENU_LINE_WIDTH, DOTTED, CURVE_AXIS_COLOR);
|
||||||
|
lcdDrawHorizontalLine(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 7*FH + 2, SUBMENU_LINE_WIDTH, DOTTED, CURVE_AXIS_COLOR);
|
||||||
|
drawHorizontalScrollbar(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 9*FH - 1, SUBMENU_LINE_WIDTH, pointsOfs, 5+crv.points, 5);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ bool menuModelSelect(evt_t event)
|
|||||||
putEvent(EVT_REFRESH);
|
putEvent(EVT_REFRESH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawScrollbar(DEFAULT_SCROLLBAR_X, MENU_HEADER_HEIGHT+7, MENU_FOOTER_TOP-MENU_HEADER_HEIGHT-15, s_pgOfs, (index+1)/2, 3);
|
drawVerticalScrollbar(DEFAULT_SCROLLBAR_X, MENU_HEADER_HEIGHT+7, MENU_FOOTER_TOP-MENU_HEADER_HEIGHT-15, s_pgOfs, (index+1)/2, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ const char * displayMenu(evt_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s_menu_count > display_count) {
|
if (s_menu_count > display_count) {
|
||||||
drawScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ bool menuTextView(evt_t event)
|
|||||||
#endif
|
#endif
|
||||||
lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
|
lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
|
||||||
|
|
||||||
drawScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, s_pgOfs, lines_count, NUM_BODY_LINES);
|
drawVerticalScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, s_pgOfs, lines_count, NUM_BODY_LINES);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||||
{
|
{
|
||||||
if (visible < count) {
|
if (visible < count) {
|
||||||
lcdDrawSolidVerticalLine(x, y, h, LINE_COLOR);
|
lcdDrawSolidVerticalLine(x, y, h, LINE_COLOR);
|
||||||
@@ -116,6 +116,18 @@ void drawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawHorizontalScrollbar(coord_t x, coord_t y, coord_t w, uint16_t offset, uint16_t count, uint8_t visible)
|
||||||
|
{
|
||||||
|
if (visible < count) {
|
||||||
|
lcdDrawSolidHorizontalLine(x, y, w, LINE_COLOR);
|
||||||
|
coord_t xofs = (w*offset + count/2) / count;
|
||||||
|
coord_t xhgt = (w*visible + count/2) / count;
|
||||||
|
if (xhgt + xofs > w)
|
||||||
|
xhgt = w - xofs;
|
||||||
|
lcdDrawSolidFilledRect(x+xofs, y-1, xhgt, 3, SCROLLBOX_COLOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void drawProgressBar(const char *label)
|
void drawProgressBar(const char *label)
|
||||||
{
|
{
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, 4*FH, label);
|
lcdDrawText(MENUS_MARGIN_LEFT, 4*FH, label);
|
||||||
@@ -161,8 +173,6 @@ void drawScreenTemplate(const char * title)
|
|||||||
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MENU_ICONS_SPACING 31
|
|
||||||
|
|
||||||
void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X)
|
void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||||
{
|
{
|
||||||
// clear the screen
|
// clear the screen
|
||||||
@@ -187,11 +197,11 @@ void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X)
|
|||||||
if (name) {
|
if (name) {
|
||||||
// must be done at the end so that we can write something at the right of the menu title
|
// must be done at the end so that we can write something at the right of the menu title
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP+1, name, TEXT_COLOR);
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP+1, name, TEXT_COLOR);
|
||||||
lcdDrawSolidFilledRect(MENUS_MARGIN_LEFT-4, MENU_TITLE_TOP+19, 220, 2, TITLE_BGCOLOR);
|
lcdDrawSolidFilledRect(MENUS_MARGIN_LEFT-4, MENU_TITLE_TOP+20, SUBMENU_LINE_WIDTH, 2, TITLE_BGCOLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollbar_X && linesCount > NUM_BODY_LINES+1) {
|
if (scrollbar_X && linesCount > NUM_BODY_LINES+1) {
|
||||||
drawScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H+MENU_FOOTER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES+1);
|
drawVerticalScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H+MENU_FOOTER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +245,7 @@ void drawMenuTemplate(const char * name, uint16_t scrollbar_X)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
||||||
drawScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, s_pgOfs, linesCount, NUM_BODY_LINES);
|
drawVerticalScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ struct MenuItem {
|
|||||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
||||||
void displaySplash();
|
void displaySplash();
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||||
void drawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||||
void displayMenuBar(const MenuItem *menu, int index);
|
void displayMenuBar(const MenuItem *menu, int index);
|
||||||
void drawProgressBar(const char *label);
|
void drawProgressBar(const char *label);
|
||||||
void updateProgressBar(int num, int den);
|
void updateProgressBar(int num, int den);
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
||||||
drawScrollbar(scrollbar_X, MENU_HEADER_HEIGHT, LCD_H-MENU_HEADER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
drawVerticalScrollbar(scrollbar_X, MENU_HEADER_HEIGHT, LCD_H-MENU_HEADER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ const char * displayMenu(uint8_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s_menu_count > display_count) {
|
if (s_menu_count > display_count) {
|
||||||
drawScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), s_menu_offset, s_menu_count, display_count);
|
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), s_menu_offset, s_menu_count, display_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(event) {
|
switch(event) {
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void menuTextView(uint8_t event)
|
|||||||
lcd_invert_line(0);
|
lcd_invert_line(0);
|
||||||
|
|
||||||
if (lines_count > LCD_LINES-1) {
|
if (lines_count > LCD_LINES-1) {
|
||||||
drawScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
drawVerticalScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
|||||||
lcd_outdezAtt(x, 0, index+1, attr);
|
lcd_outdezAtt(x, 0, index+1, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||||
{
|
{
|
||||||
lcdDrawVerticalLine(x, y, h, DOTTED);
|
lcdDrawVerticalLine(x, y, h, DOTTED);
|
||||||
coord_t yofs = (h * offset) / count;
|
coord_t yofs = (h * offset) / count;
|
||||||
|
|||||||
Reference in New Issue
Block a user