/
options.cpp
4335 lines (3479 loc) · 165 KB
/
options.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
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************
*
* Project: OpenCPN
* Purpose: Options Dialog
* Author: David Register
*
***************************************************************************
* Copyright (C) 2010 by David S. Register *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
**************************************************************************/
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/progdlg.h>
#include <wx/sound.h>
#include <wx/radiobox.h>
#include <wx/listbox.h>
#include <wx/imaglist.h>
#include <wx/display.h>
#include <wx/choice.h>
#include <wx/dirdlg.h>
#if wxCHECK_VERSION(2,9,4) /* does this work in 2.8 too.. do we need a test? */
#include <wx/renderer.h>
#endif
#include "dychart.h"
#include "chart1.h"
#include "chartdbs.h"
#include "options.h"
#include "styles.h"
#include "datastream.h"
#include "multiplexer.h"
#include "FontMgr.h"
#include "OCPN_Sound.h"
#include "NMEALogWindow.h"
#include "navutil.h"
#ifdef USE_S57
#include "s52plib.h"
#include "s52utils.h"
#include "cm93.h"
#endif
wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString *lang_dir);
extern MyFrame *gFrame;
extern ChartCanvas *cc1;
extern bool g_bShowOutlines;
extern bool g_bShowDepthUnits;
extern bool g_bskew_comp;
extern bool g_bopengl;
extern bool g_bsmoothpanzoom;
extern wxString *pInit_Chart_Dir;
extern wxArrayOfConnPrm *g_pConnectionParams;
extern Multiplexer *g_pMUX;
extern bool g_bfilter_cogsog;
extern int g_COGFilterSec;
extern int g_SOGFilterSec;
extern PlugInManager *g_pi_manager;
extern ocpnStyle::StyleManager* g_StyleManager;
extern wxString g_SData_Locn;
extern bool g_bDisplayGrid;
// AIS Global configuration
extern bool g_bCPAMax;
extern double g_CPAMax_NM;
extern bool g_bCPAWarn;
extern double g_CPAWarn_NM;
extern bool g_bTCPA_Max;
extern double g_TCPA_Max;
extern bool g_bMarkLost;
extern double g_MarkLost_Mins;
extern bool g_bRemoveLost;
extern double g_RemoveLost_Mins;
extern bool g_bShowCOG;
extern double g_ShowCOG_Mins;
extern bool g_bAISShowTracks;
extern double g_AISShowTracks_Mins;
extern bool g_bShowMoored;
extern double g_ShowMoored_Kts;
extern bool g_bAIS_CPA_Alert;
extern bool g_bAIS_CPA_Alert_Audio;
extern wxString g_sAIS_Alert_Sound_File;
extern bool g_bAIS_CPA_Alert_Suppress_Moored;
extern bool g_bShowAreaNotices;
extern bool g_bDrawAISSize;
extern bool g_bShowAISName;
extern int g_Show_Target_Name_Scale;
extern int g_iNavAidRadarRingsNumberVisible;
extern float g_fNavAidRadarRingsStep;
extern int g_pNavAidRadarRingsStepUnits;
extern bool g_bWayPointPreventDragging;
extern bool g_bPreserveScaleOnX;
extern bool g_bPlayShipsBells;
extern bool g_bFullscreenToolbar;
extern bool g_bTransparentToolbar;
extern int g_OwnShipIconType;
extern double g_n_ownship_length_meters;
extern double g_n_ownship_beam_meters;
extern double g_n_gps_antenna_offset_y;
extern double g_n_gps_antenna_offset_x;
extern int g_n_ownship_min_mm;
extern bool g_bEnableZoomToCursor;
extern bool g_bTrackDaily;
extern bool g_bHighliteTracks;
extern double g_TrackIntervalSeconds;
extern double g_TrackDeltaDistance;
extern double g_TrackDeltaDistance;
extern int g_nTrackPrecision;
extern int g_iSDMMFormat;
extern int g_iDistanceFormat;
extern int g_iSpeedFormat;
extern int g_cm93_zoom_factor;
extern int g_COGAvgSec;
extern bool g_bCourseUp;
extern bool g_bLookAhead;
extern double g_ownship_predictor_minutes;
extern bool g_bAISRolloverShowClass;
extern bool g_bAISRolloverShowCOG;
extern bool g_bAISRolloverShowCPA;
extern bool g_bAIS_ACK_Timeout;
extern double g_AckTimeout_Mins;
extern bool g_bQuiltEnable;
extern bool g_bFullScreenQuilt;
extern bool g_bConfirmObjectDelete;
extern wxString g_GPS_Ident;
extern bool g_bGarminHostUpload;
extern wxLocale *plocale_def_lang;
extern OCPN_Sound g_anchorwatch_sound;
#ifdef USE_S57
extern s52plib *ps52plib;
#endif
extern wxString g_locale;
extern bool g_bportable;
extern bool g_bdisable_opengl;
extern wxString *pHome_Locn;
extern ChartGroupArray *g_pGroupArray;
extern ocpnStyle::StyleManager* g_StyleManager;
// Some constants
#define ID_CHOICE_NMEA wxID_HIGHEST + 1
extern wxArrayString *EnumerateSerialPorts(void); // in chart1.cpp
extern wxArrayString TideCurrentDataSet;
extern wxString g_TCData_Dir;
options *g_pOptions;
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(ArrayOfDirCtrls);
IMPLEMENT_DYNAMIC_CLASS( options, wxDialog )
// sort callback for Connections list Sort by priority.
#if wxCHECK_VERSION(2, 9, 0)
int wxCALLBACK SortConnectionOnPriority(long item1, long item2, wxIntPtr list)
#else
int wxCALLBACK SortConnectionOnPriority(long item1, long item2, long list)
#endif
{
wxListCtrl *lc = (wxListCtrl*)list;
wxListItem it1, it2;
it1.SetId(lc->FindItem(-1, item1));
it1.SetColumn(3);
it1.SetMask(it1.GetMask() | wxLIST_MASK_TEXT);
it2.SetId(lc->FindItem(-1, item2));
it2.SetColumn(3);
it2.SetMask(it2.GetMask() | wxLIST_MASK_TEXT);
lc->GetItem(it1);
lc->GetItem(it2);
#ifdef __WXOSX__
return it1.GetText().CmpNoCase(it2.GetText());
#else
return it2.GetText().CmpNoCase(it1.GetText());
#endif
}
BEGIN_EVENT_TABLE( options, wxDialog )
EVT_CHECKBOX( ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click )
EVT_BUTTON( ID_BUTTONADD, options::OnButtonaddClick )
EVT_BUTTON( ID_BUTTONDELETE, options::OnButtondeleteClick )
EVT_BUTTON( ID_TCDATAADD, options::OnInsertTideDataLocation )
EVT_BUTTON( ID_TCDATADEL, options::OnRemoveTideDataLocation )
EVT_BUTTON( ID_APPLY, options::OnApplyClick )
EVT_BUTTON( xID_OK, options::OnXidOkClick )
EVT_BUTTON( wxID_CANCEL, options::OnCancelClick )
EVT_BUTTON( ID_BUTTONFONTCHOOSE, options::OnChooseFont )
EVT_RADIOBOX(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton )
EVT_BUTTON( ID_CLEARLIST, options::OnButtonClearClick )
EVT_BUTTON( ID_SELECTLIST, options::OnButtonSelectClick )
EVT_BUTTON( ID_AISALERTSELECTSOUND, options::OnButtonSelectSound )
EVT_BUTTON( ID_AISALERTTESTSOUND, options::OnButtonTestSound )
EVT_CHECKBOX( ID_SHOWGPSWINDOW, options::OnShowGpsWindowCheckboxClick )
EVT_CHECKBOX( ID_ZTCCHECKBOX, options::OnZTCCheckboxClick )
EVT_CHOICE( ID_SHIPICONTYPE, options::OnShipTypeSelect )
EVT_CHOICE( ID_RADARRINGS, options::OnRadarringSelect )
EVT_CHAR_HOOK( options::OnCharHook )
END_EVENT_TABLE()
options::options()
{
Init();
}
options::options( MyFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos,
const wxSize& size, long style )
{
Init();
pParent = parent;
long wstyle = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER;
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, wstyle );
CreateControls();
Fit();
Center();
}
options::~options()
{
// Disconnect Events
m_lcSources->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( options::OnSelectDatasource ), NULL, this );
m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( options::OnAddDatasourceClick ), NULL, this );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( options::OnRemoveDatasourceClick ), NULL, this );
m_tFilterSec->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_rbTypeSerial->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnTypeSerialSelected ), NULL, this );
m_rbTypeNet->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnTypeNetSelected ), NULL, this );
m_rbNetProtoTCP->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnNetProtocolSelected ), NULL, this );
m_rbNetProtoUDP->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnNetProtocolSelected ), NULL, this );
m_rbNetProtoGPSD->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnNetProtocolSelected ), NULL, this );
m_tNetAddress->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_tNetPort->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_comboPort->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_comboPort->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_choiceBaudRate->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( options::OnBaudrateChoice ), NULL, this );
m_choiceSerialProtocol->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( options::OnProtocolChoice ), NULL, this );
m_choicePriority->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_cbCheckCRC->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnCrcCheck ), NULL, this );
m_cbGarminHost->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnUploadFormatChange ), NULL, this );
m_cbGarminUploadHost->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnUploadFormatChange ), NULL, this );
m_cbFurunoGP3X->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnUploadFormatChange ), NULL, this );
m_rbIAccept->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnRbAcceptInput ), NULL, this );
m_rbIIgnore->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnRbIgnoreInput ), NULL, this );
m_tcInputStc->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_btnInputStcList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( options::OnBtnIStcs ), NULL, this );
m_cbOutput->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnCbOutput ), NULL, this );
m_rbOAccept->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnRbOutput ), NULL, this );
m_rbOIgnore->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnRbOutput ), NULL, this );
m_tcOutputStc->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_btnOutputStcList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( options::OnBtnOStcs ), NULL, this );
m_cbNMEADebug->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnShowGpsWindowCheckboxClick ), NULL, this );
delete m_pSerialArray;
groupsPanel->EmptyChartGroupArray( m_pGroupArray );
delete m_pGroupArray;
m_pGroupArray = NULL;
g_pOptions = NULL;
if( m_topImgList ) delete m_topImgList;
}
void options::Init()
{
m_pWorkDirList = NULL;
pDebugShowStat = NULL;
pSelCtl = NULL;
pActiveChartsList = NULL;
ps57CtlListBox = NULL;
pDispCat = NULL;
m_pSerialArray = NULL;
pUpdateCheckBox = NULL;
k_charts = 0;
k_vectorcharts = 0;
k_plugins = 0;
k_tides = 0;
activeSizer = NULL;
itemActiveChartStaticBox = NULL;
m_bVisitLang = false;
m_itemFontElementListBox = NULL;
m_topImgList = NULL;
m_pSerialArray = EnumerateSerialPorts();
m_pListbook = NULL;
m_pGroupArray = NULL;
m_groups_changed = 0;
m_pageDisplay = -1;
m_pageConnections = -1;
m_pageCharts = -1;
m_pageShips = -1;
m_pageUI = -1;
m_pagePlugins = -1;
lastPage = -1;
// This variable is used by plugin callback function AddOptionsPage
g_pOptions = this;
}
bool options::Create( MyFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos,
const wxSize& size, long style )
{
SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
Fit();
if( lastWindowPos == wxPoint(0,0) ) {
Centre();
} else {
Move( lastWindowPos );
}
lastWindowPos = GetPosition();
return TRUE;
}
wxWindow* options::GetContentWindow() const
{
return NULL;
}
size_t options::CreatePanel(const wxString & title)
{
size_t id = m_pListbook->GetPageCount();
/* This is the default empty content for any top tab.
It'll be replaced when we call AddPage */
wxPanel *panel = new wxPanel( m_pListbook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title );
m_pListbook->AddPage( panel, title, false, id );
return id;
}
wxScrolledWindow *options::AddPage( size_t parent, const wxString & title)
{
if( parent > m_pListbook->GetPageCount() - 1 ) {
wxLogMessage(
wxString::Format( _T("Warning: invalid parent in options::AddPage( %d, "),
parent ) + title + _T(" )") );
return NULL;
}
wxNotebookPage* page = m_pListbook->GetPage( parent );
wxScrolledWindow *window;
int style = wxVSCROLL | wxTAB_TRAVERSAL;
if( page->IsKindOf( CLASSINFO(wxNotebook))) {
window = new wxScrolledWindow( page, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
window->SetScrollRate(5,5);
((wxNotebook *)page)->AddPage( window, title );
} else if (page->IsKindOf(CLASSINFO(wxScrolledWindow))) {
wxString toptitle = m_pListbook->GetPageText( parent );
wxNotebook *nb = new wxNotebook( m_pListbook, wxID_ANY, wxDefaultPosition, wxDefaultSize,wxNB_TOP );
/* Only remove the tab from listbook, we still have original content in {page} */
m_pListbook->RemovePage( parent );
m_pListbook->InsertPage( parent, nb, toptitle, false, parent );
wxString previoustitle = page->GetName();
page->Reparent( nb );
nb->AddPage( page, previoustitle );
/* wxNotebookPage is hidden under wxGTK after RemovePage/Reparent
* we must explicitely Show() it */
page->Show();
window = new wxScrolledWindow( nb, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
window->SetScrollRate(5, 5);
nb->AddPage( window, title );
nb->ChangeSelection( 0 );
} else { // This is the default content, we can replace it now
window = new wxScrolledWindow( m_pListbook, wxID_ANY, wxDefaultPosition, wxDefaultSize, style, title );
window->SetScrollRate(5, 5);
wxString toptitle = m_pListbook->GetPageText( parent );
m_pListbook->DeletePage( parent );
m_pListbook->InsertPage( parent, window, toptitle, false, parent );
}
return window;
}
bool options::DeletePage( wxScrolledWindow *page )
{
for (size_t i = 0; i < m_pListbook->GetPageCount(); i++)
{
wxNotebookPage* pg = m_pListbook->GetPage( i );
if( pg->IsKindOf( CLASSINFO(wxNotebook))) {
wxNotebook *nb = ((wxNotebook *)pg);
for (size_t j = 0; j < nb->GetPageCount(); j++)
{
wxNotebookPage* spg = nb->GetPage( j );
if ( spg == page )
{
nb->DeletePage( j );
if (nb->GetPageCount()==1)
{
/* There's only one page, remove inner notebook */
spg = nb->GetPage( 0 );
spg->Reparent( m_pListbook );
nb->RemovePage( 0 );
wxString toptitle = m_pListbook->GetPageText( i );
m_pListbook->DeletePage( i );
m_pListbook->InsertPage( i, spg, toptitle, false, i );
}
return true;
}
}
} else if (pg->IsKindOf(CLASSINFO(wxScrolledWindow)) && pg == page) {
/* There's only one page, replace it with empty panel */
m_pListbook->DeletePage( i );
wxPanel *panel = new wxPanel( m_pListbook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("") );
wxString toptitle = m_pListbook->GetPageText( i );
m_pListbook->InsertPage( i, panel, toptitle, false, i );
return true;
}
}
return false;
}
void options::CreatePanel_NMEA( size_t parent, int border_size, int group_item_spacing, wxSize small_button_size )
{
m_pNMEAForm = AddPage( parent, _("NMEA") );
wxBoxSizer* bSizer4 = new wxBoxSizer( wxVERTICAL );
m_pNMEAForm->SetSizer( bSizer4 );
m_pNMEAForm->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerOuterContainer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerGeneral;
sbSizerGeneral = new wxStaticBoxSizer( new wxStaticBox( m_pNMEAForm, wxID_ANY, _("General") ), wxVERTICAL );
wxBoxSizer* bSizer151;
bSizer151 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer161;
bSizer161 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer171;
bSizer171 = new wxBoxSizer( wxHORIZONTAL );
m_cbFilterSogCog = new wxCheckBox( m_pNMEAForm, wxID_ANY, _("Filter NMEA Course and Speed data"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer171->Add( m_cbFilterSogCog, 0, wxALL, 5 );
m_stFilterSec = new wxStaticText( m_pNMEAForm, wxID_ANY, _("Filter period (sec)"), wxDefaultPosition, wxDefaultSize, 0 );
m_stFilterSec->Wrap( -1 );
int nspace = 5;
#ifdef __WXGTK__
nspace = 9;
#endif
bSizer171->Add( m_stFilterSec, 0, wxALL, nspace );
m_tFilterSec = new wxTextCtrl( m_pNMEAForm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer171->Add( m_tFilterSec, 0, wxALL, 4 );
bSizer161->Add( bSizer171, 1, wxEXPAND, 5 );
m_cbNMEADebug = new wxCheckBox( m_pNMEAForm, wxID_ANY, _("Show NMEA Debug Window"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer161->Add( m_cbNMEADebug, 0, wxALL, 3 );
m_cbFurunoGP3X = new wxCheckBox( m_pNMEAForm, wxID_ANY, _("Format uploads for Furuno GP3X"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbFurunoGP3X->SetValue(g_GPS_Ident == _T("FurunoGP3X"));
bSizer161->Add( m_cbFurunoGP3X, 0, wxALL, 3 );
m_cbGarminUploadHost = new wxCheckBox( m_pNMEAForm, wxID_ANY, _("Use Garmin GRMN (Host) mode for uploads"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbGarminUploadHost->SetValue(g_bGarminHostUpload);
bSizer161->Add( m_cbGarminUploadHost, 0, wxALL, 3 );
bSizer151->Add( bSizer161, 1, wxEXPAND, 5 );
sbSizerGeneral->Add( bSizer151, 1, wxEXPAND, 5 );
bSizerOuterContainer->Add( sbSizerGeneral, 0, wxALL|wxEXPAND, 5 );
// Connections listbox, etc
wxStaticBoxSizer* sbSizerLB= new wxStaticBoxSizer( new wxStaticBox( m_pNMEAForm, wxID_ANY, _("Data Connections") ), wxVERTICAL );
wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxHORIZONTAL );
m_lcSources = new wxListCtrl( m_pNMEAForm, wxID_ANY, wxDefaultPosition, wxSize(-1, 150), wxLC_REPORT|wxLC_SINGLE_SEL);
bSizer17->Add( m_lcSources, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer18;
bSizer18 = new wxBoxSizer( wxVERTICAL );
m_buttonAdd = new wxButton( m_pNMEAForm, wxID_ANY, _("Add Connection"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer18->Add( m_buttonAdd, 0, wxALL, 5 );
m_buttonRemove = new wxButton( m_pNMEAForm, wxID_ANY, _("Remove Connection"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRemove->Enable( false );
bSizer18->Add( m_buttonRemove, 0, wxALL, 5 );
bSizer17->Add( bSizer18, 0, wxEXPAND, 5 );
sbSizerLB->Add( bSizer17, 1, wxEXPAND, 5 );
bSizerOuterContainer->Add( sbSizerLB, 0, wxEXPAND, 5 );
// Connections Properties
sbSizerConnectionProps = new wxStaticBoxSizer( new wxStaticBox( m_pNMEAForm, wxID_ANY, _("Properties") ), wxVERTICAL );
wxBoxSizer* bSizer15;
bSizer15 = new wxBoxSizer( wxHORIZONTAL );
m_rbTypeSerial = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("Serial"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbTypeSerial->SetValue( true );
bSizer15->Add( m_rbTypeSerial, 0, wxALL, 5 );
m_rbTypeNet = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("Network"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer15->Add( m_rbTypeNet, 0, wxALL, 5 );
sbSizerConnectionProps->Add( bSizer15, 0, wxEXPAND, 0 );
gSizerNetProps = new wxGridSizer( 0, 2, 0, 0 );
m_stNetProto = new wxStaticText( m_pNMEAForm, wxID_ANY, _("Protocol"), wxDefaultPosition, wxDefaultSize, 0 );
m_stNetProto->Wrap( -1 );
gSizerNetProps->Add( m_stNetProto, 0, wxALL, 5 );
wxBoxSizer* bSizer16;
bSizer16 = new wxBoxSizer( wxHORIZONTAL );
m_rbNetProtoTCP = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("TCP"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbNetProtoTCP->Enable( true );
bSizer16->Add( m_rbNetProtoTCP, 0, wxALL, 5 );
m_rbNetProtoUDP = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("UDP"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbNetProtoUDP->Enable( true );
bSizer16->Add( m_rbNetProtoUDP, 0, wxALL, 5 );
m_rbNetProtoGPSD = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("GPSD"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbNetProtoGPSD->SetValue( true );
bSizer16->Add( m_rbNetProtoGPSD, 0, wxALL, 5 );
gSizerNetProps->Add( bSizer16, 1, wxEXPAND, 5 );
m_stNetAddr = new wxStaticText( m_pNMEAForm, wxID_ANY, _("Address"), wxDefaultPosition, wxDefaultSize, 0 );
m_stNetAddr->Wrap( -1 );
gSizerNetProps->Add( m_stNetAddr, 0, wxALL, 5 );
m_tNetAddress = new wxTextCtrl( m_pNMEAForm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gSizerNetProps->Add( m_tNetAddress, 0, wxEXPAND|wxTOP, 5 );
m_stNetPort = new wxStaticText( m_pNMEAForm, wxID_ANY, _("DataPort"), wxDefaultPosition, wxDefaultSize, 0 );
m_stNetPort->Wrap( -1 );
gSizerNetProps->Add( m_stNetPort, 0, wxALL, 5 );
m_tNetPort = new wxTextCtrl( m_pNMEAForm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gSizerNetProps->Add( m_tNetPort, 1, wxEXPAND|wxTOP, 5 );
sbSizerConnectionProps->Add( gSizerNetProps, 0, wxEXPAND, 5 );
gSizerSerProps = new wxGridSizer( 0, 1, 0, 0 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 4, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_stSerPort = new wxStaticText( m_pNMEAForm, wxID_ANY, _("DataPort"), wxDefaultPosition, wxDefaultSize, 0 );
m_stSerPort->Wrap( -1 );
fgSizer1->Add( m_stSerPort, 0, wxALL, 5 );
m_comboPort = new wxComboBox( m_pNMEAForm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgSizer1->Add( m_comboPort, 0, wxEXPAND|wxTOP, 5 );
m_stSerBaudrate = new wxStaticText( m_pNMEAForm, wxID_ANY, _("Baudrate"), wxDefaultPosition, wxDefaultSize, 0 );
m_stSerBaudrate->Wrap( -1 );
fgSizer1->Add( m_stSerBaudrate, 0, wxALL, 5 );
wxString m_choiceBaudRateChoices[] = { _("150"), _("300"), _("600"), _("1200"), _("2400"), _("4800"), _("9600"), _("19200"), _("38400"), _("57600"), _("115200"), _("230400"), _("460800"), _("921600") };
int m_choiceBaudRateNChoices = sizeof( m_choiceBaudRateChoices ) / sizeof( wxString );
m_choiceBaudRate = new wxChoice( m_pNMEAForm, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceBaudRateNChoices, m_choiceBaudRateChoices, 0 );
m_choiceBaudRate->SetSelection( 0 );
fgSizer1->Add( m_choiceBaudRate, 1, wxEXPAND|wxTOP, 5 );
m_stSerProtocol = new wxStaticText( m_pNMEAForm, wxID_ANY, _("Protocol"), wxDefaultPosition, wxDefaultSize, 0 );
m_stSerProtocol->Wrap( -1 );
fgSizer1->Add( m_stSerProtocol, 0, wxALL, 5 );
wxString m_choiceSerialProtocolChoices[] = { _("NMEA 0183"), _("NMEA 2000"), _("Seatalk") };
int m_choiceSerialProtocolNChoices = sizeof( m_choiceSerialProtocolChoices ) / sizeof( wxString );
m_choiceSerialProtocol = new wxChoice( m_pNMEAForm, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSerialProtocolNChoices, m_choiceSerialProtocolChoices, 0 );
m_choiceSerialProtocol->SetSelection( 0 );
m_choiceSerialProtocol->Enable( false );
fgSizer1->Add( m_choiceSerialProtocol, 1, wxEXPAND|wxTOP, 5 );
m_stPriority = new wxStaticText( m_pNMEAForm, wxID_ANY, _("Priority"), wxDefaultPosition, wxDefaultSize, 0 );
m_stPriority->Wrap( -1 );
fgSizer1->Add( m_stPriority, 0, wxALL, 5 );
wxString m_choicePriorityChoices[] = { _("0"), _("1"), _("2"), _("3"), _("4"), _("5"), _("6"), _("7"), _("8"), _("9") };
int m_choicePriorityNChoices = sizeof( m_choicePriorityChoices ) / sizeof( wxString );
m_choicePriority = new wxChoice( m_pNMEAForm, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePriorityNChoices, m_choicePriorityChoices, 0 );
m_choicePriority->SetSelection( 9 );
fgSizer1->Add( m_choicePriority, 0, wxEXPAND|wxTOP, 5 );
gSizerSerProps->Add( fgSizer1, 0, wxEXPAND, 5 );
wxFlexGridSizer* fgSizer5;
fgSizer5 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer5->SetFlexibleDirection( wxBOTH );
fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_cbCheckCRC = new wxCheckBox( m_pNMEAForm, wxID_ANY, _("Control checksum"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbCheckCRC->SetValue(true);
m_cbCheckCRC->SetToolTip( _("If checked, only the sentences with a valid checksum are passed through") );
fgSizer5->Add( m_cbCheckCRC, 0, wxALL, 5 );
m_cbGarminHost = new wxCheckBox( m_pNMEAForm, wxID_ANY, _("Use Garmin (GRMN) mode for input"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbGarminHost->SetValue(false);
fgSizer5->Add( m_cbGarminHost, 0, wxALL, 5 );
sbSizerConnectionProps->Add( gSizerSerProps, 0, wxEXPAND, 5 );
sbSizerConnectionProps->Add( fgSizer5, 0, wxEXPAND, 5 );
sbSizerInFilter = new wxStaticBoxSizer( new wxStaticBox( m_pNMEAForm, wxID_ANY, _("Input filtering") ), wxVERTICAL );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
m_rbIAccept = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("Accept only sentences"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
bSizer9->Add( m_rbIAccept, 0, wxALL, 5 );
m_rbIIgnore = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("Ignore sentences"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_rbIIgnore, 0, wxALL, 5 );
sbSizerInFilter->Add( bSizer9, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
m_tcInputStc = new wxTextCtrl( m_pNMEAForm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bSizer11->Add( m_tcInputStc, 1, wxALL|wxEXPAND, 5 );
m_btnInputStcList = new wxButton( m_pNMEAForm, wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
bSizer11->Add( m_btnInputStcList, 0, wxALL, 5 );
sbSizerInFilter->Add( bSizer11, 0, wxEXPAND, 5 );
sbSizerConnectionProps->Add( sbSizerInFilter, 0, wxEXPAND, 5 );
m_cbOutput = new wxCheckBox( m_pNMEAForm, wxID_ANY, _("Output on this port ( as Autopilot or NMEA Repeater)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerConnectionProps->Add( m_cbOutput, 0, wxALL, 5 );
sbSizerOutFilter = new wxStaticBoxSizer( new wxStaticBox( m_pNMEAForm, wxID_ANY, _("Output filtering") ), wxVERTICAL );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
m_rbOAccept = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("Transmit sentences"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
bSizer10->Add( m_rbOAccept, 0, wxALL, 5 );
m_rbOIgnore = new wxRadioButton( m_pNMEAForm, wxID_ANY, _("Drop sentences"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer10->Add( m_rbOIgnore, 0, wxALL, 5 );
sbSizerOutFilter->Add( bSizer10, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxHORIZONTAL );
m_tcOutputStc = new wxTextCtrl( m_pNMEAForm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bSizer12->Add( m_tcOutputStc, 1, wxALL|wxEXPAND, 5 );
m_btnOutputStcList = new wxButton( m_pNMEAForm, wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
bSizer12->Add( m_btnOutputStcList, 0, wxALL, 5 );
sbSizerOutFilter->Add( bSizer12, 0, wxEXPAND, 5 );
sbSizerConnectionProps->Add( sbSizerOutFilter, 0, wxEXPAND, 5 );
bSizerOuterContainer->Add( sbSizerConnectionProps, 1, wxALL|wxEXPAND, 5 );
bSizer4->Add( bSizerOuterContainer, 1, wxEXPAND, 5 );
// Connect Events
m_lcSources->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( options::OnSelectDatasource ), NULL, this );
m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( options::OnAddDatasourceClick ), NULL, this );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( options::OnRemoveDatasourceClick ), NULL, this );
m_rbTypeSerial->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnTypeSerialSelected ), NULL, this );
m_rbTypeNet->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnTypeNetSelected ), NULL, this );
m_rbNetProtoTCP->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnNetProtocolSelected ), NULL, this );
m_rbNetProtoUDP->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnNetProtocolSelected ), NULL, this );
m_rbNetProtoGPSD->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnNetProtocolSelected ), NULL, this );
m_tNetAddress->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnConnValChange ), NULL, this );
m_tNetPort->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnConnValChange ), NULL, this );
m_comboPort->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( options::OnConnValChange ), NULL, this );
m_comboPort->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnConnValChange ), NULL, this );
m_choiceBaudRate->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( options::OnBaudrateChoice ), NULL, this );
m_choiceSerialProtocol->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( options::OnProtocolChoice ), NULL, this );
m_choicePriority->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( options::OnConnValChange ), NULL, this );
m_cbCheckCRC->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnCrcCheck ), NULL, this );
m_cbGarminHost->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnUploadFormatChange ), NULL, this );
m_cbGarminUploadHost->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnUploadFormatChange ), NULL, this );
m_cbFurunoGP3X->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnUploadFormatChange ), NULL, this );
m_rbIAccept->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnRbAcceptInput ), NULL, this );
m_rbIIgnore->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnRbIgnoreInput ), NULL, this );
m_tcInputStc->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnConnValChange ), NULL, this );
m_btnInputStcList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( options::OnBtnIStcs ), NULL, this );
m_cbOutput->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnCbOutput ), NULL, this );
m_rbOAccept->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnRbOutput ), NULL, this );
m_rbOIgnore->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( options::OnRbOutput ), NULL, this );
m_tcOutputStc->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnConnValChange ), NULL, this );
m_btnOutputStcList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( options::OnBtnOStcs ), NULL, this );
m_cbNMEADebug->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnShowGpsWindowCheckboxClick ), NULL, this );
m_cbFilterSogCog->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_tFilterSec->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( options::OnValChange ), NULL, this );
m_lcSources->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler(options::OnConnectionToggleEnable), NULL, this );
wxListItem col0;
col0.SetId(0);
col0.SetText( _("Enable") );
m_lcSources->InsertColumn(0, col0);
wxListItem col1;
col1.SetId(1);
col1.SetText( _("Type") );
m_lcSources->InsertColumn(1, col1);
wxListItem col2;
col2.SetId(2);
col2.SetText( _("DataPort") );
m_lcSources->InsertColumn(2, col2);
wxListItem col3;
col3.SetId(3);
col3.SetText( _("Priority") );
m_lcSources->InsertColumn(3, col3);
wxListItem col4;
col4.SetId(4);
col4.SetText( _("Parameters") );
m_lcSources->InsertColumn(4, col4);
wxListItem col5;
col5.SetId(5);
col5.SetText( _("Output") );
m_lcSources->InsertColumn(5, col5);
wxListItem col6;
col6.SetId(6);
col6.SetText( _("Filters") );
m_lcSources->InsertColumn(6, col6);
// Build the image list
wxBitmap unchecked_bmp(16, 16), checked_bmp(16, 16);
{
wxMemoryDC renderer_dc;
// Unchecked
renderer_dc.SelectObject(unchecked_bmp);
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID));
renderer_dc.Clear();
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), 0);
// Checked
renderer_dc.SelectObject(checked_bmp);
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID));
renderer_dc.Clear();
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), wxCONTROL_CHECKED);
}
wxImageList *imglist = new wxImageList( 16, 16, true, 1 );
imglist->Add( unchecked_bmp );
imglist->Add( checked_bmp );
m_lcSources->AssignImageList( imglist, wxIMAGE_LIST_SMALL );
m_lcSources->Refresh();
m_stcdialog_in = new SentenceListDlg(FILTER_INPUT, this);
m_stcdialog_out = new SentenceListDlg(FILTER_OUTPUT, this);
FillSourceList();
for(size_t i = 0; i < m_pSerialArray->Count() ; i++)
{
m_comboPort->Append(m_pSerialArray->Item(i));
}
ShowNMEACommon( false );
ShowNMEASerial( false );
ShowNMEANet( false );
connectionsaved = true;
}
void options::OnConnectionToggleEnable( wxMouseEvent &event )
{
wxPoint pos = event.GetPosition();
int flags = 0;
long clicked_index = m_lcSources->HitTest( pos, flags );
// Clicking Enable Checkbox (full column)?
if( clicked_index > -1 && event.GetX() < m_lcSources->GetColumnWidth( 0 ) ) {
// Process the clicked item
ConnectionParams *conn = g_pConnectionParams->Item( m_lcSources->GetItemData( clicked_index ) );
conn->bEnabled = !conn->bEnabled;
m_connection_enabled = conn->bEnabled;
m_lcSources->SetItemImage( clicked_index, conn->bEnabled ? 1 : 0 );
cc1->Refresh();
}
else if( clicked_index == -1 ) {
ClearNMEAForm();
m_buttonRemove->Enable( false );
}
// Allow wx to process...
event.Skip();
}
void options::CreatePanel_Ownship( size_t parent, int border_size, int group_item_spacing, wxSize small_button_size )
{
itemPanelShip = AddPage( parent, _("Own Ship") );
ownShip = new wxBoxSizer( wxVERTICAL );
itemPanelShip->SetSizer( ownShip );
// OwnShip Display options
wxStaticBox* osdBox = new wxStaticBox( itemPanelShip, wxID_ANY, _("Display Options") );
dispOptions = new wxStaticBoxSizer( osdBox, wxVERTICAL );
ownShip->Add( dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size );
wxFlexGridSizer* dispOptionsGrid = new wxFlexGridSizer( 2, 2, group_item_spacing, group_item_spacing );
dispOptionsGrid->AddGrowableCol( 1 );
dispOptions->Add( dispOptionsGrid, 0, wxALL | wxEXPAND, border_size );
wxStaticText *pStatic_OSCOG_Predictor = new wxStaticText( itemPanelShip, wxID_ANY, _("COG Predictor Length (min)") );
dispOptionsGrid->Add( pStatic_OSCOG_Predictor, 0 );
m_pText_OSCOG_Predictor = new wxTextCtrl( itemPanelShip, wxID_ANY );
dispOptionsGrid->Add( m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT );
wxStaticText *iconTypeTxt = new wxStaticText( itemPanelShip, wxID_ANY, _("Ship Icon Type") );
dispOptionsGrid->Add( iconTypeTxt, 0 );
wxString iconTypes[] = { _("Default"), _("Real Scale Bitmap"), _("Real Scale Vector") };
m_pShipIconType = new wxChoice( itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition, wxDefaultSize, 3, iconTypes );
dispOptionsGrid->Add( m_pShipIconType, 0, wxALIGN_RIGHT | wxLEFT|wxRIGHT|wxTOP, group_item_spacing );
realSizes = new wxFlexGridSizer( 5, 2, group_item_spacing, group_item_spacing );
realSizes->AddGrowableCol(1);
dispOptions->Add( realSizes, 0, wxEXPAND | wxLEFT, 30 );
realSizes->Add( new wxStaticText( itemPanelShip, wxID_ANY, _("Length Over All (m)") ), 1, wxALIGN_LEFT );
m_pOSLength = new wxTextCtrl( itemPanelShip, 1 );
realSizes->Add( m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing );
realSizes->Add( new wxStaticText( itemPanelShip, wxID_ANY, _("Width Over All (m)") ), 1, wxALIGN_LEFT );
m_pOSWidth = new wxTextCtrl( itemPanelShip, wxID_ANY );
realSizes->Add( m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing );
realSizes->Add( new wxStaticText( itemPanelShip, wxID_ANY, _("GPS Offset from Bow (m)") ), 1, wxALIGN_LEFT );
m_pOSGPSOffsetY = new wxTextCtrl( itemPanelShip, wxID_ANY );
realSizes->Add( m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing );
realSizes->Add( new wxStaticText( itemPanelShip, wxID_ANY, _("GPS Offset from Midship (m)") ), 1, wxALIGN_LEFT );
m_pOSGPSOffsetX = new wxTextCtrl( itemPanelShip, wxID_ANY );
realSizes->Add( m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing );
realSizes->Add( new wxStaticText( itemPanelShip, wxID_ANY, _("Minimum Screen Size (mm)") ), 1, wxALIGN_LEFT );
m_pOSMinSize = new wxTextCtrl( itemPanelShip, wxID_ANY );
realSizes->Add( m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing );
// Radar rings
wxFlexGridSizer* rrSelect = new wxFlexGridSizer( 1, 2, group_item_spacing, group_item_spacing );
rrSelect->AddGrowableCol( 1 );
dispOptions->Add( rrSelect, 0, wxLEFT|wxRIGHT | wxEXPAND, border_size );
wxStaticText *rrTxt = new wxStaticText( itemPanelShip, wxID_ANY, _("Show radar rings") );
rrSelect->Add( rrTxt, 1, wxEXPAND | wxALL, group_item_spacing );
wxString rrAlt[] = { _("None"), _T("1"), _T("2"), _T("3"), _T("4"), _T("5"), _T("6"), _T("7"), _T("8"), _T("9"), _T("10") };
pNavAidRadarRingsNumberVisible = new wxChoice( itemPanelShip, ID_RADARRINGS, wxDefaultPosition, m_pShipIconType->GetSize(), 11, rrAlt );
rrSelect->Add( pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL, group_item_spacing );
radarGrid = new wxFlexGridSizer( 2, 2, group_item_spacing, group_item_spacing );
radarGrid->AddGrowableCol( 1 );
dispOptions->Add( radarGrid, 0, wxLEFT | wxEXPAND, 30 );
wxStaticText* distanceText = new wxStaticText( itemPanelShip, wxID_STATIC, _("Distance Between Rings") );
radarGrid->Add( distanceText, 1, wxEXPAND | wxALL, group_item_spacing );
pNavAidRadarRingsStep = new wxTextCtrl( itemPanelShip, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize( 100, -1 ), 0 );
radarGrid->Add( pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL, group_item_spacing );
wxStaticText* unitText = new wxStaticText( itemPanelShip, wxID_STATIC, _("Distance Unit") );
radarGrid->Add( unitText, 1, wxEXPAND | wxALL, group_item_spacing );
wxString pDistUnitsStrings[] = { _("Nautical Miles"), _("Kilometers") };
m_itemRadarRingsUnits = new wxChoice( itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition, m_pShipIconType->GetSize(), 2, pDistUnitsStrings );
radarGrid->Add( m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size );
// Tracks
wxStaticBox* trackText = new wxStaticBox( itemPanelShip, wxID_ANY, _("Tracks") );
wxStaticBoxSizer* trackSizer = new wxStaticBoxSizer( trackText, wxVERTICAL );
ownShip->Add( trackSizer, 0, wxGROW | wxALL, border_size );
pTrackDaily = new wxCheckBox( itemPanelShip, ID_DAILYCHECKBOX, _("Automatic Daily Tracks") );
trackSizer->Add( pTrackDaily, 1, wxALL, border_size );
pTrackHighlite = new wxCheckBox( itemPanelShip, ID_TRACKHILITE, _("Highlight Tracks") );
trackSizer->Add( pTrackHighlite, 1, wxALL, border_size );
wxFlexGridSizer *pTrackGrid = new wxFlexGridSizer( 1, 2, group_item_spacing, group_item_spacing );
pTrackGrid->AddGrowableCol( 1 );
trackSizer->Add( pTrackGrid, 0, wxALL | wxEXPAND, border_size );
wxStaticText* tpText = new wxStaticText( itemPanelShip, wxID_STATIC, _("Tracking Precision") );
pTrackGrid->Add( tpText, 1, wxEXPAND | wxALL, group_item_spacing );
wxString trackAlt[] = { _("Low"), _("Medium"), _("High") };
pTrackPrecision = new wxChoice( itemPanelShip, wxID_ANY, wxDefaultPosition, m_pShipIconType->GetSize(), 3, trackAlt );
pTrackGrid->Add( pTrackPrecision, 0, wxALIGN_RIGHT | wxALL, group_item_spacing );
DimeControl( itemPanelShip );
}
void options::CreatePanel_ChartsLoad( size_t parent, int border_size, int group_item_spacing,
wxSize small_button_size )
{
wxScrolledWindow *chartPanelWin = AddPage( m_pageCharts, _("Loaded Charts") );
chartPanel = new wxBoxSizer( wxVERTICAL );
chartPanelWin->SetSizer( chartPanel );
wxStaticBox* loadedBox = new wxStaticBox( chartPanelWin, wxID_ANY, _("Directories") );
activeSizer = new wxStaticBoxSizer( loadedBox, wxHORIZONTAL );