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};
246
247WX_DEFINE_ARRAY_PTR(wxGenericDirCtrl *, ArrayOfDirCtrls);
248
249class options; // forward
250extern options *g_options;
251
252class MyConfig; // circular
253class OCPNColourPickerCtrl; // circular
254class canvasConfig; // circular
255
256class ChartGroupsUI; // forward
257class MMSI_Props_Panel; // forward
258class CanvasConfigSelect; // forward
259class OCPNCheckedListCtrl; // forward in .cpp file
260class OCPNChartDirPanel; // forward in .cpp file
261class OCPNSoundPanel; // forward in .cpp file
262
264protected:
265 Uncopyable(void) {}
266 ~Uncopyable(void) {}
267
268private:
269 Uncopyable(const Uncopyable &);
270 Uncopyable &operator=(const Uncopyable &);
271};
272
274 std::function<void(options *, int)> prepare_close;
275 std::function<void(int, ArrayOfCDI *)> process_dialog;
276 OptionsCallbacks() : prepare_close(nullptr), process_dialog(nullptr) {}
277};
278
279class options : public wxDialog {
280public:
281 explicit options(wxWindow *parent, OptionsCallbacks callbacks,
282 wxWindowID id = SYMBOL_OPTIONS_IDNAME,
283 const wxString &caption = SYMBOL_OPTIONS_TITLE,
284 const wxPoint &pos = SYMBOL_OPTIONS_POSITION,
285 const wxSize &size = SYMBOL_OPTIONS_SIZE,
286 long style = SYMBOL_OPTIONS_STYLE);
287 options(const options &) = delete;
288 options &operator=(const options &) = delete;
289
290 ~options(void);
291 bool SendIdleEvents(wxIdleEvent &event);
292 void SetInitialPage(int page_sel, int sub_page = -1);
293 void Finish(void);
294
295 void OnClose(wxCloseEvent &event);
296
297 void ShowOKButtons(bool _show) { m_OK_Cancel_Apply_buttons->Show(_show); }
298
299 void CreateListbookIcons();
300 void CreateControls(void);
301 size_t CreatePanel(const wxString &title);
302 wxScrolledWindow *AddPage(size_t parent, const wxString &title);
303 bool DeletePluginPage(wxScrolledWindow *page);
304 void SetColorScheme(ColorScheme cs);
305 void RecalculateSize(int hint_x, int hint_y);
306
307 void SetInitChartDir(const wxString &dir) { m_init_chart_dir = dir; }
308 void SetInitialSettings(void);
309 void SetInitialVectorSettings(void);
310
311 void SetCurrentDirList(ArrayOfCDI p) { m_CurrentDirList = p; }
312 void SetWorkDirListPtr(ArrayOfCDI *p) { m_pWorkDirList = p; }
313 ArrayOfCDI *GetWorkDirListPtr(void) { return m_pWorkDirList; }
314
315 void AddChartDir(const wxString &dir);
316
317 void UpdateDisplayedChartDirList(ArrayOfCDI p);
318 void UpdateOptionsUnits(void);
319
320 void SetConfigPtr(MyConfig *p) { m_pConfig = p; }
321 void OnDebugcheckbox1Click(wxCommandEvent &event);
322 void OnDirctrlSelChanged(wxTreeEvent &event);
323 void OnButtonaddClick(wxCommandEvent &event);
324 void OnButtondeleteClick(wxCommandEvent &event);
325 void OnButtonParseENC(wxCommandEvent &event);
326 void OnButtonRebuildChartDb(wxCommandEvent &event);
327 void OnButtoncompressClick(wxCommandEvent &event);
328 void OnButtonmigrateClick(wxCommandEvent &event);
329 void OnButtonEcdisHelp(wxCommandEvent &event);
330 void OnRadioboxSelected(wxCommandEvent &event);
331 void OnApplyClick(wxCommandEvent &event);
332 void OnXidOkClick(wxCommandEvent &event);
333 void OnCancelClick(wxCommandEvent &event);
334 void OnChooseFont(wxCommandEvent &event);
335 void OnFontChoice(wxCommandEvent &event);
336 void OnCPAWarnClick(wxCommandEvent &event);
337 void OnSyncCogPredClick(wxCommandEvent &event);
338 void OnSizeAutoButton(wxCommandEvent &event);
339 void OnSizeManualButton(wxCommandEvent &event);
340
341#if defined(__WXGTK__) || defined(__WXQT__)
342 void OnChooseFontColor(wxCommandEvent &event);
343#endif
344 void OnGLClicked(wxCommandEvent &event);
345 void OnOpenGLOptions(wxCommandEvent &event);
346 void OnDisplayCategoryRadioButton(wxCommandEvent &event);
347 void OnButtonClearClick(wxCommandEvent &event);
348 void OnButtonSelectClick(wxCommandEvent &event);
349 void OnButtonSetStd(wxCommandEvent &event);
350
351 void OnPageChange(wxListbookEvent &event);
352 void OnTopNBPageChange(wxNotebookEvent &event);
353 void OnSubNBPageChange(wxNotebookEvent &event);
354 void DoOnPageChange(size_t page);
355
356 wxString SelectSoundFile();
357 void OnButtonSelectSound(wxCommandEvent &event);
358 void OnButtonTestSound(wxCommandEvent &event);
359
360 void OnShowGpsWindowCheckboxClick(wxCommandEvent &event);
361 void OnZTCCheckboxClick(wxCommandEvent &event);
362 void OnRadarringSelect(wxCommandEvent &event);
363 void OnWaypointRangeRingSelect(wxCommandEvent &event);
364 void OnShipTypeSelect(wxCommandEvent &event);
365 void OnButtonGroups(wxCommandEvent &event);
366 void OnInsertTideDataLocation(wxCommandEvent &event);
367 void OnRemoveTideDataLocation(wxCommandEvent &event);
368 void OnCharHook(wxKeyEvent &event);
369 void OnChartsPageChange(wxListbookEvent &event);
370 void OnChartDirListSelect(wxCommandEvent &event);
371 void OnUnitsChoice(wxCommandEvent &event);
372
373 void UpdateWorkArrayFromDisplayPanel(void);
374 ArrayOfCDI GetSelectedChartDirs();
375 ArrayOfCDI GetUnSelectedChartDirs();
376 void SetDirActionButtons();
377
378 void OnCreateConfig(wxCommandEvent &event);
379 void OnEditConfig(wxCommandEvent &event);
380 void OnDeleteConfig(wxCommandEvent &event);
381 void OnApplyConfig(wxCommandEvent &event);
382 void SetConfigButtonState();
383 void ClearConfigList();
384 void BuildConfigList();
385 void OnConfigMouseSelected(wxMouseEvent &event);
386 void OnDialogInit(wxInitDialogEvent &event);
387
388 bool GetNeedNew() { return m_bneedNew; }
389 void SetNeedNew(bool bnew) { m_bneedNew = bnew; }
390 int GetScrollRate() { return m_scrollRate; }
391 void SetForceNewToolbarOnCancel(bool val) {
392 m_bForceNewToolbaronCancel = val;
393 }
394
395 wxArrayString *GetSerialArray() { return m_pSerialArray; }
396 void OptionsFinalizeChartDBUpdate();
397
398 // Should we show tooltips?
399 static bool ShowToolTips(void);
400
401#ifdef OCPN_OPTIONS_USE_LISTBOOK
402 wxListbook *m_pListbook;
403#else
404 wxNotebook *m_pListbook;
405#endif
406
407 wxBoxSizer *m_OK_Cancel_Apply_buttons;
408
409 size_t m_pageDisplay, m_pageConnections, m_pageCharts, m_pageShips;
410 size_t m_pageUI, m_pagePlugins;
411 int lastPage, lastSubPage;
412 wxPoint lastWindowPos;
413 wxSize lastWindowSize;
414 wxButton *m_ApplyButton, *m_OKButton, *m_CancelButton;
415
416 ChartGroupArray *m_pGroupArray;
417 int m_groups_changed;
418
419 // Sizer flags
420 wxSizerFlags inputFlags, verticleInputFlags, labelFlags, groupInputFlags;
421 wxSizerFlags groupLabelFlags, groupLabelFlagsHoriz;
422
423 // For general options
424 wxScrolledWindow *pDisplayPanel;
425 wxCheckBox *pShowStatusBar, *pShowMenuBar, *pShowChartBar, *pShowCompassWin;
426 wxCheckBox *pPrintShowIcon, *pCDOOutlines, *pSDepthUnits, *pSDisplayGrid;
427 wxCheckBox *pAutoAnchorMark, *pCDOQuilting, *pCBRaster, *pCBVector;
428 wxCheckBox *pCBCM93, *pCBLookAhead, *pSkewComp, *pOpenGL, *pSmoothPanZoom;
429 wxCheckBox *pFullScreenQuilt, *pMobile, *pResponsive, *pOverzoomEmphasis;
430 wxCheckBox *pOZScaleVector, *pToolbarAutoHideCB, *pInlandEcdis, *pRollover;
431 wxCheckBox *pZoomButtons, *pChartBarEX;
432 wxTextCtrl *pCOGUPUpdateSecs, *m_pText_OSCOG_Predictor, *pScreenMM;
433 wxTextCtrl *pToolbarHideSecs, *m_pText_OSHDT_Predictor, *m_pTxt_OwnMMSI;
434 // Radio buttons to control the date/time format.
435 // In the future, other date/time formats may be added here. For example:
436 // 1. Local Mean Time (LMT) at the location.
437 // 2. Custom timezone, such as for route planning purpose.
438
441 wxRadioButton *pTimezoneLocalTime;
443 wxRadioButton *pTimezoneUTC;
444 wxTextCtrl *pCmdSoundString;
445
446 wxChoice *m_pShipIconType, *m_pcTCDatasets;
447 wxSlider *m_pSlider_Zoom_Raster, *m_pSlider_GUI_Factor,
448 *m_pSlider_Chart_Factor, *m_pSlider_Ship_Factor, *m_pSlider_Text_Factor,
449 *m_pSlider_ENCText_Factor;
450 wxSlider *m_pMouse_Zoom_Slider;
451 wxSlider *m_pSlider_Zoom_Vector;
452 wxSlider *m_pSlider_CM93_Zoom;
453 // LIVE ETA OPTION
454 wxCheckBox *pSLiveETA;
455 wxTextCtrl *pSDefaultBoatSpeed;
456
457 wxRadioButton *pCBCourseUp, *pCBNorthUp, *pRBSizeAuto, *pRBSizeManual;
458
459 // For the Display\Units page
460 wxStaticText *itemStaticTextUserVar;
461 wxStaticText *itemStaticTextUserVar2;
462 wxButton *m_configDeleteButton, *m_configApplyButton;
463
464 void OnAISRolloverClick(wxCommandEvent &event);
465 void UpdateChartDirList();
466
467 void OnCanvasConfigSelectClick(int ID, bool selected);
468
469 bool b_haveWMM;
470 bool b_oldhaveWMM;
471 ColorScheme m_cs;
472
473 // For "S57" page
474 wxBoxSizer *vectorPanel;
475 wxScrolledWindow *ps57Ctl;
476
477 OCPNCheckedListCtrl *ps57CtlListBox;
478
479 wxChoice *pDispCat, *pPointStyle, *pBoundStyle, *p24Color;
480 wxButton *itemButtonClearList, *itemButtonSelectList, *itemButtonSetStd;
481 wxCheckBox *pCheck_SOUNDG, *pCheck_META, *pCheck_SHOWIMPTEXT;
482 wxCheckBox *pCheck_SCAMIN, *pCheck_SuperSCAMIN;
483 wxCheckBox *pCheck_ATONTEXT, *pCheck_LDISTEXT;
484 wxCheckBox *pCheck_XLSECTTEXT, *pCheck_DECLTEXT, *pCheck_NATIONALTEXT;
485 wxCheckBox *pSEnableCM93Offset;
486 wxTextCtrl *m_ShallowCtl, *m_SafetyCtl, *m_DeepCtl;
487 wxStaticText *m_depthUnitsShal, *m_depthUnitsSafe, *m_depthUnitsDeep;
488 int k_vectorcharts;
489
490 // For "Units" page
491 wxChoice *pSDMMFormat, *pDistanceFormat, *pSpeedFormat, *pDepthUnitSelect,
492 *pTempFormat, *pWindSpeedFormat, *pHeightUnitSelect;
493 wxCheckBox *pCBTrueShow, *pCBMagShow;
494 wxTextCtrl *pMagVar;
495
496 // For "Charts" page
497 wxStaticBoxSizer *activeSizer;
498 wxBoxSizer *chartPanel;
499 wxTextCtrl *pSelCtl;
500
501 ArrayOfCDI ActiveChartArray;
502
503 wxStaticBox *itemActiveChartStaticBox;
504 wxCheckBox *pUpdateCheckBox, *pScanCheckBox;
505 wxButton *pParseENCButton, *pRebuildChartDatabase;
506 wxButton *m_removeBtn, *m_compressBtn;
507 wxButton *m_migrateBtn;
508 int k_charts;
509 int m_nCharWidthMax;
510 wxBoxSizer *boxSizerCharts;
511 wxScrolledWindow *m_scrollWinChartList;
512 wxScrolledWindow *chartPanelWin;
513 wxBoxSizer *cmdButtonSizer;
514 wxStaticBox *loadedBox;
515 std::vector<OCPNChartDirPanel *> panelVector;
516 wxArrayString activeChartList;
517
518 // For the "Charts->Display Options" page
519 wxScrolledWindow *m_ChartDisplayPage;
520
521 // For the "AIS" page
522 wxCheckBox *m_pCheck_CPA_Max, *m_pCheck_CPA_Warn, *m_pCheck_CPA_WarnT;
523 wxCheckBox *m_pCheck_Mark_Lost, *m_pCheck_Remove_Lost;
524 wxCheckBox *m_pCheck_Show_COG, *m_pCheck_Sync_OCOG_ACOG;
525 wxCheckBox *m_pCheck_Show_Tracks, *m_pCheck_Hide_Moored,
526 *m_pCheck_Scale_Priority;
527 wxCheckBox *m_pCheck_AlertDialog, *m_pCheck_AlertAudio;
528 wxCheckBox *m_pCheck_Alert_Moored, *m_pCheck_Rollover_Class;
529 wxCheckBox *m_pCheck_Rollover_COG, *m_pCheck_Rollover_CPA;
530 wxCheckBox *m_pCheck_Ack_Timout, *m_pCheck_Show_Area_Notices;
531 wxCheckBox *m_pCheck_Draw_Target_Size, *m_pCheck_Draw_Realtime_Prediction;
532 wxCheckBox *m_pCheck_Show_Target_Name;
533 wxChoice *m_pWplAction;
534 wxCheckBox *m_pCheck_use_Wpl, *m_pCheck_ShowAllCPA;
535 wxTextCtrl *m_pText_CPA_Max, *m_pText_CPA_Warn, *m_pText_CPA_WarnT;
536 wxTextCtrl *m_pText_Mark_Lost, *m_pText_Remove_Lost, *m_pText_COG_Predictor;
537 wxTextCtrl *m_pText_Track_Length, *m_pText_Moored_Speed,
538 *m_pText_Scale_Priority;
539 wxTextCtrl *m_pText_ACK_Timeout, *m_pText_Show_Target_Name_Scale;
540 wxTextCtrl *m_pText_RealtPred_Speed;
541
542 // For Display->Configs page...
543 wxScrolledWindow *m_DisplayConfigsPage;
544
545 CanvasConfigSelect *m_sconfigSelect_single;
546 CanvasConfigSelect *m_sconfigSelect_twovertical;
547 wxStaticText *m_Text_def_boat_speed;
548
549 // For Configuration Template panel
550 wxScrolledWindow *m_scrollWinConfigList;
551 wxStaticText *m_templateTitleText;
552 wxStaticText *m_staticTextLastAppled;
553 wxStaticBoxSizer *m_templateStatusBoxSizer;
554
555 // For the ship page
556 wxFlexGridSizer *realSizes;
557 wxTextCtrl *m_pOSLength, *m_pOSWidth, *m_pOSGPSOffsetX, *m_pOSGPSOffsetY;
558 wxTextCtrl *m_pOSMinSize, *m_pText_ACRadius;
559 wxStaticBoxSizer *dispOptions, *dispWaypointOptions;
560 wxScrolledWindow *itemPanelShip, *itemPanelRoutes;
561 wxBoxSizer *ownShip, *Routes;
562 wxCheckBox *pShowshipToActive;
563 wxChoice *m_shipToActiveStyle, *m_shipToActiveColor;
564
565 OCPNIconCombo *pWaypointDefaultIconChoice;
566 OCPNIconCombo *pRoutepointDefaultIconChoice;
567 wxCheckBox *pScaMinChckB, *pScaMinOverruleChckB;
568 wxTextCtrl *m_pText_ScaMin;
569 wxTextCtrl *m_pText_ScaMax;
570
571 // For the font page
572 wxBoxSizer *m_itemBoxSizerFontPanel;
573 wxChoice *m_itemFontElementListBox, *m_itemStyleListBox, *m_itemLangListBox;
574 wxStaticText *m_textSample;
575 bool m_bVisitLang;
576 bool m_bVisitPlugins;
577
578 // For "AIS Options"
579 wxComboBox *m_itemAISListBox;
580
581 // For "PlugIns" Panel
582 PluginListPanel *m_pPlugInCtrl;
583 AddPluginPanel *m_AddPluginPanel;
584 CatalogMgrPanel *m_PluginCatalogMgrPanel;
585 wxScrolledWindow *itemPanelPlugins;
586 wxBoxSizer *itemBoxSizerPanelPlugins;
587 wxFlexGridSizer *radarGrid, *waypointradarGrid;
588 wxChoice *pNavAidRadarRingsNumberVisible, *pWaypointRangeRingsNumber;
589 OCPNColourPickerCtrl *m_colourOwnshipRangeRingColour;
590 wxChoice *m_itemRadarRingsUnits, *m_itemWaypointRangeRingsUnits;
591 OCPNColourPickerCtrl *m_colourTrackLineColour;
592 ;
593 wxChoice *pTrackPrecision;
594 wxTextCtrl *pNavAidRadarRingsStep, *pWaypointRangeRingsStep;
595 wxTextCtrl *m_pText_TP_Secs, *m_pText_TP_Dist;
596 wxCheckBox *pWayPointPreventDragging, *pConfirmObjectDeletion;
597 wxCheckBox *pEnableZoomToCursor, *pPreserveScale, *pPlayShipsBells;
598 wxCheckBox *pEnableTenHertz, *pTransparentToolbar;
599 wxCheckBox *pAdvanceRouteWaypointOnArrivalOnly, *pTrackShowIcon;
600 wxCheckBox *pTrackDaily, *pTrackHighlite;
601 wxStaticText *pStatic_CallSign;
602
603#if wxCHECK_VERSION(2, 9, 0)
604#if wxUSE_TIMEPICKCTRL
605#ifdef __WXGTK__
606 TimeCtrl *pTrackRotateTime;
607#else
608 wxTimePickerCtrl *pTrackRotateTime;
609#endif
610#endif
611#endif
612 wxRadioButton *pTrackRotateComputerTime, *pTrackRotateUTC, *pTrackRotateLMT;
613 OCPNColourPickerCtrl *m_colourWaypointRangeRingsColour;
614 wxChoice *pSoundDeviceIndex;
615 wxStaticText *stSoundDeviceIndex;
616
617 wxArrayPtrVoid OBJLBoxArray;
618 wxString m_init_chart_dir;
619 wxArrayString *m_pSerialArray;
620
621 ArrayOfCDI m_CurrentDirList, *m_pWorkDirList;
622 MyConfig *m_pConfig;
623 wxWindow *pParent;
624
625 int k_plugins;
626 bool m_bForceNewToolbaronCancel;
627
628 // Sounds panel
629
630 OCPNSoundPanel *m_soundPanelAnchor;
631 OCPNSoundPanel *m_soundPanelAIS;
632 OCPNSoundPanel *m_soundPanelSART;
633 OCPNSoundPanel *m_soundPanelDSC;
634 void OnUXAudioEnableButtonClickAIS(wxCommandEvent &event);
635 void OnUXAudioEnableButtonClickSART(wxCommandEvent &event);
636 void OnUXAudioEnableButtonClickDSC(wxCommandEvent &event);
637
640 ObsListener m_sound_done_listener;
641 wxGenericProgressDialog *m_pCBDSprog;
642 void DoDBSUpdate(bool force_full);
643 bool m_bTextureCacheingSave;
644
645private:
646 void Init(void);
647 void CreatePanel_MMSI(size_t parent, int border_size, int group_item_spacing);
648 void CreatePanel_AIS(size_t parent, int border_size, int group_item_spacing);
649 void CreatePanel_Ownship(size_t parent, int border_size,
650 int group_item_spacing);
651 void CreatePanel_NMEA(size_t parent, int border_size, int group_item_spacing);
652 void CreatePanel_ChartsLoad(size_t parent, int border_size,
653 int group_item_spacing);
654 void CreatePanel_VectorCharts(size_t parent, int border_size,
655 int group_item_spacing);
656 void CreatePanel_TidesCurrents(size_t parent, int border_size,
657 int group_item_spacing);
658 void CreatePanel_ChartGroups(size_t parent, int border_size,
659 int group_item_spacing);
660 void CreatePanel_Display(size_t parent, int border_size,
661 int group_item_spacing);
662 void CreatePanel_UI(size_t parent, int border_size, int group_item_spacing);
663 void CreatePanel_Units(size_t parent, int border_size,
664 int group_item_spacing);
665 void CreatePanel_Sounds(size_t parent, int border_size,
666 int group_item_spacing);
667 void CreatePanel_Advanced(size_t parent, int border_size,
668 int group_item_spacing);
669 void CreatePanel_Configs(size_t parent, int border_size,
670 int group_item_spacing);
671 void CreatePanel_Routes(size_t parent, int border_size,
672 int group_item_spacing);
673
674 void OnAlertEnableButtonClick(wxCommandEvent &event);
675 void OnAlertAudioEnableButtonClick(wxCommandEvent &event);
676 void OnResetFont(wxCommandEvent &event);
677
678 void UpdateTemplateTitleText();
679 void CheckDeviceAccess(wxString &path);
680
681 OptionsCallbacks m_callbacks;
682 int m_returnChanges;
683 wxListCtrl *tcDataSelected;
684 std::vector<int> marinersStdXref;
685 ChartGroupsUI *groupsPanel;
686 wxImageList *m_topImgList;
687
688 wxCheckBox *m_persist_active_route_chkbox;
689 wxScrolledWindow *m_pNMEAForm;
690 void resetMarStdList(bool bsetConfig, bool bsetStd);
691
692 ObservableListener compat_os_listener;
693 void ApplyChanges(wxCommandEvent &event);
694
695 unsigned int m_screenConfig;
696
697 wxNotebookPage *m_groupsPage;
698 wxFont *dialogFont;
699 wxFont smallFont;
700 // wxFont *dialogFont;
701 wxSize m_small_button_size;
702
703 bool m_bcompact;
704 int m_fontHeight, m_scrollRate;
705 bool m_bfontChanged;
706 wxArrayString m_font_element_array;
707
708 bool m_bVectorInit;
709
710 wxBoxSizer *m_boxSizerConfigs;
711 wxColour m_panelBackgroundUnselected;
712 wxString m_selectedConfigPanelGUID;
713 wxSize m_colourPickerDefaultSize;
714
715 wxSize m_sliderSize;
716 bool m_bneedNew;
717 ObsListener m_OnChartDb_finalize_listener;
718 std::shared_ptr<ConnectionsDlg> comm_dialog;
719
720 DECLARE_EVENT_TABLE()
721};
722
723class CanvasConfigSelect : public wxPanel {
724public:
725 CanvasConfigSelect(wxWindow *parent, options *parentOptions, int id,
726 wxBitmap &bmp, const wxPoint &pos = wxDefaultPosition,
727 const wxSize &size = wxDefaultSize);
729
730 void OnMouseSelected(wxMouseEvent &event);
731 void SetSelected(bool selected);
732 void OnPaint(wxPaintEvent &event);
733
734 bool GetSelected() { return m_bSelected; }
735
736private:
737 options *m_parentOptions;
738 bool m_bSelected;
739 wxColour m_boxColour;
740 wxBitmap m_bmpNormal;
741 int m_borderWidth;
742
743 DECLARE_EVENT_TABLE()
744};
745
746class ChartGroupsUI : public wxScrolledWindow {
747public:
748 ChartGroupsUI(wxWindow *parent);
749 ~ChartGroupsUI(void);
750
751 void CreatePanel(size_t parent, int border_size, int group_item_spacing);
752 void CompletePanel(void);
753 void SetDBDirs(ArrayOfCDI &array) { m_db_dirs = array; }
754 void SetGroupArray(ChartGroupArray *pGroupArray) {
755 m_pGroupArray = pGroupArray;
756 }
757 void SetInitialSettings(void);
758 void CompleteInitialSettings(void);
759 void PopulateTrees(void);
760 void PopulateTreeCtrl(wxTreeCtrl *ptc, const wxArrayString &dir_array,
761 const wxColour &col, wxFont *pFont = NULL);
762 void BuildNotebookPages(ChartGroupArray *pGroupArray);
763 void EmptyChartGroupArray(ChartGroupArray *s);
764 void ClearGroupPages();
765
766 void OnNodeExpanded(wxTreeEvent &event);
767 void OnAvailableSelection(wxTreeEvent &event);
768 void OnInsertChartItem(wxCommandEvent &event);
769 void OnRemoveChartItem(wxCommandEvent &event);
770 void OnGroupPageChange(wxNotebookEvent &event);
771 void OnNewGroup(wxCommandEvent &event);
772 void OnDeleteGroup(wxCommandEvent &event);
773
774 ChartGroupArray *CloneChartGroupArray(ChartGroupArray *s);
775 wxTreeCtrl *AddEmptyGroupPage(const wxString &label);
776
777 bool modified, m_UIcomplete, m_settingscomplete, m_treespopulated;
778
779 wxScrolledWindow *m_panel;
780
781private:
782 int FindGroupBranch(ChartGroup *pGroup, wxTreeCtrl *ptree, wxTreeItemId item,
783 wxString *pbranch_adder);
784
785 wxWindow *pParent;
786 wxFlexGridSizer *groupsSizer;
787 wxButton *m_pAddButton, *m_pRemoveButton, *m_pNewGroupButton;
788 wxButton *m_pDeleteGroupButton;
789 wxGenericDirCtrl *allAvailableCtl, *defaultAllCtl;
790 wxTreeCtrl *m_pActiveChartsTree, *lastSelectedCtl;
791 wxTreeItemId lastDeletedItem;
792 wxNotebook *m_GroupNB;
793 wxFont *iFont;
794 wxFont *dialogFont;
795
796 ArrayOfCDI m_db_dirs;
797 ArrayOfDirCtrls m_DirCtrlArray;
798 ChartGroupArray *m_pGroupArray;
799
800 int m_border_size, m_group_item_spacing, m_GroupSelectedPage;
801
802 wxBoxSizer *m_topSizer;
803
804 DECLARE_EVENT_TABLE()
805};
806
807#ifdef ocpnUSE_GL
808class OpenGLOptionsDlg : private Uncopyable, public wxDialog {
809public:
810 explicit OpenGLOptionsDlg(wxWindow *parent);
811 bool GetAcceleratedPanning(void) const;
812 bool GetTextureCompression(void) const;
813 bool GetPolygonSmoothing(void) const;
814 bool GetLineSmoothing(void) const;
815 bool GetSoftwareGL(void) const;
816 bool GetTextureCompressionCaching(void) const;
817 bool GetRebuildCache(void) const;
818 int GetTextureMemorySize(void) const;
819
820private:
821 void Populate(void);
822 void OnButtonRebuild(wxCommandEvent &event);
823 void OnButtonClear(wxCommandEvent &event);
824 wxString GetTextureCacheSize(void);
825
826 wxCheckBox *m_cbUseAcceleratedPanning, *m_cbTextureCompression;
827 wxCheckBox *m_cbTextureCompressionCaching, *m_cbSoftwareGL,
828 *m_cbPolygonSmoothing, *m_cbLineSmoothing;
829 wxSpinCtrl *m_sTextureDimension, *m_sTextureMemorySize;
830 wxStaticText *m_cacheSize, *m_memorySize;
831
832 bool m_brebuild_cache;
833
834 DECLARE_EVENT_TABLE()
835};
836#endif
837
838#define ID_MMSI_PROPS_LIST 10073
839
840enum {
841 mlMMSI = 0,
842 mlTrackMode,
843 mlIgnore,
844 mlMOB,
845 mlVDM,
846 mlFollower,
847 mlShipName
848}; // MMSIListCtrl Columns;
849
850class MMSIListCtrl : private Uncopyable, public wxListCtrl {
851public:
852 explicit MMSIListCtrl(wxWindow *parent, wxWindowID id, const wxPoint &pos,
853 const wxSize &size, long style);
854 ~MMSIListCtrl(void);
855
856 wxString OnGetItemText(long item, long column) const;
857 void OnListItemClick(wxListEvent &event);
858 void OnListItemActivated(wxListEvent &event);
859 void OnListItemRightClick(wxListEvent &event);
860 void PopupMenuHandler(wxCommandEvent &event);
861
862 wxWindow *m_parent;
863 int m_context_item;
864
865 DECLARE_EVENT_TABLE()
866};
867
868#define ID_MMSIEDIT_OK 8191
869#define ID_MMSIEDIT_CANCEL 8192
870#define ID_MMSI_CTL 8193
871#define ID_DEF_MENU_MMSI_EDIT 8194
872#define ID_DEF_MENU_MMSI_DELETE 8195
873
874class MMSIEditDialog : private Uncopyable, public wxDialog {
875public:
876 explicit MMSIEditDialog(MmsiProperties *props, wxWindow *parent,
877 wxWindowID id = wxID_ANY,
878 const wxString &caption = wxEmptyString,
879 const wxPoint &pos = wxDefaultPosition,
880 const wxSize &size = wxDefaultSize, long style = 0);
881 ~MMSIEditDialog(void);
882
883 void SetColorScheme(ColorScheme cs);
884 void CreateControls(void);
885 void OnMMSIEditCancelClick(wxCommandEvent &event);
886 void OnMMSIEditOKClick(wxCommandEvent &event);
887 void OnCtlUpdated(wxCommandEvent &event);
888 void OnMMSIChanged(wxCommandEvent &event);
889
890 MmsiProperties *m_props;
891 wxTextCtrl *m_MMSICtl, *m_ShipNameCtl; // Has ToDo take away?
892 wxRadioButton *m_rbTypeTrackDefault, *m_rbTypeTrackAlways;
893 wxRadioButton *m_rbTypeTrackNever;
894 wxCheckBox *m_cbTrackPersist, *m_IgnoreButton, *m_MOBButton, *m_VDMButton,
895 *m_FollowerButton;
896 wxButton *m_CancelButton, *m_OKButton;
897
898private:
899 void Persist();
900
901 DECLARE_EVENT_TABLE()
902};
903
904class MMSI_Props_Panel : private Uncopyable, public wxPanel {
905public:
906 explicit MMSI_Props_Panel(wxWindow *parent);
908
909 void OnNewButton(wxCommandEvent &event);
910 void SetColorScheme(ColorScheme cs);
911 void UpdateMMSIList(void);
912
913 MMSIListCtrl *m_pListCtrlMMSI;
914 wxButton *m_pButtonNew;
915
916private:
917 wxWindow *m_pparent;
918};
919
920class ConfigCreateDialog : private Uncopyable, public wxDialog {
921public:
922 explicit ConfigCreateDialog(wxWindow *parent, wxWindowID id = wxID_ANY,
923 const wxString &caption = wxEmptyString,
924 const wxPoint &pos = wxDefaultPosition,
925 const wxSize &size = wxDefaultSize,
926 long style = 0);
928
929 void SetColorScheme(ColorScheme cs);
930 void CreateControls(void);
931 void OnConfigEditCancelClick(wxCommandEvent &event);
932 void OnConfigEditOKClick(wxCommandEvent &event);
933 wxString GetCreatedTemplateGUID() { return m_createdTemplateGUID; }
934
935 wxTextCtrl *m_TitleCtl, *m_DescriptionCtl;
936 wxButton *m_CancelButton, *m_OKButton;
937 wxString m_createdTemplateGUID;
938 DECLARE_EVENT_TABLE()
939};
940
941#endif
942// _OPTIONS_H_
Class AisDecoder and helpers.
Basic chart info storage.
Represents a user-defined collection of logically related charts.
Definition chartdbs.h:485
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
Process incoming AIS messages.
Definition ais_decoder.h:74
Custom combobox for selecting waypoint icons.
Definition mark_info.h:149
Define an action to be performed when a KeyProvider is notified.
Definition observable.h:257
Keeps listening over its lifespan, removes itself on destruction.
Definition observable.h:155
Encapsulates persistent canvas configuration.
wxRadioButton * pTimezoneUTC
Specify date/time should be formatted in UTC.
Definition options.h:443
EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Definition options.h:639
wxRadioButton * pTimezoneLocalTime
Specify date/time should be formatted in timezone as configured in the operating system.
Definition options.h:441
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.