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