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