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