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