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