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 wxCheckBox *pSogCogFromLLCheckBox;
596 wxSpinCtrl *pSogCogFromLLDampInterval;
597 wxTextCtrl *m_pText_TP_Secs, *m_pText_TP_Dist;
598 wxCheckBox *pWayPointPreventDragging, *pConfirmObjectDeletion;
599 wxCheckBox *pEnableZoomToCursor, *pPreserveScale, *pPlayShipsBells;
600 wxCheckBox *pEnableTenHertz, *pTransparentToolbar;
601 wxCheckBox *pAdvanceRouteWaypointOnArrivalOnly, *pTrackShowIcon;
602 wxCheckBox *pTrackDaily, *pTrackHighlite;
603 wxStaticText *pStatic_CallSign;
604
605#if wxCHECK_VERSION(2, 9, 0)
606#if wxUSE_TIMEPICKCTRL
607#ifdef __WXGTK__
608 TimeCtrl *pTrackRotateTime;
609#else
610 wxTimePickerCtrl *pTrackRotateTime;
611#endif
612#endif
613#endif
614 wxRadioButton *pTrackRotateComputerTime, *pTrackRotateUTC, *pTrackRotateLMT;
615 OCPNColourPickerCtrl *m_colourWaypointRangeRingsColour;
616 wxChoice *pSoundDeviceIndex;
617 wxStaticText *stSoundDeviceIndex;
618
619 wxArrayPtrVoid OBJLBoxArray;
620 wxString m_init_chart_dir;
621 wxArrayString *m_pSerialArray;
622
623 ArrayOfCDI m_CurrentDirList, *m_pWorkDirList;
624 MyConfig *m_pConfig;
625 wxWindow *pParent;
626
627 int k_plugins;
628 bool m_bForceNewToolbaronCancel;
629
630 // Sounds panel
631
632 OCPNSoundPanel *m_soundPanelAnchor;
633 OCPNSoundPanel *m_soundPanelAIS;
634 OCPNSoundPanel *m_soundPanelSART;
635 OCPNSoundPanel *m_soundPanelDSC;
636 void OnUXAudioEnableButtonClickAIS(wxCommandEvent &event);
637 void OnUXAudioEnableButtonClickSART(wxCommandEvent &event);
638 void OnUXAudioEnableButtonClickDSC(wxCommandEvent &event);
639
642 ObsListener m_sound_done_listener;
643 wxGenericProgressDialog *m_pCBDSprog;
644 void DoDBSUpdate(bool force_full);
645 bool m_bTextureCacheingSave;
646
647private:
648 void Init(void);
649 void CreatePanel_MMSI(size_t parent, int border_size, int group_item_spacing);
650 void CreatePanel_AIS(size_t parent, int border_size, int group_item_spacing);
651 void CreatePanel_Ownship(size_t parent, int border_size,
652 int group_item_spacing);
653 void CreatePanel_NMEA(size_t parent, int border_size, int group_item_spacing);
654 void CreatePanel_ChartsLoad(size_t parent, int border_size,
655 int group_item_spacing);
656 void CreatePanel_VectorCharts(size_t parent, int border_size,
657 int group_item_spacing);
658 void CreatePanel_TidesCurrents(size_t parent, int border_size,
659 int group_item_spacing);
660 void CreatePanel_ChartGroups(size_t parent, int border_size,
661 int group_item_spacing);
662 void CreatePanel_Display(size_t parent, int border_size,
663 int group_item_spacing);
664 void CreatePanel_UI(size_t parent, int border_size, int group_item_spacing);
665 void CreatePanel_Units(size_t parent, int border_size,
666 int group_item_spacing);
667 void CreatePanel_Sounds(size_t parent, int border_size,
668 int group_item_spacing);
669 void CreatePanel_Advanced(size_t parent, int border_size,
670 int group_item_spacing);
671 void CreatePanel_Configs(size_t parent, int border_size,
672 int group_item_spacing);
673 void CreatePanel_Routes(size_t parent, int border_size,
674 int group_item_spacing);
675
676 void OnAlertEnableButtonClick(wxCommandEvent &event);
677 void OnAlertAudioEnableButtonClick(wxCommandEvent &event);
678 void OnResetFont(wxCommandEvent &event);
679
680 void UpdateTemplateTitleText();
681 void CheckDeviceAccess(wxString &path);
682
683 OptionsCallbacks m_callbacks;
684 int m_returnChanges;
685 wxListCtrl *tcDataSelected;
686 std::vector<int> marinersStdXref;
687 ChartGroupsUI *groupsPanel;
688 wxImageList *m_topImgList;
689
690 wxCheckBox *m_persist_active_route_chkbox;
691 wxScrolledWindow *m_pNMEAForm;
692 void resetMarStdList(bool bsetConfig, bool bsetStd);
693
694 ObservableListener compat_os_listener;
695 void ApplyChanges(wxCommandEvent &event);
696
697 unsigned int m_screenConfig;
698
699 wxNotebookPage *m_groupsPage;
700 wxFont *dialogFont;
701 wxFont smallFont;
702 // wxFont *dialogFont;
703 wxSize m_small_button_size;
704
705 bool m_bcompact;
706 int m_fontHeight, m_scrollRate;
707 bool m_bfontChanged;
708 wxArrayString m_font_element_array;
709
710 bool m_bVectorInit;
711
712 wxBoxSizer *m_boxSizerConfigs;
713 wxColour m_panelBackgroundUnselected;
714 wxString m_selectedConfigPanelGUID;
715 wxSize m_colourPickerDefaultSize;
716
717 wxSize m_sliderSize;
718 bool m_bneedNew;
719 ObsListener m_OnChartDb_finalize_listener;
720 std::shared_ptr<ConnectionsDlg> comm_dialog;
721
722 DECLARE_EVENT_TABLE()
723};
724
725class CanvasConfigSelect : public wxPanel {
726public:
727 CanvasConfigSelect(wxWindow *parent, options *parentOptions, int id,
728 wxBitmap &bmp, const wxPoint &pos = wxDefaultPosition,
729 const wxSize &size = wxDefaultSize);
731
732 void OnMouseSelected(wxMouseEvent &event);
733 void SetSelected(bool selected);
734 void OnPaint(wxPaintEvent &event);
735
736 bool GetSelected() { return m_bSelected; }
737
738private:
739 options *m_parentOptions;
740 bool m_bSelected;
741 wxColour m_boxColour;
742 wxBitmap m_bmpNormal;
743 int m_borderWidth;
744
745 DECLARE_EVENT_TABLE()
746};
747
748class ChartGroupsUI : public wxScrolledWindow {
749public:
750 ChartGroupsUI(wxWindow *parent);
751 ~ChartGroupsUI(void);
752
753 void CreatePanel(size_t parent, int border_size, int group_item_spacing);
754 void CompletePanel(void);
755 void SetDBDirs(ArrayOfCDI &array) { m_db_dirs = array; }
756 void SetGroupArray(ChartGroupArray *pGroupArray) {
757 m_pGroupArray = pGroupArray;
758 }
759 void SetInitialSettings(void);
760 void CompleteInitialSettings(void);
761 void PopulateTrees(void);
762 void PopulateTreeCtrl(wxTreeCtrl *ptc, const wxArrayString &dir_array,
763 const wxColour &col, wxFont *pFont = NULL);
764 void BuildNotebookPages(ChartGroupArray *pGroupArray);
765 void EmptyChartGroupArray(ChartGroupArray *s);
766 void ClearGroupPages();
767
768 void OnNodeExpanded(wxTreeEvent &event);
769 void OnAvailableSelection(wxTreeEvent &event);
770 void OnInsertChartItem(wxCommandEvent &event);
771 void OnRemoveChartItem(wxCommandEvent &event);
772 void OnGroupPageChange(wxNotebookEvent &event);
773 void OnNewGroup(wxCommandEvent &event);
774 void OnDeleteGroup(wxCommandEvent &event);
775
776 ChartGroupArray *CloneChartGroupArray(ChartGroupArray *s);
777 wxTreeCtrl *AddEmptyGroupPage(const wxString &label);
778
779 bool modified, m_UIcomplete, m_settingscomplete, m_treespopulated;
780
781 wxScrolledWindow *m_panel;
782
783private:
784 int FindGroupBranch(ChartGroup *pGroup, wxTreeCtrl *ptree, wxTreeItemId item,
785 wxString *pbranch_adder);
786
787 wxWindow *pParent;
788 wxFlexGridSizer *groupsSizer;
789 wxButton *m_pAddButton, *m_pRemoveButton, *m_pNewGroupButton;
790 wxButton *m_pDeleteGroupButton;
791 wxGenericDirCtrl *allAvailableCtl, *defaultAllCtl;
792 wxTreeCtrl *m_pActiveChartsTree, *lastSelectedCtl;
793 wxTreeItemId lastDeletedItem;
794 wxNotebook *m_GroupNB;
795 wxFont *iFont;
796 wxFont *dialogFont;
797
798 ArrayOfCDI m_db_dirs;
799 ArrayOfDirCtrls m_DirCtrlArray;
800 ChartGroupArray *m_pGroupArray;
801
802 int m_border_size, m_group_item_spacing, m_GroupSelectedPage;
803
804 wxBoxSizer *m_topSizer;
805
806 DECLARE_EVENT_TABLE()
807};
808
809#ifdef ocpnUSE_GL
810class OpenGLOptionsDlg : private Uncopyable, public wxDialog {
811public:
812 explicit OpenGLOptionsDlg(wxWindow *parent);
813 bool GetAcceleratedPanning(void) const;
814 bool GetTextureCompression(void) const;
815 bool GetPolygonSmoothing(void) const;
816 bool GetLineSmoothing(void) const;
817 bool GetSoftwareGL(void) const;
818 bool GetTextureCompressionCaching(void) const;
819 bool GetRebuildCache(void) const;
820 int GetTextureMemorySize(void) const;
821
822private:
823 void Populate(void);
824 void OnButtonRebuild(wxCommandEvent &event);
825 void OnButtonClear(wxCommandEvent &event);
826 wxString GetTextureCacheSize(void);
827
828 wxCheckBox *m_cbUseAcceleratedPanning, *m_cbTextureCompression;
829 wxCheckBox *m_cbTextureCompressionCaching, *m_cbSoftwareGL,
830 *m_cbPolygonSmoothing, *m_cbLineSmoothing;
831 wxSpinCtrl *m_sTextureDimension, *m_sTextureMemorySize;
832 wxStaticText *m_cacheSize, *m_memorySize;
833
834 bool m_brebuild_cache;
835
836 DECLARE_EVENT_TABLE()
837};
838#endif
839
840#define ID_MMSI_PROPS_LIST 10073
841
842enum {
843 mlMMSI = 0,
844 mlTrackMode,
845 mlIgnore,
846 mlMOB,
847 mlVDM,
848 mlFollower,
849 mlShipName
850}; // MMSIListCtrl Columns;
851
852class MMSIListCtrl : private Uncopyable, public wxListCtrl {
853public:
854 explicit MMSIListCtrl(wxWindow *parent, wxWindowID id, const wxPoint &pos,
855 const wxSize &size, long style);
856 ~MMSIListCtrl(void);
857
858 wxString OnGetItemText(long item, long column) const;
859 void OnListItemClick(wxListEvent &event);
860 void OnListItemActivated(wxListEvent &event);
861 void OnListItemRightClick(wxListEvent &event);
862 void PopupMenuHandler(wxCommandEvent &event);
863
864 wxWindow *m_parent;
865 int m_context_item;
866
867 DECLARE_EVENT_TABLE()
868};
869
870#define ID_MMSIEDIT_OK 8191
871#define ID_MMSIEDIT_CANCEL 8192
872#define ID_MMSI_CTL 8193
873#define ID_DEF_MENU_MMSI_EDIT 8194
874#define ID_DEF_MENU_MMSI_DELETE 8195
875
876class MMSIEditDialog : private Uncopyable, public wxDialog {
877public:
878 explicit MMSIEditDialog(MmsiProperties *props, wxWindow *parent,
879 wxWindowID id = wxID_ANY,
880 const wxString &caption = wxEmptyString,
881 const wxPoint &pos = wxDefaultPosition,
882 const wxSize &size = wxDefaultSize, long style = 0);
883 ~MMSIEditDialog(void);
884
885 void SetColorScheme(ColorScheme cs);
886 void CreateControls(void);
887 void OnMMSIEditCancelClick(wxCommandEvent &event);
888 void OnMMSIEditOKClick(wxCommandEvent &event);
889 void OnCtlUpdated(wxCommandEvent &event);
890 void OnMMSIChanged(wxCommandEvent &event);
891
892 MmsiProperties *m_props;
893 wxTextCtrl *m_MMSICtl, *m_ShipNameCtl; // Has ToDo take away?
894 wxRadioButton *m_rbTypeTrackDefault, *m_rbTypeTrackAlways;
895 wxRadioButton *m_rbTypeTrackNever;
896 wxCheckBox *m_cbTrackPersist, *m_IgnoreButton, *m_MOBButton, *m_VDMButton,
897 *m_FollowerButton;
898 wxButton *m_CancelButton, *m_OKButton;
899
900private:
901 void Persist();
902
903 DECLARE_EVENT_TABLE()
904};
905
906class MMSI_Props_Panel : private Uncopyable, public wxPanel {
907public:
908 explicit MMSI_Props_Panel(wxWindow *parent);
910
911 void OnNewButton(wxCommandEvent &event);
912 void SetColorScheme(ColorScheme cs);
913 void UpdateMMSIList(void);
914
915 MMSIListCtrl *m_pListCtrlMMSI;
916 wxButton *m_pButtonNew;
917
918private:
919 wxWindow *m_pparent;
920};
921
922class ConfigCreateDialog : private Uncopyable, public wxDialog {
923public:
924 explicit ConfigCreateDialog(wxWindow *parent, wxWindowID id = wxID_ANY,
925 const wxString &caption = wxEmptyString,
926 const wxPoint &pos = wxDefaultPosition,
927 const wxSize &size = wxDefaultSize,
928 long style = 0);
930
931 void SetColorScheme(ColorScheme cs);
932 void CreateControls(void);
933 void OnConfigEditCancelClick(wxCommandEvent &event);
934 void OnConfigEditOKClick(wxCommandEvent &event);
935 wxString GetCreatedTemplateGUID() { return m_createdTemplateGUID; }
936
937 wxTextCtrl *m_TitleCtl, *m_DescriptionCtl;
938 wxButton *m_CancelButton, *m_OKButton;
939 wxString m_createdTemplateGUID;
940 DECLARE_EVENT_TABLE()
941};
942
943#endif
944// _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:641
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:183
PlugInManager and helper classes – Mostly gui parts (dialogs) and plugin API stuff.
Time textbox to replace broken wxTimePickerCtrl on wxGTK.