Mercurial > public > ostc4
annotate Discovery/Src/tMenuEdit.c @ 760:21949c88da90
Quit simualted dives after the dive time set in the SIM tab.
author | heinrichsweikamp |
---|---|
date | Tue, 21 Mar 2023 12:56:54 +0100 |
parents | 190e5814b2f5 |
children | 6169309d6eb9 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEdit.c | |
5 /// \brief Main Template file for Menu Setting Modifications | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 04-July-2014 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "tMenuEdit.h" | |
31 | |
32 #include "externLogbookFlash.h" | |
33 #include "gfx_fonts.h" | |
34 #include "tHome.h" | |
35 #include "tInfoCompass.h" | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
36 #include "tInfoSensor.h" |
38 | 37 #include "tMenuEditHardware.h" |
38 #include "tMenuEditPlanner.h" | |
39 #include "tMenuEditSystem.h" | |
40 #include "tMenuEditXtra.h" | |
508 | 41 #include "tMenuEditCustom.h" |
38 | 42 |
43 /* Private types -------------------------------------------------------------*/ | |
44 #define TEXTSIZE 16 | |
45 | |
46 typedef struct | |
47 { | |
48 uint32_t pEventFunction; | |
49 uint32_t callerID; | |
50 } SEventHandler; | |
51 | |
52 typedef struct | |
53 { | |
54 uint32_t pEventFunction; | |
55 uint8_t functionParameter; | |
56 uint8_t line; | |
57 } SBackMenuHandler; | |
58 | |
59 typedef struct | |
60 { | |
61 char orgText[32]; | |
62 char newText[32]; | |
63 uint16_t input[4]; | |
64 uint16_t coord[3]; | |
65 int8_t begin[4], size[4]; | |
66 tFont *fontUsed; | |
67 uint32_t callerID; | |
68 uint8_t maintype; | |
69 uint8_t subtype; | |
70 } SEditIdent; | |
71 | |
72 typedef enum | |
73 { | |
74 FIELD_NUMBERS = 0, | |
75 FIELD_BUTTON, | |
76 FIELD_SELECT, | |
77 FIELD_SYMBOL, | |
78 FIELD_TOGGLE, | |
79 FIELD_ON_OFF, | |
80 FIELD_UDIGIT, | |
81 FIELD_2DIGIT, | |
82 FIELD_3DIGIT, | |
83 FIELD_FLOAT, | |
84 FIELD_END | |
85 } SField; | |
86 | |
87 /* Private variables ---------------------------------------------------------*/ | |
88 GFX_DrawCfgScreen tMEscreen; | |
89 GFX_DrawCfgScreen tMEcursor; | |
90 GFX_DrawCfgScreen tMEcursorNew; | |
91 | |
508 | 92 static uint32_t menuID; |
93 static uint8_t menuColor; | |
38 | 94 |
508 | 95 static int8_t id = 0; |
96 static int8_t idLast = -1; | |
97 static SEditIdent ident[10]; | |
98 static int8_t tME_stop = 0; | |
38 | 99 |
508 | 100 static int8_t evid = 0; |
101 static int8_t evidLast = -1; | |
102 static SEventHandler event[10]; | |
38 | 103 |
508 | 104 static SBackMenuHandler backmenu; |
38 | 105 |
508 | 106 static int8_t block = 0; |
107 static int8_t subBlockPosition = 0; | |
38 | 108 |
508 | 109 static _Bool EnterPressedBeforeButtonAction = 0; |
110 static _Bool EnterPressed = 0; | |
38 | 111 |
508 | 112 static _Bool WriteSettings = 0; |
38 | 113 |
114 /* Private function prototypes -----------------------------------------------*/ | |
115 void draw_tMEdesign(void); | |
116 void set_cursorNew(uint8_t forThisIdentID); | |
117 void startMenuEditFieldSelect(void); | |
118 void create_newText_for_actual_Id(void); | |
119 void write_content_of_actual_Id(void); | |
120 void clean_content_of_actual_Id(void); | |
121 void write_content_without_Id(void); | |
122 | |
123 void nextMenuEditFieldDigit(void); | |
124 void upMenuEditFieldDigit(void); | |
125 void downMenuEditFieldDigit(void); | |
126 | |
127 void draw_tMEcursorNewDesign(void); | |
128 | |
129 void exitMenuEdit(uint8_t writeSettingsIfEnterPressed); | |
130 uint8_t split_Content_to_Digit_helper(uint8_t inContentAscii, uint8_t *outDigit100, uint8_t *outDigit10, uint8_t *outDigit1); | |
131 | |
132 /* Exported functions --------------------------------------------------------*/ | |
133 | |
134 void tMenuEdit_init(void) | |
135 { | |
136 tMEcursor.FBStartAdress = getFrame(7); | |
137 tMEcursor.ImageHeight = 480; | |
138 tMEcursor.ImageWidth = 800; | |
139 tMEcursor.LayerIndex = 0; | |
140 | |
141 GFX_fill_buffer(tMEcursor.FBStartAdress, 0xFF, CLUT_MenuEditCursor); | |
142 | |
143 tMEcursorNew.FBStartAdress = getFrame(8); | |
144 tMEcursorNew.ImageHeight = 390; | |
145 tMEcursorNew.ImageWidth = 800; | |
146 tMEcursorNew.LayerIndex = 0; | |
147 | |
148 draw_tMEcursorNewDesign(); | |
149 } | |
150 | |
151 void stop_cursor_fields(void) | |
152 { | |
153 tME_stop = 1; | |
154 } | |
155 | |
156 void resetMenuEdit(uint8_t color) | |
157 { | |
158 id = 0; | |
159 idLast = -1; | |
160 evid = 0; | |
161 evidLast = -1; | |
162 tME_stop = 0; | |
163 EnterPressed = 0; | |
164 EnterPressedBeforeButtonAction = 0; | |
165 | |
166 setBackMenu(0,0,0); | |
167 | |
168 releaseFrame(9,tMEscreen.FBStartAdress); | |
169 | |
170 tMEscreen.FBStartAdress = getFrame(9); | |
171 tMEscreen.ImageHeight = 480; | |
172 tMEscreen.ImageWidth = 800; | |
173 tMEscreen.LayerIndex = 1; | |
174 | |
175 /* | |
176 write_content_simple(&tMEscreen, 0, 38, 0, &Awe48,"x",CLUT_ButtonSymbols); | |
177 write_content_simple(&tMEscreen, 800-46, 800, 0, &Awe48,"u",CLUT_ButtonSymbols); | |
178 write_content_simple(&tMEscreen, 0, 45, 480-45, &Awe48,"d",CLUT_ButtonSymbols); | |
179 write_content_simple(&tMEscreen, 800-48, 800, 480-45, &Awe48,"e",CLUT_ButtonSymbols); | |
180 */ | |
181 menuID = get_globalState(); | |
182 | |
183 menuColor = color; | |
184 | |
185 // draw_tMEdesign(); | |
186 // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, tMEcursor.FBStartAdress,480); | |
187 uint8_t line = 1; | |
188 // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, (tMEcursorNew.FBStartAdress) + 65*2*(line - 1),390); | |
189 GFX_SetFrameTop(tMEscreen.FBStartAdress); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
190 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
191 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
192 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
193 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
194 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
195 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
196 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(line)) *2, 0, 480-390-25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
197 } |
38 | 198 } |
199 | |
200 | |
201 void tMenuEdit_refresh_live_content(void) | |
202 { | |
508 | 203 uint32_t globState = get_globalState(); |
204 void (*refreshFct)() = NULL; | |
38 | 205 |
508 | 206 |
207 switch(globState) | |
208 { | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
209 case (StMHARD3_O2_Sensor1): |
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
552
diff
changeset
|
210 case (StMHARD3_O2_Sensor1 & MaskFieldDigit): |
584 | 211 case (StMHARD3_O2_Calibrate): |
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
718
diff
changeset
|
212 case (StMHARD3_Sensor_Detect): |
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
718
diff
changeset
|
213 case (StMHARD3_Sensor_Info): refreshFct = refresh_O2Sensors; |
508 | 214 break; |
215 case (StMHARD2_Compass_SetCourse & MaskFieldDigit): refreshFct = refresh_CompassEdit; | |
216 break; | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
217 /* case (StMXTRA_CompassHeading & MaskFieldDigit): StMXTRA_CompassHeading and StMXTRA_PSCR_O2_Drop share the same menu ID => select function based on divemode */ |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
218 case (StMXTRA_PSCR_O2_Drop & MaskFieldDigit): |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
219 if(actual_menu_content == MENU_SURFACE) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
220 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
221 if(settingsGetPointer()->dive_mode != DIVEMODE_PSCR) /* workaround because PSCR mode is set dynamic */ |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
222 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
223 refreshFct = refresh_CO2Data; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
224 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
225 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
226 else |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
227 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
228 refreshFct = refresh_CompassHeading; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
229 } |
662 | 230 break; |
231 case (StMXTRA_CO2_Sensor & MaskFieldDigit): refreshFct = refresh_CO2Data; | |
232 break; | |
520 | 233 case (StMSYS4_Info & MaskFieldDigit): refreshFct = &refresh_InformationPage; |
508 | 234 break; |
235 case (StMPLAN5_ExitResult & MaskFieldDigit): refreshFct = refresh_PlanResult; | |
236 break; | |
237 case (StMHARD5_Button1 & MaskFieldDigit): // will not be executed in EditFieldMode as global state is different | |
238 refreshFct = refresh_ButtonValuesFromPIC; | |
239 break; | |
240 case (StMSYS3_Units & MaskFieldDigit): refreshFct = refresh_Design; | |
241 break; | |
520 | 242 case (StMCustom1_CViewTimeout & MaskFieldDigit):refreshFct = refresh_Customviews; |
508 | 243 break; |
531 | 244 case (StMCustom4_CViewSelection1 & MaskFieldDigit): |
245 case (StMCustom3_CViewSelection1 & MaskFieldDigit): | |
521
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
520
diff
changeset
|
246 case StMCustom3_CViewSelection2: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
520
diff
changeset
|
247 case StMCustom3_CViewSelection3: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
520
diff
changeset
|
248 case StMCustom3_CViewSelection4: |
e221cf762f45
Move Bigfont and motion Ctrl selection menu out of custom view submenu:
Ideenmodellierer
parents:
520
diff
changeset
|
249 case StMCustom3_CViewSelection5: |
531 | 250 case StMCustom3_CViewSelection6: refreshFct = CustomviewDivemode_refresh; |
508 | 251 break; |
604
fb5bb04ad914
Merged menu items of viewport and motion control:
Ideenmodellierer
parents:
584
diff
changeset
|
252 case (StMCustom5_CViewPortCalib & MaskFieldDigit): |
fb5bb04ad914
Merged menu items of viewport and motion control:
Ideenmodellierer
parents:
584
diff
changeset
|
253 case StMCustom5_CViewPortLayout: |
fb5bb04ad914
Merged menu items of viewport and motion control:
Ideenmodellierer
parents:
584
diff
changeset
|
254 case StMCustom5_CViewPortAmbient: refreshFct = refresh_ViewPort; |
552
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
255 break; |
508 | 256 default: /* no menu has been updated */ |
257 break; | |
258 } | |
259 | |
260 if(refreshFct != NULL) | |
261 { | |
262 uint32_t rememberPage = tMEscreen.FBStartAdress; | |
263 tMEscreen.FBStartAdress = getFrame(9); | |
264 | |
265 refreshFct(); | |
266 | |
267 GFX_SetFrameTop(tMEscreen.FBStartAdress); | |
268 releaseFrame(9,rememberPage); | |
269 } | |
38 | 270 } |
271 | |
272 void tMenuEdit_writeSettingsToFlash(void) | |
273 { | |
274 if(WriteSettings) | |
275 { | |
662 | 276 reset_SettingWarning(); |
38 | 277 GFX_logoAutoOff(); |
427 | 278 ext_flash_write_settings(0); |
38 | 279 WriteSettings = 0; |
280 } | |
281 } | |
282 | |
283 void helperLeaveMenuEditField(uint8_t idID) | |
284 { | |
285 if(ident[idID].maintype == FIELD_NUMBERS) | |
286 { | |
287 change_CLUT_entry((CLUT_MenuEditField0 + idID), CLUT_MenuEditFieldRegular); | |
288 } | |
289 } | |
290 | |
291 | |
292 void helperGotoMenuEditField(uint8_t idID) | |
293 { | |
294 /* | |
295 if(ident[idID].maintype == FIELD_NUMBERS) | |
296 { | |
297 change_CLUT_entry((CLUT_MenuEditField0 + idID), CLUT_MenuEditFieldSelected); | |
298 } | |
299 */ | |
300 set_cursorNew(idID); | |
301 // set_cursor(idID); | |
302 } | |
303 | |
304 | |
305 void exitMenuEdit_to_BackMenu(void) | |
306 { | |
307 _Bool EnterPressedBackup = EnterPressed; | |
308 | |
309 if(backmenu.pEventFunction) | |
310 { | |
311 ((void (*)(uint8_t))(backmenu.pEventFunction))(backmenu.functionParameter); | |
312 | |
313 EnterPressed = EnterPressedBackup; | |
314 // if(backmenu.line > 1) | |
315 // helperGotoMenuEditField(backmenu.line); | |
316 } | |
317 } | |
318 | |
319 | |
320 void exitMenuEdit_to_Menu_with_Menu_Update(void) | |
321 { | |
322 EnterPressed = 1; | |
323 exitMenuEdit(1); | |
324 } | |
325 | |
326 | |
327 void exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(void) | |
328 { | |
329 EnterPressed = 1; | |
330 exitMenuEdit(0); | |
331 } | |
332 | |
333 | |
334 void exitMenuEdit_to_Home_with_Menu_Update(void) | |
335 { | |
336 EnterPressed = 1; | |
337 exitMenuEdit(1); | |
338 set_globalState_tHome(); | |
339 } | |
340 | |
341 | |
342 void exitMenuEdit_to_InfoCompassCalibration(void) | |
343 { | |
344 exitMenuEdit(1); | |
345 openInfo_Compass(); | |
346 } | |
347 | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
348 void exitMenuEdit_to_InfoSensor(void) |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
349 { |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
350 exitMenuEdit(1); |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
351 openInfo_Sensor(); |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
352 } |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
353 |
38 | 354 |
355 void exitMenuEdit_to_Home(void) | |
356 { | |
357 exitMenuEdit(1); | |
358 set_globalState_tHome(); | |
359 } | |
360 | |
361 | |
362 void exitMenuEdit(uint8_t writeSettingsIfEnterPressed) | |
363 { | |
364 openMenu(0); | |
365 if(EnterPressed) | |
366 { | |
367 updateMenu(); | |
368 if((stateUsed->mode == MODE_SURFACE) && writeSettingsIfEnterPressed) | |
369 WriteSettings = 1; | |
370 } | |
371 releaseFrame(9,tMEscreen.FBStartAdress); | |
372 } | |
373 | |
374 | |
375 void exitMenuEditBackMenuOption(void) | |
376 { | |
377 if(backmenu.pEventFunction == 0) | |
378 exitMenuEdit(1); | |
379 else | |
380 exitMenuEdit_to_BackMenu(); | |
381 } | |
382 | |
383 | |
384 void startMenuEditFieldSelect(void) | |
385 { | |
386 id = 0; | |
387 helperGotoMenuEditField(id); | |
388 } | |
389 | |
390 | |
391 void nextMenuEditField(void) | |
392 { | |
393 helperLeaveMenuEditField(id); | |
394 | |
395 if(id < idLast) | |
396 id++; | |
397 else | |
398 id = 0; | |
399 helperGotoMenuEditField(id); | |
400 } | |
401 | |
402 /* | |
403 void previousMenuEditField(void) | |
404 { | |
405 helperLeaveMenuEditField(id); | |
406 if(id > 0) | |
407 id--; | |
408 else | |
409 id = idLast; | |
410 helperGotoMenuEditField(id); | |
411 } | |
412 */ | |
413 | |
414 _Bool inc_subBlock_or_block_of_actual_id(void) | |
415 { | |
416 if(event[evid].callerID != ident[id].callerID) | |
417 return 0; | |
418 | |
419 if((ident[id].subtype != FIELD_3DIGIT) && (ident[id].subtype != FIELD_2DIGIT) && ((subBlockPosition + 1) < ident[id].size[block])) | |
420 { | |
421 subBlockPosition++; | |
422 return 1; | |
423 } | |
424 | |
425 if(((block + 1) < 4) && (ident[id].size[block+1] > 0)) | |
426 { | |
427 block++; | |
428 subBlockPosition = 0; | |
429 return 1; | |
430 } | |
431 | |
432 return 0; | |
433 } | |
434 | |
435 | |
436 uint8_t get_newContent_of_actual_id_block_and_subBlock(uint8_t action) | |
437 { | |
438 uint8_t (*onActionFunc)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t); | |
439 uint8_t content; | |
440 | |
441 if(event[evid].callerID != ident[id].callerID) | |
442 return 0; | |
443 | |
444 onActionFunc = (uint8_t (*)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t))(event[evid].pEventFunction); | |
445 | |
446 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT)) | |
447 { | |
448 content = 100 * ( ident[id].newText[ident[id].begin[block] + 0] - '0'); | |
449 content += 10 * ( ident[id].newText[ident[id].begin[block] + 1] - '0'); | |
450 content += ident[id].newText[ident[id].begin[block] + 2]; | |
451 } | |
452 else | |
453 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT)) | |
454 { | |
455 content = 10 * (ident[id].newText[ident[id].begin[block] + 0] - '0'); | |
456 content += ident[id].newText[ident[id].begin[block] + 1]; | |
457 } | |
458 else | |
459 if(ident[id].maintype == FIELD_NUMBERS) | |
460 content = ident[id].newText[ident[id].begin[block] + subBlockPosition]; | |
461 else | |
584 | 462 if((ident[id].maintype == FIELD_ON_OFF) || (ident[id].maintype == FIELD_TOGGLE)) |
38 | 463 content = ident[id].input[block]; |
464 else | |
465 content = 0; /* just a default for protection */ | |
466 | |
467 return onActionFunc(ident[id].callerID, block, subBlockPosition, content, action); | |
468 } | |
469 | |
470 void mark_digit_of_actual_id_with_this_block_and_subBlock(int8_t oldblock, int8_t oldsubblockpos) | |
471 { | |
472 char oneCharText[2]; | |
473 uint16_t positionOffset; | |
474 | |
475 if(event[evid].callerID != ident[id].callerID) | |
476 return; | |
477 | |
478 if(ident[id].maintype == FIELD_NUMBERS) | |
479 { | |
480 oneCharText[0] = ident[id].newText[ident[id].begin[oldblock] + oldsubblockpos]; | |
481 oneCharText[1] = 0; | |
482 positionOffset = GFX_return_offset(ident[id].fontUsed, ident[id].newText, ident[id].begin[oldblock] + oldsubblockpos); | |
483 write_content( ident[id].coord[0] + positionOffset, ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, oneCharText, CLUT_MenuEditFieldSelected); | |
484 } | |
485 } | |
486 | |
487 | |
488 void mark_new_2digit_of_actual_id_block(void) | |
489 { | |
490 char oneCharText[3]; | |
491 uint16_t positionOffset; | |
492 | |
493 if(event[evid].callerID != ident[id].callerID) | |
494 return; | |
495 | |
496 if(ident[id].maintype == FIELD_NUMBERS) | |
497 { | |
498 oneCharText[0] = ident[id].newText[ident[id].begin[block] + 0]; | |
499 oneCharText[1] = ident[id].newText[ident[id].begin[block] + 1]; | |
500 oneCharText[2] = 0; | |
501 positionOffset = GFX_return_offset(ident[id].fontUsed, ident[id].newText, ident[id].begin[block] + 0); | |
502 write_content( ident[id].coord[0] + positionOffset, ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, oneCharText, CLUT_MenuEditDigit); | |
503 } | |
504 } | |
505 | |
506 | |
507 void mark_new_3digit_of_actual_id_block(void) | |
508 { | |
509 char oneCharText[4]; | |
510 uint16_t positionOffset; | |
511 | |
512 if(event[evid].callerID != ident[id].callerID) | |
513 return; | |
514 | |
515 if(ident[id].maintype == FIELD_NUMBERS) | |
516 { | |
517 oneCharText[0] = ident[id].newText[ident[id].begin[block] + 0]; | |
518 oneCharText[1] = ident[id].newText[ident[id].begin[block] + 1]; | |
519 oneCharText[2] = ident[id].newText[ident[id].begin[block] + 2]; | |
520 oneCharText[3] = 0; | |
521 positionOffset = GFX_return_offset(ident[id].fontUsed, ident[id].newText, ident[id].begin[block] + 0); | |
522 write_content( ident[id].coord[0] + positionOffset, ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, oneCharText, CLUT_MenuEditDigit); | |
523 } | |
524 } | |
525 | |
526 | |
527 void mark_new_digit_of_actual_id_block_and_subBlock(void) | |
528 { | |
529 char oneCharText[2]; | |
530 uint16_t positionOffset; | |
531 | |
532 if(event[evid].callerID != ident[id].callerID) | |
533 return; | |
534 | |
535 if(ident[id].maintype == FIELD_NUMBERS) | |
536 { | |
537 oneCharText[0] = ident[id].newText[ident[id].begin[block] + subBlockPosition]; | |
538 oneCharText[1] = 0; | |
539 positionOffset = GFX_return_offset(ident[id].fontUsed, ident[id].newText, ident[id].begin[block] + subBlockPosition); | |
540 write_content( ident[id].coord[0] + positionOffset, ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, oneCharText, CLUT_MenuEditDigit); | |
541 } | |
542 } | |
543 | |
544 | |
545 void enterMenuEditField(void) | |
546 { | |
547 uint8_t newContent; | |
548 uint8_t digit100; | |
549 uint8_t digit10; | |
550 uint8_t digit1; | |
551 | |
552 evid = 0; | |
553 while((evid < evidLast) && (event[evid].callerID != ident[id].callerID)) | |
554 { | |
555 evid++; | |
556 } | |
557 | |
558 if(event[evid].callerID != ident[id].callerID) | |
559 return; | |
560 | |
561 set_globalState(event[evid].callerID); | |
562 block = 0; | |
563 subBlockPosition = 0; | |
564 | |
565 | |
566 if(ident[id].maintype == FIELD_NUMBERS) | |
567 { | |
568 change_CLUT_entry(CLUT_MenuEditLineSelected, CLUT_MenuEditCursor); | |
569 // old stuff? hw 150916, reactivated 150923, this shows which digit will be changed now as it marks the other grey/black | |
570 // now fixed for button settings with newContent <= '0'+99 condition | |
571 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldSelected); | |
572 } | |
584 | 573 if(ident[id].maintype == FIELD_TOGGLE) |
574 { | |
575 change_CLUT_entry(CLUT_MenuEditLineSelected, CLUT_MenuEditCursor); | |
576 } | |
577 | |
38 | 578 |
579 newContent = get_newContent_of_actual_id_block_and_subBlock(ACTION_BUTTON_ENTER); | |
580 | |
581 if (((newContent == UPDATE_DIVESETTINGS) || (newContent == UPDATE_AND_EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_MENU)) && (actual_menu_content == MENU_SURFACE)) | |
582 createDiveSettings(); | |
583 | |
584 if(newContent == EXIT_TO_MENU_WITH_LOGO) | |
585 { | |
586 GFX_logoAutoOff(); | |
587 } | |
588 | |
589 if((newContent == EXIT_TO_MENU) || (newContent == UPDATE_AND_EXIT_TO_MENU) || (newContent == EXIT_TO_MENU_WITH_LOGO)) | |
590 { | |
591 if(backmenu.pEventFunction == 0) | |
592 exitMenuEdit(1); | |
593 else | |
594 exitMenuEdit_to_BackMenu(); | |
595 return; | |
596 } | |
597 | |
598 if((newContent == EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_HOME)) | |
599 { | |
600 exitMenuEdit_to_Home(); | |
601 return; | |
602 } | |
603 | |
604 if(newContent == EXIT_TO_INFO_COMPASS) | |
605 { | |
606 exitMenuEdit_to_InfoCompassCalibration(); | |
607 return; | |
608 } | |
609 | |
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
610 if(newContent == EXIT_TO_INFO_SENSOR) |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
611 { |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
612 exitMenuEdit_to_InfoSensor(); |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
613 return; |
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
707
diff
changeset
|
614 } |
38 | 615 |
616 switch(ident[id].maintype) | |
617 { | |
618 case FIELD_NUMBERS: | |
619 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
620 | |
621 if(ident[id].subtype == FIELD_UDIGIT) | |
622 { | |
623 if((newContent >= '0') && (newContent <= '9')) | |
624 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; | |
625 | |
626 mark_new_digit_of_actual_id_block_and_subBlock(); | |
627 } | |
628 else if(ident[id].subtype == FIELD_3DIGIT) | |
629 { | |
630 if((newContent >= '0') && (newContent <= '0'+200)) | |
631 { | |
632 split_Content_to_Digit_helper( newContent, &digit100, &digit10, &digit1); | |
633 ident[id].newText[ident[id].begin[block] + 0] = '0' + digit100; | |
634 ident[id].newText[ident[id].begin[block] + 1] = '0' + digit10; | |
635 ident[id].newText[ident[id].begin[block] + 2] = '0' + digit1; | |
636 mark_new_3digit_of_actual_id_block(); | |
637 } | |
638 } | |
639 else // FIELD_2DIGIT | |
640 { | |
641 if((newContent >= '0') && (newContent <= '0'+99)) | |
642 { | |
643 ident[id].newText[ident[id].begin[block]] = '0' + (newContent - '0')/10; | |
644 ident[id].newText[ident[id].begin[block] + 1] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
645 mark_new_2digit_of_actual_id_block(); | |
646 } | |
647 } | |
648 break; | |
649 case FIELD_BUTTON: | |
650 set_globalState(menuID); | |
651 break; | |
652 case FIELD_ON_OFF: | |
653 set_globalState(menuID); | |
654 break; | |
655 case FIELD_SYMBOL: | |
656 ident[id].input[0] += 1; | |
657 if(ident[id].input[0] >= ident[id].input[1]) | |
658 ident[id].input[0] = 0; | |
659 ident[id].newText[0] = ident[id].orgText[ident[id].input[0]]; | |
660 write_content_of_actual_Id(); | |
661 set_globalState(menuID); | |
662 break; | |
663 } | |
664 } | |
665 | |
666 | |
667 void exitMenuEditField(void) | |
668 { | |
669 uint8_t newContent; | |
670 | |
671 set_globalState(menuID); | |
672 | |
673 if(event[evid].callerID != ident[id].callerID) | |
674 return; | |
675 | |
676 newContent = get_newContent_of_actual_id_block_and_subBlock(ACTION_TIMEOUT); | |
677 | |
678 /* | |
679 uint8_t (*onActionFunc)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t); | |
680 uint8_t newContent; | |
681 | |
682 onActionFunc = (uint8_t (*)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t))(event[evid].pEventFunction); | |
683 | |
684 newContent = onActionFunc(ident[id].callerID, 0, 0, 255, ACTION_BUTTON_BACK); | |
685 */ | |
686 | |
687 /* destroy changes of editing in newText */ | |
688 change_CLUT_entry(CLUT_MenuEditLineSelected, CLUT_MenuLineSelected); | |
689 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
690 | |
691 create_newText_for_actual_Id(); | |
692 write_content_of_actual_Id(); | |
693 | |
694 if((newContent == EXIT_TO_MENU) || (newContent == UPDATE_AND_EXIT_TO_MENU)) | |
695 { | |
696 exitMenuEdit(1); | |
697 return; | |
698 } | |
699 | |
700 if((newContent == EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_HOME)) | |
701 { | |
702 exitMenuEdit_to_Home(); | |
703 return; | |
704 } | |
705 | |
706 } | |
707 | |
708 void nextMenuEditFieldDigit(void) | |
709 { | |
710 uint8_t action; | |
711 uint8_t newContent; | |
712 int8_t blockOld = 0; | |
713 int8_t subBlockPositionOld = 0; | |
714 | |
715 if(event[evid].callerID != ident[id].callerID) | |
716 return; | |
717 | |
718 blockOld = block; | |
719 subBlockPositionOld = subBlockPosition; | |
720 | |
721 if(inc_subBlock_or_block_of_actual_id()) | |
722 action = ACTION_BUTTON_ENTER; | |
723 else | |
724 action = ACTION_BUTTON_ENTER_FINAL; | |
725 | |
726 newContent = get_newContent_of_actual_id_block_and_subBlock(action); | |
727 | |
728 if(action == ACTION_BUTTON_ENTER_FINAL) | |
729 { | |
730 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
731 | |
732 change_CLUT_entry(CLUT_MenuEditLineSelected, CLUT_MenuLineSelected); | |
733 for(int i = 0;i<=9;i++) | |
734 change_CLUT_entry((CLUT_MenuEditField0 + i), CLUT_MenuEditFieldRegular); | |
735 | |
736 if(((newContent == UPDATE_DIVESETTINGS) || (newContent == UPDATE_AND_EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_MENU)) && (actual_menu_content == MENU_SURFACE)) | |
737 createDiveSettings(); | |
738 | |
739 if((newContent == EXIT_TO_MENU) || (newContent == UPDATE_AND_EXIT_TO_MENU)) | |
740 { | |
741 exitMenuEdit(1); | |
742 return; | |
743 } | |
744 | |
745 if((newContent == EXIT_TO_HOME) || (newContent == UPDATE_AND_EXIT_TO_HOME)) | |
746 { | |
747 exitMenuEdit_to_Home(); | |
748 return; | |
749 } | |
750 } | |
751 | |
752 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT) && (action == ACTION_BUTTON_ENTER) &&(newContent >= '0') && (newContent <= '0' + 99)) | |
753 { | |
754 ident[id].newText[ident[id].begin[block] + 0] = '0' + (newContent - '0')/100; | |
755 ident[id].newText[ident[id].begin[block] + 1] = '0' + (newContent - '0')/10; | |
756 ident[id].newText[ident[id].begin[block] + 2] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
757 } | |
758 else | |
759 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT) && (action == ACTION_BUTTON_ENTER) &&(newContent >= '0') && (newContent <= '0' + 99)) | |
760 { | |
761 ident[id].newText[ident[id].begin[block] + 0] = '0' + (newContent - '0')/10; | |
762 ident[id].newText[ident[id].begin[block] + 1] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
763 } | |
764 else | |
765 if((ident[id].maintype == FIELD_NUMBERS) && (action == ACTION_BUTTON_ENTER) && (newContent >= '0') && (newContent <= '9')) | |
766 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; | |
767 | |
768 if(action == ACTION_BUTTON_ENTER) | |
769 { | |
770 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT)) | |
771 { | |
772 mark_new_3digit_of_actual_id_block(); | |
773 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,0); | |
774 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,1); | |
775 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,2); | |
776 } | |
777 else | |
778 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT)) | |
779 { | |
780 mark_new_2digit_of_actual_id_block(); | |
781 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,0); | |
782 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,1); | |
783 } | |
784 else | |
785 { | |
786 mark_new_digit_of_actual_id_block_and_subBlock(); | |
787 mark_digit_of_actual_id_with_this_block_and_subBlock(blockOld,subBlockPositionOld); | |
788 } | |
789 } | |
790 else /* action == ACTION_BUTTON_ENTER_FINAL */ | |
791 set_globalState(menuID); | |
792 } | |
793 | |
794 uint8_t split_Content_to_Digit_helper(uint8_t inContentAscii, uint8_t *outDigit100, uint8_t *outDigit10, uint8_t *outDigit1) | |
795 { | |
796 uint8_t newContent, tempDigit, CopyContent; | |
797 | |
798 newContent = inContentAscii - '0'; | |
799 CopyContent = newContent; | |
800 | |
801 tempDigit = newContent / 100; | |
802 newContent -= tempDigit * 100; | |
803 if(outDigit100) | |
804 *outDigit100 = tempDigit; | |
805 | |
806 tempDigit = newContent / 10; | |
807 newContent -= tempDigit * 10; | |
808 if(outDigit10) | |
809 *outDigit10 = tempDigit; | |
810 | |
811 tempDigit = newContent; | |
812 if(outDigit1) | |
813 *outDigit1 = tempDigit; | |
814 | |
815 return CopyContent; | |
816 } | |
817 | |
818 void upMenuEditFieldDigit(void) | |
819 { | |
820 uint8_t newContent; | |
821 uint8_t digit100; | |
822 uint8_t digit10; | |
823 uint8_t digit1; | |
824 | |
825 if(event[evid].callerID != ident[id].callerID) | |
826 return; | |
827 | |
828 newContent = get_newContent_of_actual_id_block_and_subBlock(ACTION_BUTTON_NEXT); | |
829 | |
830 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT) &&(newContent >= '0') && (newContent <= '0' + 200)) | |
831 { | |
832 split_Content_to_Digit_helper( newContent, &digit100, &digit10, &digit1); | |
833 ident[id].newText[ident[id].begin[block] + 0] = '0' + digit100; | |
834 ident[id].newText[ident[id].begin[block] + 1] = '0' + digit10; | |
835 ident[id].newText[ident[id].begin[block] + 2] = '0' + digit1; | |
836 mark_new_3digit_of_actual_id_block(); | |
837 return; | |
838 } | |
839 | |
840 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT) &&(newContent >= '0') && (newContent <= '0' + 99)) | |
841 { | |
842 ident[id].newText[ident[id].begin[block] + 0] = '0' + (newContent - '0')/10; | |
843 ident[id].newText[ident[id].begin[block] + 1] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
844 mark_new_2digit_of_actual_id_block(); | |
845 return; | |
846 } | |
847 | |
848 if((ident[id].maintype == FIELD_NUMBERS) && (newContent >= '0') && (newContent <= '9')) | |
849 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; | |
850 | |
851 mark_new_digit_of_actual_id_block_and_subBlock(); | |
852 } | |
853 | |
854 | |
855 void downMenuEditFieldDigit(void) | |
856 { | |
857 uint8_t newContent; | |
858 uint8_t digit100; | |
859 uint8_t digit10; | |
860 uint8_t digit1; | |
861 | |
862 if(event[evid].callerID != ident[id].callerID) | |
863 return; | |
864 | |
865 newContent = get_newContent_of_actual_id_block_and_subBlock(ACTION_BUTTON_BACK); | |
866 | |
867 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_3DIGIT) &&(newContent >= '0') && (newContent <= '0' + 200)) | |
868 { | |
869 split_Content_to_Digit_helper( newContent, &digit100, &digit10, &digit1); | |
870 ident[id].newText[ident[id].begin[block] + 0] = '0' + digit100; | |
871 ident[id].newText[ident[id].begin[block] + 1] = '0' + digit10; | |
872 ident[id].newText[ident[id].begin[block] + 2] = '0' + digit1; | |
873 mark_new_3digit_of_actual_id_block(); | |
874 return; | |
875 } | |
876 | |
877 if((ident[id].maintype == FIELD_NUMBERS) && (ident[id].subtype == FIELD_2DIGIT) &&(newContent >= '0') && (newContent <= '0' + 99)) | |
878 { | |
879 ident[id].newText[ident[id].begin[block] + 0] = '0' + (newContent - '0')/10; | |
880 ident[id].newText[ident[id].begin[block] + 1] = '0' + ((newContent - '0') - (10*((newContent - '0')/10))); | |
881 mark_new_2digit_of_actual_id_block(); | |
882 return; | |
883 } | |
884 | |
885 if((ident[id].maintype == FIELD_NUMBERS) && (newContent >= '0') && (newContent <= '9')) | |
886 ident[id].newText[ident[id].begin[block] + subBlockPosition] = newContent; | |
887 | |
888 mark_new_digit_of_actual_id_block_and_subBlock(); | |
889 } | |
890 | |
891 | |
892 void evaluateNewString(uint32_t editID, uint32_t *pNewValue1, uint32_t *pNewValue2, uint32_t *pNewValue3, uint32_t *pNewValue4) | |
893 { | |
894 if(editID != ident[id].callerID) | |
895 return; | |
896 | |
897 uint8_t i, digitCount, digit; | |
898 uint32_t sum[4], multiplier; | |
899 | |
900 for(i=0;i<4;i++) | |
901 sum[i] = 0; | |
902 | |
903 i = 0; | |
904 while( ident[id].size[i] && (i < 4)) | |
905 { | |
906 multiplier = 1; | |
907 for(digitCount = 1; digitCount < ident[id].size[i]; digitCount++) | |
908 multiplier *= 10; | |
909 | |
910 for(digitCount = 0; digitCount < ident[id].size[i]; digitCount++) | |
911 { | |
912 digit = ident[id].newText[ident[id].begin[i] + digitCount]; | |
913 | |
914 if(digit > '0') | |
915 digit -= '0'; | |
916 else | |
917 digit = 0; | |
918 | |
919 if(digit > 9) | |
920 digit = 9; | |
921 | |
922 sum[i] += digit * multiplier; | |
923 | |
924 if(multiplier >= 10) | |
925 multiplier /= 10; | |
926 else | |
927 multiplier = 0; | |
928 } | |
929 i++; | |
930 } | |
931 | |
932 *pNewValue1 = sum[0]; | |
933 *pNewValue2 = sum[1]; | |
934 *pNewValue3 = sum[2]; | |
935 *pNewValue4 = sum[3]; | |
936 } | |
937 | |
938 | |
939 uint8_t get_id_of(uint32_t editID) | |
940 { | |
941 uint8_t temp_id; | |
942 | |
943 if(editID == ident[id].callerID) | |
944 return id; | |
945 else | |
946 { | |
947 temp_id = 0; | |
948 while((temp_id < 9) && (editID != ident[temp_id].callerID)) | |
949 temp_id++; | |
950 if(editID != ident[temp_id].callerID) | |
951 temp_id = 255; | |
952 return temp_id; | |
953 } | |
954 } | |
955 | |
956 | |
957 void tMenuEdit_newButtonText(uint32_t editID, char *text) | |
958 { | |
959 uint8_t backup_id, temp_id; | |
960 | |
961 temp_id = get_id_of(editID); | |
962 if(temp_id == 255) | |
963 return; | |
964 | |
965 backup_id = id; | |
966 id = temp_id; | |
967 | |
968 strncpy(ident[id].newText, text, 32); | |
969 ident[id].newText[31] = 0; | |
970 | |
971 clean_content_of_actual_Id(); | |
972 write_content_of_actual_Id(); | |
973 | |
974 id = backup_id; | |
975 } | |
976 | |
977 | |
978 void tMenuEdit_set_on_off(uint32_t editID, uint32_t int1) | |
979 { | |
980 uint8_t backup_id, temp_id; | |
981 | |
982 temp_id = get_id_of(editID); | |
983 if(temp_id == 255) | |
984 return; | |
985 | |
986 backup_id = id; | |
987 id = temp_id; | |
988 | |
989 ident[id].input[0] = int1; | |
990 | |
991 if(int1) | |
992 ident[id].newText[0] = '\005'; | |
993 else | |
994 ident[id].newText[0] = '\006'; | |
995 | |
996 clean_content_of_actual_Id(); | |
997 write_content_of_actual_Id(); | |
998 | |
999 id = backup_id; | |
1000 } | |
1001 | |
508 | 1002 void tMenuEdit_select(uint32_t editID) |
1003 { | |
1004 uint8_t id_local = 0; | |
1005 id_local = get_id_of(editID); | |
38 | 1006 |
508 | 1007 if(id_local <= idLast) |
1008 { | |
1009 id = id_local; | |
1010 set_cursorNew(id); | |
1011 } | |
1012 } | |
1013 | |
1014 #if OLD_SELECTION | |
38 | 1015 void tMenuEdit_select(uint32_t editID, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) |
1016 { | |
1017 if(int1 > 4) | |
1018 return; | |
1019 | |
1020 uint8_t backup_id, temp_id; | |
1021 | |
1022 temp_id = get_id_of(editID); | |
1023 if(temp_id == 255) | |
1024 return; | |
1025 | |
1026 backup_id = id; | |
1027 id = temp_id; | |
1028 | |
1029 ident[id].input[0] = int1; | |
1030 ident[id].input[1] = int1; | |
1031 ident[id].input[2] = int1; | |
1032 ident[id].input[3] = int1; | |
1033 | |
1034 create_newText_for_actual_Id(); | |
1035 clean_content_of_actual_Id(); | |
1036 write_content_of_actual_Id(); | |
1037 | |
1038 id = backup_id; | |
1039 } | |
508 | 1040 #endif |
38 | 1041 |
1042 | |
1043 void tMenuEdit_newInput(uint32_t editID, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1044 { | |
1045 uint8_t backup_id, temp_id; | |
1046 | |
1047 temp_id = get_id_of(editID); | |
1048 if(temp_id == 255) | |
1049 return; | |
1050 | |
1051 backup_id = id; | |
1052 id = temp_id; | |
1053 | |
1054 if(editID != ident[id].callerID) | |
1055 { | |
1056 temp_id = 0; | |
1057 while((temp_id < 9) && (editID != ident[temp_id].callerID)) | |
1058 temp_id++; | |
1059 if(editID != ident[temp_id].callerID) | |
1060 return; | |
1061 id = temp_id; | |
1062 } | |
1063 ident[id].input[0] = int1; | |
1064 ident[id].input[1] = int2; | |
1065 ident[id].input[2] = int3; | |
1066 ident[id].input[3] = int4; | |
1067 | |
1068 create_newText_for_actual_Id(); | |
1069 if(id <= idLast) | |
1070 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1071 write_content_of_actual_Id(); | |
1072 | |
1073 id = backup_id; | |
1074 } | |
1075 | |
1076 | |
1077 void resetEnterPressedToStateBeforeButtonAction(void) | |
1078 { | |
1079 EnterPressed = EnterPressedBeforeButtonAction; | |
1080 } | |
1081 | |
1082 | |
1083 void sendActionToMenuEdit(uint8_t sendAction) | |
1084 { | |
1085 if(get_globalState() == menuID) | |
1086 { | |
1087 switch(sendAction) | |
1088 { | |
1089 case ACTION_BUTTON_ENTER: | |
1090 EnterPressedBeforeButtonAction = EnterPressed; | |
1091 EnterPressed = 1; | |
1092 enterMenuEditField(); | |
1093 break; | |
1094 case ACTION_BUTTON_NEXT: | |
1095 nextMenuEditField(); | |
1096 // previousMenuEditField(); | |
1097 break; | |
1098 case ACTION_BUTTON_BACK: | |
1099 exitMenuEditBackMenuOption(); | |
1100 break; | |
1101 case ACTION_TIMEOUT: | |
1102 case ACTION_MODE_CHANGE: | |
1103 exitMenuEdit(1); | |
1104 break; | |
1105 case ACTION_IDLE_TICK: | |
1106 case ACTION_IDLE_SECOND: | |
219 | 1107 default: |
38 | 1108 break; |
219 | 1109 |
38 | 1110 } |
1111 } | |
1112 else | |
1113 if(get_globalState() == event[evid].callerID) | |
1114 { | |
1115 switch(sendAction) | |
1116 { | |
1117 case ACTION_BUTTON_ENTER: | |
1118 nextMenuEditFieldDigit(); | |
1119 break; | |
1120 case ACTION_BUTTON_NEXT: | |
1121 upMenuEditFieldDigit(); | |
1122 break; | |
1123 case ACTION_BUTTON_BACK: | |
1124 downMenuEditFieldDigit(); | |
1125 break; | |
1126 case ACTION_TIMEOUT: | |
1127 case ACTION_MODE_CHANGE: | |
1128 exitMenuEditField(); | |
1129 break; | |
1130 case ACTION_IDLE_TICK: | |
1131 case ACTION_IDLE_SECOND: | |
1132 break; | |
219 | 1133 default: |
1134 break; | |
38 | 1135 } |
1136 } | |
1137 else | |
1138 { | |
1139 switch(sendAction) | |
1140 { | |
1141 case ACTION_BUTTON_ENTER: | |
1142 break; | |
1143 case ACTION_BUTTON_NEXT: | |
1144 break; | |
1145 case ACTION_BUTTON_BACK: | |
1146 break; | |
1147 case ACTION_TIMEOUT: | |
1148 case ACTION_MODE_CHANGE: | |
1149 exitMenuEdit(1); | |
1150 break; | |
1151 case ACTION_IDLE_TICK: | |
1152 case ACTION_IDLE_SECOND: | |
1153 break; | |
219 | 1154 default: |
1155 break; | |
38 | 1156 } |
1157 } | |
1158 } | |
1159 | |
1160 | |
1161 void create_newText_for_actual_Id_and_field_select(void) | |
1162 { | |
1163 uint8_t i; | |
1164 | |
1165 i = 0; | |
1166 while( ident[id].size[i] && (i < 4)) | |
1167 { | |
1168 if(ident[id].input[i]) | |
1169 ident[id].newText[ident[id].begin[i]] = '\005'; | |
1170 else | |
1171 ident[id].newText[ident[id].begin[i]] = '\006'; | |
1172 i++; | |
1173 } | |
1174 } | |
1175 | |
1176 | |
1177 void create_newText_for_actual_Id(void) | |
1178 { | |
1179 if( ident[id].maintype == FIELD_SELECT) | |
1180 { | |
1181 create_newText_for_actual_Id_and_field_select(); | |
1182 return; | |
1183 } | |
1184 | |
1185 uint8_t i, digitCount; | |
1186 uint32_t remainder, digit, divider; | |
1187 | |
1188 i = 0; | |
1189 while( ident[id].size[i] && (i < 4)) | |
1190 { | |
1191 remainder = ident[id].input[i]; | |
1192 divider = 1; | |
1193 | |
1194 for(digitCount = 1; digitCount < ident[id].size[i]; digitCount++) | |
1195 divider *= 10; | |
1196 | |
1197 for(digitCount = 0; digitCount < ident[id].size[i]; digitCount++) | |
1198 { | |
1199 digit = remainder / divider; | |
1200 remainder -= digit * divider; | |
1201 divider /= 10; | |
1202 if(digit < 10) | |
1203 ident[id].newText[ident[id].begin[i] + digitCount] = digit + '0'; | |
1204 else | |
1205 ident[id].newText[ident[id].begin[i] + digitCount] = 'x'; | |
1206 } | |
1207 i++; | |
1208 } | |
1209 } | |
1210 | |
1211 | |
1212 void write_content_without_Id(void) | |
1213 { | |
1214 write_content( ident[id].coord[0], ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, ident[id].newText, CLUT_MenuEditFieldRegular); | |
1215 } | |
1216 | |
1217 | |
1218 void write_content_of_actual_Id(void) | |
1219 { | |
1220 write_content( ident[id].coord[0], ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed, ident[id].newText, (CLUT_MenuEditField0 + id)); | |
1221 } | |
1222 | |
1223 | |
1224 void clean_content_of_actual_Id(void) | |
1225 { | |
1226 clean_content( ident[id].coord[0], ident[id].coord[1], ident[id].coord[2], ident[id].fontUsed); | |
1227 } | |
1228 | |
1229 | |
1230 void write_field_udigit_and_2digit(uint8_t subtype, uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1231 { | |
1232 if(id >= 9) | |
1233 return; | |
1234 | |
1235 ident[id].maintype = FIELD_NUMBERS; | |
1236 ident[id].subtype = subtype; | |
1237 | |
1238 ident[id].coord[0] = XleftGimpStyle; | |
1239 ident[id].coord[1] = XrightGimpStyle; | |
1240 ident[id].coord[2] = YtopGimpStyle; | |
1241 ident[id].fontUsed = (tFont *)Font; | |
1242 ident[id].callerID = editID; | |
1243 | |
1244 strncpy(ident[id].orgText, text, 32); | |
1245 strncpy(ident[id].newText, text, 32); | |
1246 ident[id].orgText[31] = 0; | |
1247 ident[id].newText[31] = 0; | |
1248 | |
1249 /* uint32_t has max 10 digits */ | |
1250 | |
1251 int8_t beginTmp, sizeTmp; | |
1252 uint8_t i; | |
1253 | |
1254 ident[id].input[0] = int1; | |
1255 ident[id].input[1] = int2; | |
1256 ident[id].input[2] = int3; | |
1257 ident[id].input[3] = int4; | |
1258 | |
1259 for(i=0;i<4;i++) | |
1260 ident[id].size[i] = 0; | |
1261 | |
1262 beginTmp = 0; | |
1263 for(i=0;i<4;i++) | |
1264 { | |
1265 while((ident[id].orgText[beginTmp] != '#')&& ident[id].orgText[beginTmp]) | |
1266 beginTmp++; | |
1267 | |
1268 if(ident[id].orgText[beginTmp] == '#') | |
1269 { | |
1270 sizeTmp = 1; | |
1271 while(ident[id].orgText[beginTmp + sizeTmp] == '#') | |
1272 sizeTmp++; | |
1273 | |
1274 ident[id].begin[i] = beginTmp; | |
1275 ident[id].size[i] = sizeTmp; | |
1276 beginTmp = ident[id].begin[i] + ident[id].size[i]; | |
1277 } | |
1278 else | |
1279 break; | |
1280 } | |
1281 | |
1282 if(!tME_stop) | |
1283 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1284 else | |
1285 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditInfo); | |
1286 | |
1287 create_newText_for_actual_Id(); | |
1288 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1289 if(editID == 0) |
38 | 1290 write_content_without_Id(); |
1291 else | |
1292 { | |
1293 write_content_of_actual_Id(); | |
1294 if(!tME_stop) | |
1295 idLast = id; | |
1296 id++; | |
1297 } | |
1298 } | |
1299 | |
1300 void write_field_udigit(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1301 { | |
1302 write_field_udigit_and_2digit(FIELD_UDIGIT, editID,XleftGimpStyle,XrightGimpStyle,YtopGimpStyle,Font,text,int1,int2,int3,int4); | |
1303 } | |
1304 | |
1305 void write_field_2digit(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1306 { | |
1307 write_field_udigit_and_2digit(FIELD_2DIGIT, editID,XleftGimpStyle,XrightGimpStyle,YtopGimpStyle,Font,text,int1,int2,int3,int4); | |
1308 } | |
1309 | |
1310 void write_field_3digit(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint32_t int1, uint32_t int2, uint32_t int3, uint32_t int4) | |
1311 { | |
1312 write_field_udigit_and_2digit(FIELD_3DIGIT, editID,XleftGimpStyle,XrightGimpStyle,YtopGimpStyle,Font,text,int1,int2,int3,int4); | |
1313 } | |
1314 | |
1315 /* | |
1316 void write_field_sdigit(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, int32_t int1, int32_t int2, int32_t int3, int32_t int4) | |
1317 { | |
1318 } | |
1319 */ | |
1320 | |
1321 void write_field_select(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1, uint8_t int2, uint8_t int3, uint8_t int4) | |
1322 { | |
1323 if(id >= 9) | |
1324 return; | |
1325 | |
1326 int8_t beginTmp; | |
1327 | |
1328 ident[id].maintype = FIELD_SELECT; | |
1329 ident[id].subtype = FIELD_SELECT; | |
1330 | |
1331 ident[id].coord[0] = XleftGimpStyle; | |
1332 ident[id].coord[1] = XrightGimpStyle; | |
1333 ident[id].coord[2] = YtopGimpStyle; | |
1334 ident[id].fontUsed = (tFont *)Font; | |
1335 ident[id].callerID = editID; | |
1336 | |
1337 strncpy(ident[id].orgText, text, 32); | |
1338 strncpy(ident[id].newText, text, 32); | |
1339 ident[id].orgText[31] = 0; | |
1340 ident[id].newText[31] = 0; | |
1341 | |
1342 ident[id].input[0] = int1; | |
1343 ident[id].input[1] = int2; | |
1344 ident[id].input[2] = int3; | |
1345 ident[id].input[3] = int4; | |
1346 | |
1347 for(int i=0;i<4;i++) | |
1348 ident[id].size[i] = 0; | |
1349 | |
1350 beginTmp = 0; | |
1351 for(int i=0;i<4;i++) | |
1352 { | |
1353 while((ident[id].orgText[beginTmp] != '#')&& ident[id].orgText[beginTmp]) | |
1354 beginTmp++; | |
1355 | |
1356 if(ident[id].orgText[beginTmp] == '#') | |
1357 { | |
1358 | |
1359 ident[id].begin[i] = beginTmp; | |
1360 ident[id].size[i] = 1; | |
1361 beginTmp = ident[id].begin[i] + ident[id].size[i]; | |
1362 } | |
1363 else | |
1364 break; | |
1365 } | |
1366 | |
1367 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1368 | |
1369 create_newText_for_actual_Id(); | |
1370 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1371 if(editID == 0) |
38 | 1372 write_content_without_Id(); |
1373 else | |
1374 { | |
1375 write_content_of_actual_Id(); | |
1376 if(!tME_stop) | |
1377 idLast = id; | |
1378 id++; | |
1379 } | |
1380 } | |
1381 | |
1382 void write_field_button(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text) | |
1383 { | |
1384 if(id >= 9) | |
1385 return; | |
1386 | |
1387 ident[id].maintype = FIELD_BUTTON; | |
1388 ident[id].subtype = FIELD_BUTTON; | |
1389 | |
1390 ident[id].coord[0] = XleftGimpStyle; | |
1391 ident[id].coord[1] = XrightGimpStyle; | |
1392 ident[id].coord[2] = YtopGimpStyle; | |
1393 ident[id].fontUsed = (tFont *)Font; | |
1394 ident[id].callerID = editID; | |
1395 | |
1396 strncpy(ident[id].orgText, text, 32); | |
1397 strncpy(ident[id].newText, text, 32); | |
1398 ident[id].orgText[31] = 0; | |
1399 ident[id].newText[31] = 0; | |
1400 | |
1401 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditButtonColor1); | |
1402 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1403 if(editID == 0) |
38 | 1404 write_content_without_Id(); |
1405 else | |
1406 { | |
1407 write_content_of_actual_Id(); | |
1408 if(!tME_stop) | |
1409 idLast = id; | |
1410 id++; | |
1411 } | |
1412 } | |
1413 | |
1414 | |
1415 void write_field_symbol(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1) | |
1416 { | |
1417 if(id >= 9) | |
1418 return; | |
1419 | |
1420 ident[id].maintype = FIELD_SYMBOL; | |
1421 ident[id].subtype = FIELD_SYMBOL; | |
1422 | |
1423 ident[id].coord[0] = XleftGimpStyle; | |
1424 ident[id].coord[1] = XrightGimpStyle; | |
1425 ident[id].coord[2] = YtopGimpStyle; | |
1426 ident[id].fontUsed = (tFont *)Font; | |
1427 ident[id].callerID = editID; | |
1428 | |
1429 strncpy(ident[id].orgText, text, 32); | |
1430 strncpy(ident[id].newText, text, 32); | |
1431 ident[id].orgText[31] = 0; | |
1432 | |
1433 ident[id].newText[0] = text[0]; | |
1434 ident[id].newText[1] = 0; | |
1435 | |
1436 ident[id].input[0] = int1; | |
1437 ident[id].input[1] = strlen(ident[id].orgText); | |
1438 | |
1439 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditButtonColor1); | |
1440 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1441 if(editID == 0) |
38 | 1442 write_content_without_Id(); |
1443 else | |
1444 { | |
1445 write_content_of_actual_Id(); | |
1446 if(!tME_stop) | |
1447 idLast = id; | |
1448 id++; | |
1449 } | |
1450 } | |
584 | 1451 void write_field_toggle(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1, uint8_t int2) |
1452 { | |
1453 if(id >= 9) return; | |
1454 ident[id].maintype = FIELD_TOGGLE; | |
1455 ident[id].subtype = FIELD_TOGGLE; | |
1456 ident[id].coord[0] = XleftGimpStyle; | |
1457 ident[id].coord[1] = XrightGimpStyle; | |
1458 ident[id].coord[2] = YtopGimpStyle; | |
1459 ident[id].fontUsed = (tFont *)Font; | |
1460 ident[id].callerID = editID; | |
1461 strncpy(ident[id].orgText, text, 32); | |
1462 strncpy(ident[id].newText, text, 32); | |
1463 ident[id].orgText[31] = 0; | |
1464 ident[id].newText[31] = 0; | |
1465 | |
1466 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditButtonColor1); | |
1467 | |
1468 if(editID == 0) write_content_without_Id(); | |
1469 else | |
1470 { | |
1471 write_content_of_actual_Id(); | |
1472 if(!tME_stop) idLast = id; | |
1473 id++; | |
1474 } | |
1475 } | |
1476 | |
38 | 1477 |
1478 | |
1479 /* was build for field_on_off | |
1480 * to be tested for other purposes first | |
1481 */ | |
1482 void tMenuEdit_refresh_field(uint32_t editID) | |
1483 { | |
1484 uint8_t temp_id; | |
1485 | |
1486 temp_id = get_id_of(editID); | |
1487 if(temp_id == 255) | |
1488 return; | |
1489 | |
1490 clean_content( ident[temp_id].coord[0], ident[temp_id].coord[1], ident[temp_id].coord[2], ident[temp_id].fontUsed); | |
1491 write_content( ident[temp_id].coord[0], ident[temp_id].coord[1], ident[temp_id].coord[2], ident[temp_id].fontUsed, ident[temp_id].newText, (CLUT_MenuEditField0 + temp_id)); | |
1492 } | |
1493 | |
1494 | |
1495 void write_field_on_off(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1) | |
1496 { | |
1497 if(id >= 9) | |
1498 return; | |
1499 | |
1500 ident[id].maintype = FIELD_ON_OFF; | |
1501 ident[id].subtype = FIELD_ON_OFF; | |
1502 | |
1503 ident[id].coord[0] = XleftGimpStyle; | |
1504 ident[id].coord[1] = XrightGimpStyle; | |
1505 ident[id].coord[2] = YtopGimpStyle; | |
1506 ident[id].fontUsed = (tFont *)Font; | |
1507 ident[id].callerID = editID; | |
1508 | |
1509 if(int1) | |
1510 ident[id].orgText[0] = '\005'; | |
1511 else | |
1512 ident[id].orgText[0] = '\006'; | |
1513 | |
1514 ident[id].orgText[1] = ' '; | |
1515 | |
1516 strncpy(&ident[id].orgText[2], text, 30); | |
1517 strncpy(ident[id].newText, ident[id].orgText, 32); | |
1518 ident[id].orgText[31] = 0; | |
1519 ident[id].newText[31] = 0; | |
1520 | |
1521 if(!tME_stop) | |
1522 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1523 else | |
1524 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditInfo); | |
1525 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1526 if(editID == 0) |
38 | 1527 write_content_without_Id(); |
1528 else | |
1529 { | |
1530 write_content_of_actual_Id(); | |
1531 if(!tME_stop) | |
1532 idLast = id; | |
1533 id++; | |
1534 } | |
1535 } | |
1536 | |
1537 | |
1538 void write_field_fpoint(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, float input) | |
1539 { | |
1540 if(id >= 9) | |
1541 return; | |
1542 | |
1543 ident[id].maintype = FIELD_NUMBERS; | |
1544 ident[id].subtype = FIELD_FLOAT; | |
1545 | |
1546 ident[id].coord[0] = XleftGimpStyle; | |
1547 ident[id].coord[1] = XrightGimpStyle; | |
1548 ident[id].coord[2] = YtopGimpStyle; | |
1549 ident[id].fontUsed = (tFont *)Font; | |
1550 ident[id].callerID = editID; | |
1551 | |
1552 strncpy(ident[id].orgText, text, 32); | |
1553 strncpy(ident[id].newText, text, 32); | |
1554 ident[id].orgText[31] = 0; | |
1555 ident[id].newText[31] = 0; | |
1556 | |
1557 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); | |
1558 | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
1559 if(editID == 0) |
38 | 1560 write_content_without_Id(); |
1561 else | |
1562 { | |
1563 write_content_of_actual_Id(); | |
1564 if(!tME_stop) | |
1565 idLast = id; | |
1566 id++; | |
1567 } | |
1568 } | |
1569 | |
1570 | |
1571 void setBackMenu(uint32_t inputFunctionCall, uint8_t functionCallParameter, uint8_t gotoMenuEditField) | |
1572 { | |
1573 backmenu.pEventFunction = inputFunctionCall; | |
1574 backmenu.functionParameter = functionCallParameter; | |
1575 backmenu.line = gotoMenuEditField; | |
1576 } | |
1577 | |
1578 | |
1579 void setEvent(uint32_t inputEventID, uint32_t inputFunctionCall) | |
1580 { | |
1581 if(evidLast >= 9) | |
1582 return; | |
1583 | |
1584 /* set cursor to first field */ | |
1585 if(evidLast < 0) | |
1586 { | |
1587 startMenuEditFieldSelect(); | |
1588 } | |
1589 | |
1590 event[evid].callerID = inputEventID; | |
1591 event[evid].pEventFunction = inputFunctionCall; | |
1592 | |
1593 evidLast = evid; | |
1594 evid++; | |
1595 } | |
1596 | |
1597 void startEdit(void) | |
1598 { | |
1599 EnterPressed = 1; | |
1600 helperGotoMenuEditField(0); | |
1601 enterMenuEditField(); | |
1602 } | |
1603 | |
1604 void exitEditWithUpdate(void) | |
1605 { | |
1606 createDiveSettings(); | |
1607 EnterPressed = 1; | |
1608 exitMenuEdit(1); | |
1609 } | |
1610 | |
1611 /* | |
1612 void set_cursor(uint8_t forThisIdentID) | |
1613 { | |
1614 int16_t x0, x1, y0, y1; | |
1615 | |
1616 uint32_t xtra_left_right = 10; | |
1617 uint32_t xtra_top_bottom = 10; | |
1618 | |
1619 // y geht von 0 bis 799 | |
1620 // x geht von 0 bis 479 | |
1621 | |
1622 x0 = (int16_t)ident[forThisIdentID].coord[0]; | |
1623 x1 = (int16_t)ident[forThisIdentID].coord[1]; | |
1624 y0 = (int16_t)ident[forThisIdentID].coord[2]; | |
1625 y1 = y0 + (int16_t)ident[forThisIdentID].fontUsed->height; | |
1626 | |
1627 if(((int16_t)ident[forThisIdentID].fontUsed->height) > 70) | |
1628 { | |
1629 xtra_left_right = 10; | |
1630 xtra_top_bottom = 10; | |
1631 } | |
1632 else | |
1633 { | |
1634 xtra_left_right = 10; | |
1635 xtra_top_bottom = 0; | |
1636 } | |
1637 | |
1638 x0 -= xtra_left_right; | |
1639 x1 += xtra_left_right; | |
1640 y0 -= xtra_top_bottom; | |
1641 y1 += xtra_top_bottom; | |
1642 | |
1643 GFX_SetWindowLayer0(tMEcursor.FBStartAdress, x0, x1, y0, y1); | |
1644 } | |
1645 */ | |
1646 | |
1647 void set_cursorNew(uint8_t forThisIdentID) | |
1648 { | |
1649 int16_t y0; | |
1650 uint8_t lineMinusOne; | |
1651 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1652 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1653 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1654 y0 = (int16_t)ident[forThisIdentID].coord[2]; |
117 | 1655 y0 -= ME_Y_LINE1; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1656 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1657 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1658 { |
117 | 1659 y0 = 390 + 25 - (int16_t)ident[forThisIdentID].coord[2]; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1660 } |
117 | 1661 |
38 | 1662 y0 /= ME_Y_LINE_STEP; |
117 | 1663 if((y0 >= 0) && (y0 <=6)) |
38 | 1664 lineMinusOne = y0; |
1665 else | |
1666 lineMinusOne = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1667 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1668 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1669 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1670 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(lineMinusOne), 0, 25, 800, 390); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1671 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1672 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1673 { |
117 | 1674 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(6-lineMinusOne)) *2, 0, 480-390-25, 800, 390); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1675 } |
38 | 1676 } |
1677 | |
1678 | |
1679 void write_topline( char *text) | |
1680 { | |
1681 GFX_DrawCfgWindow hgfx; | |
1682 const tFont *Font = &FontT48; | |
1683 | |
1684 hgfx.Image = &tMEscreen; | |
1685 hgfx.WindowNumberOfTextLines = 1; | |
1686 hgfx.WindowLineSpacing = 0; | |
1687 hgfx.WindowTab = 0; | |
1688 hgfx.WindowX0 = 20; | |
1689 hgfx.WindowX1 = 779; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1690 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1691 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1692 hgfx.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1693 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1694 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1695 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1696 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1697 hgfx.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1698 hgfx.WindowY1 = hgfx.WindowY0 + Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1699 } |
38 | 1700 GFX_write_label(Font, &hgfx, text, menuColor); |
1701 } | |
1702 | |
1703 | |
1704 void write_buttonTextline( uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode) | |
1705 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1706 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1707 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1708 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1709 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1710 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1711 { |
117 | 1712 GFX_clean_area(&tMEscreen, 0, 800, 479-24,480); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1713 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1714 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1715 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1716 GFX_clean_area(&tMEscreen, 0, 800, 0, 24); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1717 } |
38 | 1718 |
1719 char localtext[32]; | |
1720 | |
1721 if(left2ByteCode) | |
1722 { | |
1723 localtext[0] = TXT_2BYTE; | |
1724 localtext[1] = left2ByteCode; | |
1725 localtext[2] = 0; | |
117 | 1726 |
1727 write_content_simple(&tMEscreen, 0, 800, 479-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); | |
38 | 1728 } |
1729 | |
1730 if(middle2ByteCode) | |
1731 { | |
1732 localtext[0] = '\001'; | |
1733 localtext[1] = TXT_2BYTE; | |
1734 localtext[2] = middle2ByteCode; | |
1735 localtext[3] = 0; | |
117 | 1736 |
1737 write_content_simple(&tMEscreen, 0, 800, 479-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); | |
38 | 1738 } |
1739 | |
1740 if(right2ByteCode) | |
1741 { | |
1742 localtext[0] = '\002'; | |
1743 localtext[1] = TXT_2BYTE; | |
1744 localtext[2] = right2ByteCode; | |
1745 localtext[3] = 0; | |
117 | 1746 |
1747 write_content_simple(&tMEscreen, 0, 800, 479-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); | |
38 | 1748 } |
1749 } | |
1750 | |
1751 | |
1752 | |
1753 void write_label_var(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text) | |
1754 { | |
1755 GFX_DrawCfgWindow hgfx; | |
1756 | |
1757 if(XrightGimpStyle > 799) | |
1758 XrightGimpStyle = 799; | |
1759 if(XleftGimpStyle >= XrightGimpStyle) | |
1760 XleftGimpStyle = 0; | |
1761 if(YtopGimpStyle > 479) | |
1762 YtopGimpStyle = 479; | |
1763 hgfx.Image = &tMEscreen; | |
1764 hgfx.WindowNumberOfTextLines = 1; | |
1765 hgfx.WindowLineSpacing = 0; | |
1766 hgfx.WindowTab = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1767 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1768 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1769 hgfx.WindowX0 = XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1770 hgfx.WindowX1 = XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1771 hgfx.WindowY1 = 479 - YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1772 if(hgfx.WindowY1 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1773 hgfx.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1774 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1775 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1776 } |
38 | 1777 else |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1778 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1779 hgfx.WindowX0 = 800 - XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1780 hgfx.WindowX1 = 800 - XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1781 hgfx.WindowY0 = YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1782 if(hgfx.WindowY0 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1783 hgfx.WindowY1 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1784 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1785 hgfx.WindowY1 = hgfx.WindowY0 + Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1786 } |
38 | 1787 GFX_write_label(Font, &hgfx, text, 0);/*menuColor);*/ |
1788 } | |
1789 | |
1790 | |
1791 void write_content(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t color) | |
1792 { | |
1793 GFX_DrawCfgWindow hgfx; | |
1794 | |
1795 if(XrightGimpStyle > 799) | |
1796 XrightGimpStyle = 799; | |
1797 if(XleftGimpStyle >= XrightGimpStyle) | |
1798 XleftGimpStyle = 0; | |
1799 if(YtopGimpStyle > 479) | |
1800 YtopGimpStyle = 479; | |
1801 hgfx.Image = &tMEscreen; | |
1802 hgfx.WindowNumberOfTextLines = 1; | |
1803 hgfx.WindowLineSpacing = 0; | |
1804 hgfx.WindowTab = 0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1805 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1806 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1807 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1808 hgfx.WindowX0 = XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1809 hgfx.WindowX1 = XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1810 hgfx.WindowY1 = 479 - YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1811 if(hgfx.WindowY1 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1812 hgfx.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1813 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1814 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1815 } |
38 | 1816 else |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1817 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1818 hgfx.WindowX0 = 800 - XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1819 hgfx.WindowX1 = 800 - XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1820 hgfx.WindowY0 = YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1821 if(hgfx.WindowY0 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1822 hgfx.WindowY1 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1823 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1824 hgfx.WindowY1 = hgfx.WindowY0 + Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1825 } |
38 | 1826 GFX_write_label(Font, &hgfx, text, color); |
1827 } | |
1828 | |
1829 | |
1830 void write_label_fix(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char textId) | |
1831 { | |
1832 char text[2]; | |
1833 | |
1834 text[0] = textId; | |
1835 text[1] = 0; | |
1836 | |
1837 write_label_var(XleftGimpStyle, XrightGimpStyle, YtopGimpStyle, Font, text); | |
1838 } | |
1839 | |
1840 | |
1841 void clean_content(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font) | |
1842 { | |
1843 GFX_DrawCfgWindow hgfx; | |
1844 | |
1845 if(XrightGimpStyle > 799) | |
1846 XrightGimpStyle = 799; | |
1847 if(XleftGimpStyle >= XrightGimpStyle) | |
1848 XleftGimpStyle = 0; | |
1849 if(YtopGimpStyle > 479) | |
1850 YtopGimpStyle = 479; | |
1851 hgfx.Image = &tMEscreen; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1852 if(!settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1853 { |
38 | 1854 hgfx.WindowX0 = XleftGimpStyle; |
1855 hgfx.WindowX1 = XrightGimpStyle; | |
1856 hgfx.WindowY1 = 479 - YtopGimpStyle; | |
1857 if(hgfx.WindowY1 < Font->height) | |
1858 hgfx.WindowY0 = 0; | |
1859 else | |
1860 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1861 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1862 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1863 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1864 hgfx.WindowX0 = 800 - XrightGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1865 hgfx.WindowX1 = 800 - XleftGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1866 hgfx.WindowY0 = YtopGimpStyle; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1867 if(hgfx.WindowY0 < Font->height) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1868 hgfx.WindowY1 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1869 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1870 hgfx.WindowY1 = hgfx.WindowY0 + Font->height; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1871 } |
38 | 1872 GFX_clear_window_immediately(&hgfx); |
1873 } | |
1874 | |
1875 | |
1876 /* Private functions ---------------------------------------------------------*/ | |
1877 | |
1878 void draw_tMEdesign(void) | |
1879 { | |
1880 GFX_draw_header(&tMEscreen,menuColor); | |
1881 } | |
1882 | |
1883 void draw_tMEdesignSubUnselected(uint32_t *ppDestination) | |
1884 { | |
1885 union al88_u | |
1886 { | |
1887 uint8_t al8[2]; | |
1888 uint16_t al88; | |
1889 }; | |
1890 | |
1891 union al88_u color_seperator; | |
1892 union al88_u color_unselected; | |
1893 int i; | |
1894 | |
1895 color_seperator.al8[0] = CLUT_MenuLineUnselectedSeperator; | |
1896 color_unselected.al8[0] = CLUT_MenuLineUnselected; | |
1897 | |
1898 color_seperator.al8[1] = 0xFF; | |
1899 color_unselected.al8[1] = 0xFF; | |
1900 | |
1901 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1902 *ppDestination += 2; | |
1903 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1904 *ppDestination += 2; | |
1905 | |
1906 for(i = 61; i > 0; i--) | |
1907 { | |
1908 *(__IO uint16_t*)*ppDestination = color_unselected.al88; | |
1909 *ppDestination += 2; | |
1910 } | |
1911 | |
1912 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1913 *ppDestination += 2; | |
1914 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1915 *ppDestination += 2; | |
1916 } | |
1917 | |
1918 | |
1919 void draw_tMEdesignSubSelected(uint32_t *ppDestination) | |
1920 { | |
1921 union al88_u | |
1922 { | |
1923 uint8_t al8[2]; | |
1924 uint16_t al88; | |
1925 }; | |
1926 | |
1927 union al88_u color_selected; | |
1928 union al88_u color_seperator; | |
1929 int i; | |
1930 | |
1931 color_selected.al8[0] = CLUT_MenuEditLineSelected; | |
1932 color_selected.al8[1] = 0xFF; | |
1933 | |
1934 color_seperator.al8[0] = CLUT_MenuLineSelectedSeperator; | |
1935 color_seperator.al8[1] = 0xFF; | |
1936 | |
1937 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1938 *ppDestination += 2; | |
1939 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1940 *ppDestination += 2; | |
1941 | |
1942 for(i = 61; i > 0; i--) | |
1943 { | |
1944 *(__IO uint16_t*)*ppDestination = color_selected.al88; | |
1945 *ppDestination += 2; | |
1946 } | |
1947 | |
1948 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1949 *ppDestination += 2; | |
1950 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
1951 *ppDestination += 2; | |
1952 } | |
1953 | |
1954 | |
1955 void draw_tMEdesignSubSelectedBorder(uint32_t *ppDestination) | |
1956 { | |
1957 union al88_u | |
1958 { | |
1959 uint8_t al8[2]; | |
1960 uint16_t al88; | |
1961 }; | |
1962 | |
1963 union al88_u color_selected_sides; | |
1964 | |
1965 int i; | |
1966 | |
1967 color_selected_sides.al8[0] = CLUT_MenuLineSelectedSides; | |
1968 color_selected_sides.al8[1] = 0xFF; | |
1969 | |
1970 for(i = 65; i > 0; i--) | |
1971 { | |
1972 *(__IO uint16_t*)*ppDestination = color_selected_sides.al88; | |
1973 *ppDestination += 2; | |
1974 } | |
1975 } | |
1976 | |
1977 | |
1978 void draw_tMEcursorNewDesign(void) | |
1979 { | |
1980 int i,j; | |
1981 uint32_t pDestination; | |
1982 | |
1983 pDestination = tMEcursorNew.FBStartAdress; | |
1984 | |
1985 for(j = 801; j > 0; j--) | |
1986 { | |
1987 for(i = 5; i > 0; i--) | |
1988 { | |
1989 draw_tMEdesignSubUnselected(&pDestination); | |
1990 } | |
1991 if((j > 787) || (j < 17)) | |
1992 draw_tMEdesignSubSelectedBorder(&pDestination); | |
1993 else | |
1994 draw_tMEdesignSubSelected(&pDestination); | |
1995 } | |
1996 } | |
552
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
1997 |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
1998 GFX_DrawCfgScreen* getMenuEditScreen() |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
1999 { |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2000 return &tMEscreen; |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2001 } |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2002 |
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
531
diff
changeset
|
2003 |