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