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