45#include <wx/clrpicker.h>
48#include <wx/display.h>
49#include <wx/fontdata.h>
50#include <wx/fontdlg.h>
51#include <wx/imaglist.h>
52#include <wx/listbox.h>
53#include <wx/mediactrl.h>
54#include <wx/odcombo.h>
55#include <wx/progdlg.h>
56#include <wx/radiobox.h>
58#include <wx/renderer.h>
59#include <wx/statline.h>
60#include <wx/stdpaths.h>
61#include <wx/textwrapper.h>
62#include <wx/tokenzr.h>
66#if defined(__WXGTK__) || defined(__WXQT__)
67#include <wx/colordlg.h>
71#include "ocpn_fontdlg.h"
78#include "model/ais_target_data.h"
81#include "model/comm_util.h"
83#include "model/idents.h"
85#include "model/navutil_base.h"
86#include "model/own_ship.h"
87#include "model/routeman.h"
88#include "model/ser_ports.h"
89#include "model/wx28compat.h"
105#include "ocpn_frame.h"
106#include "OCPNPlatform.h"
107#include "OCPN_Sound.h"
111#include "SoundFactory.h"
114#include "SystemCmdSound.h"
115#include "usb_devices.h"
116#include "waypointman_gui.h"
119#include "glChartCanvas.h"
120extern GLuint g_raster_format;
128#include "androidUTIL.h"
132#include <QtWidgets/QScroller>
136#if wxCHECK_VERSION(3, 2, 0)
137#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
139#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS
142#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
145wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
147wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
152extern bool g_bSoftwareGL;
154extern bool g_bShowOutlines;
155extern bool g_bShowChartBar;
156extern bool g_bShowDepthUnits;
157extern bool g_bskew_comp;
158extern bool g_bopengl;
159extern bool g_bChartBarEx;
161extern int g_chart_zoom_modifier_raster;
162extern int g_chart_zoom_modifier_vector;
163extern bool g_bUIexpert;
165extern wxString* pInit_Chart_Dir;
174extern bool g_bShowLiveETA;
175extern double g_defaultBoatSpeed;
176extern double g_defaultBoatSpeedUserUnit;
178extern bool g_bNavAidRadarRingsShown;
179extern float g_fNavAidRadarRingsStep;
180extern int g_pNavAidRadarRingsStepUnits;
181extern bool g_bWayPointPreventDragging;
182extern wxColour g_colourOwnshipRangeRingsColour;
183extern bool g_bShowShipToActive;
184extern int g_shipToActiveStyle;
185extern int g_shipToActiveColor;
187extern bool g_own_ship_sog_cog_calc;
188extern int g_own_ship_sog_cog_calc_damp_sec;
190extern bool g_bPreserveScaleOnX;
191extern bool g_bPlayShipsBells;
193extern wxString g_CmdSoundString;
195extern int g_iSoundDeviceIndex;
196extern bool g_bFullscreenToolbar;
197extern bool g_bTransparentToolbar;
198extern bool g_bTransparentToolbarInOpenGLOK;
200extern unsigned g_OwnShipmmsi;
201extern int g_OwnShipIconType;
202extern double g_n_ownship_length_meters;
203extern double g_n_ownship_beam_meters;
204extern double g_n_gps_antenna_offset_y;
205extern double g_n_gps_antenna_offset_x;
206extern int g_n_ownship_min_mm;
208extern bool g_bEnableZoomToCursor;
209extern bool g_bHighliteTracks;
210extern wxColour g_colourTrackLineColour;
212extern bool g_bAdvanceRouteWaypointOnArrivalOnly;
214extern int g_cm93_zoom_factor;
218extern bool g_bCourseUp;
219extern bool g_bLookAhead;
221extern double g_ownship_predictor_minutes;
222extern double g_ownship_HDTpredictor_miles;
224extern bool g_bQuiltEnable;
225extern bool g_bFullScreenQuilt;
226extern bool g_bConfirmObjectDelete;
229extern wxLocale* plocale_def_lang;
232extern double g_mouse_zoom_sensitivity;
233extern int g_mouse_zoom_sensitivity_ui;
235extern OcpnSound* g_anchorwatch_sound;
237extern bool g_fog_overzoom;
238extern bool g_oz_vector_scale;
239extern bool g_bShowStatusBar;
241extern s52plib* ps52plib;
243extern wxString g_locale;
252extern bool g_bGLexpert;
254#define ID_CHOICE_NMEA wxID_HIGHEST + 1
256extern std::vector<std::string> TideCurrentDataSet;
257extern wxString g_TCData_Dir;
261extern bool g_bShowMenuBar;
262extern bool g_bShowCompassWin;
264extern bool g_bresponsive;
265extern bool g_bAutoHideToolbar;
266extern int g_nAutoHideToolbar;
267extern int g_GUIScaleFactor;
268extern int g_ChartScaleFactor;
269extern float g_MarkScaleFactorExp;
271extern int g_ShipScaleFactor;
272extern float g_ShipScaleFactorExp;
273extern int g_ENCSoundingScaleFactor;
274extern int g_ENCTextScaleFactor;
275extern bool g_bShowMuiZoomButtons;
278extern bool g_config_display_size_manual;
279extern unsigned int g_canvasConfig;
281extern wxString g_lastAppliedTemplateGUID;
282extern wxString g_default_wp_icon;
283extern int osMajor, osMinor;
284extern bool g_bShowMuiZoomButtons;
286extern bool g_btenhertz;
289extern int g_Android_SDK_Version;
290extern MigrateAssistantDialog* g_migrateDialog;
293extern wxString GetShipNameFromFile(
int);
295WX_DEFINE_ARRAY_PTR(
ChartCanvas*, arrayofCanvasPtr);
296extern arrayofCanvasPtr g_canvasArray;
298using CBList = std::list<wxCheckBox*>;
303static int lang_list[] = {
304 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
305 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
306 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
307 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
308 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
309 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
310 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
311 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
313 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
314 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
315 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
316 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
317 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
318 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
326 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
327 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
328 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
329 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
330 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
331 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
332 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
333 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
334 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
335 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
336 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
337 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
338 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
339 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
340 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
341 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
342 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
343 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
344 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
345 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
346 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
347 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
348 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
349 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
350 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
353 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
354 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
355 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
356 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
357 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
359 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
360 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
361 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
362 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
363 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
364 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
365 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
366 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
367 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
368 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
369 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
370 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
371 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
372 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
373 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
374 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
375 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
376 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
377 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
379 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
380 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
381 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
382 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
383 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
384 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
385 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
386 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
387 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
388 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
389 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
390 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
391 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
395void prepareSlider(wxSlider* slider) {
396 slider->GetHandle()->setStyleSheet(
397 prepareAndroidSliderStyleSheet(slider->GetSize().x));
398 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
399 slider->GetHandle()->grabGesture(Qt::PanGesture);
400 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
405int wxCALLBACK SortConnectionOnPriority(wxIntPtr item1, wxIntPtr item2,
407 wxListCtrl* lc =
reinterpret_cast<wxListCtrl*
>(list);
410 it1.SetId(lc->FindItem(-1, item1));
412 it1.SetMask(it1.GetMask() | wxLIST_MASK_TEXT);
414 it2.SetId(lc->FindItem(-1, item2));
416 it2.SetMask(it2.GetMask() | wxLIST_MASK_TEXT);
422 return it1.GetText().CmpNoCase(it2.GetText());
424 return it2.GetText().CmpNoCase(it1.GetText());
437 wxString textMod = text;
438 textMod.Replace(
" ",
"^");
441 wxString sep = wxFileName::GetPathSeparator();
442 textMod.Replace(sep,
" ");
444 Wrap(win, textMod, widthMax);
447 for (
size_t i = 0; i < m_array.GetCount(); i++) {
448 wxString a = m_array[i];
450 if (m_array.GetCount() > 1) {
451 if (i < m_array.GetCount() - 1) a += sep;
457 wxString
const& GetWrapped()
const {
return m_wrapped; }
458 int const GetLineCount()
const {
return m_lineCount; }
459 wxArrayString GetLineArray() {
return m_array; }
462 virtual void OnOutputLine(
const wxString& line) {
466 virtual void OnNewLine() {
474 wxArrayString m_array;
483 void DoChartSelected();
484 void SetSelected(
bool selected);
485 void OnPaint(wxPaintEvent& event);
487 void OnSize(wxSizeEvent& event);
489 int GetUnselectedHeight() {
return m_unselectedHeight; }
490 int GetRefHeight() {
return m_refHeight; }
491 bool IsSelected() {
return m_bSelected; }
492 void OnClickDown(wxMouseEvent& event);
493 void OnClickUp(wxMouseEvent& event);
498 wxColour m_boxColour;
499 int m_unselectedHeight;
500 wxString m_pChartDir;
504 DECLARE_EVENT_TABLE()
508EVT_PAINT(OCPNChartDirPanel::OnPaint)
510EVT_SIZE(OCPNChartDirPanel::OnSize)
514 const wxPoint& pos, const wxSize& size,
516 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
517 m_pChartDir = cdi.fullpath;
520 if (cdi.fullpath.StartsWith(
521 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
522 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
527 m_refHeight = GetCharHeight();
529 m_unselectedHeight = 2 * m_refHeight;
535 SetMinSize(wxSize(-1, m_unselectedHeight));
537 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
540 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
545OCPNChartDirPanel::~OCPNChartDirPanel() {}
547static wxStopWatch swclick;
549static int downx, downy;
552void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
555 event.GetPosition(&downx, &downy);
561void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
563 qDebug() << swclick.Time();
564 if (swclick.Time() < 200) {
566 event.GetPosition(&upx, &upy);
567 if ((fabs(upx - downx) < GetCharWidth()) &&
568 (fabs(upy - downy) < GetCharWidth())) {
576void OCPNChartDirPanel::DoChartSelected() {
586void OCPNChartDirPanel::SetSelected(
bool selected) {
587 m_bSelected = selected;
591 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
594 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
599 g_pOptions->SetDirActionButtons();
606void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
607 if (m_pChartDir.Length()) {
609 GetClientSize(&x, &y);
612 wxArrayString nameWrapped = wrapper.GetLineArray();
614 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
620void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
622 GetSize(&width, &height);
625 dc.SetPen(*wxTRANSPARENT_PEN);
626 dc.SetBrush(wxBrush(GetBackgroundColour()));
627 dc.DrawRectangle(GetVirtualSize());
629 wxString nameString = m_pChartDir;
631 wxArrayString nameWrapped = wrapper.GetLineArray();
633 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
634 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
635 GetParent()->GetSizer()->Layout();
639 dc.SetBrush(wxBrush(m_boxColour));
641 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
643 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
645 int offset = height / 10;
646 int text_x = offset * 2;
648 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
651 dc.SetTextForeground(
652 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
654 int yd = height * 20 / 100;
655 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
657 dc.DrawText(nameWrapped[i], text_x, yd);
659 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
660 yd += GetCharHeight();
664 dc.SetBrush(wxBrush(m_boxColour));
667 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME),
670 int offset = height / 10;
671 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
672 height - (2 * offset), height / 10);
674 int text_x = offset * 2;
676 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
679 dc.SetTextForeground(
680 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
682 int yd = height * 20 / 100;
683 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
685 dc.DrawText(nameWrapped[i], text_x, yd);
687 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
688 yd += GetCharHeight();
696static bool LoadAllPlugIns(
bool load_enabled) {
697 g_Platform->ShowBusySpinner();
698 bool b = PluginLoader::GetInstance()->
LoadAllPlugIns(load_enabled);
699 g_Platform->HideBusySpinner();
708 const wxPoint& pt = wxDefaultPosition,
709 const wxSize& sz = wxDefaultSize,
710 long style = wxHSCROLL | wxVSCROLL,
711 const wxString& name =
"scrolledWindow") {
712 Create(parent,
id, pt, sz, style, name);
715 bool Create(wxWindow* parent, wxWindowID
id = -1,
716 const wxPoint& pt = wxDefaultPosition,
717 const wxSize& sz = wxDefaultSize,
718 long style = wxHSCROLL | wxVSCROLL,
719 const wxString& name =
"scrolledWindow");
723 unsigned int Append(wxString& label,
bool benable =
true,
724 bool bsizerLayout =
true);
725 unsigned int GetCount() {
return m_list.size(); }
730 void Check(
int index,
bool val);
731 bool IsChecked(
int index);
739bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
740 const wxPoint& pt,
const wxSize& sz,
741 long style,
const wxString& name) {
742 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
745 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
746 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
750 m_sizer =
new wxBoxSizer(wxVERTICAL);
756unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable,
758 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
760 cb->SetValue(!benable);
762 if (bsizerLayout) m_sizer->Layout();
764 m_list.push_back(cb);
766 return m_list.size() - 1;
769void OCPNCheckedListCtrl::Check(
int index,
bool val) {
770 auto it = m_list.begin();
771 std::advance(it, index);
772 wxCheckBox* cb = *it;
774 if (cb) cb->SetValue(val);
777bool OCPNCheckedListCtrl::IsChecked(
int index) {
778 auto it = m_list.begin();
779 std::advance(it, index);
780 wxCheckBox* cb = *it;
782 return cb ? cb->GetValue() :
false;
785void OCPNCheckedListCtrl::RunLayout() { m_sizer->Layout(); }
787void OCPNCheckedListCtrl::Clear() {
793void appendOSDirSlash(wxString* pString);
795extern ArrayOfMmsiProperties g_MMSI_Props_Array;
802EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
803EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
807 const wxString& caption,
808 const wxPoint& pos, const wxSize& size,
810 : wxDialog(parent,
id, caption, pos, size,
811 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
813 GetSizer()->SetSizeHints(
this);
817ConfigCreateDialog::~ConfigCreateDialog(
void) {}
819void ConfigCreateDialog::CreateControls(
void) {
820 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
823 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
824 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
826 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
827 wxSize(40 * GetCharHeight(), -1), 0);
828 mainSizer->Add(m_TitleCtl, 0,
829 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
831 mainSizer->AddSpacer(2 * GetCharHeight());
833 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
834 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
837 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
838 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
839 mainSizer->Add(m_DescriptionCtl, 0,
840 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
842 mainSizer->AddSpacer(2 * GetCharHeight());
847 _(
"Create a private configuration template based on current settings.\n\
848This template will be saved, and may be selected for further use at any time.\n\
850 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
852 mainSizer->AddSpacer(2 * GetCharHeight());
854 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
855 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
857 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
858 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
860 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
861 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
862 m_OKButton->SetDefault();
865void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
866 EndModal(wxID_CANCEL);
869void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
870 const wxString& title = m_TitleCtl->GetValue();
871 const wxString& desc = m_DescriptionCtl->GetValue();
872 m_createdTemplateGUID = ConfigMgr::Get().CreateNamedConfig(title, desc,
"");
881EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
882EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
886 wxWindowID
id, const wxString& caption,
887 const wxPoint& pos, const wxSize& size,
889 : wxDialog(parent,
id, caption, pos, size,
890 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
893 GetSizer()->SetSizeHints(
this);
897MMSIEditDialog::~MMSIEditDialog(
void) {
delete m_MMSICtl; }
899void MMSIEditDialog::CreateControls(
void) {
900 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
903 wxStaticBox* mmsiBox =
904 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
906 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
907 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
909 wxStaticText* mmsiLabel =
new wxStaticText(
this, wxID_STATIC, _(
"MMSI"));
910 mmsiLabel->SetToolTip(
911 _(
"Maritime Mobile Service Identity - A unique 9-digit number assigned "
912 "to a vessel or navigation aid. Used to identify vessels and devices "
913 "in AIS transmissions and DSC calls."));
914 mmsiSizer->Add(mmsiLabel, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
916 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
917 wxDefaultPosition, wxSize(180, -1), 0);
918 m_MMSICtl->SetToolTip(
919 _(
"Enter the 9-digit MMSI number for this vessel or station"));
920 mmsiSizer->Add(m_MMSICtl, 0,
921 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
922 m_MMSICtl->Bind(wxEVT_TEXT, &MMSIEditDialog::OnMMSIChanged,
this);
924 wxStaticText* userLabelText =
new wxStaticText(
this, wxID_STATIC, _(
"Name"));
925 userLabelText->SetToolTip(
926 _(
"Display name for this vessel or device - can override names received "
928 mmsiSizer->Add(userLabelText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
930 m_ShipNameCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
931 wxDefaultPosition, wxSize(180, -1), 0);
932 m_ShipNameCtl->SetToolTip(_(
933 "Set the name for this vessel or device. If specified, this name takes "
934 "precedence over names received via AIS messages. Note that standard AIS "
935 "only supports uppercase letters (A-Z), numbers, and limited "
936 "punctuation. Your manual entries are stored in the mmsitoname.csv file "
937 "and preserved across sessions."));
938 mmsiSizer->Add(m_ShipNameCtl, 0,
939 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
941 wxStaticBox* trackBox =
new wxStaticBox(
this, wxID_ANY, _(
"Tracking"));
942 trackBox->SetToolTip(_(
"Control how tracks are created for this MMSI"));
943 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackBox, wxVERTICAL);
945 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
947 m_rbTypeTrackDefault =
948 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
949 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
950 m_rbTypeTrackDefault->SetToolTip(
951 _(
"Use the global tracking settings for this vessel"));
952 m_rbTypeTrackDefault->SetValue(TRUE);
953 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
955 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
956 m_rbTypeTrackAlways->SetToolTip(_(
957 "Always create a track for this vessel, regardless of global settings"));
958 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
960 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
961 m_rbTypeTrackNever->SetToolTip(
962 _(
"Never create a track for this vessel, regardless of global settings"));
963 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
965 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
966 m_cbTrackPersist->SetToolTip(
967 _(
"Save this vessel's track between OpenCPN sessions. Useful for vessels "
968 "you want to monitor continuously over time."));
969 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
971 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
972 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
974 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
975 m_IgnoreButton->SetToolTip(
976 _(
"When checked, AIS data for this MMSI will be ignored and the vessel "
977 "will not appear on the chart. Useful for suppressing shore stations, "
978 "permanently moored vessels, or duplicate AIS signals that you don't "
979 "need to monitor."));
980 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
982 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
983 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
984 m_MOBButton->SetToolTip(
985 _(
"When checked, OpenCPN will display a special icon for this device, "
986 "sound a distinctive alarm, and automatically create a temporary MOB "
987 "route from your vessel to this device in emergency. For crew safety "
988 "devices, you can assign the crew member's name using the Name "
989 "field above for quick identification."));
990 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
993 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
994 m_VDMButton->SetToolTip(
995 _(
"When checked, converts AIS messages for this vessel from AIVDM (other "
996 "vessel) to AIVDO (own vessel) format."));
997 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
999 m_FollowerButton =
new wxCheckBox(
1000 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
1001 m_FollowerButton->SetToolTip(
1002 _(
"When checked, disables CPA (Closest Point of Approach) alerts for "
1003 "this vessel as it's considered intentionally following your vessel. "
1004 "Follower vessels are displayed with a special own-ship style icon."));
1005 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
1007 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
1008 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
1010 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
1011 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1013 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
1014 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1015 m_OKButton->SetDefault();
1019 if (m_props->MMSI > 0)
1020 sMMSI.Printf(
"%d", m_props->MMSI);
1023 m_MMSICtl->AppendText(sMMSI);
1026 if (!m_props->m_ShipName.IsEmpty()) {
1027 m_ShipNameCtl->SetValue(m_props->m_ShipName);
1030 switch (m_props->TrackType) {
1031 case TRACKTYPE_ALWAYS:
1032 m_rbTypeTrackAlways->SetValue(TRUE);
1034 case TRACKTYPE_NEVER:
1035 m_rbTypeTrackNever->SetValue(TRUE);
1041 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
1042 m_IgnoreButton->SetValue(m_props->m_bignore);
1043 m_MOBButton->SetValue(m_props->m_bMOB);
1044 m_VDMButton->SetValue(m_props->m_bVDM);
1045 m_FollowerButton->SetValue(m_props->m_bFollower);
1047 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1050void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1052void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
1053 EndModal(wxID_CANCEL);
1056void MMSIEditDialog::Persist() {
1058 if (m_rbTypeTrackDefault->GetValue())
1059 m_props->TrackType = TRACKTYPE_DEFAULT;
1060 else if (m_rbTypeTrackAlways->GetValue())
1061 m_props->TrackType = TRACKTYPE_ALWAYS;
1063 m_props->TrackType = TRACKTYPE_NEVER;
1065 m_props->m_bignore = m_IgnoreButton->GetValue();
1066 m_props->m_bMOB = m_MOBButton->GetValue();
1067 m_props->m_bVDM = m_VDMButton->GetValue();
1068 m_props->m_bFollower = m_FollowerButton->GetValue();
1069 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
1072 wxString shipName = m_ShipNameCtl->GetValue().Upper();
1073 if (!shipName.IsEmpty()) {
1074 m_props->m_ShipName = shipName;
1077 wxString mmsi = m_MMSICtl->GetValue();
1078 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1079 g_pAIS->UpdateMMSItoNameFile(mmsi, shipName);
1084 else if (m_props->m_ShipName == wxEmptyString) {
1085 auto proptarget = g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
1087 wxString s = proptarget->GetFullName();
1088 m_props->m_ShipName = s;
1090 wxString GetShipNameFromFile(
int);
1091 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
1097void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
1101 m_MMSICtl->GetValue().ToLong(&nmmsi);
1102 m_props->MMSI = nmmsi;
1105 if (m_MMSICtl->GetValue().Length() != 9) {
1108 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
1109 "your entries and cancel if necessary."),
1110 _(
"OpenCPN Info"), wxOK | wxCANCEL);
1112 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
1113 if (retcode == wxID_OK) {
1124void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
1126void MMSIEditDialog::OnMMSIChanged(wxCommandEvent& event) {
1127 wxString mmsi = m_MMSICtl->GetValue();
1130 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1132 wxString shipName = g_pAIS->GetMMSItoNameEntry(mmsi);
1135 if (shipName.IsEmpty()) {
1136 auto target = g_pAIS->Get_Target_Data_From_MMSI(wxAtoi(mmsi));
1138 shipName = target->GetFullName();
1143 if (!shipName.IsEmpty()) {
1144 m_ShipNameCtl->SetValue(shipName);
1152EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1153EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1154EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1155 MMSIListCtrl::OnListItemRightClick)
1156EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1157EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1161 const wxSize& size,
long style)
1162 : wxListCtrl(parent,
id, pos, size, style) {
1166MMSIListCtrl::~MMSIListCtrl(
void) {}
1168wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1172 if (!props)
return ret;
1175 if (props->MMSI > 0) ret = wxString::Format(_T(
"%d" ), props->MMSI);
1178 switch (props->TrackType) {
1179 case TRACKTYPE_DEFAULT:
1182 case TRACKTYPE_ALWAYS:
1185 case TRACKTYPE_NEVER:
1191 if (props->m_bPersistentTrack)
1192 ret.Append(_T(
", " )).Append(_(
"Persistent"));
1195 if (props->m_bignore) ret = _T(
"X" );
1198 if (props->m_bMOB) ret = _T(
"X" );
1201 if (props->m_bVDM) ret = _T(
"X" );
1204 if (props->m_bFollower) ret =
"X";
1207 ret = props->m_ShipName;
1216void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1218void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1219 MmsiProperties* props = g_MMSI_Props_Array.Item(event.GetIndex());
1223 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1224 wxDefaultPosition, wxSize(200, 200));
1226 if (pd->ShowModal() == wxID_OK) {
1227 g_MMSI_Props_Array.RemoveAt(event.GetIndex());
1229 g_MMSI_Props_Array.Insert(props_new, event.GetIndex());
1236void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1237 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1238 if (m_context_item == wxNOT_FOUND)
return;
1239 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1240 wxMenuItem* item_edit =
1241 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") +
"...");
1242 menu->Append(item_edit);
1243 wxMenuItem* item_delete =
1244 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1245 menu->Append(item_delete);
1249 item_edit->SetFont(*qFont);
1250 item_delete->SetFont(*qFont);
1253 wxPoint p = ScreenToClient(wxGetMousePosition());
1254 PopupMenu(menu, p.x, p.y);
1256 SetItemCount(g_MMSI_Props_Array.GetCount());
1260void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1261 int context_item = m_context_item;
1266 switch (event.GetId()) {
1267 case ID_DEF_MENU_MMSI_EDIT: {
1270 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1271 wxDefaultPosition, wxSize(200, 200));
1273 if (pd->ShowModal() == wxID_OK) {
1274 g_MMSI_Props_Array.RemoveAt(context_item);
1276 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1277 g_MMSI_Props_Array.Insert(props_new, context_item);
1284 case ID_DEF_MENU_MMSI_DELETE:
1285 g_MMSI_Props_Array.RemoveAt(context_item);
1291MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1292 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1299 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1302 wxString MMSI_props_column_spec =
"120;120;100;100;100;100;100;100";
1304 wxStringTokenizer tkz(MMSI_props_column_spec,
";");
1305 wxString s_width = tkz.GetNextToken();
1310 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1311 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1312 wxBORDER_SUNKEN | wxLC_VIRTUAL);
1320 int dx = GetCharWidth();
1323 if (s_width.ToLong(&lwidth)) {
1324 width = wxMax(dx * 2, lwidth);
1325 width = wxMin(width, dx * 13);
1327 m_pListCtrlMMSI->InsertColumn(tlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, width);
1329 s_width = tkz.GetNextToken();
1331 if (s_width.ToLong(&lwidth)) {
1332 width = wxMax(dx * 2, lwidth);
1333 width = wxMin(width, dx * 25);
1335 m_pListCtrlMMSI->InsertColumn(tlCLASS, _(
"Track Mode"), wxLIST_FORMAT_CENTER,
1338 s_width = tkz.GetNextToken();
1340 if (s_width.ToLong(&lwidth)) {
1341 width = wxMax(dx * 2, lwidth);
1342 width = wxMin(width, dx * 10);
1344 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1347 s_width = tkz.GetNextToken();
1349 if (s_width.ToLong(&lwidth)) {
1350 width = wxMax(dx * 2, lwidth);
1351 width = wxMin(width, dx * 10);
1353 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"MOB"), wxLIST_FORMAT_CENTER, width);
1355 s_width = tkz.GetNextToken();
1357 if (s_width.ToLong(&lwidth)) {
1358 width = wxMax(dx * 2, lwidth);
1359 width = wxMin(width, dx * 15);
1361 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1364 s_width = tkz.GetNextToken();
1366 if (s_width.ToLong(&lwidth)) {
1367 width = wxMax(dx * 2, lwidth);
1368 width = wxMin(width, dx * 30);
1370 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ship name"), wxLIST_FORMAT_CENTER,
1373 s_width = tkz.GetNextToken();
1375 if (s_width.ToLong(&lwidth)) {
1376 width = wxMax(dx * 2, lwidth);
1377 width = wxMin(width, dx * 10);
1379 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Follower"), wxLIST_FORMAT_CENTER,
1382 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1384 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1386 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1387 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1389 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1396 SetSize(GetSize().x, GetSize().y - 1);
1398 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1401MMSI_Props_Panel::~MMSI_Props_Panel(
void) {}
1403void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1407 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1408 wxDefaultPosition, wxSize(200, 200));
1411 pd->ShowWindowModalThenDo([
this, pd, props](
int retcode) {
1412 if (retcode == wxID_OK) {
1413 g_MMSI_Props_Array.Add(props);
1421void MMSI_Props_Panel::UpdateMMSIList(
void) {
1423 long selItemID = wxNOT_FOUND;
1424 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1425 wxLIST_STATE_SELECTED);
1427 int selMMSI = wxNOT_FOUND;
1428 if (selItemID != wxNOT_FOUND) selMMSI = g_MMSI_Props_Array[selItemID]->MMSI;
1430 m_pListCtrlMMSI->SetItemCount(g_MMSI_Props_Array.GetCount());
1433 long item_sel = wxNOT_FOUND;
1434 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1435 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
1436 if (g_MMSI_Props_Array[i]->MMSI == selMMSI) {
1443 if (g_MMSI_Props_Array.GetCount() > 0)
1444 m_pListCtrlMMSI->SetItemState(item_sel,
1445 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1446 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1449 m_pListCtrlMMSI->Refresh(FALSE);
1453void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1463 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value =
"",
1464 const wxPoint& pos = wxDefaultPosition,
1465 const wxSize& size = wxDefaultSize,
int n = 0,
1466 const wxString choices[] = NULL,
long style = 0,
1467 const wxValidator& validator = wxDefaultValidator,
1468 const wxString& name =
"OCPNFatCombo");
1472 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1473 wxCoord OnMeasureItem(
size_t item)
const;
1474 wxCoord OnMeasureItemWidth(
size_t item)
const;
1475 bool SetFont(
const wxFont& font);
1477 int Append(
const wxString& item, wxBitmap bmp);
1480 const wxFont* dfont;
1484 ArrayOfBitmaps bmpArray;
1487OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1489OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1490 const wxString& value,
const wxPoint& pos,
1491 const wxSize& size,
int n,
const wxString choices[],
1492 long style,
const wxValidator& validator,
1493 const wxString& name)
1494 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1497 GetFont().GetPointSize() / g_Platform->getFontPointsperPixel();
1498 itemHeight = (int)wxRound(fontHeight);
1499 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1502OCPNFatCombo::~OCPNFatCombo() {}
1504bool OCPNFatCombo::SetFont(
const wxFont& font) {
1509void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1516 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1517 wxBrush br = wxBrush(bg);
1518 wxBrush sv = dc.GetBrush();
1520 dc.DrawRectangle(0, 0, rect.width, rect.height);
1522 dc.SetTextForeground(wxColour(0, 0, 0));
1524 if (flags & wxODCB_PAINTING_CONTROL) {
1525 wxString text = GetValue();
1527 dc.DrawText(text, rect.x + margin_x + offset_x,
1528 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1530 dc.SetBackground(wxBrush(br));
1532 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1533 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1537wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1538 if (item < bmpArray.GetCount())
1539 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1541 return itemHeight * 12 / 10;
1544wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1546int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1548 int idx = wxOwnerDrawnComboBox::Append(item);
1553void OCPNFatCombo::Clear(
void) {
1554 wxOwnerDrawnComboBox::Clear();
1558BEGIN_EVENT_TABLE(
options, wxDialog)
1559EVT_INIT_DIALOG(options::OnDialogInit)
1560EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1561EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1562EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1563EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1564EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1565EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1566EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1567EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1568EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1569EVT_BUTTON(xID_OK, options::OnXidOkClick)
1570EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1571EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1572EVT_BUTTON(ID_BUTTONFONT_RESET, options::OnResetFont)
1573EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1575EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1576EVT_CLOSE(options::OnClose)
1578#if defined(__WXGTK__) || defined(__WXQT__)
1579EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1582EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1584EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1585EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1586EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1587EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1588EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1589EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1590EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1591EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1592EVT_CHAR_HOOK(options::OnCharHook)
1596options::
options(wxWindow* parent, wxWindowID
id, const wxString& caption,
1597 const wxPoint& pos, const wxSize& size,
long style)
1598 : pTrackRotateTime(0) {
1603 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1605 wxDialog::Create(parent,
id, caption, pos, size, style,
"Options");
1606 SetFont(*dialogFont);
1609 RecalculateSize(size.x, size.y);
1611 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1613 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1614 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1616 m_pPlugInCtrl->ReloadPluginPanels();
1618 auto action = [&](wxCommandEvent& evt) {
1619 g_persist_active_route = m_persist_active_route_chkbox->IsChecked();
1621 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1622 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1625options::~options(
void) {
1627 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1629 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1630 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1633 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1635 delete m_pSerialArray;
1636 delete m_pGroupArray;
1637 delete m_topImgList;
1641 delete m_pPlugInCtrl;
1642 if (g_pi_manager) g_pi_manager->SetListPanelPtr(NULL);
1644 delete m_PluginCatalogMgrPanel;
1649bool options::SendIdleEvents(wxIdleEvent& event) {
1650 if (IsShown())
return wxDialog::SendIdleEvents(event);
1654void options::RecalculateSize(
int hint_x,
int hint_y) {
1655 if (!g_bresponsive) {
1656 m_nCharWidthMax = GetSize().x / GetCharWidth();
1660 if ((hint_x < 200) || (hint_y < 200)) {
1662 int display_width, display_height;
1663 display_width = g_monitor_info[g_current_monitor].width;
1664 display_height = g_monitor_info[g_current_monitor].height;
1666 if (display_height < 600) {
1669 vectorPanel->SetSizeHints(ps57Ctl);
1679 esize.x = GetCharWidth() * 110;
1680 esize.y = GetCharHeight() * 40;
1682 wxSize dsize = GetParent()->GetSize();
1683 esize.y = wxMin(esize.y, dsize.y - 0 );
1684 esize.x = wxMin(esize.x, dsize.x - 0 );
1687 wxSize fsize = GetSize();
1688 wxSize canvas_size = GetParent()->GetSize();
1689 wxPoint screen_pos = GetParent()->GetScreenPosition();
1690 int xp = (canvas_size.x - fsize.x) / 2;
1691 int yp = (canvas_size.y - fsize.y) / 2;
1692 Move(screen_pos.x + xp, screen_pos.y + yp);
1694 m_nCharWidthMax = GetSize().x / GetCharWidth();
1697void options::Init(
void) {
1698 m_pWorkDirList = NULL;
1700 pShowStatusBar = NULL;
1701 pShowMenuBar = NULL;
1702 pShowCompassWin = NULL;
1705 m_scrollWinChartList = NULL;
1706 ps57CtlListBox = NULL;
1708 m_pSerialArray = NULL;
1709 pUpdateCheckBox = NULL;
1710 pParseENCButton = NULL;
1717 pSoundDeviceIndex = NULL;
1721 pCBLookAhead = NULL;
1722 pCDOQuilting = NULL;
1723 pPreserveScale = NULL;
1724 pSmoothPanZoom = NULL;
1725 pEnableZoomToCursor = NULL;
1726 pSDisplayGrid = NULL;
1727 pCDOOutlines = NULL;
1728 pSDepthUnits = NULL;
1730 pSDefaultBoatSpeed = NULL;
1733 itemActiveChartStaticBox = NULL;
1735 pCheck_SOUNDG = NULL;
1737 pCheck_SHOWIMPTEXT = NULL;
1738 pCheck_SCAMIN = NULL;
1739 pCheck_ATONTEXT = NULL;
1740 pCheck_LDISTEXT = NULL;
1741 pCheck_XLSECTTEXT = NULL;
1743 m_bVisitLang = FALSE;
1744 m_bVisitPlugins = FALSE;
1745 m_itemFontElementListBox = NULL;
1746 m_textSample = NULL;
1747 m_topImgList = NULL;
1750 m_pGroupArray = NULL;
1751 m_groups_changed = 0;
1754 m_pageConnections = -1;
1759 m_pageConnections = -1;
1761 pEnableTenHertz =
nullptr;
1763 auto loader = PluginLoader::GetInstance();
1764 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
1765 b_oldhaveWMM = b_haveWMM;
1770 m_bForceNewToolbaronCancel =
false;
1772 m_cs = (ColorScheme)0;
1775 m_pPlugInCtrl = NULL;
1776 m_PluginCatalogMgrPanel = NULL;
1790 m_bVectorInit =
false;
1795 pCmdSoundString = NULL;
1797 m_sconfigSelect_single = NULL;
1798 m_sconfigSelect_twovertical = NULL;
1801 dc.SetFont(*dialogFont);
1803 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, dialogFont);
1805 m_colourPickerDefaultSize =
1819 auto sound =
static_cast<OcpnSound*
>(ev.GetClientData());
1825#if defined(__GNUC__) && __GNUC__ < 8
1828static const wxString BAD_ACCESS_MSG = _(
1829 "The device selected is not accessible; opencpn will likely not be able\n"
1830 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1831 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1832 "with the following contents:\n\n"
1833 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1834 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1835 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1836 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1840static const wxString BAD_ACCESS_MSG = _(R
"(
1841The device selected is not accessible; opencpn will likely not be able
1842to use this device as-is. You might want to exit OpenCPN, reboot and
1843retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1844with the following contents:
1846 KERNEL=="ttyUSB*", MODE="0666"
1847 KERNEL=="ttyACM*", MODE="0666"
1848 KERNEL=="ttyS*", MODE="0666"
1850For more info, see the file LINUX_DEVICES.md in the distribution docs.
1855void options::OnDialogInit(wxInitDialogEvent& event) {}
1857void options::CheckDeviceAccess( wxString& path) {}
1859size_t options::CreatePanel(
const wxString& title) {
1860 size_t id = m_pListbook->GetPageCount();
1863 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1864 wxDefaultSize, wxTAB_TRAVERSAL, title);
1865 m_pListbook->AddPage(panel, title, FALSE,
id);
1869wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1870 if (parent > m_pListbook->GetPageCount() - 1) {
1872 wxString::Format(
"Warning: invalid parent in options::AddPage( %d, ",
1877 wxNotebookPage* page = m_pListbook->GetPage(parent);
1879 wxScrolledWindow* sw;
1881 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1882 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1884 for (
size_t i_page = 0; i_page < nb->GetPageCount(); i_page++) {
1885 wxString candidate_title = nb->GetPageText(i_page);
1886 if (candidate_title.IsSameAs(title))
1887 return static_cast<wxScrolledWindow*
>(nb->GetPage(i_page));
1890 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1892 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1893 nb->AddPage(sw, title);
1894 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1895 wxString toptitle = m_pListbook->GetPageText(parent);
1896 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1897 wxDefaultSize, wxNB_TOP);
1900 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1901 m_pListbook->SetSelection(0);
1902 m_pListbook->RemovePage(parent + 1);
1903 wxString previoustitle = page->GetName();
1905 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1906 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1908 nb->AddPage(page, previoustitle);
1912 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1914 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1915 nb->AddPage(sw, title);
1916 nb->ChangeSelection(0);
1918 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1919 wxDefaultSize, style, title);
1920 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1921 wxString toptitle = m_pListbook->GetPageText(parent);
1922 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1923 m_pListbook->SetSelection(0);
1924 m_pListbook->DeletePage(parent + 1);
1928 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1934bool options::DeletePluginPage(wxScrolledWindow* page) {
1935 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1936 wxNotebookPage* pg = m_pListbook->GetPage(i);
1937 auto nb =
dynamic_cast<wxNotebook*
>(pg);
1940 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1941 wxNotebookPage* spg = nb->GetPage(j);
1944 if (nb->GetPageCount() != 1)
return TRUE;
1946 spg = nb->GetPage(0);
1947 spg->Reparent(m_pListbook);
1949 wxString toptitle = m_pListbook->GetPageText(i);
1950 m_pListbook->DeletePage(i);
1951 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1955 }
else if (pg == page) {
1957 m_pListbook->DeletePage(i);
1958 wxPanel* panel =
new wxPanel(m_pListbook);
1959 wxString toptitle = m_pListbook->GetPageText(i);
1960 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1967void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1968 int group_item_spacing) {
1969 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1972 std::make_shared<ConnectionsDlg>(m_pNMEAForm, TheConnectionParams());
1975 Bind(wxEVT_SIZE, [&](wxSizeEvent& ev) {
1976 auto w = m_pListbook->GetCurrentPage();
1977 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
1981 comm_dialog->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1985void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1986 int group_item_spacing) {
1987 itemPanelShip = AddPage(parent, _(
"Own ship"));
1989 ownShip =
new wxBoxSizer(wxVERTICAL);
1990 itemPanelShip->SetSizer(ownShip);
1993 wxStaticBox* osdBox =
1994 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1995 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1996 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1998 wxFlexGridSizer* dispOptionsGrid =
1999 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2000 dispOptionsGrid->AddGrowableCol(1);
2001 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
2003 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
2004 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
2005 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
2007 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
2008 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
2010 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
2011 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
2012 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
2014 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
2015 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
2017 wxStaticText* iconTypeTxt =
2018 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
2019 dispOptionsGrid->Add(iconTypeTxt, 0);
2021 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
2022 _(
"Real Scale Vector")};
2024 m_pShipIconType =
new wxChoice(
2025 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
2026 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
2027 dispOptionsGrid->Add(m_pShipIconType, 0,
2028 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
2029 group_item_spacing);
2031 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
2032 realSizes->AddGrowableCol(1);
2034 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
2037 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
2039 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
2040 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2043 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
2045 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2046 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2049 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
2051 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2052 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2054 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
2055 _(
"GPS Offset from Midship (m)")),
2057 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2058 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2061 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
2063 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2064 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2067 wxFlexGridSizer* rrSelect =
2068 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2069 rrSelect->AddGrowableCol(1);
2070 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2072 wxStaticText* rrTxt =
2073 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
2074 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2076 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
2077 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
2078 _T(
"8" ), _T(
"9" ), _T(
"10" )};
2079 pNavAidRadarRingsNumberVisible =
2080 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
2081 m_pShipIconType->GetSize(), 11, rrAlt);
2082 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
2083 group_item_spacing);
2085 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2086 radarGrid->AddGrowableCol(1);
2087 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
2089 wxStaticText* distanceText =
2090 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
2091 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
2093 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL,
"",
2094 wxDefaultPosition, wxSize(100, -1), 0);
2095 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
2096 group_item_spacing);
2098 wxStaticText* unitText =
2099 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
2100 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
2102 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"),
2103 _(
"Minutes (time)")};
2104 m_itemRadarRingsUnits =
2105 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
2106 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
2107 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2109 wxStaticText* colourText =
2110 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Color"));
2111 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2114 itemPanelShip, wxID_ANY, *wxRED, wxDefaultPosition,
2115 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2116 _T(
"ID_COLOUROSRANGECOLOUR" ));
2117 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2120 wxFlexGridSizer* shipToActiveGrid =
2121 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2122 shipToActiveGrid->AddGrowableCol(1);
2123 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2124 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2125 _(
"Show direction to Active Waypoint"));
2126 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2129 wxStaticText* shipToActiveText1 =
2130 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2131 shipToActiveGrid->Add(shipToActiveText1, 1,
2132 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2134 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
2135 _(
"Long dash"), _(
"Short dash")};
2136 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2137 m_shipToActiveStyle =
2138 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2139 LineStyleNChoices, LineStyleChoices, 0);
2140 m_shipToActiveStyle->SetSelection(0);
2141 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2143 wxStaticText* shipToActiveText2 =
2144 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2145 shipToActiveGrid->Add(shipToActiveText2, 1,
2146 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2148 wxString m_LineColorChoices[] = {
2149 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2150 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2151 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2152 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2154 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2155 m_shipToActiveColor =
2156 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2157 LineColorNChoices, m_LineColorChoices, 0);
2158 m_shipToActiveColor->SetSelection(0);
2159 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2162 wxStaticBox* shipdata =
2163 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Ship's identifier"));
2164 wxStaticBoxSizer* datasizer =
new wxStaticBoxSizer(shipdata, wxVERTICAL);
2165 ownShip->Add(datasizer, 0, wxGROW | wxALL, border_size);
2167 wxFlexGridSizer* ownmmsisizer =
2168 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2169 ownmmsisizer->AddGrowableCol(1);
2170 datasizer->Add(ownmmsisizer, 0, wxALL | wxEXPAND, border_size);
2174 wxStaticText* pStatic_ownshipmmsi =
2175 new wxStaticText(itemPanelShip, wxID_ANY,
2176 _(
"Own ship's MMSI. (If available) Nine digits"));
2177 ownmmsisizer->Add(pStatic_ownshipmmsi, 0);
2180 const wxString AllowDigits[] = {
"0",
"1",
"2",
"3",
"4",
2181 "5",
"6",
"7",
"8",
"9"};
2182 wxArrayString ArrayAllowDigits(10, AllowDigits);
2183 wxTextValidator mmsiVal(wxFILTER_INCLUDE_CHAR_LIST);
2184 mmsiVal.SetIncludes(ArrayAllowDigits);
2185 m_pTxt_OwnMMSI =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"",
2186 wxDefaultPosition, wxDefaultSize, 0, mmsiVal);
2187 ownmmsisizer->Add(m_pTxt_OwnMMSI, 0, wxALIGN_RIGHT);
2190 wxStaticBox* trackText =
2191 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2192 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2193 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2194 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2196 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2197 _(
"Automatic Daily Tracks at midnight"));
2199 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2202 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2204#if wxUSE_TIMEPICKCTRL
2205 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2208 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2209 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2210 wxDefaultPosition, wxDefaultSize, 0);
2213 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2214 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2215 wxDefaultPosition, wxDefaultSize, 0);
2217 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2221 pTrackRotateComputerTime =
2222 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2223 wxDefaultPosition, wxDefaultSize, 0);
2224 trackSizer1->Add(pTrackRotateComputerTime, 0,
2225 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2228 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2229 wxDefaultPosition, wxDefaultSize, 0);
2230 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2234 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2235 wxDefaultPosition, wxDefaultSize, 0);
2236 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2239 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2241 wxFlexGridSizer* hTrackGrid =
2242 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2243 hTrackGrid->AddGrowableCol(1);
2244 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2247 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2248 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2250 wxStaticText* trackColourText =
2251 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Color"));
2252 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2255 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2256 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2257 _T(
"ID_COLOURTRACKCOLOUR" ));
2258 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2260 wxFlexGridSizer* pTrackGrid =
2261 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2262 pTrackGrid->AddGrowableCol(1);
2263 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2265 wxStaticText* tpText =
2266 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2267 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2269 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2270 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2271 m_pShipIconType->GetSize(), 3, trackAlt);
2272 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2273 group_item_spacing);
2276 wxStaticBox* ownshipcalcText =
2277 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Calculate values"));
2278 wxStaticBoxSizer* ownshipcalcSizer =
2279 new wxStaticBoxSizer(ownshipcalcText, wxVERTICAL);
2280 ownShip->Add(ownshipcalcSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2282 wxFlexGridSizer* dispOwnShipCalcOptionsGrid =
2283 new wxFlexGridSizer(2, 2, group_item_spacing, group_item_spacing);
2284 ownshipcalcSizer->Add(dispOwnShipCalcOptionsGrid, 0, wxTOP | wxALL | wxEXPAND,
2287 dispOwnShipCalcOptionsGrid->AddGrowableCol(1);
2289 pSogCogFromLLCheckBox =
2290 new wxCheckBox(itemPanelShip, ID_SOGCOGFROMLLCHECKBOX,
2291 _(
"Calculate SOG and COG from position changes"));
2292 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLCheckBox, 1, wxALL, 5);
2293 dispOwnShipCalcOptionsGrid->AddSpacer(0);
2295 wxStaticText* SogCogFromLLDampIntText =
new wxStaticText(
2296 itemPanelShip, wxID_STATIC, _(
"Min seconds between updates"));
2297 dispOwnShipCalcOptionsGrid->Add(SogCogFromLLDampIntText, 1, wxEXPAND | wxALL,
2298 group_item_spacing);
2300 pSogCogFromLLDampInterval =
new wxSpinCtrl(
2301 itemPanelShip, ID_SOGCOGDAMPINTTEXTCTRL, wxEmptyString, wxDefaultPosition,
2302 wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0);
2304 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLDampInterval, 0,
2305 wxALIGN_RIGHT | wxALL, group_item_spacing);
2308void options::CreatePanel_Routes(
size_t parent,
int border_size,
2309 int group_item_spacing) {
2310 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2312 Routes =
new wxBoxSizer(wxVERTICAL);
2313 itemPanelRoutes->SetSizer(Routes);
2315 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2317 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
2318 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
2319 _T(
"8" ), _T(
"9" ), _T(
"10" )};
2322 wxStaticBox* routeText =
2323 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2324 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2325 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2327 wxStaticBox* activeRouteText =
2328 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2329 wxStaticBoxSizer* activeRouteSizer =
2330 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2332 m_persist_active_route_chkbox =
new wxCheckBox(
2333 itemPanelRoutes, wxID_ANY,
2334 _(
"Persist active route, automatically activate on start up"));
2335 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2336 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2338 routeSizer->AddSpacer(5);
2341 wxFlexGridSizer* routepointiconSelect =
2342 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2343 routepointiconSelect->AddGrowableCol(1);
2344 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2347 wxStaticText* routepointiconTxt =
2348 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2349 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2350 group_item_spacing);
2353 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2354 0, NULL, wxCB_READONLY);
2355 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2356 wxALIGN_RIGHT | wxALL, group_item_spacing);
2358 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2361 int min_size = GetCharHeight() * 2;
2362 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2363 pRoutepointDefaultIconChoice->SetMinSize(
2364 wxSize(GetCharHeight() * 15, min_size));
2366 routeSizer->AddSpacer(5);
2368 wxFlexGridSizer* pRouteGrid =
2369 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2370 pRouteGrid->AddGrowableCol(1);
2371 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2373 wxStaticText* raText =
new wxStaticText(
2374 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Arrival Circle Radius (NMi)"));
2375 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2377 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2378 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2379 group_item_spacing);
2381 pAdvanceRouteWaypointOnArrivalOnly =
2382 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2383 _(
"Advance route waypoint on arrival only"));
2384 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2387 Routes->AddSpacer(8 * group_item_spacing);
2389 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2390 wxDefaultSize, wxLI_HORIZONTAL);
2391 Routes->Add(pln, 0, wxEXPAND);
2395 wxStaticBox* waypointText =
2396 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2397 wxStaticBoxSizer* waypointSizer =
2398 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2399 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2401 waypointSizer->AddSpacer(5);
2404 wxFlexGridSizer* waypointiconSelect =
2405 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2406 waypointiconSelect->AddGrowableCol(1);
2407 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2410 wxStaticText* waypointiconTxt =
2411 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2412 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2413 group_item_spacing);
2416 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2417 0, NULL, wxCB_READONLY);
2418 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2419 group_item_spacing);
2421 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2424 int rmin_size = GetCharHeight() * 2;
2425 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2426 pWaypointDefaultIconChoice->SetMinSize(
2427 wxSize(GetCharHeight() * 15, rmin_size));
2429 waypointSizer->AddSpacer(5);
2431 wxFlexGridSizer* ScaMinSizer =
2432 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2433 ScaMinSizer->AddGrowableCol(1);
2434 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2436 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2437 _(
"Show marks only at a chartscale greater than 1 :"));
2438 ScaMinSizer->Add(pScaMinChckB, 0);
2439 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2440 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2441 group_item_spacing);
2444 pScaMinOverruleChckB =
2445 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2446 _(
"Override the settings for chartscale based visibility "
2447 "and show always"));
2448 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2450 waypointSizer->AddSpacer(5);
2452 wxFlexGridSizer* waypointrrSelect =
2453 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2454 waypointrrSelect->AddGrowableCol(1);
2455 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2458 wxStaticText* waypointrrTxt =
2459 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2460 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2462 pWaypointRangeRingsNumber =
2463 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2464 m_pShipIconType->GetSize(), 11, rrAlt);
2465 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2466 group_item_spacing);
2469 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2470 waypointradarGrid->AddGrowableCol(1);
2471 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2473 wxStaticText* waypointdistanceText =
new wxStaticText(
2474 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2475 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2476 group_item_spacing);
2478 pWaypointRangeRingsStep =
2479 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2480 wxSize(100, -1), 0);
2481 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2482 group_item_spacing);
2484 wxStaticText* waypointunitText =
2485 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2486 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2487 group_item_spacing);
2489 m_itemWaypointRangeRingsUnits =
2490 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2491 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2492 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2493 wxALIGN_RIGHT | wxALL, border_size);
2495 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2496 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colors"));
2497 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2500 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2501 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2502 _T(
"ID_COLOURWAYPOINTRANGERINGSCOLOUR" ));
2503 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2504 wxALIGN_RIGHT | wxALL, 1);
2509 Routes->AddSpacer(8 * group_item_spacing);
2510 wxStaticLine* pln1 =
2511 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2512 wxDefaultSize, wxLI_HORIZONTAL);
2513 Routes->Add(pln1, 0, wxEXPAND);
2516 wxStaticBox* waypointControl =
2517 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2518 wxStaticBoxSizer* ControlSizer =
2519 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2520 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2522 ControlSizer->AddSpacer(5);
2524 pWayPointPreventDragging =
new wxCheckBox(
2525 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2526 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2527 pWayPointPreventDragging->SetValue(FALSE);
2528 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2530 pConfirmObjectDeletion =
2531 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2532 _(
"Confirm deletion of tracks and routes"));
2533 pConfirmObjectDeletion->SetValue(FALSE);
2534 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2535 ControlSizer->AddSpacer(5);
2538 pWaypointDefaultIconChoice->Clear();
2540 bool fillCombo =
true;
2543 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2544 wxString* ps = pWayPointMan->GetIconDescription(i);
2545 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2547 pWaypointDefaultIconChoice->Append(*ps, bmp);
2552 int iconToSelect = -1;
2553 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2554 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2556 pWaypointDefaultIconChoice->Select(iconToSelect);
2562 pRoutepointDefaultIconChoice->Clear();
2567 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2568 wxString* ps = pWayPointMan->GetIconDescription(i);
2569 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2571 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2577 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2578 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2580 pRoutepointDefaultIconChoice->Select(iconToSelect);
2588void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2589 int group_item_spacing) {
2590 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2592 chartPanel =
new wxBoxSizer(wxVERTICAL);
2593 chartPanelWin->SetSizer(chartPanel);
2595 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2596 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2597 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2599 m_scrollWinChartList =
new wxScrolledWindow(
2600 chartPanelWin, wxID_ANY, wxDefaultPosition,
2601 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2603 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2610 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2612 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2613 m_scrollWinChartList->SetSizer(boxSizerCharts);
2615 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2616 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2618 wxString b1 = _(
"Add Directory...");
2619 wxString b2 = _(
"Remove Selected");
2620 wxString b3 = _(
"Compress Selected");
2628 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2629 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2631 cmdButtonSizer->AddSpacer(GetCharHeight());
2633 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2634 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2635 m_removeBtn->Disable();
2637 cmdButtonSizer->AddSpacer(GetCharHeight());
2640 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2641 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2642 m_compressBtn->Disable();
2644 m_compressBtn = NULL;
2648 if (g_Android_SDK_Version >= 30) {
2650 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2651 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2655 cmdButtonSizer->AddSpacer(GetCharHeight());
2657 wxStaticBox* itemStaticBoxUpdateStatic =
2658 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2659 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2660 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2661 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2663 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2664 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2666 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2667 _(
"Scan Charts and Update Database"));
2668 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2670 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2671 _(
"Force Full Database Rebuild"));
2672 itemFlexGridSizerUpdate->Add(pUpdateCheckBox, 1, wxALL, 5);
2674 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2675 _(
"Prepare all ENC Charts"));
2676 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2678 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2681 ActiveChartArray.Clear();
2682 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2683 ActiveChartArray.Add(m_CurrentDirList[i]);
2686 UpdateChartDirList();
2688 chartPanel->Layout();
2691void options::UpdateChartDirList() {
2693 m_scrollWinChartList->GetSizer()->Clear(
true);
2694 m_scrollWinChartList->ClearBackground();
2696 panelVector.clear();
2699 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2702 wxSize(-1, -1), ActiveChartArray[i]);
2703 chartPanel->SetSelected(
false);
2705 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2707 panelVector.push_back(chartPanel);
2710 m_scrollWinChartList->GetSizer()->Layout();
2712 chartPanelWin->ClearBackground();
2713 chartPanelWin->Layout();
2722 wxSize sza = GetSize();
2727 m_scrollWinChartList->GetParent()->Layout();
2730 m_scrollWinChartList->Scroll(0, 0);
2733void options::UpdateTemplateTitleText() {
2734 if (!m_templateTitleText)
return;
2736 wxString activeTitle;
2737 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2738 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2740 bool configCompare =
2741 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2742 if (!configCompare) activeTitle += _(
" [Modified]");
2743 m_templateTitleText->SetLabel(activeTitle);
2745 m_templateTitleText->SetLabel(_(
"None"));
2748void options::CreatePanel_Configs(
size_t parent,
int border_size,
2749 int group_item_spacing) {
2750 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2756 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2757 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2761 wxStaticBox* templateStatusBox =
2762 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2763 m_templateStatusBoxSizer =
2764 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2765 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2768 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2769 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2771 m_staticTextLastAppled =
new wxStaticText(
2772 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2773 m_staticTextLastAppled->Hide();
2775 statSizer->Add(m_staticTextLastAppled);
2777 m_templateTitleText =
2778 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2779 statSizer->Add(m_templateTitleText);
2780 m_templateTitleText->Hide();
2782 UpdateTemplateTitleText();
2784 wxStaticBox* configsBox =
2785 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2786 wxStaticBoxSizer* configSizer =
2787 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2788 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2790 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2791 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2793 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2794 cPanel->SetSizer(boxSizercPanel);
2796 m_scrollWinConfigList =
2797 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2798 wxBORDER_RAISED | wxVSCROLL);
2799 m_scrollWinConfigList->SetScrollRate(1, 1);
2800 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2802 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2804 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2805 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2807 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2808 configSizer->Add(btnSizer);
2811 wxButton* createButton =
2812 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2813 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2814 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2815 wxCommandEventHandler(options::OnCreateConfig), NULL,
2823 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2824 _(
"Delete Selected Config..."));
2825 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2826 group_item_spacing);
2827 m_configDeleteButton->Connect(
2828 wxEVT_COMMAND_BUTTON_CLICKED,
2829 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2831 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2832 _(
"Apply Selected Config"));
2833 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2834 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2835 wxCommandEventHandler(options::OnApplyConfig),
2842 SetConfigButtonState();
2846void options::ClearConfigList() {
2847 if (m_scrollWinConfigList) {
2848 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2849 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2850 wxWindowListNode* node = kids.Item(i);
2851 wxWindow* win = node->GetData();
2852 auto pcp =
dynamic_cast<wxPanel*
>(win);
2861 SetConfigButtonState();
2864void options::BuildConfigList() {
2865 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2867 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2869 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2871 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2872 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2873 pp->Connect(wxEVT_LEFT_DOWN,
2874 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2878 wxWindowList kids = pp->GetChildren();
2879 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2880 wxWindowListNode* node = kids.Item(i);
2881 wxWindow* win = node->GetData();
2882 win->Connect(wxEVT_LEFT_DOWN,
2883 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2889 m_boxSizerConfigs->Layout();
2891 m_selectedConfigPanelGUID =
"";
2892 SetConfigButtonState();
2895void options::SetConfigButtonState() {
2896 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2897 if (m_selectedConfigPanelGUID.StartsWith(
2899 m_configDeleteButton->Disable();
2900 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2903void options::OnCreateConfig(wxCommandEvent& event) {
2905 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2907 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2908 if (retcode == wxID_OK) {
2909 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2910 UpdateTemplateTitleText();
2914 m_DisplayConfigsPage->Layout();
2916 SetConfigButtonState();
2920void options::OnEditConfig(wxCommandEvent& event) {}
2922void options::OnDeleteConfig(wxCommandEvent& event) {
2923 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2925 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2926 m_selectedConfigPanelGUID =
"";
2931 m_DisplayConfigsPage->Layout();
2932 SetConfigButtonState();
2935void options::OnApplyConfig(wxCommandEvent& event) {
2936 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2939 wxString currentLocale = g_locale;
2943 evt.SetId(ID_APPLY);
2947 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2951 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2952 wxString activeTitle =
2953 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2954 m_templateTitleText->SetLabel(activeTitle);
2955 m_templateTitleText->Show();
2956 m_staticTextLastAppled->Show();
2957 m_templateStatusBoxSizer->Layout();
2959 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2960 _(
"OpenCPN Info"), wxOK);
2963 if (m_scrollWinConfigList) {
2964 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2965 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2966 wxWindowListNode* node = kids.Item(i);
2967 wxWindow* win = node->GetData();
2968 auto pcp =
dynamic_cast<wxPanel*
>(win);
2972 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2977 m_selectedConfigPanelGUID = wxEmptyString;
2979 m_returnChanges |= CONFIG_CHANGED;
2981 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2986void options::OnConfigMouseSelected(wxMouseEvent& event) {
2987 wxPanel* selectedPanel = NULL;
2988 wxObject* obj =
event.GetEventObject();
2990 auto panel =
dynamic_cast<wxPanel*
>(obj);
2992 selectedPanel = panel;
2996 auto win =
dynamic_cast<wxWindow*
>(obj);
2998 auto parentpanel =
dynamic_cast<wxPanel*
>(win->GetParent());
3000 selectedPanel = parentpanel;
3005 if (m_scrollWinConfigList) {
3006 wxWindowList kids = m_scrollWinConfigList->GetChildren();
3007 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
3008 wxWindowListNode* node = kids.Item(i);
3009 wxWindow* win = node->GetData();
3010 auto panel =
dynamic_cast<wxPanel*
>(win);
3012 if (panel == selectedPanel) {
3013 panel->SetBackgroundColour(wxSystemSettings::GetColour(
3014 wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
3016 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
3018 panel->SetBackgroundColour(m_panelBackgroundUnselected);
3020 panel->Refresh(
true);
3024 m_DisplayConfigsPage->Layout();
3025 SetConfigButtonState();
3029void options::CreatePanel_Advanced(
size_t parent,
int border_size,
3030 int group_item_spacing) {
3031 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
3035 double dpmm = g_Platform->GetDisplayDPmm();
3037 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3038 m_ChartDisplayPage->SetSizer(wrapperSizer);
3040 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
3043 itemBoxSizerUI->Add(0, border_size * 3);
3044 itemBoxSizerUI->Add(0, border_size * 3);
3047 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3048 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3050 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3051 _(
"De-skew Raster Charts"));
3052 boxCharts->Add(pSkewComp, inputFlags);
3054 itemBoxSizerUI->Add(0, border_size * 3);
3055 itemBoxSizerUI->Add(0, border_size * 3);
3059 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
3060 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3062 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3063 _(
"Use Accelerated Graphics (OpenGL)"));
3064 OpenGLSizer->Add(pOpenGL, inputFlags);
3065 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3067 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3068 _(
"OpenGL Options") +
"...");
3069 OpenGLSizer->Add(bOpenGL, inputFlags);
3070 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3072 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3073 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3078 itemBoxSizerUI->Add(0, border_size * 3);
3079 itemBoxSizerUI->Add(0, border_size * 3);
3083 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3084 _(
"Chart Rotation Averaging Time"));
3086 wrapperSizer->Add(crat, 0,
3087 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3088 group_item_spacing);
3090 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3091 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
3094 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3095 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3096 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
3097 group_item_spacing);
3099 pCOGUPFilterRow->Add(
3100 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3103 itemBoxSizerUI->Add(0, border_size * 3);
3104 itemBoxSizerUI->Add(0, border_size * 3);
3107 wxStaticText* zoomTextHead =
new wxStaticText(
3108 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3109 zoomTextHead->Wrap(-1);
3110 itemBoxSizerUI->Add(
3112 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3113 group_item_spacing);
3114 itemBoxSizerUI->Add(0, border_size * 1);
3116 itemBoxSizerUI->Add(
3117 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3120 m_pSlider_Zoom_Raster =
3121 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3122 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3125 prepareSlider(m_pSlider_Zoom_Raster);
3128 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3130 itemBoxSizerUI->Add(
3131 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3134 m_pSlider_Zoom_Vector =
3135 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3136 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3139 prepareSlider(m_pSlider_Zoom_Vector);
3142 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3144 itemBoxSizerUI->Add(
3145 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3147 m_pSlider_CM93_Zoom =
3148 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3149 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3150 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3153 prepareSlider(m_pSlider_CM93_Zoom);
3156 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3158 itemBoxSizerUI->Add(0, border_size * 3);
3159 itemBoxSizerUI->Add(0, border_size * 3);
3160 itemBoxSizerUI->Add(0, border_size * 3);
3163 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3164 _(
"Physical Screen Width")),
3166 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3167 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3169 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3170 pDPIRow->Add(pRBSizeAuto, inputFlags);
3171 pDPIRow->AddSpacer(10);
3172 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3173 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3174 pDPIRow->Add(pRBSizeManual, inputFlags);
3176 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3177 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3180 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3181 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3182 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3184 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3188 itemBoxSizerUI->Add(
3189 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3191 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3192 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3194 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3195 _(
"Show extended chart bar information."));
3196 ChartBarSizer->Add(pChartBarEX, inputFlags);
3198 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3199 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3201 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3202 wxCommandEventHandler(options::OnSizeManualButton),
3208 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3209 itemBoxSizerUI->SetHGap(border_size);
3216 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3217 m_ChartDisplayPage->SetSizer(wrapperSizer);
3218 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3221 itemBoxSizerUI->Add(0, border_size * 3);
3222 itemBoxSizerUI->Add(0, border_size * 3);
3225 itemBoxSizerUI->Add(
3226 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3228 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3229 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3231 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3232 _(
"Show Skewed Raster Charts as North-Up"));
3233 boxCharts->Add(pSkewComp, verticleInputFlags);
3251 itemBoxSizerUI->Add(0, border_size * 3);
3252 itemBoxSizerUI->Add(0, border_size * 3);
3255 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3256 _(
"Chart Rotation Averaging Time")),
3258 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3259 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3260 group_item_spacing);
3263 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3264 wxSize(50, -1), wxTE_RIGHT);
3265 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3267 pCOGUPFilterRow->Add(
3268 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3272 itemBoxSizerUI->Add(0, border_size * 8);
3273 itemBoxSizerUI->Add(0, border_size * 8);
3276 wxStaticText* zoomTextHead =
new wxStaticText(
3277 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3279 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3280 itemBoxSizerUI->Add(0, border_size * 1);
3281 itemBoxSizerUI->Add(0, border_size * 1);
3283 wxStaticText* zoomText =
new wxStaticText(
3284 m_ChartDisplayPage, wxID_ANY,
3285 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3286With a higher value, the same zoom level shows a more detailed chart."));
3288 smallFont = *dialogFont;
3290 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3292 zoomText->SetFont(smallFont);
3293 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3301 itemBoxSizerUI->Add(
3302 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3304 m_pSlider_Zoom_Raster =
3305 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3306 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3309 prepareSlider(m_pSlider_Zoom_Raster);
3312 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3314 itemBoxSizerUI->Add(
3315 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3317 m_pSlider_Zoom_Vector =
3318 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3319 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3322 prepareSlider(m_pSlider_Zoom_Vector);
3325 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3328 itemBoxSizerUI->Add(0, border_size * 3);
3329 itemBoxSizerUI->Add(0, border_size * 3);
3331 itemBoxSizerUI->Add(
3332 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3334 m_pSlider_CM93_Zoom =
3335 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3336 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3337 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3340 prepareSlider(m_pSlider_CM93_Zoom);
3343 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3346 itemBoxSizerUI->Add(0, border_size * 3);
3347 itemBoxSizerUI->Add(0, border_size * 3);
3348 itemBoxSizerUI->Add(0, border_size * 3);
3349 itemBoxSizerUI->Add(0, border_size * 3);
3350 itemBoxSizerUI->Add(0, border_size * 3);
3351 itemBoxSizerUI->Add(0, border_size * 3);
3354 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3355 _(
"Physical Screen Width")),
3357 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3358 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3360 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3361 pDPIRow->Add(pRBSizeAuto, inputFlags);
3362 pDPIRow->AddSpacer(10);
3363 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3364 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3365 pDPIRow->Add(pRBSizeManual, inputFlags);
3368 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3369 wxSize(3 * m_fontHeight, -1), wxTE_RIGHT);
3370 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3372 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3375 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3376 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3378 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3379 wxCommandEventHandler(options::OnSizeManualButton),
3383 itemBoxSizerUI->Add(0, border_size * 3);
3384 itemBoxSizerUI->Add(0, border_size * 3);
3389 itemBoxSizerUI->Add(
3390 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3392 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3393 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3395 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3396 _(
"Use Accelerated Graphics (OpenGL)"));
3397 OpenGLSizer->Add(pOpenGL, inputFlags);
3398 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3400 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3401 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3407 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3408 _(
"Options") +
"...");
3409 OpenGLSizer->Add(bOpenGL, inputFlags);
3410 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3413 itemBoxSizerUI->Add(0, border_size * 3);
3414 itemBoxSizerUI->Add(0, border_size * 3);
3419 itemBoxSizerUI->Add(
3420 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3422 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3423 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3425 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3426 _(
"Show extended chart bar information."));
3427 ChartBarSizer->Add(pChartBarEX, inputFlags);
3439 m_ChartDisplayPage->Fit();
3443void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3444 int group_item_spacing) {
3445 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3448 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3449 ps57Ctl->SetSizer(vectorPanel);
3452 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3453 optionsColumn->SetHGap(border_size);
3454 optionsColumn->AddGrowableCol(0, 2);
3455 optionsColumn->AddGrowableCol(1, 3);
3456 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3459 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3460 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3465 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3467 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3468 _(
"Mariner's Standard")};
3469 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3470 wxDefaultSize, 4, pDispCatStrings);
3471 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3475 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3476 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3479 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3482 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3483 optionsColumn->Add(miscSizer, groupInputFlags);
3487 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3488 pCheck_SOUNDG->SetValue(FALSE);
3489 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3492 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3493 _(
"Chart Information Objects"));
3494 pCheck_META->SetValue(FALSE);
3495 miscSizer->Add(pCheck_META, verticleInputFlags);
3498 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3501 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3502 optionsColumn->Add(lightSizer, groupInputFlags);
3505 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3506 pCheck_ATONTEXT->SetValue(FALSE);
3507 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3510 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3511 pCheck_LDISTEXT->SetValue(FALSE);
3512 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3514 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3515 _(
"Extended Light Sectors"));
3516 pCheck_XLSECTTEXT->SetValue(FALSE);
3517 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3520 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3523 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3524 optionsColumn->Add(textSizer, groupInputFlags);
3526 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3527 _(
"National text on chart"));
3528 pCheck_NATIONALTEXT->SetValue(FALSE);
3529 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3531 pCheck_SHOWIMPTEXT =
3532 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3533 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3534 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3537 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3538 pCheck_DECLTEXT->SetValue(FALSE);
3539 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3541 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3543 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3544 _(
"Reduced Detail at Small Scale"));
3545 pCheck_SCAMIN->SetValue(FALSE);
3546 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3548 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3549 pCheck_SuperSCAMIN =
3550 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3551 _(
"Additional detail reduction at Small Scale"));
3552 pCheck_SuperSCAMIN->SetValue(FALSE);
3553 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3556 optionsColumn->Add(0, border_size * 4);
3557 optionsColumn->Add(0, border_size * 4);
3559 wxSize item_size = wxSize(-1, -1);
3561 item_size = wxSize(m_fontHeight * 3, m_fontHeight);
3565 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3567 wxString pPointStyleStrings[] = {
3571 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3572 item_size, 2, pPointStyleStrings);
3573 optionsColumn->Add(pPointStyle, inputFlags);
3575 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3577 wxString pBoundStyleStrings[] = {
3581 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3582 item_size, 2, pBoundStyleStrings);
3583 optionsColumn->Add(pBoundStyle, inputFlags);
3585 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3587 wxString pColorNumStrings[] = {
3591 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3592 item_size, 2, pColorNumStrings);
3593 optionsColumn->Add(p24Color, inputFlags);
3596 optionsColumn->Add(0, border_size * 4);
3597 optionsColumn->Add(0, border_size * 4);
3599 item_size = wxSize(60, -1);
3601 item_size = wxSize(m_fontHeight * 2, m_fontHeight);
3605 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3607 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3608 optionsColumn->Add(depShalRow);
3609 m_ShallowCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3610 item_size, wxTE_RIGHT);
3611 depShalRow->Add(m_ShallowCtl, inputFlags);
3612 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3613 depShalRow->Add(m_depthUnitsShal, inputFlags);
3615 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3617 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3618 optionsColumn->Add(depSafeRow);
3619 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3620 item_size, wxTE_RIGHT);
3621 depSafeRow->Add(m_SafetyCtl, inputFlags);
3622 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3623 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3625 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3627 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3628 optionsColumn->Add(depDeepRow);
3629 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3630 item_size, wxTE_RIGHT);
3631 depDeepRow->Add(m_DeepCtl, inputFlags);
3632 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3633 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3636 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3637 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3639 wxStaticBox* marinersBox =
3640 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3641 wxStaticBoxSizer* marinersSizer =
3642 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3643 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3646 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3647 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3649 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3650 itemButtonSelectList =
3651 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3652 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3653 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3654 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3655 marinersSizer->Add(btnRow1);
3657 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3659 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3660 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3661 marinersSizer->Add(btnRow2);
3666 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3667 ps57Ctl->SetSizer(vectorPanel);
3669 wxBoxSizer* optionsColumn = vectorPanel;
3672 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3677 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3679 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3680 _(
"Mariner's Standard")};
3681 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3682 wxSize(350, -1), 4, pDispCatStrings);
3683 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3686 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3691 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3692 optionsColumn->Add(miscSizer, groupInputFlags);
3695 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3696 pCheck_SOUNDG->SetValue(FALSE);
3697 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3699 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3700 _(
"Chart Information Objects"));
3701 pCheck_META->SetValue(FALSE);
3702 miscSizer->Add(pCheck_META, inputFlags);
3704 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3705 optionsColumn->Add(lightSizer, groupInputFlags);
3708 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3709 pCheck_ATONTEXT->SetValue(FALSE);
3710 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3713 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3714 pCheck_LDISTEXT->SetValue(FALSE);
3715 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3717 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3718 _(
"Extended Light Sectors"));
3719 pCheck_XLSECTTEXT->SetValue(FALSE);
3720 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3722 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3723 optionsColumn->Add(textSizer, groupInputFlags);
3725 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3726 _(
"National text on chart"));
3727 pCheck_NATIONALTEXT->SetValue(FALSE);
3728 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3730 pCheck_SHOWIMPTEXT =
3731 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3732 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3733 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3736 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3737 pCheck_DECLTEXT->SetValue(FALSE);
3738 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3740 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3741 _(
"Reduced Detail at Small Scale"));
3742 pCheck_SCAMIN->SetValue(FALSE);
3743 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3745 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3746 pCheck_SuperSCAMIN =
3747 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3748 _(
"Additional detail reduction at Small Scale"));
3749 pCheck_SuperSCAMIN->SetValue(FALSE);
3750 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3753 optionsColumn->Add(0, border_size * 4);
3754 optionsColumn->Add(0, border_size * 4);
3758 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3759 StyleColumn->SetHGap(border_size);
3760 StyleColumn->AddGrowableCol(0, 2);
3761 StyleColumn->AddGrowableCol(1, 3);
3762 optionsColumn->Add(StyleColumn);
3764 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3766 wxString pPointStyleStrings[] = {
3770 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3771 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3772 pPointStyleStrings);
3774 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3777 StyleColumn->Add(pPointStyle, inputFlags);
3779 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3781 wxString pBoundStyleStrings[] = {
3785 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3786 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3787 pBoundStyleStrings);
3789 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3792 StyleColumn->Add(pBoundStyle, inputFlags);
3794 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3797 wxString pColorNumStrings[] = {
3801 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3802 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3805 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3807 StyleColumn->Add(p24Color, inputFlags);
3810 optionsColumn->Add(0, border_size * 4);
3811 optionsColumn->Add(0, border_size * 4);
3813 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3814 DepthColumn->SetHGap(border_size);
3815 DepthColumn->AddGrowableCol(0, 3);
3816 DepthColumn->AddGrowableCol(1, 2);
3817 DepthColumn->AddGrowableCol(2, 3);
3818 optionsColumn->Add(DepthColumn);
3821 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3824 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3825 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3826 DepthColumn->Add(m_ShallowCtl, inputFlags);
3827 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3828 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3830 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3833 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3834 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3835 DepthColumn->Add(m_SafetyCtl, inputFlags);
3836 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3837 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3839 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3842 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3843 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3844 DepthColumn->Add(m_DeepCtl, inputFlags);
3845 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3846 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3849 optionsColumn->Add(0, border_size * 4);
3850 optionsColumn->Add(0, border_size * 4);
3853 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3854 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3856 wxStaticBox* marinersBox =
3857 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3858 wxStaticBoxSizer* marinersSizer =
3859 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3860 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3862 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3863 itemButtonSelectList =
3864 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3865 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3866 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3867 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3868 marinersSizer->Add(btnRow1);
3870 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3872 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3873 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3874 marinersSizer->Add(btnRow2);
3877 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3879 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3883void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3884 int group_item_spacing) {
3885 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3887 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3888 tcPanel->SetSizer(mainHBoxSizer);
3890 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3891 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3892 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3895 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3896 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3898 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3902 tcDataSelected->DeleteAllItems();
3909 col0.SetAlign(wxLIST_FORMAT_LEFT);
3911 tcDataSelected->InsertColumn(0, col0);
3914 unsigned int id = 0;
3915 for (
auto ds : TideCurrentDataSet) {
3918 tcDataSelected->InsertItem(li);
3920 wxString setName = ds;
3921 tcDataSelected->SetItem(
id, 0, setName);
3922 GetTextExtent(setName, &w1, &h);
3923 w = w1 > w ? w1 : w;
3926 tcDataSelected->SetColumnWidth(0, 20 + w);
3929 wxButton* insertButton =
3930 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3931 wxButton* removeButton =
3932 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3934 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3935 tcSizer->Add(btnSizer);
3937 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3938 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3941void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3942 int group_item_spacing) {
3947 wxNotebook* chartsPageNotebook = (wxNotebook*)m_pListbook->GetPage(parent);
3948 wxScrolledWindow* sw =
new ChartGroupsUI(chartsPageNotebook);
3949 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3950 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3953 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3956void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3957 int group_item_spacing) {
3959 m_border_size = border_size;
3960 m_group_item_spacing = group_item_spacing;
3962 m_UIcomplete = FALSE;
3967void ChartGroupsUI::CompletePanel(
void) {
3969 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3970 m_panel->SetSizer(m_topSizer);
3973 wxStaticText* allChartsLabel =
3974 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3975 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3977 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3978 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3980 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3981 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3985 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3986 wxDefaultSize, wxVSCROLL);
3989 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3990 wxDefaultSize, wxVSCROLL);
3992 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3994 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3995 m_pAddButton->Disable();
3996 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3997 m_pRemoveButton->Disable();
3999 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
4000 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
4002 m_pRemoveButton->Connect(
4003 wxEVT_COMMAND_BUTTON_CLICKED,
4004 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
4006 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
4007 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
4008 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
4010 sizerCharts->AddSpacer(20);
4013 wxStaticText* groupsLabel =
4014 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
4015 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
4017 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
4018 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
4020 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
4021 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
4022 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
4023 wxDefaultSize, wxNB_TOP);
4024 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
4026 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
4027 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
4031 wxPanel* allActiveGroup =
4032 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
4033 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
4035 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4036 allActiveGroup->SetSizer(page0BoxSizer);
4038 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1,
"",
4039 wxDefaultPosition, wxDefaultSize);
4042 iFont =
new wxFont(*dialogFont);
4043 iFont->SetStyle(wxFONTSTYLE_ITALIC);
4044 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
4046 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
4048 m_DirCtrlArray.Add(defaultAllCtl);
4052 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
4053 m_pDeleteGroupButton =
4054 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
4055 m_pDeleteGroupButton->Disable();
4057 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
4058 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
4060 m_pDeleteGroupButton->Connect(
4061 wxEVT_COMMAND_BUTTON_CLICKED,
4062 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
4064 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
4065 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
4067 newDeleteGrp->AddSpacer(25);
4068 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
4069 m_group_item_spacing);
4070 newDeleteGrp->AddSpacer(15);
4071 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
4072 m_group_item_spacing);
4073 newDeleteGrp->AddSpacer(25);
4074 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
4076 sizerGroups->AddSpacer(20);
4080 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
4081 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
4084 m_UIcomplete = TRUE;
4087void options::CreatePanel_Display(
size_t parent,
int border_size,
4088 int group_item_spacing) {
4089 pDisplayPanel = AddPage(parent, _(
"General"));
4092 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4093 generalSizer->SetHGap(border_size);
4100 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4101 pDisplayPanel->SetSizer(wrapperSizer);
4102 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4105 generalSizer->Add(0, border_size * 4);
4106 generalSizer->Add(0, border_size * 4);
4111 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4113 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4114 generalSizer->Add(boxNavMode, groupInputFlags);
4116 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4117 boxNavMode->Add(rowOrientation);
4119 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4120 rowOrientation->Add(pCBNorthUp, inputFlags);
4122 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4123 rowOrientation->Add(pCBCourseUp,
4125 .Align(wxALIGN_CENTRE_VERTICAL)
4126 .Border(wxLEFT, group_item_spacing * 2));
4128 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4129 _(
"Look Ahead Mode"));
4130 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4133 generalSizer->Add(0, border_size * 4);
4134 generalSizer->Add(0, border_size * 4);
4138 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4140 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4141 generalSizer->Add(boxCharts, groupInputFlags);
4143 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4144 _(
"Enable Chart Quilting"));
4145 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4148 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4149 _(
"Preserve scale when switching charts"));
4150 boxCharts->Add(pPreserveScale, verticleInputFlags);
4153 generalSizer->Add(0, border_size * 4);
4154 generalSizer->Add(0, border_size * 4);
4158 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4160 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4161 generalSizer->Add(boxCtrls, groupInputFlags);
4163 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4164 _(
"Smooth Panning / Zooming"));
4165 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4167 pEnableZoomToCursor =
4168 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4169 pEnableZoomToCursor->SetValue(FALSE);
4170 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4172 pEnableTenHertz =
nullptr;
4174 pEnableTenHertz =
new wxCheckBox(pDisplayPanel, ID_TENHZCHECKBOX,
4175 _(
"Enable Ten Hz screen update"));
4176 pEnableTenHertz->SetValue(FALSE);
4177 boxCtrls->Add(pEnableTenHertz, verticleInputFlags);
4182 generalSizer->Add(0, border_size * 4);
4183 generalSizer->Add(0, border_size * 4);
4187 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4189 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4190 generalSizer->Add(boxDisp, groupInputFlags);
4193 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4194 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4196 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4197 _(
"Show Chart Outlines"));
4198 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4200 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4201 _(
"Show Depth Units"));
4202 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4212 generalSizer->Add(0, border_size * 4);
4213 generalSizer->Add(0, border_size * 4);
4217 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4219 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4220 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4223 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4224 _(
"Live ETA at Cursor"));
4225 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4229 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4230 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4232 m_Text_def_boat_speed =
new wxStaticText(
4233 pDisplayPanel, wxID_ANY,
4234 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4236 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4237 pSDefaultBoatSpeed =
4238 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4239 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4240 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4241 group_item_spacing);
4248 if (g_Platform->GetDisplayAreaCM2() > 100) {
4249 wxStaticBox* itemStaticBoxScreenConfig =
4250 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4251 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4252 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4253 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4256 wxString iconDir = g_Platform->GetSharedDataDir();
4257 appendOSDirSlash(&iconDir);
4258 iconDir.append(
"uidata");
4259 appendOSDirSlash(&iconDir);
4260 iconDir.append(
"MUI_flat");
4261 appendOSDirSlash(&iconDir);
4262 int bmpSize = GetCharHeight() * 3;
4264 wxBitmap bmp = LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4265 m_sconfigSelect_single =
4267 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4270 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4272 bmp = LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4273 m_sconfigSelect_twovertical =
4275 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4278 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4283 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4284 generalSizer->SetHGap(border_size);
4291 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4292 pDisplayPanel->SetSizer(wrapperSizer);
4293 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4296 generalSizer->Add(0, border_size * 4);
4297 generalSizer->Add(0, border_size * 4);
4302 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4304 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4305 generalSizer->Add(boxNavMode, groupInputFlags);
4307 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4308 boxNavMode->Add(rowOrientation);
4310 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4311 rowOrientation->Add(pCBNorthUp, inputFlags);
4313 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4314 rowOrientation->Add(pCBCourseUp,
4316 .Align(wxALIGN_CENTRE_VERTICAL)
4317 .Border(wxLEFT, group_item_spacing * 2));
4319 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4320 _(
"Look Ahead Mode"));
4321 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4324 generalSizer->Add(0, border_size * 4);
4325 generalSizer->Add(0, border_size * 4);
4329 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4331 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4332 generalSizer->Add(boxCharts, groupInputFlags);
4334 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4335 _(
"Enable Chart Quilting"));
4336 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4339 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4340 _(
"Preserve scale when switching charts"));
4341 boxCharts->Add(pPreserveScale, verticleInputFlags);
4344 generalSizer->Add(0, border_size * 4);
4345 generalSizer->Add(0, border_size * 4);
4349 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4351 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4352 generalSizer->Add(boxCtrls, groupInputFlags);
4354 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4355 _(
"Smooth Panning / Zooming"));
4356 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4357 pEnableZoomToCursor =
4358 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4359 pEnableZoomToCursor->SetValue(FALSE);
4360 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4363 pSmoothPanZoom->Hide();
4364 pEnableZoomToCursor->Hide();
4368 generalSizer->Add(0, border_size * 4);
4369 generalSizer->Add(0, border_size * 4);
4374 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4376 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4377 generalSizer->Add(boxDisp, groupInputFlags);
4380 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4381 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4383 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4384 _(
"Show Chart Outlines"));
4385 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4387 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4388 _(
"Show Depth Units"));
4389 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4399 generalSizer->Add(0, border_size * 4);
4400 generalSizer->Add(0, border_size * 4);
4404 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4406 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4407 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4410 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4411 _(
"Live ETA at Cursor"));
4412 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4416 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4417 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4418 m_Text_def_boat_speed =
new wxStaticText(
4419 pDisplayPanel, wxID_ANY,
4420 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4421 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4422 pSDefaultBoatSpeed =
4423 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4424 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4425 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4426 group_item_spacing);
4432 if (g_Platform->GetDisplayAreaCM2() > 100) {
4434 wxStaticBox* itemStaticBoxScreenConfig =
4435 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4436 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4437 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4438 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4441 wxString iconDir = g_Platform->GetSharedDataDir();
4442 appendOSDirSlash(&iconDir);
4443 iconDir.append(
"uidata");
4444 appendOSDirSlash(&iconDir);
4445 iconDir.append(
"MUI_flat");
4446 appendOSDirSlash(&iconDir);
4447 int bmpSize = GetCharHeight() * 3;
4449 wxBitmap bmp = LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4450 m_sconfigSelect_single =
4452 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4455 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4457 bmp = LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4458 m_sconfigSelect_twovertical =
4460 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4463 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4469void options::CreatePanel_Units(
size_t parent,
int border_size,
4470 int group_item_spacing) {
4471 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4474 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4475 unitsSizer->SetHGap(border_size);
4479 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4480 panelUnits->SetSizer(wrapperSizer);
4482 wrapperSizer->Add(1, border_size * 24);
4483 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4486 unitsSizer->Add(0, border_size * 4);
4487 unitsSizer->Add(0, border_size * 4);
4490 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4492 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4493 _(
"Kilometers"), _(
"Meters")};
4494 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4496 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4497 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4500 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4502 unitsSizer->Add(pDistanceFormat, inputFlags);
4505 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4507 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4508 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4509 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4510 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4511 m_SpeedFormatsNChoices, pSpeedFormats);
4513 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4515 unitsSizer->Add(pSpeedFormat, inputFlags);
4518 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4520 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4521 int m_WindSpeedFormatsNChoices =
4522 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4524 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4525 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4528 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4530 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4533 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4535 wxString pDepthUnitStrings[] = {
4541 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4542 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4544 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4546 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4549 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4551 wxString pTempUnitStrings[] = {
4557 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4558 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4560 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4562 unitsSizer->Add(pTempFormat, inputFlags);
4565 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4566 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4569 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4571 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4572 _(
"Decimal Degrees"),
4573 _(
"Degrees, Minutes, Seconds")};
4574 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4575 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4576 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4577 m_SDMMFormatsNChoices, pSDMMFormats);
4579 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4581 unitsSizer->Add(pSDMMFormat, inputFlags);
4584 unitsSizer->Add(0, border_size * 4);
4585 unitsSizer->Add(0, border_size * 4);
4589 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4592 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4593 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4594 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4595 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4598 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4599 wxDefaultPosition, wxDefaultSize, 0);
4601 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4602 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4603 wxDefaultPosition, wxDefaultSize, 0);
4605 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4608 unitsSizer->Add(0, border_size * 4);
4609 unitsSizer->Add(0, border_size * 4);
4612 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4617 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4618 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4619 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4622 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4623 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4624 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4628 wxStaticBox* itemStaticBoxVar =
new wxStaticBox(panelUnits, wxID_ANY,
"");
4630 wxStaticBoxSizer* itemStaticBoxSizerVar =
4631 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4632 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4634 itemStaticBoxSizerVar->Add(0, border_size * 4);
4636 itemStaticTextUserVar =
4637 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4638 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4639 group_item_spacing);
4641 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4642 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4643 group_item_spacing);
4645 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4646 wxSize(150, -1), wxTE_RIGHT);
4647 magVarSizer->AddSpacer(100);
4649 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4651 itemStaticTextUserVar2 =
4652 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4654 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4655 group_item_spacing);
4657 itemStaticBoxSizerVar->Add(0, border_size * 40);
4660 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4661 unitsSizer->SetHGap(border_size);
4663 int item_h_size = -1;
4665 item_h_size = m_fontHeight * 4;
4670 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4671 panelUnits->SetSizer(wrapperSizer);
4672 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4675 unitsSizer->Add(0, border_size * 4);
4676 unitsSizer->Add(0, border_size * 4);
4679 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4681 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4682 _(
"Kilometers"), _(
"Meters")};
4683 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4684 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4685 wxDefaultPosition, wxSize(item_h_size, -1),
4686 m_DistanceFormatsNChoices, pDistanceFormats);
4688 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4690 unitsSizer->Add(pDistanceFormat, inputFlags);
4693 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4695 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4696 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4697 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4698 wxDefaultPosition, wxSize(item_h_size, -1),
4699 m_SpeedFormatsNChoices, pSpeedFormats);
4701 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4703 unitsSizer->Add(pSpeedFormat, inputFlags);
4706 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4708 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4709 int m_WindSpeedFormatsNChoices =
4710 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4711 pWindSpeedFormat =
new wxChoice(
4712 panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4713 wxSize(item_h_size, -1), m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4715 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4717 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4720 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4722 wxString pDepthUnitStrings[] = {
4728 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4729 wxSize(item_h_size, -1), 3, pDepthUnitStrings);
4731 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4733 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4736 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4738 wxString pTempUnitStrings[] = {
4744 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4745 wxSize(item_h_size, -1), 3, pTempUnitStrings);
4747 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4749 unitsSizer->Add(pTempFormat, inputFlags);
4752 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4753 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4756 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4758 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4759 _(
"Decimal Degrees"),
4760 _(
"Degrees, Minutes, Seconds")};
4761 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4762 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4763 wxDefaultPosition, wxSize(item_h_size, -1),
4764 m_SDMMFormatsNChoices, pSDMMFormats);
4766 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4768 unitsSizer->Add(pSDMMFormat, inputFlags);
4771 unitsSizer->Add(0, border_size * 4);
4772 unitsSizer->Add(0, border_size * 4);
4776 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4779 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4780 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4781 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4782 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4785 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4786 wxDefaultPosition, wxDefaultSize, 0);
4788 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4789 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4790 wxDefaultPosition, wxDefaultSize, 0);
4792 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4795 unitsSizer->Add(0, border_size * 4);
4796 unitsSizer->Add(0, border_size * 4);
4799 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4802 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4803 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4806 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4807 _(
"Show true bearings and headings"));
4808 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4809 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4810 _(
"Show magnetic bearings and headings."));
4811 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4813 bearingsSizer->AddSpacer(10);
4816 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4817 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4819 itemStaticTextUserVar =
4820 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4821 itemStaticTextUserVar->SetLabel(
4822 _(
"WMM Plugin calculated magnetic variation"));
4824 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4825 group_item_spacing);
4827 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4828 wxSize(50, -1), wxTE_RIGHT);
4829 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4831 itemStaticTextUserVar2 =
4832 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4833 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4834 group_item_spacing);
4836 bearingsSizer->AddSpacer(10);
4838 wxStaticText* varText =
4839 new wxStaticText(panelUnits, wxID_ANY,
4840 _(
" To set the magnetic variation manually,\n you "
4841 "must disable the WMM plugin."));
4842 smallFont = *dialogFont;
4843 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4845 varText->SetFont(smallFont);
4847 bearingsSizer->Add(varText);
4856 OCPNSoundPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
4857 const wxSize& size, wxString title, wxString checkLegend,
4858 wxString selectLegend, wxString* pSoundFile);
4862 void OnButtonSelectSound(wxCommandEvent& event);
4863 void OnButtonSPTestSound(wxCommandEvent& event);
4864 wxString SelectSoundFile();
4865 void SetSoundFileLabel(wxString file);
4866 wxCheckBox* GetCheckBox() {
return m_pCheck_Sound; }
4867 wxString GetSoundFile() {
return m_sound_file; }
4869 wxCheckBox* m_pCheck_Sound;
4870 wxSize m_small_button_size;
4871 wxString m_sound_file;
4872 wxString* m_pSoundFile;
4873 wxStaticText* m_AudioFileNameText;
4876 wxButton* TestSound;
4883 bool m_soundPlaying;
4885 DECLARE_EVENT_TABLE()
4888#define ID_SELECTSOUND 9341
4889#define ID_TESTSOUND 9342
4892EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4893EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4898 const wxPoint& pos, const wxSize& size,
4899 wxString title, wxString checkLegend,
4900 wxString selectLegend, wxString* pSoundFile)
4901 : wxPanel(parent,
id, pos, size, wxBORDER_NONE), m_soundPlaying(false) {
4902 wxFont* pif = FontMgr::Get().
GetFont(_(
"Dialog"));
4905 m_pSoundFile = pSoundFile;
4906 if (pSoundFile) m_sound_file = *pSoundFile;
4908 m_sound = SoundFactory();
4910 int border_size = 4;
4911 int group_item_spacing = 2;
4913 int font_size_y, font_descent, font_lead;
4914 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
4915 m_small_button_size = wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4917 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4918 SetSizer(wrapperSizer);
4920 wxStaticBox* StaticBox1 =
new wxStaticBox(
this, wxID_ANY, title);
4921 wxStaticBoxSizer* StaticBoxSizer1 =
4922 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4923 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4925 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO, checkLegend);
4926 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4929 wxString LabelWrapped;
4935 g_pOptions->GetSize().x * 8 / 10);
4936 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4937 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4938 LabelWrapped +=
"\n";
4940 LabelWrapped +=
"\n";
4943 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4944 m_AudioFileNameText->Wrap(-1);
4945 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4947 SetSoundFileLabel(m_sound_file);
4950 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4951 soundSizer1->SetHGap(border_size * 2);
4952 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4954 SelSound =
new wxButton(
this, ID_SELECTSOUND, selectLegend, wxDefaultPosition,
4955 m_small_button_size, 0);
4956 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4957 soundSizer1->AddSpacer(group_item_spacing * 4);
4958 TestSound =
new wxButton(
this, ID_TESTSOUND, _(
"Test"), wxDefaultPosition,
4959 m_small_button_size, 0);
4960 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4961 auto sound_action = [
this](
ObservedEvt ev) { m_soundPlaying =
false; };
4962 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4965void OCPNSoundPanel::SetSoundFileLabel(wxString file) {
4966 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " + file);
4969 g_pOptions->GetSize().x * 8 / 10);
4970 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4971 wxString LabelWrapped;
4972 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4974 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4976 LabelWrapped += LabelWrappedArray[i];
4977 LabelWrapped +=
"\n";
4980 m_AudioFileNameText->SetLabel(LabelWrapped);
4984wxString OCPNSoundPanel::SelectSoundFile() {
4985 wxString sound_dir = g_Platform->GetSharedDataDir();
4986 sound_dir.Append(
"sounds");
4991 wxFileDialog* popenDialog =
new wxFileDialog(
4992 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4993 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
4995 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
4997 response = popenDialog->ShowModal();
4998 sel_file = popenDialog->GetPath();
5002 response = g_Platform->DoFileSelectorDialog(
5003 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
5007 if (response == wxID_OK)
5008 return g_Platform->NormalizePath(sel_file);
5013void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
5014 wxString sel_file = SelectSoundFile();
5016 if (!sel_file.IsEmpty()) {
5017 m_sound_file = g_Platform->NormalizePath(sel_file);
5018 if (m_pSoundFile) *m_pSoundFile = m_sound_file;
5020 SetSoundFileLabel(m_sound_file);
5025void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
5026 if (!m_soundPlaying) {
5027 m_sound->SetFinishedCallback(
5029 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
5030 m_soundPlaying =
true;
5036void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent& event) {
5037 if (event.IsChecked())
5038 m_pCheck_AlertAudio->SetValue(
true);
5040 if (!m_soundPanelSART->GetCheckBox()->GetValue() &&
5041 !m_soundPanelDSC->GetCheckBox()->GetValue())
5042 m_pCheck_AlertAudio->SetValue(
false);
5046void options::OnUXAudioEnableButtonClickSART(wxCommandEvent& event) {
5047 if (event.IsChecked())
5048 m_pCheck_AlertAudio->SetValue(
true);
5050 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5051 !m_soundPanelDSC->GetCheckBox()->GetValue())
5052 m_pCheck_AlertAudio->SetValue(
false);
5056void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent& event) {
5057 if (event.IsChecked())
5058 m_pCheck_AlertAudio->SetValue(
true);
5060 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5061 !m_soundPanelSART->GetCheckBox()->GetValue())
5062 m_pCheck_AlertAudio->SetValue(
false);
5066void options::CreatePanel_Sounds(
size_t parent,
int border_size,
5067 int group_item_spacing) {
5068 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
5070 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
5071 panelSounds->SetSizer(wrapperSizer);
5075 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize,
5076 _(
"Anchor Alarm"), _(
"Play Sound on Anchor Alarm."),
5077 _(
"Select Anchor Alarm Sound"), &g_anchorwatch_sound_file);
5078 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
5082 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"AIS Alert"),
5083 _(
"Play Sound on AIS Alert."), _(
"Select AIS Alert Sound"),
5085 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
5087 m_soundPanelAIS->GetCheckBox()->Connect(
5088 wxEVT_COMMAND_CHECKBOX_CLICKED,
5089 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
5094 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"SART Alert"),
5095 _(
"Play Sound on AIS SART Alert."), _(
"Select AIS SART Alert Sound"),
5096 &g_SART_sound_file);
5097 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
5099 m_soundPanelSART->GetCheckBox()->Connect(
5100 wxEVT_COMMAND_CHECKBOX_CLICKED,
5101 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
5106 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"DSC Alert"),
5107 _(
"Play Sound on DSC notification."), _(
"Select DSC notification Sound"),
5109 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
5111 m_soundPanelDSC->GetCheckBox()->Connect(
5112 wxEVT_COMMAND_CHECKBOX_CLICKED,
5113 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
5117 wxStaticBox* StatBoxSoundConfig =
5118 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
5119 wxStaticBoxSizer* StatBoxSoundConfigSizer =
5120 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
5121 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
5123 auto sound = std::unique_ptr<OcpnSound>(SoundFactory());
5124 int deviceCount = sound->DeviceCount();
5125 wxLogMessage(
"options: got device count: %d", deviceCount);
5126 if (deviceCount >= 1) {
5127 wxArrayString labels;
5128 for (
int i = 0; i < deviceCount; i += 1) {
5129 wxString label(sound->GetDeviceInfo(i));
5131 std::ostringstream stm;
5133 label = _(
"Unknown device :") + stm.str();
5135 if (!sound->IsOutputDevice(i)) {
5136 std::ostringstream stm;
5138 label = _(
"Input device :") + stm.str();
5145 int iDefault = labels.Index(
"default");
5147 if (g_iSoundDeviceIndex == -1) {
5149 g_iSoundDeviceIndex = iDefault;
5151 g_iSoundDeviceIndex = 0;
5154 pSoundDeviceIndex =
new wxChoice();
5155 if (pSoundDeviceIndex) {
5156 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
5157 wxDefaultSize, labels);
5158 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
5159 pSoundDeviceIndex->Show();
5160 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
5161 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
5162 group_item_spacing);
5164 stSoundDeviceIndex =
5165 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
5166 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
5167 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
5172 if ((
bool)
dynamic_cast<SystemCmdSound*
>(SoundFactory())) {
5173 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
5174 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND,
5175 group_item_spacing);
5177 new wxTextCtrl(panelSounds, wxID_ANY, _T(
"" ), wxDefaultPosition,
5178 wxSize(450, -1), wxTE_LEFT);
5180 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
5181 wxALIGN_LEFT | wxALL);
5182 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
5186 if (!deviceCount) StatBoxSoundConfig->Hide();
5189 stSoundDeviceIndex->Hide();
5190 pSoundDeviceIndex->Hide();
5194void options::CreatePanel_MMSI(
size_t parent,
int border_size,
5195 int group_item_spacing) {
5196 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
5198 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
5199 panelMMSI->SetSizer(MMSISizer);
5202 wxStaticBox* itemStaticBoxMMSI =
5203 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
5204 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
5205 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
5206 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
5210 pPropsPanel->UpdateMMSIList();
5212 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
5214 panelMMSI->Layout();
5217void options::CreatePanel_AIS(
size_t parent,
int border_size,
5218 int group_item_spacing) {
5219 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5221 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5222 panelAIS->SetSizer(aisSizer);
5225 wxStaticBox* itemStaticBoxCPA =
5226 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5227 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5228 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5229 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5231 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5232 pCPAGrid->AddGrowableCol(1);
5233 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5235 m_pCheck_CPA_Max =
new wxCheckBox(
5237 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5238 m_pCheck_CPA_Max->SetToolTip(
5239 _(
"Disable CPA (Closest Point of Approach) and TCPA (Time to CPA) alerts "
5240 "for targets beyond this distance from your vessel"));
5241 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5243 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5244 m_pText_CPA_Max->SetToolTip(
5245 _(
"Maximum distance in nautical miles at which Closest Point of Approach "
5246 "alerts will be triggered"));
5247 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5250 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5251 m_pCheck_CPA_Warn->SetToolTip(
5252 _(
"Enable warning alerts when targets have a Closest Point of Approach "
5253 "less than this distance"));
5254 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5257 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5258 m_pText_CPA_Warn->SetToolTip(
5259 _(
"Distance threshold in nautical miles for CPA warning alerts"));
5260 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5262 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5263 wxCommandEventHandler(options::OnCPAWarnClick),
5266 m_pCheck_CPA_WarnT =
5267 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5268 m_pCheck_CPA_WarnT->SetToolTip(
5269 _(
"Additional time constraint - alerts only occur if the Time to Closest "
5270 "Point of Approach is less than this value"));
5271 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5273 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5274 m_pText_CPA_WarnT->SetToolTip(
5275 _(
"Time threshold in minutes for TCPA constraints"));
5276 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5277 group_item_spacing);
5280 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5281 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5282 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5284 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5285 pLostGrid->AddGrowableCol(1);
5286 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5288 m_pCheck_Mark_Lost =
5289 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5290 m_pCheck_Mark_Lost->SetToolTip(
5291 _(
"Targets will be considered lost when no update is received for this "
5293 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5295 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5296 m_pText_Mark_Lost->SetToolTip(
5297 _(
"Time in minutes after which targets with no updates are marked as "
5299 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5300 group_item_spacing);
5302 m_pCheck_Remove_Lost =
5303 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5304 m_pCheck_Remove_Lost->SetToolTip(
5305 _(
"Lost targets will be completely removed from display after this "
5306 "additional time period"));
5307 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5309 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5310 m_pText_Remove_Lost->SetToolTip(_(
5311 "Time in minutes after which lost targets are removed from the display"));
5312 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5313 group_item_spacing);
5315 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5318 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5319 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5320 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5322 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5323 pDisplayGrid->AddGrowableCol(1);
5324 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5326 m_pCheck_Show_COG =
new wxCheckBox(
5327 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5328 m_pCheck_Show_COG->SetToolTip(
5329 _(
"Display a predictor arrow for each AIS target, showing its projected "
5330 "course over ground for the specified number of minutes."));
5331 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5333 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5334 m_pText_COG_Predictor->SetToolTip(
5335 _(
"Set the length in minutes for the COG predictor arrow for AIS "
5337 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5338 group_item_spacing);
5340 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5341 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5342 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5343 m_pCheck_Sync_OCOG_ACOG->Connect(
5344 wxEVT_COMMAND_CHECKBOX_CLICKED,
5345 wxCommandEventHandler(options::OnSyncCogPredClick), NULL,
this);
5347 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1,
"");
5348 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5350 m_pCheck_Show_Tracks =
5351 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5352 m_pCheck_Show_Tracks->SetToolTip(
5353 _(
"Display the recent track (history) of each AIS target for the "
5354 "specified number of minutes."));
5355 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5357 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5358 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5359 group_item_spacing);
5361 m_pCheck_Hide_Moored =
new wxCheckBox(
5362 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5363 m_pCheck_Hide_Moored->SetToolTip(
5364 _(
"Hide AIS targets that are moving slower than this speed, typically "
5365 "indicating they are anchored or moored."));
5366 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5368 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5369 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5370 group_item_spacing);
5372 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5373 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5374 m_pCheck_Draw_Realtime_Prediction->SetToolTip(
5375 _(
"Show a real-time prediction vector for AIS targets moving faster than "
5377 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5378 group_item_spacing);
5380 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5381 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5382 group_item_spacing);
5384 m_pCheck_Scale_Priority =
new wxCheckBox(
5386 _(
"Allow attenuation of less critical targets if more than ... targets"));
5387 m_pCheck_Scale_Priority->SetToolTip(
5388 _(
"Reduce the display prominence of less critical AIS targets when the "
5389 "number of targets exceeds the specified value."));
5390 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5392 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5393 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5394 group_item_spacing);
5396 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5397 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5398 m_pCheck_Show_Area_Notices->SetToolTip(
5399 _(
"Display area notices received via AIS binary messages on the chart."));
5400 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5402 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1,
"");
5403 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5405 m_pCheck_Draw_Target_Size =
5406 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5407 m_pCheck_Draw_Target_Size->SetToolTip(
5408 _(
"Display AIS targets using their actual reported size and shape on the "
5410 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5412 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1,
"");
5413 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5415 m_pCheck_Show_Target_Name =
new wxCheckBox(
5416 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5417 m_pCheck_Show_Target_Name->SetToolTip(
5418 _(
"Display the name of AIS targets when the chart scale is greater than "
5419 "the specified value."));
5420 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5422 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5423 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5424 group_item_spacing);
5426 m_pCheck_use_Wpl =
new wxCheckBox(
5427 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5428 m_pCheck_use_Wpl->SetToolTip(
5429 _(
"Enable processing of WPL (Waypoint Location) position messages from "
5430 "AIS and select the action to take when received."));
5431 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5433 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5434 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5435 wxDefaultSize, 2, Wpl_Action);
5436 m_pWplAction->SetToolTip(
5437 _(
"Select the action to perform when a WPL message is received: create "
5438 "an Automatic Packet Reporting System (APRS) report or a mark on the "
5440 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5443 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5444 wxStaticBoxSizer* rolloverSizer =
5445 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5446 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5448 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5449 _(
"Enable route/AIS info block"));
5450 pRollover->SetToolTip(
5451 _(
"Show a popup info block with details about routes and AIS targets "
5452 "when hovering over them."));
5453 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5455 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5456 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5460 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5461 pStatic_CallSign->SetToolTip(
5462 _(
"Display the ship name and MMSI (call sign) in the rollover info "
5464 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5466 m_pCheck_Rollover_Class =
5467 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5468 m_pCheck_Rollover_Class->SetToolTip(
5469 _(
"Show the AIS class, type, and status in the rollover info block."));
5470 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5472 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5473 m_pCheck_Rollover_COG->SetToolTip(
5474 _(
"Show speed over ground (SOG) and course over ground (COG) in the "
5475 "rollover info block."));
5476 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5478 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5479 m_pCheck_Rollover_CPA->SetToolTip(
5480 _(
"Show Closest Point of Approach (CPA) and time to CPA (TCPA) in the "
5481 "rollover info block."));
5482 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5485 wxStaticBox* alertBox =
5486 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5487 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5488 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5490 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5491 pAlertGrid->AddGrowableCol(1);
5492 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5494 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5495 _(
"Show CPA/TCPA Alert Dialog"));
5496 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5498 m_pCheck_AlertDialog->Connect(
5499 wxEVT_COMMAND_CHECKBOX_CLICKED,
5500 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5509 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1,
"");
5510 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5512 m_pCheck_AlertAudio =
new wxCheckBox(
5513 panelAIS, ID_AISALERTAUDIO,
5514 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5515 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5517 m_pCheck_AlertAudio->Connect(
5518 wxEVT_COMMAND_CHECKBOX_CLICKED,
5519 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5522 wxButton* m_pPlay_Sound =
5523 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"), wxDefaultPosition,
5524 m_small_button_size, 0);
5525 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5527 m_pPlay_Sound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
5528 wxCommandEventHandler(options::OnButtonTestSound),
5534 m_pCheck_Alert_Moored =
new wxCheckBox(
5535 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5536 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5538 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1,
"");
5539 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5541 m_pCheck_Ack_Timout =
new wxCheckBox(
5542 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5543 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5545 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5546 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5547 group_item_spacing);
5555 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5559 GetHandle()->setStyleSheet(getQtStyleSheet());
5564void options::CreatePanel_UI(
size_t parent,
int border_size,
5565 int group_item_spacing) {
5566 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5568 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5569 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5571 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5572 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5574 wxStaticBox* itemLangStaticBox =
5575 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5576 wxStaticBoxSizer* itemLangStaticBoxSizer =
5577 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5579 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5581 wxSize langChoiceSize = wxSize(-1, -1);
5584 langChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5587 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG,
5588 wxDefaultPosition, langChoiceSize);
5590 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5597 wxStaticBox* itemFontStaticBox =
5598 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5600 wxSize fontChoiceSize = wxSize(-1, -1);
5602 int fLayout = wxHORIZONTAL;
5605 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5608 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5611 wxStaticBoxSizer* itemFontStaticBoxSizer =
5612 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5613 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5616 m_itemFontElementListBox =
5617 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5618 fontChoiceSize, 0, NULL, wxCB_SORT);
5621 for (
size_t i = 0; i < uniqueStrings.GetCount(); i++) {
5622 m_itemFontElementListBox->Append(uniqueStrings[i]);
5625 if (uniqueStrings.GetCount()) m_itemFontElementListBox->SetSelection(0);
5627 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5629 wxButton* itemFontChooseButton =
5630 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5631 wxDefaultPosition, wxDefaultSize, 0);
5632 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5633#if defined(__WXGTK__) || defined(__WXQT__)
5634 wxButton* itemFontColorButton =
5635 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5636 wxDefaultPosition, wxDefaultSize, 0);
5637 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5639 wxButton* itemFontResetButton =
5640 new wxButton(itemPanelFont, ID_BUTTONFONT_RESET, _(
"Reset to Default"),
5641 wxDefaultPosition, wxDefaultSize, 0);
5642 itemFontStaticBoxSizer->Add(itemFontResetButton, 0, wxALL, border_size);
5644 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5645 wxDefaultPosition, wxDefaultSize, 0);
5646 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5651 wxStaticBox* itemStyleStaticBox =
5652 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5653 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5654 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5655 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5657 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5659 wxArrayPtrVoid styles = g_StyleManager->GetArrayOfStyles();
5660 for (
unsigned int i = 0; i < styles.Count(); i++) {
5662 m_itemStyleListBox->Append(style->name);
5664 m_itemStyleListBox->SetStringSelection(
5665 g_StyleManager->GetCurrentStyle()->name);
5666 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5669 wxStaticBox* miscOptionsBox =
5670 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5671 wxStaticBoxSizer* miscOptions =
5672 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5673 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5676 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5677 pShowStatusBar->SetValue(FALSE);
5678 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5681 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5682 pShowMenuBar->SetValue(FALSE);
5683 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5687 pShowMenuBar->Hide();
5690 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5691 pShowChartBar->SetValue(g_bShowChartBar);
5692 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5694 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5695 _(
"Show Compass/GPS Status Window"));
5696 pShowCompassWin->SetValue(FALSE);
5697 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5699 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5700 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5702 pToolbarAutoHideCB =
5703 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5704 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5706 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL,
"", wxDefaultPosition,
5707 wxSize(50, -1), wxTE_RIGHT);
5708 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5710 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5711 group_item_spacing);
5713 auto enable_debug_cb =
new wxCheckBox(itemPanelFont, wxID_ANY,
5714 _(
"Enable Debug in root context menu"));
5715 enable_debug_cb->Bind(wxEVT_CHECKBOX, [enable_debug_cb](wxCommandEvent&) {
5716 g_enable_root_menu_debug = enable_debug_cb->IsChecked();
5718 enable_debug_cb->SetValue(g_enable_root_menu_debug);
5719 miscOptions->Add(enable_debug_cb, 0, wxALL, border_size);
5723 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5724 miscOptions->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5727 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5728 _(
"Enable Touchscreen interface"));
5729 miscOptions->Add(pMobile, 0, wxALL, border_size);
5731 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5732 _(
"Enable Scaled Graphics interface"));
5733 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5738 pResponsive->Hide();
5742 pResponsive->Hide();
5745 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5746 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5748 pZoomButtons->Hide();
5752 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5753 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5755 wxButton* itemEcdisHelp =
5756 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5757 wxDefaultPosition, wxDefaultSize, 0);
5758 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5761 pInlandEcdis->Hide();
5762 itemEcdisHelp->Hide();
5765 miscOptions->AddSpacer(10);
5767 wxFlexGridSizer* sliderSizer;
5768 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5769 sliderSizer->AddGrowableCol(1);
5770 sliderSizer->SetFlexibleDirection(wxBOTH);
5771 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5773 m_pSlider_GUI_Factor =
5774 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5775 m_sliderSize, SLIDER_STYLE);
5776 m_pSlider_GUI_Factor->Hide();
5777 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5778 _(
"User Interface scale factor")),
5780 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5781 m_pSlider_GUI_Factor->Show();
5784 prepareSlider(m_pSlider_GUI_Factor);
5787 m_pSlider_Chart_Factor =
5788 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5789 m_sliderSize, SLIDER_STYLE);
5790 m_pSlider_Chart_Factor->Hide();
5792 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5794 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5795 m_pSlider_Chart_Factor->Show();
5798 prepareSlider(m_pSlider_Chart_Factor);
5801 m_pSlider_Ship_Factor =
5802 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5803 m_sliderSize, SLIDER_STYLE);
5804 m_pSlider_Ship_Factor->Hide();
5806 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5808 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5809 m_pSlider_Ship_Factor->Show();
5812 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5815 m_pSlider_Text_Factor =
5816 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5817 m_sliderSize, SLIDER_STYLE);
5818 m_pSlider_Text_Factor->Hide();
5820 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5822 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5823 m_pSlider_Text_Factor->Show();
5826 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5829 m_pSlider_ENCText_Factor =
5830 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5831 m_sliderSize, SLIDER_STYLE);
5832 m_pSlider_ENCText_Factor->Hide();
5834 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5836 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5837 m_pSlider_ENCText_Factor->Show();
5840 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5843 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5844 _(
"Mouse wheel zoom sensitivity")),
5846 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5847 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5849 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5850 miscOptions->AddSpacer(20);
5853void options::OnResetFont(wxCommandEvent& event) {
5854 wxString itemElement;
5855 int i = m_itemFontElementListBox->GetSelection();
5857 itemElement = m_itemFontElementListBox->GetString(i);
5859 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5861 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5862 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5865 m_textSample->SetFont(*pFont);
5866 m_textSample->SetForegroundColour(colour);
5867 m_textSample->Refresh();
5870 gFrame->UpdateAllFonts();
5871 m_bfontChanged =
true;
5872 OnFontChoice(event);
5877void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5878 m_pCheck_AlertAudio->Enable(event.IsChecked());
5879 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5882void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5883 if (event.IsChecked()) {
5884 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5885 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5886 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5890void options::CreateListbookIcons() {
5893 if (!g_bresponsive) {
5896 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5898#if wxCHECK_VERSION(2, 8, 12)
5899 m_topImgList->Add(style->GetIcon(
"Display", sx, sy));
5900 m_topImgList->Add(style->GetIcon(
"Charts", sx, sy));
5901 m_topImgList->Add(style->GetIcon(
"Connections", sx, sy));
5902 m_topImgList->Add(style->GetIcon(
"Ship", sx, sy));
5903 m_topImgList->Add(style->GetIcon(
"UI", sx, sy));
5904 m_topImgList->Add(style->GetIcon(
"Plugins", sx, sy));
5908 bmp = style->GetIcon(
"Display");
5909 img = bmp.ConvertToImage();
5910 img.ConvertAlphaToMask(128);
5911 bmp = wxBitmap(img);
5912 m_topImgList->Add(bmp);
5913 bmp = style->GetIcon(
"Charts");
5914 img = bmp.ConvertToImage();
5915 img.ConvertAlphaToMask(128);
5916 bmp = wxBitmap(img);
5917 m_topImgList->Add(bmp);
5918 bmp = style->GetIcon(
"Connections");
5919 img = bmp.ConvertToImage();
5920 img.ConvertAlphaToMask(128);
5921 bmp = wxBitmap(img);
5922 m_topImgList->Add(bmp);
5923 bmp = style->GetIcon(
"Ship");
5924 img = bmp.ConvertToImage();
5925 img.ConvertAlphaToMask(128);
5926 bmp = wxBitmap(img);
5927 m_topImgList->Add(bmp);
5928 bmp = style->GetIcon(
"UI");
5929 img = bmp.ConvertToImage();
5930 img.ConvertAlphaToMask(128);
5931 bmp = wxBitmap(img);
5932 m_topImgList->Add(bmp);
5933 bmp = style->GetIcon(
"Plugins");
5934 img = bmp.ConvertToImage();
5935 img.ConvertAlphaToMask(128);
5936 bmp = wxBitmap(img);
5937 m_topImgList->Add(bmp);
5941 bmps = style->GetIcon(
"Display");
5942 int base_size = bmps.GetWidth();
5943 double tool_size = base_size;
5945 double premult = 1.0;
5949 double target_size = 6.0;
5951 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5952 premult = target_size / basic_tool_size_mm;
5955 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5956 postmult = wxMin(postmult, 3.0);
5957 postmult = wxMax(postmult, 1.0);
5959 int sizeTab = base_size * postmult * premult;
5961 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5965 bmp = style->GetIcon(
"Display");
5966 img = bmp.ConvertToImage();
5967 simg = img.Scale(sizeTab, sizeTab);
5968 bmp = wxBitmap(simg);
5969 m_topImgList->Add(bmp);
5970 bmp = style->GetIcon(
"Charts");
5971 img = bmp.ConvertToImage();
5972 simg = img.Scale(sizeTab, sizeTab);
5973 bmp = wxBitmap(simg);
5974 m_topImgList->Add(bmp);
5975 bmp = style->GetIcon(
"Connections");
5976 img = bmp.ConvertToImage();
5977 simg = img.Scale(sizeTab, sizeTab);
5978 bmp = wxBitmap(simg);
5979 m_topImgList->Add(bmp);
5980 bmp = style->GetIcon(
"Ship");
5981 img = bmp.ConvertToImage();
5982 simg = img.Scale(sizeTab, sizeTab);
5983 bmp = wxBitmap(simg);
5984 m_topImgList->Add(bmp);
5985 bmp = style->GetIcon(
"UI");
5986 img = bmp.ConvertToImage();
5987 simg = img.Scale(sizeTab, sizeTab);
5988 bmp = wxBitmap(simg);
5989 m_topImgList->Add(bmp);
5990 bmp = style->GetIcon(
"Plugins");
5991 img = bmp.ConvertToImage();
5992 simg = img.Scale(sizeTab, sizeTab);
5993 bmp = wxBitmap(simg);
5994 m_topImgList->Add(bmp);
5998void options::CreateControls(
void) {
5999 int border_size = 4;
6001 int group_item_spacing = 2;
6003 int font_size_y, font_descent, font_lead;
6004 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
6005 m_fontHeight = font_size_y + font_descent + font_lead;
6009 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
6010 m_fontHeight * 8 / 10);
6013 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
6017 m_small_button_size =
6018 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
6020 m_nCharWidthMax = GetSize().x / GetCharWidth();
6023 pEnableZoomToCursor = NULL;
6024 pSmoothPanZoom = NULL;
6029 width = g_monitor_info[g_current_monitor].width;
6030 height = g_monitor_info[g_current_monitor].height;
6032 if (!g_bresponsive && height <= 800) {
6034 group_item_spacing = 1;
6038 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
6039 inputFlags = wxSizerFlags(0)
6040 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
6041 .Border(wxALL, group_item_spacing);
6042 verticleInputFlags =
6043 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
6044 groupLabelFlags = wxSizerFlags(0)
6045 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
6046 .Border(wxALL, group_item_spacing);
6047 groupLabelFlagsHoriz =
6048 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
6049 groupInputFlags = wxSizerFlags(0)
6050 .Align(wxALIGN_LEFT | wxALIGN_TOP)
6051 .Border(wxBOTTOM, group_item_spacing * 2)
6055 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
6060 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
6061 itemDialog1->SetSizer(itemBoxSizer2);
6065 wxFont* qFont = dialogFont;
6067 wxString wqs = getFontQtStylesheet(qFont);
6068 wxCharBuffer sbuf = wqs.ToUTF8();
6069 QString qsb = QString(sbuf.data());
6071 QString qsbq = getQtStyleSheet();
6073 itemDialog1->GetHandle()->setStyleSheet(qsb +
6080#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
6082 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6083 wxSize(-1, -1), flags);
6084 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
6085 wxListbookEventHandler(options::OnPageChange), NULL,
6089 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6090 wxSize(-1, -1), flags);
6091 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6092 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
6099 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
6103 CreateListbookIcons();
6105 m_pListbook->SetImageList(m_topImgList);
6106 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
6108 m_OK_Cancel_Apply_buttons =
new wxBoxSizer(wxHORIZONTAL);
6109 itemBoxSizer2->Add(m_OK_Cancel_Apply_buttons, 0, wxALIGN_RIGHT | wxALL,
6112 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
6113 m_OKButton->SetDefault();
6114 m_OK_Cancel_Apply_buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
6117 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
6118 m_OK_Cancel_Apply_buttons->Add(m_CancelButton, 0,
6119 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6121 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
6122 m_OK_Cancel_Apply_buttons->Add(m_ApplyButton, 0,
6123 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6125 m_pageDisplay = CreatePanel(_(
"Display"));
6126 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
6127 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
6128 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
6129 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
6131 m_pageCharts = CreatePanel(_(
"Charts"));
6132 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
6133 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
6136 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
6137 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
6140 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
6142#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
6143 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6144 wxListbookEventHandler(options::OnChartsPageChange), NULL,
6147 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6148 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
6154 wxString ConnTab = _(
"Connections");
6157 m_pageConnections = CreatePanel(ConnTab);
6158 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6162 m_pageShips = CreatePanel(_(
"Ships"));
6163 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
6164 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
6165 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
6167 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
6169 wxString UITab = _(
"User Interface");
6172 m_pageUI = CreatePanel(UITab);
6173 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
6174 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
6176 m_pagePlugins = CreatePanel(_(
"Plugins"));
6177 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
6179 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
6180 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
6183 if (g_pi_manager) g_pi_manager->NotifySetupOptions();
6185 SetColorScheme(
static_cast<ColorScheme
>(0));
6196 SetSizeHints(-1, -1, width - marginx, height - marginy);
6205void options::SetInitialPage(
int page_sel,
int sub_page) {
6206 if (page_sel < (
int)m_pListbook->GetPageCount())
6207 m_pListbook->SetSelection(page_sel);
6209 m_pListbook->SetSelection(0);
6211 if (sub_page >= 0) {
6212 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
6213 wxNotebookPage* pg = m_pListbook->GetPage(i);
6214 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
6216 if (i == (
size_t)page_sel) {
6217 if (sub_page < (
int)nb->GetPageCount())
6218 nb->SetSelection(sub_page);
6220 nb->SetSelection(0);
6222 nb->ChangeSelection(0);
6228void options::SetColorScheme(ColorScheme cs) {
6231#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
6232 wxListView* lv = m_pListbook->GetListView();
6233 lv->SetBackgroundColour(GetBackgroundColour());
6236 delete m_topImgList;
6237 CreateListbookIcons();
6238 m_pListbook->SetImageList(m_topImgList);
6246 comm_dialog->SetColorScheme(cs);
6249void options::OnAISRolloverClick(wxCommandEvent& event) {
6250 m_pCheck_Rollover_Class->Enable(event.IsChecked());
6251 m_pCheck_Rollover_COG->Enable(event.IsChecked());
6252 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
6253 pStatic_CallSign->Enable(event.IsChecked());
6256void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
6258 case ID_SCREENCONFIG1:
6259 if (m_sconfigSelect_twovertical)
6260 m_sconfigSelect_twovertical->SetSelected(
false);
6264 case ID_SCREENCONFIG2:
6265 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6271void options::SetInitialSettings(
void) {
6274 m_returnChanges = 0;
6275 m_bfontChanged =
false;
6276 m_font_element_array.Clear();
6278 b_oldhaveWMM = b_haveWMM;
6279 auto loader = PluginLoader::GetInstance();
6280 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
6283 switch (g_canvasConfig) {
6286 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
6287 if (m_sconfigSelect_twovertical)
6288 m_sconfigSelect_twovertical->SetSelected(
false);
6291 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6292 if (m_sconfigSelect_twovertical)
6293 m_sconfigSelect_twovertical->SetSelected(
true);
6296 m_screenConfig = g_canvasConfig;
6300 ActiveChartArray.Clear();
6301 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6302 ActiveChartArray.Add(m_CurrentDirList[i]);
6306 if (m_pWorkDirList) {
6307 UpdateWorkArrayFromDisplayPanel();
6308 groupsPanel->SetDBDirs(*m_pWorkDirList);
6311 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6312 delete m_pGroupArray;
6313 m_pGroupArray = groupsPanel->CloneChartGroupArray(
g_pGroupArray);
6314 groupsPanel->SetGroupArray(m_pGroupArray);
6315 groupsPanel->SetInitialSettings();
6319 pShowStatusBar->SetValue(g_bShowStatusBar);
6321 pShowMenuBar->SetValue(g_bShowMenuBar);
6323 pShowCompassWin->SetValue(g_bShowCompassWin);
6327 pCOGUPUpdateSecs->SetValue(s);
6329 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6330 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6332 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6333 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6334 pMobile->SetValue(g_btouch);
6335 pResponsive->SetValue(g_bresponsive);
6342 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6346 pInlandEcdis->SetValue(g_bInlandEcdis);
6348 pOpenGL->SetValue(g_bopengl);
6351 pCBTrueShow->SetValue(g_bShowTrue);
6352 pCBMagShow->SetValue(g_bShowMag);
6354 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6358 itemStaticTextUserVar->SetLabel(
6359 _(
"WMM Plugin calculated magnetic variation"));
6361 s.Printf(
"%4.1f", gVar);
6362 pMagVar->SetValue(s);
6364 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6366 s.Printf(
"%4.1f", g_UserVar);
6367 pMagVar->SetValue(s);
6370 int newLength = itemStaticTextUserVar->GetLabel().Length();
6373 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6374 wxSize sz = GetSize();
6375 SetSize(sz.x + 1, sz.y);
6379 itemStaticTextUserVar2->Enable(!b_haveWMM);
6380 pMagVar->Enable(!b_haveWMM);
6387 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6391 wxString stringDefaultBoatSpeed;
6392 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6393 g_defaultBoatSpeed = 6.0;
6394 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6396 stringDefaultBoatSpeed.Printf(
"%d", (
int)g_defaultBoatSpeedUserUnit);
6397 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6401 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6402 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6403 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6405 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6407 s.Printf(
"%6.2f", g_ownship_predictor_minutes);
6409 s.Printf(
"%4.0f", g_ownship_predictor_minutes);
6410 m_pText_OSCOG_Predictor->SetValue(s);
6412 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6413 g_ownship_HDTpredictor_miles) > 1e-4)
6414 s.Printf(
"%6.2f", g_ownship_HDTpredictor_miles);
6416 s.Printf(
"%4.0f", g_ownship_HDTpredictor_miles);
6417 m_pText_OSHDT_Predictor->SetValue(s);
6419 if (g_OwnShipmmsi > 0) {
6420 wxString s = wxString::Format(
"%i", g_OwnShipmmsi);
6421 m_pTxt_OwnMMSI->SetValue(s);
6423 m_pTxt_OwnMMSI->SetValue(
"");
6425 m_pShipIconType->SetSelection(g_OwnShipIconType);
6426 wxCommandEvent eDummy;
6427 OnShipTypeSelect(eDummy);
6428 m_pOSLength->SetValue(wxString::Format(
"%.1f", g_n_ownship_length_meters));
6429 m_pOSWidth->SetValue(wxString::Format(
"%.1f", g_n_ownship_beam_meters));
6430 m_pOSGPSOffsetX->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_x));
6431 m_pOSGPSOffsetY->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_y));
6432 m_pOSMinSize->SetValue(wxString::Format(
"%d", g_n_ownship_min_mm));
6433 m_pText_ACRadius->SetValue(
6434 wxString::Format(
"%.3f", g_n_arrival_circle_radius));
6437 if (g_iNavAidRadarRingsNumberVisible > 10)
6438 g_iNavAidRadarRingsNumberVisible = 10;
6439 pNavAidRadarRingsNumberVisible->SetSelection(
6440 g_iNavAidRadarRingsNumberVisible);
6441 buf.Printf(
"%.3f", g_fNavAidRadarRingsStep);
6442 pNavAidRadarRingsStep->SetValue(buf);
6443 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6444 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6446 pScaMinChckB->SetValue(g_bUseWptScaMin);
6447 m_pText_ScaMin->SetValue(wxString::Format(
"%i", g_iWpt_ScaMin));
6448 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6450 OnRadarringSelect(eDummy);
6452 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6453 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6454 buf.Printf(
"%.3f", g_fWaypointRangeRingsStep);
6455 pWaypointRangeRingsStep->SetValue(buf);
6456 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6457 m_colourWaypointRangeRingsColour->SetColour(g_colourWaypointRangeRingsColour);
6458 OnWaypointRangeRingSelect(eDummy);
6459 pShowshipToActive->SetValue(g_bShowShipToActive);
6460 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6461 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6463 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6464 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6466 pSogCogFromLLCheckBox->SetValue(g_own_ship_sog_cog_calc);
6467 pSogCogFromLLDampInterval->SetValue(g_own_ship_sog_cog_calc_damp_sec);
6469 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6470 if (pEnableTenHertz) pEnableTenHertz->SetValue(g_btenhertz);
6472 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6473 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6475 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6477 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6480 pSDMMFormat->Select(g_iSDMMFormat);
6481 pDistanceFormat->Select(g_iDistanceFormat);
6482 pSpeedFormat->Select(g_iSpeedFormat);
6483 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6484 pTempFormat->Select(g_iTempFormat);
6486 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6487 g_bAdvanceRouteWaypointOnArrivalOnly);
6498 pTrackDaily->SetValue(g_bTrackDaily);
6499 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6500 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6501 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6502 TIME_TYPE_COMPUTER);
6503 pTrackHighlite->SetValue(g_bHighliteTracks);
6504 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6505 pTrackPrecision->SetSelection(g_nTrackPrecision);
6507 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6511 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6513 s.Printf(
"%4.1f", g_CPAMax_NM);
6514 m_pText_CPA_Max->SetValue(s);
6516 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6518 s.Printf(
"%4.1f", g_CPAWarn_NM);
6519 m_pText_CPA_Warn->SetValue(s);
6521 if (m_pCheck_CPA_Warn->GetValue()) {
6522 m_pCheck_CPA_WarnT->Enable();
6523 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6525 m_pCheck_CPA_WarnT->Disable();
6527 s.Printf(
"%4.0f", g_TCPA_Max);
6528 m_pText_CPA_WarnT->SetValue(s);
6531 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6533 s.Printf(
"%4.0f", g_MarkLost_Mins);
6534 m_pText_Mark_Lost->SetValue(s);
6536 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6538 s.Printf(
"%4.0f", g_RemoveLost_Mins);
6539 m_pText_Remove_Lost->SetValue(s);
6542 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6544 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6545 m_pText_COG_Predictor->SetValue(s);
6547 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6548 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6550 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6552 s.Printf(
"%4.0f", g_AISShowTracks_Mins);
6553 m_pText_Track_Length->SetValue(s);
6555 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6557 s.Printf(
"%4.1f", g_ShowMoored_Kts);
6558 m_pText_Moored_Speed->SetValue(s);
6560 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6562 s.Printf(
"%4.1f", g_AIS_RealtPred_Kts);
6563 m_pText_RealtPred_Speed->SetValue(s);
6565 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6567 s.Printf(
"%i", g_ShowScaled_Num);
6568 m_pText_Scale_Priority->SetValue(s);
6570 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6572 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6573 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6575 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6577 s.Printf(
"%d", g_Show_Target_Name_Scale);
6578 m_pText_Show_Target_Name_Scale->SetValue(s);
6580 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6581 m_pWplAction->SetSelection(g_WplAction);
6584 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6585 if (g_bAIS_CPA_Alert) {
6586 m_pCheck_AlertAudio->Enable();
6587 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6589 m_pCheck_AlertAudio->Disable();
6590 m_pCheck_AlertAudio->SetValue(
false);
6593 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6595 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6596 s.Printf(
"%4.0f", g_AckTimeout_Mins);
6597 m_pText_ACK_Timeout->SetValue(s);
6600 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6601 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6602 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6605 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6606 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6607 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6609 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6610 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6612 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6613 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6614 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6615 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6616 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6617 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6619 if (!g_config_display_size_manual) {
6620 pRBSizeAuto->SetValue(TRUE);
6621 for (
const auto& mm : g_monitor_info) {
6622 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6624 screenmm.RemoveLast();
6625 pScreenMM->Disable();
6628 screenmm.Append(wxString::Format(
"%zu,", mm));
6630 screenmm.RemoveLast();
6631 pRBSizeManual->SetValue(TRUE);
6634 pScreenMM->SetValue(screenmm);
6636 pDepthUnitSelect->SetSelection(g_nDepthUnitDisplay);
6637 UpdateOptionsUnits();
6639 SetInitialVectorSettings();
6641 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6643 s.Printf(
"%d", g_nAutoHideToolbar);
6644 pToolbarHideSecs->SetValue(s);
6648 delete m_pSerialArray;
6649 m_pSerialArray = NULL;
6650 m_pSerialArray = EnumerateSerialPorts();
6651 m_bForceNewToolbaronCancel =
false;
6654void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6655 if (ps57CtlListBox) {
6657 ps57CtlListBox->Clear();
6658 marinersStdXref.clear();
6660 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6662 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6665 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6666 item = ps52plib->OBJLDescriptions[iPtr];
6668 item = wxString(pOLE->OBJLName, wxConvUTF8);
6674 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6675 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6676 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6678 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6679 (catl == DISPLAYBASE))
6681 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6684 bool benable =
true;
6685 if (cat > 0) benable = cat != DISPLAYBASE;
6690 int newpos = ps57CtlListBox->Append(item, benable,
false);
6691 marinersStdXref.push_back(newpos);
6692 for (
size_t i = 0; i < iPtr; i++) {
6693 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6697 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6699 if (cat == DISPLAYBASE) bviz =
true;
6702 if (cat == STANDARD) {
6707 ps57CtlListBox->Check(newpos, bviz);
6711 ps57CtlListBox->RunLayout();
6714 wxSize s = ps57CtlListBox->GetSize();
6715 ps57CtlListBox->SetSize(s.x, s.y - 1);
6719void options::SetInitialVectorSettings(
void) {
6720 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6724 m_bVectorInit =
true;
6725 resetMarStdList(
true,
false);
6728 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6732 switch (ps52plib->GetDisplayCategory()) {
6742 case (MARINERS_STANDARD):
6750 if (pDispCat) pDispCat->SetSelection(nset);
6754 bool benableMarStd =
false;
6756 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); i++) {
6759 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6760 benableMarStd =
true;
6769 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6770 itemButtonClearList->Enable(benableMarStd);
6771 itemButtonSelectList->Enable(benableMarStd);
6772 itemButtonSetStd->Enable(benableMarStd);
6775 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6776 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6777 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6778 if (pCheck_XLSECTTEXT)
6779 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6781 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6782 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6783 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6784 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6786 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6787 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6790 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6791 pPointStyle->SetSelection(0);
6793 pPointStyle->SetSelection(1);
6795 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6796 pBoundStyle->SetSelection(0);
6798 pBoundStyle->SetSelection(1);
6800 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6801 p24Color->SetSelection(0);
6803 p24Color->SetSelection(1);
6805 UpdateOptionsUnits();
6809void options::UpdateOptionsUnits(
void) {
6810 int depthUnit = pDepthUnitSelect->GetSelection();
6812 depthUnit = wxMax(depthUnit, 0);
6813 depthUnit = wxMin(depthUnit, 2);
6819 else if (depthUnit == 2)
6825 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6826 wxString depthUnitString = depthUnitStrings[depthUnit];
6827 m_depthUnitsShal->SetLabel(depthUnitString);
6828 m_depthUnitsSafe->SetLabel(depthUnitString);
6829 m_depthUnitsDeep->SetLabel(depthUnitString);
6832 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6834 m_ShallowCtl->SetValue(s);
6836 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6838 m_SafetyCtl->SetValue(s);
6840 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6842 m_DeepCtl->SetValue(s);
6872void options::OnSizeAutoButton(wxCommandEvent& event) {
6874 for (
const auto& mm : g_monitor_info) {
6875 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6877 screenmm.RemoveLast();
6878 pScreenMM->SetValue(screenmm);
6879 pScreenMM->Disable();
6880 g_config_display_size_manual = FALSE;
6883void options::OnSizeManualButton(wxCommandEvent& event) {
6887 screenmm.Append(wxString::Format(
"%zu,", mm));
6890 for (
const auto& mm : g_monitor_info) {
6891 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6894 screenmm.RemoveLast();
6895 pScreenMM->SetValue(screenmm);
6896 pScreenMM->Enable();
6897 g_config_display_size_manual = TRUE;
6900void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6902void options::OnCPAWarnClick(wxCommandEvent& event) {
6903 if (m_pCheck_CPA_Warn->GetValue()) {
6904 m_pCheck_CPA_WarnT->Enable();
6906 m_pCheck_CPA_WarnT->SetValue(FALSE);
6907 m_pCheck_CPA_WarnT->Disable();
6911void options::OnSyncCogPredClick(wxCommandEvent& event) {
6912 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6913 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6914 m_pText_COG_Predictor->Disable();
6917 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6918 m_pText_COG_Predictor->SetValue(s);
6919 m_pText_COG_Predictor->Enable();
6923void options::OnShipTypeSelect(wxCommandEvent& event) {
6924 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6925 dispOptions->Layout();
6927 itemPanelShip->Layout();
6928 itemPanelShip->Refresh();
6932void options::OnRadarringSelect(wxCommandEvent& event) {
6933 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6934 dispOptions->Layout();
6936 itemPanelShip->Layout();
6937 itemPanelShip->Refresh();
6941void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6942 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6943 dispOptions->Layout();
6945 itemPanelRoutes->Layout();
6946 itemPanelRoutes->Refresh();
6950void options::OnGLClicked(wxCommandEvent& event) {
6955void options::OnOpenGLOptions(wxCommandEvent& event) {
6957 OpenGLOptionsDlg dlg(
this);
6959 if (dlg.ShowModal() == wxID_OK) {
6960 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6961 g_GLOptions.m_bUseAcceleratedPanning = g_bGLexpert
6962 ? dlg.GetAcceleratedPanning()
6963 : gFrame->GetPrimaryCanvas()
6965 ->CanAcceleratePanning();
6968 g_bSoftwareGL = dlg.GetSoftwareGL();
6970 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6971 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6975 g_GLOptions.m_bTextureCompressionCaching =
6976 dlg.GetTextureCompressionCaching();
6977 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6980 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6983 if (g_bopengl && g_glTextureManager &&
6984 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6986 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6988 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6989 ::wxBeginBusyCursor();
6990 gFrame->GetPrimaryCanvas()->GetglCanvas()->SetupCompression();
6991 g_glTextureManager->ClearAllRasterTextures();
6992 ::wxEndBusyCursor();
6995 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6998 if (dlg.GetRebuildCache()) {
6999 m_returnChanges = REBUILD_RASTER_CACHE;
7005void options::OnChartDirListSelect(wxCommandEvent& event) {
7007 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
7008 m_removeBtn->Enable(selected);
7009 if (m_compressBtn) m_compressBtn->Enable(selected);
7013void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
7016 const bool select = pDispCat->GetSelection() == 3;
7017 ps57CtlListBox->Enable(select);
7018 itemButtonClearList->Enable(select);
7019 itemButtonSelectList->Enable(select);
7020 itemButtonSetStd->Enable(select);
7026void options::OnButtonClearClick(wxCommandEvent& event) {
7027 resetMarStdList(
false,
false);
7036void options::OnButtonSelectClick(wxCommandEvent& event) {
7037 int nOBJL = ps57CtlListBox->GetCount();
7038 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
7043void options::OnButtonSetStd(wxCommandEvent& event) {
7044 resetMarStdList(
false,
true);
7049bool options::ShowToolTips(
void) {
return TRUE; }
7051void options::OnCharHook(wxKeyEvent& event) {
7052 if (event.GetKeyCode() == WXK_RETURN &&
7053 event.GetModifiers() == wxMOD_CONTROL) {
7054 wxCommandEvent okEvent;
7055 okEvent.SetId(xID_OK);
7056 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
7057 GetEventHandler()->AddPendingEvent(okEvent);
7062void options::OnButtonaddClick(wxCommandEvent& event) {
7064 int dresult = g_Platform->DoDirSelectorDialog(
7065 this, &selDir, _(
"Add a directory containing chart files"),
7066 *pInit_Chart_Dir,
false);
7068 if (dresult != wxID_CANCEL) AddChartDir(selDir);
7073void options::AddChartDir(
const wxString& dir) {
7074 wxFileName dirname = wxFileName(dir);
7075 pInit_Chart_Dir->Empty();
7080 f.MakeRelativeTo(g_Platform->GetHomeDir());
7081 dirAdd = f.GetFullPath();
7083 pInit_Chart_Dir->Append(dirname.GetPath());
7088 cdi.fullpath = dirAdd;
7089 ActiveChartArray.Add(cdi);
7091 UpdateChartDirList();
7093 k_charts |= CHANGE_CHARTS;
7095 pScanCheckBox->Disable();
7098void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
7101 ActiveChartArray.Clear();
7102 for (
size_t i = 0; i < p.GetCount(); i++) {
7103 ActiveChartArray.Add(p[i]);
7106 UpdateChartDirList();
7109void options::UpdateWorkArrayFromDisplayPanel(
void) {
7111 int n = ActiveChartArray.GetCount();
7112 if (m_pWorkDirList) {
7113 m_pWorkDirList->Clear();
7114 for (
int i = 0; i < n; i++) {
7115 dirname = ActiveChartArray[i].fullpath;
7116 if (!dirname.IsEmpty()) {
7119 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7120 (dirname.Last() == wxChar(_T(
'\r'))))
7121 dirname.RemoveLast();
7127 bool b_added = FALSE;
7130 int nDir = m_CurrentDirList.GetCount();
7132 for (
int i = 0; i < nDir; i++) {
7133 if (m_CurrentDirList[i].fullpath == dirname) {
7135 m_pWorkDirList->Add(cdi);
7143 cdin.fullpath = dirname;
7144 m_pWorkDirList->Add(cdin);
7151void options::OnApplyClick(wxCommandEvent& event) {
7152 ApplyChanges(event);
7157 if ((m_returnChanges & FONT_CHANGED) ||
7158 (m_returnChanges & NEED_NEW_OPTIONS)) {
7159 gFrame->PrepareOptionsClose(
this, m_returnChanges);
7160 if (!(m_returnChanges & FONT_CHANGED_SAFE))
7161 gFrame->ScheduleReconfigAndSettingsReload(
true,
true);
7165 if ((m_returnChanges & CONFIG_CHANGED)) {
7166 gFrame->ScheduleReconfigAndSettingsReload(
true,
false);
7171void options::ApplyChanges(wxCommandEvent& event) {
7177 if (m_pShipIconType->GetSelection() > 0) {
7178 double n_ownship_length_meters;
7179 double n_ownship_beam_meters;
7180 double n_gps_antenna_offset_y;
7181 double n_gps_antenna_offset_x;
7182 long n_ownship_min_mm;
7183 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
7184 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
7185 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
7186 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
7187 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
7189 if (n_ownship_length_meters <= 0)
7190 msg += _(
"\n - your ship's length must be > 0");
7191 if (n_ownship_beam_meters <= 0)
7192 msg += _(
"\n - your ship's beam must be > 0");
7193 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
7195 "\n - your GPS offset from midship must be within your ship's beam");
7196 if (n_gps_antenna_offset_y < 0 ||
7197 n_gps_antenna_offset_y > n_ownship_length_meters)
7199 _(
"\n - your GPS offset from bow must be within your ship's length");
7200 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
7201 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
7202 if (!msg.IsEmpty()) {
7203 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
7204 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
7205 ::wxEndBusyCursor();
7206 event.SetInt(wxID_STOP);
7209 g_n_ownship_length_meters = n_ownship_length_meters;
7210 g_n_ownship_beam_meters = n_ownship_beam_meters;
7211 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
7212 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
7213 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
7215 g_OwnShipIconType = m_pShipIconType->GetSelection();
7216 g_bShowShipToActive = pShowshipToActive->GetValue();
7217 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
7218 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
7220 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
7221 g_n_arrival_circle_radius =
7222 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
7224 wxString* icon_name =
7225 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
7226 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
7229 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
7230 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
7232 g_bUseWptScaMin = pScaMinChckB->GetValue();
7233 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
7234 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
7237 if (m_bfontChanged) {
7239 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
7240 gFrame->GetPrimaryCanvas()->GetglCanvas()->ResetGridFont();
7243 if (gFrame->GetPrimaryCanvas()) {
7244 gFrame->GetPrimaryCanvas()->ResetGridFont();
7247 m_returnChanges |= FONT_CHANGED;
7251 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
7252 m_returnChanges |= FONT_CHANGED_SAFE;
7256 UpdateWorkArrayFromDisplayPanel();
7258 groupsPanel->SetDBDirs(*m_pWorkDirList);
7259 groupsPanel->m_treespopulated = FALSE;
7261 int k_force = FORCE_UPDATE;
7262 if (pUpdateCheckBox) {
7263 if (!pUpdateCheckBox->GetValue()) k_force = 0;
7264 pUpdateCheckBox->Enable();
7265 pUpdateCheckBox->SetValue(FALSE);
7270 m_returnChanges |= k_force;
7272 int k_scan = SCAN_UPDATE;
7273 if (pScanCheckBox) {
7274 if (!pScanCheckBox->GetValue()) k_scan = 0;
7275 pScanCheckBox->Enable();
7276 pScanCheckBox->SetValue(FALSE);
7281 m_returnChanges |= k_scan;
7285 if (groupsPanel->modified) {
7288 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
7289 m_returnChanges |= GROUPS_CHANGED;
7294 g_bShowStatusBar = pShowStatusBar->GetValue();
7296 g_bShowMenuBar = pShowMenuBar->GetValue();
7298 g_bShowCompassWin = pShowCompassWin->GetValue();
7301 g_bShowChartBar = pShowChartBar->GetValue();
7303 wxString screenmm = pScreenMM->GetValue();
7304 wxStringTokenizer tkz(screenmm, _T(
"," ));
7306 while (tkz.HasMoreTokens()) {
7307 wxString token = tkz.GetNextToken();
7309 if (token.ToLong(&mm) && mm > 0) {
7315 g_config_display_size_manual = pRBSizeManual->GetValue();
7318 comm_dialog->ApplySettings();
7320 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7324 bool temp_bquilting = pCDOQuilting->GetValue();
7327 g_bQuiltEnable = temp_bquilting;
7331 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7332 g_bskew_comp = pSkewComp->GetValue();
7333 g_btouch = pMobile->GetValue();
7334 g_bresponsive = pResponsive->GetValue();
7336 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7338 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7341 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7342 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7343 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7357 long update_val = 1;
7358 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7359 g_COGAvgSec = wxMin(
static_cast<int>(update_val), MAX_COG_AVERAGE_SECONDS);
7363 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7365 g_bShowTrue = pCBTrueShow->GetValue();
7366 g_bShowMag = pCBMagShow->GetValue();
7368 auto loader = PluginLoader::GetInstance();
7369 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
7370 if (!b_haveWMM && !b_oldhaveWMM) {
7371 pMagVar->GetValue().ToDouble(&g_UserVar);
7375 g_OwnShipmmsi = wxAtoi(m_pTxt_OwnMMSI->GetValue());
7376 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7377 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7380 g_iNavAidRadarRingsNumberVisible =
7381 pNavAidRadarRingsNumberVisible->GetSelection();
7382 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7383 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7384 g_fNavAidRadarRingsStep = temp_dbl;
7385 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7386 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7387 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7388 g_fWaypointRangeRingsStep = temp_dbl;
7389 g_iWaypointRangeRingsStepUnits =
7390 m_itemWaypointRangeRingsUnits->GetSelection();
7391 g_colourWaypointRangeRingsColour =
7392 m_colourWaypointRangeRingsColour->GetColour();
7393 g_colourWaypointRangeRingsColour =
7394 wxColour(g_colourWaypointRangeRingsColour.Red(),
7395 g_colourWaypointRangeRingsColour.Green(),
7396 g_colourWaypointRangeRingsColour.Blue());
7397 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7398 g_own_ship_sog_cog_calc = pSogCogFromLLCheckBox->GetValue();
7399 g_own_ship_sog_cog_calc_damp_sec = pSogCogFromLLDampInterval->GetValue();
7401 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7403 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7405 if (pCmdSoundString) {
7406 g_CmdSoundString = pCmdSoundString->GetValue();
7407 if (wxIsEmpty(g_CmdSoundString)) {
7408 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7409 pCmdSoundString->SetValue(g_CmdSoundString);
7413 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7414 if (pSoundDeviceIndex)
7415 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7417 g_iSDMMFormat = pSDMMFormat->GetSelection();
7418 g_iDistanceFormat = pDistanceFormat->GetSelection();
7419 g_iSpeedFormat = pSpeedFormat->GetSelection();
7420 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7421 g_iTempFormat = pTempFormat->GetSelection();
7424 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7425 if (pSDefaultBoatSpeed)
7426 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7427 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7428 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7429 getUsrSpeedUnit() +
")");
7431 g_bAdvanceRouteWaypointOnArrivalOnly =
7432 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7434 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7435 g_colourTrackLineColour =
7436 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7437 g_colourTrackLineColour.Blue());
7438 g_nTrackPrecision = pTrackPrecision->GetSelection();
7440 g_bTrackDaily = pTrackDaily->GetValue();
7442 g_track_rotate_time = 0;
7443#if wxUSE_TIMEPICKCTRL
7445 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7446 g_track_rotate_time = h * 3600 + m * 60 + s;
7449 if (pTrackRotateUTC->GetValue())
7450 g_track_rotate_time_type = TIME_TYPE_UTC;
7451 else if (pTrackRotateLMT->GetValue())
7452 g_track_rotate_time_type = TIME_TYPE_LMT;
7454 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7456 g_bHighliteTracks = pTrackHighlite->GetValue();
7463 if (pEnableZoomToCursor)
7464 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7466 if (pEnableTenHertz) g_btenhertz = pEnableTenHertz->GetValue();
7469 g_bEnableZoomToCursor =
false;
7472 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7473 g_colourOwnshipRangeRingsColour =
7474 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7475 g_colourOwnshipRangeRingsColour.Green(),
7476 g_colourOwnshipRangeRingsColour.Blue());
7479 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7480 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7481 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7482 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7486 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7487 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7488 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7489 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7490 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7491 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7494 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7495 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7496 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7497 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7500 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7502 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7503 if (g_bSyncCogPredictors) {
7504 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7506 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7508 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7509 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7513 for (
const auto& it : g_pAIS->GetTargetList()) {
7514 auto pAISTarget = it.second;
7515 if (NULL != pAISTarget) {
7516 pAISTarget->b_show_track = g_bAISShowTracks;
7518 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
7519 if (pAISTarget->MMSI == g_MMSI_Props_Array[i]->MMSI) {
7521 if (TRACKTYPE_NEVER == props->TrackType) {
7522 pAISTarget->b_show_track =
false;
7524 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7525 pAISTarget->b_show_track =
true;
7532 std::map<int, Track*>::iterator it;
7533 it = g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7534 if (it != g_pAIS->m_persistent_tracks.end())
7535 pAISTarget->b_show_track =
true;
7536 pAISTarget->b_show_track_old = g_bAISShowTracks;
7541 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7542 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7544 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7545 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7547 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7549 m_pText_Scale_Priority->GetValue().ToLong(&l);
7550 g_ShowScaled_Num = (int)l;
7552 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7553 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7554 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7555 long ais_name_scale = 5000;
7556 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7557 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7558 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7559 g_WplAction = m_pWplAction->GetSelection();
7562 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7563 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7564 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7566 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7567 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7570 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7571 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7572 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7574 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7575 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7576 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7577 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7579 bool bchange_scale =
false;
7580 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7581 bchange_scale =
true;
7582 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7584 g_ChartScaleFactorExp =
7585 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7586 g_MarkScaleFactorExp = g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7587 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7588 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7589 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7590 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7592 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7593 g_mouse_zoom_sensitivity =
7598 if (pWayPointMan)
WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7606 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7607 g_bopengl = pOpenGL->GetValue();
7610 g_bChartBarEx = pChartBarEX->GetValue();
7613 int depthUnit = pDepthUnitSelect->GetSelection();
7614 g_nDepthUnitDisplay = depthUnit;
7617 bool bUserStdChange =
false;
7619 int nOBJL = ps57CtlListBox->GetCount();
7621 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7623 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7624 if (marinersStdXref[i] == iPtr) {
7629 assert(itemIndex >= 0);
7630 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7631 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7632 bUserStdChange =
true;
7633 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7639 ps52plib->GenerateStateHash();
7640 long stateHash = ps52plib->GetStateHash();
7642 if (m_returnChanges & GL_CHANGED) {
7645 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7647 ps52plib->ClearCNSYLUPArray();
7648 ps52plib->GenerateStateHash();
7652 enum _DisCat nset = OTHER;
7653 switch (pDispCat->GetSelection()) {
7664 nset = MARINERS_STANDARD;
7667 ps52plib->SetDisplayCategory(nset);
7670 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7671 if (pCheck_ATONTEXT)
7672 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7673 if (pCheck_LDISTEXT)
7674 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7675 if (pCheck_XLSECTTEXT)
7676 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7678 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7679 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7680 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7681 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7682 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7683 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7685 ps52plib->m_nSymbolStyle =
7686 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7688 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7690 : SYMBOLIZED_BOUNDARIES;
7691 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7692 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7694 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7695 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7703 else if (depthUnit == 2)
7706 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7707 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7709 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7713 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7714 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7716 if (m_DeepCtl->GetValue().ToDouble(&dval))
7717 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7719 ps52plib->UpdateMarinerParams();
7720 ps52plib->m_nDepthUnitDisplay = depthUnit;
7722 ps52plib->GenerateStateHash();
7725 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7726 m_returnChanges |= S52_CHANGED;
7728 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7732#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7734 wxString new_canon =
"en_US";
7735 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7737 int nLang =
sizeof(lang_list) /
sizeof(
int);
7738 for (
int it = 0; it < nLang; it++) {
7739 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7741 wxString lang_canonical = pli->CanonicalName;
7742 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7743 if (lang_sel == test_string) {
7744 new_canon = lang_canonical;
7750 wxString locale_old = g_locale;
7751 g_locale = new_canon;
7753 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7755 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7758 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7759 m_returnChanges |= STYLE_CHANGED;
7761 wxSizeEvent nullEvent;
7762 gFrame->OnSize(nullEvent);
7765 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7766 g_bInlandEcdis = pInlandEcdis->GetValue();
7767 SwitchInlandEcdisMode(g_bInlandEcdis);
7768 m_returnChanges |= TOOLBAR_CHANGED;
7773 if (PluginLoader::GetInstance()->UpdatePlugIns())
7774 m_returnChanges |= TOOLBAR_CHANGED;
7778 g_pi_manager->UpdateConfig();
7781 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
7783 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7784 m_groups_changed | k_plugins | k_tides;
7788 TideCurrentDataSet.clear();
7789 int nEntry = tcDataSelected->GetItemCount();
7790 for (
int i = 0; i < nEntry; i++) {
7791 wxString setName = tcDataSelected->GetItemText(i);
7792 TideCurrentDataSet.push_back(setName.ToStdString());
7795 if (g_canvasConfig != m_screenConfig) m_returnChanges |= CONFIG_CHANGED;
7796 g_canvasConfig = m_screenConfig;
7798 gFrame->ProcessOptionsDialog(m_returnChanges, m_pWorkDirList);
7804 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7807 gFrame->RefreshAllCanvas();
7810 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7812 if (m_bVisitPlugins) m_returnChanges |= FORCE_RELOAD;
7815 UpdateTemplateTitleText();
7818 ::wxEndBusyCursor();
7821void options::OnXidOkClick(wxCommandEvent& event) {
7824 if (event.GetEventObject() == NULL)
return;
7826 ApplyChanges(event);
7829 gFrame->PrepareOptionsClose(
this, m_returnChanges);
7832 if ((m_returnChanges & CONFIG_CHANGED) || (m_returnChanges & GL_CHANGED))
7833 gFrame->ScheduleReconfigAndSettingsReload(
false,
false);
7836 if ((m_returnChanges & FONT_CHANGED) &&
7837 !(m_returnChanges & FONT_CHANGED_SAFE))
7838 gFrame->ScheduleDeleteSettingsDialog();
7841 if (m_returnChanges & LOCALE_CHANGED) gFrame->ScheduleDeleteSettingsDialog();
7844 if (m_returnChanges & FORCE_RELOAD) gFrame->ScheduleReloadCharts();
7850void options::Finish(
void) {
7852 m_pListbook->ChangeSelection(0);
7853 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7854 wxNotebookPage* pg = m_pListbook->GetPage(i);
7855 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7856 if (nb) nb->ChangeSelection(0);
7859 lastWindowPos = GetPosition();
7860 lastWindowSize = GetSize();
7862 pConfig->SetPath(
"/Settings");
7863 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7864 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7867ArrayOfCDI options::GetSelectedChartDirs() {
7869 for (
size_t i = 0; i < panelVector.size(); i++) {
7870 if (panelVector[i]->IsSelected()) {
7871 rv.Add(panelVector[i]->GetCDI());
7878ArrayOfCDI options::GetUnSelectedChartDirs() {
7880 for (
size_t i = 0; i < panelVector.size(); i++) {
7881 if (!panelVector[i]->IsSelected()) {
7882 rv.Add(panelVector[i]->GetCDI());
7889void options::SetDirActionButtons() {
7890 ArrayOfCDI selArray = GetSelectedChartDirs();
7891 if (selArray.GetCount())
7892 m_removeBtn->Enable();
7894 m_removeBtn->Disable();
7897void options::OnButtondeleteClick(wxCommandEvent& event) {
7898 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7899 ActiveChartArray.Clear();
7900 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7901 ActiveChartArray.Add(unselArray[i]);
7904 UpdateChartDirList();
7906 UpdateWorkArrayFromDisplayPanel();
7909 if (m_pWorkDirList) {
7910 pActiveChartsList->DeleteAllItems();
7911 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7912 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7915 li.SetAlign(wxLIST_FORMAT_LEFT);
7916 li.SetText(dirname);
7918 long idx = pActiveChartsList->InsertItem(li);
7923 k_charts |= CHANGE_CHARTS;
7925 pScanCheckBox->Disable();
7930void options::OnButtonParseENC(wxCommandEvent& event) {
7931 gFrame->GetPrimaryCanvas()->EnablePaint(
false);
7933 extern void ParseAllENC(wxWindow * parent);
7935 ParseAllENC(g_pOptions);
7938 gFrame->ChartsRefresh();
7940 gFrame->GetPrimaryCanvas()->EnablePaint(
true);
7946static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
7949 lzma_action action = LZMA_RUN;
7953 uint8_t inbuf[BUFSIZ];
7954 uint8_t outbuf[BUFSIZ];
7967 strm->next_in = NULL;
7969 strm->next_out = outbuf;
7970 strm->avail_out =
sizeof(outbuf);
7976 if (strm->avail_in == 0 && !feof(infile)) {
7977 strm->next_in = inbuf;
7978 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
7980 if (ferror(infile)) {
7981 fprintf(stderr,
"Read error: %s\n", strerror(errno));
7989 if (feof(infile)) action = LZMA_FINISH;
8007 lzma_ret ret = lzma_code(strm, action);
8012 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
8017 size_t write_size =
sizeof(outbuf) - strm->avail_out;
8019 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
8020 fprintf(stderr,
"Write error: %s\n", strerror(errno));
8025 strm->next_out = outbuf;
8026 strm->avail_out =
sizeof(outbuf);
8031 if (ret != LZMA_OK) {
8038 if (ret == LZMA_STREAM_END)
return true;
8049 case LZMA_MEM_ERROR:
8050 msg =
"Memory allocation failed";
8053 case LZMA_DATA_ERROR:
8066 msg =
"File size limits exceeded";
8081 msg =
"Unknown error, possibly a bug";
8085 wxLogMessage(
"LZMA Encoder error: %s (error code %u)\n", msg, ret);
8092static bool CompressChart(wxString in, wxString out) {
8094 FILE* infile = fopen(in.mb_str(),
"rb");
8095 if (!infile)
return false;
8097 FILE* outfile = fopen(out.mb_str(),
"wb");
8103 lzma_stream strm = LZMA_STREAM_INIT;
8104 bool success =
false;
8105 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
8107 success = compress(&strm, infile, outfile);
8118void options::OnButtonmigrateClick(wxCommandEvent& event) {
8123 new MigrateAssistantDialog(gFrame,
true);
8124 g_migrateDialog->SetSize(gFrame->GetSize());
8125 g_migrateDialog->Centre();
8126 g_migrateDialog->Raise();
8127 g_migrateDialog->ShowModal();
8131void options::OnButtonEcdisHelp(wxCommandEvent& event) {
8132 wxString testFile =
"/doc/iECDIS/index.html";
8134 if (!::wxFileExists(testFile)) {
8135 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
8138 _(
"Would you like to visit the iECDIS Manual website for more "
8141 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
8142 wxYES_NO | wxCENTER, 60)) {
8143 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
8154void options::OnButtoncompressClick(wxCommandEvent& event) {
8156 wxArrayInt pListBoxSelections;
8159 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
8160 wxLIST_STATE_SELECTED);
8161 if (item == -1)
break;
8166 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
8167This may make them incompatible with other programs or older versions of OpenCPN.\n\
8168Compressed charts may take slightly longer to load and display on some systems.\n\
8169They can be decompressed again using unxz or 7 zip programs."),
8170 _(
"OpenCPN Warning"),
8171 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
8175 wxArrayString filespecs;
8176 filespecs.Add(
"*.kap");
8177 filespecs.Add(
"*.KAP");
8178 filespecs.Add(
"*.000");
8181 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
8182 filespecs.Add(
"*.D");
8183 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
8184 filespecs.Add(
"*.Z");
8186 wxGenericProgressDialog prog1(
8187 _(
"OpenCPN Compress Charts"), wxEmptyString,
8188 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
8189 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8190 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8193 wxSize sz = prog1.GetSize();
8194 sz.x = gFrame->GetClientSize().x * 8 / 10;
8197 wxArrayString charts;
8198 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
8199 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
8200 if (dirname.IsEmpty())
continue;
8203 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
8204 (dirname.Last() == wxChar(_T(
'\r'))))
8205 dirname.RemoveLast();
8207 if (!wxDir::Exists(dirname))
continue;
8210 wxArrayString FileList;
8211 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
8212 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
8214 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
8218 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
8219 charts.Add(FileList[j]);
8223 if (charts.GetCount() == 0) {
8224 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
8229 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
8230 wxGenericProgressDialog prog(
8231 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
8232 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8233 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8237 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
8239 prog.Update(i, charts[i], &skip);
8242 wxString compchart = charts[i] +
".xz";
8243 if (CompressChart(charts[i], compchart)) {
8244 total_size += wxFileName::GetSize(charts[i]).ToULong();
8245 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
8246 wxRemoveFile(charts[i]);
8252 double total_size_mb = total_size / 1024.0 / 1024.0;
8253 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
8256 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
8258 count, total_size_mb, total_compressed_size_mb,
8259 total_size_mb - total_compressed_size_mb,
8260 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
8263 UpdateWorkArrayFromTextCtl();
8265 if (m_pWorkDirList) {
8266 pActiveChartsList->DeleteAllItems();
8267 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
8268 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
8271 li.SetAlign(wxLIST_FORMAT_LEFT);
8272 li.SetText(dirname);
8274 long idx = pActiveChartsList->InsertItem(li);
8278 k_charts |= CHANGE_CHARTS;
8280 pScanCheckBox->Disable();
8286void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
8288void options::OnCancelClick(wxCommandEvent& event) {
8289 m_pListbook->ChangeSelection(0);
8290 comm_dialog->CancelSettings();
8292 lastWindowPos = GetPosition();
8293 lastWindowSize = GetSize();
8295 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxCANCEL);
8297 pConfig->SetPath(
"/Settings");
8298 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8299 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8302 androidEnableBackButton(
true);
8303 androidEnableRotation();
8304 androidEnableOptionItems(
true);
8307 gFrame->ThawCharts();
8311void options::OnClose(wxCloseEvent& event) {
8313 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
8315 m_pListbook->ChangeSelection(0);
8317 lastWindowPos = GetPosition();
8318 lastWindowSize = GetSize();
8320 pConfig->SetPath(
"/Settings");
8321 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8322 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8324 gFrame->PrepareOptionsClose(
this, m_returnChanges);
8328void options::OnFontChoice(wxCommandEvent& event) {
8329 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8330 m_font_element_array.Add(sel_text_element);
8332 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8333 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8335 m_textSample->SetFont(*pif);
8336 m_textSample->SetForegroundColour(init_color);
8337 m_itemBoxSizerFontPanel->Layout();
8341void options::OnChooseFont(wxCommandEvent& event) {
8343 androidDisableRotation();
8346 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8347 m_font_element_array.Add(sel_text_element);
8348 wxFontData font_data;
8350 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8351 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8353 wxFontData init_font_data;
8354 if (pif) init_font_data.SetInitialFont(*pif);
8355 init_font_data.SetColour(init_color);
8360 wxFont* qFont = dialogFont;
8363 int retval = dg.ShowModal();
8364 if (wxID_CANCEL != retval) {
8365 font_data = dg.GetFontData();
8366 wxFont font = font_data.GetChosenFont();
8367 wxFont* psfont =
new wxFont(font);
8368 wxColor color = font_data.GetColour();
8369 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8370 gFrame->UpdateAllFonts();
8371 m_bfontChanged =
true;
8372 OnFontChoice(event);
8378 wxFontDialog dg(
this, init_font_data);
8380 wxFontDialog dg(pParent, init_font_data);
8383 wxFont* qFont = dialogFont;
8390 wxSize proposed_size = GetSize();
8392 float font_size = dialogFont->GetPointSize();
8394 if ((proposed_size.y / font_size) < n_lines) {
8395 float new_font_size = proposed_size.y / n_lines;
8396 wxFont* smallFont =
new wxFont(*dialogFont);
8397 smallFont->SetPointSize(new_font_size);
8398 dg.SetFont(*smallFont);
8402 if (g_bresponsive) {
8403 dg.SetSize(GetSize());
8407 int retval = dg.ShowModal();
8408 if (wxID_CANCEL != retval) {
8409 font_data = dg.GetFontData();
8410 wxFont font = font_data.GetChosenFont();
8411 wxFont* psfont =
new wxFont(font);
8412 wxColor color = font_data.GetColour();
8413 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8414 gFrame->UpdateAllFonts();
8415 m_bfontChanged =
true;
8416 OnFontChoice(event);
8421 androidEnableRotation();
8427#if defined(__WXGTK__) || defined(__WXQT__)
8428void options::OnChooseFontColor(wxCommandEvent& event) {
8429 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8430 m_font_element_array.Add(sel_text_element);
8432 wxColourData colour_data;
8434 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8435 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8438 androidDisableRotation();
8440 unsigned int cco = 0;
8443 cco |= init_color.Red();
8445 cco |= init_color.Green();
8447 cco |= init_color.Blue();
8448 unsigned int cc = androidColorPicker(cco);
8451 unsigned char blue = (
unsigned char)cc % 256;
8452 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8454 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8455 cn.Set(red, green, blue);
8457 FontMgr::Get().
SetFont(sel_text_element, pif, cn);
8459 gFrame->UpdateAllFonts();
8460 m_bfontChanged =
true;
8462 androidEnableRotation();
8464 wxScrolledWindow* sw =
8465 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8467 wxColourData init_colour_data;
8468 init_colour_data.SetColour(init_color);
8470 wxColourDialog dg(sw, &init_colour_data);
8472 int retval = dg.ShowModal();
8473 if (wxID_CANCEL != retval) {
8474 colour_data = dg.GetColourData();
8476 wxColor color = colour_data.GetColour();
8477 FontMgr::Get().
SetFont(sel_text_element, pif, color);
8479 gFrame->UpdateAllFonts();
8480 m_bfontChanged =
true;
8481 OnFontChoice(event);
8490void options::OnChartsPageChange(wxListbookEvent& event) {
8491 unsigned int i =
event.GetSelection();
8493 UpdateChartDirList();
8498 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8502 UpdateWorkArrayFromDisplayPanel();
8503 groupsPanel->SetDBDirs(*m_pWorkDirList);
8504 groupsPanel->m_treespopulated = FALSE;
8506 if (!groupsPanel->m_settingscomplete) {
8507 ::wxBeginBusyCursor();
8508 groupsPanel->CompleteInitialSettings();
8509 ::wxEndBusyCursor();
8510 }
else if (!groupsPanel->m_treespopulated) {
8511 groupsPanel->PopulateTrees();
8512 groupsPanel->m_treespopulated = TRUE;
8514 }
else if (1 == i) {
8516 if (!m_bVectorInit) {
8517 SetInitialVectorSettings();
8518 UpdateOptionsUnits();
8525void options::OnPageChange(wxListbookEvent& event) {
8526 DoOnPageChange(event.GetSelection());
8529void options::OnSubNBPageChange(wxNotebookEvent& event) {
8532 if (event.GetEventObject()) {
8533 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8534 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8535 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8536 if (
dynamic_cast<wxNotebook*
>(parent)) {
8537 lastSubPage =
event.GetSelection();
8540 if (
dynamic_cast<wxListbook*
>(parent)) {
8541 lastSubPage =
event.GetSelection();
8548void options::OnTopNBPageChange(wxNotebookEvent& event) {
8549 DoOnPageChange(event.GetSelection());
8552void options::DoOnPageChange(
size_t page) {
8553 unsigned int i = page;
8556 if (page > 10)
return;
8564 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8565 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8571 k_charts = VISIT_CHARTS;
8572 UpdateChartDirList();
8575 else if (m_pageConnections == i) {
8577 wxWindow* w = m_pListbook->GetCurrentPage();
8578 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
8581 else if (m_pageUI == i) {
8582 if (!m_itemLangListBox)
return;
8583#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8585 if (!m_bVisitLang) {
8586 ::wxBeginBusyCursor();
8588 int current_language = plocale_def_lang->GetLanguage();
8589 wxString current_sel = wxLocale::GetLanguageName(current_language);
8591 current_sel = GetOCPNKnownLanguage(g_locale);
8593 int nLang =
sizeof(lang_list) /
sizeof(
int);
8596 m_itemLangListBox->Append(
"English (U.S.)");
8598 wxString lang_dir = g_Platform->GetSharedDataDir() +
"share/locale/";
8599 for (
int it = 1; it < nLang; it++) {
8600 if (wxLocale::IsAvailable(lang_list[it])) {
8601 wxLocale ltest(lang_list[it], 0);
8602 ltest.AddCatalog(
"opencpn");
8603 if (!ltest.IsLoaded(
"opencpn"))
continue;
8606 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8607 wxString widgets_lang_name = loc_lang_name;
8608 wxString lang_canonical =
8609 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8612 wxString lang_suffix;
8613 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8616 wxString test_dir = lang_dir + lang_suffix;
8617 if (!wxDir::Exists(test_dir))
continue;
8619 m_itemLangListBox->Append(loc_lang_name);
8623 wxArrayString lang_array;
8626 lang_array.Add(
"en_US");
8627 for (
int it = 0; it < nLang; it++) {
8629 wxLog::EnableLogging(
8632 wxLocale ltest(lang_list[it], 0);
8633#if wxCHECK_VERSION(2, 9, 0)
8635 ltest.AddCatalogLookupPathPrefix(
8636 wxStandardPaths::Get().GetInstallPrefix() +
8637 _T(
"/share/locale" ));
8640 ltest.AddCatalog(
"opencpn");
8642 wxLog::EnableLogging(TRUE);
8643 if (ltest.IsLoaded(
"opencpn")) {
8644 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8647 s0 = x->CanonicalName;
8650 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8651 if (wxNOT_FOUND == lang_array.Index(s0)) {
8658 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8660 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8661 m_itemLangListBox->Append(loc_lang_name);
8677 delete plocale_def_lang;
8678 plocale_def_lang =
new wxLocale(current_language);
8680 setlocale(LC_NUMERIC,
"C");
8681 plocale_def_lang->AddCatalog(
"opencpn");
8683 m_itemLangListBox->SetStringSelection(current_sel);
8686 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8688 wxString clang = pli->Description;
8692 m_bVisitLang = TRUE;
8694 ::wxEndBusyCursor();
8697 }
else if (m_pagePlugins == i) {
8698 m_bVisitPlugins = TRUE;
8699 gFrame->FreezeCharts();
8703 auto loader = PluginLoader::GetInstance();
8704 if (LoadAllPlugIns(
false)) {
8705 delete m_pPlugInCtrl;
8706 m_pPlugInCtrl = NULL;
8707 delete m_PluginCatalogMgrPanel;
8708 m_PluginCatalogMgrPanel = NULL;
8709 itemBoxSizerPanelPlugins->Clear();
8712 if (!m_pPlugInCtrl) {
8714 ::wxBeginBusyCursor();
8717 wxDefaultPosition, wxDefaultSize);
8718 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8719 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8720 wxEXPAND | wxGROW | wxALL, 4);
8721 if (g_pi_manager) g_pi_manager->SetListPanelPtr(m_pPlugInCtrl);
8724 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8726 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8727 wxEXPAND | wxALL, 4);
8728 itemBoxSizerPanelPlugins->Layout();
8731 m_pPlugInCtrl->UpdateSelections();
8733 ::wxEndBusyCursor();
8735 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8738 k_plugins = TOOLBAR_CHANGED;
8740 k_plugins |= FORCE_RELOAD;
8744wxString options::SelectSoundFile() {
8745 wxString sound_dir = g_Platform->GetSharedDataDir();
8746 sound_dir.Append(
"sounds");
8751 wxFileDialog* popenDialog =
new wxFileDialog(
8752 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8753 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
8755 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8757 response = popenDialog->ShowModal();
8758 sel_file = popenDialog->GetPath();
8762 response = g_Platform->DoFileSelectorDialog(
8763 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
8766 if (response == wxID_OK)
8767 return g_Platform->NormalizePath(sel_file);
8772void options::OnButtonSelectSound(wxCommandEvent& event) {
8773 wxString sel_file = SelectSoundFile();
8775 if (!sel_file.IsEmpty()) {
8776 g_sAIS_Alert_Sound_File = g_Platform->NormalizePath(sel_file);
8780void options::OnButtonTestSound(wxCommandEvent& event) {
8781 auto sound = SoundFactory();
8782 auto cmd_sound =
dynamic_cast<SystemCmdSound*
>(sound);
8783 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8785 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8789wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8790 wxString return_string;
8791 wxString dir_suffix;
8793#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8795 if (lang_canonical ==
"en_US") {
8797 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8799 }
else if ((lang_canonical ==
"cs_CZ") || (lang_canonical ==
"cs")) {
8801 return_string = wxString(
"Čeština", wxConvUTF8);
8803 }
else if ((lang_canonical ==
"da_DK") || (lang_canonical ==
"da")) {
8805 return_string = wxString(
"Dansk", wxConvUTF8);
8807 }
else if ((lang_canonical ==
"de_DE") || (lang_canonical ==
"de")) {
8809 return_string = wxString(
"Deutsch", wxConvUTF8);
8811 }
else if ((lang_canonical ==
"et_EE") || (lang_canonical ==
"et")) {
8813 return_string = wxString(
"Eesti", wxConvUTF8);
8815 }
else if ((lang_canonical ==
"es_ES") || (lang_canonical ==
"es")) {
8817 return_string = wxString(
"Español", wxConvUTF8);
8819 }
else if ((lang_canonical ==
"fr_FR") || (lang_canonical ==
"fr")) {
8821 return_string = wxString(
"Français", wxConvUTF8);
8823 }
else if ((lang_canonical ==
"it_IT") || (lang_canonical ==
"it")) {
8825 return_string = wxString(
"Italiano", wxConvUTF8);
8827 }
else if ((lang_canonical ==
"nl_NL") || (lang_canonical ==
"nl")) {
8829 return_string = wxString(
"Nederlands", wxConvUTF8);
8831 }
else if ((lang_canonical ==
"pl_PL") || (lang_canonical ==
"pl")) {
8833 return_string = wxString(
"Polski", wxConvUTF8);
8835 }
else if ((lang_canonical ==
"pt_PT") || (lang_canonical ==
"pt")) {
8836 dir_suffix =
"pt_PT";
8837 return_string = wxString(
"Português", wxConvUTF8);
8839 }
else if ((lang_canonical ==
"pt_BR") || (lang_canonical ==
"pt_BR")) {
8840 dir_suffix =
"pt_BR";
8841 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8843 }
else if ((lang_canonical ==
"ru_RU") || (lang_canonical ==
"ru")) {
8845 return_string = wxString(
"Русский", wxConvUTF8);
8847 }
else if ((lang_canonical ==
"sv_SE") || (lang_canonical ==
"sv")) {
8849 return_string = wxString(
"Svenska", wxConvUTF8);
8851 }
else if ((lang_canonical ==
"fi_FI") || (lang_canonical ==
"fi")) {
8852 dir_suffix =
"fi_FI";
8853 return_string = wxString(
"Suomi", wxConvUTF8);
8855 }
else if ((lang_canonical ==
"nb_NO") || (lang_canonical ==
"nb")) {
8856 dir_suffix =
"nb_NO";
8857 return_string = wxString(
"Norsk", wxConvUTF8);
8859 }
else if ((lang_canonical ==
"tr_TR") || (lang_canonical ==
"tr")) {
8860 dir_suffix =
"tr_TR";
8861 return_string = wxString(
"Türkçe", wxConvUTF8);
8863 }
else if ((lang_canonical ==
"el_GR") || (lang_canonical ==
"el")) {
8864 dir_suffix =
"el_GR";
8865 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8867 }
else if ((lang_canonical ==
"hu_HU") || (lang_canonical ==
"hu")) {
8868 dir_suffix =
"hu_HU";
8869 return_string = wxString(
"Magyar", wxConvUTF8);
8871 }
else if ((lang_canonical ==
"zh_TW") || (lang_canonical ==
"zh_TW")) {
8872 dir_suffix =
"zh_TW";
8873 return_string = wxString(
"正體字", wxConvUTF8);
8875 }
else if ((lang_canonical ==
"zh_CN") || (lang_canonical ==
"zh_CN")) {
8876 dir_suffix =
"zh_CN";
8877 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8879 }
else if ((lang_canonical ==
"ca_ES") || (lang_canonical ==
"ca")) {
8880 dir_suffix =
"ca_ES";
8881 return_string = wxString(
"Catalan", wxConvUTF8);
8883 }
else if ((lang_canonical ==
"gl_ES") || (lang_canonical ==
"gl_ES")) {
8884 dir_suffix =
"gl_ES";
8885 return_string = wxString(
"Galician", wxConvUTF8);
8887 }
else if ((lang_canonical ==
"ja_JP") || (lang_canonical ==
"ja_JP")) {
8888 dir_suffix =
"ja_JP";
8889 return_string = wxString(
"Japanese", wxConvUTF8);
8891 }
else if ((lang_canonical ==
"vi_VN") || (lang_canonical ==
"vi_VN")) {
8892 dir_suffix =
"vi_VN";
8893 return_string = wxString(
"Vietnamese", wxConvUTF8);
8896 dir_suffix = lang_canonical;
8897 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8899 return_string = info->Description;
8901 return_string = lang_canonical;
8904 lang_dir = dir_suffix;
8906 return return_string;
8909wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8911 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8914ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8915 ChartGroupArray* d =
new ChartGroupArray;
8916 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8919 pdg->m_group_name = psg->m_group_name;
8920 pdg->m_element_array.reserve(psg->m_element_array.size());
8922 for (
auto& elem : psg->m_element_array)
8923 pdg->m_element_array.push_back(elem);
8930void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8940EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8941EVT_NOTEBOOK_PAGE_CHANGED(
8943 ChartGroupsUI::OnGroupPageChange)
8947 m_GroupSelectedPage = -1;
8948 m_pActiveChartsTree = 0;
8950 lastSelectedCtl = NULL;
8951 allAvailableCtl = NULL;
8952 defaultAllCtl = NULL;
8954 m_pAddButton = NULL;
8955 m_pRemoveButton = NULL;
8956 m_pDeleteGroupButton = NULL;
8957 m_pNewGroupButton = NULL;
8958 m_pGroupArray = NULL;
8961 m_UIcomplete =
false;
8962 m_treespopulated =
false;
8966ChartGroupsUI::~ChartGroupsUI(
void) {
8967 m_DirCtrlArray.Clear();
8968 m_GroupNB->Disconnect(
8969 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
8970 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
8975void ChartGroupsUI::SetInitialSettings(
void) {
8976 m_settingscomplete = FALSE;
8977 m_treespopulated = FALSE;
8980void ChartGroupsUI::PopulateTrees(
void) {
8983 wxArrayString dir_array;
8984 int nDir = m_db_dirs.GetCount();
8985 for (
int i = 0; i < nDir; i++) {
8986 wxString dirname = m_db_dirs[i].fullpath;
8987 if (!dirname.IsEmpty()) dir_array.Add(dirname);
8990 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array,
8991 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
8993 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
8997 wxArrayString dir_array0;
8998 int nDir0 = m_db_dirs.GetCount();
8999 for (
int i = 0; i < nDir0; i++) {
9000 wxString dirname = m_db_dirs[i].fullpath;
9001 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
9003 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
9004 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
9007void ChartGroupsUI::CompleteInitialSettings(
void) {
9010 BuildNotebookPages(m_pGroupArray);
9012 m_panel->GetSizer()->Layout();
9014 m_settingscomplete = TRUE;
9015 m_treespopulated = TRUE;
9018void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
9019 const wxArrayString& dir_array,
9020 const wxColour& col, wxFont* pFont) {
9021 ptc->DeleteAllItems();
9023 wxDirItemData* rootData =
new wxDirItemData(
"Dummy",
"Dummy", TRUE);
9026 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
9027 ptc->SetItemHasChildren(m_rootId);
9030 int nDir = dir_array.GetCount();
9031 for (
int i = 0; i < nDir; i++) {
9032 wxString dirname = dir_array[i];
9033 if (!dirname.IsEmpty()) {
9034 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
9035 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
9038 ptc->SetItemText(
id, dirname);
9039 if (pFont) ptc->SetItemFont(
id, *pFont);
9043 ptc->SetItemTextColour(
id, col);
9045 ptc->SetItemHasChildren(
id);
9050void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
9051 wxString insert_candidate = allAvailableCtl->GetPath();
9052 if (!insert_candidate.IsEmpty()) {
9053 if (m_DirCtrlArray.GetCount()) {
9054 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9055 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9057 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9059 if (ptree->IsEmpty()) {
9060 wxDirItemData* rootData =
9061 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9062 wxString rootName =
"Dummy";
9063 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9065 ptree->SetItemHasChildren(rootId);
9068 wxTreeItemId root_Id = ptree->GetRootItem();
9069 wxDirItemData* dir_item =
9070 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
9072 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
9073 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
9076 pGroup->m_element_array.push_back({insert_candidate});
9081 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9082 m_pAddButton->Disable();
9084 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9086 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9087 if (ptree) ptree->Refresh();
9091void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
9092 if (m_DirCtrlArray.GetCount()) {
9093 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9094 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9097 wxString sel_item = pDirCtrl->GetPath();
9099 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9100 if (ptree && ptree->GetCount()) {
9101 wxTreeItemId
id = ptree->GetSelection();
9102 lastDeletedItem = id;
9104 wxString branch_adder;
9105 int group_item_index =
9106 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
9107 if (group_item_index >= 0) {
9109 pGroup->m_element_array[group_item_index];
9110 bool b_duplicate = FALSE;
9111 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
9113 if (pelement.m_missing_name_array[k] == sel_item) {
9119 pelement.m_missing_name_array.Add(sel_item);
9125 if (branch_adder ==
"") {
9127 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
9130 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
9136 lastSelectedCtl->Unselect();
9137 lastSelectedCtl = 0;
9138 m_pRemoveButton->Disable();
9140 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9142 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9143 if (ptree) ptree->Refresh();
9151void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
9152 m_GroupSelectedPage =
event.GetSelection();
9153 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9154 if (lastSelectedCtl) {
9155 lastSelectedCtl->UnselectAll();
9156 lastSelectedCtl = 0;
9158 m_pRemoveButton->Disable();
9159 m_pAddButton->Disable();
9162 if (m_GroupSelectedPage == 0) {
9163 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
9165 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
9169void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
9170 wxObject* evtObj =
event.GetEventObject();
9171 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
9172 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
9173 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9174 m_pAddButton->Enable();
9176 m_pAddButton->Disable();
9179 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
9180 if (!lastSelectedCtl)
goto out;
9181 wxTreeItemId item = lastSelectedCtl->GetSelection();
9182 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9185 wxGenericDirCtrl* dirCtrl =
9186 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
9187 if (!dirCtrl)
goto out;
9188 wxString itemPath = dirCtrl->GetPath();
9189 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
9191 m_pRemoveButton->Disable();
9199void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
9200 wxTextEntryDialog* pd =
new wxTextEntryDialog();
9202 pd->SetFont(*qFont);
9204 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
9207 androidDisableRotation();
9210 if (pd->ShowModal() == wxID_OK) {
9211 if (pd->GetValue().Length()) {
9212 AddEmptyGroupPage(pd->GetValue());
9214 pGroup->m_group_name = pd->GetValue();
9215 m_pGroupArray->Add(pGroup);
9217 m_GroupSelectedPage =
9218 m_GroupNB->GetPageCount() - 1;
9219 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
9220 m_pDeleteGroupButton->Enable();
9227 androidEnableRotation();
9231void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
9232 if (0 != m_GroupSelectedPage) {
9233 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
9234 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
9235 m_GroupNB->DeletePage(m_GroupSelectedPage);
9238 if (m_GroupSelectedPage <= 0) {
9239 m_pAddButton->Disable();
9240 m_pDeleteGroupButton->Disable();
9244int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
9245 wxTreeItemId item, wxString* pbranch_adder) {
9246 wxString branch_name;
9247 wxString branch_adder;
9249 wxTreeItemId current_node = item;
9250 while (current_node.IsOk()) {
9251 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
9252 if (!parent_node)
break;
9254 if (parent_node == ptree->GetRootItem()) {
9255 branch_name = ptree->GetItemText(current_node);
9259 branch_adder.Prepend(ptree->GetItemText(current_node));
9260 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
9262 current_node = ptree->GetItemParent(current_node);
9266 unsigned int target_item_index = -1;
9268 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
9269 const wxString& target = pGroup->m_element_array[i].m_element_name;
9270 if (branch_name == target) {
9271 target_item_index = i;
9276 if (pbranch_adder) *pbranch_adder = branch_adder;
9278 return target_item_index;
9281void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
9282 wxTreeItemId node =
event.GetItem();
9284 if (m_GroupSelectedPage <= 0)
return;
9285 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9286 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9287 if (!pDirCtrl)
return;
9289 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9290 wxString branch_adder;
9291 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
9292 if (target_item_index < 0)
return;
9294 pGroup->m_element_array[target_item_index];
9295 const wxString& branch_name = target_element.m_element_name;
9299 if (!target_element.m_missing_name_array.GetCount())
return;
9300 wxString full_root = branch_name;
9301 full_root += branch_adder;
9302 full_root += wxString(wxFILE_SEP_PATH);
9304 wxTreeItemIdValue cookie;
9305 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
9306 while (child.IsOk()) {
9307 wxString target_string = full_root;
9308 target_string += ptree->GetItemText(child);
9310 for (
unsigned int k = 0; k < target_element.m_missing_name_array.GetCount();
9312 if (target_element.m_missing_name_array[k] == target_string) {
9313 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
9317 child = ptree->GetNextChild(node, cookie);
9321void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
9324 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
9326 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
9329 int nItems = pGroup->m_element_array.size();
9330 for (
int i = 0; i < nItems; i++) {
9331 const wxString& itemname = pGroup->m_element_array[i].m_element_name;
9332 if (!itemname.IsEmpty()) {
9333 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
9335 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
9337 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
9343wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
9344 wxGenericDirCtrl* GroupDirCtl =
9345 new wxGenericDirCtrl(m_GroupNB, wxID_ANY,
"TESTDIR");
9346 m_GroupNB->AddPage(GroupDirCtl, label);
9348 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
9349 ptree->DeleteAllItems();
9351 wxDirItemData* rootData =
9352 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9353 wxString rootName =
"Dummy";
9354 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9355 ptree->SetItemHasChildren(rootId);
9357 m_DirCtrlArray.Add(GroupDirCtl);
9362void ChartGroupsUI::ClearGroupPages() {
9363 if (m_GroupNB->GetPageCount() == 0)
return;
9365 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
9366 m_DirCtrlArray.RemoveAt(i);
9367 m_GroupNB->DeletePage(i);
9371void options::OnInsertTideDataLocation(wxCommandEvent& event) {
9373 int response = wxID_CANCEL;
9376 wxFileDialog* popenDialog =
new wxFileDialog(
9377 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
9378 "Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All "
9382 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
9384 response = popenDialog->ShowModal();
9385 sel_file = popenDialog->GetPath();
9390 response = g_Platform->DoFileSelectorDialog(
9391 this, &path, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
"*.*");
9395 if (response == wxID_OK) {
9397 int id = tcDataSelected->GetItemCount();
9399 long idx = tcDataSelected->InsertItem(li);
9400 tcDataSelected->SetItem(
id, 0, g_Platform->NormalizePath(sel_file));
9403 wxFileName fn(sel_file);
9404 wxString data_dir = fn.GetPath();
9405 g_TCData_Dir = g_Platform->NormalizePath(data_dir);
9409void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9412 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9413 wxLIST_STATE_SELECTED);
9414 if (item == -1)
break;
9415 tcDataSelected->DeleteItem(item);
9421enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9424BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9425EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9426EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9429OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9430 : wxDialog(parent, wxID_ANY, _T( "OpenGL Options" ), wxDefaultPosition,
9432 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9437 m_brebuild_cache(FALSE) {
9440 SetFont(*dialogFont);
9442 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9443 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9445 m_cbTextureCompression =
9446 new wxCheckBox(
this, wxID_ANY,
9447 g_bGLexpert ? _(
"Texture Compression")
9448 : _(
"Texture Compression with Caching"));
9449 m_cbTextureCompressionCaching =
9450 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9452 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9453 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9454 m_sTextureMemorySize->SetRange(1, 16384);
9456 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9457 wxButton* btnRebuild =
9458 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9459 wxButton* btnClear =
9460 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9461 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9462 if (!g_bopengl || g_raster_format == GL_RGB) btnRebuild->Disable();
9463 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9464 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9465 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9467 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9468 m_cbUseAcceleratedPanning =
9469 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9471 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9472 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9473 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9474 flexSizer->AddSpacer(0);
9475 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9476 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9477 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9478 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9479 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9480 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9481 flexSizer->AddSpacer(0);
9482 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9483 flexSizer->AddSpacer(0);
9484 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9485 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9486 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9487 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9488 flexSizer->AddSpacer(0);
9489 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9490 flexSizer->AddSpacer(0);
9491 flexSizer->AddSpacer(0);
9492 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9493 flexSizer->AddSpacer(0);
9494 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9495 flexSizer->AddGrowableCol(1);
9496 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9498 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9499 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9500 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9501 btnSizer->Realize();
9503 mainSizer->AddStretchSpacer();
9504 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9508 SetSizer(mainSizer);
9509 mainSizer->SetSizeHints(
this);
9513bool OpenGLOptionsDlg::GetAcceleratedPanning(
void)
const {
9514 return m_cbUseAcceleratedPanning->GetValue();
9517bool OpenGLOptionsDlg::GetTextureCompression(
void)
const {
9518 return m_cbTextureCompression->GetValue();
9521bool OpenGLOptionsDlg::GetPolygonSmoothing(
void)
const {
9522 return m_cbPolygonSmoothing->GetValue();
9525bool OpenGLOptionsDlg::GetLineSmoothing(
void)
const {
9526 return m_cbLineSmoothing->GetValue();
9529bool OpenGLOptionsDlg::GetSoftwareGL(
void)
const {
9530 return m_cbSoftwareGL->GetValue();
9533bool OpenGLOptionsDlg::GetTextureCompressionCaching(
void)
const {
9534 return m_cbTextureCompressionCaching->GetValue();
9537bool OpenGLOptionsDlg::GetRebuildCache(
void)
const {
return m_brebuild_cache; }
9539int OpenGLOptionsDlg::GetTextureMemorySize(
void)
const {
9540 return m_sTextureMemorySize->GetValue();
9543void OpenGLOptionsDlg::Populate(
void) {
9544 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9552 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9553 m_memorySize->Show(g_bGLexpert);
9554 m_sTextureMemorySize->Show(g_bGLexpert);
9556 m_cbTextureCompressionCaching->SetValue(
9557 g_GLOptions.m_bTextureCompressionCaching);
9558 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9560 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9561 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9563#if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9564 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9565 if (gFrame->GetPrimaryCanvas()
9567 ->GetVersionString()
9569 .Find(_T(
"MESA" )) != wxNOT_FOUND)
9570 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9573 m_cbSoftwareGL->Hide();
9577 SetFont(*dialogFont);
9580 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9581 if (gFrame->GetPrimaryCanvas()->GetglCanvas()->CanAcceleratePanning()) {
9582 m_cbUseAcceleratedPanning->Enable();
9583 m_cbUseAcceleratedPanning->SetValue(
9584 g_GLOptions.m_bUseAcceleratedPanning);
9586 m_cbUseAcceleratedPanning->SetValue(FALSE);
9587 m_cbUseAcceleratedPanning->Disable();
9590 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9593 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9594 m_cbUseAcceleratedPanning->Disable();
9598void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9599 if (g_GLOptions.m_bTextureCompressionCaching) {
9600 m_brebuild_cache = TRUE;
9601 EndModal(wxID_CANCEL);
9605void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9606 if (g_bopengl && g_glTextureManager) {
9607 ::wxBeginBusyCursor();
9608 g_glTextureManager->ClearAllRasterTextures();
9611 appendOSDirSlash(&path);
9612 path.append(
"raster_texture_cache");
9614 if (::wxDirExists(path)) {
9615 wxArrayString files;
9616 size_t nfiles = wxDir::GetAllFiles(path, &files);
9617 for (
unsigned int i = 0; i < files.GetCount(); i++)
9618 ::wxRemoveFile(files[i]);
9621 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9622 ::wxEndBusyCursor();
9626wxString OpenGLOptionsDlg::GetTextureCacheSize(
void) {
9628 appendOSDirSlash(&path);
9629 path.append(
"raster_texture_cache");
9630 long long total = 0;
9632 if (::wxDirExists(path)) {
9633 wxArrayString files;
9634 size_t nfiles = wxDir::GetAllFiles(path, &files);
9635 for (
unsigned int i = 0; i < files.GetCount(); i++)
9636 total += wxFile(files[i]).Length();
9638 double mb = total / (1024.0 * 1024.0);
9639 if (mb < 10000.0)
return wxString::Format(_T(
"%.1f MB" ), mb);
9641 return wxString::Format(_T(
"%.1f GB" ), mb);
9649EVT_PAINT(CanvasConfigSelect::OnPaint)
9653 wxWindowID
id, wxBitmap& bmp,
9654 const wxPoint& pos, const wxSize& size)
9655 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9656 m_parentOptions = parentOptions;
9661 int refHeight = GetCharHeight();
9663 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9664 bmp.GetSize().y + m_borderWidth * 2));
9666 Connect(wxEVT_LEFT_DOWN,
9667 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9670CanvasConfigSelect::~CanvasConfigSelect() {}
9672void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9678 if (m_parentOptions)
9679 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9682void CanvasConfigSelect::SetSelected(
bool selected) {
9683 m_bSelected = selected;
9687 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9690 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9696void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9698 GetSize(&width, &height);
9701 dc.SetBackground(*wxLIGHT_GREY);
9703 dc.SetPen(*wxTRANSPARENT_PEN);
9704 dc.SetBrush(wxBrush(GetBackgroundColour()));
9705 dc.DrawRectangle(GetVirtualSize());
9708 dc.SetBrush(wxBrush(m_boxColour));
9710 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9712 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9714 dc.SetBrush(wxBrush(m_boxColour));
9716 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9718 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9721 dc.DrawBitmap(m_bmpNormal, m_borderWidth, m_borderWidth,
false);
Class AisDecoder and helpers.
Global state for AIS decoder.
Wrapper for creating a ChartCtx based on global vars.
ChartGroupArray * g_pGroupArray
Global instance.
Basic chart info storage.
Generic Chart canvas base.
ChartCanvas - Main chart display and interaction component.
Represents an individual component within a ChartGroup.
Represents a user-defined collection of logically related charts.
Represents a panel for displaying and editing a configuration.
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
void Notify() override
Notify all listeners, no data supplied.
wxColour GetFontColor(const wxString &TextElement) const
Gets the text color for a UI element.
bool SetFont(const wxString &TextElement, wxFont *pFont, wxColour color)
Sets the default font properties for a UI element.
wxArrayString GetDialogStrings(const wxString &locale=wxEmptyString) const
Gets the list of unique dialog strings.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Gets a font object for a UI element.
Wrapper for global variable, supports notification events when value changes.
Process incoming AIS messages.
static double ui_to_config(int slider_pos)
Convert a slider scale 1-100 value to configuration value 1.02..3.0.
Handle logging and forwarding of incoming n0183/n2k messages.
Custom combobox for selecting waypoint icons.
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, const std::function< void(ObservedEvt &ev)> &action)
Initiate an object yet not listening.
Custom event class for OpenCPN's notification system.
bool LoadAllPlugIns(bool enabled_plugins, bool keep_orphans=false)
Update catalog with imported metadata and load all plugin library files.
ViewPort - Core geographic projection and coordinate transformation engine.
wxRadioButton * pTimezoneUTC
Specify date/time should be formatted in UTC.
EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
wxRadioButton * pTimezoneLocalTime
Specify date/time should be formatted in timezone as configured in the operating system.
Class cm93chart and helpers – CM93 chart state.
Global variables reflecting command line options and arguments.
Communication drivers factory and support.
Config file user configuration interface.
wxString g_datetime_format
Date/time format to use when formatting date/time strings.
bool g_bsmoothpanzoom
Controls how the chart panning and zooming smoothing is done during user interactions.
bool g_bRollover
enable/disable mouse rollover GUI effects
int g_COGAvgSec
COG average period for Course Up Mode (sec)
std::vector< size_t > g_config_display_size_mm
g_config_display_size_mm: Size of pysical screen in millimeters.
bool g_bDisplayGrid
Should lat/lon grid be displayed ?
Global variables stored in configuration file.
Panel for editing a connection.
Options | Connections GUI tab managing connections
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
Multiplexer class and helpers.
A common variable shared between producer and consumer which supports Listen() and Notify().
Global variables Listen()/Notify() wrapper.
wxString * GetpSharedDataLocation(void)
Gets shared application data location.
wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
Access checks for comm devices and dongle.