Mercurial > public > ostc4
diff Discovery/Src/tMenu.c @ 811:4c41d9a18c7f
Added function to skip lines which are not needed for operation:
It was not possible in the previous version to skip lines in the top level menu view which were not used for operation. In the past context sensitive menus as well as layout changes have been introduced which cause the cursor to be placed on lines without function.
To avoid this it is not possible to mark a line as not in use by enabling / disabling it by the individual meni Id.
author | Ideenmodellierer |
---|---|
date | Sun, 27 Aug 2023 20:59:12 +0200 |
parents | 4abfb8a2a435 |
children | ce8f71217f45 |
line wrap: on
line diff
--- a/Discovery/Src/tMenu.c Sun Aug 27 20:55:57 2023 +0200 +++ b/Discovery/Src/tMenu.c Sun Aug 27 20:59:12 2023 +0200 @@ -59,6 +59,7 @@ #define KEY_LABEL_HIGH 25 /* Height of the label used for the the user keys */ #define SLOW_UPDATE_CNT 10 /* Some content shall not be update in short intervals => add prescalar */ +#define MAXLINES 6 typedef struct { @@ -70,8 +71,9 @@ uint8_t pageCountNumber[MAXPAGES+1]; uint8_t pageCountTotal; uint8_t modeFlipPages; - uint8_t shadowPage[MAXPAGES+1]; /* the page is switch in the context of another page */ - uint8_t activeShadow; /* Base page which is used for the shadow */ + uint8_t shadowPage[MAXPAGES+1]; /* the page is switched in the context of another page */ + uint8_t activeShadow; /* Base page which is used for the shadow */ + uint8_t disableLineMask[MAXPAGES+1]; /* Bitfield used to disable a line. The line is visible but will not be selected by cursor) */ } SMenuMemory; /* Exported variables --------------------------------------------------------*/ @@ -88,6 +90,9 @@ uint8_t actual_menu_content = MENU_UNDEFINED; + + + /* Private function prototypes -----------------------------------------------*/ static void draw_tMheader(uint8_t page); static void draw_tMcursorDesign(void); @@ -149,6 +154,7 @@ menu.StartAddressForPage[i] = 0; menu.linesAvailableForPage[i] = 0; menu.shadowPage[i] = 0; + menu.disableLineMask[i] = 0; } tMscreen.FBStartAdress = 0; @@ -234,6 +240,29 @@ } } +void disableLine(uint32_t lineId) +{ + SStateList idList; + + get_idSpecificStateList(lineId, &idList); + + if((idList.page < MAXPAGES) && (idList.line < MAXLINES)) + { + menu.disableLineMask[idList.page] |= (1 << idList.line); + } +} + +void enableLine(uint32_t lineId) +{ + SStateList idList; + + get_idSpecificStateList(lineId, &idList); + + if((idList.page < MAXPAGES) && (idList.line < MAXLINES)) + { + menu.disableLineMask[idList.page] &= ~(1 << idList.line); + } +} static void clean_line_actual_page(void) { @@ -451,6 +480,11 @@ if(line == 0) line = 1; + if(menu.disableLineMask[page] & ( 1 << line)) + { + line++; + } + if(line > menu.linesAvailableForPage[page]) line = 1;