-
Notifications
You must be signed in to change notification settings - Fork 25
/
SettingsUI.cpp
958 lines (862 loc) · 54.9 KB
/
SettingsUI.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
/// @file SettingsUI.cpp
/// @brief Implements the Settings window
/// @author Birger Hoppe
/// @copyright (c) 2018-2020 Birger Hoppe
/// @copyright Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:\n
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.\n
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
#include "LiveTraffic.h"
//
//MARK: LTSettingsUI
//
LTSettingsUI::LTSettingsUI () :
widgetIds(nullptr)
{}
LTSettingsUI::~LTSettingsUI()
{
// just in case...
Disable();
}
//
//MARK: Window Structure
// Basics | Debug
//
// indexes into the below definition array, must be kept in synch with the same
enum UI_WIDGET_IDX_T {
UI_MAIN_WND = 0,
// Buttons to select 'tabs'
UI_BTN_BASICS,
UI_BTN_AC_LABELS,
UI_BTN_ADVANCED,
UI_BTN_CSL,
UI_BTN_DEBUG,
UI_BTN_HELP,
// "Basics" tab
UI_BASICS_LIVE_SUB_WND,
UI_BASICS_BTN_ENABLE,
UI_BASICS_BTN_AUTO_START,
UI_BASICS_CAP_FDCHANNELS,
UI_BASICS_BTN_OPENSKY_LIVE,
UI_BASICS_BTN_OPENSKY_MASTERDATA,
UI_BASICS_BTN_ADSB_LIVE,
UI_BASICS_TXT_ADSB_API_KEY,
UI_BASICS_CAP_ADSB_OUTPUT,
UI_BASICS_BTN_REALTRAFFIC_LIVE,
UI_BASICS_CAP_REALTRAFFIC_STATUS,
UI_BASICS_CAP_REALTRAFFIC_METAR,
UI_BASICS_CAP_VERSION_TXT,
UI_BASICS_CAP_VERSION,
UI_BASICS_RIGHT_SUB_WND,
UI_BASICS_CAP_MISC,
UI_BASICS_BTN_LND_LIGHTS_TAXI,
UI_BASICS_CAP_PARALLEL,
UI_BASICS_CAP_HIDE_BELOW_AGL,
UI_BASICS_INT_HIDE_BELOW_AGL,
UI_BASICS_BTN_HIDE_TAXIING,
UI_BASICS_BTN_AI_ON_REQUEST,
UI_BASICS_CAP_OUTPUT_CHANNELS,
UI_BASICS_BTN_FOREFLIGHT_SEND,
UI_BASICS_INT_FOREFLIGHT_INTVL,
UI_BASICS_CAP_FOREFLIGHT_S,
UI_BASICS_BTN_FOREFLIGHT_USERSPLANE,
UI_BASICS_BTN_FOREFLIGHT_TRAFFIC,
UI_BASICS_CAP_DBG_LIMIT,
// "A/C Labels" tab
UI_LABELS_SUB_WND,
UI_LABELS_CAP_STATIC,
UI_LABELS_BTN_TYPE,
UI_LABELS_BTN_AC_ID,
UI_LABELS_BTN_TRANSP,
UI_LABELS_BTN_REG,
UI_LABELS_BTN_OP,
UI_LABELS_BTN_CALL_SIGN,
UI_LABELS_BTN_FLIGHT_NO,
UI_LABELS_BTN_ROUTE,
UI_LABELS_CAP_DYNAMIC,
UI_LABELS_BTN_PHASE,
UI_LABELS_BTN_HEADING,
UI_LABELS_BTN_ALT,
UI_LABELS_BTN_HEIGHT,
UI_LABELS_BTN_SPEED,
UI_LABELS_BTN_VSI,
UI_LABELS_CAP_COLOR,
UI_LABELS_BTN_DYNAMIC,
UI_LABELS_BTN_FIXED,
UI_LABELS_TXT_COLOR,
UI_LABELS_BTN_YELLOW,
UI_LABELS_BTN_RED,
UI_LABELS_BTN_GREEN,
UI_LABELS_BTN_BLUE,
UI_LABELS_CAP_WHEN,
UI_LABELS_BTN_EXTERNAL,
UI_LABELS_BTN_INTERNAL,
UI_LABELS_BTN_VR,
// "Advanced" tab
UI_ADVCD_SUB_WND,
UI_ADVCD_CAP_LOGLEVEL,
UI_ADVCD_BTN_LOG_FATAL,
UI_ADVCD_BTN_LOG_ERROR,
UI_ADVCD_BTN_LOG_WARNING,
UI_ADVCD_BTN_LOG_INFO,
UI_ADVCD_BTN_LOG_DEBUG,
UI_ADVCD_CAP_MSGAREA_LEVEL,
UI_ADVCD_BTN_MSGAREA_FATAL,
UI_ADVCD_BTN_MSGAREA_ERROR,
UI_ADVCD_BTN_MSGAREA_WARNING,
UI_ADVCD_BTN_MSGAREA_INFO,
UI_ADVCD_CAP_MAX_NUM_AC,
UI_ADVCD_INT_MAX_NUM_AC,
UI_ADVCD_CAP_MAX_FULL_NUM_AC,
UI_ADVCD_INT_MAX_FULL_NUM_AC,
UI_ADVCD_CAP_FULL_DISTANCE,
UI_ADVCD_INT_FULL_DISTANCE,
UI_ADVCD_CAP_FD_STD_DISTANCE,
UI_ADVCD_INT_FD_STD_DISTANCE,
UI_ADVCD_CAP_FD_SNAP_TAXI_DIST,
UI_ADVCD_INT_FD_SNAP_TAXI_DIST,
UI_ADVCD_CAP_FD_REFRESH_INTVL,
UI_ADVCD_INT_FD_REFRESH_INTVL,
UI_ADVCD_CAP_FD_BUF_PERIOD,
UI_ADVCD_INT_FD_BUF_PERIOD,
UI_ADVCD_CAP_AC_OUTDATED_INTVL,
UI_ADVCD_INT_AC_OUTDATED_INTVL,
UI_ADVCD_CAP_NETW_TIMEOUT,
UI_ADVCD_INT_NETW_TIMEOUT,
// "CSL" tab
UI_CSL_SUB_WND,
UI_CSL_CAP_PATHS,
UI_CSL_BTN_ENABLE_1,
UI_CSL_TXT_PATH_1,
UI_CSL_BTN_LOAD_1,
UI_CSL_BTN_ENABLE_2,
UI_CSL_TXT_PATH_2,
UI_CSL_BTN_LOAD_2,
UI_CSL_BTN_ENABLE_3,
UI_CSL_TXT_PATH_3,
UI_CSL_BTN_LOAD_3,
UI_CSL_BTN_ENABLE_4,
UI_CSL_TXT_PATH_4,
UI_CSL_BTN_LOAD_4,
UI_CSL_BTN_ENABLE_5,
UI_CSL_TXT_PATH_5,
UI_CSL_BTN_LOAD_5,
UI_CSL_BTN_ENABLE_6,
UI_CSL_TXT_PATH_6,
UI_CSL_BTN_LOAD_6,
UI_CSL_BTN_ENABLE_7,
UI_CSL_TXT_PATH_7,
UI_CSL_BTN_LOAD_7,
UI_CSL_CAP_DEFAULT_AC_TYPE,
UI_CSL_TXT_DEFAULT_AC_TYPE,
UI_CSL_CAP_GROUND_VEHICLE_TYPE,
UI_CSL_TXT_GROUND_VEHICLE_TYPE,
// "Debug" tab
UI_DEBUG_SUB_WND,
UI_DEBUG_CAP_FILTER,
UI_DEBUG_TXT_FILTER,
UI_DEBUG_BTN_LOG_LEVEL_DEBUG,
UI_DEBUG_BTN_LOG_ACPOS,
UI_DEBUG_BTN_LOG_MODELMATCH,
UI_DEBUG_BTN_LOG_RAW_FD,
UI_DEBUG_CAP_CSL_MODEL_MATCHING,
UI_DEBUG_CAP_FIX_AC_ICAO_TYPE,
UI_DEBUG_TXT_FIX_AC_ICAO_TYPE,
UI_DEBUG_CAP_FIX_OP_ICAO,
UI_DEBUG_TXT_FIX_OP_ICAO,
UI_DEBUG_CAP_FIX_LIVERY,
UI_DEBUG_TXT_FIX_LIVERY,
// always last: number of UI elements
UI_NUMBER_OF_ELEMENTS
};
// for ease of definition coordinates start at (0|0)
// window will be centered shortly before presenting it
TFWidgetCreate_t SETTINGS_UI[] =
{
{{ 0, 0, 400, 330, 0, "LiveTraffic Settings", 1, NO_PARENT, xpWidgetClass_MainWindow}, {{xpProperty_MainWindowHasCloseBoxes, 1}, {xpProperty_MainWindowType,xpMainWindowStyle_Translucent},{0,0}} },
// Buttons to select 'tabs'
{{ 10, 30, 65, 10, 1, "Basics", 0, UI_MAIN_WND, xpWidgetClass_Button}, {{xpProperty_ButtonBehavior,xpButtonBehaviorRadioButton},{0,0},{0,0}} },
{{ 75, 30, 65, 10, 1, "A/C Labels", 0, UI_MAIN_WND, xpWidgetClass_Button}, {{xpProperty_ButtonBehavior,xpButtonBehaviorRadioButton},{0,0},{0,0}} },
{{ 140, 30, 65, 10, 1, "Advanced", 0, UI_MAIN_WND, xpWidgetClass_Button}, {{xpProperty_ButtonBehavior,xpButtonBehaviorRadioButton},{0,0},{0,0}} },
{{ 205, 30, 65, 10, 1, "CSL", 0, UI_MAIN_WND, xpWidgetClass_Button}, {{xpProperty_ButtonBehavior,xpButtonBehaviorRadioButton},{0,0},{0,0}} },
{{ 270, 30, 65, 10, 1, "Debug", 0, UI_MAIN_WND, xpWidgetClass_Button}, {{xpProperty_ButtonBehavior,xpButtonBehaviorRadioButton},{0,0},{0,0}} },
// Push button for help
{{ 360, 30, 30, 10, 1, "?", 0, UI_MAIN_WND, xpWidgetClass_Button}, {{xpProperty_ButtonBehavior,xpButtonBehaviorPushButton}, {0,0},{0,0}} },
// "Basics" tab
{{ 10, 50, 190, -10, 0, "Basics Live", 0, UI_MAIN_WND, xpWidgetClass_SubWindow}, {{0,0},{0,0},{0,0}} },
{{ 10, 10, 10, 10, 1, "Show Live Aircraft", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType,xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 25, 10, 10, 1, "Auto Start", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType,xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 5, 50, -5, 10, 1, "Flight Data Channels:",0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 10, 70, 10, 10, 1, "OpenSky Network", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 85, 10, 10, 1, "OpenSky Network Master Data", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 105, 10, 10, 1, "ADS-B Exchange, API Key:", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 120, -5, 15, 1, "", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_TextField}, {{0,0},{0,0},{0,0}} },
{{ 10, 138, -5, 10, 1, "", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 10, 165, 10, 10, 1, "RealTraffic", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 5, 180, -5, 10, 1, "", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 5, 195, -5, 10, 1, "", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 5, -15, -5, 10, 1, "Version", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 50, -15, -5, 10, 1, "", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 200, 50, -10, -10, 0, "Basics Right", 0, UI_MAIN_WND, xpWidgetClass_SubWindow}, {{0,0},{0,0},{0,0}} },
{{ 5, 8, -5, 10, 1, "Misc options:", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 10, 25, 10, 10, 1, "Landing lights during taxi", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 5, 50, -5, 10, 1, "Parallel with other traffic plugins:",0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 5, 68, 140, 10, 1, "No a/c below [ft AGL]",0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ -50, 68, -10, 15, 1, "", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,6},{0,0},{0,0}} },
{{ 10, 85, 10, 10, 1, "Hide a/c while taxiing", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 100, 10, 10, 1, "AI/TCAS on request only", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 5, 125, -5, 10, 1, "Output Channels:", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 10, 140, 10, 10, 1, "ForeFlight | every", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ -50, 138, -15, 15, 1, "", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,6},{0,0},{0,0}} },
{{ -15, 140, -10, 10, 1, "s", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 25, 155, 10, 10, 1, "User's Plane", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 120, 155, 10, 10, 1, "Traffic", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 5, -15, -5, 10, 1, "", 0, UI_BASICS_RIGHT_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
// "A/C Label" tab
{{ 10, 50, -10, -10, 0, "A/C Label", 0, UI_MAIN_WND, xpWidgetClass_SubWindow}, {{0,0},{0,0},{0,0}} },
{{ 5, 10, 190, 10, 1, "Static info:", 0, UI_LABELS_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 10, 30, 10, 10, 1, "ICAO A/C Type Code", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 45, 10, 10, 1, "Any A/C ID", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 60, 10, 10, 1, "Transponder Hex Code",0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 75, 10, 10, 1, "Registration", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 90, 10, 10, 1, "ICAO Operator Code", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 105, 10, 10, 1, "Call Sign", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 120, 10, 10, 1, "Flight Number (rare)",0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 135, 10, 10, 1, "Route", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 200, 10, -10, 10, 1, "Dynamic data:", 0, UI_LABELS_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 200, 30, 10, 10, 1, "Flight Phase", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 200, 45, 10, 10, 1, "Heading", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 200, 60, 10, 10, 1, "Altitude [ft]", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 200, 75, 10, 10, 1, "Height AGL [ft]", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 200, 90, 10, 10, 1, "Speed [kn]", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 200, 105, 10, 10, 1, "VSI [ft/min]", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 5, 155, 50, 10, 1, "Label Color:", 0, UI_LABELS_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 10, 170, 10, 10, 1, "Dynamic by Flight Model",0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 10, 185, 10, 10, 1, "Fixed:", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 60, 182, 60, 15, 1, "", 0, UI_LABELS_SUB_WND, xpWidgetClass_TextField}, {{xpProperty_MaxCharacters,6},{0,0},{0,0}} },
{{ 120, 185, 50, 10, 1, "Yellow", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 170, 185, 50, 10, 1, "Red", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 220, 185, 50, 10, 1, "Green", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 270, 185, 50, 10, 1, "Blue", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 5, 205, 50, 10, 1, "In which views to show A/C labels:", 0, UI_LABELS_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 10, 225, 10, 10, 1, "External", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 80, 225, 10, 10, 1, "Internal", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 150, 225, 10, 10, 1, "VR", 0, UI_LABELS_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
// "Advanced" tab
{{ 10, 50, -10, -10, 0, "Advanced", 0, UI_MAIN_WND, xpWidgetClass_SubWindow}, {{0,0},{0,0},{0,0}} },
{{ 5, 10, -5, 10, 1, "Log Level:", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 80, 10, 10, 10, 1, "Fatal", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 140, 10, 10, 10, 1, "Error", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 200, 10, 10, 10, 1, "Warning", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 270, 10, 10, 10, 1, "Info", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 320, 10, 10, 10, 1, "Debug", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 5, 30, -5, 10, 1, "Msg Area:", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 80, 30, 10, 10, 1, "Fatal", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 140, 30, 10, 10, 1, "Error", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 200, 30, 10, 10, 1, "Warning", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 270, 30, 10, 10, 1, "Info", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton},{0,0}} },
{{ 5, 50, 225, 10, 1, "Max number of aircraft", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 50, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
{{ 5, 70, 225, 10, 1, "Max number of full a/c to draw", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 70, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
{{ 5, 90, 225, 10, 1, "Max distance for drawing full a/c [nm]", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 90, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,2},{0,0},{0,0}} },
{{ 5, 110, 225, 10, 1, "Search distance [nm]", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 110, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
{{ 5, 130, 225, 10, 1, "Snap to taxiway [m]", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 130, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
{{ 5, 130, 225, 10, 1, "Live data refresh [s]", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 130, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
{{ 5, 150, 225, 10, 1, "Buffering period [s]", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 150, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
{{ 5, 170, 225, 10, 1, "a/c outdated period [s]", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 170, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
{{ 5, 190, 225, 10, 1, "Network timeout [s]", 0, UI_ADVCD_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 230, 190, 50, 15, 1, "", 0, UI_ADVCD_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
// "CSL" tab
{{ 10, 50, -10, -10, 0, "CSL", 0, UI_MAIN_WND, xpWidgetClass_SubWindow}, {{0,0},{0,0},{0,0}} },
{{ 5, 10, -5, 10, 1, "Enabled | Paths to CSL packages:", 0, UI_CSL_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 10, 30, 10, 10, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 25, 27, 300, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField}, {{0,0},{0,0},{0,0}} },
{{ 330, 30, 50, 10, 1, "Load", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 10, 50, 10, 10, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 25, 47, 300, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField}, {{0,0},{0,0},{0,0}} },
{{ 330, 50, 50, 10, 1, "Load", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 10, 70, 10, 10, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 25, 67, 300, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField}, {{0,0},{0,0},{0,0}} },
{{ 330, 70, 50, 10, 1, "Load", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 10, 90, 10, 10, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 25, 87, 300, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField}, {{0,0},{0,0},{0,0}} },
{{ 330, 90, 50, 10, 1, "Load", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 10, 110, 10, 10, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 25, 107, 300, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField}, {{0,0},{0,0},{0,0}} },
{{ 330, 110, 50, 10, 1, "Load", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 10, 130, 10, 10, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 25, 127, 300, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField}, {{0,0},{0,0},{0,0}} },
{{ 330, 130, 50, 10, 1, "Load", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 10, 150, 10, 10, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 25, 147, 300, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField}, {{0,0},{0,0},{0,0}} },
{{ 330, 150, 50, 10, 1, "Load", 0, UI_CSL_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpPushButton}, {xpProperty_ButtonBehavior,xpButtonBehaviorPushButton},{0,0}} },
{{ 5, 230, 130, 10, 1, "Default a/c type", 0, UI_CSL_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 135, 227, 50, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,4},{0,0},{0,0}} },
{{ 5, 250, 130, 10, 1, "Ground vehicle type", 0, UI_CSL_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 135, 247, 50, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,4},{0,0},{0,0}} },
// "Debug" tab
{{ 10, 50, -10, -10, 0, "Debug", 0, UI_MAIN_WND, xpWidgetClass_SubWindow}, {{0,0},{0,0},{0,0}} },
{{ 5, 10, 215, 10, 1, "Filter for transponder hex code:", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 220, 10, 70, 15, 1, "", 0, UI_DEBUG_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,8},{0,0},{0,0}} },
{{ 10, 30, 10, 10, 1, "Log.txt: Set Log Level = \"Debug\"", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 45, 10, 10, 1, "Log.txt: Log a/c positions", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 60, 10, 10, 1, "Log.txt: Log model matching (XPlaneMP)", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 10, 80, 10, 10, 1, "LTRawFD.log: Log raw network flight data", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Button}, {{xpProperty_ButtonType, xpRadioButton}, {xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox},{0,0}} },
{{ 5, 105, -5, 10, 1, "Forced model matching parameters for next aircraft to create:", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 5, 120, 215, 10, 1, "ICAO a/c type:", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 220, 120, 70, 15, 1, "", 0, UI_DEBUG_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,4},{0,0},{0,0}} },
{{ 5, 140, 215, 10, 1, "ICAO operator/airline:", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 220, 140, 70, 15, 1, "", 0, UI_DEBUG_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,3},{0,0},{0,0}} },
{{ 5, 160, 215, 10, 1, "livery/registration:", 0, UI_DEBUG_SUB_WND, xpWidgetClass_Caption}, {{0,0},{0,0},{0,0}} },
{{ 220, 160, 70, 15, 1, "", 0, UI_DEBUG_SUB_WND, xpWidgetClass_TextField},{{xpProperty_MaxCharacters,8},{0,0},{0,0}} },
};
constexpr int NUM_WIDGETS = sizeof(SETTINGS_UI)/sizeof(SETTINGS_UI[0]);
static_assert(UI_NUMBER_OF_ELEMENTS == NUM_WIDGETS,
"UI_WIDGET_IDX_T and SETTINGS_UI[] differ in number of elements!");
// creates the main window and all its widgets based on the above
// definition array
void LTSettingsUI::Enable()
{
if (!isEnabled()) {
// array, which receives ids of all created widgets
widgetIds = new XPWidgetID[NUM_WIDGETS];
LOG_ASSERT(widgetIds);
memset(widgetIds, 0, sizeof(XPWidgetID)*NUM_WIDGETS );
// create all widgets, i.e. the entire window structure, but keep invisible
if (!TFUCreateWidgetsEx(SETTINGS_UI, NUM_WIDGETS, NULL, widgetIds,
GetDefaultWndOpenMode()))
{
SHOW_MSG(logERR,ERR_WIDGET_CREATE);
return;
}
setId(widgetIds[0]); // register in base class for message handling
// some widgets with objects
subBasicsLive.setId(widgetIds[UI_BASICS_LIVE_SUB_WND]);
subBasicsRight.setId(widgetIds[UI_BASICS_RIGHT_SUB_WND]);
subAcLabel.setId(widgetIds[UI_LABELS_SUB_WND]);
subAdvcd.setId(widgetIds[UI_ADVCD_SUB_WND]);
subCSL.setId(widgetIds[UI_CSL_SUB_WND]);
subDebug.setId(widgetIds[UI_DEBUG_SUB_WND]);
// organise the tab button group
tabGrp.Add({
widgetIds[UI_BTN_BASICS],
widgetIds[UI_BTN_AC_LABELS],
widgetIds[UI_BTN_ADVANCED],
widgetIds[UI_BTN_CSL],
widgetIds[UI_BTN_DEBUG]
});
tabGrp.SetChecked(widgetIds[UI_BTN_BASICS]);
HookButtonGroup(tabGrp);
// *** Basic ***
// the following widgets are linked to dataRefs,
// i.e. the dataRefs are changed automatically as soon as the
// widget's status/contents changes. This in turn
// directly controls LiveTraffic (see class DataRefs,
// which receives the callbacks for the changed dataRefs)
// Class LTSettingsUI has no more code for handling these:
btnBasicsEnable.setId(widgetIds[UI_BASICS_BTN_ENABLE],
DATA_REFS_LT[DR_CFG_AIRCRAFT_DISPLAYED]);
btnBasicsAutoStart.setId(widgetIds[UI_BASICS_BTN_AUTO_START],
DATA_REFS_LT[DR_CFG_AUTO_START]);
btnOpenSkyLive.setId(widgetIds[UI_BASICS_BTN_OPENSKY_LIVE],
DATA_REFS_LT[DR_CHANNEL_OPEN_SKY_ONLINE]);
btnOpenSkyMasterdata.setId(widgetIds[UI_BASICS_BTN_OPENSKY_MASTERDATA],
DATA_REFS_LT[DR_CHANNEL_OPEN_SKY_AC_MASTERDATA]);
btnADSBLive.setId(widgetIds[UI_BASICS_BTN_ADSB_LIVE],
DATA_REFS_LT[DR_CHANNEL_ADSB_EXCHANGE_ONLINE]);
txtADSBAPIKey.setId(widgetIds[UI_BASICS_TXT_ADSB_API_KEY]);
if (dataRefs.GetADSBExAPIKey().empty()) { // no API key
btnADSBLive.Set(0); // disable channel
btnADSBLive.SetEnabled(false); // disable check box
}
else
txtADSBAPIKey.SetDescriptor(dataRefs.GetADSBExAPIKey());
capADSBOutput.setId(widgetIds[UI_BASICS_CAP_ADSB_OUTPUT]);
btnRealTraffic.setId(widgetIds[UI_BASICS_BTN_REALTRAFFIC_LIVE],
DATA_REFS_LT[DR_CHANNEL_REAL_TRAFFIC_ONLINE],
true); // still inform the settings UI of state changes
capRealTrafficStatus.setId(widgetIds[UI_BASICS_CAP_REALTRAFFIC_STATUS]);
capRealTrafficMetar.setId(widgetIds[UI_BASICS_CAP_REALTRAFFIC_METAR]);
// * right-hand side *
// landing lights during taxi?
btnLndLightsTaxi.setId(widgetIds[UI_BASICS_BTN_LND_LIGHTS_TAXI],
DATA_REFS_LT[DR_CFG_LND_LIGHTS_TAXI]);
// enhance parallel operation with other multiplayer clients
intHideBelowAGL.setId(widgetIds[UI_BASICS_INT_HIDE_BELOW_AGL],
DATA_REFS_LT[DR_CFG_HIDE_BELOW_AGL]);
// hide a/c while taxiing?
btnHideTaxiing.setId(widgetIds[UI_BASICS_BTN_HIDE_TAXIING],
DATA_REFS_LT[DR_CFG_HIDE_TAXIING]);
// AI/TCAS on request only?
btnAIonRequest.setId(widgetIds[UI_BASICS_BTN_AI_ON_REQUEST],
DATA_REFS_LT[DR_CFG_AI_ON_REQUEST]);
// ForeFlight
btnForeFlight.setId(widgetIds[UI_BASICS_BTN_FOREFLIGHT_SEND],
DATA_REFS_LT[DR_CHANNEL_FORE_FLIGHT_SENDER]);
intFFTrfcIntvl.setId(widgetIds[UI_BASICS_INT_FOREFLIGHT_INTVL],
DATA_REFS_LT[DR_CFG_FF_SEND_TRAFFIC_INTVL]);
btnFFUsersPlane.setId(widgetIds[UI_BASICS_BTN_FOREFLIGHT_USERSPLANE],
DATA_REFS_LT[DR_CFG_FF_SEND_USER_PLANE]);
btnFFTraffic.setId(widgetIds[UI_BASICS_BTN_FOREFLIGHT_TRAFFIC],
DATA_REFS_LT[DR_CFG_FF_SEND_TRAFFIC]);
// version number
XPSetWidgetDescriptor(widgetIds[UI_BASICS_CAP_VERSION],
LT_VERSION_FULL);
if (LT_BETA_VER_LIMIT)
{
char dbgLimit[100];
snprintf(dbgLimit,sizeof(dbgLimit), BETA_LIMITED_VERSION,LT_BETA_VER_LIMIT_TXT);
XPSetWidgetDescriptor(widgetIds[UI_BASICS_CAP_DBG_LIMIT],
dbgLimit);
}
// *** A/C Labels ***
drCfgLabels.setDataRef(DATA_REFS_LT[DR_CFG_LABELS]);
drCfgLabelShow.setDataRef(DATA_REFS_LT[DR_CFG_LABEL_SHOWN]);
LabelBtnInit();
// Color
btnGrpLabelColorDyn.Add({
widgetIds[UI_LABELS_BTN_DYNAMIC],
widgetIds[UI_LABELS_BTN_FIXED]
});
btnGrpLabelColorDyn.SetChecked(dataRefs.IsLabelColorDynamic() ?
widgetIds[UI_LABELS_BTN_DYNAMIC] :
widgetIds[UI_LABELS_BTN_FIXED]
);
HookButtonGroup(btnGrpLabelColorDyn);
drLabelColDyn.setDataRef(DATA_REFS_LT[DR_CFG_LABEL_COL_DYN]);
intLabelColor.setId(widgetIds[UI_LABELS_TXT_COLOR],
DATA_REFS_LT[DR_CFG_LABEL_COLOR],
TFTextFieldWidget::TFF_HEX);
// *** Advanced ***
logLevelGrp.Add({
widgetIds[UI_ADVCD_BTN_LOG_DEBUG], // index 0 equals logDEBUG, which is also 0
widgetIds[UI_ADVCD_BTN_LOG_INFO], // ...
widgetIds[UI_ADVCD_BTN_LOG_WARNING],
widgetIds[UI_ADVCD_BTN_LOG_ERROR],
widgetIds[UI_ADVCD_BTN_LOG_FATAL], // index 4 equals logFATAL, which is also 4
});
logLevelGrp.SetCheckedIndex(dataRefs.GetLogLevel());
HookButtonGroup(logLevelGrp);
msgAreaLevelGrp.Add({
widgetIds[UI_ADVCD_BTN_MSGAREA_INFO], // index 0 is logINFO, which is 1
widgetIds[UI_ADVCD_BTN_MSGAREA_WARNING],
widgetIds[UI_ADVCD_BTN_MSGAREA_ERROR],
widgetIds[UI_ADVCD_BTN_MSGAREA_FATAL], // index 4 equals logFATAL, which is also 4
});
msgAreaLevelGrp.SetCheckedIndex(dataRefs.GetMsgAreaLevel() - 1);
HookButtonGroup(msgAreaLevelGrp);
// link some buttons directly to dataRefs:
intMaxNumAc.setId(widgetIds[UI_ADVCD_INT_MAX_NUM_AC],
DATA_REFS_LT[DR_CFG_MAX_NUM_AC]);
intMaxFullNumAc.setId(widgetIds[UI_ADVCD_INT_MAX_FULL_NUM_AC],
DATA_REFS_LT[DR_CFG_MAX_FULL_NUM_AC]);
intFullDistance.setId(widgetIds[UI_ADVCD_INT_FULL_DISTANCE],
DATA_REFS_LT[DR_CFG_FULL_DISTANCE]);
intFdStdDistance.setId(widgetIds[UI_ADVCD_INT_FD_STD_DISTANCE],
DATA_REFS_LT[DR_CFG_FD_STD_DISTANCE]);
intFdSnapTaxiDist.setId(widgetIds[UI_ADVCD_INT_FD_SNAP_TAXI_DIST],
DATA_REFS_LT[DR_CFG_FD_SNAP_TAXI_DIST]);
intFdRefreshIntvl.setId(widgetIds[UI_ADVCD_INT_FD_REFRESH_INTVL],
DATA_REFS_LT[DR_CFG_FD_REFRESH_INTVL]);
intFdBufPeriod.setId(widgetIds[UI_ADVCD_INT_FD_BUF_PERIOD],
DATA_REFS_LT[DR_CFG_FD_BUF_PERIOD]);
intAcOutdatedIntvl.setId(widgetIds[UI_ADVCD_INT_AC_OUTDATED_INTVL],
DATA_REFS_LT[DR_CFG_AC_OUTDATED_INTVL]);
intNetwTimeout.setId(widgetIds[UI_ADVCD_INT_NETW_TIMEOUT],
DATA_REFS_LT[DR_CFG_NETW_TIMEOUT]);
// *** CSL ***
// Initialize all paths (3 elements each: check box, text field, button)
const DataRefs::vecCSLPaths& paths = dataRefs.GetCSLPaths();
for (size_t i=0; i < SETUI_CSL_PATHS; i++) {
const size_t wIdx = UI_CSL_BTN_ENABLE_1 + i*SETUI_CSL_ELEMS_PER_PATH;
txtCSLPaths[i].setId(widgetIds[wIdx+1]); // connect text object to widget
if (i < paths.size()) { // if there is a configured path for this line
XPSetWidgetProperty(widgetIds[wIdx ], // check box
xpProperty_ButtonState,
paths[i].enabled());
txtCSLPaths[i].SetDescriptor(paths[i].path); // text field
}
}
txtDefaultAcType.setId(widgetIds[UI_CSL_TXT_DEFAULT_AC_TYPE]);
txtDefaultAcType.tfFormat = TFTextFieldWidget::TFF_UPPER_CASE;
txtDefaultAcType.SetDescriptor(dataRefs.GetDefaultAcIcaoType());
txtGroundVehicleType.setId(widgetIds[UI_CSL_TXT_GROUND_VEHICLE_TYPE]);
txtGroundVehicleType.tfFormat = TFTextFieldWidget::TFF_UPPER_CASE;
txtGroundVehicleType.SetDescriptor(dataRefs.GetDefaultCarIcaoType());
// *** Debug ***
// filter for transponder hex code
txtDebugFilter.setId(widgetIds[UI_DEBUG_TXT_FILTER]);
txtDebugFilter.SearchFlightData(dataRefs.GetDebugAcFilter());
// debug options
btnDebugLogLevelDebug.setId(widgetIds[UI_DEBUG_BTN_LOG_LEVEL_DEBUG]);
btnDebugLogACPos.setId(widgetIds[UI_DEBUG_BTN_LOG_ACPOS],
DATA_REFS_LT[DR_DBG_AC_POS]);
btnDebugLogModelMatch.setId(widgetIds[UI_DEBUG_BTN_LOG_MODELMATCH],
DATA_REFS_LT[DR_DBG_MODEL_MATCHING]);
btnDebugLogRawFd.setId(widgetIds[UI_DEBUG_BTN_LOG_RAW_FD],
DATA_REFS_LT[DR_DBG_LOG_RAW_FD]);
// forced values for CSL model matching tests
txtFixAcType.setId(widgetIds[UI_DEBUG_TXT_FIX_AC_ICAO_TYPE]);
txtFixAcType.tfFormat = TFTextFieldWidget::TFF_UPPER_CASE;
txtFixAcType.SetDescriptor(dataRefs.cslFixAcIcaoType);
txtFixOp.setId(widgetIds[UI_DEBUG_TXT_FIX_OP_ICAO]);
txtFixOp.tfFormat = TFTextFieldWidget::TFF_UPPER_CASE;
txtFixOp.SetDescriptor(dataRefs.cslFixOpIcao);
txtFixLivery.setId(widgetIds[UI_DEBUG_TXT_FIX_LIVERY]);
txtFixLivery.tfFormat = TFTextFieldWidget::TFF_UPPER_CASE;
txtFixOp.SetDescriptor(dataRefs.cslFixLivery);
// update all values that would be updated anyway
TfwMsgMain1sTime();
// center the UI
Center();
}
}
void LTSettingsUI::Disable()
{
if (isEnabled()) {
// remove widgets and free memory
XPDestroyWidget(*widgetIds, 1);
delete widgetIds;
widgetIds = nullptr;
}
}
// make sure I'm created before first use
void LTSettingsUI::Show (bool bShow)
{
if (bShow) // create before use
Enable();
TFWidget::Show(bShow); // show/hide
// make sure we are in the right window mode
if (GetWndMode() != GetDefaultWndOpenMode()) { // only possible in XP11
if (GetDefaultWndOpenMode() == TF_MODE_VR)
SetWindowPositioningMode(xplm_WindowVR, -1);
else
SetWindowPositioningMode(xplm_WindowPositionFree, -1);
}
}
// capture entry into 'filter for transponder hex code' field
// and into CSL paths
bool LTSettingsUI::MsgTextFieldChanged (XPWidgetID textWidget, std::string text)
{
// *** Basic ***
if (txtADSBAPIKey == textWidget) {
// did the key really change?
const std::string newKey(txtADSBAPIKey.GetDescriptor());
if (newKey.empty()) {
dataRefs.SetADSBExAPIKey(newKey);
btnADSBLive.Set(0); // disable channel
btnADSBLive.SetEnabled(false); // disable check box
}
else if (newKey != dataRefs.GetADSBExAPIKey())
{
// key changed, test it
ADSBExchangeConnection::TestADSBExAPIKey(newKey);
btnADSBLive.SetEnabled(true); // enable check box
}
}
// *** Advanced ***
if (txtDebugFilter == textWidget) {
// set the filter a/c if defined
if (txtDebugFilter.HasAcKey())
DataRefs::LTSetDebugAcFilter(NULL,txtDebugFilter.GetAcKeyNum());
else
DataRefs::LTSetDebugAcFilter(NULL,0);
return true;
}
// *** CSL ***
// if any of the paths changed we store that path
for (int i = 0; i < SETUI_CSL_PATHS; i++)
if (widgetIds[UI_CSL_TXT_PATH_1 + i*SETUI_CSL_ELEMS_PER_PATH] == textWidget) {
SaveCSLPath(i);
return true;
}
// if the types change we store them (and if setting fails after validation,
// then we restore the current value)
if (txtDefaultAcType == textWidget) {
if (!dataRefs.SetDefaultAcIcaoType(text))
txtDefaultAcType.SetDescriptor(dataRefs.GetDefaultAcIcaoType());
return true;
}
if (txtGroundVehicleType == textWidget) {
if (!dataRefs.SetDefaultCarIcaoType(text))
txtGroundVehicleType.SetDescriptor(dataRefs.GetDefaultCarIcaoType());
return true;
}
// *** Debug ***
// save forced model matching parameters
if (txtFixAcType == textWidget ||
txtFixOp == textWidget ||
txtFixLivery == textWidget)
{
dataRefs.cslFixAcIcaoType = txtFixAcType.GetDescriptor();
dataRefs.cslFixOpIcao = txtFixOp.GetDescriptor();
dataRefs.cslFixLivery = txtFixLivery.GetDescriptor();
if (dataRefs.cslFixAcIcaoType.empty() &&
dataRefs.cslFixOpIcao.empty() &&
dataRefs.cslFixLivery.empty())
SHOW_MSG(logWARN, MSG_MDL_NOT_FORCED)
else
SHOW_MSG(logWARN, MSG_MDL_FORCED,
dataRefs.cslFixAcIcaoType.c_str(),
dataRefs.cslFixOpIcao.c_str(),
dataRefs.cslFixLivery.c_str());
return true;
}
// not ours
return TFMainWindowWidget::MsgTextFieldChanged(textWidget, text);
}
// writes current values out into config file
bool LTSettingsUI::MsgHidden (XPWidgetID hiddenWidget)
{
if (hiddenWidget == *this) { // only if it was me who got hidden
// then only save the config file
dataRefs.SaveConfigFile();
}
// pass on in class hierarchy
return TFMainWindowWidget::MsgHidden(hiddenWidget);
}
// update state of some buttons from dataRef every second
bool LTSettingsUI::TfwMsgMain1sTime ()
{
TFMainWindowWidget::TfwMsgMain1sTime();
// *** Basics ***
// ADSBEx: Feedback
if (dataRefs.ADSBExRLimit || dataRefs.ADSBExRRemain) {
char buf[100];
snprintf(buf, sizeof(buf), MSG_ADSBEX_LIMITE,
dataRefs.ADSBExRRemain, dataRefs.ADSBExRLimit);
capADSBOutput.SetDescriptor(buf);
} else
capADSBOutput.SetDescriptor("");
// real traffic stuff
UpdateRealTraffic();
// *** A/C Labels ***
// read current 'when-to-show' config and set accordingly
DataRefs::LabelShowCfgTy show = dataRefs.GetLabelShowCfg();
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_EXTERNAL],xpProperty_ButtonState,show.bExternal);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_INTERNAL],xpProperty_ButtonState,show.bInternal);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_VR],xpProperty_ButtonState,show.bVR);
// *** Advanced ***
logLevelGrp.SetCheckedIndex(dataRefs.GetLogLevel());
msgAreaLevelGrp.SetCheckedIndex(dataRefs.GetMsgAreaLevel() - 1);
// *** Debug ***
// "Log-Level = Debug" is checked if, well, log level is set to Debug
btnDebugLogLevelDebug.SetChecked(dataRefs.GetLogLevel() == logDEBUG);
return true;
}
// handles show/hide of 'tabs', values of logging level
bool LTSettingsUI::MsgButtonStateChanged (XPWidgetID buttonWidget, bool bNowChecked)
{
// first pass up the class hierarchy to make sure the button groups are handled correctly
bool bRet = TFMainWindowWidget::MsgButtonStateChanged(buttonWidget, bNowChecked);
// *** Tab Groups ***
// if the button is one of our tab buttons show/hide the appropriate subwindow
if (widgetIds[UI_BTN_BASICS] == buttonWidget) {
subBasicsLive.Show(bNowChecked);
subBasicsRight.Show(bNowChecked);
return true;
}
else if (widgetIds[UI_BTN_AC_LABELS] == buttonWidget) {
subAcLabel.Show(bNowChecked);
return true;
}
else if (widgetIds[UI_BTN_ADVANCED] == buttonWidget) {
subAdvcd.Show(bNowChecked);
return true;
}
else if (widgetIds[UI_BTN_CSL] == buttonWidget) {
subCSL.Show(bNowChecked);
return true;
}
else if (widgetIds[UI_BTN_DEBUG] == buttonWidget) {
subDebug.Show(bNowChecked);
return true;
}
// *** Basics ***
// If RealTraffic is now activated then we also activate OpenSky Master as a courtesy,
// but we never deactivate OpenSky Master this way.
if (btnRealTraffic == buttonWidget && bNowChecked)
dataRefs.SetChannelEnabled(DR_CHANNEL_OPEN_SKY_AC_MASTERDATA, true);
// *** A/C Labels ***
// if any of the a/c label check boxes changes we set the config accordingly
if (widgetIds[UI_LABELS_BTN_TYPE] == buttonWidget ||
widgetIds[UI_LABELS_BTN_AC_ID] == buttonWidget ||
widgetIds[UI_LABELS_BTN_TRANSP] == buttonWidget ||
widgetIds[UI_LABELS_BTN_REG] == buttonWidget ||
widgetIds[UI_LABELS_BTN_OP] == buttonWidget ||
widgetIds[UI_LABELS_BTN_CALL_SIGN] == buttonWidget ||
widgetIds[UI_LABELS_BTN_FLIGHT_NO] == buttonWidget ||
widgetIds[UI_LABELS_BTN_ROUTE] == buttonWidget ||
widgetIds[UI_LABELS_BTN_PHASE] == buttonWidget ||
widgetIds[UI_LABELS_BTN_HEADING] == buttonWidget ||
widgetIds[UI_LABELS_BTN_ALT] == buttonWidget ||
widgetIds[UI_LABELS_BTN_HEIGHT] == buttonWidget ||
widgetIds[UI_LABELS_BTN_SPEED] == buttonWidget ||
widgetIds[UI_LABELS_BTN_VSI] == buttonWidget ||
// when-to-show selection
widgetIds[UI_LABELS_BTN_EXTERNAL] == buttonWidget ||
widgetIds[UI_LABELS_BTN_INTERNAL] == buttonWidget ||
widgetIds[UI_LABELS_BTN_VR] == buttonWidget)
{
LabelBtnSave();
return true;
}
// dynamic / fixed label colors?
if (widgetIds[UI_LABELS_BTN_DYNAMIC] == buttonWidget ||
widgetIds[UI_LABELS_BTN_FIXED] == buttonWidget)
{
drLabelColDyn.Set(buttonWidget == widgetIds[UI_LABELS_BTN_DYNAMIC]);
return true;
}
// *** Advanced ***
// if any of the log-level radio buttons changes we set log-level accordingly
if (bNowChecked && logLevelGrp.isInGroup(buttonWidget))
{
dataRefs.SetLogLevel(logLevelGrp.GetCheckedIndex());
return true;
}
if (bNowChecked && msgAreaLevelGrp.isInGroup(buttonWidget))
{
dataRefs.SetMsgAreaLevel(msgAreaLevelGrp.GetCheckedIndex() + 1);
return true;
}
// *** CSL ***
// if any of the enable-check boxes changed we store that setting
for (int i = 0; i < SETUI_CSL_PATHS; i++)
if (widgetIds[UI_CSL_BTN_ENABLE_1 + i*SETUI_CSL_ELEMS_PER_PATH] == buttonWidget) {
SaveCSLPath(i);
return true;
}
// *** Advanced ***
// if "Level-Level = DEBUG" is activate we set Log level to Debug,
// if it is deactviated we set back to Warning
if ( btnDebugLogLevelDebug == buttonWidget) {
dataRefs.SetLogLevel(bNowChecked ? logDEBUG : logWARN);
return true;
}
return bRet;
}
// push buttons
bool LTSettingsUI::MsgPushButtonPressed (XPWidgetID buttonWidget)
{
// *** Help ***
if (widgetIds[UI_BTN_HELP] == buttonWidget)
{
// open help for the currently selected tab of the settings dialog
const char* helpSettingsPaths[5] = HELP_SETTINGS_PATHS;
LTOpenHelp(helpSettingsPaths[tabGrp.GetCheckedIndex()]);
return true;
}
// *** A/C Labels ***
// color presets?
if (widgetIds[UI_LABELS_BTN_YELLOW] == buttonWidget) { intLabelColor.Set(COLOR_YELLOW); return true; }
if (widgetIds[UI_LABELS_BTN_RED] == buttonWidget) { intLabelColor.Set(COLOR_RED); return true; }
if (widgetIds[UI_LABELS_BTN_GREEN] == buttonWidget) { intLabelColor.Set(COLOR_GREEN); return true; }
if (widgetIds[UI_LABELS_BTN_BLUE] == buttonWidget) { intLabelColor.Set(COLOR_BLUE); return true; }
// *** CSL ***
// any of the "Load" buttons pushed?
for (int i=0; i < SETUI_CSL_PATHS; i++) {
if (widgetIds[UI_CSL_BTN_LOAD_1 + i*SETUI_CSL_ELEMS_PER_PATH] == buttonWidget) {
SaveCSLPath(i);
if (dataRefs.LoadCSLPackage(i))
// successfully loaded...not update all CSL models in use
LTFlightData::UpdateAllModels();
return true;
}
}
// we don't know that button...
return TFMainWindowWidget::MsgPushButtonPressed(buttonWidget);
}
// Handle checkboxes for a/c labels
void LTSettingsUI::LabelBtnInit()
{
// read current label configuration and init the checkboxes accordingly
DataRefs::LabelCfgTy cfg = dataRefs.GetLabelCfg();
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_TYPE],xpProperty_ButtonState,cfg.bIcaoType);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_AC_ID],xpProperty_ButtonState,cfg.bAnyAcId);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_TRANSP],xpProperty_ButtonState,cfg.bTranspCode);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_REG],xpProperty_ButtonState,cfg.bReg);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_OP],xpProperty_ButtonState,cfg.bIcaoOp);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_CALL_SIGN],xpProperty_ButtonState,cfg.bCallSign);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_FLIGHT_NO],xpProperty_ButtonState,cfg.bFlightNo);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_ROUTE],xpProperty_ButtonState,cfg.bRoute);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_PHASE],xpProperty_ButtonState,cfg.bPhase);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_HEADING],xpProperty_ButtonState,cfg.bHeading);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_ALT],xpProperty_ButtonState,cfg.bAlt);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_HEIGHT],xpProperty_ButtonState,cfg.bHeightAGL);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_SPEED],xpProperty_ButtonState,cfg.bSpeed);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_VSI],xpProperty_ButtonState,cfg.bVSI);
// read current 'when-to-show' config and init accordingly
DataRefs::LabelShowCfgTy show = dataRefs.GetLabelShowCfg();
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_EXTERNAL],xpProperty_ButtonState,show.bExternal);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_INTERNAL],xpProperty_ButtonState,show.bInternal);
XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_VR],xpProperty_ButtonState,show.bVR);
}
void LTSettingsUI::LabelBtnSave()
{
// store the checkboxes states in a zero-inited configuration
DataRefs::LabelCfgTy cfg = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
cfg.bIcaoType = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_TYPE],xpProperty_ButtonState,NULL);
cfg.bAnyAcId = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_AC_ID],xpProperty_ButtonState,NULL);
cfg.bTranspCode = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_TRANSP],xpProperty_ButtonState,NULL);
cfg.bReg = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_REG],xpProperty_ButtonState,NULL);
cfg.bIcaoOp = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_OP],xpProperty_ButtonState,NULL);
cfg.bCallSign = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_CALL_SIGN],xpProperty_ButtonState,NULL);
cfg.bFlightNo = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_FLIGHT_NO],xpProperty_ButtonState,NULL);
cfg.bRoute = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_ROUTE],xpProperty_ButtonState,NULL);
cfg.bPhase = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_PHASE],xpProperty_ButtonState,NULL);
cfg.bHeading = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_HEADING],xpProperty_ButtonState,NULL);
cfg.bAlt = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_ALT],xpProperty_ButtonState,NULL);
cfg.bHeightAGL = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_HEIGHT],xpProperty_ButtonState,NULL);
cfg.bSpeed = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_SPEED],xpProperty_ButtonState,NULL);
cfg.bVSI = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_VSI],xpProperty_ButtonState,NULL);
// save as current config
drCfgLabels.Set(cfg.GetInt());
// store the when-to-show information in a similar way
DataRefs::LabelShowCfgTy show = { 0, 0, 0 };
show.bExternal = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_EXTERNAL],xpProperty_ButtonState,NULL);
show.bInternal = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_INTERNAL],xpProperty_ButtonState,NULL);
show.bVR = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_VR],xpProperty_ButtonState,NULL);
drCfgLabelShow.Set(show.GetInt());
}
void LTSettingsUI::UpdateRealTraffic()
{
if (dataRefs.pRTConn) {
capRealTrafficStatus.SetDescriptor(dataRefs.pRTConn->GetStatusWithTimeStr());
capRealTrafficMetar.SetDescriptor(dataRefs.pRTConn->IsConnected() ?
std::to_string(std::lround(dataRefs.pRTConn->GetHPA())) +
" hPa @ " + dataRefs.pRTConn->GetMetarIcao() : "");
} else {
capRealTrafficStatus.SetDescriptor("");
capRealTrafficMetar.SetDescriptor("");
}
}
void LTSettingsUI::SaveCSLPath(int idx)
{
// what to save
DataRefs::CSLPathCfgTy newPath {
static_cast<bool>(XPGetWidgetProperty(widgetIds[UI_CSL_BTN_ENABLE_1 + idx*SETUI_CSL_ELEMS_PER_PATH],
xpProperty_ButtonState,NULL)),
txtCSLPaths[idx].GetDescriptor()
};
// save
dataRefs.SaveCSLPath(idx, newPath);
}