Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditCustom.c @ 506:998529b3e142
Added new top level menu for customization of views
In the previous versions all menus were occupied by menu option. To indroduce the selection views for data visualization a new tab had to be added.
The menu "Customize views" has been moded to the new tab but not yet removed from the previous one. In addition a view for selection of big font options has been added (including multilanguage strings and other infrastructure)
| author | Ideenmodellierer |
|---|---|
| date | Sun, 30 Aug 2020 17:19:23 +0200 |
| parents | |
| children | 218ac999e96b |
comparison
equal
deleted
inserted
replaced
| 505:06b21f1e47a5 | 506:998529b3e142 |
|---|---|
| 1 /////////////////////////////////////////////////////////////////////////////// | |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Src/tMenuEditXtra.c | |
| 5 /// \brief Menu Edit Xtra - Specials in Divemode like Reset Stopwatch | |
| 6 /// \author heinrichs weikamp gmbh | |
| 7 /// \date 02-Mar-2015 | |
| 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 "tMenuEditCustom.h" | |
| 31 | |
| 32 #include "gfx_fonts.h" | |
| 33 #include "simulation.h" | |
| 34 #include "timer.h" | |
| 35 #include "tMenuEdit.h" | |
| 36 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() | |
| 37 #include "t3.h" | |
| 38 #include "t7.h" | |
| 39 #include "data_exchange_main.h" | |
| 40 #include "motion.h" | |
| 41 | |
| 42 #define CV_PER_PAGE (5u) /* number of cv selections shown at one page */ | |
| 43 | |
| 44 static uint8_t customviewsSubpage = 0; | |
| 45 static uint8_t customviewsSubpageMax = 0; /* number of pages needed to display all selectable views */ | |
| 46 static const uint8_t* pcv_curchangelist; | |
| 47 /* Private function prototypes -----------------------------------------------*/ | |
| 48 void openEdit_Customview2(void); | |
| 49 void refresh_Customviews2(void); | |
| 50 /* Announced function prototypes -----------------------------------------------*/ | |
| 51 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 52 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 53 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 54 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 55 | |
| 56 | |
| 57 /* Exported functions --------------------------------------------------------*/ | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 void refresh_Customviews2(void) | |
| 63 { | |
| 64 char text[32]; | |
| 65 uint8_t textpointer = 0; | |
| 66 | |
| 67 // header | |
| 68 text[0] = '\001'; | |
| 69 text[1] = TXT_2BYTE; | |
| 70 text[2] = TXT2BYTE_Customviews; | |
| 71 text[3] = 0; | |
| 72 write_topline(text); | |
| 73 | |
| 74 // custom view center return | |
| 75 textpointer = 0; | |
| 76 text[textpointer++] = TXT_2BYTE; | |
| 77 text[textpointer++] = TXT2BYTE_CViewTimeout; | |
| 78 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_customViewTimeout,TXT_Seconds); | |
| 79 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text); | |
| 80 | |
| 81 // custom view center primary | |
| 82 text[0] = TXT_2BYTE; | |
| 83 text[1] = TXT2BYTE_CViewStandard; | |
| 84 text[2] = ' '; | |
| 85 text[3] = ' '; | |
| 86 switch(settingsGetPointer()->tX_customViewPrimary) | |
| 87 { | |
| 88 case CVIEW_sensors: | |
| 89 text[4] = TXT_2BYTE; | |
| 90 text[5] = TXT2BYTE_O2monitor; | |
| 91 break; | |
| 92 case CVIEW_sensors_mV: | |
| 93 text[4] = TXT_2BYTE; | |
| 94 text[5] = TXT2BYTE_O2voltage; | |
| 95 break; | |
| 96 case CVIEW_Compass: | |
| 97 text[4] = TXT_2BYTE; | |
| 98 text[5] = TXT2BYTE_Compass; | |
| 99 break; | |
| 100 case CVIEW_Decolist: | |
| 101 text[4] = TXT_2BYTE; | |
| 102 text[5] = TXT2BYTE_Decolist; | |
| 103 break; | |
| 104 case CVIEW_Tissues: | |
| 105 text[4] = TXT_2BYTE; | |
| 106 text[5] = TXT2BYTE_Tissues; | |
| 107 break; | |
| 108 case CVIEW_Profile: | |
| 109 text[4] = TXT_2BYTE; | |
| 110 text[5] = TXT2BYTE_Profile; | |
| 111 break; | |
| 112 case CVIEW_Gaslist: | |
| 113 text[4] = TXT_2BYTE; | |
| 114 text[5] = TXT2BYTE_Gaslist; | |
| 115 break; | |
| 116 case CVIEW_EADTime: | |
| 117 text[4] = TXT_2BYTE; | |
| 118 text[5] = TXT2BYTE_Info; | |
| 119 break; | |
| 120 case CVIEW_SummaryOfLeftCorner: | |
| 121 text[4] = TXT_2BYTE; | |
| 122 text[5] = TXT2BYTE_Summary; | |
| 123 break; | |
| 124 case CVIEW_noneOrDebug: | |
| 125 text[4] = ' '; | |
| 126 text[5] = '-'; | |
| 127 break; | |
| 128 default: | |
| 129 snprintf(&text[4],3,"%02u",settingsGetPointer()->tX_customViewPrimary); | |
| 130 break; | |
| 131 } | |
| 132 text[6] = 0; | |
| 133 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text); | |
| 134 | |
| 135 | |
| 136 // field corner return | |
| 137 textpointer = 0; | |
| 138 text[textpointer++] = TXT_2BYTE; | |
| 139 text[textpointer++] = TXT2BYTE_CornerTimeout; | |
| 140 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds); | |
| 141 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); | |
| 142 | |
| 143 // field corner primary | |
| 144 text[0] = TXT_2BYTE; | |
| 145 text[1] = TXT2BYTE_CornerStandard; | |
| 146 text[2] = ' '; | |
| 147 text[3] = ' '; | |
| 148 switch(settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary) | |
| 149 { | |
| 150 /* Temperature */ | |
| 151 case LLC_Temperature: | |
| 152 text[4] = TXT_Temperature; | |
| 153 break; | |
| 154 /* Average Depth */ | |
| 155 case LLC_AverageDepth: | |
| 156 text[4] = TXT_AvgDepth; | |
| 157 break; | |
| 158 /* ppO2 */ | |
| 159 case LLC_ppO2: | |
| 160 text[4] = TXT_ppO2; | |
| 161 break; | |
| 162 /* Stop Uhr */ | |
| 163 case LLC_Stopwatch: | |
| 164 text[4] = TXT_Stopwatch; | |
| 165 break; | |
| 166 /* Ceiling */ | |
| 167 case LLC_Ceiling: | |
| 168 text[4] = TXT_Ceiling; | |
| 169 break; | |
| 170 /* Future TTS */ | |
| 171 case LLC_FutureTTS: | |
| 172 text[4] = TXT_FutureTTS; | |
| 173 break; | |
| 174 /* CNS */ | |
| 175 case LLC_CNS: | |
| 176 text[4] = TXT_CNS; | |
| 177 break; | |
| 178 case LLC_GF: | |
| 179 text[4] = TXT_ActualGradient; | |
| 180 break; | |
| 181 #ifdef ENABLE_BOTTLE_SENSOR | |
| 182 case LCC_BottleBar: | |
| 183 text[4] = TXT_AtemGasVorrat; | |
| 184 break; | |
| 185 #endif | |
| 186 /* none */ | |
| 187 case LLC_Empty: | |
| 188 text[4] = '-'; | |
| 189 break; | |
| 190 default: | |
| 191 snprintf(&text[4],2,"%u",settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary); | |
| 192 break; | |
| 193 } | |
| 194 text[5] = 0; | |
| 195 write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text); | |
| 196 | |
| 197 | |
| 198 // extra display | |
| 199 text[0] = TXT_2BYTE; | |
| 200 text[1] = TXT2BYTE_ExtraDisplay; | |
| 201 text[2] = ' '; | |
| 202 text[3] = ' '; | |
| 203 text[4] = TXT_2BYTE; | |
| 204 switch(settingsGetPointer()->extraDisplay) | |
| 205 { | |
| 206 /* BigFont */ | |
| 207 case EXTRADISPLAY_BIGFONT: | |
| 208 text[5] = TXT2BYTE_ExtraBigFont; | |
| 209 break; | |
| 210 /* DecoGame */ | |
| 211 case EXTRADISPLAY_DECOGAME: | |
| 212 text[5] = TXT2BYTE_ExtraDecoGame; | |
| 213 break; | |
| 214 /* none */ | |
| 215 case EXTRADISPLAY_none: | |
| 216 text[5] = TXT2BYTE_ExtraNone; | |
| 217 break; | |
| 218 | |
| 219 default: | |
| 220 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay); | |
| 221 break; | |
| 222 } | |
| 223 text[6] = 0; | |
| 224 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text); | |
| 225 | |
| 226 /* MotionCtrl */ | |
| 227 text[0] = TXT_2BYTE; | |
| 228 text[1] = TXT2BYTE_MotionCtrl; | |
| 229 text[2] = ' '; | |
| 230 text[3] = ' '; | |
| 231 text[4] = TXT_2BYTE; | |
| 232 switch(settingsGetPointer()->MotionDetection) | |
| 233 { | |
| 234 case MOTION_DETECT_OFF: | |
| 235 text[5] = TXT2BYTE_MoCtrlNone; | |
| 236 break; | |
| 237 case MOTION_DETECT_MOVE: | |
| 238 text[5] = TXT2BYTE_MoCtrlPitch; | |
| 239 break; | |
| 240 case MOTION_DETECT_SECTOR: | |
| 241 text[5] = TXT2BYTE_MoCtrlSector; | |
| 242 break; | |
| 243 case MOTION_DETECT_SCROLL: | |
| 244 text[5] = TXT2BYTE_MoCtrlScroll; | |
| 245 break; | |
| 246 default: | |
| 247 snprintf(&text[4],2,"%u",settingsGetPointer()->MotionDetection); | |
| 248 break; | |
| 249 } | |
| 250 text[6] = 0; | |
| 251 write_label_var( 30, 700, ME_Y_LINE6, &FontT48, text); | |
| 252 | |
| 253 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
| 254 } | |
| 255 | |
| 256 void openEdit_Custom(uint8_t line) | |
| 257 { | |
| 258 set_globalState_Menu_Line(line); | |
| 259 resetMenuEdit(CLUT_MenuPageCustomView); | |
| 260 | |
| 261 switch(line) | |
| 262 { | |
| 263 case 1: | |
| 264 default: | |
| 265 openEdit_Customview2(); | |
| 266 break; | |
| 267 case 2: | |
| 268 openEdit_CustomviewDivemode2(cv_changelist); | |
| 269 break; | |
| 270 case 3: | |
| 271 openEdit_CustomviewDivemode2(cv_changelist_BS); | |
| 272 break; | |
| 273 } | |
| 274 } | |
| 275 | |
| 276 /* Private functions ---------------------------------------------------------*/ | |
| 277 void openEdit_Customview2(void) | |
| 278 { | |
| 279 refresh_Customviews2(); | |
| 280 | |
| 281 write_field_button(StMCustom1_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, ""); | |
| 282 write_field_button(StMCustom1_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, ""); | |
| 283 | |
| 284 write_field_button(StMCustom1_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); | |
| 285 write_field_button(StMCustom1_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); | |
| 286 | |
| 287 // write_field_button(StMCustom1_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, ""); | |
| 288 // write_field_button(StMCustom1_MotionCtrl, 400, 700, ME_Y_LINE6, &FontT48, ""); | |
| 289 | |
| 290 setEvent(StMCustom1_CViewTimeout, (uint32_t)OnAction_CViewTimeout); | |
| 291 setEvent(StMCustom1_CViewStandard, (uint32_t)OnAction_CViewStandard); | |
| 292 | |
| 293 setEvent(StMCustom1_CornerTimeout, (uint32_t)OnAction_CornerTimeout); | |
| 294 setEvent(StMCustom1_CornerStandard, (uint32_t)OnAction_CornerStandard); | |
| 295 | |
| 296 // setEvent(StMCustom1_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay); | |
| 297 // setEvent(StMCustom1_MotionCtrl, (uint32_t)OnAction_MotionCtrl); | |
| 298 } | |
| 299 | |
| 300 char customview_TXT2BYTE_helper2(uint8_t customViewId) | |
| 301 { | |
| 302 char text = 0; | |
| 303 | |
| 304 switch(customViewId) | |
| 305 { | |
| 306 case CVIEW_sensors: | |
| 307 text = TXT2BYTE_O2monitor; | |
| 308 break; | |
| 309 case CVIEW_sensors_mV: | |
| 310 text = TXT2BYTE_O2voltage; | |
| 311 break; | |
| 312 case CVIEW_Compass: | |
| 313 text = TXT2BYTE_Compass; | |
| 314 break; | |
| 315 case CVIEW_Decolist: | |
| 316 case CVIEW_T3_Decostop: | |
| 317 text = TXT2BYTE_Decolist; | |
| 318 break; | |
| 319 case CVIEW_Tissues: | |
| 320 text = TXT2BYTE_Tissues; | |
| 321 break; | |
| 322 case CVIEW_Profile: | |
| 323 text = TXT2BYTE_Profile; | |
| 324 break; | |
| 325 case CVIEW_Gaslist: | |
| 326 text = TXT2BYTE_Gaslist; | |
| 327 break; | |
| 328 case CVIEW_EADTime: | |
| 329 text = TXT2BYTE_Info; | |
| 330 break; | |
| 331 case CVIEW_SummaryOfLeftCorner: | |
| 332 text = TXT2BYTE_Summary; | |
| 333 break; | |
| 334 case CVIEW_noneOrDebug: | |
| 335 text = TXT2BYTE_DispNoneDbg; | |
| 336 break; | |
| 337 case CVIEW_T3_MaxDepth: | |
| 338 text = TXT2BYTE_MaxDepth; | |
| 339 break; | |
| 340 case CVIEW_T3_StopWatch: | |
| 341 text = TXT2BYTE_Stopwatch; | |
| 342 break; | |
| 343 case CVIEW_T3_TTS: | |
| 344 text = TXT2BYTE_TTS; | |
| 345 break; | |
| 346 case CVIEW_T3_ppO2andGas: | |
| 347 text = TXT2BYTE_ppoNair; | |
| 348 break; | |
| 349 case CVIEW_T3_Navigation: | |
| 350 text = TXT2BYTE_Navigation; | |
| 351 break; | |
| 352 case CVIEW_T3_DepthData: | |
| 353 text = TXT2BYTE_DepthData; | |
| 354 break; | |
| 355 default: | |
| 356 break; | |
| 357 } | |
| 358 return text; | |
| 359 } | |
| 360 | |
| 361 | |
| 362 uint8_t OnAction_CViewTimeout2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 363 { | |
| 364 uint8_t value; | |
| 365 value = settingsGetPointer()->tX_customViewTimeout; | |
| 366 | |
| 367 if(value < 5) | |
| 368 value = 5; | |
| 369 else if(value < 10) | |
| 370 value = 10; | |
| 371 else if(value < 15) | |
| 372 value = 15; | |
| 373 else if(value < 20) | |
| 374 value = 20; | |
| 375 else if(value < 30) | |
| 376 value = 30; | |
| 377 else if(value < 45) | |
| 378 value = 45; | |
| 379 else if(value < 60) | |
| 380 value = 60; | |
| 381 else | |
| 382 value = 0; | |
| 383 | |
| 384 settingsGetPointer()->tX_customViewTimeout = value; | |
| 385 return UPDATE_DIVESETTINGS; | |
| 386 } | |
| 387 | |
| 388 | |
| 389 uint8_t OnAction_CViewStandard2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 390 { | |
| 391 uint8_t newValue; | |
| 392 switch(settingsGetPointer()->tX_customViewPrimary) | |
| 393 { | |
| 394 case CVIEW_sensors: | |
| 395 newValue = CVIEW_sensors_mV; | |
| 396 break; | |
| 397 case CVIEW_sensors_mV: | |
| 398 newValue = CVIEW_Compass; | |
| 399 break; | |
| 400 case CVIEW_Compass: | |
| 401 newValue = CVIEW_Decolist; | |
| 402 break; | |
| 403 case CVIEW_Decolist: | |
| 404 newValue = CVIEW_Tissues; | |
| 405 break; | |
| 406 case CVIEW_Tissues: | |
| 407 newValue = CVIEW_Profile; | |
| 408 break; | |
| 409 case CVIEW_Profile: | |
| 410 newValue = CVIEW_Gaslist; | |
| 411 break; | |
| 412 case CVIEW_Gaslist: | |
| 413 newValue = CVIEW_EADTime; | |
| 414 break; | |
| 415 case CVIEW_EADTime: | |
| 416 newValue = CVIEW_SummaryOfLeftCorner; | |
| 417 break; | |
| 418 case CVIEW_SummaryOfLeftCorner: | |
| 419 newValue = CVIEW_noneOrDebug; | |
| 420 break; | |
| 421 case CVIEW_noneOrDebug: | |
| 422 default: | |
| 423 newValue = CVIEW_sensors; | |
| 424 break; | |
| 425 } | |
| 426 settingsGetPointer()->tX_customViewPrimary = newValue; | |
| 427 return UPDATE_DIVESETTINGS; | |
| 428 } | |
| 429 | |
| 430 | |
| 431 uint8_t OnAction_CornerTimeout2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 432 { | |
| 433 uint8_t value; | |
| 434 value = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; | |
| 435 | |
| 436 if(value < 5) | |
| 437 value = 5; | |
| 438 else if(value < 10) | |
| 439 value = 10; | |
| 440 else if(value < 15) | |
| 441 value = 15; | |
| 442 else if(value < 20) | |
| 443 value = 20; | |
| 444 else if(value < 30) | |
| 445 value = 30; | |
| 446 else if(value < 45) | |
| 447 value = 45; | |
| 448 else if(value < 60) | |
| 449 value = 60; | |
| 450 else | |
| 451 value = 0; | |
| 452 | |
| 453 settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout = value; | |
| 454 return UPDATE_DIVESETTINGS; | |
| 455 } | |
| 456 | |
| 457 | |
| 458 uint8_t OnAction_CornerStandard2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 459 { | |
| 460 uint8_t value; | |
| 461 value = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
| 462 | |
| 463 value += 1; | |
| 464 | |
| 465 if(value >= LLC_END) | |
| 466 value = 0; | |
| 467 | |
| 468 settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary = value; | |
| 469 return UPDATE_DIVESETTINGS; | |
| 470 } | |
| 471 | |
| 472 | |
| 473 uint8_t OnAction_Customview_Toggle(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 474 { | |
| 475 | |
| 476 uint8_t line = 0; | |
| 477 SSettings *pSettings = settingsGetPointer(); | |
| 478 | |
| 479 switch(editId) | |
| 480 { | |
| 481 case StMCustom2_CViewSelection1: line = 1; | |
| 482 break; | |
| 483 case StMCustom2_CViewSelection2: line = 2; | |
| 484 break; | |
| 485 case StMCustom2_CViewSelection3: line = 3; | |
| 486 break; | |
| 487 case StMCustom2_CViewSelection4: line = 4; | |
| 488 break; | |
| 489 case StMCustom2_CViewSelection5: line = 5; | |
| 490 break; | |
| 491 | |
| 492 default: | |
| 493 break; | |
| 494 } | |
| 495 if(pcv_curchangelist == cv_changelist) | |
| 496 { | |
| 497 pSettings->cv_configuration ^= 1 << (pcv_curchangelist[customviewsSubpage * 5 + line-1]); | |
| 498 if(t7_GetEnabled_customviews() == 0) | |
| 499 { | |
| 500 pSettings->cv_configuration ^= (1 << CVIEW_noneOrDebug); | |
| 501 } | |
| 502 } | |
| 503 else | |
| 504 { | |
| 505 pSettings->cv_config_BigScreen ^= 1 << (pcv_curchangelist[customviewsSubpage * 5 + line-1]); | |
| 506 if(t3_GetEnabled_customviews() == 0) | |
| 507 { | |
| 508 pSettings->cv_config_BigScreen ^= (1 << CVIEW_noneOrDebug); | |
| 509 } | |
| 510 } | |
| 511 return UPDATE_DIVESETTINGS; | |
| 512 } | |
| 513 | |
| 514 | |
| 515 uint8_t OnAction_Customview_NextPage(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 516 { | |
| 517 uint8_t id_next = 0; | |
| 518 customviewsSubpage++; | |
| 519 if(customviewsSubpage == customviewsSubpageMax) | |
| 520 { | |
| 521 customviewsSubpage = 0; | |
| 522 } | |
| 523 resetMenuEdit(CLUT_MenuPageCustomView); /* rebuild page */ | |
| 524 openEdit_CustomviewDivemode2(pcv_curchangelist); | |
| 525 | |
| 526 tMenuEdit_select(StMCustom2_CViewSelection6); | |
| 527 return UPDATE_DIVESETTINGS; | |
| 528 } | |
| 529 | |
| 530 void openEdit_CustomviewDivemode2(const uint8_t* pcv_changelist) | |
| 531 { | |
| 532 | |
| 533 SSettings *pSettings = settingsGetPointer(); | |
| 534 char text[MAX_PAGE_TEXTSIZE]; | |
| 535 uint8_t textPointer = 0; | |
| 536 uint32_t id; | |
| 537 | |
| 538 uint8_t i; | |
| 539 | |
| 540 customviewsSubpageMax = (tHome_getNumberOfAvailableCVs(pcv_changelist) / CV_PER_PAGE) + 1; | |
| 541 pcv_curchangelist = pcv_changelist; | |
| 542 | |
| 543 CustomviewDivemode2_refresh(pcv_changelist); | |
| 544 | |
| 545 | |
| 546 text[0] = '\001'; | |
| 547 text[1] = TXT_2BYTE; | |
| 548 text[2] = TXT2BYTE_SelectCustomviews; | |
| 549 text[3] = 0; | |
| 550 write_topline(text); | |
| 551 | |
| 552 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ | |
| 553 { | |
| 554 textPointer = 0; | |
| 555 id = pcv_changelist[customviewsSubpage * 5 + i]; | |
| 556 if((id == CVIEW_END) || (id == CVIEW_T3_END)) /* last list item? */ | |
| 557 { | |
| 558 break; | |
| 559 } | |
| 560 else | |
| 561 { | |
| 562 if(pcv_changelist == cv_changelist) | |
| 563 { | |
| 564 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_configuration,id); | |
| 565 } | |
| 566 else | |
| 567 { | |
| 568 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_config_BigScreen,id); | |
| 569 } | |
| 570 text[textPointer++] = ' '; | |
| 571 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper2(id)); | |
| 572 | |
| 573 switch(i) | |
| 574 { | |
| 575 case 0: write_field_button(StMCustom2_CViewSelection1, 30, 800, ME_Y_LINE1, &FontT48, ""); | |
| 576 break; | |
| 577 case 1: write_field_button(StMCustom2_CViewSelection2, 30, 800, ME_Y_LINE2, &FontT48, ""); | |
| 578 break; | |
| 579 case 2: write_field_button(StMCustom2_CViewSelection3, 30, 800, ME_Y_LINE3, &FontT48, ""); | |
| 580 break; | |
| 581 case 3: write_field_button(StMCustom2_CViewSelection4, 30, 800, ME_Y_LINE4, &FontT48, ""); | |
| 582 break; | |
| 583 case 4: write_field_button(StMCustom2_CViewSelection5, 30, 800, ME_Y_LINE5, &FontT48, ""); | |
| 584 break; | |
| 585 default: | |
| 586 break; | |
| 587 } | |
| 588 } | |
| 589 } | |
| 590 // setEvent(StMCustom2_CViewSelection1, (uint32_t)OnAction_Customview_Toggle); | |
| 591 | |
| 592 | |
| 593 if(customviewsSubpageMax != 1) | |
| 594 { | |
| 595 textPointer = 0; | |
| 596 text[textPointer++] = TXT_2BYTE; | |
| 597 text[textPointer++] = TXT2BYTE_ButtonNext; | |
| 598 text[textPointer] = 0; | |
| 599 write_field_button(StMCustom2_CViewSelection6, 30, 800, ME_Y_LINE6, &FontT48, text); | |
| 600 } | |
| 601 | |
| 602 /* because of the ID handling inside of the functions, all buttons needs to be assigned before the events may be set => have the same loop twice */ | |
| 603 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ | |
| 604 { | |
| 605 id = pcv_changelist[customviewsSubpage * 5 + i]; | |
| 606 if((id == CVIEW_END) || (id == CVIEW_T3_END)) /* last list item? */ | |
| 607 { | |
| 608 break; | |
| 609 } | |
| 610 else | |
| 611 { | |
| 612 switch(i) | |
| 613 { | |
| 614 case 0: setEvent(StMCustom2_CViewSelection1, (uint32_t)OnAction_Customview_Toggle); | |
| 615 break; | |
| 616 case 1: setEvent(StMCustom2_CViewSelection2, (uint32_t)OnAction_Customview_Toggle); | |
| 617 break; | |
| 618 case 2: setEvent(StMCustom2_CViewSelection3, (uint32_t)OnAction_Customview_Toggle); | |
| 619 break; | |
| 620 case 3: setEvent(StMCustom2_CViewSelection4, (uint32_t)OnAction_Customview_Toggle); | |
| 621 break; | |
| 622 case 4: setEvent(StMCustom2_CViewSelection5, (uint32_t)OnAction_Customview_Toggle); | |
| 623 break; | |
| 624 | |
| 625 default: | |
| 626 break; | |
| 627 } | |
| 628 | |
| 629 } | |
| 630 } | |
| 631 if(customviewsSubpageMax != 1) | |
| 632 { | |
| 633 setEvent(StMCustom2_CViewSelection6,(uint32_t)OnAction_Customview_NextPage); | |
| 634 } | |
| 635 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */ | |
| 636 { | |
| 637 switch(i) | |
| 638 { | |
| 639 case 0: write_label_var( 30, 800, ME_Y_LINE1, &FontT48, ""); | |
| 640 break; | |
| 641 case 1: write_label_var( 30, 800, ME_Y_LINE2, &FontT48, ""); | |
| 642 break; | |
| 643 case 2: write_label_var( 30, 800, ME_Y_LINE3, &FontT48, ""); | |
| 644 break; | |
| 645 case 3: write_label_var( 30, 800, ME_Y_LINE4, &FontT48, ""); | |
| 646 break; | |
| 647 case 4: write_label_var( 30, 800, ME_Y_LINE5, &FontT48, ""); | |
| 648 break; | |
| 649 default: | |
| 650 break; | |
| 651 }; | |
| 652 } | |
| 653 | |
| 654 | |
| 655 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
| 656 } | |
| 657 | |
| 658 | |
| 659 void CustomviewDivemode2_refresh() | |
| 660 { | |
| 661 SSettings *pSettings = settingsGetPointer(); | |
| 662 char text[MAX_PAGE_TEXTSIZE]; | |
| 663 uint8_t textPointer = 0; | |
| 664 uint32_t id; | |
| 665 | |
| 666 uint8_t i; | |
| 667 | |
| 668 text[0] = '\001'; | |
| 669 text[1] = TXT_2BYTE; | |
| 670 text[2] = TXT2BYTE_SelectCustomviews; | |
| 671 text[3] = 0; | |
| 672 write_topline(text); | |
| 673 | |
| 674 | |
| 675 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ | |
| 676 { | |
| 677 textPointer = 0; | |
| 678 id = pcv_curchangelist[customviewsSubpage * 5 + i]; | |
| 679 if((id == CVIEW_END) || (id == CVIEW_T3_END)) /* last list item? */ | |
| 680 { | |
| 681 break; | |
| 682 } | |
| 683 else | |
| 684 { | |
| 685 if(pcv_curchangelist == cv_changelist) | |
| 686 { | |
| 687 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_configuration,id); | |
| 688 } | |
| 689 else | |
| 690 { | |
| 691 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_config_BigScreen,id); | |
| 692 } | |
| 693 text[textPointer++] = ' '; | |
| 694 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper2(id)); | |
| 695 | |
| 696 switch(i) | |
| 697 { | |
| 698 case 0: write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text); | |
| 699 break; | |
| 700 case 1: write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text); | |
| 701 break; | |
| 702 case 2: write_label_var( 30, 800, ME_Y_LINE3, &FontT48, text); | |
| 703 break; | |
| 704 case 3: write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
| 705 break; | |
| 706 case 4: write_label_var( 30, 800, ME_Y_LINE5, &FontT48, text); | |
| 707 break; | |
| 708 default: | |
| 709 break; | |
| 710 } | |
| 711 } | |
| 712 } | |
| 713 if(customviewsSubpageMax != 1) | |
| 714 { | |
| 715 textPointer = 0; | |
| 716 text[textPointer++] = TXT_2BYTE; | |
| 717 text[textPointer++] = TXT2BYTE_ButtonNext; | |
| 718 text[textPointer] = 0; | |
| 719 write_label_var( 30, 800, ME_Y_LINE6, &FontT48, text); | |
| 720 } | |
| 721 } |
