comparison 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
comparison
equal deleted inserted replaced
810:e6827fcd7604 811:4c41d9a18c7f
57 #define TAB_BAR_HIGH 5 57 #define TAB_BAR_HIGH 5
58 #define MENU_WDW_HIGH 390 58 #define MENU_WDW_HIGH 390
59 #define KEY_LABEL_HIGH 25 /* Height of the label used for the the user keys */ 59 #define KEY_LABEL_HIGH 25 /* Height of the label used for the the user keys */
60 60
61 #define SLOW_UPDATE_CNT 10 /* Some content shall not be update in short intervals => add prescalar */ 61 #define SLOW_UPDATE_CNT 10 /* Some content shall not be update in short intervals => add prescalar */
62 #define MAXLINES 6
62 63
63 typedef struct 64 typedef struct
64 { 65 {
65 uint32_t StartAddressForPage[MAXPAGES+1]; 66 uint32_t StartAddressForPage[MAXPAGES+1];
66 uint8_t lineMemoryForNavigationForPage[MAXPAGES+1]; 67 uint8_t lineMemoryForNavigationForPage[MAXPAGES+1];
68 uint8_t linesAvailableForPage[MAXPAGES+1]; 69 uint8_t linesAvailableForPage[MAXPAGES+1];
69 uint8_t pagesAvailable; 70 uint8_t pagesAvailable;
70 uint8_t pageCountNumber[MAXPAGES+1]; 71 uint8_t pageCountNumber[MAXPAGES+1];
71 uint8_t pageCountTotal; 72 uint8_t pageCountTotal;
72 uint8_t modeFlipPages; 73 uint8_t modeFlipPages;
73 uint8_t shadowPage[MAXPAGES+1]; /* the page is switch in the context of another page */ 74 uint8_t shadowPage[MAXPAGES+1]; /* the page is switched in the context of another page */
74 uint8_t activeShadow; /* Base page which is used for the shadow */ 75 uint8_t activeShadow; /* Base page which is used for the shadow */
76 uint8_t disableLineMask[MAXPAGES+1]; /* Bitfield used to disable a line. The line is visible but will not be selected by cursor) */
75 } SMenuMemory; 77 } SMenuMemory;
76 78
77 /* Exported variables --------------------------------------------------------*/ 79 /* Exported variables --------------------------------------------------------*/
78 80
79 /* Announced Private variables -----------------------------------------------*/ 81 /* Announced Private variables -----------------------------------------------*/
85 static GFX_DrawCfgScreen tMscreen; 87 static GFX_DrawCfgScreen tMscreen;
86 88
87 static SMenuMemory menu; 89 static SMenuMemory menu;
88 90
89 uint8_t actual_menu_content = MENU_UNDEFINED; 91 uint8_t actual_menu_content = MENU_UNDEFINED;
92
93
94
90 95
91 /* Private function prototypes -----------------------------------------------*/ 96 /* Private function prototypes -----------------------------------------------*/
92 static void draw_tMheader(uint8_t page); 97 static void draw_tMheader(uint8_t page);
93 static void draw_tMcursorDesign(void); 98 static void draw_tMcursorDesign(void);
94 99
147 { 152 {
148 menu.lineMemoryForNavigationForPage[i] = 0; 153 menu.lineMemoryForNavigationForPage[i] = 0;
149 menu.StartAddressForPage[i] = 0; 154 menu.StartAddressForPage[i] = 0;
150 menu.linesAvailableForPage[i] = 0; 155 menu.linesAvailableForPage[i] = 0;
151 menu.shadowPage[i] = 0; 156 menu.shadowPage[i] = 0;
157 menu.disableLineMask[i] = 0;
152 } 158 }
153 159
154 tMscreen.FBStartAdress = 0; 160 tMscreen.FBStartAdress = 0;
155 tMscreen.ImageHeight = 480; 161 tMscreen.ImageHeight = 480;
156 tMscreen.ImageWidth = 800; 162 tMscreen.ImageWidth = 800;
232 actual_menu_content = mode; 238 actual_menu_content = mode;
233 tM_rebuild_pages(); 239 tM_rebuild_pages();
234 } 240 }
235 } 241 }
236 242
243 void disableLine(uint32_t lineId)
244 {
245 SStateList idList;
246
247 get_idSpecificStateList(lineId, &idList);
248
249 if((idList.page < MAXPAGES) && (idList.line < MAXLINES))
250 {
251 menu.disableLineMask[idList.page] |= (1 << idList.line);
252 }
253 }
254
255 void enableLine(uint32_t lineId)
256 {
257 SStateList idList;
258
259 get_idSpecificStateList(lineId, &idList);
260
261 if((idList.page < MAXPAGES) && (idList.line < MAXLINES))
262 {
263 menu.disableLineMask[idList.page] &= ~(1 << idList.line);
264 }
265 }
237 266
238 static void clean_line_actual_page(void) 267 static void clean_line_actual_page(void)
239 { 268 {
240 uint8_t line, page; 269 uint8_t line, page;
241 270
448 477
449 line = menu.lineMemoryForNavigationForPage[page]; 478 line = menu.lineMemoryForNavigationForPage[page];
450 479
451 if(line == 0) 480 if(line == 0)
452 line = 1; 481 line = 1;
482
483 if(menu.disableLineMask[page] & ( 1 << line))
484 {
485 line++;
486 }
453 487
454 if(line > menu.linesAvailableForPage[page]) 488 if(line > menu.linesAvailableForPage[page])
455 line = 1; 489 line = 1;
456 490
457 *pageOuput = page; 491 *pageOuput = page;