37 #include <wx/wxprec.h>
43 #include <wx/progdlg.h>
44 #include <wx/radiobox.h>
45 #include <wx/listbox.h>
46 #include <wx/imaglist.h>
47 #include <wx/display.h>
48 #include <wx/choice.h>
49 #include <wx/dirdlg.h>
50 #include <wx/clrpicker.h>
51 #include <wx/fontdata.h>
52 #include <wx/fontdlg.h>
53 #include <wx/stdpaths.h>
54 #include <wx/tokenzr.h>
55 #include <wx/mediactrl.h>
57 #include <wx/odcombo.h>
58 #include <wx/statline.h>
60 #include <wx/renderer.h>
61 #include <wx/textwrapper.h>
63 #include "model/comm_drv_factory.h"
64 #include "model/comm_util.h"
65 #include "conn_params_panel.h"
67 #if defined(__WXGTK__) || defined(__WXQT__)
68 #include <wx/colordlg.h>
72 #include "ocpn_fontdlg.h"
77 #include "model/ais_decoder.h"
79 #include "model/ais_target_data.h"
81 #include "model/config_vars.h"
82 #include "model/idents.h"
83 #include "model/multiplexer.h"
84 #include "model/navutil_base.h"
85 #include "model/own_ship.h"
86 #include "model/routeman.h"
87 #include "model/ser_ports.h"
88 #include "model/wx28compat.h"
91 #include "chart_ctx_factory.h"
95 #include "ConfigMgr.h"
101 #include "observable_evtvar.h"
102 #include "observable_globvar.h"
103 #include "ocpn_frame.h"
104 #include "OCPNPlatform.h"
105 #include "OCPN_Sound.h"
108 #include "s52utils.h"
109 #include "SoundFactory.h"
111 #include "svg_utils.h"
112 #include "SystemCmdSound.h"
113 #include "usb_devices.h"
114 #include "waypointman_gui.h"
117 #include "glChartCanvas.h"
118 extern GLuint g_raster_format;
127 #include "androidUTIL.h"
131 #include <QtWidgets/QScroller>
135 #if wxCHECK_VERSION(3,2,0)
136 #define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
138 #define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS
141 #define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
144 wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
146 wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
151 extern bool g_bSoftwareGL;
153 extern bool g_bShowOutlines;
154 extern bool g_bShowChartBar;
155 extern bool g_bShowDepthUnits;
156 extern bool g_bskew_comp;
157 extern bool g_bopengl;
158 extern bool g_bChartBarEx;
159 extern bool g_bsmoothpanzoom;
160 extern int g_chart_zoom_modifier_raster;
161 extern int g_chart_zoom_modifier_vector;
162 extern bool g_bUIexpert;
164 extern wxString* pInit_Chart_Dir;
166 extern bool g_bfilter_cogsog;
167 extern int g_COGFilterSec;
168 extern int g_SOGFilterSec;
173 extern bool g_bDisplayGrid;
176 extern bool g_bShowLiveETA;
177 extern double g_defaultBoatSpeed;
178 extern double g_defaultBoatSpeedUserUnit;
180 extern int g_iNavAidRadarRingsNumberVisible;
181 extern bool g_bNavAidRadarRingsShown;
182 extern float g_fNavAidRadarRingsStep;
183 extern int g_pNavAidRadarRingsStepUnits;
184 extern bool g_bWayPointPreventDragging;
185 extern wxColour g_colourOwnshipRangeRingsColour;
186 extern bool g_bShowShipToActive;
187 extern int g_shipToActiveStyle;
188 extern int g_shipToActiveColor;
190 extern bool g_own_ship_sog_cog_calc;
191 extern int g_own_ship_sog_cog_calc_damp_sec;
193 extern bool g_bPreserveScaleOnX;
194 extern bool g_bPlayShipsBells;
196 extern wxString g_CmdSoundString;
198 extern int g_iSoundDeviceIndex;
199 extern bool g_bFullscreenToolbar;
200 extern bool g_bTransparentToolbar;
201 extern bool g_bTransparentToolbarInOpenGLOK;
203 extern int g_OwnShipIconType;
204 extern double g_n_ownship_length_meters;
205 extern double g_n_ownship_beam_meters;
206 extern double g_n_gps_antenna_offset_y;
207 extern double g_n_gps_antenna_offset_x;
208 extern int g_n_ownship_min_mm;
210 extern bool g_bEnableZoomToCursor;
211 extern bool g_bHighliteTracks;
212 extern wxColour g_colourTrackLineColour;
214 extern bool g_bAdvanceRouteWaypointOnArrivalOnly;
216 extern int g_cm93_zoom_factor;
218 extern int g_COGAvgSec;
220 extern bool g_bCourseUp;
221 extern bool g_bLookAhead;
223 extern double g_ownship_predictor_minutes;
224 extern double g_ownship_HDTpredictor_miles;
226 extern bool g_bQuiltEnable;
227 extern bool g_bFullScreenQuilt;
228 extern bool g_bConfirmObjectDelete;
231 extern wxLocale* plocale_def_lang;
234 extern double g_mouse_zoom_sensitivity;
235 extern int g_mouse_zoom_sensitivity_ui;
237 extern OcpnSound* g_anchorwatch_sound;
239 extern bool g_fog_overzoom;
240 extern bool g_oz_vector_scale;
241 extern bool g_bShowStatusBar;
243 extern s52plib* ps52plib;
245 extern wxString g_locale;
247 extern ChartGroupArray* g_pGroupArray;
254 extern bool g_bGLexpert;
256 #define ID_CHOICE_NMEA wxID_HIGHEST + 1
258 extern std::vector<std::string> TideCurrentDataSet;
259 extern wxString g_TCData_Dir;
263 extern bool g_bShowMenuBar;
264 extern bool g_bShowCompassWin;
266 extern bool g_bresponsive;
267 extern bool g_bAutoHideToolbar;
268 extern int g_nAutoHideToolbar;
269 extern int g_GUIScaleFactor;
270 extern int g_ChartScaleFactor;
271 extern float g_MarkScaleFactorExp;
272 extern bool g_bRollover;
273 extern int g_ShipScaleFactor;
274 extern float g_ShipScaleFactorExp;
275 extern int g_ENCSoundingScaleFactor;
276 extern int g_ENCTextScaleFactor;
277 extern bool g_bShowMuiZoomButtons;
279 extern std::vector<size_t> g_config_display_size_mm;
280 extern bool g_config_display_size_manual;
281 extern unsigned int g_canvasConfig;
282 extern bool g_useMUI;
283 extern wxString g_lastAppliedTemplateGUID;
284 extern wxString g_default_wp_icon;
285 extern int osMajor, osMinor;
286 extern bool g_bShowMuiZoomButtons;
290 extern int g_Android_SDK_Version;
291 extern MigrateAssistantDialog* g_migrateDialog;
294 extern wxString GetShipNameFromFile(
int);
296 WX_DEFINE_ARRAY_PTR(
ChartCanvas*, arrayofCanvasPtr);
297 extern arrayofCanvasPtr g_canvasArray;
300 static int lang_list[] = {
301 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
302 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
303 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
304 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
305 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
306 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
307 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
308 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
310 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
311 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
312 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
313 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
314 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
315 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
323 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
324 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
325 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
326 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
327 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
328 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
329 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
330 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
331 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
332 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
333 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
334 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
335 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
336 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
337 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
338 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
339 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
340 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
341 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
342 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
343 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
344 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
345 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
346 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
347 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
350 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
351 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
352 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
353 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
354 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
356 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
357 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
358 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
359 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
360 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
361 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
362 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
363 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
364 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
365 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
366 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
367 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
368 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
369 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
370 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
371 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
372 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
373 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
374 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
376 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
377 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
378 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
379 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
380 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
381 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
382 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
383 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
384 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
385 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
386 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
387 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
388 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
392 void prepareSlider(wxSlider* slider) {
393 slider->GetHandle()->setStyleSheet(
394 prepareAndroidSliderStyleSheet(slider->GetSize().x));
395 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
396 slider->GetHandle()->grabGesture(Qt::PanGesture);
397 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
402 int wxCALLBACK SortConnectionOnPriority(wxIntPtr item1, wxIntPtr item2,
405 wxListCtrl* lc =
reinterpret_cast<wxListCtrl*
>(list);
408 it1.SetId(lc->FindItem(-1, item1));
410 it1.SetMask(it1.GetMask() | wxLIST_MASK_TEXT);
412 it2.SetId(lc->FindItem(-1, item2));
414 it2.SetMask(it2.GetMask() | wxLIST_MASK_TEXT);
420 return it1.GetText().CmpNoCase(it2.GetText());
422 return it2.GetText().CmpNoCase(it1.GetText());
435 wxString textMod = text;
436 textMod.Replace(
" ",
"^");
439 wxString sep = wxFileName::GetPathSeparator();
440 textMod.Replace(sep,
" ");
442 Wrap(win, textMod, widthMax);
445 for (
size_t i = 0; i < m_array.GetCount(); i++) {
446 wxString a = m_array[i];
448 if (m_array.GetCount() > 1) {
449 if (i < m_array.GetCount() - 1) a += sep;
455 wxString
const& GetWrapped()
const {
return m_wrapped; }
456 int const GetLineCount()
const {
return m_lineCount; }
457 wxArrayString GetLineArray() {
return m_array; }
460 virtual void OnOutputLine(
const wxString& line) {
464 virtual void OnNewLine() {
472 wxArrayString m_array;
481 void DoChartSelected();
482 void SetSelected(
bool selected);
483 void OnPaint(wxPaintEvent& event);
485 void OnSize(wxSizeEvent& event);
487 int GetUnselectedHeight() {
return m_unselectedHeight; }
488 int GetRefHeight() {
return m_refHeight; }
489 bool IsSelected() {
return m_bSelected; }
490 void OnClickDown(wxMouseEvent& event);
491 void OnClickUp(wxMouseEvent& event);
496 wxColour m_boxColour;
497 int m_unselectedHeight;
498 wxString m_pChartDir;
502 DECLARE_EVENT_TABLE()
506 EVT_PAINT(OCPNChartDirPanel::OnPaint)
508 EVT_SIZE(OCPNChartDirPanel::OnSize)
512 const wxPoint& pos, const wxSize& size,
514 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
515 m_pChartDir = cdi.fullpath;
518 if (cdi.fullpath.StartsWith(
519 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
520 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
525 m_refHeight = GetCharHeight();
527 m_unselectedHeight = 2 * m_refHeight;
533 SetMinSize(wxSize(-1, m_unselectedHeight));
535 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
538 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
543 OCPNChartDirPanel::~OCPNChartDirPanel() {}
545 static wxStopWatch swclick;
547 static int downx, downy;
550 void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
553 event.GetPosition(&downx, &downy);
559 void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
561 qDebug() << swclick.Time();
562 if (swclick.Time() < 200) {
564 event.GetPosition(&upx, &upy);
565 if ((fabs(upx - downx) < GetCharWidth()) &&
566 (fabs(upy - downy) < GetCharWidth())) {
574 void OCPNChartDirPanel::DoChartSelected() {
584 void OCPNChartDirPanel::SetSelected(
bool selected) {
585 m_bSelected = selected;
588 m_boxColour = wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
590 m_boxColour = wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
595 g_pOptions->SetDirActionButtons();
602 void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
603 if (m_pChartDir.Length()) {
605 GetClientSize(&x, &y);
608 wxArrayString nameWrapped = wrapper.GetLineArray();
610 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
616 void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
618 GetSize(&width, &height);
621 dc.SetPen(*wxTRANSPARENT_PEN);
622 dc.SetBrush(wxBrush(GetBackgroundColour()));
623 dc.DrawRectangle(GetVirtualSize());
625 wxString nameString = m_pChartDir;
627 wxArrayString nameWrapped = wrapper.GetLineArray();
629 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
630 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
631 GetParent()->GetSizer()->Layout();
635 dc.SetBrush(wxBrush(m_boxColour));
637 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
639 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
641 int offset = height / 10;
642 int text_x = offset * 2;
644 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
647 dc.SetTextForeground(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
649 int yd = height * 20 / 100;
650 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
652 dc.DrawText(nameWrapped[i], text_x, yd);
654 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
655 yd += GetCharHeight();
659 dc.SetBrush(wxBrush(m_boxColour));
661 dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME), 1));
663 int offset = height / 10;
664 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
665 height - (2 * offset), height / 10);
667 int text_x = offset * 2;
669 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
672 dc.SetTextForeground(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
674 int yd = height * 20 / 100;
675 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
677 dc.DrawText(nameWrapped[i], text_x, yd);
679 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
680 yd += GetCharHeight();
689 static bool LoadAllPlugIns(
bool load_enabled) {
690 g_Platform->ShowBusySpinner();
691 bool b = PluginLoader::getInstance()->
LoadAllPlugIns(load_enabled);
692 g_Platform->HideBusySpinner();
696 WX_DECLARE_LIST(wxCheckBox, CBList);
703 const wxPoint& pt = wxDefaultPosition,
704 const wxSize& sz = wxDefaultSize,
705 long style = wxHSCROLL | wxVSCROLL,
706 const wxString& name = _T(
"scrolledWindow")) {
707 Create(parent,
id, pt, sz, style, name);
710 bool Create(wxWindow* parent, wxWindowID
id = -1,
711 const wxPoint& pt = wxDefaultPosition,
712 const wxSize& sz = wxDefaultSize,
713 long style = wxHSCROLL | wxVSCROLL,
714 const wxString& name = _T(
"scrolledWindow"));
718 unsigned int Append(wxString& label,
bool benable =
true);
719 unsigned int GetCount() {
return m_list.GetCount(); }
722 void Check(
int index,
bool val);
723 bool IsChecked(
int index);
731 #include <wx/listimpl.cpp>
732 WX_DEFINE_LIST(CBList);
734 bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
735 const wxPoint& pt,
const wxSize& sz,
736 long style,
const wxString& name) {
737 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
740 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
741 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
745 m_sizer =
new wxBoxSizer(wxVERTICAL);
751 unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable) {
752 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
754 cb->SetValue(!benable);
760 return m_list.GetCount() - 1;
763 void OCPNCheckedListCtrl::Check(
int index,
bool val) {
764 CBList::Node* node = m_list.Item(index);
765 wxCheckBox* cb = node->GetData();
767 if (cb) cb->SetValue(val);
770 bool OCPNCheckedListCtrl::IsChecked(
int index) {
771 CBList::Node* node = m_list.Item(index);
772 wxCheckBox* cb = node->GetData();
775 return cb->GetValue();
780 void OCPNCheckedListCtrl::Clear() {
781 for (
unsigned int i = 0; i < m_list.GetCount(); i++) {
782 wxCheckBox* cb = m_list[i];
790 void appendOSDirSlash(wxString* pString);
792 extern ArrayOfMmsiProperties g_MMSI_Props_Array;
799 EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
800 EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
804 const wxString& caption,
805 const wxPoint& pos, const wxSize& size,
807 : wxDialog(parent,
id, caption, pos, size,
808 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
810 GetSizer()->SetSizeHints(
this);
814 ConfigCreateDialog::~ConfigCreateDialog(
void) {}
816 void ConfigCreateDialog::CreateControls(
void) {
817 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
820 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
821 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
823 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
824 wxSize(40 * GetCharHeight(), -1), 0);
825 mainSizer->Add(m_TitleCtl, 0,
826 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
828 mainSizer->AddSpacer(2 * GetCharHeight());
830 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
831 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
834 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
835 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
836 mainSizer->Add(m_DescriptionCtl, 0,
837 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
839 mainSizer->AddSpacer(2 * GetCharHeight());
844 _(
"Create a private configuration template based on current settings.\n\
845 This template will be saved, and may be selected for further use at any time.\n\
847 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
849 mainSizer->AddSpacer(2 * GetCharHeight());
851 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
852 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
854 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
855 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
857 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
858 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
859 m_OKButton->SetDefault();
862 void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
863 EndModal(wxID_CANCEL);
866 void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
867 const wxString& title = m_TitleCtl->GetValue();
868 const wxString& desc = m_DescriptionCtl->GetValue();
869 m_createdTemplateGUID =
870 ConfigMgr::Get().CreateNamedConfig(title, desc, _T(
""));
879 EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
880 EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
884 wxWindowID
id, const wxString& caption,
885 const wxPoint& pos, const wxSize& size,
887 : wxDialog(parent,
id, caption, pos, size,
888 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
891 GetSizer()->SetSizeHints(
this);
895 MMSIEditDialog::~MMSIEditDialog(
void) {
delete m_MMSICtl; }
897 void MMSIEditDialog::CreateControls(
void) {
898 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
901 wxStaticBox* mmsiBox =
902 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
904 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
905 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
907 mmsiSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"MMSI")), 0,
908 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
910 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
911 wxDefaultPosition, wxSize(180, -1), 0);
912 mmsiSizer->Add(m_MMSICtl, 0,
913 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
915 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(
916 new wxStaticBox(
this, wxID_ANY, _(
"Tracking")), wxVERTICAL);
918 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
920 m_rbTypeTrackDefault =
921 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
922 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
923 m_rbTypeTrackDefault->SetValue(TRUE);
924 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
926 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
927 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
929 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
930 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
932 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
933 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
935 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
936 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
938 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
939 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
941 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
942 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
943 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
946 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
947 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
949 m_FollowerButton =
new wxCheckBox(
950 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
951 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
953 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
954 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
956 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
957 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
959 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
960 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
961 m_OKButton->SetDefault();
965 if (m_props->MMSI > 0)
966 sMMSI.Printf(_T(
"%d"), m_props->MMSI);
969 m_MMSICtl->AppendText(sMMSI);
971 switch (m_props->TrackType) {
972 case TRACKTYPE_ALWAYS:
973 m_rbTypeTrackAlways->SetValue(TRUE);
975 case TRACKTYPE_NEVER:
976 m_rbTypeTrackNever->SetValue(TRUE);
982 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
983 m_IgnoreButton->SetValue(m_props->m_bignore);
984 m_MOBButton->SetValue(m_props->m_bMOB);
985 m_VDMButton->SetValue(m_props->m_bVDM);
986 m_FollowerButton->SetValue(m_props->m_bFollower);
988 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
991 void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
993 void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
994 EndModal(wxID_CANCEL);
997 void MMSIEditDialog::Persist() {
999 if (m_rbTypeTrackDefault->GetValue())
1000 m_props->TrackType = TRACKTYPE_DEFAULT;
1001 else if (m_rbTypeTrackAlways->GetValue())
1002 m_props->TrackType = TRACKTYPE_ALWAYS;
1004 m_props->TrackType = TRACKTYPE_NEVER;
1006 m_props->m_bignore = m_IgnoreButton->GetValue();
1007 m_props->m_bMOB = m_MOBButton->GetValue();
1008 m_props->m_bVDM = m_VDMButton->GetValue();
1009 m_props->m_bFollower = m_FollowerButton->GetValue();
1010 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
1011 if (m_props->m_ShipName == wxEmptyString) {
1012 auto proptarget = g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
1014 wxString s = proptarget->GetFullName();
1015 m_props->m_ShipName = s;
1017 wxString GetShipNameFromFile(
int);
1018 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
1024 void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
1028 m_MMSICtl->GetValue().ToLong(&nmmsi);
1029 m_props->MMSI = nmmsi;
1032 if (m_MMSICtl->GetValue().Length() != 9) {
1035 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
1036 "your entries and cancel if necessary."),
1037 _(
"OpenCPN Info"), wxOK | wxCANCEL);
1039 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
1040 if (retcode == wxID_OK) {
1051 void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
1054 EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1055 EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1056 EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1057 MMSIListCtrl::OnListItemRightClick)
1058 EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1059 EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1063 const wxSize& size,
long style)
1064 : wxListCtrl(parent,
id, pos, size, style) {
1068 MMSIListCtrl::~MMSIListCtrl(
void) {}
1070 wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1074 if (!props)
return ret;
1077 if (props->MMSI > 0) ret = wxString::Format(_T(
"%d" ), props->MMSI);
1080 switch (props->TrackType) {
1081 case TRACKTYPE_DEFAULT:
1084 case TRACKTYPE_ALWAYS:
1087 case TRACKTYPE_NEVER:
1093 if (props->m_bPersistentTrack)
1094 ret.Append(_T(
", " )).Append(_(
"Persistent"));
1097 if (props->m_bignore) ret = _T(
"X" );
1100 if (props->m_bMOB) ret = _T(
"X" );
1103 if (props->m_bVDM) ret = _T(
"X" );
1106 if (props->m_bFollower) ret = _T(
"X");
1109 ret = props->m_ShipName;
1118 void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1120 void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1121 MmsiProperties* props = g_MMSI_Props_Array.Item(event.GetIndex());
1125 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1126 wxDefaultPosition, wxSize(200, 200));
1128 if (pd->ShowModal() == wxID_OK) {
1129 g_MMSI_Props_Array.RemoveAt(event.GetIndex());
1131 g_MMSI_Props_Array.Insert(props_new, event.GetIndex());
1138 void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1139 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1140 if (m_context_item == wxNOT_FOUND)
return;
1141 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1142 wxMenuItem* item_edit =
1143 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") + _T(
"..."));
1144 menu->Append(item_edit);
1145 wxMenuItem* item_delete =
1146 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1147 menu->Append(item_delete);
1150 wxFont* qFont = GetOCPNScaledFont(_(
"Menu"));
1151 item_edit->SetFont(*qFont);
1152 item_delete->SetFont(*qFont);
1155 wxPoint p = ScreenToClient(wxGetMousePosition());
1156 PopupMenu(menu, p.x, p.y);
1158 SetItemCount(g_MMSI_Props_Array.GetCount());
1162 void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1163 int context_item = m_context_item;
1168 switch (event.GetId()) {
1169 case ID_DEF_MENU_MMSI_EDIT: {
1172 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1173 wxDefaultPosition, wxSize(200, 200));
1175 if (pd->ShowModal() == wxID_OK) {
1176 g_MMSI_Props_Array.RemoveAt(context_item);
1178 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1179 g_MMSI_Props_Array.Insert(props_new, context_item);
1186 case ID_DEF_MENU_MMSI_DELETE:
1187 g_MMSI_Props_Array.RemoveAt(context_item);
1193 MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1194 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1198 wxFont* qFont = GetOCPNScaledFont(_(
"Dialog"));
1201 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1204 wxString MMSI_props_column_spec = _T(
"120;120;100;100;100;100;100;100");
1206 wxStringTokenizer tkz(MMSI_props_column_spec, _T(
";"));
1207 wxString s_width = tkz.GetNextToken();
1212 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1213 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1214 wxBORDER_SUNKEN | wxLC_VIRTUAL);
1222 int dx = GetCharWidth();
1225 if (s_width.ToLong(&lwidth)) {
1226 width = wxMax(dx * 2, lwidth);
1227 width = wxMin(width, dx * 13);
1229 m_pListCtrlMMSI->InsertColumn(tlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, width);
1231 s_width = tkz.GetNextToken();
1233 if (s_width.ToLong(&lwidth)) {
1234 width = wxMax(dx * 2, lwidth);
1235 width = wxMin(width, dx * 25);
1237 m_pListCtrlMMSI->InsertColumn(tlCLASS, _(
"Track Mode"), wxLIST_FORMAT_CENTER,
1240 s_width = tkz.GetNextToken();
1242 if (s_width.ToLong(&lwidth)) {
1243 width = wxMax(dx * 2, lwidth);
1244 width = wxMin(width, dx * 10);
1246 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1249 s_width = tkz.GetNextToken();
1251 if (s_width.ToLong(&lwidth)) {
1252 width = wxMax(dx * 2, lwidth);
1253 width = wxMin(width, dx * 10);
1255 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"MOB"), wxLIST_FORMAT_CENTER, width);
1257 s_width = tkz.GetNextToken();
1259 if (s_width.ToLong(&lwidth)) {
1260 width = wxMax(dx * 2, lwidth);
1261 width = wxMin(width, dx * 15);
1263 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1266 s_width = tkz.GetNextToken();
1268 if (s_width.ToLong(&lwidth)) {
1269 width = wxMax(dx * 2, lwidth);
1270 width = wxMin(width, dx * 30);
1272 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ship name"), wxLIST_FORMAT_CENTER,
1275 s_width = tkz.GetNextToken();
1277 if (s_width.ToLong(&lwidth)) {
1278 width = wxMax(dx * 2, lwidth);
1279 width = wxMin(width, dx * 10);
1281 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Follower"), wxLIST_FORMAT_CENTER,
1284 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1286 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1288 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1289 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1291 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1298 SetSize(GetSize().x, GetSize().y - 1);
1300 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1303 MMSI_Props_Panel::~MMSI_Props_Panel(
void) {}
1305 void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1309 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1310 wxDefaultPosition, wxSize(200, 200));
1313 pd->ShowWindowModalThenDo([
this, pd, props](
int retcode) {
1314 if (retcode == wxID_OK) {
1315 g_MMSI_Props_Array.Add(props);
1323 void MMSI_Props_Panel::UpdateMMSIList(
void) {
1325 long selItemID = wxNOT_FOUND;
1326 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1327 wxLIST_STATE_SELECTED);
1329 int selMMSI = wxNOT_FOUND;
1330 if (selItemID != wxNOT_FOUND) selMMSI = g_MMSI_Props_Array[selItemID]->MMSI;
1332 m_pListCtrlMMSI->SetItemCount(g_MMSI_Props_Array.GetCount());
1335 long item_sel = wxNOT_FOUND;
1336 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1337 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
1338 if (g_MMSI_Props_Array[i]->MMSI == selMMSI) {
1345 if (g_MMSI_Props_Array.GetCount() > 0)
1346 m_pListCtrlMMSI->SetItemState(item_sel,
1347 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1348 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1351 m_pListCtrlMMSI->Refresh(FALSE);
1355 void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1365 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value = _T(
""),
1366 const wxPoint& pos = wxDefaultPosition,
1367 const wxSize& size = wxDefaultSize,
int n = 0,
1368 const wxString choices[] = NULL,
long style = 0,
1369 const wxValidator& validator = wxDefaultValidator,
1370 const wxString& name = _T(
"OCPNFatCombo"));
1374 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1375 wxCoord OnMeasureItem(
size_t item)
const;
1376 wxCoord OnMeasureItemWidth(
size_t item)
const;
1377 bool SetFont(
const wxFont& font);
1379 int Append(
const wxString& item, wxBitmap bmp);
1382 const wxFont* dfont;
1386 ArrayOfBitmaps bmpArray;
1389 OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1391 OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1392 const wxString& value,
const wxPoint& pos,
1393 const wxSize& size,
int n,
const wxString choices[],
1394 long style,
const wxValidator& validator,
1395 const wxString& name)
1396 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1399 GetFont().GetPointSize() / g_Platform->getFontPointsperPixel();
1400 itemHeight = (int)wxRound(fontHeight);
1401 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1404 OCPNFatCombo::~OCPNFatCombo() {}
1406 bool OCPNFatCombo::SetFont(
const wxFont& font) {
1411 void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1418 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1419 wxBrush br = wxBrush(bg);
1420 wxBrush sv = dc.GetBrush();
1422 dc.DrawRectangle(0, 0, rect.width, rect.height);
1424 dc.SetTextForeground(wxColour(0, 0, 0));
1426 if (flags & wxODCB_PAINTING_CONTROL) {
1427 wxString text = GetValue();
1429 dc.DrawText(text, rect.x + margin_x + offset_x,
1430 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1432 dc.SetBackground(wxBrush(br));
1434 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1435 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1439 wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1440 if (item < bmpArray.GetCount())
1441 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1443 return itemHeight * 12 / 10;
1446 wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1448 int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1450 int idx = wxOwnerDrawnComboBox::Append(item);
1455 void OCPNFatCombo::Clear(
void) {
1456 wxOwnerDrawnComboBox::Clear();
1460 BEGIN_EVENT_TABLE(
options, wxDialog)
1461 EVT_INIT_DIALOG(options::OnDialogInit)
1462 EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1463 EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1464 EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1465 EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1466 EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1467 EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1468 EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1469 EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1470 EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1471 EVT_BUTTON(xID_OK, options::OnXidOkClick)
1472 EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1473 EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1474 EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1476 EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1477 EVT_CLOSE(options::OnClose)
1479 #if defined(__WXGTK__) || defined(__WXQT__)
1480 EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1483 EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1485 EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1486 EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1487 EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1488 EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1489 EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1490 EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1491 EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1492 EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1493 EVT_CHAR_HOOK(options::OnCharHook)
1497 options::
options(wxWindow* parent, wxWindowID
id, const wxString& caption,
1498 const wxPoint& pos, const wxSize& size,
long style)
1499 : pTrackRotateTime(0) {
1504 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1506 wxDialog::Create(parent,
id, caption, pos, size, style);
1507 SetFont(*dialogFont);
1510 RecalculateSize( size.x, size.y);
1514 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1515 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1517 m_pPlugInCtrl->ReloadPluginPanels();
1519 auto action = [&](wxCommandEvent &evt) {
1520 g_persist_active_route = m_persist_active_route_chkbox->IsChecked(); };
1521 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1522 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1525 options::~options(
void) {
1527 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1529 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1530 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1533 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1535 delete m_pSerialArray;
1536 delete m_pGroupArray;
1537 delete m_topImgList;
1541 delete m_pPlugInCtrl;
1542 if (g_pi_manager) g_pi_manager->SetListPanelPtr(NULL);
1544 delete m_PluginCatalogMgrPanel;
1549 bool options::SendIdleEvents(wxIdleEvent& event) {
1550 if (IsShown())
return wxDialog::SendIdleEvents(event);
1554 void options::RecalculateSize(
int hint_x,
int hint_y) {
1555 if (!g_bresponsive) {
1556 m_nCharWidthMax = GetSize().x / GetCharWidth();
1560 if ((hint_x < 200) || (hint_y < 200)){
1563 int display_width, display_height;
1564 display_width = g_monitor_info[g_current_monitor].width;
1565 display_height = g_monitor_info[g_current_monitor].height;
1567 if(display_height < 600){
1568 SetSize(wxSize(GetOCPNCanvasWindow()->GetSize() ));
1571 vectorPanel-> SetSizeHints(ps57Ctl);
1581 esize.x = GetCharWidth() * 110;
1582 esize.y = GetCharHeight() * 40;
1584 wxSize dsize = GetParent()->GetSize();
1585 esize.y = wxMin(esize.y, dsize.y - 0 );
1586 esize.x = wxMin(esize.x, dsize.x - 0 );
1589 wxSize fsize = GetSize();
1590 wxSize canvas_size = GetParent()->GetSize();
1591 wxPoint screen_pos = GetParent()->GetScreenPosition();
1592 int xp = (canvas_size.x - fsize.x) / 2;
1593 int yp = (canvas_size.y - fsize.y) / 2;
1594 Move(screen_pos.x + xp, screen_pos.y + yp);
1596 m_nCharWidthMax = GetSize().x / GetCharWidth();
1599 void options::Init(
void) {
1600 m_pWorkDirList = NULL;
1602 pShowStatusBar = NULL;
1603 pShowMenuBar = NULL;
1604 pShowCompassWin = NULL;
1607 m_scrollWinChartList = NULL;
1608 ps57CtlListBox = NULL;
1610 m_pSerialArray = NULL;
1611 pUpdateCheckBox = NULL;
1612 pParseENCButton = NULL;
1619 pSoundDeviceIndex = NULL;
1623 pCBLookAhead = NULL;
1624 pCDOQuilting = NULL;
1625 pPreserveScale = NULL;
1626 pSmoothPanZoom = NULL;
1627 pEnableZoomToCursor = NULL;
1628 pSDisplayGrid = NULL;
1629 pCDOOutlines = NULL;
1630 pSDepthUnits = NULL;
1632 pSDefaultBoatSpeed = NULL;
1635 itemActiveChartStaticBox = NULL;
1637 pCheck_SOUNDG = NULL;
1639 pCheck_SHOWIMPTEXT = NULL;
1640 pCheck_SCAMIN = NULL;
1641 pCheck_ATONTEXT = NULL;
1642 pCheck_LDISTEXT = NULL;
1643 pCheck_XLSECTTEXT = NULL;
1645 m_bVisitLang = FALSE;
1646 m_itemFontElementListBox = NULL;
1647 m_textSample = NULL;
1648 m_topImgList = NULL;
1651 m_pGroupArray = NULL;
1652 m_groups_changed = 0;
1655 m_pageConnections = -1;
1660 m_pageConnections = -1;
1663 auto loader = PluginLoader::getInstance();
1664 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
1665 b_oldhaveWMM = b_haveWMM;
1670 m_bForceNewToolbaronCancel =
false;
1672 m_cs = (ColorScheme)0;
1675 m_pPlugInCtrl = NULL;
1676 m_PluginCatalogMgrPanel = NULL;
1688 dialogFont = GetOCPNScaledFont(_(
"Dialog"));
1690 m_bVectorInit =
false;
1695 pCmdSoundString = NULL;
1697 m_sconfigSelect_single = NULL;
1698 m_sconfigSelect_twovertical = NULL;
1701 dc.SetFont(*dialogFont);
1703 dc.GetTextExtent(_T(
"H"), &width, &height, NULL, NULL, dialogFont);
1705 m_colourPickerDefaultSize =
1706 wxSize(4 * height, height* 2 * OCPN_GetWinDIPScaleFactor());
1714 double dsizemm = g_Platform->GetDisplaySizeMM();
1719 auto sound =
static_cast<OcpnSound*
>(ev.GetClientData());
1726 #if defined(__GNUC__) && __GNUC__ < 8
1729 static const wxString BAD_ACCESS_MSG = _(
1730 "The device selected is not accessible; opencpn will likely not be able\n"
1731 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1732 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1733 "with the following contents:\n\n"
1734 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1735 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1736 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1737 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1741 static const wxString BAD_ACCESS_MSG = _(R
"(
1742 The device selected is not accessible; opencpn will likely not be able
1743 to use this device as-is. You might want to exit OpenCPN, reboot and
1744 retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1745 with the following contents:
1747 KERNEL=="ttyUSB*", MODE="0666"
1748 KERNEL=="ttyACM*", MODE="0666"
1749 KERNEL=="ttyS*", MODE="0666"
1751 For more info, see the file LINUX_DEVICES.md in the distribution docs.
1756 void options::OnDialogInit(wxInitDialogEvent& event) {}
1758 void options::CheckDeviceAccess( wxString& path) {}
1760 size_t options::CreatePanel(
const wxString& title) {
1761 size_t id = m_pListbook->GetPageCount();
1764 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1765 wxDefaultSize, wxTAB_TRAVERSAL, title);
1766 m_pListbook->AddPage(panel, title, FALSE,
id);
1770 wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1771 if (parent > m_pListbook->GetPageCount() - 1) {
1774 _T(
"Warning: invalid parent in options::AddPage( %d, "), parent) +
1778 wxNotebookPage* page = m_pListbook->GetPage(parent);
1780 wxScrolledWindow* sw;
1782 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1783 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1784 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1786 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1787 nb->AddPage(sw, title);
1788 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1789 wxString toptitle = m_pListbook->GetPageText(parent);
1790 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1791 wxDefaultSize, wxNB_TOP);
1794 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1795 m_pListbook->SetSelection(0);
1796 m_pListbook->RemovePage(parent + 1);
1797 wxString previoustitle = page->GetName();
1799 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1800 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1802 nb->AddPage(page, previoustitle);
1806 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1808 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1809 nb->AddPage(sw, title);
1810 nb->ChangeSelection(0);
1812 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1813 wxDefaultSize, style, title);
1814 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1815 wxString toptitle = m_pListbook->GetPageText(parent);
1816 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1817 m_pListbook->SetSelection(0);
1818 m_pListbook->DeletePage(parent + 1);
1822 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1828 bool options::DeletePluginPage(wxScrolledWindow* page) {
1829 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1830 wxNotebookPage* pg = m_pListbook->GetPage(i);
1831 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
1834 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1835 wxNotebookPage* spg = nb->GetPage(j);
1838 if (nb->GetPageCount() != 1)
return TRUE;
1840 spg = nb->GetPage(0);
1841 spg->Reparent(m_pListbook);
1843 wxString toptitle = m_pListbook->GetPageText(i);
1844 m_pListbook->DeletePage(i);
1845 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1849 }
else if (pg == page) {
1851 m_pListbook->DeletePage(i);
1852 wxPanel* panel =
new wxPanel(m_pListbook);
1853 wxString toptitle = m_pListbook->GetPageText(i);
1854 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1861 void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1862 int group_item_spacing) {
1863 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1865 comm_dialog = std::make_shared<ConnectionsDialog>(m_pNMEAForm,
this);
1869 void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1870 int group_item_spacing) {
1871 itemPanelShip = AddPage(parent, _(
"Own ship"));
1873 ownShip =
new wxBoxSizer(wxVERTICAL);
1874 itemPanelShip->SetSizer(ownShip);
1877 wxStaticBox* osdBox =
1878 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1879 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1880 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1882 wxFlexGridSizer* dispOptionsGrid =
1883 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1884 dispOptionsGrid->AddGrowableCol(1);
1885 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1887 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1888 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1889 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1891 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1892 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
1894 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
1895 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
1896 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
1898 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1899 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
1901 wxStaticText* iconTypeTxt =
1902 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
1903 dispOptionsGrid->Add(iconTypeTxt, 0);
1905 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
1906 _(
"Real Scale Vector")};
1908 m_pShipIconType =
new wxChoice(
1909 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
1910 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
1911 dispOptionsGrid->Add(m_pShipIconType, 0,
1912 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
1913 group_item_spacing);
1915 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
1916 realSizes->AddGrowableCol(1);
1918 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
1921 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
1923 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
1924 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1927 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
1929 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1930 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1933 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
1935 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1936 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1938 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
1939 _(
"GPS Offset from Midship (m)")),
1941 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1942 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1945 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
1947 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1948 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1951 wxFlexGridSizer* rrSelect =
1952 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
1953 rrSelect->AddGrowableCol(1);
1954 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
1956 wxStaticText* rrTxt =
1957 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
1958 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
1960 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
1961 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
1962 _T(
"8" ), _T(
"9" ), _T(
"10" )};
1963 pNavAidRadarRingsNumberVisible =
1964 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
1965 m_pShipIconType->GetSize(), 11, rrAlt);
1966 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
1967 group_item_spacing);
1969 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1970 radarGrid->AddGrowableCol(1);
1971 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
1973 wxStaticText* distanceText =
1974 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
1975 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
1977 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL, _T(
""),
1978 wxDefaultPosition, wxSize(100, -1), 0);
1979 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
1980 group_item_spacing);
1982 wxStaticText* unitText =
1983 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
1984 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
1986 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"), _(
"Minutes (time)")};
1987 m_itemRadarRingsUnits =
1988 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
1989 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
1990 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
1992 wxStaticText* colourText =
1993 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Colour"));
1994 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
1997 itemPanelShip, wxID_ANY, *wxRED, wxDefaultPosition,
1998 m_colourPickerDefaultSize, 0, wxDefaultValidator,
1999 _T(
"ID_COLOUROSRANGECOLOUR" ));
2000 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2003 wxFlexGridSizer* shipToActiveGrid =
2004 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2005 shipToActiveGrid->AddGrowableCol(1);
2006 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2007 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2008 _(
"Show direction to Active Waypoint"));
2009 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2012 wxStaticText* shipToActiveText1 =
2013 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2014 shipToActiveGrid->Add(shipToActiveText1, 1,
2015 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2017 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"),
2018 _(
"Dot"), _(
"Long dash"),
2020 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2021 m_shipToActiveStyle =
2022 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2023 LineStyleNChoices, LineStyleChoices, 0);
2024 m_shipToActiveStyle->SetSelection(0);
2025 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2027 wxStaticText* shipToActiveText2 =
2028 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2029 shipToActiveGrid->Add(shipToActiveText2, 1,
2030 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2032 wxString m_LineColorChoices[] = {
2033 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2034 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2035 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2036 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2038 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2039 m_shipToActiveColor =
2040 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2041 LineColorNChoices, m_LineColorChoices, 0);
2042 m_shipToActiveColor->SetSelection(0);
2043 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2046 wxStaticBox* trackText =
2047 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2048 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2049 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2050 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2052 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2053 _(
"Automatic Daily Tracks at midnight"));
2055 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2058 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2060 #if wxUSE_TIMEPICKCTRL
2061 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2064 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2065 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2066 wxDefaultPosition, wxDefaultSize, 0);
2069 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2070 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2071 wxDefaultPosition, wxDefaultSize, 0);
2073 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2077 pTrackRotateComputerTime =
2078 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2079 wxDefaultPosition, wxDefaultSize, 0);
2080 trackSizer1->Add(pTrackRotateComputerTime, 0,
2081 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2084 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2085 wxDefaultPosition, wxDefaultSize, 0);
2086 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2090 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2091 wxDefaultPosition, wxDefaultSize, 0);
2092 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2095 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2097 wxFlexGridSizer* hTrackGrid =
2098 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2099 hTrackGrid->AddGrowableCol(1);
2100 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2103 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2104 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2106 wxStaticText* trackColourText =
2107 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Colour"));
2108 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2111 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2112 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2113 _T(
"ID_COLOURTRACKCOLOUR" ));
2114 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2116 wxFlexGridSizer* pTrackGrid =
2117 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2118 pTrackGrid->AddGrowableCol(1);
2119 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2121 wxStaticText* tpText =
2122 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2123 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2125 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2126 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2127 m_pShipIconType->GetSize(), 3, trackAlt);
2128 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2129 group_item_spacing);
2132 wxStaticBox* ownshipcalcText =
2133 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Calculate values"));
2134 wxStaticBoxSizer* ownshipcalcSizer =
2135 new wxStaticBoxSizer(ownshipcalcText, wxVERTICAL);
2136 ownShip->Add(ownshipcalcSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2138 wxFlexGridSizer* dispOwnShipCalcOptionsGrid =
2139 new wxFlexGridSizer(2, 2, group_item_spacing, group_item_spacing);
2140 ownshipcalcSizer->Add(dispOwnShipCalcOptionsGrid, 0, wxTOP | wxALL | wxEXPAND,
2143 dispOwnShipCalcOptionsGrid->AddGrowableCol(1);
2145 pSogCogFromLLCheckBox =
2146 new wxCheckBox(itemPanelShip, ID_SOGCOGFROMLLCHECKBOX,
2147 _(
"Calculate SOG and COG from position changes"));
2148 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLCheckBox, 1, wxALL, 5);
2149 dispOwnShipCalcOptionsGrid->AddSpacer(0);
2151 wxStaticText* SogCogFromLLDampIntText =
new wxStaticText(
2152 itemPanelShip, wxID_STATIC, _(
"Min seconds between updates"));
2153 dispOwnShipCalcOptionsGrid->Add(SogCogFromLLDampIntText, 1, wxEXPAND | wxALL,
2154 group_item_spacing);
2156 pSogCogFromLLDampInterval =
new wxSpinCtrl(
2157 itemPanelShip, ID_SOGCOGDAMPINTTEXTCTRL, wxEmptyString, wxDefaultPosition,
2158 wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0);
2160 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLDampInterval, 0,
2161 wxALIGN_RIGHT | wxALL, group_item_spacing);
2166 void options::CreatePanel_Routes(
size_t parent,
int border_size,
2167 int group_item_spacing) {
2168 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2170 Routes =
new wxBoxSizer(wxVERTICAL);
2171 itemPanelRoutes->SetSizer(Routes);
2173 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2175 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
2176 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
2177 _T(
"8" ), _T(
"9" ), _T(
"10" )};
2180 wxStaticBox* routeText =
2181 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2182 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2183 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2185 wxStaticBox* activeRouteText =
2186 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2187 wxStaticBoxSizer* activeRouteSizer =
2188 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2190 m_persist_active_route_chkbox =
new wxCheckBox(
2191 itemPanelRoutes, wxID_ANY,
2192 _(
"Persist active route, automatically activate on start up"));
2193 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2194 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2196 routeSizer->AddSpacer(5);
2199 wxFlexGridSizer* routepointiconSelect =
2200 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2201 routepointiconSelect->AddGrowableCol(1);
2202 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2205 wxStaticText* routepointiconTxt =
2206 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2207 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2208 group_item_spacing);
2211 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2212 0, NULL, wxCB_READONLY);
2213 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2214 wxALIGN_RIGHT | wxALL, group_item_spacing);
2216 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2219 int min_size = GetCharHeight() * 2;
2220 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2221 pRoutepointDefaultIconChoice->SetMinSize(
2222 wxSize(GetCharHeight() * 15, min_size));
2224 routeSizer->AddSpacer(5);
2226 wxFlexGridSizer* pRouteGrid =
2227 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2228 pRouteGrid->AddGrowableCol(1);
2229 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2231 wxStaticText* raText =
new wxStaticText(
2232 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Arrival Circle Radius (NMi)"));
2233 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2235 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2236 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2237 group_item_spacing);
2239 pAdvanceRouteWaypointOnArrivalOnly =
2240 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2241 _(
"Advance route waypoint on arrival only"));
2242 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2245 Routes->AddSpacer(8 * group_item_spacing);
2247 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2248 wxDefaultSize, wxLI_HORIZONTAL);
2249 Routes->Add(pln, 0, wxEXPAND);
2253 wxStaticBox* waypointText =
2254 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2255 wxStaticBoxSizer* waypointSizer =
2256 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2257 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2259 waypointSizer->AddSpacer(5);
2262 wxFlexGridSizer* waypointiconSelect =
2263 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2264 waypointiconSelect->AddGrowableCol(1);
2265 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2268 wxStaticText* waypointiconTxt =
2269 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2270 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2271 group_item_spacing);
2274 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2275 0, NULL, wxCB_READONLY);
2276 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2277 group_item_spacing);
2279 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2282 int rmin_size = GetCharHeight() * 2;
2283 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2284 pWaypointDefaultIconChoice->SetMinSize(
2285 wxSize(GetCharHeight() * 15, rmin_size));
2287 waypointSizer->AddSpacer(5);
2289 wxFlexGridSizer* ScaMinSizer =
2290 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2291 ScaMinSizer->AddGrowableCol(1);
2292 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2294 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2295 _(
"Show marks only at a chartscale greater than 1 :"));
2296 ScaMinSizer->Add(pScaMinChckB, 0);
2297 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2298 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2299 group_item_spacing);
2302 pScaMinOverruleChckB =
2303 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2304 _(
"Override the settings for chartscale based visibility "
2305 "and show always"));
2306 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2308 waypointSizer->AddSpacer(5);
2310 wxFlexGridSizer* waypointrrSelect =
2311 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2312 waypointrrSelect->AddGrowableCol(1);
2313 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2316 wxStaticText* waypointrrTxt =
2317 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2318 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2320 pWaypointRangeRingsNumber =
2321 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2322 m_pShipIconType->GetSize(), 11, rrAlt);
2323 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2324 group_item_spacing);
2327 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2328 waypointradarGrid->AddGrowableCol(1);
2329 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2331 wxStaticText* waypointdistanceText =
new wxStaticText(
2332 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2333 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2334 group_item_spacing);
2336 pWaypointRangeRingsStep =
2337 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
2338 wxSize(100, -1), 0);
2339 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2340 group_item_spacing);
2342 wxStaticText* waypointunitText =
2343 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2344 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2345 group_item_spacing);
2347 m_itemWaypointRangeRingsUnits =
2348 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2349 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2350 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2351 wxALIGN_RIGHT | wxALL, border_size);
2353 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2354 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colours"));
2355 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2358 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2359 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2360 _T(
"ID_COLOURWAYPOINTRANGERINGSCOLOUR" ));
2361 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2362 wxALIGN_RIGHT | wxALL, 1);
2367 Routes->AddSpacer(8 * group_item_spacing);
2368 wxStaticLine* pln1 =
2369 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2370 wxDefaultSize, wxLI_HORIZONTAL);
2371 Routes->Add(pln1, 0, wxEXPAND);
2374 wxStaticBox* waypointControl =
2375 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2376 wxStaticBoxSizer* ControlSizer =
2377 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2378 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2380 ControlSizer->AddSpacer(5);
2382 pWayPointPreventDragging =
new wxCheckBox(
2383 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2384 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2385 pWayPointPreventDragging->SetValue(FALSE);
2386 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2388 pConfirmObjectDeletion =
2389 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2390 _(
"Confirm deletion of tracks and routes"));
2391 pConfirmObjectDeletion->SetValue(FALSE);
2392 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2393 ControlSizer->AddSpacer(5);
2396 pWaypointDefaultIconChoice->Clear();
2398 bool fillCombo =
true;
2401 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2402 wxString* ps = pWayPointMan->GetIconDescription(i);
2403 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2405 pWaypointDefaultIconChoice->Append(*ps, bmp);
2410 int iconToSelect = -1;
2411 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2412 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2414 pWaypointDefaultIconChoice->Select(iconToSelect);
2420 pRoutepointDefaultIconChoice->Clear();
2425 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2426 wxString* ps = pWayPointMan->GetIconDescription(i);
2427 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2429 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2435 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2436 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2438 pRoutepointDefaultIconChoice->Select(iconToSelect);
2446 void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2447 int group_item_spacing) {
2448 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2450 chartPanel =
new wxBoxSizer(wxVERTICAL);
2451 chartPanelWin->SetSizer(chartPanel);
2453 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2454 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2455 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2457 m_scrollWinChartList =
new wxScrolledWindow(
2458 chartPanelWin, wxID_ANY, wxDefaultPosition,
2459 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2461 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2468 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2470 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2471 m_scrollWinChartList->SetSizer(boxSizerCharts);
2473 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2474 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2476 wxString b1 = _(
"Add Directory...");
2477 wxString b2 = _(
"Remove Selected");
2478 wxString b3 = _(
"Compress Selected");
2486 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2487 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2489 cmdButtonSizer->AddSpacer(GetCharHeight());
2491 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2492 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2493 m_removeBtn->Disable();
2495 cmdButtonSizer->AddSpacer(GetCharHeight());
2497 #ifdef OCPN_USE_LZMA
2498 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2499 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2500 m_compressBtn->Disable();
2502 m_compressBtn = NULL;
2506 if (g_Android_SDK_Version >= 30) {
2508 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2509 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2513 cmdButtonSizer->AddSpacer(GetCharHeight());
2515 wxStaticBox* itemStaticBoxUpdateStatic =
2516 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2517 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2518 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2519 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2521 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2522 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2524 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2525 _(
"Scan Charts and Update Database"));
2526 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2528 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2529 _(
"Force Full Database Rebuild"));
2530 itemFlexGridSizerUpdate->Add(pUpdateCheckBox, 1, wxALL, 5);
2532 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2533 _(
"Prepare all ENC Charts"));
2534 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2536 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2539 ActiveChartArray.Clear();
2540 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2541 ActiveChartArray.Add(m_CurrentDirList[i]);
2544 UpdateChartDirList();
2546 chartPanel->Layout();
2550 void options::UpdateChartDirList() {
2552 m_scrollWinChartList->GetSizer()->Clear(
true);
2553 m_scrollWinChartList->ClearBackground();
2555 panelVector.clear();
2558 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2561 wxSize(-1, -1), ActiveChartArray[i]);
2562 chartPanel->SetSelected(
false);
2564 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2566 panelVector.push_back(chartPanel);
2569 m_scrollWinChartList->GetSizer()->Layout();
2571 chartPanelWin->ClearBackground();
2572 chartPanelWin->Layout();
2581 wxSize sza = GetSize();
2586 m_scrollWinChartList->GetParent()->Layout();
2589 m_scrollWinChartList->Scroll(0, 0);
2592 void options::UpdateTemplateTitleText() {
2593 if (!m_templateTitleText)
return;
2595 wxString activeTitle;
2596 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2597 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2599 bool configCompare =
2600 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2601 if (!configCompare) activeTitle += _(
" [Modified]");
2602 m_templateTitleText->SetLabel(activeTitle);
2604 m_templateTitleText->SetLabel(_(
"None"));
2607 void options::CreatePanel_Configs(
size_t parent,
int border_size,
2608 int group_item_spacing) {
2609 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2615 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2616 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2620 wxStaticBox* templateStatusBox =
2621 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2622 m_templateStatusBoxSizer =
2623 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2624 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2627 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2628 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2630 m_staticTextLastAppled =
new wxStaticText(
2631 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2632 m_staticTextLastAppled->Hide();
2634 statSizer->Add(m_staticTextLastAppled);
2636 m_templateTitleText =
2637 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2638 statSizer->Add(m_templateTitleText);
2639 m_templateTitleText->Hide();
2641 UpdateTemplateTitleText();
2643 wxStaticBox* configsBox =
2644 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2645 wxStaticBoxSizer* configSizer =
2646 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2647 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2649 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2650 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2652 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2653 cPanel->SetSizer(boxSizercPanel);
2655 m_scrollWinConfigList =
2656 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2657 wxBORDER_RAISED | wxVSCROLL);
2658 m_scrollWinConfigList->SetScrollRate(1, 1);
2659 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2661 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2663 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2664 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2666 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2667 configSizer->Add(btnSizer);
2670 wxButton* createButton =
2671 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2672 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2673 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2674 wxCommandEventHandler(options::OnCreateConfig), NULL,
2682 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2683 _(
"Delete Selected Config..."));
2684 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2685 group_item_spacing);
2686 m_configDeleteButton->Connect(
2687 wxEVT_COMMAND_BUTTON_CLICKED,
2688 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2690 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2691 _(
"Apply Selected Config"));
2692 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2693 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2694 wxCommandEventHandler(options::OnApplyConfig),
2701 SetConfigButtonState();
2705 void options::ClearConfigList() {
2706 if (m_scrollWinConfigList) {
2707 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2708 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2709 wxWindowListNode* node = kids.Item(i);
2710 wxWindow* win = node->GetData();
2711 wxPanel* pcp = wxDynamicCast(win, wxPanel);
2720 SetConfigButtonState();
2723 void options::BuildConfigList() {
2724 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2726 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2728 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2730 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2731 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2732 pp->Connect(wxEVT_LEFT_DOWN,
2733 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2737 wxWindowList kids = pp->GetChildren();
2738 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2739 wxWindowListNode* node = kids.Item(i);
2740 wxWindow* win = node->GetData();
2741 win->Connect(wxEVT_LEFT_DOWN,
2742 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2748 m_boxSizerConfigs->Layout();
2750 m_selectedConfigPanelGUID = _T(
"");
2751 SetConfigButtonState();
2754 void options::SetConfigButtonState() {
2755 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2756 if (m_selectedConfigPanelGUID.StartsWith(
2758 m_configDeleteButton->Disable();
2759 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2762 void options::OnCreateConfig(wxCommandEvent& event) {
2764 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2766 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2767 if (retcode == wxID_OK) {
2768 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2769 UpdateTemplateTitleText();
2773 m_DisplayConfigsPage->Layout();
2775 SetConfigButtonState();
2779 void options::OnEditConfig(wxCommandEvent& event) {}
2781 void options::OnDeleteConfig(wxCommandEvent& event) {
2782 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2784 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2785 m_selectedConfigPanelGUID = _T(
"");
2790 m_DisplayConfigsPage->Layout();
2791 SetConfigButtonState();
2794 void options::OnApplyConfig(wxCommandEvent& event) {
2795 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2798 wxString currentLocale = g_locale;
2802 evt.SetId(ID_APPLY);
2806 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2810 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2811 wxString activeTitle =
2812 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2813 m_templateTitleText->SetLabel(activeTitle);
2814 m_templateTitleText->Show();
2815 m_staticTextLastAppled->Show();
2816 m_templateStatusBoxSizer->Layout();
2818 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2819 _(
"OpenCPN Info"), wxOK);
2822 if (m_scrollWinConfigList) {
2823 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2824 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2825 wxWindowListNode* node = kids.Item(i);
2826 wxWindow* win = node->GetData();
2827 wxPanel* pcp = wxDynamicCast(win, wxPanel);
2831 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2836 m_selectedConfigPanelGUID = wxEmptyString;
2838 m_returnChanges |= CONFIG_CHANGED;
2840 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2845 void options::OnConfigMouseSelected(wxMouseEvent& event) {
2846 wxPanel* selectedPanel = NULL;
2847 wxObject* obj =
event.GetEventObject();
2849 wxPanel* panel = wxDynamicCast(obj, wxPanel);
2851 selectedPanel = panel;
2855 wxWindow* win = wxDynamicCast(obj, wxWindow);
2857 wxPanel* parentpanel = wxDynamicCast(win->GetParent(), wxPanel);
2859 selectedPanel = parentpanel;
2864 if (m_scrollWinConfigList) {
2865 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2866 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2867 wxWindowListNode* node = kids.Item(i);
2868 wxWindow* win = node->GetData();
2869 wxPanel* panel = wxDynamicCast(win, wxPanel);
2871 if (panel == selectedPanel) {
2872 panel->SetBackgroundColour(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
2874 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
2876 panel->SetBackgroundColour(m_panelBackgroundUnselected);
2878 panel->Refresh(
true);
2882 m_DisplayConfigsPage->Layout();
2883 SetConfigButtonState();
2887 void options::CreatePanel_Advanced(
size_t parent,
int border_size,
2888 int group_item_spacing) {
2889 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
2892 wxSize sz = g_Platform->getDisplaySize();
2893 double dpmm = g_Platform->GetDisplayDPmm();
2895 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2896 m_ChartDisplayPage->SetSizer(wrapperSizer);
2898 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
2901 itemBoxSizerUI->Add(0, border_size * 3);
2902 itemBoxSizerUI->Add(0, border_size * 3);
2905 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
2906 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
2908 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
2909 _(
"De-skew Raster Charts"));
2910 boxCharts->Add(pSkewComp, inputFlags);
2912 itemBoxSizerUI->Add(0, border_size * 3);
2913 itemBoxSizerUI->Add(0, border_size * 3);
2917 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
2918 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
2920 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
2921 _(
"Use Accelerated Graphics (OpenGL)"));
2922 OpenGLSizer->Add(pOpenGL, inputFlags);
2923 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
2925 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
2926 _(
"OpenGL Options") + _T(
"..."));
2927 OpenGLSizer->Add(bOpenGL, inputFlags);
2928 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
2930 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
2931 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
2936 itemBoxSizerUI->Add(0, border_size * 3);
2937 itemBoxSizerUI->Add(0, border_size * 3);
2941 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
2942 _(
"Chart Rotation Averaging Time"));
2944 wrapperSizer->Add(crat, 0,
2945 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
2946 group_item_spacing);
2948 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
2949 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
2952 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
2953 wxDefaultPosition, wxSize(sz.x / 5, -1), wxTE_RIGHT);
2954 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
2955 group_item_spacing);
2957 pCOGUPFilterRow->Add(
2958 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
2961 itemBoxSizerUI->Add(0, border_size * 3);
2962 itemBoxSizerUI->Add(0, border_size * 3);
2965 wxStaticText* zoomTextHead =
new wxStaticText(
2966 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
2967 zoomTextHead->Wrap(-1);
2968 itemBoxSizerUI->Add(
2970 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
2971 group_item_spacing);
2972 itemBoxSizerUI->Add(0, border_size * 1);
2974 itemBoxSizerUI->Add(
2975 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
2978 m_pSlider_Zoom_Raster =
2979 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
2980 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
2983 prepareSlider(m_pSlider_Zoom_Raster);
2986 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
2988 itemBoxSizerUI->Add(
2989 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
2992 m_pSlider_Zoom_Vector =
2993 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
2994 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
2997 prepareSlider(m_pSlider_Zoom_Vector);
3000 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3002 itemBoxSizerUI->Add(
3003 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3005 m_pSlider_CM93_Zoom =
3006 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3007 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3008 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3011 prepareSlider(m_pSlider_CM93_Zoom);
3014 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3016 itemBoxSizerUI->Add(0, border_size * 3);
3017 itemBoxSizerUI->Add(0, border_size * 3);
3018 itemBoxSizerUI->Add(0, border_size * 3);
3021 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3022 _(
"Physical Screen Width")),
3024 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3025 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3027 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3028 pDPIRow->Add(pRBSizeAuto, inputFlags);
3029 pDPIRow->AddSpacer(10);
3030 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3031 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3032 pDPIRow->Add(pRBSizeManual, inputFlags);
3034 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3035 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3038 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3039 wxDefaultPosition, wxSize(sz.x / 5, -1), wxTE_RIGHT);
3040 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3042 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3045 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3046 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3048 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3049 wxCommandEventHandler(options::OnSizeManualButton),
3055 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3056 itemBoxSizerUI->SetHGap(border_size);
3063 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3064 m_ChartDisplayPage->SetSizer(wrapperSizer);
3065 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3068 itemBoxSizerUI->Add(0, border_size * 3);
3069 itemBoxSizerUI->Add(0, border_size * 3);
3072 itemBoxSizerUI->Add(
3073 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3075 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3076 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3078 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3079 _(
"Show Skewed Raster Charts as North-Up"));
3080 boxCharts->Add(pSkewComp, verticleInputFlags);
3098 itemBoxSizerUI->Add(0, border_size * 3);
3099 itemBoxSizerUI->Add(0, border_size * 3);
3102 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3103 _(
"Chart Rotation Averaging Time")),
3105 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3106 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3107 group_item_spacing);
3110 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3111 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
3112 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3114 pCOGUPFilterRow->Add(
3115 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3119 itemBoxSizerUI->Add(0, border_size * 8);
3120 itemBoxSizerUI->Add(0, border_size * 8);
3123 wxStaticText* zoomTextHead =
new wxStaticText(
3124 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3126 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3127 itemBoxSizerUI->Add(0, border_size * 1);
3128 itemBoxSizerUI->Add(0, border_size * 1);
3130 wxStaticText* zoomText =
new wxStaticText(
3131 m_ChartDisplayPage, wxID_ANY,
3132 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3133 With a higher value, the same zoom level shows a more detailed chart."));
3135 smallFont = *dialogFont;
3137 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3139 zoomText->SetFont(smallFont);
3140 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3148 itemBoxSizerUI->Add(
3149 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3151 m_pSlider_Zoom_Raster =
3152 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3153 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3156 prepareSlider(m_pSlider_Zoom_Raster);
3159 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3161 itemBoxSizerUI->Add(
3162 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3164 m_pSlider_Zoom_Vector =
3165 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3166 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3169 prepareSlider(m_pSlider_Zoom_Vector);
3172 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3175 itemBoxSizerUI->Add(0, border_size * 3);
3176 itemBoxSizerUI->Add(0, border_size * 3);
3178 itemBoxSizerUI->Add(
3179 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3181 m_pSlider_CM93_Zoom =
3182 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3183 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3184 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3187 prepareSlider(m_pSlider_CM93_Zoom);
3190 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3193 itemBoxSizerUI->Add(0, border_size * 3);
3194 itemBoxSizerUI->Add(0, border_size * 3);
3195 itemBoxSizerUI->Add(0, border_size * 3);
3196 itemBoxSizerUI->Add(0, border_size * 3);
3197 itemBoxSizerUI->Add(0, border_size * 3);
3198 itemBoxSizerUI->Add(0, border_size * 3);
3201 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3202 _(
"Physical Screen Width")),
3204 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3205 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3207 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3208 pDPIRow->Add(pRBSizeAuto, inputFlags);
3209 pDPIRow->AddSpacer(10);
3210 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3211 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3212 pDPIRow->Add(pRBSizeManual, inputFlags);
3214 pScreenMM =
new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3215 wxDefaultPosition, wxSize(3 * m_fontHeight, -1),
3217 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3219 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3222 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3223 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3225 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3226 wxCommandEventHandler(options::OnSizeManualButton),
3230 itemBoxSizerUI->Add(0, border_size * 3);
3231 itemBoxSizerUI->Add(0, border_size * 3);
3236 itemBoxSizerUI->Add(
3237 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3239 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3240 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3242 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3243 _(
"Use Accelerated Graphics (OpenGL)"));
3244 OpenGLSizer->Add(pOpenGL, inputFlags);
3245 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3247 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3248 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3254 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3255 _(
"Options") + _T(
"..."));
3256 OpenGLSizer->Add(bOpenGL, inputFlags);
3257 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3261 itemBoxSizerUI->Add(0, border_size * 3);
3262 itemBoxSizerUI->Add(0, border_size * 3);
3267 itemBoxSizerUI->Add(
3268 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3270 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3271 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3273 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3274 _(
"Show extended chart bar information."));
3275 ChartBarSizer->Add(pChartBarEX, inputFlags);
3287 m_ChartDisplayPage->Fit();
3291 void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3292 int group_item_spacing) {
3293 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3296 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3297 ps57Ctl->SetSizer(vectorPanel);
3300 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3301 optionsColumn->SetHGap(border_size);
3302 optionsColumn->AddGrowableCol(0, 2);
3303 optionsColumn->AddGrowableCol(1, 3);
3304 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3307 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3308 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3313 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3315 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3316 _(
"Mariner's Standard")};
3317 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3318 wxDefaultSize, 4, pDispCatStrings);
3319 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3323 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3324 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3327 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3330 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3331 optionsColumn->Add(miscSizer, groupInputFlags);
3335 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3336 pCheck_SOUNDG->SetValue(FALSE);
3337 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3340 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3341 _(
"Chart Information Objects"));
3342 pCheck_META->SetValue(FALSE);
3343 miscSizer->Add(pCheck_META, verticleInputFlags);
3346 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3349 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3350 optionsColumn->Add(lightSizer, groupInputFlags);
3353 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3354 pCheck_ATONTEXT->SetValue(FALSE);
3355 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3358 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3359 pCheck_LDISTEXT->SetValue(FALSE);
3360 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3362 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3363 _(
"Extended Light Sectors"));
3364 pCheck_XLSECTTEXT->SetValue(FALSE);
3365 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3368 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3371 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3372 optionsColumn->Add(textSizer, groupInputFlags);
3374 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3375 _(
"National text on chart"));
3376 pCheck_NATIONALTEXT->SetValue(FALSE);
3377 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3379 pCheck_SHOWIMPTEXT =
3380 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3381 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3382 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3385 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3386 pCheck_DECLTEXT->SetValue(FALSE);
3387 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3389 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3391 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3392 _(
"Reduced Detail at Small Scale"));
3393 pCheck_SCAMIN->SetValue(FALSE);
3394 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3396 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3398 pCheck_SuperSCAMIN =
new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3399 _(
"Additional detail reduction at Small Scale"));
3400 pCheck_SuperSCAMIN->SetValue(FALSE);
3401 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3404 optionsColumn->Add(0, border_size * 4);
3405 optionsColumn->Add(0, border_size * 4);
3408 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3410 wxString pPointStyleStrings[] = {
3414 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3415 wxDefaultSize, 2, pPointStyleStrings);
3416 optionsColumn->Add(pPointStyle, inputFlags);
3418 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3420 wxString pBoundStyleStrings[] = {
3424 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3425 wxDefaultSize, 2, pBoundStyleStrings);
3426 optionsColumn->Add(pBoundStyle, inputFlags);
3428 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3430 wxString pColorNumStrings[] = {
3434 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3435 wxDefaultSize, 2, pColorNumStrings);
3436 optionsColumn->Add(p24Color, inputFlags);
3439 optionsColumn->Add(0, border_size * 4);
3440 optionsColumn->Add(0, border_size * 4);
3443 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3445 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3446 optionsColumn->Add(depShalRow);
3448 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3449 wxSize(60, -1), wxTE_RIGHT);
3450 depShalRow->Add(m_ShallowCtl, inputFlags);
3451 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3452 depShalRow->Add(m_depthUnitsShal, inputFlags);
3454 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3456 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3457 optionsColumn->Add(depSafeRow);
3458 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""),
3459 wxDefaultPosition, wxSize(60, -1), wxTE_RIGHT);
3460 depSafeRow->Add(m_SafetyCtl, inputFlags);
3461 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3462 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3464 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3466 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3467 optionsColumn->Add(depDeepRow);
3468 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""),
3469 wxDefaultPosition, wxSize(60, -1), wxTE_RIGHT);
3470 depDeepRow->Add(m_DeepCtl, inputFlags);
3471 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3472 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3475 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3476 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3478 wxStaticBox* marinersBox =
3479 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3480 wxStaticBoxSizer* marinersSizer =
3481 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3482 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3485 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3486 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3488 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3489 itemButtonSelectList =
3490 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3491 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3492 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3493 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3494 marinersSizer->Add(btnRow1);
3496 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3498 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3499 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3500 marinersSizer->Add(btnRow2);
3505 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3506 ps57Ctl->SetSizer(vectorPanel);
3508 wxBoxSizer* optionsColumn = vectorPanel;
3511 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3516 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3518 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3519 _(
"Mariner's Standard")};
3520 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3521 wxSize(350, -1), 4, pDispCatStrings);
3522 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3525 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3530 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3531 optionsColumn->Add(miscSizer, groupInputFlags);
3534 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3535 pCheck_SOUNDG->SetValue(FALSE);
3536 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3538 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3539 _(
"Chart Information Objects"));
3540 pCheck_META->SetValue(FALSE);
3541 miscSizer->Add(pCheck_META, inputFlags);
3543 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3544 optionsColumn->Add(lightSizer, groupInputFlags);
3547 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3548 pCheck_ATONTEXT->SetValue(FALSE);
3549 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3552 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3553 pCheck_LDISTEXT->SetValue(FALSE);
3554 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3556 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3557 _(
"Extended Light Sectors"));
3558 pCheck_XLSECTTEXT->SetValue(FALSE);
3559 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3561 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3562 optionsColumn->Add(textSizer, groupInputFlags);
3564 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3565 _(
"National text on chart"));
3566 pCheck_NATIONALTEXT->SetValue(FALSE);
3567 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3569 pCheck_SHOWIMPTEXT =
3570 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3571 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3572 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3575 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3576 pCheck_DECLTEXT->SetValue(FALSE);
3577 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3579 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3580 _(
"Reduced Detail at Small Scale"));
3581 pCheck_SCAMIN->SetValue(FALSE);
3582 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3584 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3586 pCheck_SuperSCAMIN =
new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3587 _(
"Additional detail reduction at Small Scale"));
3588 pCheck_SuperSCAMIN->SetValue(FALSE);
3589 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3592 optionsColumn->Add(0, border_size * 4);
3593 optionsColumn->Add(0, border_size * 4);
3597 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3598 StyleColumn->SetHGap(border_size);
3599 StyleColumn->AddGrowableCol(0, 2);
3600 StyleColumn->AddGrowableCol(1, 3);
3601 optionsColumn->Add(StyleColumn);
3603 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3605 wxString pPointStyleStrings[] = {
3609 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3610 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3611 pPointStyleStrings);
3613 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3616 StyleColumn->Add(pPointStyle, inputFlags);
3618 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3620 wxString pBoundStyleStrings[] = {
3624 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3625 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3626 pBoundStyleStrings);
3628 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3631 StyleColumn->Add(pBoundStyle, inputFlags);
3633 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3636 wxString pColorNumStrings[] = {
3640 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3641 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3644 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3646 StyleColumn->Add(p24Color, inputFlags);
3649 optionsColumn->Add(0, border_size * 4);
3650 optionsColumn->Add(0, border_size * 4);
3652 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3653 DepthColumn->SetHGap(border_size);
3654 DepthColumn->AddGrowableCol(0, 3);
3655 DepthColumn->AddGrowableCol(1, 2);
3656 DepthColumn->AddGrowableCol(2, 3);
3657 optionsColumn->Add(DepthColumn);
3660 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3663 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3664 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3665 DepthColumn->Add(m_ShallowCtl, inputFlags);
3666 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3667 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3669 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3672 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3673 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3674 DepthColumn->Add(m_SafetyCtl, inputFlags);
3675 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3676 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3678 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3681 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3682 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3683 DepthColumn->Add(m_DeepCtl, inputFlags);
3684 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3685 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3688 optionsColumn->Add(0, border_size * 4);
3689 optionsColumn->Add(0, border_size * 4);
3692 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3693 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3695 wxStaticBox* marinersBox =
3696 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3697 wxStaticBoxSizer* marinersSizer =
3698 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3699 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3701 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3702 itemButtonSelectList =
3703 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3704 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3705 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3706 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3707 marinersSizer->Add(btnRow1);
3709 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3711 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3712 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3713 marinersSizer->Add(btnRow2);
3716 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3718 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3722 void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3723 int group_item_spacing) {
3724 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3726 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3727 tcPanel->SetSizer(mainHBoxSizer);
3729 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3730 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3731 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3734 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3735 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3737 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3741 tcDataSelected->DeleteAllItems();
3746 col0.SetText(_T(
""));
3748 col0.SetAlign(wxLIST_FORMAT_LEFT);
3750 tcDataSelected->InsertColumn(0, col0);
3753 unsigned int id = 0;
3754 for (
auto ds : TideCurrentDataSet) {
3757 tcDataSelected->InsertItem(li);
3759 wxString setName = ds;
3760 tcDataSelected->SetItem(
id, 0, setName);
3761 GetTextExtent(setName, &w1, &h);
3762 w = w1 > w ? w1 : w;
3765 tcDataSelected->SetColumnWidth(0, 20 + w);
3768 wxButton* insertButton =
3769 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3770 wxButton* removeButton =
3771 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3773 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3774 tcSizer->Add(btnSizer);
3776 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3777 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3780 void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3781 int group_item_spacing) {
3786 wxNotebook *chartsPageNotebook = (wxNotebook *)m_pListbook->GetPage(parent);
3787 wxScrolledWindow *sw =
new ChartGroupsUI(chartsPageNotebook);
3788 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3789 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3792 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3795 void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3796 int group_item_spacing) {
3798 m_border_size = border_size;
3799 m_group_item_spacing = group_item_spacing;
3801 m_UIcomplete = FALSE;
3806 void ChartGroupsUI::CompletePanel(
void) {
3808 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3809 m_panel->SetSizer(m_topSizer);
3812 wxStaticText* allChartsLabel =
3813 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3814 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3816 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3817 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3819 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3820 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3824 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE, _T(
""),
3825 wxDefaultPosition, wxDefaultSize, wxVSCROLL);
3828 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE, _T(
""),
3829 wxDefaultPosition, wxDefaultSize, wxVSCROLL);
3831 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3833 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3834 m_pAddButton->Disable();
3835 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3836 m_pRemoveButton->Disable();
3838 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3839 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3841 m_pRemoveButton->Connect(
3842 wxEVT_COMMAND_BUTTON_CLICKED,
3843 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3845 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3846 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3847 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3849 sizerCharts->AddSpacer(20);
3852 wxStaticText* groupsLabel =
3853 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3854 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3856 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
3857 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
3859 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
3860 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
3861 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
3862 wxDefaultSize, wxNB_TOP);
3863 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
3865 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
3866 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
3870 wxPanel* allActiveGroup =
3871 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
3872 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
3874 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
3875 allActiveGroup->SetSizer(page0BoxSizer);
3877 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1, _T(
""),
3878 wxDefaultPosition, wxDefaultSize);
3881 iFont =
new wxFont(*dialogFont);
3882 iFont->SetStyle(wxFONTSTYLE_ITALIC);
3883 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
3885 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
3887 m_DirCtrlArray.Add(defaultAllCtl);
3891 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
3892 m_pDeleteGroupButton =
3893 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
3894 m_pDeleteGroupButton->Disable();
3896 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3897 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
3899 m_pDeleteGroupButton->Connect(
3900 wxEVT_COMMAND_BUTTON_CLICKED,
3901 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
3904 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
3905 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
3907 newDeleteGrp->AddSpacer(25);
3908 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
3909 m_group_item_spacing);
3910 newDeleteGrp->AddSpacer(15);
3911 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
3912 m_group_item_spacing);
3913 newDeleteGrp->AddSpacer(25);
3914 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3916 sizerGroups->AddSpacer(20);
3920 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
3921 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
3924 m_UIcomplete = TRUE;
3927 void options::CreatePanel_Display(
size_t parent,
int border_size,
3928 int group_item_spacing) {
3929 pDisplayPanel = AddPage(parent, _(
"General"));
3932 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
3933 generalSizer->SetHGap(border_size);
3940 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3941 pDisplayPanel->SetSizer(wrapperSizer);
3942 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
3945 generalSizer->Add(0, border_size * 4);
3946 generalSizer->Add(0, border_size * 4);
3951 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
3953 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
3954 generalSizer->Add(boxNavMode, groupInputFlags);
3956 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
3957 boxNavMode->Add(rowOrientation);
3959 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
3960 rowOrientation->Add(pCBNorthUp, inputFlags);
3962 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
3963 rowOrientation->Add(pCBCourseUp,
3965 .Align(wxALIGN_CENTRE_VERTICAL)
3966 .Border(wxLEFT, group_item_spacing * 2));
3968 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
3969 _(
"Look Ahead Mode"));
3970 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
3973 generalSizer->Add(0, border_size * 4);
3974 generalSizer->Add(0, border_size * 4);
3978 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
3980 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3981 generalSizer->Add(boxCharts, groupInputFlags);
3983 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
3984 _(
"Enable Chart Quilting"));
3985 boxCharts->Add(pCDOQuilting, verticleInputFlags);
3988 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
3989 _(
"Preserve scale when switching charts"));
3990 boxCharts->Add(pPreserveScale, verticleInputFlags);
3993 generalSizer->Add(0, border_size * 4);
3994 generalSizer->Add(0, border_size * 4);
3998 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4000 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4001 generalSizer->Add(boxCtrls, groupInputFlags);
4003 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4004 _(
"Smooth Panning / Zooming"));
4005 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4007 pEnableZoomToCursor =
4008 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4009 pEnableZoomToCursor->SetValue(FALSE);
4010 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4013 generalSizer->Add(0, border_size * 4);
4014 generalSizer->Add(0, border_size * 4);
4019 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4021 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4022 generalSizer->Add(boxDisp, groupInputFlags);
4025 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4026 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4028 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4029 _(
"Show Chart Outlines"));
4030 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4032 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4033 _(
"Show Depth Units"));
4034 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4044 generalSizer->Add(0, border_size * 4);
4045 generalSizer->Add(0, border_size * 4);
4049 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4051 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4052 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4055 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4056 _(
"Live ETA at Cursor"));
4057 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4061 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4062 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4064 m_Text_def_boat_speed =
new wxStaticText( pDisplayPanel, wxID_ANY,
4065 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4067 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4068 pSDefaultBoatSpeed =
4069 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED, _T(
""),
4070 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4071 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4072 group_item_spacing);
4079 if (g_Platform->GetDisplayAreaCM2() > 100) {
4080 wxStaticBox* itemStaticBoxScreenConfig =
4081 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4082 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4083 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4084 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4087 wxString iconDir = g_Platform->GetSharedDataDir();
4088 appendOSDirSlash(&iconDir);
4089 iconDir.append(_T(
"uidata"));
4090 appendOSDirSlash(&iconDir);
4091 iconDir.append(_T(
"MUI_flat"));
4092 appendOSDirSlash(&iconDir);
4093 int bmpSize = GetCharHeight() * 3;
4096 LoadSVG(iconDir + _T(
"MUI_Sconfig_1.svg"), bmpSize, bmpSize);
4097 m_sconfigSelect_single =
4099 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4102 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4104 bmp = LoadSVG(iconDir + _T(
"MUI_Sconfig_2.svg"), bmpSize, bmpSize);
4105 m_sconfigSelect_twovertical =
4107 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4110 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4115 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4116 generalSizer->SetHGap(border_size);
4123 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4124 pDisplayPanel->SetSizer(wrapperSizer);
4125 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4128 generalSizer->Add(0, border_size * 4);
4129 generalSizer->Add(0, border_size * 4);
4134 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4136 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4137 generalSizer->Add(boxNavMode, groupInputFlags);
4139 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4140 boxNavMode->Add(rowOrientation);
4142 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4143 rowOrientation->Add(pCBNorthUp, inputFlags);
4145 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4146 rowOrientation->Add(pCBCourseUp,
4148 .Align(wxALIGN_CENTRE_VERTICAL)
4149 .Border(wxLEFT, group_item_spacing * 2));
4151 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4152 _(
"Look Ahead Mode"));
4153 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4156 generalSizer->Add(0, border_size * 4);
4157 generalSizer->Add(0, border_size * 4);
4161 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4163 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4164 generalSizer->Add(boxCharts, groupInputFlags);
4166 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4167 _(
"Enable Chart Quilting"));
4168 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4171 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4172 _(
"Preserve scale when switching charts"));
4173 boxCharts->Add(pPreserveScale, verticleInputFlags);
4176 generalSizer->Add(0, border_size * 4);
4177 generalSizer->Add(0, border_size * 4);
4181 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4183 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4184 generalSizer->Add(boxCtrls, groupInputFlags);
4186 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4187 _(
"Smooth Panning / Zooming"));
4188 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4189 pEnableZoomToCursor =
4190 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4191 pEnableZoomToCursor->SetValue(FALSE);
4192 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4195 pSmoothPanZoom->Hide();
4196 pEnableZoomToCursor->Hide();
4200 generalSizer->Add(0, border_size * 4);
4201 generalSizer->Add(0, border_size * 4);
4206 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4208 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4209 generalSizer->Add(boxDisp, groupInputFlags);
4212 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4213 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4215 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4216 _(
"Show Chart Outlines"));
4217 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4219 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4220 _(
"Show Depth Units"));
4221 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4231 generalSizer->Add(0, border_size * 4);
4232 generalSizer->Add(0, border_size * 4);
4236 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4238 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4239 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4242 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4243 _(
"Live ETA at Cursor"));
4244 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4248 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4249 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4250 defaultBoatSpeedSizer->Add(
4251 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Default Boat Speed ")),
4252 groupLabelFlagsHoriz);
4253 pSDefaultBoatSpeed =
4254 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED, _T(
""),
4255 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4256 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4257 group_item_spacing);
4263 if (g_Platform->GetDisplayAreaCM2() > 100) {
4265 wxStaticBox* itemStaticBoxScreenConfig =
4266 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4267 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4268 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4269 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4272 wxString iconDir = g_Platform->GetSharedDataDir();
4273 appendOSDirSlash(&iconDir);
4274 iconDir.append(_T(
"uidata"));
4275 appendOSDirSlash(&iconDir);
4276 iconDir.append(_T(
"MUI_flat"));
4277 appendOSDirSlash(&iconDir);
4278 int bmpSize = GetCharHeight() * 3;
4281 LoadSVG(iconDir + _T(
"MUI_Sconfig_1.svg"), bmpSize, bmpSize);
4282 m_sconfigSelect_single =
4284 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4287 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4289 bmp = LoadSVG(iconDir + _T(
"MUI_Sconfig_2.svg"), bmpSize, bmpSize);
4290 m_sconfigSelect_twovertical =
4292 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4295 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4301 void options::CreatePanel_Units(
size_t parent,
int border_size,
4302 int group_item_spacing) {
4303 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4306 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4307 unitsSizer->SetHGap(border_size);
4311 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4312 panelUnits->SetSizer(wrapperSizer);
4314 wrapperSizer->Add(1, border_size * 24);
4315 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4318 unitsSizer->Add(0, border_size * 4);
4319 unitsSizer->Add(0, border_size * 4);
4322 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4324 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4325 _(
"Kilometers"), _(
"Meters")};
4326 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4328 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4329 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4332 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4334 unitsSizer->Add(pDistanceFormat, inputFlags);
4337 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4339 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4340 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4341 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4342 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4343 m_SpeedFormatsNChoices, pSpeedFormats);
4345 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4347 unitsSizer->Add(pSpeedFormat, inputFlags);
4350 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4352 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4353 int m_WindSpeedFormatsNChoices =
4354 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4356 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4357 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4360 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4362 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4365 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4367 wxString pDepthUnitStrings[] = {
4373 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4374 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4376 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4378 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4381 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4383 wxString pTempUnitStrings[] = {
4389 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4390 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4392 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4394 unitsSizer->Add(pTempFormat, inputFlags);
4397 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4398 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4401 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4403 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4404 _(
"Decimal Degrees"),
4405 _(
"Degrees, Minutes, Seconds")};
4406 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4407 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4408 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4409 m_SDMMFormatsNChoices, pSDMMFormats);
4411 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4413 unitsSizer->Add(pSDMMFormat, inputFlags);
4416 unitsSizer->Add(0, border_size * 4);
4417 unitsSizer->Add(0, border_size * 4);
4420 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4425 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4426 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4427 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4430 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4431 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4432 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4436 wxStaticBox* itemStaticBoxVar =
4437 new wxStaticBox(panelUnits, wxID_ANY, _T(
""));
4439 wxStaticBoxSizer* itemStaticBoxSizerVar =
4440 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4441 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4443 itemStaticBoxSizerVar->Add(0, border_size * 4);
4445 itemStaticTextUserVar =
4446 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4447 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4448 group_item_spacing);
4450 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4451 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4452 group_item_spacing);
4454 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL, _T(
""),
4455 wxDefaultPosition, wxSize(150, -1), wxTE_RIGHT);
4456 magVarSizer->AddSpacer(100);
4458 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4460 itemStaticTextUserVar2 =
4461 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4463 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4464 group_item_spacing);
4466 itemStaticBoxSizerVar->Add(0, border_size * 40);
4469 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4470 unitsSizer->SetHGap(border_size);
4474 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4475 panelUnits->SetSizer(wrapperSizer);
4476 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4479 unitsSizer->Add(0, border_size * 4);
4480 unitsSizer->Add(0, border_size * 4);
4483 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4485 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4486 _(
"Kilometers"), _(
"Meters")};
4487 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4488 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4489 wxDefaultPosition, wxDefaultSize,
4490 m_DistanceFormatsNChoices, pDistanceFormats);
4491 unitsSizer->Add(pDistanceFormat, inputFlags);
4494 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4496 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4497 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4499 new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE, wxDefaultPosition,
4500 wxDefaultSize, m_SpeedFormatsNChoices, pSpeedFormats);
4501 unitsSizer->Add(pSpeedFormat, inputFlags);
4504 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"WindSpeed")),
4506 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4507 int m_WindSpeedFormatsNChoices =
sizeof(pWindSpeedFormats) /
sizeof(wxString);
4509 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4510 wxDefaultSize, m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4511 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4514 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4516 wxString pDepthUnitStrings[] = {
4522 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4523 wxDefaultSize, 3, pDepthUnitStrings);
4524 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4527 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4529 wxString pTempUnitStrings[] = {
4535 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4536 wxDefaultSize, 3, pTempUnitStrings);
4537 unitsSizer->Add(pTempFormat, inputFlags);
4540 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4541 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4544 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4546 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4547 _(
"Decimal Degrees"),
4548 _(
"Degrees, Minutes, Seconds")};
4549 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4551 new wxChoice(panelUnits, ID_SDMMFORMATCHOICE, wxDefaultPosition,
4552 wxDefaultSize, m_SDMMFormatsNChoices, pSDMMFormats);
4553 unitsSizer->Add(pSDMMFormat, inputFlags);
4556 unitsSizer->Add(0, border_size * 4);
4557 unitsSizer->Add(0, border_size * 4);
4560 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4563 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4564 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4567 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4568 _(
"Show true bearings and headings"));
4569 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4570 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4571 _(
"Show magnetic bearings and headings."));
4572 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4574 bearingsSizer->AddSpacer(10);
4577 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4578 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4580 itemStaticTextUserVar =
4581 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4582 itemStaticTextUserVar->SetLabel(
4583 _(
"WMM Plugin calculated magnetic variation"));
4585 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4586 group_item_spacing);
4588 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL, _T(
""),
4589 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4590 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4592 itemStaticTextUserVar2 =
4593 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4594 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4595 group_item_spacing);
4597 bearingsSizer->AddSpacer(10);
4599 wxStaticText* varText =
4600 new wxStaticText(panelUnits, wxID_ANY,
4601 _(
" To set the magnetic variation manually,\n you "
4602 "must disable the WMM plugin."));
4603 smallFont = *dialogFont;
4604 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4606 varText->SetFont(smallFont);
4608 bearingsSizer->Add(varText);
4618 OCPNSoundPanel( wxWindow *parent, wxWindowID
id,
const wxPoint &pos,
const wxSize &size,
4620 wxString checkLegend,
4621 wxString selectLegend,
4622 wxString *pSoundFile
4627 void OnButtonSelectSound(wxCommandEvent& event);
4628 void OnButtonSPTestSound(wxCommandEvent& event);
4629 wxString SelectSoundFile();
4630 void SetSoundFileLabel(wxString file);
4631 wxCheckBox *GetCheckBox(){
return m_pCheck_Sound; }
4632 wxString GetSoundFile(){
return m_sound_file;}
4634 wxCheckBox *m_pCheck_Sound;
4635 wxSize m_small_button_size;
4636 wxString m_sound_file;
4637 wxString *m_pSoundFile;
4638 wxStaticText *m_AudioFileNameText;
4641 wxButton* TestSound;
4648 bool m_soundPlaying;
4650 DECLARE_EVENT_TABLE()
4653 #define ID_SELECTSOUND 9341
4654 #define ID_TESTSOUND 9342
4658 EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4659 EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4666 wxString checkLegend,
4667 wxString selectLegend,
4668 wxString *pSoundFile)
4669 :wxPanel(parent,
id, pos, size, wxBORDER_NONE),
4670 m_soundPlaying(false)
4672 wxFont* pif = FontMgr::Get().GetFont(_T(
"Dialog"));
4675 m_pSoundFile = pSoundFile;
4677 m_sound_file = *pSoundFile;
4679 m_sound = SoundFactory();
4681 int border_size = 4;
4682 int group_item_spacing = 2;
4684 int font_size_y, font_descent, font_lead;
4685 GetTextExtent(_T(
"0"), NULL, &font_size_y, &font_descent, &font_lead);
4686 m_small_button_size =
4687 wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4690 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4691 SetSizer(wrapperSizer);
4693 wxStaticBox* StaticBox1 =
4694 new wxStaticBox(
this, wxID_ANY, title);
4695 wxStaticBoxSizer* StaticBoxSizer1 =
4696 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4697 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4699 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO,
4701 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4704 wxString LabelWrapped;
4710 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4711 for (
unsigned int i=0 ; i < LabelWrappedArray.GetCount() ; i++){
4712 LabelWrapped +=
"\n";
4714 LabelWrapped +=
"\n";
4717 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4718 m_AudioFileNameText->Wrap(-1);
4719 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4721 SetSoundFileLabel(m_sound_file);
4724 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4725 soundSizer1->SetHGap(border_size * 2);
4726 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4728 SelSound =
new wxButton(
4729 this, ID_SELECTSOUND, selectLegend,
4730 wxDefaultPosition, m_small_button_size, 0);
4731 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT,
4732 group_item_spacing);
4733 soundSizer1->AddSpacer(group_item_spacing * 4);
4734 TestSound =
new wxButton(
4735 this, ID_TESTSOUND, _(
"Test"),
4736 wxDefaultPosition, m_small_button_size, 0);
4737 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT,
4738 group_item_spacing);
4740 m_soundPlaying =
false;
4742 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4746 void OCPNSoundPanel::SetSoundFileLabel(wxString file)
4748 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " +
4752 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4753 wxString LabelWrapped;
4754 for (
unsigned int i=0 ; i < LabelWrappedArray.GetCount() ; i++){
4756 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4758 LabelWrapped += LabelWrappedArray[i];
4759 LabelWrapped +=
"\n";
4762 m_AudioFileNameText->SetLabel(LabelWrapped);
4768 wxString OCPNSoundPanel::SelectSoundFile() {
4769 wxString sound_dir = g_Platform->GetSharedDataDir();
4770 sound_dir.Append(_T(
"sounds"));
4775 wxFileDialog* popenDialog =
new wxFileDialog(
4776 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4777 _T(
"WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN);
4779 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
4781 response = popenDialog->ShowModal();
4782 sel_file = popenDialog->GetPath();
4787 g_Platform->DoFileSelectorDialog(
this, &sel_file, _(
"Select Sound File"),
4788 sound_dir, wxEmptyString, wxT(
"*.*"));
4792 if (response == wxID_OK)
4793 return g_Platform->NormalizePath(sel_file);
4798 void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4799 wxString sel_file = SelectSoundFile();
4801 if (!sel_file.IsEmpty()) {
4802 m_sound_file = g_Platform->NormalizePath(sel_file);
4804 *m_pSoundFile = m_sound_file;
4806 SetSoundFileLabel(m_sound_file);
4811 void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
4812 if (!m_soundPlaying) {
4813 m_sound->SetFinishedCallback(
4815 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
4816 m_soundPlaying =
true;
4825 void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent &event) {
4826 if (event.IsChecked())
4827 m_pCheck_AlertAudio->SetValue(
true );
4829 if (!m_soundPanelSART->GetCheckBox()->GetValue()
4830 && !m_soundPanelDSC->GetCheckBox()->GetValue())
4831 m_pCheck_AlertAudio->SetValue(
false );
4835 void options::OnUXAudioEnableButtonClickSART(wxCommandEvent &event) {
4836 if (event.IsChecked())
4837 m_pCheck_AlertAudio->SetValue(
true );
4839 if (!m_soundPanelAIS->GetCheckBox()->GetValue()
4840 && !m_soundPanelDSC->GetCheckBox()->GetValue())
4841 m_pCheck_AlertAudio->SetValue(
false );
4845 void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent &event) {
4846 if (event.IsChecked())
4847 m_pCheck_AlertAudio->SetValue(
true );
4849 if (!m_soundPanelAIS->GetCheckBox()->GetValue()
4850 && !m_soundPanelSART->GetCheckBox()->GetValue())
4851 m_pCheck_AlertAudio->SetValue(
false );
4855 void options::CreatePanel_Sounds(
size_t parent,
int border_size,
4856 int group_item_spacing) {
4858 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
4860 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4861 panelSounds->SetSizer(wrapperSizer);
4865 wxDefaultPosition, wxDefaultSize,
4867 _(
"Play Sound on Anchor Alarm."),
4868 _(
"Select Anchor Alarm Sound"),
4869 &g_anchorwatch_sound_file
4871 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
4876 wxDefaultPosition, wxDefaultSize,
4878 _(
"Play Sound on AIS Alert."),
4879 _(
"Select AIS Alert Sound"),
4882 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
4884 m_soundPanelAIS->GetCheckBox()->Connect(
4885 wxEVT_COMMAND_CHECKBOX_CLICKED,
4886 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
4891 wxDefaultPosition, wxDefaultSize,
4893 _(
"Play Sound on AIS SART Alert."),
4894 _(
"Select AIS SART Alert Sound"),
4897 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
4899 m_soundPanelSART->GetCheckBox()->Connect(
4900 wxEVT_COMMAND_CHECKBOX_CLICKED,
4901 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
4906 wxDefaultPosition, wxDefaultSize,
4908 _(
"Play Sound on DSC notification."),
4909 _(
"Select DSC notification Sound"),
4912 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
4914 m_soundPanelDSC->GetCheckBox()->Connect(
4915 wxEVT_COMMAND_CHECKBOX_CLICKED,
4916 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
4920 wxStaticBox* StatBoxSoundConfig =
4921 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
4922 wxStaticBoxSizer* StatBoxSoundConfigSizer =
4923 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
4924 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
4926 auto sound = std::unique_ptr<OcpnSound>(SoundFactory());
4927 int deviceCount = sound->DeviceCount();
4928 wxLogMessage(
"options: got device count: %d", deviceCount);
4929 if (deviceCount >= 1) {
4930 wxArrayString labels;
4931 for (
int i = 0; i < deviceCount; i += 1) {
4932 wxString label(sound->GetDeviceInfo(i));
4934 std::ostringstream stm;
4936 label = _(
"Unknown device :") + stm.str();
4938 if (!sound->IsOutputDevice(i)) {
4939 std::ostringstream stm;
4941 label = _(
"Input device :") + stm.str();
4948 int iDefault = labels.Index(
"default");
4950 if (g_iSoundDeviceIndex == -1) {
4952 g_iSoundDeviceIndex = iDefault;
4954 g_iSoundDeviceIndex = 0;
4958 pSoundDeviceIndex =
new wxChoice();
4959 if (pSoundDeviceIndex) {
4960 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
4961 wxDefaultSize, labels);
4962 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
4963 pSoundDeviceIndex->Show();
4964 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
4965 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
4966 group_item_spacing);
4968 stSoundDeviceIndex =
4969 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
4970 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
4971 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
4976 if ((
bool)
dynamic_cast<SystemCmdSound*
>(SoundFactory())) {
4977 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
4978 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND, group_item_spacing);
4980 new wxTextCtrl(panelSounds, wxID_ANY, _T(
"" ), wxDefaultPosition,
4981 wxSize(450, -1), wxTE_LEFT);
4983 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
4984 wxALIGN_LEFT | wxALL);
4985 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
4990 StatBoxSoundConfig->Hide();
4993 stSoundDeviceIndex->Hide();
4994 pSoundDeviceIndex->Hide();
4999 void options::CreatePanel_MMSI(
size_t parent,
int border_size,
5000 int group_item_spacing) {
5001 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
5003 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
5004 panelMMSI->SetSizer(MMSISizer);
5007 wxStaticBox* itemStaticBoxMMSI =
5008 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
5009 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
5010 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
5011 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
5015 pPropsPanel->UpdateMMSIList();
5017 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
5019 panelMMSI->Layout();
5022 void options::CreatePanel_AIS(
size_t parent,
int border_size,
5023 int group_item_spacing) {
5024 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5026 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5027 panelAIS->SetSizer(aisSizer);
5030 wxStaticBox* itemStaticBoxCPA =
5031 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5032 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5033 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5034 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5036 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5037 pCPAGrid->AddGrowableCol(1);
5038 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5040 m_pCheck_CPA_Max =
new wxCheckBox(
5042 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5043 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5045 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5046 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5049 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5050 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5053 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5054 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5056 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5057 wxCommandEventHandler(options::OnCPAWarnClick),
5060 m_pCheck_CPA_WarnT =
5061 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5062 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5064 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5065 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5066 group_item_spacing);
5069 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5070 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5071 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5073 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5074 pLostGrid->AddGrowableCol(1);
5075 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5077 m_pCheck_Mark_Lost =
5078 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5079 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5081 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5082 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5083 group_item_spacing);
5085 m_pCheck_Remove_Lost =
5086 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5087 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5089 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5090 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5091 group_item_spacing);
5093 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5096 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5097 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5098 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5100 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5101 pDisplayGrid->AddGrowableCol(1);
5102 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5104 m_pCheck_Show_COG =
new wxCheckBox(
5105 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5106 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5108 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5109 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5110 group_item_spacing);
5112 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5113 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5114 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5115 m_pCheck_Sync_OCOG_ACOG->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5116 wxCommandEventHandler(options::OnSyncCogPredClick),
5119 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1, _T(
""));
5120 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5122 m_pCheck_Show_Tracks =
5123 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5124 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5126 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5127 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5128 group_item_spacing);
5130 m_pCheck_Hide_Moored =
new wxCheckBox(
5131 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5132 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5134 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5135 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5136 group_item_spacing);
5138 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5139 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5140 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5141 group_item_spacing);
5143 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5144 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5145 group_item_spacing);
5147 m_pCheck_Scale_Priority =
new wxCheckBox(
5149 _(
"Allow attenuation of less critical targets if more than ... targets"));
5150 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5152 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5153 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5154 group_item_spacing);
5156 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5157 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5158 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5160 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1, _T(
""));
5161 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5163 m_pCheck_Draw_Target_Size =
5164 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5165 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5167 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1, _T(
""));
5168 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5170 m_pCheck_Show_Target_Name =
new wxCheckBox(
5171 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5172 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5174 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5175 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5176 group_item_spacing);
5178 m_pCheck_use_Wpl =
new wxCheckBox(
5179 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5180 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5182 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5183 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5184 wxDefaultSize, 2, Wpl_Action);
5185 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5188 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5189 wxStaticBoxSizer* rolloverSizer =
5190 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5191 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5193 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5194 _(
"Enable route/AIS info block"));
5195 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5197 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5198 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5202 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5203 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5205 m_pCheck_Rollover_Class =
5206 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5207 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5209 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5210 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5212 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5213 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5216 wxStaticBox* alertBox =
5217 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5218 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5219 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5221 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5222 pAlertGrid->AddGrowableCol(1);
5223 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5225 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5226 _(
"Show CPA/TCPA Alert Dialog"));
5227 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5229 m_pCheck_AlertDialog->Connect(
5230 wxEVT_COMMAND_CHECKBOX_CLICKED,
5231 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5240 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1, _T(
""));
5241 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5243 m_pCheck_AlertAudio =
new wxCheckBox(
5244 panelAIS, ID_AISALERTAUDIO,
5245 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5246 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5248 m_pCheck_AlertAudio->Connect(
5249 wxEVT_COMMAND_CHECKBOX_CLICKED,
5250 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5253 wxButton* m_pPlay_Sound =
5254 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"),
5255 wxDefaultPosition, m_small_button_size, 0);
5256 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5258 m_pPlay_Sound->Connect(
5259 wxEVT_COMMAND_BUTTON_CLICKED,
5260 wxCommandEventHandler(options::OnButtonTestSound), NULL,
5266 m_pCheck_Alert_Moored =
new wxCheckBox(
5267 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5268 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5270 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1, _T(
""));
5271 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5273 m_pCheck_Ack_Timout =
new wxCheckBox(
5274 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5275 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5277 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5278 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5279 group_item_spacing);
5287 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5291 GetHandle()->setStyleSheet(getQtStyleSheet());
5296 void options::CreatePanel_UI(
size_t parent,
int border_size,
5297 int group_item_spacing) {
5298 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5300 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5301 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5303 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5304 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5306 wxStaticBox* itemLangStaticBox =
5307 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5308 wxStaticBoxSizer* itemLangStaticBoxSizer =
5309 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5311 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5313 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG);
5315 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5318 m_itemLangListBox->Disable();
5321 wxStaticBox* itemFontStaticBox =
5322 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5324 wxSize fontChoiceSize = wxSize(-1, -1);
5326 int fLayout = wxHORIZONTAL;
5329 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5332 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5335 wxStaticBoxSizer* itemFontStaticBoxSizer =
5336 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5337 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5340 m_itemFontElementListBox =
5341 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5342 fontChoiceSize, 0, NULL, wxCB_SORT);
5344 int nFonts = FontMgr::Get().GetNumFonts();
5345 for (
int it = 0; it < nFonts; it++) {
5346 const wxString& t = FontMgr::Get().GetDialogString(it);
5348 if (FontMgr::Get().GetConfigString(it).StartsWith(g_locale)) {
5349 m_itemFontElementListBox->Append(t);
5353 if (nFonts) m_itemFontElementListBox->SetSelection(0);
5355 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5357 wxButton* itemFontChooseButton =
5358 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5359 wxDefaultPosition, wxDefaultSize, 0);
5360 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5361 #if defined(__WXGTK__) || defined(__WXQT__)
5362 wxButton* itemFontColorButton =
5363 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5364 wxDefaultPosition, wxDefaultSize, 0);
5365 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5367 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5368 wxDefaultPosition, wxDefaultSize, 0);
5369 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5374 wxStaticBox* itemStyleStaticBox =
5375 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5376 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5377 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5378 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5380 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5382 wxArrayPtrVoid styles = g_StyleManager->GetArrayOfStyles();
5383 for (
unsigned int i = 0; i < styles.Count(); i++) {
5385 m_itemStyleListBox->Append(style->name);
5387 m_itemStyleListBox->SetStringSelection(
5388 g_StyleManager->GetCurrentStyle()->name);
5389 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5392 wxStaticBox* miscOptionsBox =
5393 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5394 wxStaticBoxSizer* miscOptions =
5395 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5396 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5399 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5400 pShowStatusBar->SetValue(FALSE);
5401 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5404 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5405 pShowMenuBar->SetValue(FALSE);
5406 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5410 pShowMenuBar->Hide();
5413 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5414 pShowChartBar->SetValue(g_bShowChartBar);
5415 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5417 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5418 _(
"Show Compass/GPS Status Window"));
5419 pShowCompassWin->SetValue(FALSE);
5420 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5422 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5423 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5425 pToolbarAutoHideCB =
5426 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5427 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5430 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
5431 wxSize(50, -1), wxTE_RIGHT);
5432 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5434 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5435 group_item_spacing);
5437 wxBoxSizer* pShipsBellsSizer =
new wxBoxSizer(wxHORIZONTAL);
5438 miscOptions->Add(pShipsBellsSizer, 0, wxALL, group_item_spacing);
5441 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5442 pShipsBellsSizer->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5445 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5446 _(
"Enable Touchscreen interface"));
5447 miscOptions->Add(pMobile, 0, wxALL, border_size);
5449 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5450 _(
"Enable Scaled Graphics interface"));
5451 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5456 pResponsive->Hide();
5460 pResponsive->Hide();
5463 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5464 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5466 pZoomButtons->Hide();
5469 pInlandEcdis =
new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX,
5470 _(
"Use Inland ECDIS"));
5471 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5473 wxButton* itemEcdisHelp =
5474 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5475 wxDefaultPosition, wxDefaultSize, 0);
5476 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5479 pInlandEcdis->Hide();
5480 itemEcdisHelp->Hide();
5483 miscOptions->AddSpacer(10);
5485 wxFlexGridSizer* sliderSizer;
5486 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5487 sliderSizer->AddGrowableCol(1);
5488 sliderSizer->SetFlexibleDirection(wxBOTH);
5489 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5491 m_pSlider_GUI_Factor =
5492 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5493 m_sliderSize, SLIDER_STYLE);
5494 m_pSlider_GUI_Factor->Hide();
5495 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5496 _(
"User Interface scale factor")),
5498 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5499 m_pSlider_GUI_Factor->Show();
5502 prepareSlider(m_pSlider_GUI_Factor);
5505 m_pSlider_Chart_Factor =
5506 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5507 m_sliderSize, SLIDER_STYLE);
5508 m_pSlider_Chart_Factor->Hide();
5510 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5512 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5513 m_pSlider_Chart_Factor->Show();
5516 prepareSlider(m_pSlider_Chart_Factor);
5519 m_pSlider_Ship_Factor =
5520 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5521 m_sliderSize, SLIDER_STYLE);
5522 m_pSlider_Ship_Factor->Hide();
5524 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5526 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5527 m_pSlider_Ship_Factor->Show();
5530 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5533 m_pSlider_Text_Factor =
5534 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5535 m_sliderSize, SLIDER_STYLE);
5536 m_pSlider_Text_Factor->Hide();
5538 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5540 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5541 m_pSlider_Text_Factor->Show();
5544 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5547 m_pSlider_ENCText_Factor =
5548 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5549 m_sliderSize, SLIDER_STYLE);
5550 m_pSlider_ENCText_Factor->Hide();
5552 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5554 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5555 m_pSlider_ENCText_Factor->Show();
5558 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5562 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Mouse wheel zoom sensitivity")),
5564 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5565 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5567 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5568 miscOptions->AddSpacer(20);
5571 void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5572 m_pCheck_AlertAudio->Enable(event.IsChecked());
5573 if (!event.IsChecked())
5574 m_pCheck_AlertAudio->SetValue(
false );
5577 void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5578 if (event.IsChecked()) {
5579 m_soundPanelAIS->GetCheckBox()->SetValue(
true );
5580 m_soundPanelSART->GetCheckBox()->SetValue(
true );
5581 m_soundPanelDSC->GetCheckBox()->SetValue(
true );
5585 void options::CreateListbookIcons() {
5588 if (!g_bresponsive) {
5591 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5593 #if wxCHECK_VERSION(2, 8, 12)
5594 m_topImgList->Add(style->GetIcon(_T(
"Display"), sx, sy));
5595 m_topImgList->Add(style->GetIcon(_T(
"Charts"), sx, sy));
5596 m_topImgList->Add(style->GetIcon(_T(
"Connections"), sx, sy));
5597 m_topImgList->Add(style->GetIcon(_T(
"Ship"), sx, sy));
5598 m_topImgList->Add(style->GetIcon(_T(
"UI"), sx, sy));
5599 m_topImgList->Add(style->GetIcon(_T(
"Plugins"), sx, sy));
5603 bmp = style->GetIcon(_T(
"Display"));
5604 img = bmp.ConvertToImage();
5605 img.ConvertAlphaToMask(128);
5606 bmp = wxBitmap(img);
5607 m_topImgList->Add(bmp);
5608 bmp = style->GetIcon(_T(
"Charts"));
5609 img = bmp.ConvertToImage();
5610 img.ConvertAlphaToMask(128);
5611 bmp = wxBitmap(img);
5612 m_topImgList->Add(bmp);
5613 bmp = style->GetIcon(_T(
"Connections"));
5614 img = bmp.ConvertToImage();
5615 img.ConvertAlphaToMask(128);
5616 bmp = wxBitmap(img);
5617 m_topImgList->Add(bmp);
5618 bmp = style->GetIcon(_T(
"Ship"));
5619 img = bmp.ConvertToImage();
5620 img.ConvertAlphaToMask(128);
5621 bmp = wxBitmap(img);
5622 m_topImgList->Add(bmp);
5623 bmp = style->GetIcon(_T(
"UI"));
5624 img = bmp.ConvertToImage();
5625 img.ConvertAlphaToMask(128);
5626 bmp = wxBitmap(img);
5627 m_topImgList->Add(bmp);
5628 bmp = style->GetIcon(_T(
"Plugins"));
5629 img = bmp.ConvertToImage();
5630 img.ConvertAlphaToMask(128);
5631 bmp = wxBitmap(img);
5632 m_topImgList->Add(bmp);
5636 bmps = style->GetIcon(_T(
"Display"));
5637 int base_size = bmps.GetWidth();
5638 double tool_size = base_size;
5640 double premult = 1.0;
5644 double target_size = 6.0;
5646 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5647 premult = target_size / basic_tool_size_mm;
5650 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5651 postmult = wxMin(postmult, 3.0);
5652 postmult = wxMax(postmult, 1.0);
5654 int sizeTab = base_size * postmult * premult;
5656 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5660 bmp = style->GetIcon(_T(
"Display"));
5661 img = bmp.ConvertToImage();
5662 simg = img.Scale(sizeTab, sizeTab);
5663 bmp = wxBitmap(simg);
5664 m_topImgList->Add(bmp);
5665 bmp = style->GetIcon(_T(
"Charts"));
5666 img = bmp.ConvertToImage();
5667 simg = img.Scale(sizeTab, sizeTab);
5668 bmp = wxBitmap(simg);
5669 m_topImgList->Add(bmp);
5670 bmp = style->GetIcon(_T(
"Connections"));
5671 img = bmp.ConvertToImage();
5672 simg = img.Scale(sizeTab, sizeTab);
5673 bmp = wxBitmap(simg);
5674 m_topImgList->Add(bmp);
5675 bmp = style->GetIcon(_T(
"Ship"));
5676 img = bmp.ConvertToImage();
5677 simg = img.Scale(sizeTab, sizeTab);
5678 bmp = wxBitmap(simg);
5679 m_topImgList->Add(bmp);
5680 bmp = style->GetIcon(_T(
"UI"));
5681 img = bmp.ConvertToImage();
5682 simg = img.Scale(sizeTab, sizeTab);
5683 bmp = wxBitmap(simg);
5684 m_topImgList->Add(bmp);
5685 bmp = style->GetIcon(_T(
"Plugins"));
5686 img = bmp.ConvertToImage();
5687 simg = img.Scale(sizeTab, sizeTab);
5688 bmp = wxBitmap(simg);
5689 m_topImgList->Add(bmp);
5693 void options::CreateControls(
void) {
5694 int border_size = 4;
5696 int group_item_spacing = 2;
5698 int font_size_y, font_descent, font_lead;
5699 GetTextExtent(_T(
"0"), NULL, &font_size_y, &font_descent, &font_lead);
5700 m_fontHeight = font_size_y + font_descent + font_lead;
5704 wxSize(wxMin(m_fontHeight * 8, g_Platform->getDisplaySize().x / 2),
5705 m_fontHeight * 8 / 10);
5708 wxSize(wxMin(m_fontHeight * 8, g_Platform->getDisplaySize().x / 2),
5712 m_small_button_size =
5713 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5715 m_nCharWidthMax = GetSize().x / GetCharWidth();
5718 pEnableZoomToCursor = NULL;
5719 pSmoothPanZoom = NULL;
5724 width = g_monitor_info[g_current_monitor].width;
5725 height = g_monitor_info[g_current_monitor].height;
5727 if (!g_bresponsive && height <= 800) {
5729 group_item_spacing = 1;
5733 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
5734 inputFlags = wxSizerFlags(0)
5735 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
5736 .Border(wxALL, group_item_spacing);
5737 verticleInputFlags =
5738 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
5739 groupLabelFlags = wxSizerFlags(0)
5740 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
5741 .Border(wxALL, group_item_spacing);
5742 groupLabelFlagsHoriz =
5743 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
5744 groupInputFlags = wxSizerFlags(0)
5745 .Align(wxALIGN_LEFT | wxALIGN_TOP)
5746 .Border(wxBOTTOM, group_item_spacing * 2)
5750 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
5755 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
5756 itemDialog1->SetSizer(itemBoxSizer2);
5760 wxFont* qFont = dialogFont;
5762 wxString wqs = getFontQtStylesheet(qFont);
5763 wxCharBuffer sbuf = wqs.ToUTF8();
5764 QString qsb = QString(sbuf.data());
5766 QString qsbq = getQtStyleSheet();
5768 itemDialog1->GetHandle()->setStyleSheet(qsb +
5775 #ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5777 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
5778 wxSize(-1, -1), flags);
5779 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
5780 wxListbookEventHandler(options::OnPageChange), NULL,
5784 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
5785 wxSize(-1, -1), flags);
5786 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5787 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
5794 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
5798 CreateListbookIcons();
5800 m_pListbook->SetImageList(m_topImgList);
5801 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
5803 wxBoxSizer* buttons =
new wxBoxSizer(wxHORIZONTAL);
5804 itemBoxSizer2->Add(buttons, 0, wxALIGN_RIGHT | wxALL, border_size);
5806 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"OK"));
5807 m_OKButton->SetDefault();
5808 buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5810 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
5811 buttons->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5813 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
5814 buttons->Add(m_ApplyButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5816 m_pageDisplay = CreatePanel(_(
"Display"));
5817 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
5818 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
5819 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
5820 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
5822 m_pageCharts = CreatePanel(_(
"Charts"));
5823 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
5824 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
5827 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
5828 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
5831 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
5833 #ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5834 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5835 wxListbookEventHandler(options::OnChartsPageChange), NULL,
5838 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5839 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
5845 wxString ConnTab = _(
"Connections");
5846 if (g_Platform->GetDisplayDIPMult(gFrame) < 1)
5847 ConnTab = _(
"Connect");
5849 m_pageConnections = CreatePanel(ConnTab);
5851 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
5853 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
5859 m_pageShips = CreatePanel(_(
"Ships"));
5860 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
5861 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
5863 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
5866 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
5868 wxString UITab = _(
"User Interface");
5869 if (g_Platform->GetDisplayDIPMult(gFrame) < 1)
5872 m_pageUI = CreatePanel(UITab);
5873 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
5874 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
5876 m_pagePlugins = CreatePanel(_(
"Plugins"));
5877 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
5879 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
5880 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
5883 if (g_pi_manager) g_pi_manager->NotifySetupOptions();
5885 SetColorScheme(
static_cast<ColorScheme
>(0));
5896 SetSizeHints(-1, -1, width - marginx, height - marginy);
5906 void options::SetInitialPage(
int page_sel,
int sub_page) {
5907 if (page_sel < (
int)m_pListbook->GetPageCount())
5908 m_pListbook->SetSelection(page_sel);
5910 m_pListbook->SetSelection(0);
5912 if (sub_page >= 0) {
5913 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
5914 wxNotebookPage* pg = m_pListbook->GetPage(i);
5915 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
5917 if (i == (
size_t)page_sel) {
5918 if (sub_page < (
int)nb->GetPageCount())
5919 nb->SetSelection(sub_page);
5921 nb->SetSelection(0);
5923 nb->ChangeSelection(0);
5929 void options::SetColorScheme(ColorScheme cs) {
5932 #ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5933 wxListView* lv = m_pListbook->GetListView();
5934 lv->SetBackgroundColour(GetBackgroundColour());
5937 delete m_topImgList;
5938 CreateListbookIcons();
5939 m_pListbook->SetImageList(m_topImgList);
5947 void options::OnAISRolloverClick(wxCommandEvent& event) {
5948 m_pCheck_Rollover_Class->Enable(event.IsChecked());
5949 m_pCheck_Rollover_COG->Enable(event.IsChecked());
5950 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
5951 pStatic_CallSign->Enable(event.IsChecked());
5954 void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
5956 case ID_SCREENCONFIG1:
5957 if (m_sconfigSelect_twovertical)
5958 m_sconfigSelect_twovertical->SetSelected(
false);
5962 case ID_SCREENCONFIG2:
5963 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
5969 void options::SetInitialSettings(
void) {
5972 m_returnChanges = 0;
5973 m_bfontChanged =
false;
5975 b_oldhaveWMM = b_haveWMM;
5976 auto loader = PluginLoader::getInstance();
5977 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
5980 switch (g_canvasConfig) {
5983 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
5984 if (m_sconfigSelect_twovertical)
5985 m_sconfigSelect_twovertical->SetSelected(
false);
5988 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
5989 if (m_sconfigSelect_twovertical)
5990 m_sconfigSelect_twovertical->SetSelected(
true);
5993 m_screenConfig = g_canvasConfig;
5997 ActiveChartArray.Clear();
5998 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
5999 ActiveChartArray.Add(m_CurrentDirList[i]);
6003 if (m_pWorkDirList) {
6004 UpdateWorkArrayFromDisplayPanel();
6005 groupsPanel->SetDBDirs(*m_pWorkDirList);
6008 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6009 delete m_pGroupArray;
6010 m_pGroupArray = groupsPanel->CloneChartGroupArray(g_pGroupArray);
6011 groupsPanel->SetGroupArray(m_pGroupArray);
6012 groupsPanel->SetInitialSettings();
6016 pShowStatusBar->SetValue(g_bShowStatusBar);
6018 pShowMenuBar->SetValue(g_bShowMenuBar);
6020 pShowCompassWin->SetValue(g_bShowCompassWin);
6023 s.Printf(_T(
"%d"), g_COGAvgSec);
6024 pCOGUPUpdateSecs->SetValue(s);
6026 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6027 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6029 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6030 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6031 pMobile->SetValue(g_btouch);
6032 pResponsive->SetValue(g_bresponsive);
6033 pRollover->SetValue(g_bRollover);
6034 m_pCheck_Rollover_Class->Enable(g_bRollover);
6035 m_pCheck_Rollover_COG->Enable(g_bRollover);
6036 m_pCheck_Rollover_CPA->Enable(g_bRollover);
6037 pStatic_CallSign->Enable(g_bRollover);
6039 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6043 pInlandEcdis->SetValue(g_bInlandEcdis);
6045 pOpenGL->SetValue(g_bopengl);
6047 if (pSmoothPanZoom) pSmoothPanZoom->SetValue(g_bsmoothpanzoom);
6048 pCBTrueShow->SetValue(g_bShowTrue);
6049 pCBMagShow->SetValue(g_bShowMag);
6051 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6055 itemStaticTextUserVar->SetLabel(
6056 _(
"WMM Plugin calculated magnetic variation"));
6058 s.Printf(_T(
"%4.1f"), gVar);
6059 pMagVar->SetValue(s);
6061 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6063 s.Printf(_T(
"%4.1f"), g_UserVar);
6064 pMagVar->SetValue(s);
6067 int newLength = itemStaticTextUserVar->GetLabel().Length();
6070 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6071 wxSize sz = GetSize();
6072 SetSize(sz.x + 1, sz.y);
6076 itemStaticTextUserVar2->Enable(!b_haveWMM);
6077 pMagVar->Enable(!b_haveWMM);
6079 if (pSDisplayGrid) pSDisplayGrid->SetValue(g_bDisplayGrid);
6084 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6088 wxString stringDefaultBoatSpeed;
6089 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6090 g_defaultBoatSpeed = 6.0;
6091 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6093 stringDefaultBoatSpeed.Printf(_T(
"%d"), (
int)g_defaultBoatSpeedUserUnit);
6094 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6098 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6099 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6100 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6102 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6104 s.Printf(_T(
"%6.2f"), g_ownship_predictor_minutes);
6106 s.Printf(_T(
"%4.0f"), g_ownship_predictor_minutes);
6107 m_pText_OSCOG_Predictor->SetValue(s);
6109 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6110 g_ownship_HDTpredictor_miles) > 1e-4)
6111 s.Printf(_T(
"%6.2f"), g_ownship_HDTpredictor_miles);
6113 s.Printf(_T(
"%4.0f"), g_ownship_HDTpredictor_miles);
6114 m_pText_OSHDT_Predictor->SetValue(s);
6116 m_pShipIconType->SetSelection(g_OwnShipIconType);
6117 wxCommandEvent eDummy;
6118 OnShipTypeSelect(eDummy);
6119 m_pOSLength->SetValue(
6120 wxString::Format(_T(
"%.1f"), g_n_ownship_length_meters));
6121 m_pOSWidth->SetValue(wxString::Format(_T(
"%.1f"), g_n_ownship_beam_meters));
6122 m_pOSGPSOffsetX->SetValue(
6123 wxString::Format(_T(
"%.1f"), g_n_gps_antenna_offset_x));
6124 m_pOSGPSOffsetY->SetValue(
6125 wxString::Format(_T(
"%.1f"), g_n_gps_antenna_offset_y));
6126 m_pOSMinSize->SetValue(wxString::Format(_T(
"%d"), g_n_ownship_min_mm));
6127 m_pText_ACRadius->SetValue(
6128 wxString::Format(_T(
"%.3f"), g_n_arrival_circle_radius));
6131 if (g_iNavAidRadarRingsNumberVisible > 10)
6132 g_iNavAidRadarRingsNumberVisible = 10;
6133 pNavAidRadarRingsNumberVisible->SetSelection(
6134 g_iNavAidRadarRingsNumberVisible);
6135 buf.Printf(_T(
"%.3f"), g_fNavAidRadarRingsStep);
6136 pNavAidRadarRingsStep->SetValue(buf);
6137 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6138 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6140 pScaMinChckB->SetValue(g_bUseWptScaMin);
6141 m_pText_ScaMin->SetValue(wxString::Format(_T(
"%i"), g_iWpt_ScaMin));
6142 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6144 OnRadarringSelect(eDummy);
6146 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6147 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6148 buf.Printf(_T(
"%.3f"), g_fWaypointRangeRingsStep);
6149 pWaypointRangeRingsStep->SetValue(buf);
6150 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6151 m_colourWaypointRangeRingsColour->SetColour(g_colourWaypointRangeRingsColour);
6152 OnWaypointRangeRingSelect(eDummy);
6153 pShowshipToActive->SetValue(g_bShowShipToActive);
6154 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6155 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6157 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6158 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6160 pSogCogFromLLCheckBox->SetValue(g_own_ship_sog_cog_calc);
6161 pSogCogFromLLDampInterval->SetValue(g_own_ship_sog_cog_calc_damp_sec);
6163 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6165 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6166 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6168 if (pCmdSoundString)
6169 pCmdSoundString->SetValue(g_CmdSoundString);
6171 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6174 pSDMMFormat->Select(g_iSDMMFormat);
6175 pDistanceFormat->Select(g_iDistanceFormat);
6176 pSpeedFormat->Select(g_iSpeedFormat);
6177 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6178 pTempFormat->Select(g_iTempFormat);
6180 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6181 g_bAdvanceRouteWaypointOnArrivalOnly);
6183 pTrackDaily->SetValue(g_bTrackDaily);
6184 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6185 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6186 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6187 TIME_TYPE_COMPUTER);
6188 pTrackHighlite->SetValue(g_bHighliteTracks);
6189 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6190 pTrackPrecision->SetSelection(g_nTrackPrecision);
6192 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6196 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6198 s.Printf(_T(
"%4.1f"), g_CPAMax_NM);
6199 m_pText_CPA_Max->SetValue(s);
6201 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6203 s.Printf(_T(
"%4.1f"), g_CPAWarn_NM);
6204 m_pText_CPA_Warn->SetValue(s);
6206 if (m_pCheck_CPA_Warn->GetValue()) {
6207 m_pCheck_CPA_WarnT->Enable();
6208 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6210 m_pCheck_CPA_WarnT->Disable();
6212 s.Printf(_T(
"%4.0f"), g_TCPA_Max);
6213 m_pText_CPA_WarnT->SetValue(s);
6216 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6218 s.Printf(_T(
"%4.0f"), g_MarkLost_Mins);
6219 m_pText_Mark_Lost->SetValue(s);
6221 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6223 s.Printf(_T(
"%4.0f"), g_RemoveLost_Mins);
6224 m_pText_Remove_Lost->SetValue(s);
6227 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6229 s.Printf(_T(
"%4.0f"), g_ShowCOG_Mins);
6230 m_pText_COG_Predictor->SetValue(s);
6232 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6233 if(g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6235 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6237 s.Printf(_T(
"%4.0f"), g_AISShowTracks_Mins);
6238 m_pText_Track_Length->SetValue(s);
6240 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6242 s.Printf(_T(
"%4.1f"), g_ShowMoored_Kts);
6243 m_pText_Moored_Speed->SetValue(s);
6245 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6247 s.Printf(_T(
"%4.1f"), g_AIS_RealtPred_Kts);
6248 m_pText_RealtPred_Speed->SetValue(s);
6250 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6252 s.Printf(_T(
"%i"), g_ShowScaled_Num);
6253 m_pText_Scale_Priority->SetValue(s);
6255 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6257 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6258 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6260 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6262 s.Printf(_T(
"%d"), g_Show_Target_Name_Scale);
6263 m_pText_Show_Target_Name_Scale->SetValue(s);
6265 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6266 m_pWplAction->SetSelection(g_WplAction);
6269 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6270 if (g_bAIS_CPA_Alert) {
6271 m_pCheck_AlertAudio->Enable();
6272 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6275 m_pCheck_AlertAudio->Disable();
6276 m_pCheck_AlertAudio->SetValue(
false);
6280 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6282 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6283 s.Printf(_T(
"%4.0f"), g_AckTimeout_Mins);
6284 m_pText_ACK_Timeout->SetValue(s);
6287 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6288 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6289 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6292 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6293 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6294 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6296 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6297 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6299 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6300 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6301 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6302 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6303 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6304 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6306 if (!g_config_display_size_manual) {
6307 pRBSizeAuto->SetValue(TRUE);
6308 for (
const auto &mm : g_monitor_info) {
6309 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6311 screenmm.RemoveLast();
6312 pScreenMM->Disable();
6314 for (
const auto &mm : g_config_display_size_mm) {
6315 screenmm.Append(wxString::Format(
"%zu,", mm));
6317 screenmm.RemoveLast();
6318 pRBSizeManual->SetValue(TRUE);
6321 pScreenMM->SetValue(screenmm);
6324 pDepthUnitSelect->SetSelection(g_nDepthUnitDisplay);
6325 UpdateOptionsUnits();
6327 SetInitialVectorSettings();
6329 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6331 s.Printf(_T(
"%d"), g_nAutoHideToolbar);
6332 pToolbarHideSecs->SetValue(s);
6337 delete m_pSerialArray;
6338 m_pSerialArray = NULL;
6339 m_pSerialArray = EnumerateSerialPorts();
6341 comm_dialog->SetInitialSettings();
6343 m_bForceNewToolbaronCancel =
false;
6346 void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6347 if (ps57CtlListBox) {
6349 ps57CtlListBox->Clear();
6350 marinersStdXref.clear();
6352 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6354 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6357 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6358 item = ps52plib->OBJLDescriptions[iPtr];
6360 item = wxString(pOLE->OBJLName, wxConvUTF8);
6366 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6367 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6368 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6370 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6371 (catl == DISPLAYBASE))
6373 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6376 bool benable =
true;
6377 if (cat > 0) benable = cat != DISPLAYBASE;
6382 int newpos = ps57CtlListBox->Append(item, benable);
6383 marinersStdXref.push_back(newpos);
6384 for (
size_t i = 0; i < iPtr; i++) {
6385 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6389 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6391 if (cat == DISPLAYBASE) bviz =
true;
6394 if (cat == STANDARD) {
6399 ps57CtlListBox->Check(newpos, bviz);
6402 wxSize s = ps57CtlListBox->GetSize();
6403 ps57CtlListBox->SetSize(s.x, s.y - 1);
6407 void options::SetInitialVectorSettings(
void) {
6408 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6412 m_bVectorInit =
true;
6413 resetMarStdList(
true,
false);
6416 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6420 switch (ps52plib->GetDisplayCategory()) {
6430 case (MARINERS_STANDARD):
6438 if (pDispCat) pDispCat->SetSelection(nset);
6442 bool benableMarStd =
false;
6444 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); i++) {
6447 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD)
6448 benableMarStd =
true;
6455 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6456 itemButtonClearList->Enable(benableMarStd);
6457 itemButtonSelectList->Enable(benableMarStd);
6458 itemButtonSetStd->Enable(benableMarStd);
6461 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6462 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6463 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6464 if (pCheck_XLSECTTEXT)
6465 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6467 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6468 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6469 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6470 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6472 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6473 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6476 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6477 pPointStyle->SetSelection(0);
6479 pPointStyle->SetSelection(1);
6481 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6482 pBoundStyle->SetSelection(0);
6484 pBoundStyle->SetSelection(1);
6486 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6487 p24Color->SetSelection(0);
6489 p24Color->SetSelection(1);
6491 UpdateOptionsUnits();
6495 void options::UpdateOptionsUnits(
void) {
6496 int depthUnit = pDepthUnitSelect->GetSelection();
6498 depthUnit = wxMax(depthUnit, 0);
6499 depthUnit = wxMin(depthUnit, 2);
6505 else if (depthUnit == 2)
6511 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6512 wxString depthUnitString = depthUnitStrings[depthUnit];
6513 m_depthUnitsShal->SetLabel(depthUnitString);
6514 m_depthUnitsSafe->SetLabel(depthUnitString);
6515 m_depthUnitsDeep->SetLabel(depthUnitString);
6518 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6520 m_ShallowCtl->SetValue(s);
6522 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6524 m_SafetyCtl->SetValue(s);
6526 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6528 m_DeepCtl->SetValue(s);
6558 void options::OnSizeAutoButton(wxCommandEvent& event) {
6560 for (
const auto &mm : g_monitor_info) {
6561 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6563 screenmm.RemoveLast();
6564 pScreenMM->SetValue(screenmm);
6565 pScreenMM->Disable();
6566 g_config_display_size_manual = FALSE;
6569 void options::OnSizeManualButton(wxCommandEvent& event) {
6571 if (g_config_display_size_mm.size() > 0 && g_config_display_size_mm[0] > 0) {
6572 for (
const auto &mm : g_config_display_size_mm) {
6573 screenmm.Append(wxString::Format(
"%zu,", mm));
6576 for (
const auto &mm : g_monitor_info) {
6577 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6580 screenmm.RemoveLast();
6581 pScreenMM->SetValue(screenmm);
6582 pScreenMM->Enable();
6583 g_config_display_size_manual = TRUE;
6586 void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6588 void options::OnCPAWarnClick(wxCommandEvent& event) {
6589 if (m_pCheck_CPA_Warn->GetValue()) {
6590 m_pCheck_CPA_WarnT->Enable();
6592 m_pCheck_CPA_WarnT->SetValue(FALSE);
6593 m_pCheck_CPA_WarnT->Disable();
6597 void options::OnSyncCogPredClick(wxCommandEvent &event) {
6598 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6599 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6600 m_pText_COG_Predictor->Disable();
6604 s.Printf(_T(
"%4.0f"), g_ShowCOG_Mins);
6605 m_pText_COG_Predictor->SetValue(s);
6606 m_pText_COG_Predictor->Enable();
6610 void options::OnShipTypeSelect(wxCommandEvent& event) {
6611 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6612 dispOptions->Layout();
6614 itemPanelShip->Layout();
6615 itemPanelShip->Refresh();
6619 void options::OnRadarringSelect(wxCommandEvent& event) {
6620 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6621 dispOptions->Layout();
6623 itemPanelShip->Layout();
6624 itemPanelShip->Refresh();
6628 void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6629 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6630 dispOptions->Layout();
6632 itemPanelRoutes->Layout();
6633 itemPanelRoutes->Refresh();
6637 void options::OnGLClicked(wxCommandEvent& event) {
6642 void options::OnOpenGLOptions(wxCommandEvent& event) {
6644 OpenGLOptionsDlg dlg(
this);
6646 if (dlg.ShowModal() == wxID_OK) {
6647 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6648 g_GLOptions.m_bUseAcceleratedPanning = g_bGLexpert
6649 ? dlg.GetAcceleratedPanning()
6650 : gFrame->GetPrimaryCanvas()
6652 ->CanAcceleratePanning();
6655 g_bSoftwareGL = dlg.GetSoftwareGL();
6657 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6658 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6662 g_GLOptions.m_bTextureCompressionCaching =
6663 dlg.GetTextureCompressionCaching();
6664 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6667 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6670 if (g_bopengl && g_glTextureManager &&
6671 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6673 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6675 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6676 ::wxBeginBusyCursor();
6677 gFrame->GetPrimaryCanvas()->GetglCanvas()->SetupCompression();
6678 g_glTextureManager->ClearAllRasterTextures();
6679 ::wxEndBusyCursor();
6682 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6685 if (dlg.GetRebuildCache()) {
6686 m_returnChanges = REBUILD_RASTER_CACHE;
6692 void options::OnChartDirListSelect(wxCommandEvent& event) {
6694 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6695 m_removeBtn->Enable(selected);
6696 if (m_compressBtn) m_compressBtn->Enable(selected);
6700 void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6703 const bool select = pDispCat->GetSelection() == 3;
6704 ps57CtlListBox->Enable(select);
6705 itemButtonClearList->Enable(select);
6706 itemButtonSelectList->Enable(select);
6707 itemButtonSetStd->Enable(select);
6713 void options::OnButtonClearClick(wxCommandEvent& event) {
6714 resetMarStdList(
false,
false);
6723 void options::OnButtonSelectClick(wxCommandEvent& event) {
6724 int nOBJL = ps57CtlListBox->GetCount();
6725 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
6730 void options::OnButtonSetStd(wxCommandEvent& event) {
6731 resetMarStdList(
false,
true);
6736 bool options::ShowToolTips(
void) {
return TRUE; }
6738 void options::OnCharHook(wxKeyEvent& event) {
6739 if (event.GetKeyCode() == WXK_RETURN &&
6740 event.GetModifiers() == wxMOD_CONTROL) {
6741 wxCommandEvent okEvent;
6742 okEvent.SetId(xID_OK);
6743 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
6744 GetEventHandler()->AddPendingEvent(okEvent);
6749 void options::OnButtonaddClick(wxCommandEvent& event) {
6751 int dresult = g_Platform->DoDirSelectorDialog(
6752 this, &selDir, _(
"Add a directory containing chart files"),
6753 *pInit_Chart_Dir,
false);
6755 if (dresult != wxID_CANCEL) AddChartDir(selDir);
6760 void options::AddChartDir(
const wxString& dir) {
6761 wxFileName dirname = wxFileName(dir);
6762 pInit_Chart_Dir->Empty();
6767 f.MakeRelativeTo(g_Platform->GetHomeDir());
6768 dirAdd = f.GetFullPath();
6770 pInit_Chart_Dir->Append(dirname.GetPath());
6775 cdi.fullpath = dirAdd;
6776 ActiveChartArray.Add(cdi);
6778 UpdateChartDirList();
6780 k_charts |= CHANGE_CHARTS;
6782 pScanCheckBox->Disable();
6785 void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
6788 ActiveChartArray.Clear();
6789 for (
size_t i = 0; i < p.GetCount(); i++) {
6790 ActiveChartArray.Add(p[i]);
6793 UpdateChartDirList();
6796 void options::UpdateWorkArrayFromDisplayPanel(
void) {
6798 int n = ActiveChartArray.GetCount();
6799 if (m_pWorkDirList) {
6800 m_pWorkDirList->Clear();
6801 for (
int i = 0; i < n; i++) {
6802 dirname = ActiveChartArray[i].fullpath;
6803 if (!dirname.IsEmpty()) {
6806 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
6807 (dirname.Last() == wxChar(_T(
'\r'))))
6808 dirname.RemoveLast();
6814 bool b_added = FALSE;
6817 int nDir = m_CurrentDirList.GetCount();
6819 for (
int i = 0; i < nDir; i++) {
6820 if (m_CurrentDirList[i].fullpath == dirname) {
6822 m_pWorkDirList->Add(cdi);
6830 cdin.fullpath = dirname;
6831 m_pWorkDirList->Add(cdin);
6839 void options::OnApplyClick(wxCommandEvent& event) {
6845 if (m_pShipIconType->GetSelection() > 0) {
6846 double n_ownship_length_meters;
6847 double n_ownship_beam_meters;
6848 double n_gps_antenna_offset_y;
6849 double n_gps_antenna_offset_x;
6850 long n_ownship_min_mm;
6851 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
6852 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
6853 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
6854 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
6855 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
6857 if (n_ownship_length_meters <= 0)
6858 msg += _(
"\n - your ship's length must be > 0");
6859 if (n_ownship_beam_meters <= 0)
6860 msg += _(
"\n - your ship's beam must be > 0");
6861 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
6863 "\n - your GPS offset from midship must be within your ship's beam");
6864 if (n_gps_antenna_offset_y < 0 ||
6865 n_gps_antenna_offset_y > n_ownship_length_meters)
6867 _(
"\n - your GPS offset from bow must be within your ship's length");
6868 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
6869 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
6870 if (!msg.IsEmpty()) {
6871 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
6872 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
6873 ::wxEndBusyCursor();
6874 event.SetInt(wxID_STOP);
6877 g_n_ownship_length_meters = n_ownship_length_meters;
6878 g_n_ownship_beam_meters = n_ownship_beam_meters;
6879 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
6880 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
6881 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
6883 g_OwnShipIconType = m_pShipIconType->GetSelection();
6884 g_bShowShipToActive = pShowshipToActive->GetValue();
6885 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
6886 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
6888 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
6889 g_n_arrival_circle_radius =
6890 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
6892 wxString* icon_name =
6893 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
6894 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
6897 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
6898 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
6900 g_bUseWptScaMin = pScaMinChckB->GetValue();
6901 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
6902 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
6905 if (m_bfontChanged){
6907 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6908 gFrame->GetPrimaryCanvas()->GetglCanvas()->ResetGridFont();
6911 m_returnChanges |= FONT_CHANGED;
6915 UpdateWorkArrayFromDisplayPanel();
6917 groupsPanel->SetDBDirs(*m_pWorkDirList);
6918 groupsPanel->m_treespopulated = FALSE;
6920 int k_force = FORCE_UPDATE;
6921 if (pUpdateCheckBox) {
6922 if (!pUpdateCheckBox->GetValue()) k_force = 0;
6923 pUpdateCheckBox->Enable();
6924 pUpdateCheckBox->SetValue(FALSE);
6929 m_returnChanges |= k_force;
6931 int k_scan = SCAN_UPDATE;
6932 if (pScanCheckBox) {
6933 if (!pScanCheckBox->GetValue()) k_scan = 0;
6934 pScanCheckBox->Enable();
6935 pScanCheckBox->SetValue(FALSE);
6940 m_returnChanges |= k_scan;
6944 if (groupsPanel->modified) {
6945 groupsPanel->EmptyChartGroupArray(g_pGroupArray);
6946 delete g_pGroupArray;
6947 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
6948 m_returnChanges |= GROUPS_CHANGED;
6953 g_bShowStatusBar = pShowStatusBar->GetValue();
6955 g_bShowMenuBar = pShowMenuBar->GetValue();
6957 g_bShowCompassWin = pShowCompassWin->GetValue();
6960 g_bShowChartBar = pShowChartBar->GetValue();
6962 wxString screenmm = pScreenMM->GetValue();
6963 wxStringTokenizer tkz(screenmm, _T(
"," ));
6964 g_config_display_size_mm.clear();
6965 while(tkz.HasMoreTokens()){
6966 wxString token = tkz.GetNextToken();
6968 if (token.ToLong(&mm) && mm > 0) {
6969 g_config_display_size_mm.push_back(mm);
6971 g_config_display_size_mm.push_back(0);
6974 g_config_display_size_manual = pRBSizeManual->GetValue();
6977 comm_dialog->ApplySettings();
6979 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
6980 if (pSDisplayGrid) g_bDisplayGrid = pSDisplayGrid->GetValue();
6983 bool temp_bquilting = pCDOQuilting->GetValue();
6986 g_bQuiltEnable = temp_bquilting;
6990 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
6991 g_bskew_comp = pSkewComp->GetValue();
6992 g_btouch = pMobile->GetValue();
6993 g_bresponsive = pResponsive->GetValue();
6994 g_bRollover = pRollover->GetValue();
6995 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
6997 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7000 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7001 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7002 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7007 g_bsmoothpanzoom = pSmoothPanZoom->GetValue();
7009 g_bsmoothpanzoom =
false;
7011 if (pSmoothPanZoom) g_bsmoothpanzoom = pSmoothPanZoom->GetValue();
7013 g_bsmoothpanzoom =
false;
7016 long update_val = 1;
7017 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7018 g_COGAvgSec = wxMin(
static_cast<int>(update_val), MAX_COG_AVERAGE_SECONDS);
7022 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7024 g_bShowTrue = pCBTrueShow->GetValue();
7025 g_bShowMag = pCBMagShow->GetValue();
7027 auto loader = PluginLoader::getInstance();
7028 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
7029 if (!b_haveWMM && !b_oldhaveWMM) {
7030 pMagVar->GetValue().ToDouble(&g_UserVar);
7034 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7035 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7038 g_iNavAidRadarRingsNumberVisible =
7039 pNavAidRadarRingsNumberVisible->GetSelection();
7040 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7041 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7042 g_fNavAidRadarRingsStep = temp_dbl;
7043 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7044 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7045 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7046 g_fWaypointRangeRingsStep = temp_dbl;
7047 g_iWaypointRangeRingsStepUnits =
7048 m_itemWaypointRangeRingsUnits->GetSelection();
7049 g_colourWaypointRangeRingsColour =
7050 m_colourWaypointRangeRingsColour->GetColour();
7051 g_colourWaypointRangeRingsColour =
7052 wxColour(g_colourWaypointRangeRingsColour.Red(),
7053 g_colourWaypointRangeRingsColour.Green(),
7054 g_colourWaypointRangeRingsColour.Blue());
7055 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7056 g_own_ship_sog_cog_calc = pSogCogFromLLCheckBox->GetValue();
7057 g_own_ship_sog_cog_calc_damp_sec = pSogCogFromLLDampInterval->GetValue();
7059 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7061 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7063 if (pCmdSoundString) {
7064 g_CmdSoundString = pCmdSoundString->GetValue();
7065 if (wxIsEmpty(g_CmdSoundString)) {
7066 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7067 pCmdSoundString->SetValue(g_CmdSoundString);
7071 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7072 if (pSoundDeviceIndex)
7073 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7075 g_iSDMMFormat = pSDMMFormat->GetSelection();
7076 g_iDistanceFormat = pDistanceFormat->GetSelection();
7077 g_iSpeedFormat = pSpeedFormat->GetSelection();
7078 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7079 g_iTempFormat = pTempFormat->GetSelection();
7082 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7083 if (pSDefaultBoatSpeed)
7084 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7085 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7086 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7087 getUsrSpeedUnit() +
")");
7089 g_bAdvanceRouteWaypointOnArrivalOnly =
7090 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7092 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7093 g_colourTrackLineColour =
7094 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7095 g_colourTrackLineColour.Blue());
7096 g_nTrackPrecision = pTrackPrecision->GetSelection();
7098 g_bTrackDaily = pTrackDaily->GetValue();
7100 g_track_rotate_time = 0;
7101 #if wxUSE_TIMEPICKCTRL
7103 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7104 g_track_rotate_time = h * 3600 + m * 60 + s;
7107 if (pTrackRotateUTC->GetValue())
7108 g_track_rotate_time_type = TIME_TYPE_UTC;
7109 else if (pTrackRotateLMT->GetValue())
7110 g_track_rotate_time_type = TIME_TYPE_LMT;
7112 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7114 g_bHighliteTracks = pTrackHighlite->GetValue();
7116 if (pEnableZoomToCursor)
7117 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7119 g_bEnableZoomToCursor =
false;
7122 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7123 g_colourOwnshipRangeRingsColour =
7124 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7125 g_colourOwnshipRangeRingsColour.Green(),
7126 g_colourOwnshipRangeRingsColour.Blue());
7129 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7130 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7131 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7132 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7136 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7137 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7138 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7139 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7140 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7141 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7144 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7145 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7146 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7147 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7150 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7152 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7153 if (g_bSyncCogPredictors) {
7154 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7156 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7158 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7159 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7163 for (
const auto& it : g_pAIS->GetTargetList()) {
7164 auto pAISTarget = it.second;
7165 if (NULL != pAISTarget) {
7166 pAISTarget->b_show_track = g_bAISShowTracks;
7168 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
7169 if (pAISTarget->MMSI == g_MMSI_Props_Array[i]->MMSI) {
7171 if (TRACKTYPE_NEVER == props->TrackType) {
7172 pAISTarget->b_show_track =
false;
7175 else if (TRACKTYPE_ALWAYS == props->TrackType) {
7176 pAISTarget->b_show_track =
true;
7184 std::map<int, Track *>::iterator it;
7185 it = g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7186 if (it != g_pAIS->m_persistent_tracks.end())
7187 pAISTarget->b_show_track =
true;
7192 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7193 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7195 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7196 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7198 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7200 m_pText_Scale_Priority->GetValue().ToLong(&l);
7201 g_ShowScaled_Num = (int)l;
7203 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7204 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7205 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7206 long ais_name_scale = 5000;
7207 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7208 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7209 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7210 g_WplAction = m_pWplAction->GetSelection();
7213 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7214 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7215 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7217 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7218 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7221 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7222 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7223 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7225 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7226 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7227 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7228 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7230 bool bchange_scale =
false;
7231 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7232 bchange_scale =
true;
7233 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7235 g_ChartScaleFactorExp =
7236 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7237 g_MarkScaleFactorExp =
7238 g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7239 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7240 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7241 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7242 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7244 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7245 g_mouse_zoom_sensitivity =
7258 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7259 g_bopengl = pOpenGL->GetValue();
7262 g_bChartBarEx = pChartBarEX->GetValue();
7265 int depthUnit = pDepthUnitSelect->GetSelection();
7266 g_nDepthUnitDisplay = depthUnit;
7269 bool bUserStdChange =
false;
7271 int nOBJL = ps57CtlListBox->GetCount();
7273 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7275 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7276 if (marinersStdXref[i] == iPtr) {
7281 assert(itemIndex >= 0);
7282 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7283 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7284 bUserStdChange =
true;
7285 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7291 ps52plib->GenerateStateHash();
7292 long stateHash = ps52plib->GetStateHash();
7294 if (m_returnChanges & GL_CHANGED) {
7297 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7299 ps52plib->ClearCNSYLUPArray();
7300 ps52plib->GenerateStateHash();
7304 enum _DisCat nset = OTHER;
7305 switch (pDispCat->GetSelection()) {
7316 nset = MARINERS_STANDARD;
7319 ps52plib->SetDisplayCategory(nset);
7322 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7323 if (pCheck_ATONTEXT)
7324 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7325 if (pCheck_LDISTEXT)
7326 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7327 if (pCheck_XLSECTTEXT)
7328 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7330 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7331 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7332 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7333 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7334 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7335 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7337 ps52plib->m_nSymbolStyle =
7338 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7340 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7342 : SYMBOLIZED_BOUNDARIES;
7343 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7344 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7346 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7347 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7355 else if (depthUnit == 2)
7358 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7359 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7361 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7365 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7366 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7368 if (m_DeepCtl->GetValue().ToDouble(&dval))
7369 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7371 ps52plib->UpdateMarinerParams();
7372 ps52plib->m_nDepthUnitDisplay = depthUnit;
7374 ps52plib->GenerateStateHash();
7377 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7378 m_returnChanges |= S52_CHANGED;
7381 m_returnChanges |= S52_CHANGED;
7385 #if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7387 wxString new_canon = _T(
"en_US");
7388 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7390 int nLang =
sizeof(lang_list) /
sizeof(
int);
7391 for (
int it = 0; it < nLang; it++) {
7392 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7394 wxString lang_canonical = pli->CanonicalName;
7395 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7396 if (lang_sel == test_string) {
7397 new_canon = lang_canonical;
7403 wxString locale_old = g_locale;
7404 g_locale = new_canon;
7406 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7408 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7411 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7412 m_returnChanges |= STYLE_CHANGED;
7414 wxSizeEvent nullEvent;
7415 gFrame->OnSize(nullEvent);
7418 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7419 g_bInlandEcdis = pInlandEcdis->GetValue();
7420 SwitchInlandEcdisMode(g_bInlandEcdis);
7421 m_returnChanges |= TOOLBAR_CHANGED;
7426 if (PluginLoader::getInstance()->UpdatePlugIns())
7427 m_returnChanges |= TOOLBAR_CHANGED;
7431 g_pi_manager->UpdateConfig();
7434 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
7436 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7437 m_groups_changed | k_plugins | k_tides;
7441 TideCurrentDataSet.clear();
7442 int nEntry = tcDataSelected->GetItemCount();
7443 for (
int i = 0; i < nEntry; i++) {
7444 wxString setName = tcDataSelected->GetItemText(i);
7445 TideCurrentDataSet.push_back(setName.ToStdString());
7448 if (event.GetId() != ID_APPLY)
7449 g_canvasConfig = m_screenConfig;
7451 if (event.GetId() == ID_APPLY) {
7452 gFrame->ProcessOptionsDialog(m_returnChanges, m_pWorkDirList);
7458 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7461 gFrame->RefreshAllCanvas();
7465 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7468 UpdateTemplateTitleText();
7471 ::wxEndBusyCursor();
7474 void options::OnXidOkClick(wxCommandEvent& event) {
7477 if (event.GetEventObject() == NULL)
return;
7479 OnApplyClick(event);
7480 SetReturnCode(m_returnChanges);
7481 if (event.GetInt() == wxID_STOP)
return;
7486 void options::Finish(
void) {
7488 m_pListbook->ChangeSelection(0);
7489 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7490 wxNotebookPage* pg = m_pListbook->GetPage(i);
7491 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7492 if (nb) nb->ChangeSelection(0);
7495 lastWindowPos = GetPosition();
7496 lastWindowSize = GetSize();
7498 pConfig->SetPath(
"/Settings");
7499 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7500 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7502 SetReturnCode(m_returnChanges);
7503 EndModal(m_returnChanges);
7506 ArrayOfCDI options::GetSelectedChartDirs() {
7508 for (
size_t i = 0; i < panelVector.size(); i++) {
7509 if (panelVector[i]->IsSelected()) {
7510 rv.Add(panelVector[i]->GetCDI());
7517 ArrayOfCDI options::GetUnSelectedChartDirs() {
7519 for (
size_t i = 0; i < panelVector.size(); i++) {
7520 if (!panelVector[i]->IsSelected()) {
7521 rv.Add(panelVector[i]->GetCDI());
7528 void options::SetDirActionButtons() {
7529 ArrayOfCDI selArray = GetSelectedChartDirs();
7530 if (selArray.GetCount())
7531 m_removeBtn->Enable();
7533 m_removeBtn->Disable();
7536 void options::OnButtondeleteClick(wxCommandEvent& event) {
7537 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7538 ActiveChartArray.Clear();
7539 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7540 ActiveChartArray.Add(unselArray[i]);
7543 UpdateChartDirList();
7545 UpdateWorkArrayFromDisplayPanel();
7548 if (m_pWorkDirList) {
7549 pActiveChartsList->DeleteAllItems();
7550 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7551 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7554 li.SetAlign(wxLIST_FORMAT_LEFT);
7555 li.SetText(dirname);
7557 long idx = pActiveChartsList->InsertItem(li);
7562 k_charts |= CHANGE_CHARTS;
7564 pScanCheckBox->Disable();
7569 void options::OnButtonParseENC(wxCommandEvent& event) {
7570 gFrame->GetPrimaryCanvas()->EnablePaint(
false);
7572 extern void ParseAllENC(wxWindow * parent);
7574 ParseAllENC(g_pOptions);
7577 gFrame->ChartsRefresh();
7579 gFrame->GetPrimaryCanvas()->EnablePaint(
true);
7582 #ifdef OCPN_USE_LZMA
7585 static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
7588 lzma_action action = LZMA_RUN;
7592 uint8_t inbuf[BUFSIZ];
7593 uint8_t outbuf[BUFSIZ];
7606 strm->next_in = NULL;
7608 strm->next_out = outbuf;
7609 strm->avail_out =
sizeof(outbuf);
7615 if (strm->avail_in == 0 && !feof(infile)) {
7616 strm->next_in = inbuf;
7617 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
7619 if (ferror(infile)) {
7620 fprintf(stderr,
"Read error: %s\n", strerror(errno));
7628 if (feof(infile)) action = LZMA_FINISH;
7646 lzma_ret ret = lzma_code(strm, action);
7651 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
7656 size_t write_size =
sizeof(outbuf) - strm->avail_out;
7658 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
7659 fprintf(stderr,
"Write error: %s\n", strerror(errno));
7664 strm->next_out = outbuf;
7665 strm->avail_out =
sizeof(outbuf);
7670 if (ret != LZMA_OK) {
7677 if (ret == LZMA_STREAM_END)
return true;
7688 case LZMA_MEM_ERROR:
7689 msg =
"Memory allocation failed";
7692 case LZMA_DATA_ERROR:
7705 msg =
"File size limits exceeded";
7720 msg =
"Unknown error, possibly a bug";
7724 wxLogMessage(_T(
"LZMA Encoder error: %s (error code %u)\n"), msg, ret);
7731 static bool CompressChart(wxString in, wxString out) {
7732 #ifdef OCPN_USE_LZMA
7733 FILE* infile = fopen(in.mb_str(),
"rb");
7734 if (!infile)
return false;
7736 FILE* outfile = fopen(out.mb_str(),
"wb");
7742 lzma_stream strm = LZMA_STREAM_INIT;
7743 bool success =
false;
7744 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
7746 success = compress(&strm, infile, outfile);
7757 void options::OnButtonmigrateClick(wxCommandEvent& event) {
7762 new MigrateAssistantDialog(gFrame,
true);
7763 g_migrateDialog->SetSize(gFrame->GetSize());
7764 g_migrateDialog->Centre();
7765 g_migrateDialog->Raise();
7766 g_migrateDialog->ShowModal();
7770 void options::OnButtonEcdisHelp(wxCommandEvent& event) {
7772 wxString testFile =
"/doc/iECDIS/index.html";
7774 if (!::wxFileExists(testFile)) {
7775 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
7778 _(
"Would you like to visit the iECDIS Manual website for more "
7782 OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"), wxYES_NO | wxCENTER, 60)) {
7783 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
7787 wxLaunchDefaultBrowser(
"file:///" + *GetpSharedDataLocation() +
7790 wxLaunchDefaultBrowser(
"file://" + *GetpSharedDataLocation() +
7797 void options::OnButtoncompressClick(wxCommandEvent& event) {
7799 wxArrayInt pListBoxSelections;
7802 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
7803 wxLIST_STATE_SELECTED);
7804 if (item == -1)
break;
7809 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
7810 This may make them incompatible with other programs or older versions of OpenCPN.\n\
7811 Compressed charts may take slightly longer to load and display on some systems.\n\
7812 They can be decompressed again using unxz or 7 zip programs."),
7813 _(
"OpenCPN Warning"),
7814 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
7818 wxArrayString filespecs;
7819 filespecs.Add(
"*.kap");
7820 filespecs.Add(
"*.KAP");
7821 filespecs.Add(
"*.000");
7824 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
7825 filespecs.Add(
"*.D");
7826 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
7827 filespecs.Add(
"*.Z");
7829 wxGenericProgressDialog prog1(
7830 _(
"OpenCPN Compress Charts"), wxEmptyString,
7831 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
7832 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
7833 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
7836 wxSize sz = prog1.GetSize();
7837 sz.x = gFrame->GetClientSize().x * 8 / 10;
7840 wxArrayString charts;
7841 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
7842 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
7843 if (dirname.IsEmpty())
continue;
7846 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7847 (dirname.Last() == wxChar(_T(
'\r'))))
7848 dirname.RemoveLast();
7850 if (!wxDir::Exists(dirname))
continue;
7853 wxArrayString FileList;
7854 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
7855 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
7857 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
7861 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
7862 charts.Add(FileList[j]);
7866 if (charts.GetCount() == 0) {
7867 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
7872 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
7873 wxGenericProgressDialog prog(
7874 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
7875 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
7876 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
7880 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
7882 prog.Update(i, charts[i], &skip);
7885 wxString compchart = charts[i] + _T(
".xz");
7886 if (CompressChart(charts[i], compchart)) {
7887 total_size += wxFileName::GetSize(charts[i]).ToULong();
7888 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
7889 wxRemoveFile(charts[i]);
7895 double total_size_mb = total_size / 1024.0 / 1024.0;
7896 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
7899 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
7901 count, total_size_mb, total_compressed_size_mb,
7902 total_size_mb - total_compressed_size_mb,
7903 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
7906 UpdateWorkArrayFromTextCtl();
7908 if (m_pWorkDirList) {
7909 pActiveChartsList->DeleteAllItems();
7910 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7911 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7914 li.SetAlign(wxLIST_FORMAT_LEFT);
7915 li.SetText(dirname);
7917 long idx = pActiveChartsList->InsertItem(li);
7921 k_charts |= CHANGE_CHARTS;
7923 pScanCheckBox->Disable();
7929 void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
7931 void options::OnCancelClick(wxCommandEvent& event) {
7932 m_pListbook->ChangeSelection(0);
7934 lastWindowPos = GetPosition();
7935 lastWindowSize = GetSize();
7937 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxCANCEL);
7939 pConfig->SetPath(
"/Settings");
7940 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7941 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7944 if (m_bForceNewToolbaronCancel) rv = TOOLBAR_CHANGED;
7948 void options::OnClose(wxCloseEvent& event) {
7950 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
7952 m_pListbook->ChangeSelection(0);
7954 lastWindowPos = GetPosition();
7955 lastWindowSize = GetSize();
7957 pConfig->SetPath(
"/Settings");
7958 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7959 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7964 void options::OnFontChoice(wxCommandEvent& event) {
7965 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
7967 wxFont* pif = FontMgr::Get().GetFont(sel_text_element);
7968 wxColour init_color = FontMgr::Get().GetFontColor(sel_text_element);
7970 m_textSample->SetFont(*pif);
7971 m_textSample->SetForegroundColour(init_color);
7972 m_itemBoxSizerFontPanel->Layout();
7977 void options::OnChooseFont(wxCommandEvent& event) {
7979 androidDisableRotation();
7982 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
7983 wxFontData font_data;
7985 wxFont* pif = FontMgr::Get().GetFont(sel_text_element);
7986 wxColour init_color = FontMgr::Get().GetFontColor(sel_text_element);
7988 wxFontData init_font_data;
7989 if (pif) init_font_data.SetInitialFont(*pif);
7990 init_font_data.SetColour(init_color);
7993 if (g_Platform->getDisplaySize().y < 800) {
7995 wxFont* qFont = dialogFont;
7998 int retval = dg.ShowModal();
7999 if (wxID_CANCEL != retval) {
8000 font_data = dg.GetFontData();
8001 wxFont font = font_data.GetChosenFont();
8002 wxFont* psfont =
new wxFont(font);
8003 wxColor color = font_data.GetColour();
8004 FontMgr::Get().SetFont(sel_text_element, psfont, color);
8005 gFrame->UpdateAllFonts();
8006 m_bfontChanged =
true;
8007 OnFontChoice(event);
8014 wxFontDialog dg(
this, init_font_data);
8016 wxFontDialog dg(pParent, init_font_data);
8019 wxFont* qFont = dialogFont;
8025 wxSize proposed_size = GetSize();
8027 float font_size = dialogFont->GetPointSize();
8029 if ((proposed_size.y / font_size) < n_lines) {
8030 float new_font_size = proposed_size.y / n_lines;
8031 wxFont* smallFont =
new wxFont(*dialogFont);
8032 smallFont->SetPointSize(new_font_size);
8033 dg.SetFont(*smallFont);
8037 if (g_bresponsive) {
8038 dg.SetSize(GetSize());
8042 int retval = dg.ShowModal();
8043 if (wxID_CANCEL != retval) {
8044 font_data = dg.GetFontData();
8045 wxFont font = font_data.GetChosenFont();
8046 wxFont* psfont =
new wxFont(font);
8047 wxColor color = font_data.GetColour();
8048 FontMgr::Get().SetFont(sel_text_element, psfont, color);
8049 gFrame->UpdateAllFonts();
8050 m_bfontChanged =
true;
8051 OnFontChoice(event);
8056 androidEnableRotation();
8062 #if defined(__WXGTK__) || defined(__WXQT__)
8063 void options::OnChooseFontColor(wxCommandEvent& event) {
8064 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8066 wxColourData colour_data;
8068 wxFont* pif = FontMgr::Get().GetFont(sel_text_element);
8069 wxColour init_color = FontMgr::Get().GetFontColor(sel_text_element);
8072 androidDisableRotation();
8074 unsigned int cco = 0;
8077 cco |= init_color.Red();
8079 cco |= init_color.Green();
8081 cco |= init_color.Blue();
8082 unsigned int cc = androidColorPicker(cco);
8085 unsigned char blue = (
unsigned char)cc % 256;
8086 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8088 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8089 cn.Set(red, green, blue);
8091 FontMgr::Get().SetFont(sel_text_element, pif, cn);
8093 gFrame->UpdateAllFonts();
8094 m_bfontChanged =
true;
8096 androidEnableRotation();
8098 wxScrolledWindow* sw =
8099 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8101 wxColourData init_colour_data;
8102 init_colour_data.SetColour(init_color);
8104 wxColourDialog dg(sw, &init_colour_data);
8106 int retval = dg.ShowModal();
8107 if (wxID_CANCEL != retval) {
8108 colour_data = dg.GetColourData();
8110 wxColor color = colour_data.GetColour();
8111 FontMgr::Get().SetFont(sel_text_element, pif, color);
8113 gFrame->UpdateAllFonts();
8114 m_bfontChanged =
true;
8115 OnFontChoice(event);
8124 void options::OnChartsPageChange(wxListbookEvent& event) {
8125 unsigned int i =
event.GetSelection();
8127 UpdateChartDirList();
8132 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8136 UpdateWorkArrayFromDisplayPanel();
8137 groupsPanel->SetDBDirs(*m_pWorkDirList);
8138 groupsPanel->m_treespopulated = FALSE;
8140 if (!groupsPanel->m_settingscomplete) {
8141 ::wxBeginBusyCursor();
8142 groupsPanel->CompleteInitialSettings();
8143 ::wxEndBusyCursor();
8144 }
else if (!groupsPanel->m_treespopulated) {
8145 groupsPanel->PopulateTrees();
8146 groupsPanel->m_treespopulated = TRUE;
8148 }
else if (1 == i) {
8150 if (!m_bVectorInit) {
8151 SetInitialVectorSettings();
8152 UpdateOptionsUnits();
8159 void options::OnPageChange(wxListbookEvent& event) {
8160 DoOnPageChange(event.GetSelection());
8163 void options::OnSubNBPageChange(wxNotebookEvent& event) {
8166 if (event.GetEventObject()) {
8167 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8168 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8169 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8170 if (
dynamic_cast<wxNotebook*
>(parent)) {
8171 lastSubPage =
event.GetSelection();
8174 if (
dynamic_cast<wxListbook*
>(parent)) {
8175 lastSubPage =
event.GetSelection();
8182 void options::OnTopNBPageChange(wxNotebookEvent& event) {
8183 DoOnPageChange(event.GetSelection());
8186 void options::DoOnPageChange(
size_t page) {
8187 unsigned int i = page;
8190 if (page > 10)
return;
8196 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8197 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8203 k_charts = VISIT_CHARTS;
8204 UpdateChartDirList();
8207 else if (m_pageUI == i) {
8208 if (!m_itemLangListBox)
return;
8209 #if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8211 if (!m_bVisitLang) {
8212 ::wxBeginBusyCursor();
8214 int current_language = plocale_def_lang->GetLanguage();
8215 wxString current_sel = wxLocale::GetLanguageName(current_language);
8217 current_sel = GetOCPNKnownLanguage(g_locale);
8219 int nLang =
sizeof(lang_list) /
sizeof(
int);
8222 m_itemLangListBox->Append(_T(
"English (U.S.)"));
8224 wxString lang_dir = g_Platform->GetSharedDataDir() + _T(
"share/locale/");
8225 for (
int it = 1; it < nLang; it++) {
8226 if (wxLocale::IsAvailable(lang_list[it])) {
8227 wxLocale ltest(lang_list[it], 0);
8228 ltest.AddCatalog(_T(
"opencpn"));
8229 if (!ltest.IsLoaded(_T(
"opencpn")))
continue;
8232 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8233 wxString widgets_lang_name = loc_lang_name;
8234 wxString lang_canonical =
8235 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8238 wxString lang_suffix;
8239 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8242 wxString test_dir = lang_dir + lang_suffix;
8243 if (!wxDir::Exists(test_dir))
8246 m_itemLangListBox->Append(loc_lang_name);
8250 wxArrayString lang_array;
8253 lang_array.Add(_T(
"en_US"));
8254 for (
int it = 0; it < nLang; it++) {
8256 wxLog::EnableLogging(
8259 wxLocale ltest(lang_list[it], 0);
8260 #if wxCHECK_VERSION(2, 9, 0)
8262 ltest.AddCatalogLookupPathPrefix(
8263 wxStandardPaths::Get().GetInstallPrefix() +
8264 _T(
"/share/locale" ));
8267 ltest.AddCatalog(_T(
"opencpn"));
8269 wxLog::EnableLogging(TRUE);
8270 if (ltest.IsLoaded(_T(
"opencpn"))) {
8271 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8273 if (x) s0 = x->CanonicalName;
8275 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8276 if (wxNOT_FOUND == lang_array.Index(s0)) {
8283 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8285 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8286 m_itemLangListBox->Append(loc_lang_name);
8302 delete plocale_def_lang;
8303 plocale_def_lang =
new wxLocale(current_language);
8305 setlocale(LC_NUMERIC,
"C");
8306 plocale_def_lang->AddCatalog(_T(
"opencpn"));
8308 m_itemLangListBox->SetStringSelection(current_sel);
8311 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8313 wxString clang = pli->Description;
8317 m_bVisitLang = TRUE;
8319 ::wxEndBusyCursor();
8322 }
else if (m_pagePlugins == i) {
8325 auto loader = PluginLoader::getInstance();
8326 if (LoadAllPlugIns(
false)) {
8327 delete m_pPlugInCtrl;
8328 m_pPlugInCtrl = NULL;
8329 delete m_PluginCatalogMgrPanel;
8330 m_PluginCatalogMgrPanel = NULL;
8331 itemBoxSizerPanelPlugins->Clear();
8334 if (!m_pPlugInCtrl) {
8336 ::wxBeginBusyCursor();
8341 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8342 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8343 wxEXPAND | wxGROW | wxALL, 4);
8344 if (g_pi_manager) g_pi_manager->SetListPanelPtr(m_pPlugInCtrl);
8347 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8349 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8350 wxEXPAND | wxALL, 4);
8351 itemBoxSizerPanelPlugins->Layout();
8354 m_pPlugInCtrl->UpdateSelections();
8356 ::wxEndBusyCursor();
8361 k_plugins = TOOLBAR_CHANGED;
8365 wxString options::SelectSoundFile() {
8366 wxString sound_dir = g_Platform->GetSharedDataDir();
8367 sound_dir.Append(_T(
"sounds"));
8372 wxFileDialog* popenDialog =
new wxFileDialog(
8373 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8374 _T(
"WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN);
8376 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8378 response = popenDialog->ShowModal();
8379 sel_file = popenDialog->GetPath();
8384 g_Platform->DoFileSelectorDialog(
this, &sel_file, _(
"Select Sound File"),
8385 sound_dir, wxEmptyString, wxT(
"*.*"));
8388 if (response == wxID_OK)
8389 return g_Platform->NormalizePath(sel_file);
8394 void options::OnButtonSelectSound(wxCommandEvent& event) {
8395 wxString sel_file = SelectSoundFile();
8397 if (!sel_file.IsEmpty()) {
8398 g_sAIS_Alert_Sound_File = g_Platform->NormalizePath(sel_file);
8402 void options::OnButtonTestSound(wxCommandEvent& event) {
8403 auto sound = SoundFactory();
8404 auto cmd_sound =
dynamic_cast<SystemCmdSound*
>(sound);
8405 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8406 sound->SetFinishedCallback(
8408 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8412 wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8413 wxString return_string;
8414 wxString dir_suffix;
8416 #if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8418 if (lang_canonical == _T(
"en_US")) {
8419 dir_suffix = _T(
"en");
8420 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8422 }
else if ((lang_canonical == _T(
"cs_CZ")) || (lang_canonical == _T(
"cs"))) {
8423 dir_suffix = _T(
"cs");
8424 return_string = wxString(
"Čeština", wxConvUTF8);
8426 }
else if ((lang_canonical == _T(
"da_DK")) || (lang_canonical == _T(
"da"))) {
8427 dir_suffix = _T(
"da");
8428 return_string = wxString(
"Dansk", wxConvUTF8);
8430 }
else if ((lang_canonical == _T(
"de_DE")) || (lang_canonical == _T(
"de"))) {
8431 dir_suffix = _T(
"de");
8432 return_string = wxString(
"Deutsch", wxConvUTF8);
8434 }
else if ((lang_canonical == _T(
"et_EE")) || (lang_canonical == _T(
"et"))) {
8435 dir_suffix = _T(
"et");
8436 return_string = wxString(
"Eesti", wxConvUTF8);
8438 }
else if ((lang_canonical == _T(
"es_ES")) || (lang_canonical == _T(
"es"))) {
8439 dir_suffix = _T(
"es");
8440 return_string = wxString(
"Español", wxConvUTF8);
8442 }
else if ((lang_canonical == _T(
"fr_FR")) || (lang_canonical == _T(
"fr"))) {
8443 dir_suffix = _T(
"fr");
8444 return_string = wxString(
"Français", wxConvUTF8);
8446 }
else if ((lang_canonical == _T(
"it_IT")) || (lang_canonical == _T(
"it"))) {
8447 dir_suffix = _T(
"it");
8448 return_string = wxString(
"Italiano", wxConvUTF8);
8450 }
else if ((lang_canonical == _T(
"nl_NL")) || (lang_canonical == _T(
"nl"))) {
8451 dir_suffix = _T(
"nl");
8452 return_string = wxString(
"Nederlands", wxConvUTF8);
8454 }
else if ((lang_canonical == _T(
"pl_PL")) || (lang_canonical == _T(
"pl"))) {
8455 dir_suffix = _T(
"pl");
8456 return_string = wxString(
"Polski", wxConvUTF8);
8458 }
else if ((lang_canonical == _T(
"pt_PT")) || (lang_canonical == _T(
"pt"))) {
8459 dir_suffix = _T(
"pt_PT");
8460 return_string = wxString(
"Português", wxConvUTF8);
8462 }
else if ((lang_canonical == _T(
"pt_BR")) || (lang_canonical == _T(
"pt_BR"))) {
8463 dir_suffix = _T(
"pt_BR");
8464 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8466 }
else if ((lang_canonical == _T(
"ru_RU")) || (lang_canonical == _T(
"ru"))) {
8467 dir_suffix = _T(
"ru");
8468 return_string = wxString(
"Русский", wxConvUTF8);
8470 }
else if ((lang_canonical == _T(
"sv_SE")) || (lang_canonical == _T(
"sv"))) {
8471 dir_suffix = _T(
"sv");
8472 return_string = wxString(
"Svenska", wxConvUTF8);
8474 }
else if ((lang_canonical == _T(
"fi_FI")) || (lang_canonical == _T(
"fi"))) {
8475 dir_suffix = _T(
"fi_FI");
8476 return_string = wxString(
"Suomi", wxConvUTF8);
8478 }
else if ((lang_canonical == _T(
"nb_NO")) || (lang_canonical == _T(
"nb"))) {
8479 dir_suffix = _T(
"nb_NO");
8480 return_string = wxString(
"Norsk", wxConvUTF8);
8482 }
else if ((lang_canonical == _T(
"tr_TR")) || (lang_canonical == _T(
"tr"))) {
8483 dir_suffix = _T(
"tr_TR");
8484 return_string = wxString(
"Türkçe", wxConvUTF8);
8486 }
else if ((lang_canonical == _T(
"el_GR")) || (lang_canonical == _T(
"el"))) {
8487 dir_suffix = _T(
"el_GR");
8488 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8490 }
else if ((lang_canonical == _T(
"hu_HU")) || (lang_canonical == _T(
"hu"))) {
8491 dir_suffix = _T(
"hu_HU");
8492 return_string = wxString(
"Magyar", wxConvUTF8);
8494 }
else if ((lang_canonical == _T(
"zh_TW")) || (lang_canonical == _T(
"zh_TW"))) {
8495 dir_suffix = _T(
"zh_TW");
8496 return_string = wxString(
"正體字", wxConvUTF8);
8498 }
else if ((lang_canonical == _T(
"zh_CN")) || (lang_canonical == _T(
"zh_CN"))) {
8499 dir_suffix = _T(
"zh_CN");
8500 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8502 }
else if ((lang_canonical == _T(
"ca_ES")) || (lang_canonical == _T(
"ca"))) {
8503 dir_suffix = _T(
"ca_ES");
8504 return_string = wxString(
"Catalan", wxConvUTF8);
8506 }
else if ((lang_canonical == _T(
"gl_ES")) || (lang_canonical == _T(
"gl_ES"))) {
8507 dir_suffix = _T(
"gl_ES");
8508 return_string = wxString(
"Galician", wxConvUTF8);
8510 }
else if ((lang_canonical == _T(
"ja_JP")) || (lang_canonical == _T(
"ja_JP"))) {
8511 dir_suffix = _T(
"ja_JP");
8512 return_string = wxString(
"Japanese", wxConvUTF8);
8514 }
else if ((lang_canonical == _T(
"vi_VN")) || (lang_canonical == _T(
"vi_VN"))) {
8515 dir_suffix = _T(
"vi_VN");
8516 return_string = wxString(
"Vietnamese", wxConvUTF8);
8519 dir_suffix = lang_canonical;
8520 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8522 return_string = info->Description;
8524 return_string = lang_canonical;
8527 lang_dir = dir_suffix;
8529 return return_string;
8533 wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8535 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8538 ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8539 ChartGroupArray* d =
new ChartGroupArray;
8540 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8543 pdg->m_group_name = psg->m_group_name;
8544 pdg->m_element_array.reserve(psg->m_element_array.size());
8546 for (
auto& elem : psg->m_element_array)
8547 pdg->m_element_array.push_back(elem);
8554 void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8564 EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8565 EVT_NOTEBOOK_PAGE_CHANGED(
8567 ChartGroupsUI::OnGroupPageChange)
8571 : wxScrolledWindow(parent) {
8572 m_GroupSelectedPage = -1;
8573 m_pActiveChartsTree = 0;
8575 lastSelectedCtl = NULL;
8576 allAvailableCtl = NULL;
8577 defaultAllCtl = NULL;
8579 m_pAddButton = NULL;
8580 m_pRemoveButton = NULL;
8581 m_pDeleteGroupButton = NULL;
8582 m_pNewGroupButton = NULL;
8583 m_pGroupArray = NULL;
8586 m_UIcomplete =
false;
8587 m_treespopulated =
false;
8588 dialogFont = GetOCPNScaledFont(_(
"Dialog"));
8591 ChartGroupsUI::~ChartGroupsUI(
void) {
8592 m_DirCtrlArray.Clear();
8593 m_GroupNB->Disconnect(
8594 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
8595 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
8600 void ChartGroupsUI::SetInitialSettings(
void) {
8601 m_settingscomplete = FALSE;
8602 m_treespopulated = FALSE;
8605 void ChartGroupsUI::PopulateTrees(
void) {
8608 wxArrayString dir_array;
8609 int nDir = m_db_dirs.GetCount();
8610 for (
int i = 0; i < nDir; i++) {
8611 wxString dirname = m_db_dirs[i].fullpath;
8612 if (!dirname.IsEmpty()) dir_array.Add(dirname);
8615 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
8617 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
8621 wxArrayString dir_array0;
8622 int nDir0 = m_db_dirs.GetCount();
8623 for (
int i = 0; i < nDir0; i++) {
8624 wxString dirname = m_db_dirs[i].fullpath;
8625 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
8627 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
8628 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
8631 void ChartGroupsUI::CompleteInitialSettings(
void) {
8634 BuildNotebookPages(m_pGroupArray);
8636 m_panel->GetSizer()->Layout();
8638 m_settingscomplete = TRUE;
8639 m_treespopulated = TRUE;
8642 void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
8643 const wxArrayString& dir_array,
8644 const wxColour& col, wxFont* pFont) {
8645 ptc->DeleteAllItems();
8647 wxDirItemData* rootData =
new wxDirItemData(_T(
"Dummy"), _T(
"Dummy"), TRUE);
8649 rootName = _T(
"Dummy");
8650 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
8651 ptc->SetItemHasChildren(m_rootId);
8654 int nDir = dir_array.GetCount();
8655 for (
int i = 0; i < nDir; i++) {
8656 wxString dirname = dir_array[i];
8657 if (!dirname.IsEmpty()) {
8658 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
8659 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
8662 ptc->SetItemText(
id, dirname);
8663 if (pFont) ptc->SetItemFont(
id, *pFont);
8667 ptc->SetItemTextColour(
id, col);
8669 ptc->SetItemHasChildren(
id);
8674 void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
8675 wxString insert_candidate = allAvailableCtl->GetPath();
8676 if (!insert_candidate.IsEmpty()) {
8677 if (m_DirCtrlArray.GetCount()) {
8678 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8679 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8681 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8683 if (ptree->IsEmpty()) {
8684 wxDirItemData* rootData =
8685 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
8686 wxString rootName = _T(
"Dummy");
8687 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
8689 ptree->SetItemHasChildren(rootId);
8692 wxTreeItemId root_Id = ptree->GetRootItem();
8693 wxDirItemData* dir_item =
8694 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
8696 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
8697 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
8700 pGroup->m_element_array.push_back({insert_candidate});
8705 allAvailableCtl->GetTreeCtrl()->UnselectAll();
8706 m_pAddButton->Disable();
8708 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8710 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8711 if (ptree) ptree->Refresh();
8715 void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
8716 if (m_DirCtrlArray.GetCount()) {
8717 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8718 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8721 wxString sel_item = pDirCtrl->GetPath();
8723 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8724 if (ptree && ptree->GetCount()) {
8725 wxTreeItemId
id = ptree->GetSelection();
8726 lastDeletedItem = id;
8728 wxString branch_adder;
8729 int group_item_index =
8730 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
8731 if (group_item_index >= 0) {
8733 pGroup->m_element_array[group_item_index];
8734 bool b_duplicate = FALSE;
8735 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
8737 if (pelement.m_missing_name_array[k] == sel_item) {
8743 pelement.m_missing_name_array.Add(sel_item);
8749 if (branch_adder == _T(
"")) {
8751 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
8754 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
8760 lastSelectedCtl->Unselect();
8761 lastSelectedCtl = 0;
8762 m_pRemoveButton->Disable();
8764 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8766 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8767 if (ptree) ptree->Refresh();
8775 void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
8776 m_GroupSelectedPage =
event.GetSelection();
8777 allAvailableCtl->GetTreeCtrl()->UnselectAll();
8778 if (lastSelectedCtl) {
8779 lastSelectedCtl->UnselectAll();
8780 lastSelectedCtl = 0;
8782 m_pRemoveButton->Disable();
8783 m_pAddButton->Disable();
8786 if (m_GroupSelectedPage == 0) {
8787 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
8789 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
8793 void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
8794 wxObject* evtObj =
event.GetEventObject();
8795 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
8796 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
8797 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
8798 m_pAddButton->Enable();
8800 m_pAddButton->Disable();
8803 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
8804 if (!lastSelectedCtl)
goto out;
8805 wxTreeItemId item = lastSelectedCtl->GetSelection();
8806 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
8809 wxGenericDirCtrl* dirCtrl =
8810 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
8811 if (!dirCtrl)
goto out;
8812 wxString itemPath = dirCtrl->GetPath();
8813 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
8815 m_pRemoveButton->Disable();
8823 void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
8824 wxTextEntryDialog* pd =
new wxTextEntryDialog();
8825 wxFont* qFont = GetOCPNScaledFont(_(
"Dialog"));
8826 pd->SetFont(*qFont);
8828 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
8831 androidDisableRotation();
8834 if (pd->ShowModal() == wxID_OK) {
8835 if (pd->GetValue().Length()) {
8836 AddEmptyGroupPage(pd->GetValue());
8838 pGroup->m_group_name = pd->GetValue();
8839 m_pGroupArray->Add(pGroup);
8841 m_GroupSelectedPage =
8842 m_GroupNB->GetPageCount() - 1;
8843 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
8844 m_pDeleteGroupButton->Enable();
8851 androidEnableRotation();
8855 void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
8856 if (0 != m_GroupSelectedPage) {
8857 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
8858 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
8859 m_GroupNB->DeletePage(m_GroupSelectedPage);
8862 if (m_GroupSelectedPage <= 0) {
8863 m_pAddButton->Disable();
8864 m_pDeleteGroupButton->Disable();
8868 int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
8869 wxTreeItemId item, wxString* pbranch_adder) {
8870 wxString branch_name;
8871 wxString branch_adder;
8873 wxTreeItemId current_node = item;
8874 while (current_node.IsOk()) {
8875 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
8876 if (!parent_node)
break;
8878 if (parent_node == ptree->GetRootItem()) {
8879 branch_name = ptree->GetItemText(current_node);
8883 branch_adder.Prepend(ptree->GetItemText(current_node));
8884 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
8886 current_node = ptree->GetItemParent(current_node);
8890 unsigned int target_item_index = -1;
8892 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
8893 const wxString &target = pGroup->m_element_array[i].m_element_name;
8894 if (branch_name == target) {
8895 target_item_index = i;
8900 if (pbranch_adder) *pbranch_adder = branch_adder;
8902 return target_item_index;
8905 void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
8906 wxTreeItemId node =
event.GetItem();
8908 if (m_GroupSelectedPage <= 0)
return;
8909 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8910 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8911 if (!pDirCtrl)
return;
8913 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8914 wxString branch_adder;
8915 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
8916 if (target_item_index < 0)
return;
8918 pGroup->m_element_array[target_item_index];
8919 const wxString &branch_name = target_element.m_element_name;
8923 if (!target_element.m_missing_name_array.GetCount())
return;
8924 wxString full_root = branch_name;
8925 full_root += branch_adder;
8926 full_root += wxString(wxFILE_SEP_PATH);
8928 wxTreeItemIdValue cookie;
8929 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
8930 while (child.IsOk()) {
8931 wxString target_string = full_root;
8932 target_string += ptree->GetItemText(child);
8934 for (
unsigned int k = 0;
8935 k < target_element.m_missing_name_array.GetCount(); k++) {
8936 if (target_element.m_missing_name_array[k] == target_string) {
8937 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
8941 child = ptree->GetNextChild(node, cookie);
8945 void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
8948 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
8950 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
8953 int nItems = pGroup->m_element_array.size();
8954 for (
int i = 0; i < nItems; i++) {
8955 const wxString &itemname = pGroup->m_element_array[i].m_element_name;
8956 if (!itemname.IsEmpty()) {
8957 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
8959 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
8961 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
8967 wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
8968 wxGenericDirCtrl* GroupDirCtl =
8969 new wxGenericDirCtrl(m_GroupNB, wxID_ANY, _T(
"TESTDIR"));
8970 m_GroupNB->AddPage(GroupDirCtl, label);
8972 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
8973 ptree->DeleteAllItems();
8975 wxDirItemData* rootData =
8976 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
8977 wxString rootName = _T(
"Dummy");
8978 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
8979 ptree->SetItemHasChildren(rootId);
8981 m_DirCtrlArray.Add(GroupDirCtl);
8986 void ChartGroupsUI::ClearGroupPages() {
8987 if (m_GroupNB->GetPageCount() == 0)
return;
8989 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
8990 m_DirCtrlArray.RemoveAt(i);
8991 m_GroupNB->DeletePage(i);
8995 void options::OnInsertTideDataLocation(wxCommandEvent& event) {
8997 int response = wxID_CANCEL;
9000 wxFileDialog* popenDialog =
new wxFileDialog(
9001 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir, wxT(
""),
9002 wxT(
"Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All ")
9003 wxT(
"files (*.*)|*.*"),
9006 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
9008 response = popenDialog->ShowModal();
9009 sel_file = popenDialog->GetPath();
9014 response = g_Platform->DoFileSelectorDialog(
this, &path,
9015 _(
"Select Tide/Current Data"),
9016 g_TCData_Dir, _T(
""), wxT(
"*.*"));
9020 if (response == wxID_OK) {
9022 int id = tcDataSelected->GetItemCount();
9024 long idx = tcDataSelected->InsertItem(li);
9025 tcDataSelected->SetItem(
id, 0, g_Platform->NormalizePath(sel_file));
9028 wxFileName fn(sel_file);
9029 wxString data_dir = fn.GetPath();
9030 g_TCData_Dir = g_Platform->NormalizePath(data_dir);
9034 void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9037 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9038 wxLIST_STATE_SELECTED);
9039 if (item == -1)
break;
9040 tcDataSelected->DeleteItem(item);
9047 enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9050 BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9051 EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9052 EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9055 OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9056 : wxDialog(parent, wxID_ANY, _T( "OpenGL Options" ), wxDefaultPosition,
9058 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9063 m_brebuild_cache(FALSE) {
9065 wxFont* dialogFont = GetOCPNScaledFont(_(
"Dialog"));
9066 SetFont(*dialogFont);
9068 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9069 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9071 m_cbTextureCompression =
9072 new wxCheckBox(
this, wxID_ANY,
9073 g_bGLexpert ? _(
"Texture Compression")
9074 : _(
"Texture Compression with Caching"));
9075 m_cbTextureCompressionCaching =
9076 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9078 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9079 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9080 m_sTextureMemorySize->SetRange(1, 16384);
9082 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9083 wxButton* btnRebuild =
9084 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9085 wxButton* btnClear =
9086 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9087 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9088 if (!g_bopengl || g_raster_format == GL_RGB) btnRebuild->Disable();
9089 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9090 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9091 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9093 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9094 m_cbUseAcceleratedPanning =
9095 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9097 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9098 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9099 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9100 flexSizer->AddSpacer(0);
9101 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9102 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9103 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9104 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9105 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9106 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9107 flexSizer->AddSpacer(0);
9108 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9109 flexSizer->AddSpacer(0);
9110 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9111 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9112 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9113 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9114 flexSizer->AddSpacer(0);
9115 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9116 flexSizer->AddSpacer(0);
9117 flexSizer->AddSpacer(0);
9118 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9119 flexSizer->AddSpacer(0);
9120 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9121 flexSizer->AddGrowableCol(1);
9122 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9124 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9125 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9126 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9127 btnSizer->Realize();
9129 mainSizer->AddStretchSpacer();
9130 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9134 SetSizer(mainSizer);
9135 mainSizer->SetSizeHints(
this);
9139 bool OpenGLOptionsDlg::GetAcceleratedPanning(
void)
const {
9140 return m_cbUseAcceleratedPanning->GetValue();
9143 bool OpenGLOptionsDlg::GetTextureCompression(
void)
const {
9144 return m_cbTextureCompression->GetValue();
9147 bool OpenGLOptionsDlg::GetPolygonSmoothing(
void)
const {
9148 return m_cbPolygonSmoothing->GetValue();
9151 bool OpenGLOptionsDlg::GetLineSmoothing(
void)
const {
9152 return m_cbLineSmoothing->GetValue();
9155 bool OpenGLOptionsDlg::GetSoftwareGL(
void)
const {
9156 return m_cbSoftwareGL->GetValue();
9159 bool OpenGLOptionsDlg::GetTextureCompressionCaching(
void)
const {
9160 return m_cbTextureCompressionCaching->GetValue();
9163 bool OpenGLOptionsDlg::GetRebuildCache(
void)
const {
return m_brebuild_cache; }
9165 int OpenGLOptionsDlg::GetTextureMemorySize(
void)
const {
9166 return m_sTextureMemorySize->GetValue();
9169 void OpenGLOptionsDlg::Populate(
void) {
9171 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9179 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9180 m_memorySize->Show(g_bGLexpert);
9181 m_sTextureMemorySize->Show(g_bGLexpert);
9183 m_cbTextureCompressionCaching->SetValue(
9184 g_GLOptions.m_bTextureCompressionCaching);
9185 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9187 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9188 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9190 #if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9191 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9192 if (gFrame->GetPrimaryCanvas()
9194 ->GetVersionString()
9196 .Find(_T(
"MESA" )) != wxNOT_FOUND)
9197 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9200 m_cbSoftwareGL->Hide();
9203 wxFont* dialogFont = GetOCPNScaledFont(_(
"Dialog"));
9204 SetFont(*dialogFont);
9207 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9208 if (gFrame->GetPrimaryCanvas()->GetglCanvas()->CanAcceleratePanning()) {
9209 m_cbUseAcceleratedPanning->Enable();
9210 m_cbUseAcceleratedPanning->SetValue(
9211 g_GLOptions.m_bUseAcceleratedPanning);
9213 m_cbUseAcceleratedPanning->SetValue(FALSE);
9214 m_cbUseAcceleratedPanning->Disable();
9217 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9220 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9221 m_cbUseAcceleratedPanning->Disable();
9225 void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9226 if (g_GLOptions.m_bTextureCompressionCaching) {
9227 m_brebuild_cache = TRUE;
9228 EndModal(wxID_CANCEL);
9232 void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9233 if (g_bopengl && g_glTextureManager) {
9234 ::wxBeginBusyCursor();
9235 g_glTextureManager->ClearAllRasterTextures();
9238 appendOSDirSlash(&path);
9239 path.append(_T(
"raster_texture_cache"));
9241 if (::wxDirExists(path)) {
9242 wxArrayString files;
9243 size_t nfiles = wxDir::GetAllFiles(path, &files);
9244 for (
unsigned int i = 0; i < files.GetCount(); i++)
9245 ::wxRemoveFile(files[i]);
9248 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9249 ::wxEndBusyCursor();
9253 wxString OpenGLOptionsDlg::GetTextureCacheSize(
void) {
9255 appendOSDirSlash(&path);
9256 path.append(_T(
"raster_texture_cache"));
9257 long long total = 0;
9259 if (::wxDirExists(path)) {
9260 wxArrayString files;
9261 size_t nfiles = wxDir::GetAllFiles(path, &files);
9262 for (
unsigned int i = 0; i < files.GetCount(); i++)
9263 total += wxFile(files[i]).Length();
9265 double mb = total / (1024.0 * 1024.0);
9266 if (mb < 10000.0)
return wxString::Format(_T(
"%.1f MB" ), mb);
9268 return wxString::Format(_T(
"%.1f GB" ), mb);
9276 EVT_PAINT(CanvasConfigSelect::OnPaint)
9280 wxWindowID
id, wxBitmap& bmp,
9281 const wxPoint& pos, const wxSize& size)
9282 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9283 m_parentOptions = parentOptions;
9288 int refHeight = GetCharHeight();
9290 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9291 bmp.GetSize().y + m_borderWidth * 2));
9293 Connect(wxEVT_LEFT_DOWN,
9294 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9297 CanvasConfigSelect::~CanvasConfigSelect() {}
9299 void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9305 if (m_parentOptions)
9306 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9309 void CanvasConfigSelect::SetSelected(
bool selected) {
9310 m_bSelected = selected;
9313 m_boxColour = wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9315 m_boxColour = wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9321 void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9323 GetSize(&width, &height);
9326 dc.SetBackground(*wxLIGHT_GREY);
9328 dc.SetPen(*wxTRANSPARENT_PEN);
9329 dc.SetBrush(wxBrush(GetBackgroundColour()));
9330 dc.DrawRectangle(GetVirtualSize());
9333 dc.SetBrush(wxBrush(m_boxColour));
9334 dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT), 3));
9335 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9337 dc.SetBrush(wxBrush(m_boxColour));
9338 dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT), 3));
9339 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9342 dc.DrawBitmap(m_bmpNormal, m_borderWidth, m_borderWidth,
false);
Global state for AIS decoder.
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
const void Notify()
Notify all listeners, no data supplied.
Wrapper for global variable, supports notification events when value changes.
static double ui_to_config(int slider_pos)
Convert a slider scale 1-100 value to configuration value 1.02..3.0.
EventVar m_on_sp_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Define an action to be performed when a KeyProvider is notified.
void Init(const KeyProvider &kp, std::function< void(ObservedEvt &ev)> action)
Initiate an object yet not listening.
Adds a std::shared<void> element to wxCommandEvent.
bool LoadAllPlugIns(bool enabled_plugins, bool keep_orphans=false)
Update catalog with imported metadata and load all plugin library files.
EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Global variables reflecting command line options and arguments.
wxDEFINE_EVENT(REST_IO_EVT, ObservedEvt)
Event from IO thread to main.
Access checks for comm devices and dongle.