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