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