OpenCPN Partial API docs
options.h
1 /***************************************************************************
2  *
3  * Project: OpenCPN
4  * Purpose: Options Dialog
5  * Author: David Register
6  *
7  ***************************************************************************
8  * Copyright (C) 2010 by David S. Register *
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  * This program is distributed in the hope that it will be useful, *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18  * GNU General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this program; if not, write to the *
22  * Free Software Foundation, Inc., *
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24  **************************************************************************/
25 
26 #ifndef _OPTIONS_H_
27 #define _OPTIONS_H_
28 
29 #ifdef __MINGW32__
30 #undef IPV6STRICT // mingw FTBS fix: missing struct ip_mreq
31 #include <windows.h>
32 #endif
33 
34 #include <memory>
35 
36 #include <wx/listbook.h>
37 #include <wx/dirctrl.h>
38 #include <wx/spinctrl.h>
39 #include <wx/listctrl.h>
40 #include <wx/choice.h>
41 #include <wx/collpane.h>
42 #include <wx/clrpicker.h>
43 #include <wx/colourdata.h>
44 #include "connections_dialog.h"
45 
46 #if wxUSE_TIMEPICKCTRL
47 #include <wx/timectrl.h>
48 #endif
49 
50 #ifdef __WXGTK__
51 // wxTimePickerCtrl is completely broken in Gnome based desktop environments as
52 // of wxGTK 3.0
53 #include "time_textbox.h"
54 #endif
55 
56 #include <vector>
57 
58 #if wxCHECK_VERSION(2, 9, 0)
59 #include <wx/frame.h>
60 #else
61 #include "scrollingdialog.h"
62 #endif
63 
64 #include "chartdbs.h"
65 #include "pluginmanager.h" // FIXME: Refactor
66 
67 #ifndef __OCPN__ANDROID__
68 #define __OCPN__OPTIONS_USE_LISTBOOK__
69 #endif
70 
71 // Forward Declarations
72 class wxGenericDirCtrl;
73 class MyConfig;
74 class ChartGroupsUI;
75 //class ConnectionParams;
76 class PluginListPanel;
77 class ChartGroupArray;
78 class ChartGroup;
79 class MMSI_Props_Panel;
80 class MmsiProperties;
82 class CanvasConfigSelect;
83 class OCPNIconCombo;
85 class OCPNChartDirPanel;
86 class OCPNSoundPanel;
87 
88 #define ID_DIALOG 10001
89 #ifdef __WXOSX__
90 #define SYMBOL_OPTIONS_STYLE \
91  wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX | wxSTAY_ON_TOP
92 #else
93 #define SYMBOL_OPTIONS_STYLE \
94  wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
95 #endif
96 #define SYMBOL_OPTIONS_TITLE _("Options")
97 #define SYMBOL_OPTIONS_IDNAME ID_DIALOG
98 #define SYMBOL_OPTIONS_SIZE wxSize(500, 500)
99 #define SYMBOL_OPTIONS_POSITION wxDefaultPosition
100 
101 enum {
102  ID_APPLY = 10000,
103  ID_ATONTEXTCHECKBOX,
104  ID_AUTOANCHORMARKBOX1,
105  ID_BELLSCHECKBOX,
106  ID_BUTTONADD,
107  ID_BUTTONDELETE,
108  ID_BUTTONCOMPRESS,
109  ID_BUTTONFONTCHOOSE,
110  ID_BUTTONECDISHELP,
111  ID_BUTTONFONTCOLOR,
112  ID_BUTTONGROUP,
113  ID_BUTTONREBUILD,
114  ID_BUTTONTCDATA,
115  ID_CHECKLISTBOX,
116  ID_CHECK_DISPLAYGRID,
117  ID_CHECK_LOOKAHEAD,
118  ID_CHOICE_AIS,
119  ID_CHOICE_AP,
120  ID_CHOICE_FONTELEMENT,
121  ID_CHOICE_LANG,
122  ID_CHOICE_NMEA_BAUD,
123  ID_CLEARLIST,
124  ID_CM93CHECKBOX1,
125  ID_CM93ZOOM,
126  ID_COURSEUPCHECKBOX,
127  ID_DAILYCHECKBOX,
128  ID_DEBUGCHECKBOX1,
129  ID_DECLTEXTCHECKBOX,
130  ID_DIRCTRL,
131  ID_DRAGGINGCHECKBOX,
132  ID_FILTERNMEA,
133  ID_FSTOOLBARCHECKBOX,
134  ID_FULLSCREENQUILT,
135  ID_GARMINHOST,
136  ID_RADARRINGS,
137  ID_GRIBCHECKBOX,
138  ID_GROUPAVAILABLE,
139  ID_GROUPDELETEGROUP,
140  ID_GROUPINSERTDIR,
141  ID_GROUPNEWGROUP,
142  ID_GROUPNOTEBOOK,
143  ID_GROUPREMOVEDIR,
144  ID_IMPTEXTCHECKBOX,
145  ID_LDISTEXTCHECKBOX,
146  ID_LISTBOX,
147  ID_METACHECKBOX,
148  ID_NOTEBOOK,
149  ID_OPENGLBOX,
150  ID_OPENGLOPTIONS,
151  ID_SHIPICONTYPE,
152  ID_OUTLINECHECKBOX1,
153  ID_PANEL,
154  ID_PANEL2,
155  ID_PANEL3,
156  ID_PANELADVANCED,
157  ID_PANELAIS,
158  ID_PANELMMSI,
159  ID_PANELFONT,
160  ID_PANELPIM,
161  ID_PRESERVECHECKBOX,
162  ID_PRINTCHECKBOX1,
163  ID_QUILTCHECKBOX1,
164  ID_RADARDISTUNIT,
165  ID_RASTERCHECKBOX1,
166  ID_SCAMINCHECKBOX,
167  ID_SUPERSCAMINCHECKBOX,
168  ID_SCANCHECKBOX,
169  ID_SDMMFORMATCHOICE,
170  ID_DISTANCEUNITSCHOICE,
171  ID_SPEEDUNITSCHOICE,
172  ID_WINDSPEEDUNITCHOICE,
173  ID_DEPTHUNITSCHOICE,
174  ID_SELECTLIST,
175  ID_SHOWDEPTHUNITSBOX1,
176  ID_SHOWGPSWINDOW,
177  ID_SKEWCOMPBOX,
178  ID_SMOOTHPANZOOMBOX,
179  ID_SOUNDGCHECKBOX,
180  ID_STYLESCOMBOBOX,
181  ID_TCDATAADD,
182  ID_TCDATADEL,
183  ID_TEXTCHECKBOX,
184  ID_OPTEXTCTRL,
185  ID_TIDESELECTED,
186  ID_TRACKCHECKBOX,
187  ID_TRACKHILITE,
188  ID_TRANSTOOLBARCHECKBOX,
189  ID_UPDCHECKBOX,
190  ID_PARSEENCBUTTON,
191  ID_VECTORCHECKBOX1,
192  ID_ZTCCHECKBOX,
193  ID_DELETECHECKBOX,
194  ID_NATIONALTEXTCHECKBOX,
195  ID_TRUESHOWCHECKBOX,
196  ID_MAGSHOWCHECKBOX,
197  ID_MAGAPBCHECKBOX,
198  ID_MOBILEBOX,
199  ID_REPONSIVEBOX,
200  ID_SIZEMANUALRADIOBUTTON,
201  ID_OPWAYPOINTRANGERINGS,
202  xID_OK,
203  ID_BT_SCANTIMER,
204  ID_TRACKROTATETIME,
205  ID_TRACKROTATEUTC,
206  ID_TRACKROTATELMT,
207  ID_TRACKROTATECOMPUTER,
208  ID_SETSTDLIST,
209  ID_VECZOOM,
210  ID_INLANDECDISBOX,
211  ID_ROLLOVERBOX,
212  ID_SOGCOGFROMLLCHECKBOX,
213  ID_SOGCOGDAMPINTTEXTCTRL,
214  // LIVE ETA OPTION
215  ID_CHECK_LIVEETA,
216  ID_DEFAULT_BOAT_SPEED,
217  ID_SCREENCONFIG1,
218  ID_SCREENCONFIG2,
219  ID_CONFIGEDIT_OK,
220  ID_CONFIGEDIT_CANCEL,
221  ID_ZOOMBUTTONS,
222  ID_RASTERZOOM,
223  ID_ANCHORALERTAUDIO,
224  ID_AISALERTAUDIO,
225  ID_AISALERTDIALOG,
226  ID_TEMPUNITSCHOICE,
227  ID_BUTTONMIGRATE
228 };
229 
230 /* Define an int bit field for dialog return value
231  * to indicate which types of settings have changed */
232 #define GENERIC_CHANGED 1
233 #define S52_CHANGED 1 << 1
234 #define FONT_CHANGED 1 << 2
235 #define FORCE_UPDATE 1 << 3
236 #define VISIT_CHARTS 1 << 4
237 #define LOCALE_CHANGED 1 << 5
238 #define TOOLBAR_CHANGED 1 << 6
239 #define CHANGE_CHARTS 1 << 7
240 #define SCAN_UPDATE 1 << 8
241 #define GROUPS_CHANGED 1 << 9
242 #define STYLE_CHANGED 1 << 10
243 #define TIDES_CHANGED 1 << 11
244 #define GL_CHANGED 1 << 12
245 #define REBUILD_RASTER_CACHE 1 << 13
246 #define NEED_NEW_OPTIONS 1 << 14
247 #define PARSE_ENC 1 << 15
248 #define CONFIG_CHANGED 1 << 16
249 
250 #ifndef wxCLOSE_BOX
251 #define wxCLOSE_BOX 0x1000
252 #endif
253 #ifndef wxFIXED_MINSIZE
254 #define wxFIXED_MINSIZE 0
255 #endif
256 
257 #include <wx/arrimpl.cpp>
258 WX_DEFINE_ARRAY_PTR(wxGenericDirCtrl *, ArrayOfDirCtrls);
259 
260 class Uncopyable {
261 protected:
262  Uncopyable(void) {}
263  ~Uncopyable(void) {}
264 
265 private:
266  Uncopyable(const Uncopyable &);
267  Uncopyable &operator=(const Uncopyable &);
268 };
269 
270 #ifndef bert // wxCHECK_VERSION(2, 9, 0)
271 class options : private Uncopyable,
272  public wxDialog
273 #else
274 class options : private Uncopyable,
275  public wxScrollingDialog
276 #endif
277 {
278 public:
279  explicit options(wxWindow *parent, wxWindowID id = SYMBOL_OPTIONS_IDNAME,
280  const wxString &caption = SYMBOL_OPTIONS_TITLE,
281  const wxPoint &pos = SYMBOL_OPTIONS_POSITION,
282  const wxSize &size = SYMBOL_OPTIONS_SIZE,
283  long style = SYMBOL_OPTIONS_STYLE);
284 
285  ~options(void);
286 #if wxCHECK_VERSION(3, 0, 0)
287  bool SendIdleEvents(wxIdleEvent &event);
288 #endif
289  void SetInitialPage(int page_sel, int sub_page = -1);
290  void Finish(void);
291 
292  void OnClose(wxCloseEvent &event);
293 
294  void CreateListbookIcons();
295  void CreateControls(void);
296  size_t CreatePanel(const wxString &title);
297  wxScrolledWindow *AddPage(size_t parent, const wxString &title);
298  bool DeletePluginPage(wxScrolledWindow *page);
299  void SetColorScheme(ColorScheme cs);
300  void RecalculateSize(int hint_x, int hint_y);
301 
302  void SetInitChartDir(const wxString &dir) { m_init_chart_dir = dir; }
303  void SetInitialSettings(void);
304  void SetInitialVectorSettings(void);
305 
306  void SetCurrentDirList(ArrayOfCDI p) { m_CurrentDirList = p; }
307  void SetWorkDirListPtr(ArrayOfCDI *p) { m_pWorkDirList = p; }
308  ArrayOfCDI *GetWorkDirListPtr(void) { return m_pWorkDirList; }
309 
310  void AddChartDir(const wxString &dir);
311 
312  void UpdateDisplayedChartDirList(ArrayOfCDI p);
313  void UpdateOptionsUnits(void);
314 
315  void SetConfigPtr(MyConfig *p) { m_pConfig = p; }
316  void OnDebugcheckbox1Click(wxCommandEvent &event);
317  void OnDirctrlSelChanged(wxTreeEvent &event);
318  void OnButtonaddClick(wxCommandEvent &event);
319  void OnButtondeleteClick(wxCommandEvent &event);
320  void OnButtonParseENC(wxCommandEvent &event);
321  void OnButtoncompressClick(wxCommandEvent &event);
322  void OnButtonmigrateClick(wxCommandEvent &event);
323  void OnButtonEcdisHelp(wxCommandEvent &event);
324  void OnRadioboxSelected(wxCommandEvent &event);
325  void OnApplyClick(wxCommandEvent &event);
326  void OnXidOkClick(wxCommandEvent &event);
327  void OnCancelClick(wxCommandEvent &event);
328  void OnChooseFont(wxCommandEvent &event);
329  void OnFontChoice(wxCommandEvent &event);
330  void OnCPAWarnClick(wxCommandEvent &event);
331  void OnSyncCogPredClick(wxCommandEvent &event);
332  void OnSizeAutoButton(wxCommandEvent &event);
333  void OnSizeManualButton(wxCommandEvent &event);
334 
335 #if defined(__WXGTK__) || defined(__WXQT__)
336  void OnChooseFontColor(wxCommandEvent &event);
337 #endif
338  void OnGLClicked(wxCommandEvent &event);
339  void OnOpenGLOptions(wxCommandEvent &event);
340  void OnDisplayCategoryRadioButton(wxCommandEvent &event);
341  void OnButtonClearClick(wxCommandEvent &event);
342  void OnButtonSelectClick(wxCommandEvent &event);
343  void OnButtonSetStd(wxCommandEvent &event);
344 
345  void OnPageChange(wxListbookEvent &event);
346  void OnTopNBPageChange(wxNotebookEvent &event);
347  void OnSubNBPageChange(wxNotebookEvent &event);
348  void DoOnPageChange(size_t page);
349 
350  wxString SelectSoundFile();
351  void OnButtonSelectSound(wxCommandEvent &event);
352  void OnButtonTestSound(wxCommandEvent &event);
353 
354  void OnShowGpsWindowCheckboxClick(wxCommandEvent &event);
355  void OnZTCCheckboxClick(wxCommandEvent &event);
356  void OnRadarringSelect(wxCommandEvent &event);
357  void OnWaypointRangeRingSelect(wxCommandEvent &event);
358  void OnShipTypeSelect(wxCommandEvent &event);
359  void OnButtonGroups(wxCommandEvent &event);
360  void OnInsertTideDataLocation(wxCommandEvent &event);
361  void OnRemoveTideDataLocation(wxCommandEvent &event);
362  void OnCharHook(wxKeyEvent &event);
363  void OnChartsPageChange(wxListbookEvent &event);
364  void OnChartDirListSelect(wxCommandEvent &event);
365  void OnUnitsChoice(wxCommandEvent &event);
366 
367  void UpdateWorkArrayFromDisplayPanel(void);
368  ArrayOfCDI GetSelectedChartDirs();
369  ArrayOfCDI GetUnSelectedChartDirs();
370  void SetDirActionButtons();
371 
372  void OnCreateConfig(wxCommandEvent &event);
373  void OnEditConfig(wxCommandEvent &event);
374  void OnDeleteConfig(wxCommandEvent &event);
375  void OnApplyConfig(wxCommandEvent &event);
376  void SetConfigButtonState();
377  void ClearConfigList();
378  void BuildConfigList();
379  void OnConfigMouseSelected(wxMouseEvent &event);
380  void OnDialogInit(wxInitDialogEvent& event);
381 
382 
383  bool GetNeedNew() { return m_bneedNew; }
384  void SetNeedNew(bool bnew) { m_bneedNew = bnew; }
385  int GetScrollRate() { return m_scrollRate; }
386  void SetForceNewToolbarOnCancel(bool val) { m_bForceNewToolbaronCancel = val; }
387 
388  wxArrayString *GetSerialArray(){ return m_pSerialArray; }
389 
390  // Should we show tooltips?
391  static bool ShowToolTips(void);
392 
393 #ifdef __OCPN__OPTIONS_USE_LISTBOOK__
394  wxListbook *m_pListbook;
395 #else
396  wxNotebook *m_pListbook;
397 #endif
398 
399  size_t m_pageDisplay, m_pageConnections, m_pageCharts, m_pageShips;
400  size_t m_pageUI, m_pagePlugins;
401  int lastPage, lastSubPage;
402  wxPoint lastWindowPos;
403  wxSize lastWindowSize;
404  wxButton *m_ApplyButton, *m_OKButton, *m_CancelButton;
405 
406  ChartGroupArray *m_pGroupArray;
407  int m_groups_changed;
408 
409  // Sizer flags
410  wxSizerFlags inputFlags, verticleInputFlags, labelFlags, groupInputFlags;
411  wxSizerFlags groupLabelFlags, groupLabelFlagsHoriz;
412 
413  // For general options
414  wxScrolledWindow *pDisplayPanel;
415  wxCheckBox *pShowStatusBar, *pShowMenuBar, *pShowChartBar, *pShowCompassWin;
416  wxCheckBox *pPrintShowIcon, *pCDOOutlines, *pSDepthUnits, *pSDisplayGrid;
417  wxCheckBox *pAutoAnchorMark, *pCDOQuilting, *pCBRaster, *pCBVector;
418  wxCheckBox *pCBCM93, *pCBLookAhead, *pSkewComp, *pOpenGL, *pSmoothPanZoom;
419  wxCheckBox *pFullScreenQuilt, *pMobile, *pResponsive, *pOverzoomEmphasis;
420  wxCheckBox *pOZScaleVector, *pToolbarAutoHideCB, *pInlandEcdis, *pRollover;
421  wxCheckBox *pZoomButtons, *pChartBarEX;
422  wxTextCtrl *pCOGUPUpdateSecs, *m_pText_OSCOG_Predictor, *pScreenMM;
423  wxTextCtrl *pToolbarHideSecs, *m_pText_OSHDT_Predictor;
424 
425  wxTextCtrl *pCmdSoundString;
426 
427  wxChoice *m_pShipIconType, *m_pcTCDatasets;
428  wxSlider *m_pSlider_Zoom_Raster, *m_pSlider_GUI_Factor, *m_pSlider_Chart_Factor,
429  *m_pSlider_Ship_Factor, *m_pSlider_Text_Factor, *m_pSlider_ENCText_Factor;
430  wxSlider *m_pMouse_Zoom_Slider;
431  wxSlider *m_pSlider_Zoom_Vector;
432  wxSlider *m_pSlider_CM93_Zoom;
433  // LIVE ETA OPTION
434  wxCheckBox *pSLiveETA;
435  wxTextCtrl *pSDefaultBoatSpeed;
436 
437  wxRadioButton *pCBCourseUp, *pCBNorthUp, *pRBSizeAuto, *pRBSizeManual;
438  int k_tides;
439 
440  // For the Display\Units page
441  wxStaticText *itemStaticTextUserVar;
442  wxStaticText *itemStaticTextUserVar2;
443  wxButton *m_configDeleteButton, *m_configApplyButton;
444 
445  void OnAISRolloverClick(wxCommandEvent &event);
446  void UpdateChartDirList();
447 
448  void OnCanvasConfigSelectClick(int ID, bool selected);
449 
450 
451  bool b_haveWMM;
452  bool b_oldhaveWMM;
453  ColorScheme m_cs;
454 
455  // For "S57" page
456  wxBoxSizer *vectorPanel;
457  wxScrolledWindow *ps57Ctl;
458 
459  OCPNCheckedListCtrl *ps57CtlListBox;
460 
461  wxChoice *pDispCat, *pPointStyle, *pBoundStyle, *p24Color;
462  wxButton *itemButtonClearList, *itemButtonSelectList, *itemButtonSetStd;
463  wxCheckBox *pCheck_SOUNDG, *pCheck_META, *pCheck_SHOWIMPTEXT;
464  wxCheckBox *pCheck_SCAMIN, *pCheck_SuperSCAMIN;
465  wxCheckBox *pCheck_ATONTEXT, *pCheck_LDISTEXT;
466  wxCheckBox *pCheck_XLSECTTEXT, *pCheck_DECLTEXT, *pCheck_NATIONALTEXT;
467  wxCheckBox *pSEnableCM93Offset;
468  wxTextCtrl *m_ShallowCtl, *m_SafetyCtl, *m_DeepCtl;
469  wxStaticText *m_depthUnitsShal, *m_depthUnitsSafe, *m_depthUnitsDeep;
470  int k_vectorcharts;
471 
472  // For "Units" page
473  wxChoice *pSDMMFormat, *pDistanceFormat, *pSpeedFormat, *pDepthUnitSelect,
474  *pTempFormat, *pWindSpeedFormat;
475  wxCheckBox *pCBTrueShow, *pCBMagShow;
476  wxTextCtrl *pMagVar;
477 
478  // For "Charts" page
479  wxStaticBoxSizer *activeSizer;
480  wxBoxSizer *chartPanel;
481  wxTextCtrl *pSelCtl;
482 
483  ArrayOfCDI ActiveChartArray;
484 
485  wxStaticBox *itemActiveChartStaticBox;
486  wxCheckBox *pUpdateCheckBox, *pScanCheckBox;
487  wxButton *pParseENCButton;
488  wxButton *m_removeBtn, *m_compressBtn;
489  wxButton *m_migrateBtn;
490  int k_charts;
491  int m_nCharWidthMax;
492  wxBoxSizer *boxSizerCharts;
493  wxScrolledWindow *m_scrollWinChartList;
494  wxScrolledWindow* chartPanelWin;
495  wxBoxSizer* cmdButtonSizer;
496  wxStaticBox* loadedBox;
497  std::vector<OCPNChartDirPanel *> panelVector;
498  wxArrayString activeChartList;
499 
500  // For the "Charts->Display Options" page
501  wxScrolledWindow *m_ChartDisplayPage;
502 
503  // For the "AIS" page
504  wxCheckBox *m_pCheck_CPA_Max, *m_pCheck_CPA_Warn, *m_pCheck_CPA_WarnT;
505  wxCheckBox *m_pCheck_Mark_Lost, *m_pCheck_Remove_Lost;
506  wxCheckBox *m_pCheck_Show_COG, *m_pCheck_Sync_OCOG_ACOG;
507  wxCheckBox *m_pCheck_Show_Tracks, *m_pCheck_Hide_Moored,
508  *m_pCheck_Scale_Priority;
509  wxCheckBox *m_pCheck_AlertDialog, *m_pCheck_AlertAudio;
510  wxCheckBox *m_pCheck_Alert_Moored, *m_pCheck_Rollover_Class;
511  wxCheckBox *m_pCheck_Rollover_COG, *m_pCheck_Rollover_CPA;
512  wxCheckBox *m_pCheck_Ack_Timout, *m_pCheck_Show_Area_Notices;
513  wxCheckBox *m_pCheck_Draw_Target_Size, *m_pCheck_Draw_Realtime_Prediction;
514  wxCheckBox *m_pCheck_Show_Target_Name;
515  wxChoice *m_pWplAction;
516  wxCheckBox *m_pCheck_use_Wpl, *m_pCheck_ShowAllCPA;
517  wxTextCtrl *m_pText_CPA_Max, *m_pText_CPA_Warn, *m_pText_CPA_WarnT;
518  wxTextCtrl *m_pText_Mark_Lost, *m_pText_Remove_Lost, *m_pText_COG_Predictor;
519  wxTextCtrl *m_pText_Track_Length, *m_pText_Moored_Speed,
520  *m_pText_Scale_Priority;
521  wxTextCtrl *m_pText_ACK_Timeout, *m_pText_Show_Target_Name_Scale;
522  wxTextCtrl *m_pText_RealtPred_Speed;
523 
524  // For Display->Configs page...
525  wxScrolledWindow *m_DisplayConfigsPage;
526 
527  CanvasConfigSelect *m_sconfigSelect_single;
528  CanvasConfigSelect *m_sconfigSelect_twovertical;
529  wxStaticText *m_Text_def_boat_speed;
530 
531  // For Configuration Template panel
532  wxScrolledWindow *m_scrollWinConfigList;
533  wxStaticText *m_templateTitleText;
534  wxStaticText *m_staticTextLastAppled;
535  wxStaticBoxSizer *m_templateStatusBoxSizer;
536 
537  // For the ship page
538  wxFlexGridSizer *realSizes;
539  wxTextCtrl *m_pOSLength, *m_pOSWidth, *m_pOSGPSOffsetX, *m_pOSGPSOffsetY;
540  wxTextCtrl *m_pOSMinSize, *m_pText_ACRadius;
541  wxStaticBoxSizer *dispOptions, *dispWaypointOptions;
542  wxScrolledWindow *itemPanelShip, *itemPanelRoutes;
543  wxBoxSizer *ownShip, *Routes;
544  wxCheckBox *pShowshipToActive;
545  wxChoice *m_shipToActiveStyle, *m_shipToActiveColor;
546 
547  OCPNIconCombo *pWaypointDefaultIconChoice;
548  OCPNIconCombo *pRoutepointDefaultIconChoice;
549  wxCheckBox *pScaMinChckB, *pScaMinOverruleChckB;
550  wxTextCtrl *m_pText_ScaMin;
551 
552  // For the font page
553  wxBoxSizer *m_itemBoxSizerFontPanel;
554  wxChoice *m_itemFontElementListBox, *m_itemStyleListBox, *m_itemLangListBox;
555  wxStaticText *m_textSample;
556  bool m_bVisitLang;
557 
558  // For "AIS Options"
559  wxComboBox *m_itemAISListBox;
560 
561  // For "PlugIns" Panel
562  PluginListPanel *m_pPlugInCtrl;
563  AddPluginPanel *m_AddPluginPanel;
564  CatalogMgrPanel *m_PluginCatalogMgrPanel;
565  wxScrolledWindow *itemPanelPlugins;
566  wxBoxSizer *itemBoxSizerPanelPlugins;
567  wxFlexGridSizer *radarGrid, *waypointradarGrid;
568  wxChoice *pNavAidRadarRingsNumberVisible, *pWaypointRangeRingsNumber;
569  OCPNColourPickerCtrl *m_colourOwnshipRangeRingColour;
570  wxChoice *m_itemRadarRingsUnits, *m_itemWaypointRangeRingsUnits;
571  OCPNColourPickerCtrl *m_colourTrackLineColour;
572  ;
573  wxChoice *pTrackPrecision;
574  wxTextCtrl *pNavAidRadarRingsStep, *pWaypointRangeRingsStep;
575  wxCheckBox *pSogCogFromLLCheckBox;
576  wxSpinCtrl *pSogCogFromLLDampInterval;
577  wxTextCtrl *m_pText_TP_Secs, *m_pText_TP_Dist;
578  wxCheckBox *pWayPointPreventDragging, *pConfirmObjectDeletion;
579  wxCheckBox *pEnableZoomToCursor, *pPreserveScale, *pPlayShipsBells;
580  wxCheckBox *pTransparentToolbar;
581  wxCheckBox *pAdvanceRouteWaypointOnArrivalOnly, *pTrackShowIcon;
582  wxCheckBox *pTrackDaily, *pTrackHighlite;
583  wxStaticText *pStatic_CallSign;
584 
585 #if wxCHECK_VERSION(2, 9, 0)
586 #if wxUSE_TIMEPICKCTRL
587 #ifdef __WXGTK__
588  TimeCtrl *pTrackRotateTime;
589 #else
590  wxTimePickerCtrl *pTrackRotateTime;
591 #endif
592 #endif
593 #endif
594  wxRadioButton *pTrackRotateComputerTime, *pTrackRotateUTC, *pTrackRotateLMT;
595  OCPNColourPickerCtrl *m_colourWaypointRangeRingsColour;
596  wxChoice *pSoundDeviceIndex;
597  wxStaticText *stSoundDeviceIndex;
598 
599  wxArrayPtrVoid OBJLBoxArray;
600  wxString m_init_chart_dir;
601  wxArrayString *m_pSerialArray;
602 
603  ArrayOfCDI m_CurrentDirList, *m_pWorkDirList;
604  MyConfig *m_pConfig;
605  wxWindow *pParent;
606 
607  int k_plugins;
608  bool m_bForceNewToolbaronCancel;
609 
610  // Sounds panel
611 
612  OCPNSoundPanel *m_soundPanelAnchor;
613  OCPNSoundPanel *m_soundPanelAIS;
614  OCPNSoundPanel *m_soundPanelSART;
615  OCPNSoundPanel *m_soundPanelDSC;
616  void OnUXAudioEnableButtonClickAIS(wxCommandEvent &event);
617  void OnUXAudioEnableButtonClickSART(wxCommandEvent &event);
618  void OnUXAudioEnableButtonClickDSC(wxCommandEvent &event);
619 
622  ObsListener m_sound_done_listener;
623 
624 private:
625  void Init(void);
626  void CreatePanel_MMSI(size_t parent, int border_size, int group_item_spacing);
627  void CreatePanel_AIS(size_t parent, int border_size, int group_item_spacing);
628  void CreatePanel_Ownship(size_t parent, int border_size,
629  int group_item_spacing);
630  void CreatePanel_NMEA(size_t parent, int border_size, int group_item_spacing);
631  void CreatePanel_ChartsLoad(size_t parent, int border_size,
632  int group_item_spacing);
633  void CreatePanel_VectorCharts(size_t parent, int border_size,
634  int group_item_spacing);
635  void CreatePanel_TidesCurrents(size_t parent, int border_size,
636  int group_item_spacing);
637  void CreatePanel_ChartGroups(size_t parent, int border_size,
638  int group_item_spacing);
639  void CreatePanel_Display(size_t parent, int border_size,
640  int group_item_spacing);
641  void CreatePanel_UI(size_t parent, int border_size, int group_item_spacing);
642  void CreatePanel_Units(size_t parent, int border_size,
643  int group_item_spacing);
644  void CreatePanel_Sounds(size_t parent, int border_size,
645  int group_item_spacing);
646  void CreatePanel_Advanced(size_t parent, int border_size,
647  int group_item_spacing);
648  void CreatePanel_Configs(size_t parent, int border_size,
649  int group_item_spacing);
650  void CreatePanel_Routes(size_t parent, int border_size,
651  int group_item_spacing);
652 
653  void OnAlertEnableButtonClick(wxCommandEvent &event);
654  void OnAlertAudioEnableButtonClick(wxCommandEvent &event);
655 
656  void UpdateTemplateTitleText();
657  void CheckDeviceAccess(wxString &path);
658  int m_returnChanges;
659  wxListCtrl *tcDataSelected;
660  std::vector<int> marinersStdXref;
661  ChartGroupsUI *groupsPanel;
662  wxImageList *m_topImgList;
663 
664  wxCheckBox* m_persist_active_route_chkbox;
665  wxScrolledWindow *m_pNMEAForm;
666  void resetMarStdList(bool bsetConfig, bool bsetStd);
667 
668  ObservableListener compat_os_listener;
669 
670  int m_screenConfig;
671 
672  wxNotebookPage *m_groupsPage;
673  wxFont *dialogFont;
674  wxFont smallFont;
675  // wxFont *dialogFont;
676  wxSize m_small_button_size;
677 
678  bool m_bcompact;
679  int m_fontHeight, m_scrollRate;
680  bool m_bfontChanged;
681  bool m_bVectorInit;
682 
683  wxBoxSizer *m_boxSizerConfigs;
684  wxColour m_panelBackgroundUnselected;
685  wxString m_selectedConfigPanelGUID;
686  wxSize m_colourPickerDefaultSize;
687 
688  wxSize m_sliderSize;
689  bool m_bneedNew;
690 
691  std::shared_ptr<ConnectionsDialog>comm_dialog;
692 
693  DECLARE_EVENT_TABLE()
694 };
695 
696 class CanvasConfigSelect : public wxPanel {
697 public:
698  CanvasConfigSelect(wxWindow *parent, options *parentOptions, int id,
699  wxBitmap &bmp, const wxPoint &pos = wxDefaultPosition,
700  const wxSize &size = wxDefaultSize);
702 
703  void OnMouseSelected(wxMouseEvent &event);
704  void SetSelected(bool selected);
705  void OnPaint(wxPaintEvent &event);
706 
707  bool GetSelected() { return m_bSelected; }
708 
709 private:
710  options *m_parentOptions;
711  bool m_bSelected;
712  wxColour m_boxColour;
713  wxBitmap m_bmpNormal;
714  int m_borderWidth;
715 
716  DECLARE_EVENT_TABLE()
717 };
718 
719 class ChartGroupsUI : public wxScrolledWindow {
720 public:
721  ChartGroupsUI(wxWindow *parent);
722  ~ChartGroupsUI(void);
723 
724  void CreatePanel(size_t parent, int border_size, int group_item_spacing);
725  void CompletePanel(void);
726  void SetDBDirs(ArrayOfCDI &array) { m_db_dirs = array; }
727  void SetGroupArray(ChartGroupArray *pGroupArray) {
728  m_pGroupArray = pGroupArray;
729  }
730  void SetInitialSettings(void);
731  void CompleteInitialSettings(void);
732  void PopulateTrees(void);
733  void PopulateTreeCtrl(wxTreeCtrl *ptc, const wxArrayString &dir_array,
734  const wxColour &col, wxFont *pFont = NULL);
735  void BuildNotebookPages(ChartGroupArray *pGroupArray);
736  void EmptyChartGroupArray(ChartGroupArray *s);
737  void ClearGroupPages();
738 
739  void OnNodeExpanded(wxTreeEvent &event);
740  void OnAvailableSelection(wxTreeEvent &event);
741  void OnInsertChartItem(wxCommandEvent &event);
742  void OnRemoveChartItem(wxCommandEvent &event);
743  void OnGroupPageChange(wxNotebookEvent &event);
744  void OnNewGroup(wxCommandEvent &event);
745  void OnDeleteGroup(wxCommandEvent &event);
746 
747  ChartGroupArray *CloneChartGroupArray(ChartGroupArray *s);
748  wxTreeCtrl *AddEmptyGroupPage(const wxString &label);
749 
750  bool modified, m_UIcomplete, m_settingscomplete, m_treespopulated;
751 
752  wxScrolledWindow *m_panel;
753 
754 private:
755  int FindGroupBranch(ChartGroup *pGroup, wxTreeCtrl *ptree, wxTreeItemId item,
756  wxString *pbranch_adder);
757 
758  wxWindow *pParent;
759  wxFlexGridSizer *groupsSizer;
760  wxButton *m_pAddButton, *m_pRemoveButton, *m_pNewGroupButton;
761  wxButton *m_pDeleteGroupButton;
762  wxGenericDirCtrl *allAvailableCtl, *defaultAllCtl;
763  wxTreeCtrl *m_pActiveChartsTree, *lastSelectedCtl;
764  wxTreeItemId lastDeletedItem;
765  wxNotebook *m_GroupNB;
766  wxFont *iFont;
767  wxFont *dialogFont;
768 
769  ArrayOfCDI m_db_dirs;
770  ArrayOfDirCtrls m_DirCtrlArray;
771  ChartGroupArray *m_pGroupArray;
772 
773  int m_border_size, m_group_item_spacing, m_GroupSelectedPage;
774 
775  wxBoxSizer *m_topSizer;
776 
777  DECLARE_EVENT_TABLE()
778 };
779 
780 #ifdef ocpnUSE_GL
781 class OpenGLOptionsDlg : private Uncopyable, public wxDialog {
782 public:
783  explicit OpenGLOptionsDlg(wxWindow *parent);
784  bool GetAcceleratedPanning(void) const;
785  bool GetTextureCompression(void) const;
786  bool GetPolygonSmoothing(void) const;
787  bool GetLineSmoothing(void) const;
788  bool GetSoftwareGL(void) const;
789  bool GetTextureCompressionCaching(void) const;
790  bool GetRebuildCache(void) const;
791  int GetTextureMemorySize(void) const;
792 
793 private:
794  void Populate(void);
795  void OnButtonRebuild(wxCommandEvent &event);
796  void OnButtonClear(wxCommandEvent &event);
797  wxString GetTextureCacheSize(void);
798 
799  wxCheckBox *m_cbUseAcceleratedPanning, *m_cbTextureCompression;
800  wxCheckBox *m_cbTextureCompressionCaching, *m_cbSoftwareGL,
801  *m_cbPolygonSmoothing, *m_cbLineSmoothing;
802  wxSpinCtrl *m_sTextureDimension, *m_sTextureMemorySize;
803  wxStaticText *m_cacheSize, *m_memorySize;
804 
805  bool m_brebuild_cache;
806 
807  DECLARE_EVENT_TABLE()
808 };
809 #endif
810 
811 #define ID_MMSI_PROPS_LIST 10073
812 
813 enum {
814  mlMMSI = 0,
815  mlTrackMode,
816  mlIgnore,
817  mlMOB,
818  mlVDM,
819  mlFollower,
820  mlShipName
821 }; // MMSIListCtrl Columns;
822 
823 class MMSIListCtrl : private Uncopyable, public wxListCtrl {
824 public:
825  explicit MMSIListCtrl(wxWindow *parent, wxWindowID id, const wxPoint &pos,
826  const wxSize &size, long style);
827  ~MMSIListCtrl(void);
828 
829  wxString OnGetItemText(long item, long column) const;
830  void OnListItemClick(wxListEvent &event);
831  void OnListItemActivated(wxListEvent &event);
832  void OnListItemRightClick(wxListEvent &event);
833  void PopupMenuHandler(wxCommandEvent &event);
834 
835  wxWindow *m_parent;
836  int m_context_item;
837 
838  DECLARE_EVENT_TABLE()
839 };
840 
841 #define ID_MMSIEDIT_OK 8191
842 #define ID_MMSIEDIT_CANCEL 8192
843 #define ID_MMSI_CTL 8193
844 #define ID_DEF_MENU_MMSI_EDIT 8194
845 #define ID_DEF_MENU_MMSI_DELETE 8195
846 
847 class MMSIEditDialog : private Uncopyable, public wxDialog {
848 public:
849  explicit MMSIEditDialog(MmsiProperties *props, wxWindow *parent,
850  wxWindowID id = wxID_ANY,
851  const wxString &caption = wxEmptyString,
852  const wxPoint &pos = wxDefaultPosition,
853  const wxSize &size = wxDefaultSize, long style = 0);
854  ~MMSIEditDialog(void);
855 
856  void SetColorScheme(ColorScheme cs);
857  void CreateControls(void);
858  void OnMMSIEditCancelClick(wxCommandEvent &event);
859  void OnMMSIEditOKClick(wxCommandEvent &event);
860  void OnCtlUpdated(wxCommandEvent &event);
861 
862  MmsiProperties *m_props;
863  wxTextCtrl *m_MMSICtl, m_ShipNameCtl; // Has ToDo take away?
864  wxRadioButton *m_rbTypeTrackDefault, *m_rbTypeTrackAlways;
865  wxRadioButton *m_rbTypeTrackNever;
866  wxCheckBox *m_cbTrackPersist, *m_IgnoreButton, *m_MOBButton, *m_VDMButton,
867  *m_FollowerButton;
868  wxButton *m_CancelButton, *m_OKButton;
869 
870 private:
871  void Persist();
872 
873  DECLARE_EVENT_TABLE()
874 };
875 
876 class MMSI_Props_Panel : private Uncopyable, public wxPanel {
877 public:
878  explicit MMSI_Props_Panel(wxWindow *parent);
879  ~MMSI_Props_Panel();
880 
881  void OnNewButton(wxCommandEvent &event);
882  void SetColorScheme(ColorScheme cs);
883  void UpdateMMSIList(void);
884 
885  MMSIListCtrl *m_pListCtrlMMSI;
886  wxButton *m_pButtonNew;
887 
888 private:
889  wxWindow *m_pparent;
890 };
891 
892 class ConfigCreateDialog : private Uncopyable, public wxDialog {
893 public:
894  explicit ConfigCreateDialog(wxWindow *parent, wxWindowID id = wxID_ANY,
895  const wxString &caption = wxEmptyString,
896  const wxPoint &pos = wxDefaultPosition,
897  const wxSize &size = wxDefaultSize,
898  long style = 0);
899  ~ConfigCreateDialog(void);
900 
901  void SetColorScheme(ColorScheme cs);
902  void CreateControls(void);
903  void OnConfigEditCancelClick(wxCommandEvent &event);
904  void OnConfigEditOKClick(wxCommandEvent &event);
905  wxString GetCreatedTemplateGUID() { return m_createdTemplateGUID; }
906 
907  wxTextCtrl *m_TitleCtl, *m_DescriptionCtl;
908  wxButton *m_CancelButton, *m_OKButton;
909  wxString m_createdTemplateGUID;
910  DECLARE_EVENT_TABLE()
911 };
912 
913 #endif
914 // _OPTIONS_H_
ConfigCreateDialog(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
Class ConfigCreateDialog.
Definition: options.cpp:803
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
MMSIEditDialog(MmsiProperties *props, wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
Class MMSIEditDialog.
Definition: options.cpp:883
Define an action to be performed when a KeyProvider is notified.
Definition: observable.h:210
Keeps listening over it's lifespan, removes itself on destruction.
Definition: observable.h:133
EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Definition: options.h:621