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>
64#include "conn_params_panel.h"
66#if defined(__WXGTK__) || defined(__WXQT__)
67#include <wx/colordlg.h>
71#include "ocpn_fontdlg.h"
76#include "model/ais_decoder.h"
78#include "model/ais_target_data.h"
80#include "model/comm_drv_factory.h"
81#include "model/comm_util.h"
82#include "model/config_vars.h"
83#include "model/idents.h"
84#include "model/multiplexer.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"
92#include "chart_ctx_factory.h"
103#include "observable_evtvar.h"
104#include "observable_globvar.h"
105#include "ocpn_frame.h"
106#include "OCPNPlatform.h"
107#include "OCPN_Sound.h"
111#include "SoundFactory.h"
113#include "svg_utils.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;
160extern bool g_bsmoothpanzoom;
161extern int g_chart_zoom_modifier_raster;
162extern int g_chart_zoom_modifier_vector;
163extern bool g_bUIexpert;
165extern wxString* pInit_Chart_Dir;
171extern bool g_bDisplayGrid;
174extern bool g_bShowLiveETA;
175extern double g_defaultBoatSpeed;
176extern double g_defaultBoatSpeedUserUnit;
178extern int g_iNavAidRadarRingsNumberVisible;
179extern bool g_bNavAidRadarRingsShown;
180extern float g_fNavAidRadarRingsStep;
181extern int g_pNavAidRadarRingsStepUnits;
182extern bool g_bWayPointPreventDragging;
183extern wxColour g_colourOwnshipRangeRingsColour;
184extern bool g_bShowShipToActive;
185extern int g_shipToActiveStyle;
186extern int g_shipToActiveColor;
188extern bool g_own_ship_sog_cog_calc;
189extern int g_own_ship_sog_cog_calc_damp_sec;
191extern bool g_bPreserveScaleOnX;
192extern bool g_bPlayShipsBells;
194extern wxString g_CmdSoundString;
196extern int g_iSoundDeviceIndex;
197extern bool g_bFullscreenToolbar;
198extern bool g_bTransparentToolbar;
199extern bool g_bTransparentToolbarInOpenGLOK;
201extern int g_OwnShipmmsi;
202extern int g_OwnShipIconType;
203extern double g_n_ownship_length_meters;
204extern double g_n_ownship_beam_meters;
205extern double g_n_gps_antenna_offset_y;
206extern double g_n_gps_antenna_offset_x;
207extern int g_n_ownship_min_mm;
209extern bool g_bEnableZoomToCursor;
210extern bool g_bHighliteTracks;
211extern wxColour g_colourTrackLineColour;
213extern bool g_bAdvanceRouteWaypointOnArrivalOnly;
215extern int g_cm93_zoom_factor;
217extern int g_COGAvgSec;
219extern bool g_bCourseUp;
220extern bool g_bLookAhead;
222extern double g_ownship_predictor_minutes;
223extern double g_ownship_HDTpredictor_miles;
225extern bool g_bQuiltEnable;
226extern bool g_bFullScreenQuilt;
227extern bool g_bConfirmObjectDelete;
230extern wxLocale* plocale_def_lang;
233extern double g_mouse_zoom_sensitivity;
234extern int g_mouse_zoom_sensitivity_ui;
236extern OcpnSound* g_anchorwatch_sound;
238extern bool g_fog_overzoom;
239extern bool g_oz_vector_scale;
240extern bool g_bShowStatusBar;
242extern s52plib* ps52plib;
244extern wxString g_locale;
246extern ChartGroupArray* g_pGroupArray;
253extern bool g_bGLexpert;
255#define ID_CHOICE_NMEA wxID_HIGHEST + 1
257extern std::vector<std::string> TideCurrentDataSet;
258extern wxString g_TCData_Dir;
262extern bool g_bShowMenuBar;
263extern bool g_bShowCompassWin;
266extern bool g_bAutoHideToolbar;
267extern int g_nAutoHideToolbar;
268extern int g_GUIScaleFactor;
269extern int g_ChartScaleFactor;
270extern float g_MarkScaleFactorExp;
271extern bool g_bRollover;
272extern int g_ShipScaleFactor;
273extern float g_ShipScaleFactorExp;
274extern int g_ENCSoundingScaleFactor;
275extern int g_ENCTextScaleFactor;
276extern bool g_bShowMuiZoomButtons;
278extern std::vector<size_t> g_config_display_size_mm;
279extern bool g_config_display_size_manual;
280extern unsigned int g_canvasConfig;
282extern wxString g_lastAppliedTemplateGUID;
283extern wxString g_default_wp_icon;
284extern int osMajor, osMinor;
285extern bool g_bShowMuiZoomButtons;
287extern bool g_btenhertz;
290extern int g_Android_SDK_Version;
291extern MigrateAssistantDialog* g_migrateDialog;
294extern wxString GetShipNameFromFile(
int);
296WX_DEFINE_ARRAY_PTR(
ChartCanvas*, arrayofCanvasPtr);
297extern arrayofCanvasPtr g_canvasArray;
300static int lang_list[] = {
301 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
302 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
303 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
304 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
305 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
306 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
307 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
308 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
310 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
311 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
312 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
313 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
314 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
315 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
323 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
324 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
325 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
326 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
327 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
328 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
329 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
330 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
331 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
332 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
333 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
334 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
335 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
336 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
337 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
338 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
339 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
340 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
341 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
342 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
343 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
344 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
345 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
346 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
347 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
350 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
351 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
352 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
353 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
354 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
356 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
357 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
358 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
359 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
360 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
361 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
362 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
363 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
364 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
365 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
366 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
367 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
368 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
369 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
370 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
371 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
372 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
373 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
374 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
376 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
377 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
378 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
379 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
380 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
381 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
382 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
383 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
384 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
385 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
386 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
387 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
388 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
392void prepareSlider(wxSlider* slider) {
393 slider->GetHandle()->setStyleSheet(
394 prepareAndroidSliderStyleSheet(slider->GetSize().x));
395 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
396 slider->GetHandle()->grabGesture(Qt::PanGesture);
397 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
402int wxCALLBACK SortConnectionOnPriority(wxIntPtr item1, wxIntPtr item2,
404 wxListCtrl* lc =
reinterpret_cast<wxListCtrl*
>(list);
407 it1.SetId(lc->FindItem(-1, item1));
409 it1.SetMask(it1.GetMask() | wxLIST_MASK_TEXT);
411 it2.SetId(lc->FindItem(-1, item2));
413 it2.SetMask(it2.GetMask() | wxLIST_MASK_TEXT);
419 return it1.GetText().CmpNoCase(it2.GetText());
421 return it2.GetText().CmpNoCase(it1.GetText());
434 wxString textMod = text;
435 textMod.Replace(
" ",
"^");
438 wxString sep = wxFileName::GetPathSeparator();
439 textMod.Replace(sep,
" ");
441 Wrap(win, textMod, widthMax);
444 for (
size_t i = 0; i < m_array.GetCount(); i++) {
445 wxString a = m_array[i];
447 if (m_array.GetCount() > 1) {
448 if (i < m_array.GetCount() - 1) a += sep;
454 wxString
const& GetWrapped()
const {
return m_wrapped; }
455 int const GetLineCount()
const {
return m_lineCount; }
456 wxArrayString GetLineArray() {
return m_array; }
459 virtual void OnOutputLine(
const wxString& line) {
463 virtual void OnNewLine() {
471 wxArrayString m_array;
480 void DoChartSelected();
481 void SetSelected(
bool selected);
482 void OnPaint(wxPaintEvent& event);
484 void OnSize(wxSizeEvent& event);
486 int GetUnselectedHeight() {
return m_unselectedHeight; }
487 int GetRefHeight() {
return m_refHeight; }
488 bool IsSelected() {
return m_bSelected; }
489 void OnClickDown(wxMouseEvent& event);
490 void OnClickUp(wxMouseEvent& event);
495 wxColour m_boxColour;
496 int m_unselectedHeight;
497 wxString m_pChartDir;
501 DECLARE_EVENT_TABLE()
505EVT_PAINT(OCPNChartDirPanel::OnPaint)
507EVT_SIZE(OCPNChartDirPanel::OnSize)
511 const wxPoint& pos, const wxSize& size,
513 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
514 m_pChartDir = cdi.fullpath;
517 if (cdi.fullpath.StartsWith(
518 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
519 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
524 m_refHeight = GetCharHeight();
526 m_unselectedHeight = 2 * m_refHeight;
532 SetMinSize(wxSize(-1, m_unselectedHeight));
534 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
537 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
542OCPNChartDirPanel::~OCPNChartDirPanel() {}
544static wxStopWatch swclick;
546static int downx, downy;
549void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
552 event.GetPosition(&downx, &downy);
558void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
560 qDebug() << swclick.Time();
561 if (swclick.Time() < 200) {
563 event.GetPosition(&upx, &upy);
564 if ((fabs(upx - downx) < GetCharWidth()) &&
565 (fabs(upy - downy) < GetCharWidth())) {
573void OCPNChartDirPanel::DoChartSelected() {
583void OCPNChartDirPanel::SetSelected(
bool selected) {
584 m_bSelected = selected;
588 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
591 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
596 g_pOptions->SetDirActionButtons();
603void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
604 if (m_pChartDir.Length()) {
606 GetClientSize(&x, &y);
609 wxArrayString nameWrapped = wrapper.GetLineArray();
611 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
617void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
619 GetSize(&width, &height);
622 dc.SetPen(*wxTRANSPARENT_PEN);
623 dc.SetBrush(wxBrush(GetBackgroundColour()));
624 dc.DrawRectangle(GetVirtualSize());
626 wxString nameString = m_pChartDir;
628 wxArrayString nameWrapped = wrapper.GetLineArray();
630 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
631 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
632 GetParent()->GetSizer()->Layout();
636 dc.SetBrush(wxBrush(m_boxColour));
638 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
640 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
642 int offset = height / 10;
643 int text_x = offset * 2;
645 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
648 dc.SetTextForeground(
649 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
651 int yd = height * 20 / 100;
652 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
654 dc.DrawText(nameWrapped[i], text_x, yd);
656 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
657 yd += GetCharHeight();
661 dc.SetBrush(wxBrush(m_boxColour));
664 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME),
667 int offset = height / 10;
668 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
669 height - (2 * offset), height / 10);
671 int text_x = offset * 2;
673 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
676 dc.SetTextForeground(
677 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
679 int yd = height * 20 / 100;
680 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
682 dc.DrawText(nameWrapped[i], text_x, yd);
684 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
685 yd += GetCharHeight();
693static bool LoadAllPlugIns(
bool load_enabled) {
694 g_Platform->ShowBusySpinner();
695 bool b = PluginLoader::GetInstance()->
LoadAllPlugIns(load_enabled);
696 g_Platform->HideBusySpinner();
700WX_DECLARE_LIST(wxCheckBox, CBList);
707 const wxPoint& pt = wxDefaultPosition,
708 const wxSize& sz = wxDefaultSize,
709 long style = wxHSCROLL | wxVSCROLL,
710 const wxString& name = _T(
"scrolledWindow")) {
711 Create(parent,
id, pt, sz, style, name);
714 bool Create(wxWindow* parent, wxWindowID
id = -1,
715 const wxPoint& pt = wxDefaultPosition,
716 const wxSize& sz = wxDefaultSize,
717 long style = wxHSCROLL | wxVSCROLL,
718 const wxString& name = _T(
"scrolledWindow"));
722 unsigned int Append(wxString& label,
bool benable =
true,
723 bool bsizerLayout =
true);
724 unsigned int GetCount() {
return m_list.GetCount(); }
729 void Check(
int index,
bool val);
730 bool IsChecked(
int index);
738#include <wx/listimpl.cpp>
739WX_DEFINE_LIST(CBList);
741bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
742 const wxPoint& pt,
const wxSize& sz,
743 long style,
const wxString& name) {
744 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
747 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
748 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
752 m_sizer =
new wxBoxSizer(wxVERTICAL);
758unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable,
760 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
762 cb->SetValue(!benable);
764 if (bsizerLayout) m_sizer->Layout();
768 return m_list.GetCount() - 1;
771void OCPNCheckedListCtrl::Check(
int index,
bool val) {
772 CBList::Node* node = m_list.Item(index);
773 wxCheckBox* cb = node->GetData();
775 if (cb) cb->SetValue(val);
778bool OCPNCheckedListCtrl::IsChecked(
int index) {
779 CBList::Node* node = m_list.Item(index);
780 wxCheckBox* cb = node->GetData();
783 return cb->GetValue();
788void OCPNCheckedListCtrl::RunLayout() { m_sizer->Layout(); }
790void OCPNCheckedListCtrl::Clear() {
791 WX_CLEAR_LIST(CBList, m_list);
796void appendOSDirSlash(wxString* pString);
798extern ArrayOfMmsiProperties g_MMSI_Props_Array;
805EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
806EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
810 const wxString& caption,
811 const wxPoint& pos, const wxSize& size,
813 : wxDialog(parent,
id, caption, pos, size,
814 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
816 GetSizer()->SetSizeHints(
this);
820ConfigCreateDialog::~ConfigCreateDialog(
void) {}
822void ConfigCreateDialog::CreateControls(
void) {
823 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
826 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
827 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
829 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
830 wxSize(40 * GetCharHeight(), -1), 0);
831 mainSizer->Add(m_TitleCtl, 0,
832 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
834 mainSizer->AddSpacer(2 * GetCharHeight());
836 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
837 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
840 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
841 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
842 mainSizer->Add(m_DescriptionCtl, 0,
843 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
845 mainSizer->AddSpacer(2 * GetCharHeight());
850 _(
"Create a private configuration template based on current settings.\n\
851This template will be saved, and may be selected for further use at any time.\n\
853 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
855 mainSizer->AddSpacer(2 * GetCharHeight());
857 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
858 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
860 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
861 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
863 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
864 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
865 m_OKButton->SetDefault();
868void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
869 EndModal(wxID_CANCEL);
872void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
873 const wxString& title = m_TitleCtl->GetValue();
874 const wxString& desc = m_DescriptionCtl->GetValue();
875 m_createdTemplateGUID =
876 ConfigMgr::Get().CreateNamedConfig(title, desc, _T(
""));
885EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
886EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
890 wxWindowID
id, const wxString& caption,
891 const wxPoint& pos, const wxSize& size,
893 : wxDialog(parent,
id, caption, pos, size,
894 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
897 GetSizer()->SetSizeHints(
this);
901MMSIEditDialog::~MMSIEditDialog(
void) {
delete m_MMSICtl; }
903void MMSIEditDialog::CreateControls(
void) {
904 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
907 wxStaticBox* mmsiBox =
908 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
910 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
911 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
913 wxStaticText* mmsiLabel =
new wxStaticText(
this, wxID_STATIC, _(
"MMSI"));
914 mmsiLabel->SetToolTip(
915 _(
"Maritime Mobile Service Identity - A unique 9-digit number assigned "
916 "to a vessel or navigation aid. Used to identify vessels and devices "
917 "in AIS transmissions and DSC calls."));
918 mmsiSizer->Add(mmsiLabel, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
920 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
921 wxDefaultPosition, wxSize(180, -1), 0);
922 m_MMSICtl->SetToolTip(
923 _(
"Enter the 9-digit MMSI number for this vessel or station"));
924 mmsiSizer->Add(m_MMSICtl, 0,
925 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
926 m_MMSICtl->Bind(wxEVT_TEXT, &MMSIEditDialog::OnMMSIChanged,
this);
928 wxStaticText* userLabelText =
new wxStaticText(
this, wxID_STATIC, _(
"Name"));
929 userLabelText->SetToolTip(
930 _(
"Display name for this vessel or device - can override names received "
932 mmsiSizer->Add(userLabelText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
934 m_ShipNameCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
935 wxDefaultPosition, wxSize(180, -1), 0);
936 m_ShipNameCtl->SetToolTip(_(
937 "Set the name for this vessel or device. If specified, this name takes "
938 "precedence over names received via AIS messages. Note that standard AIS "
939 "only supports uppercase letters (A-Z), numbers, and limited "
940 "punctuation. Your manual entries are stored in the mmsitoname.csv file "
941 "and preserved across sessions."));
942 mmsiSizer->Add(m_ShipNameCtl, 0,
943 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
945 wxStaticBox* trackBox =
new wxStaticBox(
this, wxID_ANY, _(
"Tracking"));
946 trackBox->SetToolTip(_(
"Control how tracks are created for this MMSI"));
947 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackBox, wxVERTICAL);
949 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
951 m_rbTypeTrackDefault =
952 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
953 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
954 m_rbTypeTrackDefault->SetToolTip(
955 _(
"Use the global tracking settings for this vessel"));
956 m_rbTypeTrackDefault->SetValue(TRUE);
957 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
959 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
960 m_rbTypeTrackAlways->SetToolTip(_(
961 "Always create a track for this vessel, regardless of global settings"));
962 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
964 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
965 m_rbTypeTrackNever->SetToolTip(
966 _(
"Never create a track for this vessel, regardless of global settings"));
967 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
969 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
970 m_cbTrackPersist->SetToolTip(
971 _(
"Save this vessel's track between OpenCPN sessions. Useful for vessels "
972 "you want to monitor continuously over time."));
973 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
975 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
976 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
978 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
979 m_IgnoreButton->SetToolTip(
980 _(
"When checked, AIS data for this MMSI will be ignored and the vessel "
981 "will not appear on the chart. Useful for suppressing shore stations, "
982 "permanently moored vessels, or duplicate AIS signals that you don't "
983 "need to monitor."));
984 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
986 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
987 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
988 m_MOBButton->SetToolTip(
989 _(
"When checked, OpenCPN will display a special icon for this device, "
990 "sound a distinctive alarm, and automatically create a temporary MOB "
991 "route from your vessel to this device in emergency. For crew safety "
992 "devices, you can assign the crew member's name using the Name "
993 "field above for quick identification."));
994 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
997 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
998 m_VDMButton->SetToolTip(
999 _(
"When checked, converts AIS messages for this vessel from AIVDM (other "
1000 "vessel) to AIVDO (own vessel) format."));
1001 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
1003 m_FollowerButton =
new wxCheckBox(
1004 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
1005 m_FollowerButton->SetToolTip(
1006 _(
"When checked, disables CPA (Closest Point of Approach) alerts for "
1007 "this vessel as it's considered intentionally following your vessel. "
1008 "Follower vessels are displayed with a special own-ship style icon."));
1009 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
1011 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
1012 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
1014 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
1015 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1017 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
1018 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1019 m_OKButton->SetDefault();
1023 if (m_props->MMSI > 0)
1024 sMMSI.Printf(_T(
"%d"), m_props->MMSI);
1027 m_MMSICtl->AppendText(sMMSI);
1030 if (!m_props->m_ShipName.IsEmpty()) {
1031 m_ShipNameCtl->SetValue(m_props->m_ShipName);
1034 switch (m_props->TrackType) {
1035 case TRACKTYPE_ALWAYS:
1036 m_rbTypeTrackAlways->SetValue(TRUE);
1038 case TRACKTYPE_NEVER:
1039 m_rbTypeTrackNever->SetValue(TRUE);
1045 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
1046 m_IgnoreButton->SetValue(m_props->m_bignore);
1047 m_MOBButton->SetValue(m_props->m_bMOB);
1048 m_VDMButton->SetValue(m_props->m_bVDM);
1049 m_FollowerButton->SetValue(m_props->m_bFollower);
1051 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1054void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1056void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
1057 EndModal(wxID_CANCEL);
1060void MMSIEditDialog::Persist() {
1062 if (m_rbTypeTrackDefault->GetValue())
1063 m_props->TrackType = TRACKTYPE_DEFAULT;
1064 else if (m_rbTypeTrackAlways->GetValue())
1065 m_props->TrackType = TRACKTYPE_ALWAYS;
1067 m_props->TrackType = TRACKTYPE_NEVER;
1069 m_props->m_bignore = m_IgnoreButton->GetValue();
1070 m_props->m_bMOB = m_MOBButton->GetValue();
1071 m_props->m_bVDM = m_VDMButton->GetValue();
1072 m_props->m_bFollower = m_FollowerButton->GetValue();
1073 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
1076 wxString shipName = m_ShipNameCtl->GetValue().Upper();
1077 if (!shipName.IsEmpty()) {
1078 m_props->m_ShipName = shipName;
1081 wxString mmsi = m_MMSICtl->GetValue();
1082 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1083 g_pAIS->UpdateMMSItoNameFile(mmsi, shipName);
1088 else if (m_props->m_ShipName == wxEmptyString) {
1089 auto proptarget = g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
1091 wxString s = proptarget->GetFullName();
1092 m_props->m_ShipName = s;
1094 wxString GetShipNameFromFile(
int);
1095 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
1101void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
1105 m_MMSICtl->GetValue().ToLong(&nmmsi);
1106 m_props->MMSI = nmmsi;
1109 if (m_MMSICtl->GetValue().Length() != 9) {
1112 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
1113 "your entries and cancel if necessary."),
1114 _(
"OpenCPN Info"), wxOK | wxCANCEL);
1116 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
1117 if (retcode == wxID_OK) {
1128void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
1130void MMSIEditDialog::OnMMSIChanged(wxCommandEvent& event) {
1131 wxString mmsi = m_MMSICtl->GetValue();
1134 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1136 wxString shipName = g_pAIS->GetMMSItoNameEntry(mmsi);
1139 if (shipName.IsEmpty()) {
1140 auto target = g_pAIS->Get_Target_Data_From_MMSI(wxAtoi(mmsi));
1142 shipName = target->GetFullName();
1147 if (!shipName.IsEmpty()) {
1148 m_ShipNameCtl->SetValue(shipName);
1156EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1157EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1158EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1159 MMSIListCtrl::OnListItemRightClick)
1160EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1161EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1165 const wxSize& size,
long style)
1166 : wxListCtrl(parent,
id, pos, size, style) {
1170MMSIListCtrl::~MMSIListCtrl(
void) {}
1172wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1176 if (!props)
return ret;
1179 if (props->MMSI > 0) ret = wxString::Format(_T(
"%d" ), props->MMSI);
1182 switch (props->TrackType) {
1183 case TRACKTYPE_DEFAULT:
1186 case TRACKTYPE_ALWAYS:
1189 case TRACKTYPE_NEVER:
1195 if (props->m_bPersistentTrack)
1196 ret.Append(_T(
", " )).Append(_(
"Persistent"));
1199 if (props->m_bignore) ret = _T(
"X" );
1202 if (props->m_bMOB) ret = _T(
"X" );
1205 if (props->m_bVDM) ret = _T(
"X" );
1208 if (props->m_bFollower) ret = _T(
"X");
1211 ret = props->m_ShipName;
1220void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1222void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1223 MmsiProperties* props = g_MMSI_Props_Array.Item(event.GetIndex());
1227 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1228 wxDefaultPosition, wxSize(200, 200));
1230 if (pd->ShowModal() == wxID_OK) {
1231 g_MMSI_Props_Array.RemoveAt(event.GetIndex());
1233 g_MMSI_Props_Array.Insert(props_new, event.GetIndex());
1240void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1241 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1242 if (m_context_item == wxNOT_FOUND)
return;
1243 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1244 wxMenuItem* item_edit =
1245 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") + _T(
"..."));
1246 menu->Append(item_edit);
1247 wxMenuItem* item_delete =
1248 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1249 menu->Append(item_delete);
1253 item_edit->SetFont(*qFont);
1254 item_delete->SetFont(*qFont);
1257 wxPoint p = ScreenToClient(wxGetMousePosition());
1258 PopupMenu(menu, p.x, p.y);
1260 SetItemCount(g_MMSI_Props_Array.GetCount());
1264void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1265 int context_item = m_context_item;
1270 switch (event.GetId()) {
1271 case ID_DEF_MENU_MMSI_EDIT: {
1274 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1275 wxDefaultPosition, wxSize(200, 200));
1277 if (pd->ShowModal() == wxID_OK) {
1278 g_MMSI_Props_Array.RemoveAt(context_item);
1280 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1281 g_MMSI_Props_Array.Insert(props_new, context_item);
1288 case ID_DEF_MENU_MMSI_DELETE:
1289 g_MMSI_Props_Array.RemoveAt(context_item);
1295MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1296 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1303 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1306 wxString MMSI_props_column_spec = _T(
"120;120;100;100;100;100;100;100");
1308 wxStringTokenizer tkz(MMSI_props_column_spec, _T(
";"));
1309 wxString s_width = tkz.GetNextToken();
1314 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1315 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1316 wxBORDER_SUNKEN | wxLC_VIRTUAL);
1324 int dx = GetCharWidth();
1327 if (s_width.ToLong(&lwidth)) {
1328 width = wxMax(dx * 2, lwidth);
1329 width = wxMin(width, dx * 13);
1331 m_pListCtrlMMSI->InsertColumn(tlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, width);
1333 s_width = tkz.GetNextToken();
1335 if (s_width.ToLong(&lwidth)) {
1336 width = wxMax(dx * 2, lwidth);
1337 width = wxMin(width, dx * 25);
1339 m_pListCtrlMMSI->InsertColumn(tlCLASS, _(
"Track Mode"), wxLIST_FORMAT_CENTER,
1342 s_width = tkz.GetNextToken();
1344 if (s_width.ToLong(&lwidth)) {
1345 width = wxMax(dx * 2, lwidth);
1346 width = wxMin(width, dx * 10);
1348 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1351 s_width = tkz.GetNextToken();
1353 if (s_width.ToLong(&lwidth)) {
1354 width = wxMax(dx * 2, lwidth);
1355 width = wxMin(width, dx * 10);
1357 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"MOB"), wxLIST_FORMAT_CENTER, width);
1359 s_width = tkz.GetNextToken();
1361 if (s_width.ToLong(&lwidth)) {
1362 width = wxMax(dx * 2, lwidth);
1363 width = wxMin(width, dx * 15);
1365 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1368 s_width = tkz.GetNextToken();
1370 if (s_width.ToLong(&lwidth)) {
1371 width = wxMax(dx * 2, lwidth);
1372 width = wxMin(width, dx * 30);
1374 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ship name"), wxLIST_FORMAT_CENTER,
1377 s_width = tkz.GetNextToken();
1379 if (s_width.ToLong(&lwidth)) {
1380 width = wxMax(dx * 2, lwidth);
1381 width = wxMin(width, dx * 10);
1383 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Follower"), wxLIST_FORMAT_CENTER,
1386 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1388 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1390 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1391 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1393 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1400 SetSize(GetSize().x, GetSize().y - 1);
1402 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1405MMSI_Props_Panel::~MMSI_Props_Panel(
void) {}
1407void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1411 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1412 wxDefaultPosition, wxSize(200, 200));
1415 pd->ShowWindowModalThenDo([
this, pd, props](
int retcode) {
1416 if (retcode == wxID_OK) {
1417 g_MMSI_Props_Array.Add(props);
1425void MMSI_Props_Panel::UpdateMMSIList(
void) {
1427 long selItemID = wxNOT_FOUND;
1428 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1429 wxLIST_STATE_SELECTED);
1431 int selMMSI = wxNOT_FOUND;
1432 if (selItemID != wxNOT_FOUND) selMMSI = g_MMSI_Props_Array[selItemID]->MMSI;
1434 m_pListCtrlMMSI->SetItemCount(g_MMSI_Props_Array.GetCount());
1437 long item_sel = wxNOT_FOUND;
1438 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1439 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
1440 if (g_MMSI_Props_Array[i]->MMSI == selMMSI) {
1447 if (g_MMSI_Props_Array.GetCount() > 0)
1448 m_pListCtrlMMSI->SetItemState(item_sel,
1449 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1450 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1453 m_pListCtrlMMSI->Refresh(FALSE);
1457void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1467 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value = _T(
""),
1468 const wxPoint& pos = wxDefaultPosition,
1469 const wxSize& size = wxDefaultSize,
int n = 0,
1470 const wxString choices[] = NULL,
long style = 0,
1471 const wxValidator& validator = wxDefaultValidator,
1472 const wxString& name = _T(
"OCPNFatCombo"));
1476 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1477 wxCoord OnMeasureItem(
size_t item)
const;
1478 wxCoord OnMeasureItemWidth(
size_t item)
const;
1479 bool SetFont(
const wxFont& font);
1481 int Append(
const wxString& item, wxBitmap bmp);
1484 const wxFont* dfont;
1488 ArrayOfBitmaps bmpArray;
1491OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1493OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1494 const wxString& value,
const wxPoint& pos,
1495 const wxSize& size,
int n,
const wxString choices[],
1496 long style,
const wxValidator& validator,
1497 const wxString& name)
1498 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1501 GetFont().GetPointSize() / g_Platform->getFontPointsperPixel();
1502 itemHeight = (int)wxRound(fontHeight);
1503 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1506OCPNFatCombo::~OCPNFatCombo() {}
1508bool OCPNFatCombo::SetFont(
const wxFont& font) {
1513void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1520 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1521 wxBrush br = wxBrush(bg);
1522 wxBrush sv = dc.GetBrush();
1524 dc.DrawRectangle(0, 0, rect.width, rect.height);
1526 dc.SetTextForeground(wxColour(0, 0, 0));
1528 if (flags & wxODCB_PAINTING_CONTROL) {
1529 wxString text = GetValue();
1531 dc.DrawText(text, rect.x + margin_x + offset_x,
1532 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1534 dc.SetBackground(wxBrush(br));
1536 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1537 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1541wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1542 if (item < bmpArray.GetCount())
1543 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1545 return itemHeight * 12 / 10;
1548wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1550int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1552 int idx = wxOwnerDrawnComboBox::Append(item);
1557void OCPNFatCombo::Clear(
void) {
1558 wxOwnerDrawnComboBox::Clear();
1562BEGIN_EVENT_TABLE(
options, wxDialog)
1563EVT_INIT_DIALOG(options::OnDialogInit)
1564EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1565EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1566EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1567EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1568EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1569EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1570EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1571EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1572EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1573EVT_BUTTON(xID_OK, options::OnXidOkClick)
1574EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1575EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1576EVT_BUTTON(ID_BUTTONFONT_RESET, options::OnResetFont)
1577EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1579EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1580EVT_CLOSE(options::OnClose)
1582#if defined(__WXGTK__) || defined(__WXQT__)
1583EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1586EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1588EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1589EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1590EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1591EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1592EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1593EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1594EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1595EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1596EVT_CHAR_HOOK(options::OnCharHook)
1600options::
options(wxWindow* parent, wxWindowID
id, const wxString& caption,
1601 const wxPoint& pos, const wxSize& size,
long style)
1602 : pTrackRotateTime(0) {
1607 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1609 wxDialog::Create(parent,
id, caption, pos, size, style,
"Options");
1610 SetFont(*dialogFont);
1613 RecalculateSize(size.x, size.y);
1615 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1617 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1618 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1620 m_pPlugInCtrl->ReloadPluginPanels();
1622 auto action = [&](wxCommandEvent& evt) {
1623 g_persist_active_route = m_persist_active_route_chkbox->IsChecked();
1625 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1626 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1629options::~options(
void) {
1631 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1633 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1634 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1637 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1639 delete m_pSerialArray;
1640 delete m_pGroupArray;
1641 delete m_topImgList;
1645 delete m_pPlugInCtrl;
1646 if (g_pi_manager) g_pi_manager->SetListPanelPtr(NULL);
1648 delete m_PluginCatalogMgrPanel;
1653bool options::SendIdleEvents(wxIdleEvent& event) {
1654 if (IsShown())
return wxDialog::SendIdleEvents(event);
1658void options::RecalculateSize(
int hint_x,
int hint_y) {
1660 m_nCharWidthMax = GetSize().x / GetCharWidth();
1664 if ((hint_x < 200) || (hint_y < 200)) {
1666 int display_width, display_height;
1667 display_width = g_monitor_info[g_current_monitor].width;
1668 display_height = g_monitor_info[g_current_monitor].height;
1670 if (display_height < 600) {
1673 vectorPanel->SetSizeHints(ps57Ctl);
1683 esize.x = GetCharWidth() * 110;
1684 esize.y = GetCharHeight() * 40;
1686 wxSize dsize = GetParent()->GetSize();
1687 esize.y = wxMin(esize.y, dsize.y - 0 );
1688 esize.x = wxMin(esize.x, dsize.x - 0 );
1691 wxSize fsize = GetSize();
1692 wxSize canvas_size = GetParent()->GetSize();
1693 wxPoint screen_pos = GetParent()->GetScreenPosition();
1694 int xp = (canvas_size.x - fsize.x) / 2;
1695 int yp = (canvas_size.y - fsize.y) / 2;
1696 Move(screen_pos.x + xp, screen_pos.y + yp);
1698 m_nCharWidthMax = GetSize().x / GetCharWidth();
1701void options::Init(
void) {
1702 m_pWorkDirList = NULL;
1704 pShowStatusBar = NULL;
1705 pShowMenuBar = NULL;
1706 pShowCompassWin = NULL;
1709 m_scrollWinChartList = NULL;
1710 ps57CtlListBox = NULL;
1712 m_pSerialArray = NULL;
1713 pUpdateCheckBox = NULL;
1714 pParseENCButton = NULL;
1721 pSoundDeviceIndex = NULL;
1725 pCBLookAhead = NULL;
1726 pCDOQuilting = NULL;
1727 pPreserveScale = NULL;
1728 pSmoothPanZoom = NULL;
1729 pEnableZoomToCursor = NULL;
1730 pSDisplayGrid = NULL;
1731 pCDOOutlines = NULL;
1732 pSDepthUnits = NULL;
1734 pSDefaultBoatSpeed = NULL;
1737 itemActiveChartStaticBox = NULL;
1739 pCheck_SOUNDG = NULL;
1741 pCheck_SHOWIMPTEXT = NULL;
1742 pCheck_SCAMIN = NULL;
1743 pCheck_ATONTEXT = NULL;
1744 pCheck_LDISTEXT = NULL;
1745 pCheck_XLSECTTEXT = NULL;
1747 m_bVisitLang = FALSE;
1748 m_itemFontElementListBox = NULL;
1749 m_textSample = NULL;
1750 m_topImgList = NULL;
1753 m_pGroupArray = NULL;
1754 m_groups_changed = 0;
1757 m_pageConnections = -1;
1762 m_pageConnections = -1;
1764 auto loader = PluginLoader::GetInstance();
1765 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
1766 b_oldhaveWMM = b_haveWMM;
1771 m_bForceNewToolbaronCancel =
false;
1773 m_cs = (ColorScheme)0;
1776 m_pPlugInCtrl = NULL;
1777 m_PluginCatalogMgrPanel = NULL;
1791 m_bVectorInit =
false;
1796 pCmdSoundString = NULL;
1798 m_sconfigSelect_single = NULL;
1799 m_sconfigSelect_twovertical = NULL;
1802 dc.SetFont(*dialogFont);
1804 dc.GetTextExtent(_T(
"H"), &width, &height, NULL, NULL, dialogFont);
1806 m_colourPickerDefaultSize =
1820 auto sound =
static_cast<OcpnSound*
>(ev.GetClientData());
1826#if defined(__GNUC__) && __GNUC__ < 8
1829static const wxString BAD_ACCESS_MSG = _(
1830 "The device selected is not accessible; opencpn will likely not be able\n"
1831 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1832 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1833 "with the following contents:\n\n"
1834 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1835 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1836 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1837 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1841static const wxString BAD_ACCESS_MSG = _(R
"(
1842The device selected is not accessible; opencpn will likely not be able
1843to use this device as-is. You might want to exit OpenCPN, reboot and
1844retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1845with the following contents:
1847 KERNEL=="ttyUSB*", MODE="0666"
1848 KERNEL=="ttyACM*", MODE="0666"
1849 KERNEL=="ttyS*", MODE="0666"
1851For more info, see the file LINUX_DEVICES.md in the distribution docs.
1856void options::OnDialogInit(wxInitDialogEvent& event) {}
1858void options::CheckDeviceAccess( wxString& path) {}
1860size_t options::CreatePanel(
const wxString& title) {
1861 size_t id = m_pListbook->GetPageCount();
1864 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1865 wxDefaultSize, wxTAB_TRAVERSAL, title);
1866 m_pListbook->AddPage(panel, title, FALSE,
id);
1870wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1871 if (parent > m_pListbook->GetPageCount() - 1) {
1874 _T(
"Warning: invalid parent in options::AddPage( %d, "), parent) +
1878 wxNotebookPage* page = m_pListbook->GetPage(parent);
1880 wxScrolledWindow* sw;
1882 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1883 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1884 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1886 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1887 nb->AddPage(sw, title);
1888 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1889 wxString toptitle = m_pListbook->GetPageText(parent);
1890 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1891 wxDefaultSize, wxNB_TOP);
1894 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1895 m_pListbook->SetSelection(0);
1896 m_pListbook->RemovePage(parent + 1);
1897 wxString previoustitle = page->GetName();
1899 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1900 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1902 nb->AddPage(page, previoustitle);
1906 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1908 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1909 nb->AddPage(sw, title);
1910 nb->ChangeSelection(0);
1912 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1913 wxDefaultSize, style, title);
1914 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1915 wxString toptitle = m_pListbook->GetPageText(parent);
1916 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1917 m_pListbook->SetSelection(0);
1918 m_pListbook->DeletePage(parent + 1);
1922 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1928bool options::DeletePluginPage(wxScrolledWindow* page) {
1929 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1930 wxNotebookPage* pg = m_pListbook->GetPage(i);
1931 auto nb =
dynamic_cast<wxNotebook*
>(pg);
1934 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1935 wxNotebookPage* spg = nb->GetPage(j);
1938 if (nb->GetPageCount() != 1)
return TRUE;
1940 spg = nb->GetPage(0);
1941 spg->Reparent(m_pListbook);
1943 wxString toptitle = m_pListbook->GetPageText(i);
1944 m_pListbook->DeletePage(i);
1945 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1949 }
else if (pg == page) {
1951 m_pListbook->DeletePage(i);
1952 wxPanel* panel =
new wxPanel(m_pListbook);
1953 wxString toptitle = m_pListbook->GetPageText(i);
1954 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1961void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1962 int group_item_spacing) {
1963 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1966 std::make_shared<ConnectionsDlg>(m_pNMEAForm, TheConnectionParams());
1969 Bind(wxEVT_SIZE, [&](wxSizeEvent& ev) {
1970 auto w = m_pListbook->GetCurrentPage();
1971 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
1976void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1977 int group_item_spacing) {
1978 itemPanelShip = AddPage(parent, _(
"Own ship"));
1980 ownShip =
new wxBoxSizer(wxVERTICAL);
1981 itemPanelShip->SetSizer(ownShip);
1984 wxStaticBox* osdBox =
1985 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1986 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1987 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1989 wxFlexGridSizer* dispOptionsGrid =
1990 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1991 dispOptionsGrid->AddGrowableCol(1);
1992 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1994 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1995 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1996 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1998 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1999 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
2001 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
2002 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
2003 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
2005 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
2006 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
2008 wxStaticText* iconTypeTxt =
2009 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
2010 dispOptionsGrid->Add(iconTypeTxt, 0);
2012 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
2013 _(
"Real Scale Vector")};
2015 m_pShipIconType =
new wxChoice(
2016 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
2017 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
2018 dispOptionsGrid->Add(m_pShipIconType, 0,
2019 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
2020 group_item_spacing);
2022 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
2023 realSizes->AddGrowableCol(1);
2025 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
2028 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
2030 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
2031 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2034 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
2036 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2037 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2040 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
2042 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2043 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2045 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
2046 _(
"GPS Offset from Midship (m)")),
2048 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2049 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2052 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
2054 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2055 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2058 wxFlexGridSizer* rrSelect =
2059 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2060 rrSelect->AddGrowableCol(1);
2061 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2063 wxStaticText* rrTxt =
2064 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
2065 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2067 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
2068 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
2069 _T(
"8" ), _T(
"9" ), _T(
"10" )};
2070 pNavAidRadarRingsNumberVisible =
2071 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
2072 m_pShipIconType->GetSize(), 11, rrAlt);
2073 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
2074 group_item_spacing);
2076 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2077 radarGrid->AddGrowableCol(1);
2078 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
2080 wxStaticText* distanceText =
2081 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
2082 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
2084 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL, _T(
""),
2085 wxDefaultPosition, wxSize(100, -1), 0);
2086 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
2087 group_item_spacing);
2089 wxStaticText* unitText =
2090 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
2091 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
2093 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"),
2094 _(
"Minutes (time)")};
2095 m_itemRadarRingsUnits =
2096 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
2097 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
2098 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2100 wxStaticText* colourText =
2101 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Color"));
2102 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2105 itemPanelShip, wxID_ANY, *wxRED, wxDefaultPosition,
2106 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2107 _T(
"ID_COLOUROSRANGECOLOUR" ));
2108 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2111 wxFlexGridSizer* shipToActiveGrid =
2112 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2113 shipToActiveGrid->AddGrowableCol(1);
2114 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2115 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2116 _(
"Show direction to Active Waypoint"));
2117 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2120 wxStaticText* shipToActiveText1 =
2121 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2122 shipToActiveGrid->Add(shipToActiveText1, 1,
2123 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2125 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
2126 _(
"Long dash"), _(
"Short dash")};
2127 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2128 m_shipToActiveStyle =
2129 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2130 LineStyleNChoices, LineStyleChoices, 0);
2131 m_shipToActiveStyle->SetSelection(0);
2132 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2134 wxStaticText* shipToActiveText2 =
2135 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2136 shipToActiveGrid->Add(shipToActiveText2, 1,
2137 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2139 wxString m_LineColorChoices[] = {
2140 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2141 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2142 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2143 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2145 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2146 m_shipToActiveColor =
2147 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2148 LineColorNChoices, m_LineColorChoices, 0);
2149 m_shipToActiveColor->SetSelection(0);
2150 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2153 wxStaticBox* shipdata =
2154 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Ship's identifier"));
2155 wxStaticBoxSizer* datasizer =
new wxStaticBoxSizer(shipdata, wxVERTICAL);
2156 ownShip->Add(datasizer, 0, wxGROW | wxALL, border_size);
2158 wxFlexGridSizer* ownmmsisizer =
2159 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2160 ownmmsisizer->AddGrowableCol(1);
2161 datasizer->Add(ownmmsisizer, 0, wxALL | wxEXPAND, border_size);
2165 wxStaticText* pStatic_ownshipmmsi =
2166 new wxStaticText(itemPanelShip, wxID_ANY,
2167 _(
"Own ship's MMSI. (If available) Nine digits"));
2168 ownmmsisizer->Add(pStatic_ownshipmmsi, 0);
2171 const wxString AllowDigits[] = {
"0",
"1",
"2",
"3",
"4",
2172 "5",
"6",
"7",
"8",
"9"};
2173 wxArrayString ArrayAllowDigits(10, AllowDigits);
2174 wxTextValidator mmsiVal(wxFILTER_INCLUDE_CHAR_LIST);
2175 mmsiVal.SetIncludes(ArrayAllowDigits);
2176 m_pTxt_OwnMMSI =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"",
2177 wxDefaultPosition, wxDefaultSize, 0, mmsiVal);
2178 ownmmsisizer->Add(m_pTxt_OwnMMSI, 0, wxALIGN_RIGHT);
2181 wxStaticBox* trackText =
2182 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2183 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2184 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2185 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2187 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2188 _(
"Automatic Daily Tracks at midnight"));
2190 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2193 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2195#if wxUSE_TIMEPICKCTRL
2196 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2199 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2200 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2201 wxDefaultPosition, wxDefaultSize, 0);
2204 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2205 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2206 wxDefaultPosition, wxDefaultSize, 0);
2208 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2212 pTrackRotateComputerTime =
2213 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2214 wxDefaultPosition, wxDefaultSize, 0);
2215 trackSizer1->Add(pTrackRotateComputerTime, 0,
2216 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2219 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2220 wxDefaultPosition, wxDefaultSize, 0);
2221 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2225 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2226 wxDefaultPosition, wxDefaultSize, 0);
2227 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2230 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2232 wxFlexGridSizer* hTrackGrid =
2233 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2234 hTrackGrid->AddGrowableCol(1);
2235 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2238 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2239 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2241 wxStaticText* trackColourText =
2242 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Color"));
2243 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2246 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2247 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2248 _T(
"ID_COLOURTRACKCOLOUR" ));
2249 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2251 wxFlexGridSizer* pTrackGrid =
2252 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2253 pTrackGrid->AddGrowableCol(1);
2254 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2256 wxStaticText* tpText =
2257 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2258 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2260 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2261 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2262 m_pShipIconType->GetSize(), 3, trackAlt);
2263 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2264 group_item_spacing);
2267 wxStaticBox* ownshipcalcText =
2268 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Calculate values"));
2269 wxStaticBoxSizer* ownshipcalcSizer =
2270 new wxStaticBoxSizer(ownshipcalcText, wxVERTICAL);
2271 ownShip->Add(ownshipcalcSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2273 wxFlexGridSizer* dispOwnShipCalcOptionsGrid =
2274 new wxFlexGridSizer(2, 2, group_item_spacing, group_item_spacing);
2275 ownshipcalcSizer->Add(dispOwnShipCalcOptionsGrid, 0, wxTOP | wxALL | wxEXPAND,
2278 dispOwnShipCalcOptionsGrid->AddGrowableCol(1);
2280 pSogCogFromLLCheckBox =
2281 new wxCheckBox(itemPanelShip, ID_SOGCOGFROMLLCHECKBOX,
2282 _(
"Calculate SOG and COG from position changes"));
2283 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLCheckBox, 1, wxALL, 5);
2284 dispOwnShipCalcOptionsGrid->AddSpacer(0);
2286 wxStaticText* SogCogFromLLDampIntText =
new wxStaticText(
2287 itemPanelShip, wxID_STATIC, _(
"Min seconds between updates"));
2288 dispOwnShipCalcOptionsGrid->Add(SogCogFromLLDampIntText, 1, wxEXPAND | wxALL,
2289 group_item_spacing);
2291 pSogCogFromLLDampInterval =
new wxSpinCtrl(
2292 itemPanelShip, ID_SOGCOGDAMPINTTEXTCTRL, wxEmptyString, wxDefaultPosition,
2293 wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0);
2295 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLDampInterval, 0,
2296 wxALIGN_RIGHT | wxALL, group_item_spacing);
2299void options::CreatePanel_Routes(
size_t parent,
int border_size,
2300 int group_item_spacing) {
2301 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2303 Routes =
new wxBoxSizer(wxVERTICAL);
2304 itemPanelRoutes->SetSizer(Routes);
2306 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2308 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
2309 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
2310 _T(
"8" ), _T(
"9" ), _T(
"10" )};
2313 wxStaticBox* routeText =
2314 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2315 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2316 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2318 wxStaticBox* activeRouteText =
2319 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2320 wxStaticBoxSizer* activeRouteSizer =
2321 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2323 m_persist_active_route_chkbox =
new wxCheckBox(
2324 itemPanelRoutes, wxID_ANY,
2325 _(
"Persist active route, automatically activate on start up"));
2326 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2327 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2329 routeSizer->AddSpacer(5);
2332 wxFlexGridSizer* routepointiconSelect =
2333 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2334 routepointiconSelect->AddGrowableCol(1);
2335 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2338 wxStaticText* routepointiconTxt =
2339 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2340 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2341 group_item_spacing);
2344 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2345 0, NULL, wxCB_READONLY);
2346 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2347 wxALIGN_RIGHT | wxALL, group_item_spacing);
2349 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2352 int min_size = GetCharHeight() * 2;
2353 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2354 pRoutepointDefaultIconChoice->SetMinSize(
2355 wxSize(GetCharHeight() * 15, min_size));
2357 routeSizer->AddSpacer(5);
2359 wxFlexGridSizer* pRouteGrid =
2360 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2361 pRouteGrid->AddGrowableCol(1);
2362 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2364 wxStaticText* raText =
new wxStaticText(
2365 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Arrival Circle Radius (NMi)"));
2366 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2368 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2369 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2370 group_item_spacing);
2372 pAdvanceRouteWaypointOnArrivalOnly =
2373 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2374 _(
"Advance route waypoint on arrival only"));
2375 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2378 Routes->AddSpacer(8 * group_item_spacing);
2380 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2381 wxDefaultSize, wxLI_HORIZONTAL);
2382 Routes->Add(pln, 0, wxEXPAND);
2386 wxStaticBox* waypointText =
2387 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2388 wxStaticBoxSizer* waypointSizer =
2389 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2390 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2392 waypointSizer->AddSpacer(5);
2395 wxFlexGridSizer* waypointiconSelect =
2396 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2397 waypointiconSelect->AddGrowableCol(1);
2398 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2401 wxStaticText* waypointiconTxt =
2402 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2403 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2404 group_item_spacing);
2407 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2408 0, NULL, wxCB_READONLY);
2409 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2410 group_item_spacing);
2412 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2415 int rmin_size = GetCharHeight() * 2;
2416 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2417 pWaypointDefaultIconChoice->SetMinSize(
2418 wxSize(GetCharHeight() * 15, rmin_size));
2420 waypointSizer->AddSpacer(5);
2422 wxFlexGridSizer* ScaMinSizer =
2423 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2424 ScaMinSizer->AddGrowableCol(1);
2425 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2427 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2428 _(
"Show marks only at a chartscale greater than 1 :"));
2429 ScaMinSizer->Add(pScaMinChckB, 0);
2430 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2431 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2432 group_item_spacing);
2435 pScaMinOverruleChckB =
2436 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2437 _(
"Override the settings for chartscale based visibility "
2438 "and show always"));
2439 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2441 waypointSizer->AddSpacer(5);
2443 wxFlexGridSizer* waypointrrSelect =
2444 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2445 waypointrrSelect->AddGrowableCol(1);
2446 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2449 wxStaticText* waypointrrTxt =
2450 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2451 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2453 pWaypointRangeRingsNumber =
2454 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2455 m_pShipIconType->GetSize(), 11, rrAlt);
2456 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2457 group_item_spacing);
2460 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2461 waypointradarGrid->AddGrowableCol(1);
2462 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2464 wxStaticText* waypointdistanceText =
new wxStaticText(
2465 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2466 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2467 group_item_spacing);
2469 pWaypointRangeRingsStep =
2470 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
2471 wxSize(100, -1), 0);
2472 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2473 group_item_spacing);
2475 wxStaticText* waypointunitText =
2476 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2477 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2478 group_item_spacing);
2480 m_itemWaypointRangeRingsUnits =
2481 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2482 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2483 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2484 wxALIGN_RIGHT | wxALL, border_size);
2486 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2487 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colors"));
2488 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2491 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2492 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2493 _T(
"ID_COLOURWAYPOINTRANGERINGSCOLOUR" ));
2494 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2495 wxALIGN_RIGHT | wxALL, 1);
2500 Routes->AddSpacer(8 * group_item_spacing);
2501 wxStaticLine* pln1 =
2502 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2503 wxDefaultSize, wxLI_HORIZONTAL);
2504 Routes->Add(pln1, 0, wxEXPAND);
2507 wxStaticBox* waypointControl =
2508 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2509 wxStaticBoxSizer* ControlSizer =
2510 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2511 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2513 ControlSizer->AddSpacer(5);
2515 pWayPointPreventDragging =
new wxCheckBox(
2516 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2517 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2518 pWayPointPreventDragging->SetValue(FALSE);
2519 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2521 pConfirmObjectDeletion =
2522 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2523 _(
"Confirm deletion of tracks and routes"));
2524 pConfirmObjectDeletion->SetValue(FALSE);
2525 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2526 ControlSizer->AddSpacer(5);
2529 pWaypointDefaultIconChoice->Clear();
2531 bool fillCombo =
true;
2534 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2535 wxString* ps = pWayPointMan->GetIconDescription(i);
2536 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2538 pWaypointDefaultIconChoice->Append(*ps, bmp);
2543 int iconToSelect = -1;
2544 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2545 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2547 pWaypointDefaultIconChoice->Select(iconToSelect);
2553 pRoutepointDefaultIconChoice->Clear();
2558 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2559 wxString* ps = pWayPointMan->GetIconDescription(i);
2560 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2562 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2568 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2569 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2571 pRoutepointDefaultIconChoice->Select(iconToSelect);
2579void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2580 int group_item_spacing) {
2581 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2583 chartPanel =
new wxBoxSizer(wxVERTICAL);
2584 chartPanelWin->SetSizer(chartPanel);
2586 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2587 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2588 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2590 m_scrollWinChartList =
new wxScrolledWindow(
2591 chartPanelWin, wxID_ANY, wxDefaultPosition,
2592 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2594 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2601 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2603 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2604 m_scrollWinChartList->SetSizer(boxSizerCharts);
2606 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2607 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2609 wxString b1 = _(
"Add Directory...");
2610 wxString b2 = _(
"Remove Selected");
2611 wxString b3 = _(
"Compress Selected");
2619 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2620 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2622 cmdButtonSizer->AddSpacer(GetCharHeight());
2624 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2625 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2626 m_removeBtn->Disable();
2628 cmdButtonSizer->AddSpacer(GetCharHeight());
2631 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2632 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2633 m_compressBtn->Disable();
2635 m_compressBtn = NULL;
2639 if (g_Android_SDK_Version >= 30) {
2641 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2642 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2646 cmdButtonSizer->AddSpacer(GetCharHeight());
2648 wxStaticBox* itemStaticBoxUpdateStatic =
2649 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2650 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2651 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2652 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2654 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2655 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2657 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2658 _(
"Scan Charts and Update Database"));
2659 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2661 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2662 _(
"Force Full Database Rebuild"));
2663 itemFlexGridSizerUpdate->Add(pUpdateCheckBox, 1, wxALL, 5);
2665 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2666 _(
"Prepare all ENC Charts"));
2667 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2669 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2672 ActiveChartArray.Clear();
2673 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2674 ActiveChartArray.Add(m_CurrentDirList[i]);
2677 UpdateChartDirList();
2679 chartPanel->Layout();
2682void options::UpdateChartDirList() {
2684 m_scrollWinChartList->GetSizer()->Clear(
true);
2685 m_scrollWinChartList->ClearBackground();
2687 panelVector.clear();
2690 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2693 wxSize(-1, -1), ActiveChartArray[i]);
2694 chartPanel->SetSelected(
false);
2696 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2698 panelVector.push_back(chartPanel);
2701 m_scrollWinChartList->GetSizer()->Layout();
2703 chartPanelWin->ClearBackground();
2704 chartPanelWin->Layout();
2713 wxSize sza = GetSize();
2718 m_scrollWinChartList->GetParent()->Layout();
2721 m_scrollWinChartList->Scroll(0, 0);
2724void options::UpdateTemplateTitleText() {
2725 if (!m_templateTitleText)
return;
2727 wxString activeTitle;
2728 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2729 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2731 bool configCompare =
2732 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2733 if (!configCompare) activeTitle += _(
" [Modified]");
2734 m_templateTitleText->SetLabel(activeTitle);
2736 m_templateTitleText->SetLabel(_(
"None"));
2739void options::CreatePanel_Configs(
size_t parent,
int border_size,
2740 int group_item_spacing) {
2741 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2747 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2748 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2752 wxStaticBox* templateStatusBox =
2753 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2754 m_templateStatusBoxSizer =
2755 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2756 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2759 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2760 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2762 m_staticTextLastAppled =
new wxStaticText(
2763 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2764 m_staticTextLastAppled->Hide();
2766 statSizer->Add(m_staticTextLastAppled);
2768 m_templateTitleText =
2769 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2770 statSizer->Add(m_templateTitleText);
2771 m_templateTitleText->Hide();
2773 UpdateTemplateTitleText();
2775 wxStaticBox* configsBox =
2776 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2777 wxStaticBoxSizer* configSizer =
2778 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2779 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2781 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2782 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2784 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2785 cPanel->SetSizer(boxSizercPanel);
2787 m_scrollWinConfigList =
2788 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2789 wxBORDER_RAISED | wxVSCROLL);
2790 m_scrollWinConfigList->SetScrollRate(1, 1);
2791 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2793 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2795 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2796 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2798 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2799 configSizer->Add(btnSizer);
2802 wxButton* createButton =
2803 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2804 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2805 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2806 wxCommandEventHandler(options::OnCreateConfig), NULL,
2814 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2815 _(
"Delete Selected Config..."));
2816 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2817 group_item_spacing);
2818 m_configDeleteButton->Connect(
2819 wxEVT_COMMAND_BUTTON_CLICKED,
2820 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2822 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2823 _(
"Apply Selected Config"));
2824 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2825 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2826 wxCommandEventHandler(options::OnApplyConfig),
2833 SetConfigButtonState();
2837void options::ClearConfigList() {
2838 if (m_scrollWinConfigList) {
2839 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2840 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2841 wxWindowListNode* node = kids.Item(i);
2842 wxWindow* win = node->GetData();
2843 auto pcp =
dynamic_cast<wxPanel*
>(win);
2852 SetConfigButtonState();
2855void options::BuildConfigList() {
2856 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2858 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2860 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2862 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2863 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2864 pp->Connect(wxEVT_LEFT_DOWN,
2865 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2869 wxWindowList kids = pp->GetChildren();
2870 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2871 wxWindowListNode* node = kids.Item(i);
2872 wxWindow* win = node->GetData();
2873 win->Connect(wxEVT_LEFT_DOWN,
2874 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2880 m_boxSizerConfigs->Layout();
2882 m_selectedConfigPanelGUID = _T(
"");
2883 SetConfigButtonState();
2886void options::SetConfigButtonState() {
2887 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2888 if (m_selectedConfigPanelGUID.StartsWith(
2890 m_configDeleteButton->Disable();
2891 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2894void options::OnCreateConfig(wxCommandEvent& event) {
2896 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2898 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2899 if (retcode == wxID_OK) {
2900 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2901 UpdateTemplateTitleText();
2905 m_DisplayConfigsPage->Layout();
2907 SetConfigButtonState();
2911void options::OnEditConfig(wxCommandEvent& event) {}
2913void options::OnDeleteConfig(wxCommandEvent& event) {
2914 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2916 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2917 m_selectedConfigPanelGUID = _T(
"");
2922 m_DisplayConfigsPage->Layout();
2923 SetConfigButtonState();
2926void options::OnApplyConfig(wxCommandEvent& event) {
2927 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2930 wxString currentLocale = g_locale;
2934 evt.SetId(ID_APPLY);
2938 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2942 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2943 wxString activeTitle =
2944 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2945 m_templateTitleText->SetLabel(activeTitle);
2946 m_templateTitleText->Show();
2947 m_staticTextLastAppled->Show();
2948 m_templateStatusBoxSizer->Layout();
2950 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2951 _(
"OpenCPN Info"), wxOK);
2954 if (m_scrollWinConfigList) {
2955 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2956 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2957 wxWindowListNode* node = kids.Item(i);
2958 wxWindow* win = node->GetData();
2959 auto pcp =
dynamic_cast<wxPanel*
>(win);
2963 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2968 m_selectedConfigPanelGUID = wxEmptyString;
2970 m_returnChanges |= CONFIG_CHANGED;
2972 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2977void options::OnConfigMouseSelected(wxMouseEvent& event) {
2978 wxPanel* selectedPanel = NULL;
2979 wxObject* obj =
event.GetEventObject();
2981 auto panel =
dynamic_cast<wxPanel*
>(obj);
2983 selectedPanel = panel;
2987 auto win =
dynamic_cast<wxWindow*
>(obj);
2989 auto parentpanel =
dynamic_cast<wxPanel*
>(win->GetParent());
2991 selectedPanel = parentpanel;
2996 if (m_scrollWinConfigList) {
2997 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2998 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2999 wxWindowListNode* node = kids.Item(i);
3000 wxWindow* win = node->GetData();
3001 auto panel =
dynamic_cast<wxPanel*
>(win);
3003 if (panel == selectedPanel) {
3004 panel->SetBackgroundColour(wxSystemSettings::GetColour(
3005 wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
3007 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
3009 panel->SetBackgroundColour(m_panelBackgroundUnselected);
3011 panel->Refresh(
true);
3015 m_DisplayConfigsPage->Layout();
3016 SetConfigButtonState();
3020void options::CreatePanel_Advanced(
size_t parent,
int border_size,
3021 int group_item_spacing) {
3022 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
3026 double dpmm = g_Platform->GetDisplayDPmm();
3028 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3029 m_ChartDisplayPage->SetSizer(wrapperSizer);
3031 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
3034 itemBoxSizerUI->Add(0, border_size * 3);
3035 itemBoxSizerUI->Add(0, border_size * 3);
3038 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3039 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3041 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3042 _(
"De-skew Raster Charts"));
3043 boxCharts->Add(pSkewComp, inputFlags);
3045 itemBoxSizerUI->Add(0, border_size * 3);
3046 itemBoxSizerUI->Add(0, border_size * 3);
3050 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
3051 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3053 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3054 _(
"Use Accelerated Graphics (OpenGL)"));
3055 OpenGLSizer->Add(pOpenGL, inputFlags);
3056 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3058 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3059 _(
"OpenGL Options") + _T(
"..."));
3060 OpenGLSizer->Add(bOpenGL, inputFlags);
3061 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3063 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3064 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3069 itemBoxSizerUI->Add(0, border_size * 3);
3070 itemBoxSizerUI->Add(0, border_size * 3);
3074 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3075 _(
"Chart Rotation Averaging Time"));
3077 wrapperSizer->Add(crat, 0,
3078 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3079 group_item_spacing);
3081 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3082 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
3085 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3086 wxDefaultPosition, wxSize(sz.x / 5, -1), wxTE_RIGHT);
3087 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
3088 group_item_spacing);
3090 pCOGUPFilterRow->Add(
3091 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3094 itemBoxSizerUI->Add(0, border_size * 3);
3095 itemBoxSizerUI->Add(0, border_size * 3);
3098 wxStaticText* zoomTextHead =
new wxStaticText(
3099 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3100 zoomTextHead->Wrap(-1);
3101 itemBoxSizerUI->Add(
3103 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3104 group_item_spacing);
3105 itemBoxSizerUI->Add(0, border_size * 1);
3107 itemBoxSizerUI->Add(
3108 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3111 m_pSlider_Zoom_Raster =
3112 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3113 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3116 prepareSlider(m_pSlider_Zoom_Raster);
3119 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3121 itemBoxSizerUI->Add(
3122 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3125 m_pSlider_Zoom_Vector =
3126 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3127 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3130 prepareSlider(m_pSlider_Zoom_Vector);
3133 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3135 itemBoxSizerUI->Add(
3136 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3138 m_pSlider_CM93_Zoom =
3139 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3140 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3141 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3144 prepareSlider(m_pSlider_CM93_Zoom);
3147 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3149 itemBoxSizerUI->Add(0, border_size * 3);
3150 itemBoxSizerUI->Add(0, border_size * 3);
3151 itemBoxSizerUI->Add(0, border_size * 3);
3154 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3155 _(
"Physical Screen Width")),
3157 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3158 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3160 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3161 pDPIRow->Add(pRBSizeAuto, inputFlags);
3162 pDPIRow->AddSpacer(10);
3163 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3164 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3165 pDPIRow->Add(pRBSizeManual, inputFlags);
3167 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3168 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3171 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3172 wxDefaultPosition, wxSize(sz.x / 5, -1), wxTE_RIGHT);
3173 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3175 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3179 itemBoxSizerUI->Add(
3180 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3182 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3183 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3185 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3186 _(
"Show extended chart bar information."));
3187 ChartBarSizer->Add(pChartBarEX, inputFlags);
3189 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3190 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3192 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3193 wxCommandEventHandler(options::OnSizeManualButton),
3199 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3200 itemBoxSizerUI->SetHGap(border_size);
3207 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3208 m_ChartDisplayPage->SetSizer(wrapperSizer);
3209 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3212 itemBoxSizerUI->Add(0, border_size * 3);
3213 itemBoxSizerUI->Add(0, border_size * 3);
3216 itemBoxSizerUI->Add(
3217 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3219 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3220 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3222 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3223 _(
"Show Skewed Raster Charts as North-Up"));
3224 boxCharts->Add(pSkewComp, verticleInputFlags);
3242 itemBoxSizerUI->Add(0, border_size * 3);
3243 itemBoxSizerUI->Add(0, border_size * 3);
3246 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3247 _(
"Chart Rotation Averaging Time")),
3249 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3250 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3251 group_item_spacing);
3254 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3255 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
3256 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3258 pCOGUPFilterRow->Add(
3259 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3263 itemBoxSizerUI->Add(0, border_size * 8);
3264 itemBoxSizerUI->Add(0, border_size * 8);
3267 wxStaticText* zoomTextHead =
new wxStaticText(
3268 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3270 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3271 itemBoxSizerUI->Add(0, border_size * 1);
3272 itemBoxSizerUI->Add(0, border_size * 1);
3274 wxStaticText* zoomText =
new wxStaticText(
3275 m_ChartDisplayPage, wxID_ANY,
3276 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3277With a higher value, the same zoom level shows a more detailed chart."));
3279 smallFont = *dialogFont;
3281 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3283 zoomText->SetFont(smallFont);
3284 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3292 itemBoxSizerUI->Add(
3293 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3295 m_pSlider_Zoom_Raster =
3296 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3297 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3300 prepareSlider(m_pSlider_Zoom_Raster);
3303 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3305 itemBoxSizerUI->Add(
3306 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3308 m_pSlider_Zoom_Vector =
3309 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3310 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3313 prepareSlider(m_pSlider_Zoom_Vector);
3316 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3319 itemBoxSizerUI->Add(0, border_size * 3);
3320 itemBoxSizerUI->Add(0, border_size * 3);
3322 itemBoxSizerUI->Add(
3323 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3325 m_pSlider_CM93_Zoom =
3326 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3327 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3328 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3331 prepareSlider(m_pSlider_CM93_Zoom);
3334 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3337 itemBoxSizerUI->Add(0, border_size * 3);
3338 itemBoxSizerUI->Add(0, border_size * 3);
3339 itemBoxSizerUI->Add(0, border_size * 3);
3340 itemBoxSizerUI->Add(0, border_size * 3);
3341 itemBoxSizerUI->Add(0, border_size * 3);
3342 itemBoxSizerUI->Add(0, border_size * 3);
3345 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3346 _(
"Physical Screen Width")),
3348 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3349 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3351 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3352 pDPIRow->Add(pRBSizeAuto, inputFlags);
3353 pDPIRow->AddSpacer(10);
3354 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3355 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3356 pDPIRow->Add(pRBSizeManual, inputFlags);
3358 pScreenMM =
new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3359 wxDefaultPosition, wxSize(3 * m_fontHeight, -1),
3361 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3363 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3366 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3367 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3369 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3370 wxCommandEventHandler(options::OnSizeManualButton),
3374 itemBoxSizerUI->Add(0, border_size * 3);
3375 itemBoxSizerUI->Add(0, border_size * 3);
3380 itemBoxSizerUI->Add(
3381 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3383 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3384 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3386 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3387 _(
"Use Accelerated Graphics (OpenGL)"));
3388 OpenGLSizer->Add(pOpenGL, inputFlags);
3389 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3391 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3392 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3398 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3399 _(
"Options") + _T(
"..."));
3400 OpenGLSizer->Add(bOpenGL, inputFlags);
3401 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3404 itemBoxSizerUI->Add(0, border_size * 3);
3405 itemBoxSizerUI->Add(0, border_size * 3);
3410 itemBoxSizerUI->Add(
3411 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3413 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3414 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3416 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3417 _(
"Show extended chart bar information."));
3418 ChartBarSizer->Add(pChartBarEX, inputFlags);
3430 m_ChartDisplayPage->Fit();
3434void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3435 int group_item_spacing) {
3436 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3439 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3440 ps57Ctl->SetSizer(vectorPanel);
3443 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3444 optionsColumn->SetHGap(border_size);
3445 optionsColumn->AddGrowableCol(0, 2);
3446 optionsColumn->AddGrowableCol(1, 3);
3447 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3450 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3451 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3456 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3458 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3459 _(
"Mariner's Standard")};
3460 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3461 wxDefaultSize, 4, pDispCatStrings);
3462 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3466 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3467 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3470 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3473 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3474 optionsColumn->Add(miscSizer, groupInputFlags);
3478 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3479 pCheck_SOUNDG->SetValue(FALSE);
3480 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3483 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3484 _(
"Chart Information Objects"));
3485 pCheck_META->SetValue(FALSE);
3486 miscSizer->Add(pCheck_META, verticleInputFlags);
3489 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3492 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3493 optionsColumn->Add(lightSizer, groupInputFlags);
3496 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3497 pCheck_ATONTEXT->SetValue(FALSE);
3498 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3501 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3502 pCheck_LDISTEXT->SetValue(FALSE);
3503 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3505 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3506 _(
"Extended Light Sectors"));
3507 pCheck_XLSECTTEXT->SetValue(FALSE);
3508 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3511 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3514 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3515 optionsColumn->Add(textSizer, groupInputFlags);
3517 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3518 _(
"National text on chart"));
3519 pCheck_NATIONALTEXT->SetValue(FALSE);
3520 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3522 pCheck_SHOWIMPTEXT =
3523 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3524 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3525 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3528 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3529 pCheck_DECLTEXT->SetValue(FALSE);
3530 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3532 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3534 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3535 _(
"Reduced Detail at Small Scale"));
3536 pCheck_SCAMIN->SetValue(FALSE);
3537 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3539 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3540 pCheck_SuperSCAMIN =
3541 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3542 _(
"Additional detail reduction at Small Scale"));
3543 pCheck_SuperSCAMIN->SetValue(FALSE);
3544 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3547 optionsColumn->Add(0, border_size * 4);
3548 optionsColumn->Add(0, border_size * 4);
3551 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3553 wxString pPointStyleStrings[] = {
3557 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3558 wxDefaultSize, 2, pPointStyleStrings);
3559 optionsColumn->Add(pPointStyle, inputFlags);
3561 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3563 wxString pBoundStyleStrings[] = {
3567 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3568 wxDefaultSize, 2, pBoundStyleStrings);
3569 optionsColumn->Add(pBoundStyle, inputFlags);
3571 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3573 wxString pColorNumStrings[] = {
3577 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3578 wxDefaultSize, 2, pColorNumStrings);
3579 optionsColumn->Add(p24Color, inputFlags);
3582 optionsColumn->Add(0, border_size * 4);
3583 optionsColumn->Add(0, border_size * 4);
3586 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3588 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3589 optionsColumn->Add(depShalRow);
3591 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3592 wxSize(60, -1), wxTE_RIGHT);
3593 depShalRow->Add(m_ShallowCtl, inputFlags);
3594 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3595 depShalRow->Add(m_depthUnitsShal, inputFlags);
3597 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3599 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3600 optionsColumn->Add(depSafeRow);
3601 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""),
3602 wxDefaultPosition, wxSize(60, -1), wxTE_RIGHT);
3603 depSafeRow->Add(m_SafetyCtl, inputFlags);
3604 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3605 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3607 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3609 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3610 optionsColumn->Add(depDeepRow);
3611 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""),
3612 wxDefaultPosition, wxSize(60, -1), wxTE_RIGHT);
3613 depDeepRow->Add(m_DeepCtl, inputFlags);
3614 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3615 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3618 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3619 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3621 wxStaticBox* marinersBox =
3622 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3623 wxStaticBoxSizer* marinersSizer =
3624 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3625 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3628 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3629 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3631 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3632 itemButtonSelectList =
3633 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3634 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3635 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3636 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3637 marinersSizer->Add(btnRow1);
3639 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3641 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3642 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3643 marinersSizer->Add(btnRow2);
3648 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3649 ps57Ctl->SetSizer(vectorPanel);
3651 wxBoxSizer* optionsColumn = vectorPanel;
3654 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3659 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3661 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3662 _(
"Mariner's Standard")};
3663 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3664 wxSize(350, -1), 4, pDispCatStrings);
3665 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3668 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3673 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3674 optionsColumn->Add(miscSizer, groupInputFlags);
3677 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3678 pCheck_SOUNDG->SetValue(FALSE);
3679 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3681 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3682 _(
"Chart Information Objects"));
3683 pCheck_META->SetValue(FALSE);
3684 miscSizer->Add(pCheck_META, inputFlags);
3686 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3687 optionsColumn->Add(lightSizer, groupInputFlags);
3690 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3691 pCheck_ATONTEXT->SetValue(FALSE);
3692 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3695 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3696 pCheck_LDISTEXT->SetValue(FALSE);
3697 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3699 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3700 _(
"Extended Light Sectors"));
3701 pCheck_XLSECTTEXT->SetValue(FALSE);
3702 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3704 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3705 optionsColumn->Add(textSizer, groupInputFlags);
3707 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3708 _(
"National text on chart"));
3709 pCheck_NATIONALTEXT->SetValue(FALSE);
3710 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3712 pCheck_SHOWIMPTEXT =
3713 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3714 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3715 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3718 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3719 pCheck_DECLTEXT->SetValue(FALSE);
3720 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3722 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3723 _(
"Reduced Detail at Small Scale"));
3724 pCheck_SCAMIN->SetValue(FALSE);
3725 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3727 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3728 pCheck_SuperSCAMIN =
3729 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3730 _(
"Additional detail reduction at Small Scale"));
3731 pCheck_SuperSCAMIN->SetValue(FALSE);
3732 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3735 optionsColumn->Add(0, border_size * 4);
3736 optionsColumn->Add(0, border_size * 4);
3740 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3741 StyleColumn->SetHGap(border_size);
3742 StyleColumn->AddGrowableCol(0, 2);
3743 StyleColumn->AddGrowableCol(1, 3);
3744 optionsColumn->Add(StyleColumn);
3746 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3748 wxString pPointStyleStrings[] = {
3752 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3753 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3754 pPointStyleStrings);
3756 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3759 StyleColumn->Add(pPointStyle, inputFlags);
3761 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3763 wxString pBoundStyleStrings[] = {
3767 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3768 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3769 pBoundStyleStrings);
3771 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3774 StyleColumn->Add(pBoundStyle, inputFlags);
3776 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3779 wxString pColorNumStrings[] = {
3783 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3784 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3787 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3789 StyleColumn->Add(p24Color, inputFlags);
3792 optionsColumn->Add(0, border_size * 4);
3793 optionsColumn->Add(0, border_size * 4);
3795 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3796 DepthColumn->SetHGap(border_size);
3797 DepthColumn->AddGrowableCol(0, 3);
3798 DepthColumn->AddGrowableCol(1, 2);
3799 DepthColumn->AddGrowableCol(2, 3);
3800 optionsColumn->Add(DepthColumn);
3803 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3806 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3807 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3808 DepthColumn->Add(m_ShallowCtl, inputFlags);
3809 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3810 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3812 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3815 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3816 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3817 DepthColumn->Add(m_SafetyCtl, inputFlags);
3818 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3819 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3821 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3824 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3825 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3826 DepthColumn->Add(m_DeepCtl, inputFlags);
3827 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3828 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3831 optionsColumn->Add(0, border_size * 4);
3832 optionsColumn->Add(0, border_size * 4);
3835 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3836 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3838 wxStaticBox* marinersBox =
3839 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3840 wxStaticBoxSizer* marinersSizer =
3841 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3842 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3844 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3845 itemButtonSelectList =
3846 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3847 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3848 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3849 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3850 marinersSizer->Add(btnRow1);
3852 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3854 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3855 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3856 marinersSizer->Add(btnRow2);
3859 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3861 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3865void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3866 int group_item_spacing) {
3867 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3869 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3870 tcPanel->SetSizer(mainHBoxSizer);
3872 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3873 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3874 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3877 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3878 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3880 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3884 tcDataSelected->DeleteAllItems();
3889 col0.SetText(_T(
""));
3891 col0.SetAlign(wxLIST_FORMAT_LEFT);
3893 tcDataSelected->InsertColumn(0, col0);
3896 unsigned int id = 0;
3897 for (
auto ds : TideCurrentDataSet) {
3900 tcDataSelected->InsertItem(li);
3902 wxString setName = ds;
3903 tcDataSelected->SetItem(
id, 0, setName);
3904 GetTextExtent(setName, &w1, &h);
3905 w = w1 > w ? w1 : w;
3908 tcDataSelected->SetColumnWidth(0, 20 + w);
3911 wxButton* insertButton =
3912 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3913 wxButton* removeButton =
3914 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3916 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3917 tcSizer->Add(btnSizer);
3919 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3920 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3923void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3924 int group_item_spacing) {
3929 wxNotebook* chartsPageNotebook = (wxNotebook*)m_pListbook->GetPage(parent);
3930 wxScrolledWindow* sw =
new ChartGroupsUI(chartsPageNotebook);
3931 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3932 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3935 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3938void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3939 int group_item_spacing) {
3941 m_border_size = border_size;
3942 m_group_item_spacing = group_item_spacing;
3944 m_UIcomplete = FALSE;
3949void ChartGroupsUI::CompletePanel(
void) {
3951 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3952 m_panel->SetSizer(m_topSizer);
3955 wxStaticText* allChartsLabel =
3956 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3957 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3959 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3960 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3962 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3963 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3967 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE, _T(
""),
3968 wxDefaultPosition, wxDefaultSize, wxVSCROLL);
3971 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE, _T(
""),
3972 wxDefaultPosition, wxDefaultSize, wxVSCROLL);
3974 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3976 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3977 m_pAddButton->Disable();
3978 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3979 m_pRemoveButton->Disable();
3981 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3982 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3984 m_pRemoveButton->Connect(
3985 wxEVT_COMMAND_BUTTON_CLICKED,
3986 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3988 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3989 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3990 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3992 sizerCharts->AddSpacer(20);
3995 wxStaticText* groupsLabel =
3996 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3997 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3999 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
4000 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
4002 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
4003 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
4004 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
4005 wxDefaultSize, wxNB_TOP);
4006 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
4008 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
4009 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
4013 wxPanel* allActiveGroup =
4014 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
4015 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
4017 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4018 allActiveGroup->SetSizer(page0BoxSizer);
4020 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1, _T(
""),
4021 wxDefaultPosition, wxDefaultSize);
4024 iFont =
new wxFont(*dialogFont);
4025 iFont->SetStyle(wxFONTSTYLE_ITALIC);
4026 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
4028 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
4030 m_DirCtrlArray.Add(defaultAllCtl);
4034 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
4035 m_pDeleteGroupButton =
4036 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
4037 m_pDeleteGroupButton->Disable();
4039 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
4040 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
4042 m_pDeleteGroupButton->Connect(
4043 wxEVT_COMMAND_BUTTON_CLICKED,
4044 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
4046 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
4047 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
4049 newDeleteGrp->AddSpacer(25);
4050 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
4051 m_group_item_spacing);
4052 newDeleteGrp->AddSpacer(15);
4053 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
4054 m_group_item_spacing);
4055 newDeleteGrp->AddSpacer(25);
4056 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
4058 sizerGroups->AddSpacer(20);
4062 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
4063 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
4066 m_UIcomplete = TRUE;
4069void options::CreatePanel_Display(
size_t parent,
int border_size,
4070 int group_item_spacing) {
4071 pDisplayPanel = AddPage(parent, _(
"General"));
4074 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4075 generalSizer->SetHGap(border_size);
4082 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4083 pDisplayPanel->SetSizer(wrapperSizer);
4084 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4087 generalSizer->Add(0, border_size * 4);
4088 generalSizer->Add(0, border_size * 4);
4093 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4095 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4096 generalSizer->Add(boxNavMode, groupInputFlags);
4098 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4099 boxNavMode->Add(rowOrientation);
4101 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4102 rowOrientation->Add(pCBNorthUp, inputFlags);
4104 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4105 rowOrientation->Add(pCBCourseUp,
4107 .Align(wxALIGN_CENTRE_VERTICAL)
4108 .Border(wxLEFT, group_item_spacing * 2));
4110 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4111 _(
"Look Ahead Mode"));
4112 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4115 generalSizer->Add(0, border_size * 4);
4116 generalSizer->Add(0, border_size * 4);
4120 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4122 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4123 generalSizer->Add(boxCharts, groupInputFlags);
4125 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4126 _(
"Enable Chart Quilting"));
4127 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4130 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4131 _(
"Preserve scale when switching charts"));
4132 boxCharts->Add(pPreserveScale, verticleInputFlags);
4135 generalSizer->Add(0, border_size * 4);
4136 generalSizer->Add(0, border_size * 4);
4140 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4142 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4143 generalSizer->Add(boxCtrls, groupInputFlags);
4145 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4146 _(
"Smooth Panning / Zooming"));
4147 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4149 pEnableZoomToCursor =
4150 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4151 pEnableZoomToCursor->SetValue(FALSE);
4152 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4154 pEnableTenHertz =
new wxCheckBox(pDisplayPanel, ID_TENHZCHECKBOX,
4155 _(
"Enable Ten Hz screen update"));
4156 pEnableTenHertz->SetValue(FALSE);
4157 boxCtrls->Add(pEnableTenHertz, verticleInputFlags);
4161 generalSizer->Add(0, border_size * 4);
4162 generalSizer->Add(0, border_size * 4);
4166 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4168 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4169 generalSizer->Add(boxDisp, groupInputFlags);
4172 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4173 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4175 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4176 _(
"Show Chart Outlines"));
4177 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4179 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4180 _(
"Show Depth Units"));
4181 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4191 generalSizer->Add(0, border_size * 4);
4192 generalSizer->Add(0, border_size * 4);
4196 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4198 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4199 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4202 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4203 _(
"Live ETA at Cursor"));
4204 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4208 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4209 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4211 m_Text_def_boat_speed =
new wxStaticText(
4212 pDisplayPanel, wxID_ANY,
4213 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4215 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4216 pSDefaultBoatSpeed =
4217 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED, _T(
""),
4218 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4219 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4220 group_item_spacing);
4227 if (g_Platform->GetDisplayAreaCM2() > 100) {
4228 wxStaticBox* itemStaticBoxScreenConfig =
4229 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4230 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4231 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4232 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4235 wxString iconDir = g_Platform->GetSharedDataDir();
4236 appendOSDirSlash(&iconDir);
4237 iconDir.append(_T(
"uidata"));
4238 appendOSDirSlash(&iconDir);
4239 iconDir.append(_T(
"MUI_flat"));
4240 appendOSDirSlash(&iconDir);
4241 int bmpSize = GetCharHeight() * 3;
4244 LoadSVG(iconDir + _T(
"MUI_Sconfig_1.svg"), bmpSize, bmpSize);
4245 m_sconfigSelect_single =
4247 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4250 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4252 bmp = LoadSVG(iconDir + _T(
"MUI_Sconfig_2.svg"), bmpSize, bmpSize);
4253 m_sconfigSelect_twovertical =
4255 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4258 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4263 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4264 generalSizer->SetHGap(border_size);
4271 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4272 pDisplayPanel->SetSizer(wrapperSizer);
4273 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4276 generalSizer->Add(0, border_size * 4);
4277 generalSizer->Add(0, border_size * 4);
4282 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4284 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4285 generalSizer->Add(boxNavMode, groupInputFlags);
4287 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4288 boxNavMode->Add(rowOrientation);
4290 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4291 rowOrientation->Add(pCBNorthUp, inputFlags);
4293 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4294 rowOrientation->Add(pCBCourseUp,
4296 .Align(wxALIGN_CENTRE_VERTICAL)
4297 .Border(wxLEFT, group_item_spacing * 2));
4299 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4300 _(
"Look Ahead Mode"));
4301 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4304 generalSizer->Add(0, border_size * 4);
4305 generalSizer->Add(0, border_size * 4);
4309 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4311 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4312 generalSizer->Add(boxCharts, groupInputFlags);
4314 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4315 _(
"Enable Chart Quilting"));
4316 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4319 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4320 _(
"Preserve scale when switching charts"));
4321 boxCharts->Add(pPreserveScale, verticleInputFlags);
4324 generalSizer->Add(0, border_size * 4);
4325 generalSizer->Add(0, border_size * 4);
4329 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4331 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4332 generalSizer->Add(boxCtrls, groupInputFlags);
4334 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4335 _(
"Smooth Panning / Zooming"));
4336 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4337 pEnableZoomToCursor =
4338 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4339 pEnableZoomToCursor->SetValue(FALSE);
4340 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4343 pSmoothPanZoom->Hide();
4344 pEnableZoomToCursor->Hide();
4348 generalSizer->Add(0, border_size * 4);
4349 generalSizer->Add(0, border_size * 4);
4354 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4356 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4357 generalSizer->Add(boxDisp, groupInputFlags);
4360 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4361 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4363 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4364 _(
"Show Chart Outlines"));
4365 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4367 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4368 _(
"Show Depth Units"));
4369 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4379 generalSizer->Add(0, border_size * 4);
4380 generalSizer->Add(0, border_size * 4);
4384 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4386 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4387 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4390 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4391 _(
"Live ETA at Cursor"));
4392 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4396 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4397 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4398 m_Text_def_boat_speed =
new wxStaticText(
4399 pDisplayPanel, wxID_ANY,
4400 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4401 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4402 pSDefaultBoatSpeed =
4403 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED, _T(
""),
4404 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4405 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4406 group_item_spacing);
4412 if (g_Platform->GetDisplayAreaCM2() > 100) {
4414 wxStaticBox* itemStaticBoxScreenConfig =
4415 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4416 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4417 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4418 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4421 wxString iconDir = g_Platform->GetSharedDataDir();
4422 appendOSDirSlash(&iconDir);
4423 iconDir.append(_T(
"uidata"));
4424 appendOSDirSlash(&iconDir);
4425 iconDir.append(_T(
"MUI_flat"));
4426 appendOSDirSlash(&iconDir);
4427 int bmpSize = GetCharHeight() * 3;
4430 LoadSVG(iconDir + _T(
"MUI_Sconfig_1.svg"), bmpSize, bmpSize);
4431 m_sconfigSelect_single =
4433 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4436 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4438 bmp = LoadSVG(iconDir + _T(
"MUI_Sconfig_2.svg"), bmpSize, bmpSize);
4439 m_sconfigSelect_twovertical =
4441 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4444 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4450void options::CreatePanel_Units(
size_t parent,
int border_size,
4451 int group_item_spacing) {
4452 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4455 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4456 unitsSizer->SetHGap(border_size);
4460 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4461 panelUnits->SetSizer(wrapperSizer);
4463 wrapperSizer->Add(1, border_size * 24);
4464 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4467 unitsSizer->Add(0, border_size * 4);
4468 unitsSizer->Add(0, border_size * 4);
4471 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4473 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4474 _(
"Kilometers"), _(
"Meters")};
4475 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4477 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4478 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4481 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4483 unitsSizer->Add(pDistanceFormat, inputFlags);
4486 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4488 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4489 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4490 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4491 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4492 m_SpeedFormatsNChoices, pSpeedFormats);
4494 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4496 unitsSizer->Add(pSpeedFormat, inputFlags);
4499 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4501 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4502 int m_WindSpeedFormatsNChoices =
4503 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4505 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4506 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4509 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4511 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4514 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4516 wxString pDepthUnitStrings[] = {
4522 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4523 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4525 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4527 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4530 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4532 wxString pTempUnitStrings[] = {
4538 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4539 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4541 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4543 unitsSizer->Add(pTempFormat, inputFlags);
4546 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4547 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4550 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4552 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4553 _(
"Decimal Degrees"),
4554 _(
"Degrees, Minutes, Seconds")};
4555 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4556 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4557 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4558 m_SDMMFormatsNChoices, pSDMMFormats);
4560 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4562 unitsSizer->Add(pSDMMFormat, inputFlags);
4565 unitsSizer->Add(0, border_size * 4);
4566 unitsSizer->Add(0, border_size * 4);
4570 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4573 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4574 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4575 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4576 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4579 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4580 wxDefaultPosition, wxDefaultSize, 0);
4582 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4583 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4584 wxDefaultPosition, wxDefaultSize, 0);
4586 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4589 unitsSizer->Add(0, border_size * 4);
4590 unitsSizer->Add(0, border_size * 4);
4593 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4598 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4599 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4600 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4603 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4604 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4605 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4609 wxStaticBox* itemStaticBoxVar =
4610 new wxStaticBox(panelUnits, wxID_ANY, _T(
""));
4612 wxStaticBoxSizer* itemStaticBoxSizerVar =
4613 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4614 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4616 itemStaticBoxSizerVar->Add(0, border_size * 4);
4618 itemStaticTextUserVar =
4619 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4620 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4621 group_item_spacing);
4623 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4624 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4625 group_item_spacing);
4627 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL, _T(
""),
4628 wxDefaultPosition, wxSize(150, -1), wxTE_RIGHT);
4629 magVarSizer->AddSpacer(100);
4631 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4633 itemStaticTextUserVar2 =
4634 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4636 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4637 group_item_spacing);
4639 itemStaticBoxSizerVar->Add(0, border_size * 40);
4642 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4643 unitsSizer->SetHGap(border_size);
4647 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4648 panelUnits->SetSizer(wrapperSizer);
4649 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4652 unitsSizer->Add(0, border_size * 4);
4653 unitsSizer->Add(0, border_size * 4);
4656 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4658 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4659 _(
"Kilometers"), _(
"Meters")};
4660 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4661 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4662 wxDefaultPosition, wxDefaultSize,
4663 m_DistanceFormatsNChoices, pDistanceFormats);
4664 unitsSizer->Add(pDistanceFormat, inputFlags);
4667 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4669 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4670 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4672 new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE, wxDefaultPosition,
4673 wxDefaultSize, m_SpeedFormatsNChoices, pSpeedFormats);
4674 unitsSizer->Add(pSpeedFormat, inputFlags);
4677 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"WindSpeed")),
4679 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4680 int m_WindSpeedFormatsNChoices =
4681 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4682 pWindSpeedFormat =
new wxChoice(
4683 panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition, wxDefaultSize,
4684 m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4685 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4688 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4690 wxString pDepthUnitStrings[] = {
4696 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4697 wxDefaultSize, 3, pDepthUnitStrings);
4698 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4701 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4703 wxString pTempUnitStrings[] = {
4709 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4710 wxDefaultSize, 3, pTempUnitStrings);
4711 unitsSizer->Add(pTempFormat, inputFlags);
4714 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4715 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4718 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4720 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4721 _(
"Decimal Degrees"),
4722 _(
"Degrees, Minutes, Seconds")};
4723 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4725 new wxChoice(panelUnits, ID_SDMMFORMATCHOICE, wxDefaultPosition,
4726 wxDefaultSize, m_SDMMFormatsNChoices, pSDMMFormats);
4727 unitsSizer->Add(pSDMMFormat, inputFlags);
4730 unitsSizer->Add(0, border_size * 4);
4731 unitsSizer->Add(0, border_size * 4);
4735 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4738 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4739 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4740 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4741 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4744 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4745 wxDefaultPosition, wxDefaultSize, 0);
4747 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4748 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4749 wxDefaultPosition, wxDefaultSize, 0);
4751 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4754 unitsSizer->Add(0, border_size * 4);
4755 unitsSizer->Add(0, border_size * 4);
4758 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4761 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4762 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4765 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4766 _(
"Show true bearings and headings"));
4767 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4768 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4769 _(
"Show magnetic bearings and headings."));
4770 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4772 bearingsSizer->AddSpacer(10);
4775 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4776 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4778 itemStaticTextUserVar =
4779 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4780 itemStaticTextUserVar->SetLabel(
4781 _(
"WMM Plugin calculated magnetic variation"));
4783 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4784 group_item_spacing);
4786 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL, _T(
""),
4787 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4788 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4790 itemStaticTextUserVar2 =
4791 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4792 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4793 group_item_spacing);
4795 bearingsSizer->AddSpacer(10);
4797 wxStaticText* varText =
4798 new wxStaticText(panelUnits, wxID_ANY,
4799 _(
" To set the magnetic variation manually,\n you "
4800 "must disable the WMM plugin."));
4801 smallFont = *dialogFont;
4802 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4804 varText->SetFont(smallFont);
4806 bearingsSizer->Add(varText);
4815 OCPNSoundPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
4816 const wxSize& size, wxString title, wxString checkLegend,
4817 wxString selectLegend, wxString* pSoundFile);
4821 void OnButtonSelectSound(wxCommandEvent& event);
4822 void OnButtonSPTestSound(wxCommandEvent& event);
4823 wxString SelectSoundFile();
4824 void SetSoundFileLabel(wxString file);
4825 wxCheckBox* GetCheckBox() {
return m_pCheck_Sound; }
4826 wxString GetSoundFile() {
return m_sound_file; }
4828 wxCheckBox* m_pCheck_Sound;
4829 wxSize m_small_button_size;
4830 wxString m_sound_file;
4831 wxString* m_pSoundFile;
4832 wxStaticText* m_AudioFileNameText;
4835 wxButton* TestSound;
4842 bool m_soundPlaying;
4844 DECLARE_EVENT_TABLE()
4847#define ID_SELECTSOUND 9341
4848#define ID_TESTSOUND 9342
4851EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4852EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4857 const wxPoint& pos, const wxSize& size,
4858 wxString title, wxString checkLegend,
4859 wxString selectLegend, wxString* pSoundFile)
4860 : wxPanel(parent,
id, pos, size, wxBORDER_NONE), m_soundPlaying(false) {
4861 wxFont* pif = FontMgr::Get().
GetFont(_(
"Dialog"));
4864 m_pSoundFile = pSoundFile;
4865 if (pSoundFile) m_sound_file = *pSoundFile;
4867 m_sound = SoundFactory();
4869 int border_size = 4;
4870 int group_item_spacing = 2;
4872 int font_size_y, font_descent, font_lead;
4873 GetTextExtent(_T(
"0"), NULL, &font_size_y, &font_descent, &font_lead);
4874 m_small_button_size = wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4876 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4877 SetSizer(wrapperSizer);
4879 wxStaticBox* StaticBox1 =
new wxStaticBox(
this, wxID_ANY, title);
4880 wxStaticBoxSizer* StaticBoxSizer1 =
4881 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4882 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4884 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO, checkLegend);
4885 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4888 wxString LabelWrapped;
4894 g_pOptions->GetSize().x * 8 / 10);
4895 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4896 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4897 LabelWrapped +=
"\n";
4899 LabelWrapped +=
"\n";
4902 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4903 m_AudioFileNameText->Wrap(-1);
4904 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4906 SetSoundFileLabel(m_sound_file);
4909 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4910 soundSizer1->SetHGap(border_size * 2);
4911 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4913 SelSound =
new wxButton(
this, ID_SELECTSOUND, selectLegend, wxDefaultPosition,
4914 m_small_button_size, 0);
4915 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4916 soundSizer1->AddSpacer(group_item_spacing * 4);
4917 TestSound =
new wxButton(
this, ID_TESTSOUND, _(
"Test"), wxDefaultPosition,
4918 m_small_button_size, 0);
4919 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4920 auto sound_action = [
this](
ObservedEvt ev) { m_soundPlaying =
false; };
4921 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4924void OCPNSoundPanel::SetSoundFileLabel(wxString file) {
4925 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " + file);
4928 g_pOptions->GetSize().x * 8 / 10);
4929 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4930 wxString LabelWrapped;
4931 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4933 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4935 LabelWrapped += LabelWrappedArray[i];
4936 LabelWrapped +=
"\n";
4939 m_AudioFileNameText->SetLabel(LabelWrapped);
4943wxString OCPNSoundPanel::SelectSoundFile() {
4944 wxString sound_dir = g_Platform->GetSharedDataDir();
4945 sound_dir.Append(_T(
"sounds"));
4950 wxFileDialog* popenDialog =
new wxFileDialog(
4951 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4952 _T(
"WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN);
4954 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
4956 response = popenDialog->ShowModal();
4957 sel_file = popenDialog->GetPath();
4962 g_Platform->DoFileSelectorDialog(
this, &sel_file, _(
"Select Sound File"),
4963 sound_dir, wxEmptyString, wxT(
"*.*"));
4967 if (response == wxID_OK)
4968 return g_Platform->NormalizePath(sel_file);
4973void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4974 wxString sel_file = SelectSoundFile();
4976 if (!sel_file.IsEmpty()) {
4977 m_sound_file = g_Platform->NormalizePath(sel_file);
4978 if (m_pSoundFile) *m_pSoundFile = m_sound_file;
4980 SetSoundFileLabel(m_sound_file);
4985void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
4986 if (!m_soundPlaying) {
4987 m_sound->SetFinishedCallback(
4989 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
4990 m_soundPlaying =
true;
4996void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent& event) {
4997 if (event.IsChecked())
4998 m_pCheck_AlertAudio->SetValue(
true);
5000 if (!m_soundPanelSART->GetCheckBox()->GetValue() &&
5001 !m_soundPanelDSC->GetCheckBox()->GetValue())
5002 m_pCheck_AlertAudio->SetValue(
false);
5006void options::OnUXAudioEnableButtonClickSART(wxCommandEvent& event) {
5007 if (event.IsChecked())
5008 m_pCheck_AlertAudio->SetValue(
true);
5010 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5011 !m_soundPanelDSC->GetCheckBox()->GetValue())
5012 m_pCheck_AlertAudio->SetValue(
false);
5016void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent& event) {
5017 if (event.IsChecked())
5018 m_pCheck_AlertAudio->SetValue(
true);
5020 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5021 !m_soundPanelSART->GetCheckBox()->GetValue())
5022 m_pCheck_AlertAudio->SetValue(
false);
5026void options::CreatePanel_Sounds(
size_t parent,
int border_size,
5027 int group_item_spacing) {
5028 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
5030 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
5031 panelSounds->SetSizer(wrapperSizer);
5035 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize,
5036 _(
"Anchor Alarm"), _(
"Play Sound on Anchor Alarm."),
5037 _(
"Select Anchor Alarm Sound"), &g_anchorwatch_sound_file);
5038 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
5042 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"AIS Alert"),
5043 _(
"Play Sound on AIS Alert."), _(
"Select AIS Alert Sound"),
5045 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
5047 m_soundPanelAIS->GetCheckBox()->Connect(
5048 wxEVT_COMMAND_CHECKBOX_CLICKED,
5049 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
5054 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"SART Alert"),
5055 _(
"Play Sound on AIS SART Alert."), _(
"Select AIS SART Alert Sound"),
5056 &g_SART_sound_file);
5057 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
5059 m_soundPanelSART->GetCheckBox()->Connect(
5060 wxEVT_COMMAND_CHECKBOX_CLICKED,
5061 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
5066 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"DSC Alert"),
5067 _(
"Play Sound on DSC notification."), _(
"Select DSC notification Sound"),
5069 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
5071 m_soundPanelDSC->GetCheckBox()->Connect(
5072 wxEVT_COMMAND_CHECKBOX_CLICKED,
5073 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
5077 wxStaticBox* StatBoxSoundConfig =
5078 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
5079 wxStaticBoxSizer* StatBoxSoundConfigSizer =
5080 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
5081 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
5083 auto sound = std::unique_ptr<OcpnSound>(SoundFactory());
5084 int deviceCount = sound->DeviceCount();
5085 wxLogMessage(
"options: got device count: %d", deviceCount);
5086 if (deviceCount >= 1) {
5087 wxArrayString labels;
5088 for (
int i = 0; i < deviceCount; i += 1) {
5089 wxString label(sound->GetDeviceInfo(i));
5091 std::ostringstream stm;
5093 label = _(
"Unknown device :") + stm.str();
5095 if (!sound->IsOutputDevice(i)) {
5096 std::ostringstream stm;
5098 label = _(
"Input device :") + stm.str();
5105 int iDefault = labels.Index(
"default");
5107 if (g_iSoundDeviceIndex == -1) {
5109 g_iSoundDeviceIndex = iDefault;
5111 g_iSoundDeviceIndex = 0;
5114 pSoundDeviceIndex =
new wxChoice();
5115 if (pSoundDeviceIndex) {
5116 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
5117 wxDefaultSize, labels);
5118 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
5119 pSoundDeviceIndex->Show();
5120 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
5121 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
5122 group_item_spacing);
5124 stSoundDeviceIndex =
5125 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
5126 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
5127 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
5132 if ((
bool)
dynamic_cast<SystemCmdSound*
>(SoundFactory())) {
5133 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
5134 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND,
5135 group_item_spacing);
5137 new wxTextCtrl(panelSounds, wxID_ANY, _T(
"" ), wxDefaultPosition,
5138 wxSize(450, -1), wxTE_LEFT);
5140 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
5141 wxALIGN_LEFT | wxALL);
5142 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
5146 if (!deviceCount) StatBoxSoundConfig->Hide();
5149 stSoundDeviceIndex->Hide();
5150 pSoundDeviceIndex->Hide();
5154void options::CreatePanel_MMSI(
size_t parent,
int border_size,
5155 int group_item_spacing) {
5156 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
5158 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
5159 panelMMSI->SetSizer(MMSISizer);
5162 wxStaticBox* itemStaticBoxMMSI =
5163 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
5164 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
5165 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
5166 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
5170 pPropsPanel->UpdateMMSIList();
5172 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
5174 panelMMSI->Layout();
5177void options::CreatePanel_AIS(
size_t parent,
int border_size,
5178 int group_item_spacing) {
5179 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5181 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5182 panelAIS->SetSizer(aisSizer);
5185 wxStaticBox* itemStaticBoxCPA =
5186 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5187 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5188 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5189 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5191 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5192 pCPAGrid->AddGrowableCol(1);
5193 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5195 m_pCheck_CPA_Max =
new wxCheckBox(
5197 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5198 m_pCheck_CPA_Max->SetToolTip(
5199 _(
"Disable CPA (Closest Point of Approach) and TCPA (Time to CPA) alerts "
5200 "for targets beyond this distance from your vessel"));
5201 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5203 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5204 m_pText_CPA_Max->SetToolTip(
5205 _(
"Maximum distance in nautical miles at which Closest Point of Approach "
5206 "alerts will be triggered"));
5207 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5210 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5211 m_pCheck_CPA_Warn->SetToolTip(
5212 _(
"Enable warning alerts when targets have a Closest Point of Approach "
5213 "less than this distance"));
5214 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5217 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5218 m_pText_CPA_Warn->SetToolTip(
5219 _(
"Distance threshold in nautical miles for CPA warning alerts"));
5220 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5222 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5223 wxCommandEventHandler(options::OnCPAWarnClick),
5226 m_pCheck_CPA_WarnT =
5227 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5228 m_pCheck_CPA_WarnT->SetToolTip(
5229 _(
"Additional time constraint - alerts only occur if the Time to Closest "
5230 "Point of Approach is less than this value"));
5231 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5233 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5234 m_pText_CPA_WarnT->SetToolTip(
5235 _(
"Time threshold in minutes for TCPA constraints"));
5236 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5237 group_item_spacing);
5240 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5241 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5242 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5244 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5245 pLostGrid->AddGrowableCol(1);
5246 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5248 m_pCheck_Mark_Lost =
5249 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5250 m_pCheck_Mark_Lost->SetToolTip(
5251 _(
"Targets will be considered lost when no update is received for this "
5253 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5255 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5256 m_pText_Mark_Lost->SetToolTip(
5257 _(
"Time in minutes after which targets with no updates are marked as "
5259 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5260 group_item_spacing);
5262 m_pCheck_Remove_Lost =
5263 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5264 m_pCheck_Remove_Lost->SetToolTip(
5265 _(
"Lost targets will be completely removed from display after this "
5266 "additional time period"));
5267 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5269 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5270 m_pText_Remove_Lost->SetToolTip(_(
5271 "Time in minutes after which lost targets are removed from the display"));
5272 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5273 group_item_spacing);
5275 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5278 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5279 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5280 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5282 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5283 pDisplayGrid->AddGrowableCol(1);
5284 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5286 m_pCheck_Show_COG =
new wxCheckBox(
5287 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5288 m_pCheck_Show_COG->SetToolTip(
5289 _(
"Display a predictor arrow for each AIS target, showing its projected "
5290 "course over ground for the specified number of minutes."));
5291 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5293 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5294 m_pText_COG_Predictor->SetToolTip(
5295 _(
"Set the length in minutes for the COG predictor arrow for AIS "
5297 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5298 group_item_spacing);
5300 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5301 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5302 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5303 m_pCheck_Sync_OCOG_ACOG->Connect(
5304 wxEVT_COMMAND_CHECKBOX_CLICKED,
5305 wxCommandEventHandler(options::OnSyncCogPredClick), NULL,
this);
5307 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1, _T(
""));
5308 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5310 m_pCheck_Show_Tracks =
5311 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5312 m_pCheck_Show_Tracks->SetToolTip(
5313 _(
"Display the recent track (history) of each AIS target for the "
5314 "specified number of minutes."));
5315 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5317 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5318 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5319 group_item_spacing);
5321 m_pCheck_Hide_Moored =
new wxCheckBox(
5322 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5323 m_pCheck_Hide_Moored->SetToolTip(
5324 _(
"Hide AIS targets that are moving slower than this speed, typically "
5325 "indicating they are anchored or moored."));
5326 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5328 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5329 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5330 group_item_spacing);
5332 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5333 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5334 m_pCheck_Draw_Realtime_Prediction->SetToolTip(
5335 _(
"Show a real-time prediction vector for AIS targets moving faster than "
5337 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5338 group_item_spacing);
5340 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5341 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5342 group_item_spacing);
5344 m_pCheck_Scale_Priority =
new wxCheckBox(
5346 _(
"Allow attenuation of less critical targets if more than ... targets"));
5347 m_pCheck_Scale_Priority->SetToolTip(
5348 _(
"Reduce the display prominence of less critical AIS targets when the "
5349 "number of targets exceeds the specified value."));
5350 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5352 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5353 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5354 group_item_spacing);
5356 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5357 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5358 m_pCheck_Show_Area_Notices->SetToolTip(
5359 _(
"Display area notices received via AIS binary messages on the chart."));
5360 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5362 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1, _T(
""));
5363 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5365 m_pCheck_Draw_Target_Size =
5366 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5367 m_pCheck_Draw_Target_Size->SetToolTip(
5368 _(
"Display AIS targets using their actual reported size and shape on the "
5370 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5372 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1, _T(
""));
5373 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5375 m_pCheck_Show_Target_Name =
new wxCheckBox(
5376 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5377 m_pCheck_Show_Target_Name->SetToolTip(
5378 _(
"Display the name of AIS targets when the chart scale is greater than "
5379 "the specified value."));
5380 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5382 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5383 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5384 group_item_spacing);
5386 m_pCheck_use_Wpl =
new wxCheckBox(
5387 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5388 m_pCheck_use_Wpl->SetToolTip(
5389 _(
"Enable processing of WPL (Waypoint Location) position messages from "
5390 "AIS and select the action to take when received."));
5391 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5393 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5394 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5395 wxDefaultSize, 2, Wpl_Action);
5396 m_pWplAction->SetToolTip(
5397 _(
"Select the action to perform when a WPL message is received: create "
5398 "an Automatic Packet Reporting System (APRS) report or a mark on the "
5400 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5403 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5404 wxStaticBoxSizer* rolloverSizer =
5405 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5406 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5408 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5409 _(
"Enable route/AIS info block"));
5410 pRollover->SetToolTip(
5411 _(
"Show a popup info block with details about routes and AIS targets "
5412 "when hovering over them."));
5413 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5415 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5416 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5420 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5421 pStatic_CallSign->SetToolTip(
5422 _(
"Display the ship name and MMSI (call sign) in the rollover info "
5424 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5426 m_pCheck_Rollover_Class =
5427 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5428 m_pCheck_Rollover_Class->SetToolTip(
5429 _(
"Show the AIS class, type, and status in the rollover info block."));
5430 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5432 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5433 m_pCheck_Rollover_COG->SetToolTip(
5434 _(
"Show speed over ground (SOG) and course over ground (COG) in the "
5435 "rollover info block."));
5436 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5438 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5439 m_pCheck_Rollover_CPA->SetToolTip(
5440 _(
"Show Closest Point of Approach (CPA) and time to CPA (TCPA) in the "
5441 "rollover info block."));
5442 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5445 wxStaticBox* alertBox =
5446 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5447 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5448 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5450 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5451 pAlertGrid->AddGrowableCol(1);
5452 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5454 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5455 _(
"Show CPA/TCPA Alert Dialog"));
5456 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5458 m_pCheck_AlertDialog->Connect(
5459 wxEVT_COMMAND_CHECKBOX_CLICKED,
5460 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5469 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1, _T(
""));
5470 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5472 m_pCheck_AlertAudio =
new wxCheckBox(
5473 panelAIS, ID_AISALERTAUDIO,
5474 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5475 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5477 m_pCheck_AlertAudio->Connect(
5478 wxEVT_COMMAND_CHECKBOX_CLICKED,
5479 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5482 wxButton* m_pPlay_Sound =
5483 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"), wxDefaultPosition,
5484 m_small_button_size, 0);
5485 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5487 m_pPlay_Sound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
5488 wxCommandEventHandler(options::OnButtonTestSound),
5494 m_pCheck_Alert_Moored =
new wxCheckBox(
5495 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5496 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5498 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1, _T(
""));
5499 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5501 m_pCheck_Ack_Timout =
new wxCheckBox(
5502 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5503 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5505 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5506 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5507 group_item_spacing);
5515 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5519 GetHandle()->setStyleSheet(getQtStyleSheet());
5524void options::CreatePanel_UI(
size_t parent,
int border_size,
5525 int group_item_spacing) {
5526 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5528 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5529 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5531 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5532 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5534 wxStaticBox* itemLangStaticBox =
5535 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5536 wxStaticBoxSizer* itemLangStaticBoxSizer =
5537 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5539 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5541 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG);
5543 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5546 m_itemLangListBox->Disable();
5550 wxStaticBox* itemFontStaticBox =
5551 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5553 wxSize fontChoiceSize = wxSize(-1, -1);
5555 int fLayout = wxHORIZONTAL;
5558 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5561 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5564 wxStaticBoxSizer* itemFontStaticBoxSizer =
5565 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5566 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5569 m_itemFontElementListBox =
5570 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5571 fontChoiceSize, 0, NULL, wxCB_SORT);
5574 for (
size_t i = 0; i < uniqueStrings.GetCount(); i++) {
5575 m_itemFontElementListBox->Append(uniqueStrings[i]);
5578 if (uniqueStrings.GetCount()) m_itemFontElementListBox->SetSelection(0);
5580 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5582 wxButton* itemFontChooseButton =
5583 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5584 wxDefaultPosition, wxDefaultSize, 0);
5585 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5586#if defined(__WXGTK__) || defined(__WXQT__)
5587 wxButton* itemFontColorButton =
5588 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5589 wxDefaultPosition, wxDefaultSize, 0);
5590 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5592 wxButton* itemFontResetButton =
5593 new wxButton(itemPanelFont, ID_BUTTONFONT_RESET, _(
"Reset to Default"),
5594 wxDefaultPosition, wxDefaultSize, 0);
5595 itemFontStaticBoxSizer->Add(itemFontResetButton, 0, wxALL, border_size);
5597 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5598 wxDefaultPosition, wxDefaultSize, 0);
5599 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5604 wxStaticBox* itemStyleStaticBox =
5605 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5606 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5607 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5608 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5610 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5612 wxArrayPtrVoid styles = g_StyleManager->GetArrayOfStyles();
5613 for (
unsigned int i = 0; i < styles.Count(); i++) {
5615 m_itemStyleListBox->Append(style->name);
5617 m_itemStyleListBox->SetStringSelection(
5618 g_StyleManager->GetCurrentStyle()->name);
5619 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5622 wxStaticBox* miscOptionsBox =
5623 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5624 wxStaticBoxSizer* miscOptions =
5625 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5626 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5629 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5630 pShowStatusBar->SetValue(FALSE);
5631 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5634 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5635 pShowMenuBar->SetValue(FALSE);
5636 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5640 pShowMenuBar->Hide();
5643 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5644 pShowChartBar->SetValue(g_bShowChartBar);
5645 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5647 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5648 _(
"Show Compass/GPS Status Window"));
5649 pShowCompassWin->SetValue(FALSE);
5650 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5652 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5653 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5655 pToolbarAutoHideCB =
5656 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5657 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5659 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
5660 wxSize(50, -1), wxTE_RIGHT);
5661 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5663 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5664 group_item_spacing);
5666 auto enable_debug_cb =
new wxCheckBox(itemPanelFont, wxID_ANY,
5667 _(
"Enable Debug in root context menu"));
5668 enable_debug_cb->Bind(wxEVT_CHECKBOX, [enable_debug_cb](wxCommandEvent&) {
5669 g_enable_root_menu_debug = enable_debug_cb->IsChecked();
5671 enable_debug_cb->SetValue(g_enable_root_menu_debug);
5672 miscOptions->Add(enable_debug_cb, 0, wxALL, group_item_spacing);
5674 wxBoxSizer* pShipsBellsSizer =
new wxBoxSizer(wxHORIZONTAL);
5675 miscOptions->Add(pShipsBellsSizer, 0, wxALL, group_item_spacing);
5678 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5679 pShipsBellsSizer->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5682 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5683 _(
"Enable Touchscreen interface"));
5684 miscOptions->Add(pMobile, 0, wxALL, border_size);
5686 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5687 _(
"Enable Scaled Graphics interface"));
5688 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5693 pResponsive->Hide();
5697 pResponsive->Hide();
5700 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5701 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5703 pZoomButtons->Hide();
5707 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5708 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5710 wxButton* itemEcdisHelp =
5711 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5712 wxDefaultPosition, wxDefaultSize, 0);
5713 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5716 pInlandEcdis->Hide();
5717 itemEcdisHelp->Hide();
5720 miscOptions->AddSpacer(10);
5722 wxFlexGridSizer* sliderSizer;
5723 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5724 sliderSizer->AddGrowableCol(1);
5725 sliderSizer->SetFlexibleDirection(wxBOTH);
5726 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5728 m_pSlider_GUI_Factor =
5729 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5730 m_sliderSize, SLIDER_STYLE);
5731 m_pSlider_GUI_Factor->Hide();
5732 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5733 _(
"User Interface scale factor")),
5735 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5736 m_pSlider_GUI_Factor->Show();
5739 prepareSlider(m_pSlider_GUI_Factor);
5742 m_pSlider_Chart_Factor =
5743 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5744 m_sliderSize, SLIDER_STYLE);
5745 m_pSlider_Chart_Factor->Hide();
5747 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5749 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5750 m_pSlider_Chart_Factor->Show();
5753 prepareSlider(m_pSlider_Chart_Factor);
5756 m_pSlider_Ship_Factor =
5757 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5758 m_sliderSize, SLIDER_STYLE);
5759 m_pSlider_Ship_Factor->Hide();
5761 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5763 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5764 m_pSlider_Ship_Factor->Show();
5767 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5770 m_pSlider_Text_Factor =
5771 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5772 m_sliderSize, SLIDER_STYLE);
5773 m_pSlider_Text_Factor->Hide();
5775 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5777 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5778 m_pSlider_Text_Factor->Show();
5781 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5784 m_pSlider_ENCText_Factor =
5785 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5786 m_sliderSize, SLIDER_STYLE);
5787 m_pSlider_ENCText_Factor->Hide();
5789 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5791 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5792 m_pSlider_ENCText_Factor->Show();
5795 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5798 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5799 _(
"Mouse wheel zoom sensitivity")),
5801 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5802 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5804 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5805 miscOptions->AddSpacer(20);
5808void options::OnResetFont(wxCommandEvent& event) {
5809 wxString itemElement;
5810 int i = m_itemFontElementListBox->GetSelection();
5812 itemElement = m_itemFontElementListBox->GetString(i);
5814 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5816 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5817 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5820 m_textSample->SetFont(*pFont);
5821 m_textSample->SetForegroundColour(colour);
5822 m_textSample->Refresh();
5825 gFrame->UpdateAllFonts();
5826 m_bfontChanged =
true;
5827 OnFontChoice(event);
5832void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5833 m_pCheck_AlertAudio->Enable(event.IsChecked());
5834 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5837void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5838 if (event.IsChecked()) {
5839 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5840 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5841 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5845void options::CreateListbookIcons() {
5851 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5853#if wxCHECK_VERSION(2, 8, 12)
5854 m_topImgList->Add(style->GetIcon(_T(
"Display"), sx, sy));
5855 m_topImgList->Add(style->GetIcon(_T(
"Charts"), sx, sy));
5856 m_topImgList->Add(style->GetIcon(_T(
"Connections"), sx, sy));
5857 m_topImgList->Add(style->GetIcon(_T(
"Ship"), sx, sy));
5858 m_topImgList->Add(style->GetIcon(_T(
"UI"), sx, sy));
5859 m_topImgList->Add(style->GetIcon(_T(
"Plugins"), sx, sy));
5863 bmp = style->GetIcon(_T(
"Display"));
5864 img = bmp.ConvertToImage();
5865 img.ConvertAlphaToMask(128);
5866 bmp = wxBitmap(img);
5867 m_topImgList->Add(bmp);
5868 bmp = style->GetIcon(_T(
"Charts"));
5869 img = bmp.ConvertToImage();
5870 img.ConvertAlphaToMask(128);
5871 bmp = wxBitmap(img);
5872 m_topImgList->Add(bmp);
5873 bmp = style->GetIcon(_T(
"Connections"));
5874 img = bmp.ConvertToImage();
5875 img.ConvertAlphaToMask(128);
5876 bmp = wxBitmap(img);
5877 m_topImgList->Add(bmp);
5878 bmp = style->GetIcon(_T(
"Ship"));
5879 img = bmp.ConvertToImage();
5880 img.ConvertAlphaToMask(128);
5881 bmp = wxBitmap(img);
5882 m_topImgList->Add(bmp);
5883 bmp = style->GetIcon(_T(
"UI"));
5884 img = bmp.ConvertToImage();
5885 img.ConvertAlphaToMask(128);
5886 bmp = wxBitmap(img);
5887 m_topImgList->Add(bmp);
5888 bmp = style->GetIcon(_T(
"Plugins"));
5889 img = bmp.ConvertToImage();
5890 img.ConvertAlphaToMask(128);
5891 bmp = wxBitmap(img);
5892 m_topImgList->Add(bmp);
5896 bmps = style->GetIcon(_T(
"Display"));
5897 int base_size = bmps.GetWidth();
5898 double tool_size = base_size;
5900 double premult = 1.0;
5904 double target_size = 6.0;
5906 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5907 premult = target_size / basic_tool_size_mm;
5910 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5911 postmult = wxMin(postmult, 3.0);
5912 postmult = wxMax(postmult, 1.0);
5914 int sizeTab = base_size * postmult * premult;
5916 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5920 bmp = style->GetIcon(_T(
"Display"));
5921 img = bmp.ConvertToImage();
5922 simg = img.Scale(sizeTab, sizeTab);
5923 bmp = wxBitmap(simg);
5924 m_topImgList->Add(bmp);
5925 bmp = style->GetIcon(_T(
"Charts"));
5926 img = bmp.ConvertToImage();
5927 simg = img.Scale(sizeTab, sizeTab);
5928 bmp = wxBitmap(simg);
5929 m_topImgList->Add(bmp);
5930 bmp = style->GetIcon(_T(
"Connections"));
5931 img = bmp.ConvertToImage();
5932 simg = img.Scale(sizeTab, sizeTab);
5933 bmp = wxBitmap(simg);
5934 m_topImgList->Add(bmp);
5935 bmp = style->GetIcon(_T(
"Ship"));
5936 img = bmp.ConvertToImage();
5937 simg = img.Scale(sizeTab, sizeTab);
5938 bmp = wxBitmap(simg);
5939 m_topImgList->Add(bmp);
5940 bmp = style->GetIcon(_T(
"UI"));
5941 img = bmp.ConvertToImage();
5942 simg = img.Scale(sizeTab, sizeTab);
5943 bmp = wxBitmap(simg);
5944 m_topImgList->Add(bmp);
5945 bmp = style->GetIcon(_T(
"Plugins"));
5946 img = bmp.ConvertToImage();
5947 simg = img.Scale(sizeTab, sizeTab);
5948 bmp = wxBitmap(simg);
5949 m_topImgList->Add(bmp);
5953void options::CreateControls(
void) {
5954 int border_size = 4;
5956 int group_item_spacing = 2;
5958 int font_size_y, font_descent, font_lead;
5959 GetTextExtent(_T(
"0"), NULL, &font_size_y, &font_descent, &font_lead);
5960 m_fontHeight = font_size_y + font_descent + font_lead;
5964 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5965 m_fontHeight * 8 / 10);
5968 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5972 m_small_button_size =
5973 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5975 m_nCharWidthMax = GetSize().x / GetCharWidth();
5978 pEnableZoomToCursor = NULL;
5979 pSmoothPanZoom = NULL;
5984 width = g_monitor_info[g_current_monitor].width;
5985 height = g_monitor_info[g_current_monitor].height;
5989 group_item_spacing = 1;
5993 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
5994 inputFlags = wxSizerFlags(0)
5995 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
5996 .Border(wxALL, group_item_spacing);
5997 verticleInputFlags =
5998 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
5999 groupLabelFlags = wxSizerFlags(0)
6000 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
6001 .Border(wxALL, group_item_spacing);
6002 groupLabelFlagsHoriz =
6003 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
6004 groupInputFlags = wxSizerFlags(0)
6005 .Align(wxALIGN_LEFT | wxALIGN_TOP)
6006 .Border(wxBOTTOM, group_item_spacing * 2)
6010 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
6015 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
6016 itemDialog1->SetSizer(itemBoxSizer2);
6020 wxFont* qFont = dialogFont;
6022 wxString wqs = getFontQtStylesheet(qFont);
6023 wxCharBuffer sbuf = wqs.ToUTF8();
6024 QString qsb = QString(sbuf.data());
6026 QString qsbq = getQtStyleSheet();
6028 itemDialog1->GetHandle()->setStyleSheet(qsb +
6035#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
6037 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6038 wxSize(-1, -1), flags);
6039 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
6040 wxListbookEventHandler(options::OnPageChange), NULL,
6044 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6045 wxSize(-1, -1), flags);
6046 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6047 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
6054 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
6058 CreateListbookIcons();
6060 m_pListbook->SetImageList(m_topImgList);
6061 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
6063 wxBoxSizer* buttons =
new wxBoxSizer(wxHORIZONTAL);
6064 itemBoxSizer2->Add(buttons, 0, wxALIGN_RIGHT | wxALL, border_size);
6066 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
6067 m_OKButton->SetDefault();
6068 buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6070 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
6071 buttons->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6073 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
6074 buttons->Add(m_ApplyButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6076 m_pageDisplay = CreatePanel(_(
"Display"));
6077 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
6078 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
6079 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
6080 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
6082 m_pageCharts = CreatePanel(_(
"Charts"));
6083 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
6084 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
6087 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
6088 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
6091 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
6093#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
6094 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6095 wxListbookEventHandler(options::OnChartsPageChange), NULL,
6098 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6099 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
6105 wxString ConnTab = _(
"Connections");
6108 m_pageConnections = CreatePanel(ConnTab);
6110 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6112 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6118 m_pageShips = CreatePanel(_(
"Ships"));
6119 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
6120 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
6122 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
6125 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
6127 wxString UITab = _(
"User Interface");
6130 m_pageUI = CreatePanel(UITab);
6131 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
6132 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
6134 m_pagePlugins = CreatePanel(_(
"Plugins"));
6135 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
6137 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
6138 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
6141 if (g_pi_manager) g_pi_manager->NotifySetupOptions();
6143 SetColorScheme(
static_cast<ColorScheme
>(0));
6154 SetSizeHints(-1, -1, width - marginx, height - marginy);
6163void options::SetInitialPage(
int page_sel,
int sub_page) {
6164 if (page_sel < (
int)m_pListbook->GetPageCount())
6165 m_pListbook->SetSelection(page_sel);
6167 m_pListbook->SetSelection(0);
6169 if (sub_page >= 0) {
6170 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
6171 wxNotebookPage* pg = m_pListbook->GetPage(i);
6172 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
6174 if (i == (
size_t)page_sel) {
6175 if (sub_page < (
int)nb->GetPageCount())
6176 nb->SetSelection(sub_page);
6178 nb->SetSelection(0);
6180 nb->ChangeSelection(0);
6186void options::SetColorScheme(ColorScheme cs) {
6189#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
6190 wxListView* lv = m_pListbook->GetListView();
6191 lv->SetBackgroundColour(GetBackgroundColour());
6194 delete m_topImgList;
6195 CreateListbookIcons();
6196 m_pListbook->SetImageList(m_topImgList);
6204void options::OnAISRolloverClick(wxCommandEvent& event) {
6205 m_pCheck_Rollover_Class->Enable(event.IsChecked());
6206 m_pCheck_Rollover_COG->Enable(event.IsChecked());
6207 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
6208 pStatic_CallSign->Enable(event.IsChecked());
6211void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
6213 case ID_SCREENCONFIG1:
6214 if (m_sconfigSelect_twovertical)
6215 m_sconfigSelect_twovertical->SetSelected(
false);
6219 case ID_SCREENCONFIG2:
6220 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6226void options::SetInitialSettings(
void) {
6229 m_returnChanges = 0;
6230 m_bfontChanged =
false;
6231 m_font_element_array.Clear();
6233 b_oldhaveWMM = b_haveWMM;
6234 auto loader = PluginLoader::GetInstance();
6235 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
6238 switch (g_canvasConfig) {
6241 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
6242 if (m_sconfigSelect_twovertical)
6243 m_sconfigSelect_twovertical->SetSelected(
false);
6246 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6247 if (m_sconfigSelect_twovertical)
6248 m_sconfigSelect_twovertical->SetSelected(
true);
6251 m_screenConfig = g_canvasConfig;
6255 ActiveChartArray.Clear();
6256 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6257 ActiveChartArray.Add(m_CurrentDirList[i]);
6261 if (m_pWorkDirList) {
6262 UpdateWorkArrayFromDisplayPanel();
6263 groupsPanel->SetDBDirs(*m_pWorkDirList);
6266 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6267 delete m_pGroupArray;
6268 m_pGroupArray = groupsPanel->CloneChartGroupArray(g_pGroupArray);
6269 groupsPanel->SetGroupArray(m_pGroupArray);
6270 groupsPanel->SetInitialSettings();
6274 pShowStatusBar->SetValue(g_bShowStatusBar);
6276 pShowMenuBar->SetValue(g_bShowMenuBar);
6278 pShowCompassWin->SetValue(g_bShowCompassWin);
6281 s.Printf(_T(
"%d"), g_COGAvgSec);
6282 pCOGUPUpdateSecs->SetValue(s);
6284 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6285 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6287 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6288 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6289 pMobile->SetValue(g_btouch);
6291 pRollover->SetValue(g_bRollover);
6292 m_pCheck_Rollover_Class->Enable(g_bRollover);
6293 m_pCheck_Rollover_COG->Enable(g_bRollover);
6294 m_pCheck_Rollover_CPA->Enable(g_bRollover);
6295 pStatic_CallSign->Enable(g_bRollover);
6297 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6301 pInlandEcdis->SetValue(g_bInlandEcdis);
6303 pOpenGL->SetValue(g_bopengl);
6305 if (pSmoothPanZoom) pSmoothPanZoom->SetValue(g_bsmoothpanzoom);
6306 pCBTrueShow->SetValue(g_bShowTrue);
6307 pCBMagShow->SetValue(g_bShowMag);
6309 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6313 itemStaticTextUserVar->SetLabel(
6314 _(
"WMM Plugin calculated magnetic variation"));
6316 s.Printf(_T(
"%4.1f"), gVar);
6317 pMagVar->SetValue(s);
6319 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6321 s.Printf(_T(
"%4.1f"), g_UserVar);
6322 pMagVar->SetValue(s);
6325 int newLength = itemStaticTextUserVar->GetLabel().Length();
6328 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6329 wxSize sz = GetSize();
6330 SetSize(sz.x + 1, sz.y);
6334 itemStaticTextUserVar2->Enable(!b_haveWMM);
6335 pMagVar->Enable(!b_haveWMM);
6337 if (pSDisplayGrid) pSDisplayGrid->SetValue(g_bDisplayGrid);
6342 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6346 wxString stringDefaultBoatSpeed;
6347 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6348 g_defaultBoatSpeed = 6.0;
6349 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6351 stringDefaultBoatSpeed.Printf(_T(
"%d"), (
int)g_defaultBoatSpeedUserUnit);
6352 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6356 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6357 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6358 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6360 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6362 s.Printf(_T(
"%6.2f"), g_ownship_predictor_minutes);
6364 s.Printf(_T(
"%4.0f"), g_ownship_predictor_minutes);
6365 m_pText_OSCOG_Predictor->SetValue(s);
6367 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6368 g_ownship_HDTpredictor_miles) > 1e-4)
6369 s.Printf(_T(
"%6.2f"), g_ownship_HDTpredictor_miles);
6371 s.Printf(_T(
"%4.0f"), g_ownship_HDTpredictor_miles);
6372 m_pText_OSHDT_Predictor->SetValue(s);
6374 if (g_OwnShipmmsi > 0) {
6375 wxString s = wxString::Format(
"%i", g_OwnShipmmsi);
6376 m_pTxt_OwnMMSI->SetValue(s);
6378 m_pTxt_OwnMMSI->SetValue(
"");
6380 m_pShipIconType->SetSelection(g_OwnShipIconType);
6381 wxCommandEvent eDummy;
6382 OnShipTypeSelect(eDummy);
6383 m_pOSLength->SetValue(
6384 wxString::Format(_T(
"%.1f"), g_n_ownship_length_meters));
6385 m_pOSWidth->SetValue(wxString::Format(_T(
"%.1f"), g_n_ownship_beam_meters));
6386 m_pOSGPSOffsetX->SetValue(
6387 wxString::Format(_T(
"%.1f"), g_n_gps_antenna_offset_x));
6388 m_pOSGPSOffsetY->SetValue(
6389 wxString::Format(_T(
"%.1f"), g_n_gps_antenna_offset_y));
6390 m_pOSMinSize->SetValue(wxString::Format(_T(
"%d"), g_n_ownship_min_mm));
6391 m_pText_ACRadius->SetValue(
6392 wxString::Format(_T(
"%.3f"), g_n_arrival_circle_radius));
6395 if (g_iNavAidRadarRingsNumberVisible > 10)
6396 g_iNavAidRadarRingsNumberVisible = 10;
6397 pNavAidRadarRingsNumberVisible->SetSelection(
6398 g_iNavAidRadarRingsNumberVisible);
6399 buf.Printf(_T(
"%.3f"), g_fNavAidRadarRingsStep);
6400 pNavAidRadarRingsStep->SetValue(buf);
6401 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6402 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6404 pScaMinChckB->SetValue(g_bUseWptScaMin);
6405 m_pText_ScaMin->SetValue(wxString::Format(_T(
"%i"), g_iWpt_ScaMin));
6406 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6408 OnRadarringSelect(eDummy);
6410 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6411 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6412 buf.Printf(_T(
"%.3f"), g_fWaypointRangeRingsStep);
6413 pWaypointRangeRingsStep->SetValue(buf);
6414 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6415 m_colourWaypointRangeRingsColour->SetColour(g_colourWaypointRangeRingsColour);
6416 OnWaypointRangeRingSelect(eDummy);
6417 pShowshipToActive->SetValue(g_bShowShipToActive);
6418 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6419 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6421 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6422 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6424 pSogCogFromLLCheckBox->SetValue(g_own_ship_sog_cog_calc);
6425 pSogCogFromLLDampInterval->SetValue(g_own_ship_sog_cog_calc_damp_sec);
6427 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6428 pEnableTenHertz->SetValue(g_btenhertz);
6430 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6431 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6433 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6435 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6438 pSDMMFormat->Select(g_iSDMMFormat);
6439 pDistanceFormat->Select(g_iDistanceFormat);
6440 pSpeedFormat->Select(g_iSpeedFormat);
6441 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6442 pTempFormat->Select(g_iTempFormat);
6444 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6445 g_bAdvanceRouteWaypointOnArrivalOnly);
6447 if (g_datetime_format ==
"Local Time") {
6449 }
else if (g_datetime_format ==
"UTC") {
6456 pTrackDaily->SetValue(g_bTrackDaily);
6457 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6458 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6459 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6460 TIME_TYPE_COMPUTER);
6461 pTrackHighlite->SetValue(g_bHighliteTracks);
6462 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6463 pTrackPrecision->SetSelection(g_nTrackPrecision);
6465 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6469 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6471 s.Printf(_T(
"%4.1f"), g_CPAMax_NM);
6472 m_pText_CPA_Max->SetValue(s);
6474 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6476 s.Printf(_T(
"%4.1f"), g_CPAWarn_NM);
6477 m_pText_CPA_Warn->SetValue(s);
6479 if (m_pCheck_CPA_Warn->GetValue()) {
6480 m_pCheck_CPA_WarnT->Enable();
6481 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6483 m_pCheck_CPA_WarnT->Disable();
6485 s.Printf(_T(
"%4.0f"), g_TCPA_Max);
6486 m_pText_CPA_WarnT->SetValue(s);
6489 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6491 s.Printf(_T(
"%4.0f"), g_MarkLost_Mins);
6492 m_pText_Mark_Lost->SetValue(s);
6494 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6496 s.Printf(_T(
"%4.0f"), g_RemoveLost_Mins);
6497 m_pText_Remove_Lost->SetValue(s);
6500 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6502 s.Printf(_T(
"%4.0f"), g_ShowCOG_Mins);
6503 m_pText_COG_Predictor->SetValue(s);
6505 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6506 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6508 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6510 s.Printf(_T(
"%4.0f"), g_AISShowTracks_Mins);
6511 m_pText_Track_Length->SetValue(s);
6513 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6515 s.Printf(_T(
"%4.1f"), g_ShowMoored_Kts);
6516 m_pText_Moored_Speed->SetValue(s);
6518 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6520 s.Printf(_T(
"%4.1f"), g_AIS_RealtPred_Kts);
6521 m_pText_RealtPred_Speed->SetValue(s);
6523 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6525 s.Printf(_T(
"%i"), g_ShowScaled_Num);
6526 m_pText_Scale_Priority->SetValue(s);
6528 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6530 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6531 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6533 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6535 s.Printf(_T(
"%d"), g_Show_Target_Name_Scale);
6536 m_pText_Show_Target_Name_Scale->SetValue(s);
6538 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6539 m_pWplAction->SetSelection(g_WplAction);
6542 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6543 if (g_bAIS_CPA_Alert) {
6544 m_pCheck_AlertAudio->Enable();
6545 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6547 m_pCheck_AlertAudio->Disable();
6548 m_pCheck_AlertAudio->SetValue(
false);
6551 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6553 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6554 s.Printf(_T(
"%4.0f"), g_AckTimeout_Mins);
6555 m_pText_ACK_Timeout->SetValue(s);
6558 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6559 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6560 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6563 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6564 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6565 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6567 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6568 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6570 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6571 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6572 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6573 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6574 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6575 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6577 if (!g_config_display_size_manual) {
6578 pRBSizeAuto->SetValue(TRUE);
6579 for (
const auto& mm : g_monitor_info) {
6580 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6582 screenmm.RemoveLast();
6583 pScreenMM->Disable();
6585 for (
const auto& mm : g_config_display_size_mm) {
6586 screenmm.Append(wxString::Format(
"%zu,", mm));
6588 screenmm.RemoveLast();
6589 pRBSizeManual->SetValue(TRUE);
6592 pScreenMM->SetValue(screenmm);
6594 pDepthUnitSelect->SetSelection(g_nDepthUnitDisplay);
6595 UpdateOptionsUnits();
6597 SetInitialVectorSettings();
6599 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6601 s.Printf(_T(
"%d"), g_nAutoHideToolbar);
6602 pToolbarHideSecs->SetValue(s);
6606 delete m_pSerialArray;
6607 m_pSerialArray = NULL;
6608 m_pSerialArray = EnumerateSerialPorts();
6609 m_bForceNewToolbaronCancel =
false;
6612void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6613 if (ps57CtlListBox) {
6615 ps57CtlListBox->Clear();
6616 marinersStdXref.clear();
6618 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6620 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6623 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6624 item = ps52plib->OBJLDescriptions[iPtr];
6626 item = wxString(pOLE->OBJLName, wxConvUTF8);
6632 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6633 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6634 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6636 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6637 (catl == DISPLAYBASE))
6639 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6642 bool benable =
true;
6643 if (cat > 0) benable = cat != DISPLAYBASE;
6648 int newpos = ps57CtlListBox->Append(item, benable,
false);
6649 marinersStdXref.push_back(newpos);
6650 for (
size_t i = 0; i < iPtr; i++) {
6651 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6655 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6657 if (cat == DISPLAYBASE) bviz =
true;
6660 if (cat == STANDARD) {
6665 ps57CtlListBox->Check(newpos, bviz);
6669 ps57CtlListBox->RunLayout();
6672 wxSize s = ps57CtlListBox->GetSize();
6673 ps57CtlListBox->SetSize(s.x, s.y - 1);
6677void options::SetInitialVectorSettings(
void) {
6678 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6682 m_bVectorInit =
true;
6683 resetMarStdList(
true,
false);
6686 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6690 switch (ps52plib->GetDisplayCategory()) {
6700 case (MARINERS_STANDARD):
6708 if (pDispCat) pDispCat->SetSelection(nset);
6712 bool benableMarStd =
false;
6714 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); i++) {
6717 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6718 benableMarStd =
true;
6727 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6728 itemButtonClearList->Enable(benableMarStd);
6729 itemButtonSelectList->Enable(benableMarStd);
6730 itemButtonSetStd->Enable(benableMarStd);
6733 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6734 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6735 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6736 if (pCheck_XLSECTTEXT)
6737 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6739 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6740 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6741 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6742 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6744 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6745 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6748 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6749 pPointStyle->SetSelection(0);
6751 pPointStyle->SetSelection(1);
6753 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6754 pBoundStyle->SetSelection(0);
6756 pBoundStyle->SetSelection(1);
6758 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6759 p24Color->SetSelection(0);
6761 p24Color->SetSelection(1);
6763 UpdateOptionsUnits();
6767void options::UpdateOptionsUnits(
void) {
6768 int depthUnit = pDepthUnitSelect->GetSelection();
6770 depthUnit = wxMax(depthUnit, 0);
6771 depthUnit = wxMin(depthUnit, 2);
6777 else if (depthUnit == 2)
6783 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6784 wxString depthUnitString = depthUnitStrings[depthUnit];
6785 m_depthUnitsShal->SetLabel(depthUnitString);
6786 m_depthUnitsSafe->SetLabel(depthUnitString);
6787 m_depthUnitsDeep->SetLabel(depthUnitString);
6790 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6792 m_ShallowCtl->SetValue(s);
6794 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6796 m_SafetyCtl->SetValue(s);
6798 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6800 m_DeepCtl->SetValue(s);
6830void options::OnSizeAutoButton(wxCommandEvent& event) {
6832 for (
const auto& mm : g_monitor_info) {
6833 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6835 screenmm.RemoveLast();
6836 pScreenMM->SetValue(screenmm);
6837 pScreenMM->Disable();
6838 g_config_display_size_manual = FALSE;
6841void options::OnSizeManualButton(wxCommandEvent& event) {
6843 if (g_config_display_size_mm.size() > 0 && g_config_display_size_mm[0] > 0) {
6844 for (
const auto& mm : g_config_display_size_mm) {
6845 screenmm.Append(wxString::Format(
"%zu,", mm));
6848 for (
const auto& mm : g_monitor_info) {
6849 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6852 screenmm.RemoveLast();
6853 pScreenMM->SetValue(screenmm);
6854 pScreenMM->Enable();
6855 g_config_display_size_manual = TRUE;
6858void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6860void options::OnCPAWarnClick(wxCommandEvent& event) {
6861 if (m_pCheck_CPA_Warn->GetValue()) {
6862 m_pCheck_CPA_WarnT->Enable();
6864 m_pCheck_CPA_WarnT->SetValue(FALSE);
6865 m_pCheck_CPA_WarnT->Disable();
6869void options::OnSyncCogPredClick(wxCommandEvent& event) {
6870 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6871 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6872 m_pText_COG_Predictor->Disable();
6875 s.Printf(_T(
"%4.0f"), g_ShowCOG_Mins);
6876 m_pText_COG_Predictor->SetValue(s);
6877 m_pText_COG_Predictor->Enable();
6881void options::OnShipTypeSelect(wxCommandEvent& event) {
6882 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6883 dispOptions->Layout();
6885 itemPanelShip->Layout();
6886 itemPanelShip->Refresh();
6890void options::OnRadarringSelect(wxCommandEvent& event) {
6891 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6892 dispOptions->Layout();
6894 itemPanelShip->Layout();
6895 itemPanelShip->Refresh();
6899void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6900 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6901 dispOptions->Layout();
6903 itemPanelRoutes->Layout();
6904 itemPanelRoutes->Refresh();
6908void options::OnGLClicked(wxCommandEvent& event) {
6913void options::OnOpenGLOptions(wxCommandEvent& event) {
6915 OpenGLOptionsDlg dlg(
this);
6917 if (dlg.ShowModal() == wxID_OK) {
6918 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6919 g_GLOptions.m_bUseAcceleratedPanning = g_bGLexpert
6920 ? dlg.GetAcceleratedPanning()
6921 : gFrame->GetPrimaryCanvas()
6923 ->CanAcceleratePanning();
6926 g_bSoftwareGL = dlg.GetSoftwareGL();
6928 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6929 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6933 g_GLOptions.m_bTextureCompressionCaching =
6934 dlg.GetTextureCompressionCaching();
6935 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6938 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6941 if (g_bopengl && g_glTextureManager &&
6942 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6944 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6946 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6947 ::wxBeginBusyCursor();
6948 gFrame->GetPrimaryCanvas()->GetglCanvas()->SetupCompression();
6949 g_glTextureManager->ClearAllRasterTextures();
6950 ::wxEndBusyCursor();
6953 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6956 if (dlg.GetRebuildCache()) {
6957 m_returnChanges = REBUILD_RASTER_CACHE;
6963void options::OnChartDirListSelect(wxCommandEvent& event) {
6965 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6966 m_removeBtn->Enable(selected);
6967 if (m_compressBtn) m_compressBtn->Enable(selected);
6971void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6974 const bool select = pDispCat->GetSelection() == 3;
6975 ps57CtlListBox->Enable(select);
6976 itemButtonClearList->Enable(select);
6977 itemButtonSelectList->Enable(select);
6978 itemButtonSetStd->Enable(select);
6984void options::OnButtonClearClick(wxCommandEvent& event) {
6985 resetMarStdList(
false,
false);
6994void options::OnButtonSelectClick(wxCommandEvent& event) {
6995 int nOBJL = ps57CtlListBox->GetCount();
6996 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
7001void options::OnButtonSetStd(wxCommandEvent& event) {
7002 resetMarStdList(
false,
true);
7007bool options::ShowToolTips(
void) {
return TRUE; }
7009void options::OnCharHook(wxKeyEvent& event) {
7010 if (event.GetKeyCode() == WXK_RETURN &&
7011 event.GetModifiers() == wxMOD_CONTROL) {
7012 wxCommandEvent okEvent;
7013 okEvent.SetId(xID_OK);
7014 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
7015 GetEventHandler()->AddPendingEvent(okEvent);
7020void options::OnButtonaddClick(wxCommandEvent& event) {
7022 int dresult = g_Platform->DoDirSelectorDialog(
7023 this, &selDir, _(
"Add a directory containing chart files"),
7024 *pInit_Chart_Dir,
false);
7026 if (dresult != wxID_CANCEL) AddChartDir(selDir);
7031void options::AddChartDir(
const wxString& dir) {
7032 wxFileName dirname = wxFileName(dir);
7033 pInit_Chart_Dir->Empty();
7038 f.MakeRelativeTo(g_Platform->GetHomeDir());
7039 dirAdd = f.GetFullPath();
7041 pInit_Chart_Dir->Append(dirname.GetPath());
7046 cdi.fullpath = dirAdd;
7047 ActiveChartArray.Add(cdi);
7049 UpdateChartDirList();
7051 k_charts |= CHANGE_CHARTS;
7053 pScanCheckBox->Disable();
7056void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
7059 ActiveChartArray.Clear();
7060 for (
size_t i = 0; i < p.GetCount(); i++) {
7061 ActiveChartArray.Add(p[i]);
7064 UpdateChartDirList();
7067void options::UpdateWorkArrayFromDisplayPanel(
void) {
7069 int n = ActiveChartArray.GetCount();
7070 if (m_pWorkDirList) {
7071 m_pWorkDirList->Clear();
7072 for (
int i = 0; i < n; i++) {
7073 dirname = ActiveChartArray[i].fullpath;
7074 if (!dirname.IsEmpty()) {
7077 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7078 (dirname.Last() == wxChar(_T(
'\r'))))
7079 dirname.RemoveLast();
7085 bool b_added = FALSE;
7088 int nDir = m_CurrentDirList.GetCount();
7090 for (
int i = 0; i < nDir; i++) {
7091 if (m_CurrentDirList[i].fullpath == dirname) {
7093 m_pWorkDirList->Add(cdi);
7101 cdin.fullpath = dirname;
7102 m_pWorkDirList->Add(cdin);
7109void options::OnApplyClick(wxCommandEvent& event) {
7110 ApplyChanges(event);
7115 if ((m_returnChanges & FONT_CHANGED) ||
7116 (m_returnChanges & NEED_NEW_OPTIONS)) {
7117 gFrame->PrepareOptionsClose(
this, m_returnChanges);
7118 if (!(m_returnChanges & FONT_CHANGED_SAFE))
7119 gFrame->ScheduleReconfigAndSettingsReload(
true,
true);
7123 if ((m_returnChanges & CONFIG_CHANGED)) {
7124 gFrame->ScheduleReconfigAndSettingsReload(
true,
false);
7129void options::ApplyChanges(wxCommandEvent& event) {
7135 if (m_pShipIconType->GetSelection() > 0) {
7136 double n_ownship_length_meters;
7137 double n_ownship_beam_meters;
7138 double n_gps_antenna_offset_y;
7139 double n_gps_antenna_offset_x;
7140 long n_ownship_min_mm;
7141 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
7142 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
7143 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
7144 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
7145 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
7147 if (n_ownship_length_meters <= 0)
7148 msg += _(
"\n - your ship's length must be > 0");
7149 if (n_ownship_beam_meters <= 0)
7150 msg += _(
"\n - your ship's beam must be > 0");
7151 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
7153 "\n - your GPS offset from midship must be within your ship's beam");
7154 if (n_gps_antenna_offset_y < 0 ||
7155 n_gps_antenna_offset_y > n_ownship_length_meters)
7157 _(
"\n - your GPS offset from bow must be within your ship's length");
7158 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
7159 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
7160 if (!msg.IsEmpty()) {
7161 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
7162 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
7163 ::wxEndBusyCursor();
7164 event.SetInt(wxID_STOP);
7167 g_n_ownship_length_meters = n_ownship_length_meters;
7168 g_n_ownship_beam_meters = n_ownship_beam_meters;
7169 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
7170 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
7171 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
7173 g_OwnShipIconType = m_pShipIconType->GetSelection();
7174 g_bShowShipToActive = pShowshipToActive->GetValue();
7175 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
7176 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
7178 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
7179 g_n_arrival_circle_radius =
7180 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
7182 wxString* icon_name =
7183 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
7184 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
7187 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
7188 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
7190 g_bUseWptScaMin = pScaMinChckB->GetValue();
7191 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
7192 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
7195 if (m_bfontChanged) {
7197 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
7198 gFrame->GetPrimaryCanvas()->GetglCanvas()->ResetGridFont();
7202 m_returnChanges |= FONT_CHANGED;
7206 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
7207 m_returnChanges |= FONT_CHANGED_SAFE;
7211 UpdateWorkArrayFromDisplayPanel();
7213 groupsPanel->SetDBDirs(*m_pWorkDirList);
7214 groupsPanel->m_treespopulated = FALSE;
7216 int k_force = FORCE_UPDATE;
7217 if (pUpdateCheckBox) {
7218 if (!pUpdateCheckBox->GetValue()) k_force = 0;
7219 pUpdateCheckBox->Enable();
7220 pUpdateCheckBox->SetValue(FALSE);
7225 m_returnChanges |= k_force;
7227 int k_scan = SCAN_UPDATE;
7228 if (pScanCheckBox) {
7229 if (!pScanCheckBox->GetValue()) k_scan = 0;
7230 pScanCheckBox->Enable();
7231 pScanCheckBox->SetValue(FALSE);
7236 m_returnChanges |= k_scan;
7240 if (groupsPanel->modified) {
7241 groupsPanel->EmptyChartGroupArray(g_pGroupArray);
7242 delete g_pGroupArray;
7243 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
7244 m_returnChanges |= GROUPS_CHANGED;
7249 g_bShowStatusBar = pShowStatusBar->GetValue();
7251 g_bShowMenuBar = pShowMenuBar->GetValue();
7253 g_bShowCompassWin = pShowCompassWin->GetValue();
7256 g_bShowChartBar = pShowChartBar->GetValue();
7258 wxString screenmm = pScreenMM->GetValue();
7259 wxStringTokenizer tkz(screenmm, _T(
"," ));
7260 g_config_display_size_mm.clear();
7261 while (tkz.HasMoreTokens()) {
7262 wxString token = tkz.GetNextToken();
7264 if (token.ToLong(&mm) && mm > 0) {
7265 g_config_display_size_mm.push_back(mm);
7267 g_config_display_size_mm.push_back(0);
7270 g_config_display_size_manual = pRBSizeManual->GetValue();
7273 comm_dialog->ApplySettings();
7275 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7276 if (pSDisplayGrid) g_bDisplayGrid = pSDisplayGrid->GetValue();
7279 bool temp_bquilting = pCDOQuilting->GetValue();
7282 g_bQuiltEnable = temp_bquilting;
7286 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7287 g_bskew_comp = pSkewComp->GetValue();
7288 g_btouch = pMobile->GetValue();
7290 g_bRollover = pRollover->GetValue();
7291 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7293 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7296 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7297 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7298 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7303 g_bsmoothpanzoom = pSmoothPanZoom->GetValue();
7305 g_bsmoothpanzoom =
false;
7307 if (pSmoothPanZoom) g_bsmoothpanzoom = pSmoothPanZoom->GetValue();
7309 g_bsmoothpanzoom =
false;
7312 long update_val = 1;
7313 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7314 g_COGAvgSec = wxMin(
static_cast<int>(update_val), MAX_COG_AVERAGE_SECONDS);
7318 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7320 g_bShowTrue = pCBTrueShow->GetValue();
7321 g_bShowMag = pCBMagShow->GetValue();
7323 auto loader = PluginLoader::GetInstance();
7324 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
7325 if (!b_haveWMM && !b_oldhaveWMM) {
7326 pMagVar->GetValue().ToDouble(&g_UserVar);
7330 g_OwnShipmmsi = wxAtoi(m_pTxt_OwnMMSI->GetValue());
7331 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7332 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7335 g_iNavAidRadarRingsNumberVisible =
7336 pNavAidRadarRingsNumberVisible->GetSelection();
7337 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7338 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7339 g_fNavAidRadarRingsStep = temp_dbl;
7340 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7341 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7342 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7343 g_fWaypointRangeRingsStep = temp_dbl;
7344 g_iWaypointRangeRingsStepUnits =
7345 m_itemWaypointRangeRingsUnits->GetSelection();
7346 g_colourWaypointRangeRingsColour =
7347 m_colourWaypointRangeRingsColour->GetColour();
7348 g_colourWaypointRangeRingsColour =
7349 wxColour(g_colourWaypointRangeRingsColour.Red(),
7350 g_colourWaypointRangeRingsColour.Green(),
7351 g_colourWaypointRangeRingsColour.Blue());
7352 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7353 g_own_ship_sog_cog_calc = pSogCogFromLLCheckBox->GetValue();
7354 g_own_ship_sog_cog_calc_damp_sec = pSogCogFromLLDampInterval->GetValue();
7356 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7358 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7360 if (pCmdSoundString) {
7361 g_CmdSoundString = pCmdSoundString->GetValue();
7362 if (wxIsEmpty(g_CmdSoundString)) {
7363 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7364 pCmdSoundString->SetValue(g_CmdSoundString);
7368 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7369 if (pSoundDeviceIndex)
7370 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7372 g_iSDMMFormat = pSDMMFormat->GetSelection();
7373 g_iDistanceFormat = pDistanceFormat->GetSelection();
7374 g_iSpeedFormat = pSpeedFormat->GetSelection();
7375 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7376 g_iTempFormat = pTempFormat->GetSelection();
7379 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7380 if (pSDefaultBoatSpeed)
7381 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7382 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7383 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7384 getUsrSpeedUnit() +
")");
7386 g_bAdvanceRouteWaypointOnArrivalOnly =
7387 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7389 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7390 g_colourTrackLineColour =
7391 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7392 g_colourTrackLineColour.Blue());
7393 g_nTrackPrecision = pTrackPrecision->GetSelection();
7395 g_bTrackDaily = pTrackDaily->GetValue();
7397 g_track_rotate_time = 0;
7398#if wxUSE_TIMEPICKCTRL
7400 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7401 g_track_rotate_time = h * 3600 + m * 60 + s;
7404 if (pTrackRotateUTC->GetValue())
7405 g_track_rotate_time_type = TIME_TYPE_UTC;
7406 else if (pTrackRotateLMT->GetValue())
7407 g_track_rotate_time_type = TIME_TYPE_LMT;
7409 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7411 g_bHighliteTracks = pTrackHighlite->GetValue();
7414 g_datetime_format =
"UTC";
7416 g_datetime_format =
"Local Time";
7418 if (pEnableZoomToCursor)
7419 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7421 g_btenhertz = pEnableTenHertz->GetValue();
7424 g_bEnableZoomToCursor =
false;
7427 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7428 g_colourOwnshipRangeRingsColour =
7429 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7430 g_colourOwnshipRangeRingsColour.Green(),
7431 g_colourOwnshipRangeRingsColour.Blue());
7434 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7435 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7436 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7437 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7441 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7442 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7443 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7444 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7445 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7446 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7449 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7450 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7451 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7452 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7455 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7457 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7458 if (g_bSyncCogPredictors) {
7459 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7461 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7463 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7464 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7468 for (
const auto& it : g_pAIS->GetTargetList()) {
7469 auto pAISTarget = it.second;
7470 if (NULL != pAISTarget) {
7471 pAISTarget->b_show_track = g_bAISShowTracks;
7473 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
7474 if (pAISTarget->MMSI == g_MMSI_Props_Array[i]->MMSI) {
7476 if (TRACKTYPE_NEVER == props->TrackType) {
7477 pAISTarget->b_show_track =
false;
7479 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7480 pAISTarget->b_show_track =
true;
7487 std::map<int, Track*>::iterator it;
7488 it = g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7489 if (it != g_pAIS->m_persistent_tracks.end())
7490 pAISTarget->b_show_track =
true;
7495 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7496 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7498 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7499 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7501 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7503 m_pText_Scale_Priority->GetValue().ToLong(&l);
7504 g_ShowScaled_Num = (int)l;
7506 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7507 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7508 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7509 long ais_name_scale = 5000;
7510 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7511 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7512 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7513 g_WplAction = m_pWplAction->GetSelection();
7516 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7517 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7518 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7520 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7521 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7524 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7525 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7526 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7528 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7529 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7530 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7531 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7533 bool bchange_scale =
false;
7534 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7535 bchange_scale =
true;
7536 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7538 g_ChartScaleFactorExp =
7539 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7540 g_MarkScaleFactorExp = g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7541 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7542 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7543 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7544 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7546 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7547 g_mouse_zoom_sensitivity =
7552 if (pWayPointMan)
WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7560 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7561 g_bopengl = pOpenGL->GetValue();
7564 g_bChartBarEx = pChartBarEX->GetValue();
7567 int depthUnit = pDepthUnitSelect->GetSelection();
7568 g_nDepthUnitDisplay = depthUnit;
7571 bool bUserStdChange =
false;
7573 int nOBJL = ps57CtlListBox->GetCount();
7575 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7577 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7578 if (marinersStdXref[i] == iPtr) {
7583 assert(itemIndex >= 0);
7584 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7585 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7586 bUserStdChange =
true;
7587 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7593 ps52plib->GenerateStateHash();
7594 long stateHash = ps52plib->GetStateHash();
7596 if (m_returnChanges & GL_CHANGED) {
7599 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7601 ps52plib->ClearCNSYLUPArray();
7602 ps52plib->GenerateStateHash();
7606 enum _DisCat nset = OTHER;
7607 switch (pDispCat->GetSelection()) {
7618 nset = MARINERS_STANDARD;
7621 ps52plib->SetDisplayCategory(nset);
7624 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7625 if (pCheck_ATONTEXT)
7626 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7627 if (pCheck_LDISTEXT)
7628 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7629 if (pCheck_XLSECTTEXT)
7630 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7632 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7633 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7634 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7635 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7636 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7637 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7639 ps52plib->m_nSymbolStyle =
7640 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7642 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7644 : SYMBOLIZED_BOUNDARIES;
7645 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7646 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7648 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7649 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7657 else if (depthUnit == 2)
7660 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7661 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7663 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7667 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7668 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7670 if (m_DeepCtl->GetValue().ToDouble(&dval))
7671 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7673 ps52plib->UpdateMarinerParams();
7674 ps52plib->m_nDepthUnitDisplay = depthUnit;
7676 ps52plib->GenerateStateHash();
7679 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7680 m_returnChanges |= S52_CHANGED;
7682 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7686#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7688 wxString new_canon = _T(
"en_US");
7689 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7691 int nLang =
sizeof(lang_list) /
sizeof(
int);
7692 for (
int it = 0; it < nLang; it++) {
7693 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7695 wxString lang_canonical = pli->CanonicalName;
7696 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7697 if (lang_sel == test_string) {
7698 new_canon = lang_canonical;
7704 wxString locale_old = g_locale;
7705 g_locale = new_canon;
7707 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7709 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7712 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7713 m_returnChanges |= STYLE_CHANGED;
7715 wxSizeEvent nullEvent;
7716 gFrame->OnSize(nullEvent);
7719 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7720 g_bInlandEcdis = pInlandEcdis->GetValue();
7721 SwitchInlandEcdisMode(g_bInlandEcdis);
7722 m_returnChanges |= TOOLBAR_CHANGED;
7727 if (PluginLoader::GetInstance()->UpdatePlugIns())
7728 m_returnChanges |= TOOLBAR_CHANGED;
7732 g_pi_manager->UpdateConfig();
7735 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
7737 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7738 m_groups_changed | k_plugins | k_tides;
7742 TideCurrentDataSet.clear();
7743 int nEntry = tcDataSelected->GetItemCount();
7744 for (
int i = 0; i < nEntry; i++) {
7745 wxString setName = tcDataSelected->GetItemText(i);
7746 TideCurrentDataSet.push_back(setName.ToStdString());
7749 if (g_canvasConfig != m_screenConfig) m_returnChanges |= CONFIG_CHANGED;
7750 g_canvasConfig = m_screenConfig;
7752 gFrame->ProcessOptionsDialog(m_returnChanges, m_pWorkDirList);
7758 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7761 gFrame->RefreshAllCanvas();
7764 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7767 UpdateTemplateTitleText();
7770 ::wxEndBusyCursor();
7773void options::OnXidOkClick(wxCommandEvent& event) {
7776 if (event.GetEventObject() == NULL)
return;
7778 ApplyChanges(event);
7781 gFrame->PrepareOptionsClose(
this, m_returnChanges);
7784 if ((m_returnChanges & CONFIG_CHANGED))
7785 gFrame->ScheduleReconfigAndSettingsReload(
false,
false);
7788 if ((m_returnChanges & FONT_CHANGED) &&
7789 !(m_returnChanges & FONT_CHANGED_SAFE))
7790 gFrame->ScheduleDeleteSettingsDialog();
7796void options::Finish(
void) {
7798 m_pListbook->ChangeSelection(0);
7799 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7800 wxNotebookPage* pg = m_pListbook->GetPage(i);
7801 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7802 if (nb) nb->ChangeSelection(0);
7805 lastWindowPos = GetPosition();
7806 lastWindowSize = GetSize();
7808 pConfig->SetPath(
"/Settings");
7809 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7810 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7813ArrayOfCDI options::GetSelectedChartDirs() {
7815 for (
size_t i = 0; i < panelVector.size(); i++) {
7816 if (panelVector[i]->IsSelected()) {
7817 rv.Add(panelVector[i]->GetCDI());
7824ArrayOfCDI options::GetUnSelectedChartDirs() {
7826 for (
size_t i = 0; i < panelVector.size(); i++) {
7827 if (!panelVector[i]->IsSelected()) {
7828 rv.Add(panelVector[i]->GetCDI());
7835void options::SetDirActionButtons() {
7836 ArrayOfCDI selArray = GetSelectedChartDirs();
7837 if (selArray.GetCount())
7838 m_removeBtn->Enable();
7840 m_removeBtn->Disable();
7843void options::OnButtondeleteClick(wxCommandEvent& event) {
7844 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7845 ActiveChartArray.Clear();
7846 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7847 ActiveChartArray.Add(unselArray[i]);
7850 UpdateChartDirList();
7852 UpdateWorkArrayFromDisplayPanel();
7855 if (m_pWorkDirList) {
7856 pActiveChartsList->DeleteAllItems();
7857 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7858 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7861 li.SetAlign(wxLIST_FORMAT_LEFT);
7862 li.SetText(dirname);
7864 long idx = pActiveChartsList->InsertItem(li);
7869 k_charts |= CHANGE_CHARTS;
7871 pScanCheckBox->Disable();
7876void options::OnButtonParseENC(wxCommandEvent& event) {
7877 gFrame->GetPrimaryCanvas()->EnablePaint(
false);
7879 extern void ParseAllENC(wxWindow * parent);
7881 ParseAllENC(g_pOptions);
7884 gFrame->ChartsRefresh();
7886 gFrame->GetPrimaryCanvas()->EnablePaint(
true);
7892static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
7895 lzma_action action = LZMA_RUN;
7899 uint8_t inbuf[BUFSIZ];
7900 uint8_t outbuf[BUFSIZ];
7913 strm->next_in = NULL;
7915 strm->next_out = outbuf;
7916 strm->avail_out =
sizeof(outbuf);
7922 if (strm->avail_in == 0 && !feof(infile)) {
7923 strm->next_in = inbuf;
7924 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
7926 if (ferror(infile)) {
7927 fprintf(stderr,
"Read error: %s\n", strerror(errno));
7935 if (feof(infile)) action = LZMA_FINISH;
7953 lzma_ret ret = lzma_code(strm, action);
7958 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
7963 size_t write_size =
sizeof(outbuf) - strm->avail_out;
7965 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
7966 fprintf(stderr,
"Write error: %s\n", strerror(errno));
7971 strm->next_out = outbuf;
7972 strm->avail_out =
sizeof(outbuf);
7977 if (ret != LZMA_OK) {
7984 if (ret == LZMA_STREAM_END)
return true;
7995 case LZMA_MEM_ERROR:
7996 msg =
"Memory allocation failed";
7999 case LZMA_DATA_ERROR:
8012 msg =
"File size limits exceeded";
8027 msg =
"Unknown error, possibly a bug";
8031 wxLogMessage(_T(
"LZMA Encoder error: %s (error code %u)\n"), msg, ret);
8038static bool CompressChart(wxString in, wxString out) {
8040 FILE* infile = fopen(in.mb_str(),
"rb");
8041 if (!infile)
return false;
8043 FILE* outfile = fopen(out.mb_str(),
"wb");
8049 lzma_stream strm = LZMA_STREAM_INIT;
8050 bool success =
false;
8051 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
8053 success = compress(&strm, infile, outfile);
8064void options::OnButtonmigrateClick(wxCommandEvent& event) {
8069 new MigrateAssistantDialog(gFrame,
true);
8070 g_migrateDialog->SetSize(gFrame->GetSize());
8071 g_migrateDialog->Centre();
8072 g_migrateDialog->Raise();
8073 g_migrateDialog->ShowModal();
8077void options::OnButtonEcdisHelp(wxCommandEvent& event) {
8078 wxString testFile =
"/doc/iECDIS/index.html";
8080 if (!::wxFileExists(testFile)) {
8081 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
8084 _(
"Would you like to visit the iECDIS Manual website for more "
8087 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
8088 wxYES_NO | wxCENTER, 60)) {
8089 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
8100void options::OnButtoncompressClick(wxCommandEvent& event) {
8102 wxArrayInt pListBoxSelections;
8105 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
8106 wxLIST_STATE_SELECTED);
8107 if (item == -1)
break;
8112 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
8113This may make them incompatible with other programs or older versions of OpenCPN.\n\
8114Compressed charts may take slightly longer to load and display on some systems.\n\
8115They can be decompressed again using unxz or 7 zip programs."),
8116 _(
"OpenCPN Warning"),
8117 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
8121 wxArrayString filespecs;
8122 filespecs.Add(
"*.kap");
8123 filespecs.Add(
"*.KAP");
8124 filespecs.Add(
"*.000");
8127 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
8128 filespecs.Add(
"*.D");
8129 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
8130 filespecs.Add(
"*.Z");
8132 wxGenericProgressDialog prog1(
8133 _(
"OpenCPN Compress Charts"), wxEmptyString,
8134 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
8135 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8136 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8139 wxSize sz = prog1.GetSize();
8140 sz.x = gFrame->GetClientSize().x * 8 / 10;
8143 wxArrayString charts;
8144 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
8145 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
8146 if (dirname.IsEmpty())
continue;
8149 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
8150 (dirname.Last() == wxChar(_T(
'\r'))))
8151 dirname.RemoveLast();
8153 if (!wxDir::Exists(dirname))
continue;
8156 wxArrayString FileList;
8157 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
8158 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
8160 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
8164 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
8165 charts.Add(FileList[j]);
8169 if (charts.GetCount() == 0) {
8170 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
8175 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
8176 wxGenericProgressDialog prog(
8177 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
8178 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8179 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8183 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
8185 prog.Update(i, charts[i], &skip);
8188 wxString compchart = charts[i] + _T(
".xz");
8189 if (CompressChart(charts[i], compchart)) {
8190 total_size += wxFileName::GetSize(charts[i]).ToULong();
8191 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
8192 wxRemoveFile(charts[i]);
8198 double total_size_mb = total_size / 1024.0 / 1024.0;
8199 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
8202 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
8204 count, total_size_mb, total_compressed_size_mb,
8205 total_size_mb - total_compressed_size_mb,
8206 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
8209 UpdateWorkArrayFromTextCtl();
8211 if (m_pWorkDirList) {
8212 pActiveChartsList->DeleteAllItems();
8213 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
8214 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
8217 li.SetAlign(wxLIST_FORMAT_LEFT);
8218 li.SetText(dirname);
8220 long idx = pActiveChartsList->InsertItem(li);
8224 k_charts |= CHANGE_CHARTS;
8226 pScanCheckBox->Disable();
8232void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
8234void options::OnCancelClick(wxCommandEvent& event) {
8235 m_pListbook->ChangeSelection(0);
8236 comm_dialog->CancelSettings();
8238 lastWindowPos = GetPosition();
8239 lastWindowSize = GetSize();
8241 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxCANCEL);
8243 pConfig->SetPath(
"/Settings");
8244 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8245 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8250void options::OnClose(wxCloseEvent& event) {
8252 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
8254 m_pListbook->ChangeSelection(0);
8256 lastWindowPos = GetPosition();
8257 lastWindowSize = GetSize();
8259 pConfig->SetPath(
"/Settings");
8260 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8261 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8263 gFrame->PrepareOptionsClose(
this, m_returnChanges);
8267void options::OnFontChoice(wxCommandEvent& event) {
8268 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8269 m_font_element_array.Add(sel_text_element);
8271 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8272 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8274 m_textSample->SetFont(*pif);
8275 m_textSample->SetForegroundColour(init_color);
8276 m_itemBoxSizerFontPanel->Layout();
8280void options::OnChooseFont(wxCommandEvent& event) {
8282 androidDisableRotation();
8285 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8286 m_font_element_array.Add(sel_text_element);
8287 wxFontData font_data;
8289 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8290 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8292 wxFontData init_font_data;
8293 if (pif) init_font_data.SetInitialFont(*pif);
8294 init_font_data.SetColour(init_color);
8299 wxFont* qFont = dialogFont;
8302 int retval = dg.ShowModal();
8303 if (wxID_CANCEL != retval) {
8304 font_data = dg.GetFontData();
8305 wxFont font = font_data.GetChosenFont();
8306 wxFont* psfont =
new wxFont(font);
8307 wxColor color = font_data.GetColour();
8308 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8309 gFrame->UpdateAllFonts();
8310 m_bfontChanged =
true;
8311 OnFontChoice(event);
8317 wxFontDialog dg(
this, init_font_data);
8319 wxFontDialog dg(pParent, init_font_data);
8322 wxFont* qFont = dialogFont;
8329 wxSize proposed_size = GetSize();
8331 float font_size = dialogFont->GetPointSize();
8333 if ((proposed_size.y / font_size) < n_lines) {
8334 float new_font_size = proposed_size.y / n_lines;
8335 wxFont* smallFont =
new wxFont(*dialogFont);
8336 smallFont->SetPointSize(new_font_size);
8337 dg.SetFont(*smallFont);
8342 dg.SetSize(GetSize());
8346 int retval = dg.ShowModal();
8347 if (wxID_CANCEL != retval) {
8348 font_data = dg.GetFontData();
8349 wxFont font = font_data.GetChosenFont();
8350 wxFont* psfont =
new wxFont(font);
8351 wxColor color = font_data.GetColour();
8352 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8353 gFrame->UpdateAllFonts();
8354 m_bfontChanged =
true;
8355 OnFontChoice(event);
8360 androidEnableRotation();
8366#if defined(__WXGTK__) || defined(__WXQT__)
8367void options::OnChooseFontColor(wxCommandEvent& event) {
8368 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8369 m_font_element_array.Add(sel_text_element);
8371 wxColourData colour_data;
8373 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8374 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8377 androidDisableRotation();
8379 unsigned int cco = 0;
8382 cco |= init_color.Red();
8384 cco |= init_color.Green();
8386 cco |= init_color.Blue();
8387 unsigned int cc = androidColorPicker(cco);
8390 unsigned char blue = (
unsigned char)cc % 256;
8391 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8393 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8394 cn.Set(red, green, blue);
8396 FontMgr::Get().
SetFont(sel_text_element, pif, cn);
8398 gFrame->UpdateAllFonts();
8399 m_bfontChanged =
true;
8401 androidEnableRotation();
8403 wxScrolledWindow* sw =
8404 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8406 wxColourData init_colour_data;
8407 init_colour_data.SetColour(init_color);
8409 wxColourDialog dg(sw, &init_colour_data);
8411 int retval = dg.ShowModal();
8412 if (wxID_CANCEL != retval) {
8413 colour_data = dg.GetColourData();
8415 wxColor color = colour_data.GetColour();
8416 FontMgr::Get().
SetFont(sel_text_element, pif, color);
8418 gFrame->UpdateAllFonts();
8419 m_bfontChanged =
true;
8420 OnFontChoice(event);
8429void options::OnChartsPageChange(wxListbookEvent& event) {
8430 unsigned int i =
event.GetSelection();
8432 UpdateChartDirList();
8437 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8441 UpdateWorkArrayFromDisplayPanel();
8442 groupsPanel->SetDBDirs(*m_pWorkDirList);
8443 groupsPanel->m_treespopulated = FALSE;
8445 if (!groupsPanel->m_settingscomplete) {
8446 ::wxBeginBusyCursor();
8447 groupsPanel->CompleteInitialSettings();
8448 ::wxEndBusyCursor();
8449 }
else if (!groupsPanel->m_treespopulated) {
8450 groupsPanel->PopulateTrees();
8451 groupsPanel->m_treespopulated = TRUE;
8453 }
else if (1 == i) {
8455 if (!m_bVectorInit) {
8456 SetInitialVectorSettings();
8457 UpdateOptionsUnits();
8464void options::OnPageChange(wxListbookEvent& event) {
8465 DoOnPageChange(event.GetSelection());
8468void options::OnSubNBPageChange(wxNotebookEvent& event) {
8471 if (event.GetEventObject()) {
8472 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8473 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8474 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8475 if (
dynamic_cast<wxNotebook*
>(parent)) {
8476 lastSubPage =
event.GetSelection();
8479 if (
dynamic_cast<wxListbook*
>(parent)) {
8480 lastSubPage =
event.GetSelection();
8487void options::OnTopNBPageChange(wxNotebookEvent& event) {
8488 DoOnPageChange(event.GetSelection());
8491void options::DoOnPageChange(
size_t page) {
8492 unsigned int i = page;
8495 if (page > 10)
return;
8503 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8504 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8510 k_charts = VISIT_CHARTS;
8511 UpdateChartDirList();
8514 else if (m_pageConnections == i) {
8516 wxWindow* w = m_pListbook->GetCurrentPage();
8517 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
8520 else if (m_pageUI == i) {
8521 if (!m_itemLangListBox)
return;
8522#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8524 if (!m_bVisitLang) {
8525 ::wxBeginBusyCursor();
8527 int current_language = plocale_def_lang->GetLanguage();
8528 wxString current_sel = wxLocale::GetLanguageName(current_language);
8530 current_sel = GetOCPNKnownLanguage(g_locale);
8532 int nLang =
sizeof(lang_list) /
sizeof(
int);
8535 m_itemLangListBox->Append(_T(
"English (U.S.)"));
8537 wxString lang_dir = g_Platform->GetSharedDataDir() + _T(
"share/locale/");
8538 for (
int it = 1; it < nLang; it++) {
8539 if (wxLocale::IsAvailable(lang_list[it])) {
8540 wxLocale ltest(lang_list[it], 0);
8541 ltest.AddCatalog(_T(
"opencpn"));
8542 if (!ltest.IsLoaded(_T(
"opencpn")))
continue;
8545 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8546 wxString widgets_lang_name = loc_lang_name;
8547 wxString lang_canonical =
8548 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8551 wxString lang_suffix;
8552 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8555 wxString test_dir = lang_dir + lang_suffix;
8556 if (!wxDir::Exists(test_dir))
continue;
8558 m_itemLangListBox->Append(loc_lang_name);
8562 wxArrayString lang_array;
8565 lang_array.Add(_T(
"en_US"));
8566 for (
int it = 0; it < nLang; it++) {
8568 wxLog::EnableLogging(
8571 wxLocale ltest(lang_list[it], 0);
8572#if wxCHECK_VERSION(2, 9, 0)
8574 ltest.AddCatalogLookupPathPrefix(
8575 wxStandardPaths::Get().GetInstallPrefix() +
8576 _T(
"/share/locale" ));
8579 ltest.AddCatalog(_T(
"opencpn"));
8581 wxLog::EnableLogging(TRUE);
8582 if (ltest.IsLoaded(_T(
"opencpn"))) {
8583 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8586 s0 = x->CanonicalName;
8589 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8590 if (wxNOT_FOUND == lang_array.Index(s0)) {
8597 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8599 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8600 m_itemLangListBox->Append(loc_lang_name);
8616 delete plocale_def_lang;
8617 plocale_def_lang =
new wxLocale(current_language);
8619 setlocale(LC_NUMERIC,
"C");
8620 plocale_def_lang->AddCatalog(_T(
"opencpn"));
8622 m_itemLangListBox->SetStringSelection(current_sel);
8625 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8627 wxString clang = pli->Description;
8631 m_bVisitLang = TRUE;
8633 ::wxEndBusyCursor();
8636 }
else if (m_pagePlugins == i) {
8639 auto loader = PluginLoader::GetInstance();
8640 if (LoadAllPlugIns(
false)) {
8641 delete m_pPlugInCtrl;
8642 m_pPlugInCtrl = NULL;
8643 delete m_PluginCatalogMgrPanel;
8644 m_PluginCatalogMgrPanel = NULL;
8645 itemBoxSizerPanelPlugins->Clear();
8648 if (!m_pPlugInCtrl) {
8650 ::wxBeginBusyCursor();
8653 wxDefaultPosition, wxDefaultSize);
8654 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8655 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8656 wxEXPAND | wxGROW | wxALL, 4);
8657 if (g_pi_manager) g_pi_manager->SetListPanelPtr(m_pPlugInCtrl);
8660 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8662 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8663 wxEXPAND | wxALL, 4);
8664 itemBoxSizerPanelPlugins->Layout();
8667 m_pPlugInCtrl->UpdateSelections();
8669 ::wxEndBusyCursor();
8671 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8674 k_plugins = TOOLBAR_CHANGED;
8678wxString options::SelectSoundFile() {
8679 wxString sound_dir = g_Platform->GetSharedDataDir();
8680 sound_dir.Append(_T(
"sounds"));
8685 wxFileDialog* popenDialog =
new wxFileDialog(
8686 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8687 _T(
"WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN);
8689 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8691 response = popenDialog->ShowModal();
8692 sel_file = popenDialog->GetPath();
8697 g_Platform->DoFileSelectorDialog(
this, &sel_file, _(
"Select Sound File"),
8698 sound_dir, wxEmptyString, wxT(
"*.*"));
8701 if (response == wxID_OK)
8702 return g_Platform->NormalizePath(sel_file);
8707void options::OnButtonSelectSound(wxCommandEvent& event) {
8708 wxString sel_file = SelectSoundFile();
8710 if (!sel_file.IsEmpty()) {
8711 g_sAIS_Alert_Sound_File = g_Platform->NormalizePath(sel_file);
8715void options::OnButtonTestSound(wxCommandEvent& event) {
8716 auto sound = SoundFactory();
8717 auto cmd_sound =
dynamic_cast<SystemCmdSound*
>(sound);
8718 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8720 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8724wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8725 wxString return_string;
8726 wxString dir_suffix;
8728#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8730 if (lang_canonical == _T(
"en_US")) {
8731 dir_suffix = _T(
"en");
8732 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8734 }
else if ((lang_canonical == _T(
"cs_CZ")) || (lang_canonical == _T(
"cs"))) {
8735 dir_suffix = _T(
"cs");
8736 return_string = wxString(
"Čeština", wxConvUTF8);
8738 }
else if ((lang_canonical == _T(
"da_DK")) || (lang_canonical == _T(
"da"))) {
8739 dir_suffix = _T(
"da");
8740 return_string = wxString(
"Dansk", wxConvUTF8);
8742 }
else if ((lang_canonical == _T(
"de_DE")) || (lang_canonical == _T(
"de"))) {
8743 dir_suffix = _T(
"de");
8744 return_string = wxString(
"Deutsch", wxConvUTF8);
8746 }
else if ((lang_canonical == _T(
"et_EE")) || (lang_canonical == _T(
"et"))) {
8747 dir_suffix = _T(
"et");
8748 return_string = wxString(
"Eesti", wxConvUTF8);
8750 }
else if ((lang_canonical == _T(
"es_ES")) || (lang_canonical == _T(
"es"))) {
8751 dir_suffix = _T(
"es");
8752 return_string = wxString(
"Español", wxConvUTF8);
8754 }
else if ((lang_canonical == _T(
"fr_FR")) || (lang_canonical == _T(
"fr"))) {
8755 dir_suffix = _T(
"fr");
8756 return_string = wxString(
"Français", wxConvUTF8);
8758 }
else if ((lang_canonical == _T(
"it_IT")) || (lang_canonical == _T(
"it"))) {
8759 dir_suffix = _T(
"it");
8760 return_string = wxString(
"Italiano", wxConvUTF8);
8762 }
else if ((lang_canonical == _T(
"nl_NL")) || (lang_canonical == _T(
"nl"))) {
8763 dir_suffix = _T(
"nl");
8764 return_string = wxString(
"Nederlands", wxConvUTF8);
8766 }
else if ((lang_canonical == _T(
"pl_PL")) || (lang_canonical == _T(
"pl"))) {
8767 dir_suffix = _T(
"pl");
8768 return_string = wxString(
"Polski", wxConvUTF8);
8770 }
else if ((lang_canonical == _T(
"pt_PT")) || (lang_canonical == _T(
"pt"))) {
8771 dir_suffix = _T(
"pt_PT");
8772 return_string = wxString(
"Português", wxConvUTF8);
8774 }
else if ((lang_canonical == _T(
"pt_BR")) ||
8775 (lang_canonical == _T(
"pt_BR"))) {
8776 dir_suffix = _T(
"pt_BR");
8777 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8779 }
else if ((lang_canonical == _T(
"ru_RU")) || (lang_canonical == _T(
"ru"))) {
8780 dir_suffix = _T(
"ru");
8781 return_string = wxString(
"Русский", wxConvUTF8);
8783 }
else if ((lang_canonical == _T(
"sv_SE")) || (lang_canonical == _T(
"sv"))) {
8784 dir_suffix = _T(
"sv");
8785 return_string = wxString(
"Svenska", wxConvUTF8);
8787 }
else if ((lang_canonical == _T(
"fi_FI")) || (lang_canonical == _T(
"fi"))) {
8788 dir_suffix = _T(
"fi_FI");
8789 return_string = wxString(
"Suomi", wxConvUTF8);
8791 }
else if ((lang_canonical == _T(
"nb_NO")) || (lang_canonical == _T(
"nb"))) {
8792 dir_suffix = _T(
"nb_NO");
8793 return_string = wxString(
"Norsk", wxConvUTF8);
8795 }
else if ((lang_canonical == _T(
"tr_TR")) || (lang_canonical == _T(
"tr"))) {
8796 dir_suffix = _T(
"tr_TR");
8797 return_string = wxString(
"Türkçe", wxConvUTF8);
8799 }
else if ((lang_canonical == _T(
"el_GR")) || (lang_canonical == _T(
"el"))) {
8800 dir_suffix = _T(
"el_GR");
8801 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8803 }
else if ((lang_canonical == _T(
"hu_HU")) || (lang_canonical == _T(
"hu"))) {
8804 dir_suffix = _T(
"hu_HU");
8805 return_string = wxString(
"Magyar", wxConvUTF8);
8807 }
else if ((lang_canonical == _T(
"zh_TW")) ||
8808 (lang_canonical == _T(
"zh_TW"))) {
8809 dir_suffix = _T(
"zh_TW");
8810 return_string = wxString(
"正體字", wxConvUTF8);
8812 }
else if ((lang_canonical == _T(
"zh_CN")) ||
8813 (lang_canonical == _T(
"zh_CN"))) {
8814 dir_suffix = _T(
"zh_CN");
8815 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8817 }
else if ((lang_canonical == _T(
"ca_ES")) || (lang_canonical == _T(
"ca"))) {
8818 dir_suffix = _T(
"ca_ES");
8819 return_string = wxString(
"Catalan", wxConvUTF8);
8821 }
else if ((lang_canonical == _T(
"gl_ES")) ||
8822 (lang_canonical == _T(
"gl_ES"))) {
8823 dir_suffix = _T(
"gl_ES");
8824 return_string = wxString(
"Galician", wxConvUTF8);
8826 }
else if ((lang_canonical == _T(
"ja_JP")) ||
8827 (lang_canonical == _T(
"ja_JP"))) {
8828 dir_suffix = _T(
"ja_JP");
8829 return_string = wxString(
"Japanese", wxConvUTF8);
8831 }
else if ((lang_canonical == _T(
"vi_VN")) ||
8832 (lang_canonical == _T(
"vi_VN"))) {
8833 dir_suffix = _T(
"vi_VN");
8834 return_string = wxString(
"Vietnamese", wxConvUTF8);
8837 dir_suffix = lang_canonical;
8838 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8840 return_string = info->Description;
8842 return_string = lang_canonical;
8845 lang_dir = dir_suffix;
8847 return return_string;
8850wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8852 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8855ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8856 ChartGroupArray* d =
new ChartGroupArray;
8857 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8860 pdg->m_group_name = psg->m_group_name;
8861 pdg->m_element_array.reserve(psg->m_element_array.size());
8863 for (
auto& elem : psg->m_element_array)
8864 pdg->m_element_array.push_back(elem);
8871void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8881EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8882EVT_NOTEBOOK_PAGE_CHANGED(
8884 ChartGroupsUI::OnGroupPageChange)
8888 m_GroupSelectedPage = -1;
8889 m_pActiveChartsTree = 0;
8891 lastSelectedCtl = NULL;
8892 allAvailableCtl = NULL;
8893 defaultAllCtl = NULL;
8895 m_pAddButton = NULL;
8896 m_pRemoveButton = NULL;
8897 m_pDeleteGroupButton = NULL;
8898 m_pNewGroupButton = NULL;
8899 m_pGroupArray = NULL;
8902 m_UIcomplete =
false;
8903 m_treespopulated =
false;
8907ChartGroupsUI::~ChartGroupsUI(
void) {
8908 m_DirCtrlArray.Clear();
8909 m_GroupNB->Disconnect(
8910 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
8911 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
8916void ChartGroupsUI::SetInitialSettings(
void) {
8917 m_settingscomplete = FALSE;
8918 m_treespopulated = FALSE;
8921void ChartGroupsUI::PopulateTrees(
void) {
8924 wxArrayString dir_array;
8925 int nDir = m_db_dirs.GetCount();
8926 for (
int i = 0; i < nDir; i++) {
8927 wxString dirname = m_db_dirs[i].fullpath;
8928 if (!dirname.IsEmpty()) dir_array.Add(dirname);
8931 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array,
8932 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
8934 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
8938 wxArrayString dir_array0;
8939 int nDir0 = m_db_dirs.GetCount();
8940 for (
int i = 0; i < nDir0; i++) {
8941 wxString dirname = m_db_dirs[i].fullpath;
8942 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
8944 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
8945 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
8948void ChartGroupsUI::CompleteInitialSettings(
void) {
8951 BuildNotebookPages(m_pGroupArray);
8953 m_panel->GetSizer()->Layout();
8955 m_settingscomplete = TRUE;
8956 m_treespopulated = TRUE;
8959void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
8960 const wxArrayString& dir_array,
8961 const wxColour& col, wxFont* pFont) {
8962 ptc->DeleteAllItems();
8964 wxDirItemData* rootData =
new wxDirItemData(_T(
"Dummy"), _T(
"Dummy"), TRUE);
8966 rootName = _T(
"Dummy");
8967 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
8968 ptc->SetItemHasChildren(m_rootId);
8971 int nDir = dir_array.GetCount();
8972 for (
int i = 0; i < nDir; i++) {
8973 wxString dirname = dir_array[i];
8974 if (!dirname.IsEmpty()) {
8975 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
8976 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
8979 ptc->SetItemText(
id, dirname);
8980 if (pFont) ptc->SetItemFont(
id, *pFont);
8984 ptc->SetItemTextColour(
id, col);
8986 ptc->SetItemHasChildren(
id);
8991void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
8992 wxString insert_candidate = allAvailableCtl->GetPath();
8993 if (!insert_candidate.IsEmpty()) {
8994 if (m_DirCtrlArray.GetCount()) {
8995 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8996 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8998 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9000 if (ptree->IsEmpty()) {
9001 wxDirItemData* rootData =
9002 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9003 wxString rootName = _T(
"Dummy");
9004 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9006 ptree->SetItemHasChildren(rootId);
9009 wxTreeItemId root_Id = ptree->GetRootItem();
9010 wxDirItemData* dir_item =
9011 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
9013 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
9014 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
9017 pGroup->m_element_array.push_back({insert_candidate});
9022 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9023 m_pAddButton->Disable();
9025 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9027 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9028 if (ptree) ptree->Refresh();
9032void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
9033 if (m_DirCtrlArray.GetCount()) {
9034 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9035 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9038 wxString sel_item = pDirCtrl->GetPath();
9040 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9041 if (ptree && ptree->GetCount()) {
9042 wxTreeItemId
id = ptree->GetSelection();
9043 lastDeletedItem = id;
9045 wxString branch_adder;
9046 int group_item_index =
9047 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
9048 if (group_item_index >= 0) {
9050 pGroup->m_element_array[group_item_index];
9051 bool b_duplicate = FALSE;
9052 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
9054 if (pelement.m_missing_name_array[k] == sel_item) {
9060 pelement.m_missing_name_array.Add(sel_item);
9066 if (branch_adder == _T(
"")) {
9068 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
9071 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
9077 lastSelectedCtl->Unselect();
9078 lastSelectedCtl = 0;
9079 m_pRemoveButton->Disable();
9081 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9083 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9084 if (ptree) ptree->Refresh();
9092void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
9093 m_GroupSelectedPage =
event.GetSelection();
9094 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9095 if (lastSelectedCtl) {
9096 lastSelectedCtl->UnselectAll();
9097 lastSelectedCtl = 0;
9099 m_pRemoveButton->Disable();
9100 m_pAddButton->Disable();
9103 if (m_GroupSelectedPage == 0) {
9104 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
9106 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
9110void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
9111 wxObject* evtObj =
event.GetEventObject();
9112 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
9113 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
9114 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9115 m_pAddButton->Enable();
9117 m_pAddButton->Disable();
9120 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
9121 if (!lastSelectedCtl)
goto out;
9122 wxTreeItemId item = lastSelectedCtl->GetSelection();
9123 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9126 wxGenericDirCtrl* dirCtrl =
9127 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
9128 if (!dirCtrl)
goto out;
9129 wxString itemPath = dirCtrl->GetPath();
9130 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
9132 m_pRemoveButton->Disable();
9140void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
9141 wxTextEntryDialog* pd =
new wxTextEntryDialog();
9143 pd->SetFont(*qFont);
9145 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
9148 androidDisableRotation();
9151 if (pd->ShowModal() == wxID_OK) {
9152 if (pd->GetValue().Length()) {
9153 AddEmptyGroupPage(pd->GetValue());
9155 pGroup->m_group_name = pd->GetValue();
9156 m_pGroupArray->Add(pGroup);
9158 m_GroupSelectedPage =
9159 m_GroupNB->GetPageCount() - 1;
9160 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
9161 m_pDeleteGroupButton->Enable();
9168 androidEnableRotation();
9172void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
9173 if (0 != m_GroupSelectedPage) {
9174 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
9175 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
9176 m_GroupNB->DeletePage(m_GroupSelectedPage);
9179 if (m_GroupSelectedPage <= 0) {
9180 m_pAddButton->Disable();
9181 m_pDeleteGroupButton->Disable();
9185int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
9186 wxTreeItemId item, wxString* pbranch_adder) {
9187 wxString branch_name;
9188 wxString branch_adder;
9190 wxTreeItemId current_node = item;
9191 while (current_node.IsOk()) {
9192 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
9193 if (!parent_node)
break;
9195 if (parent_node == ptree->GetRootItem()) {
9196 branch_name = ptree->GetItemText(current_node);
9200 branch_adder.Prepend(ptree->GetItemText(current_node));
9201 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
9203 current_node = ptree->GetItemParent(current_node);
9207 unsigned int target_item_index = -1;
9209 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
9210 const wxString& target = pGroup->m_element_array[i].m_element_name;
9211 if (branch_name == target) {
9212 target_item_index = i;
9217 if (pbranch_adder) *pbranch_adder = branch_adder;
9219 return target_item_index;
9222void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
9223 wxTreeItemId node =
event.GetItem();
9225 if (m_GroupSelectedPage <= 0)
return;
9226 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9227 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9228 if (!pDirCtrl)
return;
9230 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9231 wxString branch_adder;
9232 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
9233 if (target_item_index < 0)
return;
9235 pGroup->m_element_array[target_item_index];
9236 const wxString& branch_name = target_element.m_element_name;
9240 if (!target_element.m_missing_name_array.GetCount())
return;
9241 wxString full_root = branch_name;
9242 full_root += branch_adder;
9243 full_root += wxString(wxFILE_SEP_PATH);
9245 wxTreeItemIdValue cookie;
9246 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
9247 while (child.IsOk()) {
9248 wxString target_string = full_root;
9249 target_string += ptree->GetItemText(child);
9251 for (
unsigned int k = 0; k < target_element.m_missing_name_array.GetCount();
9253 if (target_element.m_missing_name_array[k] == target_string) {
9254 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
9258 child = ptree->GetNextChild(node, cookie);
9262void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
9265 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
9267 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
9270 int nItems = pGroup->m_element_array.size();
9271 for (
int i = 0; i < nItems; i++) {
9272 const wxString& itemname = pGroup->m_element_array[i].m_element_name;
9273 if (!itemname.IsEmpty()) {
9274 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
9276 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
9278 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
9284wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
9285 wxGenericDirCtrl* GroupDirCtl =
9286 new wxGenericDirCtrl(m_GroupNB, wxID_ANY, _T(
"TESTDIR"));
9287 m_GroupNB->AddPage(GroupDirCtl, label);
9289 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
9290 ptree->DeleteAllItems();
9292 wxDirItemData* rootData =
9293 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9294 wxString rootName = _T(
"Dummy");
9295 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9296 ptree->SetItemHasChildren(rootId);
9298 m_DirCtrlArray.Add(GroupDirCtl);
9303void ChartGroupsUI::ClearGroupPages() {
9304 if (m_GroupNB->GetPageCount() == 0)
return;
9306 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
9307 m_DirCtrlArray.RemoveAt(i);
9308 m_GroupNB->DeletePage(i);
9312void options::OnInsertTideDataLocation(wxCommandEvent& event) {
9314 int response = wxID_CANCEL;
9317 wxFileDialog* popenDialog =
new wxFileDialog(
9318 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir, wxT(
""),
9319 wxT(
"Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All ")
9320 wxT(
"files (*.*)|*.*"),
9323 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
9325 response = popenDialog->ShowModal();
9326 sel_file = popenDialog->GetPath();
9331 response = g_Platform->DoFileSelectorDialog(
this, &path,
9332 _(
"Select Tide/Current Data"),
9333 g_TCData_Dir, _T(
""), wxT(
"*.*"));
9337 if (response == wxID_OK) {
9339 int id = tcDataSelected->GetItemCount();
9341 long idx = tcDataSelected->InsertItem(li);
9342 tcDataSelected->SetItem(
id, 0, g_Platform->NormalizePath(sel_file));
9345 wxFileName fn(sel_file);
9346 wxString data_dir = fn.GetPath();
9347 g_TCData_Dir = g_Platform->NormalizePath(data_dir);
9351void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9354 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9355 wxLIST_STATE_SELECTED);
9356 if (item == -1)
break;
9357 tcDataSelected->DeleteItem(item);
9363enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9366BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9367EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9368EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9371OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9372 : wxDialog(parent, wxID_ANY, _T( "OpenGL Options" ), wxDefaultPosition,
9374 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9379 m_brebuild_cache(FALSE) {
9382 SetFont(*dialogFont);
9384 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9385 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9387 m_cbTextureCompression =
9388 new wxCheckBox(
this, wxID_ANY,
9389 g_bGLexpert ? _(
"Texture Compression")
9390 : _(
"Texture Compression with Caching"));
9391 m_cbTextureCompressionCaching =
9392 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9394 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9395 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9396 m_sTextureMemorySize->SetRange(1, 16384);
9398 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9399 wxButton* btnRebuild =
9400 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9401 wxButton* btnClear =
9402 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9403 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9404 if (!g_bopengl || g_raster_format == GL_RGB) btnRebuild->Disable();
9405 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9406 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9407 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9409 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9410 m_cbUseAcceleratedPanning =
9411 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9413 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9414 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9415 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9416 flexSizer->AddSpacer(0);
9417 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9418 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9419 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9420 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9421 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9422 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9423 flexSizer->AddSpacer(0);
9424 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9425 flexSizer->AddSpacer(0);
9426 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9427 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9428 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9429 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9430 flexSizer->AddSpacer(0);
9431 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9432 flexSizer->AddSpacer(0);
9433 flexSizer->AddSpacer(0);
9434 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9435 flexSizer->AddSpacer(0);
9436 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9437 flexSizer->AddGrowableCol(1);
9438 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9440 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9441 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9442 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9443 btnSizer->Realize();
9445 mainSizer->AddStretchSpacer();
9446 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9450 SetSizer(mainSizer);
9451 mainSizer->SetSizeHints(
this);
9455bool OpenGLOptionsDlg::GetAcceleratedPanning(
void)
const {
9456 return m_cbUseAcceleratedPanning->GetValue();
9459bool OpenGLOptionsDlg::GetTextureCompression(
void)
const {
9460 return m_cbTextureCompression->GetValue();
9463bool OpenGLOptionsDlg::GetPolygonSmoothing(
void)
const {
9464 return m_cbPolygonSmoothing->GetValue();
9467bool OpenGLOptionsDlg::GetLineSmoothing(
void)
const {
9468 return m_cbLineSmoothing->GetValue();
9471bool OpenGLOptionsDlg::GetSoftwareGL(
void)
const {
9472 return m_cbSoftwareGL->GetValue();
9475bool OpenGLOptionsDlg::GetTextureCompressionCaching(
void)
const {
9476 return m_cbTextureCompressionCaching->GetValue();
9479bool OpenGLOptionsDlg::GetRebuildCache(
void)
const {
return m_brebuild_cache; }
9481int OpenGLOptionsDlg::GetTextureMemorySize(
void)
const {
9482 return m_sTextureMemorySize->GetValue();
9485void OpenGLOptionsDlg::Populate(
void) {
9486 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9494 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9495 m_memorySize->Show(g_bGLexpert);
9496 m_sTextureMemorySize->Show(g_bGLexpert);
9498 m_cbTextureCompressionCaching->SetValue(
9499 g_GLOptions.m_bTextureCompressionCaching);
9500 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9502 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9503 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9505#if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9506 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9507 if (gFrame->GetPrimaryCanvas()
9509 ->GetVersionString()
9511 .Find(_T(
"MESA" )) != wxNOT_FOUND)
9512 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9515 m_cbSoftwareGL->Hide();
9519 SetFont(*dialogFont);
9522 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9523 if (gFrame->GetPrimaryCanvas()->GetglCanvas()->CanAcceleratePanning()) {
9524 m_cbUseAcceleratedPanning->Enable();
9525 m_cbUseAcceleratedPanning->SetValue(
9526 g_GLOptions.m_bUseAcceleratedPanning);
9528 m_cbUseAcceleratedPanning->SetValue(FALSE);
9529 m_cbUseAcceleratedPanning->Disable();
9532 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9535 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9536 m_cbUseAcceleratedPanning->Disable();
9540void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9541 if (g_GLOptions.m_bTextureCompressionCaching) {
9542 m_brebuild_cache = TRUE;
9543 EndModal(wxID_CANCEL);
9547void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9548 if (g_bopengl && g_glTextureManager) {
9549 ::wxBeginBusyCursor();
9550 g_glTextureManager->ClearAllRasterTextures();
9553 appendOSDirSlash(&path);
9554 path.append(_T(
"raster_texture_cache"));
9556 if (::wxDirExists(path)) {
9557 wxArrayString files;
9558 size_t nfiles = wxDir::GetAllFiles(path, &files);
9559 for (
unsigned int i = 0; i < files.GetCount(); i++)
9560 ::wxRemoveFile(files[i]);
9563 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9564 ::wxEndBusyCursor();
9568wxString OpenGLOptionsDlg::GetTextureCacheSize(
void) {
9570 appendOSDirSlash(&path);
9571 path.append(_T(
"raster_texture_cache"));
9572 long long total = 0;
9574 if (::wxDirExists(path)) {
9575 wxArrayString files;
9576 size_t nfiles = wxDir::GetAllFiles(path, &files);
9577 for (
unsigned int i = 0; i < files.GetCount(); i++)
9578 total += wxFile(files[i]).Length();
9580 double mb = total / (1024.0 * 1024.0);
9581 if (mb < 10000.0)
return wxString::Format(_T(
"%.1f MB" ), mb);
9583 return wxString::Format(_T(
"%.1f GB" ), mb);
9591EVT_PAINT(CanvasConfigSelect::OnPaint)
9595 wxWindowID
id, wxBitmap& bmp,
9596 const wxPoint& pos, const wxSize& size)
9597 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9598 m_parentOptions = parentOptions;
9603 int refHeight = GetCharHeight();
9605 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9606 bmp.GetSize().y + m_borderWidth * 2));
9608 Connect(wxEVT_LEFT_DOWN,
9609 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9612CanvasConfigSelect::~CanvasConfigSelect() {}
9614void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9620 if (m_parentOptions)
9621 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9624void CanvasConfigSelect::SetSelected(
bool selected) {
9625 m_bSelected = selected;
9629 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9632 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9638void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9640 GetSize(&width, &height);
9643 dc.SetBackground(*wxLIGHT_GREY);
9645 dc.SetPen(*wxTRANSPARENT_PEN);
9646 dc.SetBrush(wxBrush(GetBackgroundColour()));
9647 dc.DrawRectangle(GetVirtualSize());
9650 dc.SetBrush(wxBrush(m_boxColour));
9652 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9654 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9656 dc.SetBrush(wxBrush(m_boxColour));
9658 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9660 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9663 dc.DrawBitmap(m_bmpNormal, m_borderWidth, m_borderWidth,
false);
bool g_bresponsive
Flag to control adaptive UI scaling.
Global state for AIS decoder.
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.
const void Notify()
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.
static double ui_to_config(int slider_pos)
Convert a slider scale 1-100 value to configuration value 1.02..3.0.
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, 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.
Global variables reflecting command line options and arguments.
The ConnectionsDlg class.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
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.