44#include <wx/clrpicker.h>
47#include <wx/display.h>
48#include <wx/fontdata.h>
49#include <wx/fontdlg.h>
50#include <wx/imaglist.h>
51#include <wx/listbox.h>
52#include <wx/mediactrl.h>
53#include <wx/odcombo.h>
54#include <wx/progdlg.h>
55#include <wx/radiobox.h>
57#include <wx/renderer.h>
58#include <wx/statline.h>
59#include <wx/stdpaths.h>
60#include <wx/textwrapper.h>
61#include <wx/tokenzr.h>
63#include "conn_params_panel.h"
65#if defined(__WXGTK__) || defined(__WXQT__)
66#include <wx/colordlg.h>
70#include "ocpn_fontdlg.h"
75#include "model/ais_decoder.h"
77#include "model/ais_target_data.h"
79#include "model/comm_drv_factory.h"
80#include "model/comm_util.h"
81#include "model/config_vars.h"
82#include "model/idents.h"
83#include "model/multiplexer.h"
84#include "model/navutil_base.h"
85#include "model/own_ship.h"
86#include "model/routeman.h"
87#include "model/ser_ports.h"
88#include "model/wx28compat.h"
91#include "chart_ctx_factory.h"
96#include "connections_dlg.h"
102#include "observable_evtvar.h"
103#include "observable_globvar.h"
104#include "ocpn_frame.h"
105#include "OCPNPlatform.h"
106#include "OCPN_Sound.h"
110#include "SoundFactory.h"
112#include "svg_utils.h"
113#include "SystemCmdSound.h"
114#include "usb_devices.h"
115#include "waypointman_gui.h"
118#include "glChartCanvas.h"
119extern GLuint g_raster_format;
127#include "androidUTIL.h"
131#include <QtWidgets/QScroller>
135#if wxCHECK_VERSION(3, 2, 0)
136#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
138#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS
141#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
144wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
146wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
151extern bool g_bSoftwareGL;
153extern bool g_bShowOutlines;
154extern bool g_bShowChartBar;
155extern bool g_bShowDepthUnits;
156extern bool g_bskew_comp;
157extern bool g_bopengl;
158extern bool g_bChartBarEx;
159extern bool g_bsmoothpanzoom;
160extern int g_chart_zoom_modifier_raster;
161extern int g_chart_zoom_modifier_vector;
162extern bool g_bUIexpert;
164extern wxString* pInit_Chart_Dir;
170extern bool g_bDisplayGrid;
173extern bool g_bShowLiveETA;
174extern double g_defaultBoatSpeed;
175extern double g_defaultBoatSpeedUserUnit;
177extern int g_iNavAidRadarRingsNumberVisible;
178extern bool g_bNavAidRadarRingsShown;
179extern float g_fNavAidRadarRingsStep;
180extern int g_pNavAidRadarRingsStepUnits;
181extern bool g_bWayPointPreventDragging;
182extern wxColour g_colourOwnshipRangeRingsColour;
183extern bool g_bShowShipToActive;
184extern int g_shipToActiveStyle;
185extern int g_shipToActiveColor;
187extern bool g_own_ship_sog_cog_calc;
188extern int g_own_ship_sog_cog_calc_damp_sec;
190extern bool g_bPreserveScaleOnX;
191extern bool g_bPlayShipsBells;
193extern wxString g_CmdSoundString;
195extern int g_iSoundDeviceIndex;
196extern bool g_bFullscreenToolbar;
197extern bool g_bTransparentToolbar;
198extern bool g_bTransparentToolbarInOpenGLOK;
200extern int g_OwnShipIconType;
201extern double g_n_ownship_length_meters;
202extern double g_n_ownship_beam_meters;
203extern double g_n_gps_antenna_offset_y;
204extern double g_n_gps_antenna_offset_x;
205extern int g_n_ownship_min_mm;
207extern bool g_bEnableZoomToCursor;
208extern bool g_bHighliteTracks;
209extern wxColour g_colourTrackLineColour;
211extern bool g_bAdvanceRouteWaypointOnArrivalOnly;
213extern int g_cm93_zoom_factor;
215extern int g_COGAvgSec;
217extern bool g_bCourseUp;
218extern bool g_bLookAhead;
220extern double g_ownship_predictor_minutes;
221extern double g_ownship_HDTpredictor_miles;
223extern bool g_bQuiltEnable;
224extern bool g_bFullScreenQuilt;
225extern bool g_bConfirmObjectDelete;
228extern wxLocale* plocale_def_lang;
231extern double g_mouse_zoom_sensitivity;
232extern int g_mouse_zoom_sensitivity_ui;
234extern OcpnSound* g_anchorwatch_sound;
236extern bool g_fog_overzoom;
237extern bool g_oz_vector_scale;
238extern bool g_bShowStatusBar;
240extern s52plib* ps52plib;
242extern wxString g_locale;
244extern ChartGroupArray* g_pGroupArray;
251extern bool g_bGLexpert;
253#define ID_CHOICE_NMEA wxID_HIGHEST + 1
255extern std::vector<std::string> TideCurrentDataSet;
256extern wxString g_TCData_Dir;
260extern bool g_bShowMenuBar;
261extern bool g_bShowCompassWin;
263extern bool g_bresponsive;
264extern bool g_bAutoHideToolbar;
265extern int g_nAutoHideToolbar;
266extern int g_GUIScaleFactor;
267extern int g_ChartScaleFactor;
268extern float g_MarkScaleFactorExp;
269extern bool g_bRollover;
270extern int g_ShipScaleFactor;
271extern float g_ShipScaleFactorExp;
272extern int g_ENCSoundingScaleFactor;
273extern int g_ENCTextScaleFactor;
274extern bool g_bShowMuiZoomButtons;
276extern std::vector<size_t> g_config_display_size_mm;
277extern bool g_config_display_size_manual;
278extern unsigned int g_canvasConfig;
280extern wxString g_lastAppliedTemplateGUID;
281extern wxString g_default_wp_icon;
282extern int osMajor, osMinor;
283extern bool g_bShowMuiZoomButtons;
287extern int g_Android_SDK_Version;
288extern MigrateAssistantDialog* g_migrateDialog;
291extern wxString GetShipNameFromFile(
int);
293WX_DEFINE_ARRAY_PTR(
ChartCanvas*, arrayofCanvasPtr);
294extern arrayofCanvasPtr g_canvasArray;
297static int lang_list[] = {
298 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
299 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
300 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
301 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
302 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
303 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
304 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
305 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
307 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
308 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
309 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
310 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
311 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
312 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
320 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
321 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
322 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
323 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
324 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
325 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
326 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
327 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
328 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
329 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
330 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
331 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
332 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
333 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
334 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
335 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
336 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
337 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
338 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
339 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
340 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
341 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
342 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
343 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
344 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
347 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
348 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
349 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
350 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
351 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
353 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
354 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
355 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
356 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
357 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
358 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
359 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
360 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
361 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
362 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
363 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
364 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
365 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
366 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
367 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
368 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
369 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
370 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
371 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
373 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
374 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
375 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
376 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
377 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
378 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
379 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
380 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
381 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
382 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
383 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
384 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
385 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
389void prepareSlider(wxSlider* slider) {
390 slider->GetHandle()->setStyleSheet(
391 prepareAndroidSliderStyleSheet(slider->GetSize().x));
392 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
393 slider->GetHandle()->grabGesture(Qt::PanGesture);
394 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
399int wxCALLBACK SortConnectionOnPriority(wxIntPtr item1, wxIntPtr item2,
401 wxListCtrl* lc =
reinterpret_cast<wxListCtrl*
>(list);
404 it1.SetId(lc->FindItem(-1, item1));
406 it1.SetMask(it1.GetMask() | wxLIST_MASK_TEXT);
408 it2.SetId(lc->FindItem(-1, item2));
410 it2.SetMask(it2.GetMask() | wxLIST_MASK_TEXT);
416 return it1.GetText().CmpNoCase(it2.GetText());
418 return it2.GetText().CmpNoCase(it1.GetText());
431 wxString textMod = text;
432 textMod.Replace(
" ",
"^");
435 wxString sep = wxFileName::GetPathSeparator();
436 textMod.Replace(sep,
" ");
438 Wrap(win, textMod, widthMax);
441 for (
size_t i = 0; i < m_array.GetCount(); i++) {
442 wxString a = m_array[i];
444 if (m_array.GetCount() > 1) {
445 if (i < m_array.GetCount() - 1) a += sep;
451 wxString
const& GetWrapped()
const {
return m_wrapped; }
452 int const GetLineCount()
const {
return m_lineCount; }
453 wxArrayString GetLineArray() {
return m_array; }
456 virtual void OnOutputLine(
const wxString& line) {
460 virtual void OnNewLine() {
468 wxArrayString m_array;
477 void DoChartSelected();
478 void SetSelected(
bool selected);
479 void OnPaint(wxPaintEvent& event);
481 void OnSize(wxSizeEvent& event);
483 int GetUnselectedHeight() {
return m_unselectedHeight; }
484 int GetRefHeight() {
return m_refHeight; }
485 bool IsSelected() {
return m_bSelected; }
486 void OnClickDown(wxMouseEvent& event);
487 void OnClickUp(wxMouseEvent& event);
492 wxColour m_boxColour;
493 int m_unselectedHeight;
494 wxString m_pChartDir;
498 DECLARE_EVENT_TABLE()
502EVT_PAINT(OCPNChartDirPanel::OnPaint)
504EVT_SIZE(OCPNChartDirPanel::OnSize)
508 const wxPoint& pos, const wxSize& size,
510 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
511 m_pChartDir = cdi.fullpath;
514 if (cdi.fullpath.StartsWith(
515 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
516 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
521 m_refHeight = GetCharHeight();
523 m_unselectedHeight = 2 * m_refHeight;
529 SetMinSize(wxSize(-1, m_unselectedHeight));
531 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
534 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
539OCPNChartDirPanel::~OCPNChartDirPanel() {}
541static wxStopWatch swclick;
543static int downx, downy;
546void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
549 event.GetPosition(&downx, &downy);
555void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
557 qDebug() << swclick.Time();
558 if (swclick.Time() < 200) {
560 event.GetPosition(&upx, &upy);
561 if ((fabs(upx - downx) < GetCharWidth()) &&
562 (fabs(upy - downy) < GetCharWidth())) {
570void OCPNChartDirPanel::DoChartSelected() {
580void OCPNChartDirPanel::SetSelected(
bool selected) {
581 m_bSelected = selected;
585 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
588 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
593 g_pOptions->SetDirActionButtons();
600void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
601 if (m_pChartDir.Length()) {
603 GetClientSize(&x, &y);
606 wxArrayString nameWrapped = wrapper.GetLineArray();
608 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
614void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
616 GetSize(&width, &height);
619 dc.SetPen(*wxTRANSPARENT_PEN);
620 dc.SetBrush(wxBrush(GetBackgroundColour()));
621 dc.DrawRectangle(GetVirtualSize());
623 wxString nameString = m_pChartDir;
625 wxArrayString nameWrapped = wrapper.GetLineArray();
627 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
628 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
629 GetParent()->GetSizer()->Layout();
633 dc.SetBrush(wxBrush(m_boxColour));
635 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
637 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
639 int offset = height / 10;
640 int text_x = offset * 2;
642 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
645 dc.SetTextForeground(
646 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
648 int yd = height * 20 / 100;
649 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
651 dc.DrawText(nameWrapped[i], text_x, yd);
653 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
654 yd += GetCharHeight();
658 dc.SetBrush(wxBrush(m_boxColour));
661 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME),
664 int offset = height / 10;
665 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
666 height - (2 * offset), height / 10);
668 int text_x = offset * 2;
670 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
673 dc.SetTextForeground(
674 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
676 int yd = height * 20 / 100;
677 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
679 dc.DrawText(nameWrapped[i], text_x, yd);
681 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
682 yd += GetCharHeight();
690static bool LoadAllPlugIns(
bool load_enabled) {
691 g_Platform->ShowBusySpinner();
692 bool b = PluginLoader::getInstance()->
LoadAllPlugIns(load_enabled);
693 g_Platform->HideBusySpinner();
697WX_DECLARE_LIST(wxCheckBox, CBList);
704 const wxPoint& pt = wxDefaultPosition,
705 const wxSize& sz = wxDefaultSize,
706 long style = wxHSCROLL | wxVSCROLL,
707 const wxString& name = _T(
"scrolledWindow")) {
708 Create(parent,
id, pt, sz, style, name);
711 bool Create(wxWindow* parent, wxWindowID
id = -1,
712 const wxPoint& pt = wxDefaultPosition,
713 const wxSize& sz = wxDefaultSize,
714 long style = wxHSCROLL | wxVSCROLL,
715 const wxString& name = _T(
"scrolledWindow"));
719 unsigned int Append(wxString& label,
bool benable =
true,
720 bool bsizerLayout =
true);
721 unsigned int GetCount() {
return m_list.GetCount(); }
726 void Check(
int index,
bool val);
727 bool IsChecked(
int index);
735#include <wx/listimpl.cpp>
736WX_DEFINE_LIST(CBList);
738bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
739 const wxPoint& pt,
const wxSize& sz,
740 long style,
const wxString& name) {
741 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
744 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
745 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
749 m_sizer =
new wxBoxSizer(wxVERTICAL);
755unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable,
757 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
759 cb->SetValue(!benable);
761 if (bsizerLayout) m_sizer->Layout();
765 return m_list.GetCount() - 1;
768void OCPNCheckedListCtrl::Check(
int index,
bool val) {
769 CBList::Node* node = m_list.Item(index);
770 wxCheckBox* cb = node->GetData();
772 if (cb) cb->SetValue(val);
775bool OCPNCheckedListCtrl::IsChecked(
int index) {
776 CBList::Node* node = m_list.Item(index);
777 wxCheckBox* cb = node->GetData();
780 return cb->GetValue();
785void OCPNCheckedListCtrl::RunLayout() { m_sizer->Layout(); }
787void OCPNCheckedListCtrl::Clear() {
788 WX_CLEAR_LIST(CBList, m_list);
793void appendOSDirSlash(wxString* pString);
795extern ArrayOfMmsiProperties g_MMSI_Props_Array;
802EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
803EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
807 const wxString& caption,
808 const wxPoint& pos, const wxSize& size,
810 : wxDialog(parent,
id, caption, pos, size,
811 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
813 GetSizer()->SetSizeHints(
this);
817ConfigCreateDialog::~ConfigCreateDialog(
void) {}
819void ConfigCreateDialog::CreateControls(
void) {
820 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
823 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
824 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
826 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
827 wxSize(40 * GetCharHeight(), -1), 0);
828 mainSizer->Add(m_TitleCtl, 0,
829 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
831 mainSizer->AddSpacer(2 * GetCharHeight());
833 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
834 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
837 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
838 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
839 mainSizer->Add(m_DescriptionCtl, 0,
840 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
842 mainSizer->AddSpacer(2 * GetCharHeight());
847 _(
"Create a private configuration template based on current settings.\n\
848This template will be saved, and may be selected for further use at any time.\n\
850 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
852 mainSizer->AddSpacer(2 * GetCharHeight());
854 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
855 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
857 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
858 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
860 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
861 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
862 m_OKButton->SetDefault();
865void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
866 EndModal(wxID_CANCEL);
869void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
870 const wxString& title = m_TitleCtl->GetValue();
871 const wxString& desc = m_DescriptionCtl->GetValue();
872 m_createdTemplateGUID =
873 ConfigMgr::Get().CreateNamedConfig(title, desc, _T(
""));
882EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
883EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
887 wxWindowID
id, const wxString& caption,
888 const wxPoint& pos, const wxSize& size,
890 : wxDialog(parent,
id, caption, pos, size,
891 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
894 GetSizer()->SetSizeHints(
this);
898MMSIEditDialog::~MMSIEditDialog(
void) {
delete m_MMSICtl; }
900void MMSIEditDialog::CreateControls(
void) {
901 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
904 wxStaticBox* mmsiBox =
905 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
907 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
908 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
910 mmsiSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"MMSI")), 0,
911 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
913 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
914 wxDefaultPosition, wxSize(180, -1), 0);
915 mmsiSizer->Add(m_MMSICtl, 0,
916 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
918 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(
919 new wxStaticBox(
this, wxID_ANY, _(
"Tracking")), wxVERTICAL);
921 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
923 m_rbTypeTrackDefault =
924 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
925 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
926 m_rbTypeTrackDefault->SetValue(TRUE);
927 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
929 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
930 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
932 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
933 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
935 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
936 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
938 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
939 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
941 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
942 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
944 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
945 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
946 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
949 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
950 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
952 m_FollowerButton =
new wxCheckBox(
953 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
954 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
956 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
957 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
959 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
960 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
962 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
963 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
964 m_OKButton->SetDefault();
968 if (m_props->MMSI > 0)
969 sMMSI.Printf(_T(
"%d"), m_props->MMSI);
972 m_MMSICtl->AppendText(sMMSI);
974 switch (m_props->TrackType) {
975 case TRACKTYPE_ALWAYS:
976 m_rbTypeTrackAlways->SetValue(TRUE);
978 case TRACKTYPE_NEVER:
979 m_rbTypeTrackNever->SetValue(TRUE);
985 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
986 m_IgnoreButton->SetValue(m_props->m_bignore);
987 m_MOBButton->SetValue(m_props->m_bMOB);
988 m_VDMButton->SetValue(m_props->m_bVDM);
989 m_FollowerButton->SetValue(m_props->m_bFollower);
991 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
994void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
996void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
997 EndModal(wxID_CANCEL);
1000void MMSIEditDialog::Persist() {
1002 if (m_rbTypeTrackDefault->GetValue())
1003 m_props->TrackType = TRACKTYPE_DEFAULT;
1004 else if (m_rbTypeTrackAlways->GetValue())
1005 m_props->TrackType = TRACKTYPE_ALWAYS;
1007 m_props->TrackType = TRACKTYPE_NEVER;
1009 m_props->m_bignore = m_IgnoreButton->GetValue();
1010 m_props->m_bMOB = m_MOBButton->GetValue();
1011 m_props->m_bVDM = m_VDMButton->GetValue();
1012 m_props->m_bFollower = m_FollowerButton->GetValue();
1013 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
1014 if (m_props->m_ShipName == wxEmptyString) {
1015 auto proptarget = g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
1017 wxString s = proptarget->GetFullName();
1018 m_props->m_ShipName = s;
1020 wxString GetShipNameFromFile(
int);
1021 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
1027void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
1031 m_MMSICtl->GetValue().ToLong(&nmmsi);
1032 m_props->MMSI = nmmsi;
1035 if (m_MMSICtl->GetValue().Length() != 9) {
1038 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
1039 "your entries and cancel if necessary."),
1040 _(
"OpenCPN Info"), wxOK | wxCANCEL);
1042 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
1043 if (retcode == wxID_OK) {
1054void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
1057EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1058EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1059EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1060 MMSIListCtrl::OnListItemRightClick)
1061EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1062EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1066 const wxSize& size,
long style)
1067 : wxListCtrl(parent,
id, pos, size, style) {
1071MMSIListCtrl::~MMSIListCtrl(
void) {}
1073wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1077 if (!props)
return ret;
1080 if (props->MMSI > 0) ret = wxString::Format(_T(
"%d" ), props->MMSI);
1083 switch (props->TrackType) {
1084 case TRACKTYPE_DEFAULT:
1087 case TRACKTYPE_ALWAYS:
1090 case TRACKTYPE_NEVER:
1096 if (props->m_bPersistentTrack)
1097 ret.Append(_T(
", " )).Append(_(
"Persistent"));
1100 if (props->m_bignore) ret = _T(
"X" );
1103 if (props->m_bMOB) ret = _T(
"X" );
1106 if (props->m_bVDM) ret = _T(
"X" );
1109 if (props->m_bFollower) ret = _T(
"X");
1112 ret = props->m_ShipName;
1121void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1123void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1124 MmsiProperties* props = g_MMSI_Props_Array.Item(event.GetIndex());
1128 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1129 wxDefaultPosition, wxSize(200, 200));
1131 if (pd->ShowModal() == wxID_OK) {
1132 g_MMSI_Props_Array.RemoveAt(event.GetIndex());
1134 g_MMSI_Props_Array.Insert(props_new, event.GetIndex());
1141void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1142 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1143 if (m_context_item == wxNOT_FOUND)
return;
1144 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1145 wxMenuItem* item_edit =
1146 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") + _T(
"..."));
1147 menu->Append(item_edit);
1148 wxMenuItem* item_delete =
1149 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1150 menu->Append(item_delete);
1154 item_edit->SetFont(*qFont);
1155 item_delete->SetFont(*qFont);
1158 wxPoint p = ScreenToClient(wxGetMousePosition());
1159 PopupMenu(menu, p.x, p.y);
1161 SetItemCount(g_MMSI_Props_Array.GetCount());
1165void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1166 int context_item = m_context_item;
1171 switch (event.GetId()) {
1172 case ID_DEF_MENU_MMSI_EDIT: {
1175 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1176 wxDefaultPosition, wxSize(200, 200));
1178 if (pd->ShowModal() == wxID_OK) {
1179 g_MMSI_Props_Array.RemoveAt(context_item);
1181 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1182 g_MMSI_Props_Array.Insert(props_new, context_item);
1189 case ID_DEF_MENU_MMSI_DELETE:
1190 g_MMSI_Props_Array.RemoveAt(context_item);
1196MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1197 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1204 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1207 wxString MMSI_props_column_spec = _T(
"120;120;100;100;100;100;100;100");
1209 wxStringTokenizer tkz(MMSI_props_column_spec, _T(
";"));
1210 wxString s_width = tkz.GetNextToken();
1215 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1216 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1217 wxBORDER_SUNKEN | wxLC_VIRTUAL);
1225 int dx = GetCharWidth();
1228 if (s_width.ToLong(&lwidth)) {
1229 width = wxMax(dx * 2, lwidth);
1230 width = wxMin(width, dx * 13);
1232 m_pListCtrlMMSI->InsertColumn(tlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, width);
1234 s_width = tkz.GetNextToken();
1236 if (s_width.ToLong(&lwidth)) {
1237 width = wxMax(dx * 2, lwidth);
1238 width = wxMin(width, dx * 25);
1240 m_pListCtrlMMSI->InsertColumn(tlCLASS, _(
"Track Mode"), wxLIST_FORMAT_CENTER,
1243 s_width = tkz.GetNextToken();
1245 if (s_width.ToLong(&lwidth)) {
1246 width = wxMax(dx * 2, lwidth);
1247 width = wxMin(width, dx * 10);
1249 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1252 s_width = tkz.GetNextToken();
1254 if (s_width.ToLong(&lwidth)) {
1255 width = wxMax(dx * 2, lwidth);
1256 width = wxMin(width, dx * 10);
1258 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"MOB"), wxLIST_FORMAT_CENTER, width);
1260 s_width = tkz.GetNextToken();
1262 if (s_width.ToLong(&lwidth)) {
1263 width = wxMax(dx * 2, lwidth);
1264 width = wxMin(width, dx * 15);
1266 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1269 s_width = tkz.GetNextToken();
1271 if (s_width.ToLong(&lwidth)) {
1272 width = wxMax(dx * 2, lwidth);
1273 width = wxMin(width, dx * 30);
1275 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ship name"), wxLIST_FORMAT_CENTER,
1278 s_width = tkz.GetNextToken();
1280 if (s_width.ToLong(&lwidth)) {
1281 width = wxMax(dx * 2, lwidth);
1282 width = wxMin(width, dx * 10);
1284 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Follower"), wxLIST_FORMAT_CENTER,
1287 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1289 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1291 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1292 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1294 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1301 SetSize(GetSize().x, GetSize().y - 1);
1303 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1306MMSI_Props_Panel::~MMSI_Props_Panel(
void) {}
1308void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1312 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1313 wxDefaultPosition, wxSize(200, 200));
1316 pd->ShowWindowModalThenDo([
this, pd, props](
int retcode) {
1317 if (retcode == wxID_OK) {
1318 g_MMSI_Props_Array.Add(props);
1326void MMSI_Props_Panel::UpdateMMSIList(
void) {
1328 long selItemID = wxNOT_FOUND;
1329 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1330 wxLIST_STATE_SELECTED);
1332 int selMMSI = wxNOT_FOUND;
1333 if (selItemID != wxNOT_FOUND) selMMSI = g_MMSI_Props_Array[selItemID]->MMSI;
1335 m_pListCtrlMMSI->SetItemCount(g_MMSI_Props_Array.GetCount());
1338 long item_sel = wxNOT_FOUND;
1339 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1340 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
1341 if (g_MMSI_Props_Array[i]->MMSI == selMMSI) {
1348 if (g_MMSI_Props_Array.GetCount() > 0)
1349 m_pListCtrlMMSI->SetItemState(item_sel,
1350 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1351 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1354 m_pListCtrlMMSI->Refresh(FALSE);
1358void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1368 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value = _T(
""),
1369 const wxPoint& pos = wxDefaultPosition,
1370 const wxSize& size = wxDefaultSize,
int n = 0,
1371 const wxString choices[] = NULL,
long style = 0,
1372 const wxValidator& validator = wxDefaultValidator,
1373 const wxString& name = _T(
"OCPNFatCombo"));
1377 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1378 wxCoord OnMeasureItem(
size_t item)
const;
1379 wxCoord OnMeasureItemWidth(
size_t item)
const;
1380 bool SetFont(
const wxFont& font);
1382 int Append(
const wxString& item, wxBitmap bmp);
1385 const wxFont* dfont;
1389 ArrayOfBitmaps bmpArray;
1392OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1394OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1395 const wxString& value,
const wxPoint& pos,
1396 const wxSize& size,
int n,
const wxString choices[],
1397 long style,
const wxValidator& validator,
1398 const wxString& name)
1399 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1402 GetFont().GetPointSize() / g_Platform->getFontPointsperPixel();
1403 itemHeight = (int)wxRound(fontHeight);
1404 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1407OCPNFatCombo::~OCPNFatCombo() {}
1409bool OCPNFatCombo::SetFont(
const wxFont& font) {
1414void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1421 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1422 wxBrush br = wxBrush(bg);
1423 wxBrush sv = dc.GetBrush();
1425 dc.DrawRectangle(0, 0, rect.width, rect.height);
1427 dc.SetTextForeground(wxColour(0, 0, 0));
1429 if (flags & wxODCB_PAINTING_CONTROL) {
1430 wxString text = GetValue();
1432 dc.DrawText(text, rect.x + margin_x + offset_x,
1433 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1435 dc.SetBackground(wxBrush(br));
1437 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1438 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1442wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1443 if (item < bmpArray.GetCount())
1444 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1446 return itemHeight * 12 / 10;
1449wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1451int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1453 int idx = wxOwnerDrawnComboBox::Append(item);
1458void OCPNFatCombo::Clear(
void) {
1459 wxOwnerDrawnComboBox::Clear();
1463BEGIN_EVENT_TABLE(
options, wxDialog)
1464EVT_INIT_DIALOG(options::OnDialogInit)
1465EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1466EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1467EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1468EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1469EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1470EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1471EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1472EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1473EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1474EVT_BUTTON(xID_OK, options::OnXidOkClick)
1475EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1476EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1477EVT_BUTTON(ID_BUTTONFONT_RESET, options::OnResetFont)
1478EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1480EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1481EVT_CLOSE(options::OnClose)
1483#if defined(__WXGTK__) || defined(__WXQT__)
1484EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1487EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1489EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1490EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1491EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1492EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1493EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1494EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1495EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1496EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1497EVT_CHAR_HOOK(options::OnCharHook)
1501options::
options(wxWindow* parent, wxWindowID
id, const wxString& caption,
1502 const wxPoint& pos, const wxSize& size,
long style)
1503 : pTrackRotateTime(0) {
1508 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1510 wxDialog::Create(parent,
id, caption, pos, size, style,
"Options");
1511 SetFont(*dialogFont);
1514 RecalculateSize(size.x, size.y);
1516 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1518 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1519 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1521 m_pPlugInCtrl->ReloadPluginPanels();
1523 auto action = [&](wxCommandEvent& evt) {
1524 g_persist_active_route = m_persist_active_route_chkbox->IsChecked();
1526 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1527 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1530options::~options(
void) {
1532 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1534 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1535 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1538 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1540 delete m_pSerialArray;
1541 delete m_pGroupArray;
1542 delete m_topImgList;
1546 delete m_pPlugInCtrl;
1547 if (g_pi_manager) g_pi_manager->SetListPanelPtr(NULL);
1549 delete m_PluginCatalogMgrPanel;
1554bool options::SendIdleEvents(wxIdleEvent& event) {
1555 if (IsShown())
return wxDialog::SendIdleEvents(event);
1559void options::RecalculateSize(
int hint_x,
int hint_y) {
1560 if (!g_bresponsive) {
1561 m_nCharWidthMax = GetSize().x / GetCharWidth();
1565 if ((hint_x < 200) || (hint_y < 200)) {
1567 int display_width, display_height;
1568 display_width = g_monitor_info[g_current_monitor].width;
1569 display_height = g_monitor_info[g_current_monitor].height;
1571 if (display_height < 600) {
1572 SetSize(wxSize(GetOCPNCanvasWindow()->GetSize()));
1574 vectorPanel->SetSizeHints(ps57Ctl);
1584 esize.x = GetCharWidth() * 110;
1585 esize.y = GetCharHeight() * 40;
1587 wxSize dsize = GetParent()->GetSize();
1588 esize.y = wxMin(esize.y, dsize.y - 0 );
1589 esize.x = wxMin(esize.x, dsize.x - 0 );
1592 wxSize fsize = GetSize();
1593 wxSize canvas_size = GetParent()->GetSize();
1594 wxPoint screen_pos = GetParent()->GetScreenPosition();
1595 int xp = (canvas_size.x - fsize.x) / 2;
1596 int yp = (canvas_size.y - fsize.y) / 2;
1597 Move(screen_pos.x + xp, screen_pos.y + yp);
1599 m_nCharWidthMax = GetSize().x / GetCharWidth();
1602void options::Init(
void) {
1603 m_pWorkDirList = NULL;
1605 pShowStatusBar = NULL;
1606 pShowMenuBar = NULL;
1607 pShowCompassWin = NULL;
1610 m_scrollWinChartList = NULL;
1611 ps57CtlListBox = NULL;
1613 m_pSerialArray = NULL;
1614 pUpdateCheckBox = NULL;
1615 pParseENCButton = NULL;
1622 pSoundDeviceIndex = NULL;
1626 pCBLookAhead = NULL;
1627 pCDOQuilting = NULL;
1628 pPreserveScale = NULL;
1629 pSmoothPanZoom = NULL;
1630 pEnableZoomToCursor = NULL;
1631 pSDisplayGrid = NULL;
1632 pCDOOutlines = NULL;
1633 pSDepthUnits = NULL;
1635 pSDefaultBoatSpeed = NULL;
1638 itemActiveChartStaticBox = NULL;
1640 pCheck_SOUNDG = NULL;
1642 pCheck_SHOWIMPTEXT = NULL;
1643 pCheck_SCAMIN = NULL;
1644 pCheck_ATONTEXT = NULL;
1645 pCheck_LDISTEXT = NULL;
1646 pCheck_XLSECTTEXT = NULL;
1648 m_bVisitLang = FALSE;
1649 m_itemFontElementListBox = NULL;
1650 m_textSample = NULL;
1651 m_topImgList = NULL;
1654 m_pGroupArray = NULL;
1655 m_groups_changed = 0;
1658 m_pageConnections = -1;
1663 m_pageConnections = -1;
1665 auto loader = PluginLoader::getInstance();
1666 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
1667 b_oldhaveWMM = b_haveWMM;
1672 m_bForceNewToolbaronCancel =
false;
1674 m_cs = (ColorScheme)0;
1677 m_pPlugInCtrl = NULL;
1678 m_PluginCatalogMgrPanel = NULL;
1692 m_bVectorInit =
false;
1697 pCmdSoundString = NULL;
1699 m_sconfigSelect_single = NULL;
1700 m_sconfigSelect_twovertical = NULL;
1703 dc.SetFont(*dialogFont);
1705 dc.GetTextExtent(_T(
"H"), &width, &height, NULL, NULL, dialogFont);
1707 m_colourPickerDefaultSize =
1708 wxSize(4 * height, height * 2 * OCPN_GetWinDIPScaleFactor());
1721 auto sound =
static_cast<OcpnSound*
>(ev.GetClientData());
1727#if defined(__GNUC__) && __GNUC__ < 8
1730static const wxString BAD_ACCESS_MSG = _(
1731 "The device selected is not accessible; opencpn will likely not be able\n"
1732 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1733 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1734 "with the following contents:\n\n"
1735 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1736 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1737 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1738 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1742static const wxString BAD_ACCESS_MSG = _(R
"(
1743The device selected is not accessible; opencpn will likely not be able
1744to use this device as-is. You might want to exit OpenCPN, reboot and
1745retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1746with the following contents:
1748 KERNEL=="ttyUSB*", MODE="0666"
1749 KERNEL=="ttyACM*", MODE="0666"
1750 KERNEL=="ttyS*", MODE="0666"
1752For more info, see the file LINUX_DEVICES.md in the distribution docs.
1757void options::OnDialogInit(wxInitDialogEvent& event) {}
1759void options::CheckDeviceAccess( wxString& path) {}
1761size_t options::CreatePanel(
const wxString& title) {
1762 size_t id = m_pListbook->GetPageCount();
1765 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1766 wxDefaultSize, wxTAB_TRAVERSAL, title);
1767 m_pListbook->AddPage(panel, title, FALSE,
id);
1771wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1772 if (parent > m_pListbook->GetPageCount() - 1) {
1775 _T(
"Warning: invalid parent in options::AddPage( %d, "), parent) +
1779 wxNotebookPage* page = m_pListbook->GetPage(parent);
1781 wxScrolledWindow* sw;
1783 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1784 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1785 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1787 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1788 nb->AddPage(sw, title);
1789 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1790 wxString toptitle = m_pListbook->GetPageText(parent);
1791 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1792 wxDefaultSize, wxNB_TOP);
1795 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1796 m_pListbook->SetSelection(0);
1797 m_pListbook->RemovePage(parent + 1);
1798 wxString previoustitle = page->GetName();
1800 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1801 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1803 nb->AddPage(page, previoustitle);
1807 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1809 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1810 nb->AddPage(sw, title);
1811 nb->ChangeSelection(0);
1813 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1814 wxDefaultSize, style, title);
1815 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1816 wxString toptitle = m_pListbook->GetPageText(parent);
1817 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1818 m_pListbook->SetSelection(0);
1819 m_pListbook->DeletePage(parent + 1);
1823 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1829bool options::DeletePluginPage(wxScrolledWindow* page) {
1830 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1831 wxNotebookPage* pg = m_pListbook->GetPage(i);
1832 auto nb =
dynamic_cast<wxNotebook*
>(pg);
1835 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1836 wxNotebookPage* spg = nb->GetPage(j);
1839 if (nb->GetPageCount() != 1)
return TRUE;
1841 spg = nb->GetPage(0);
1842 spg->Reparent(m_pListbook);
1844 wxString toptitle = m_pListbook->GetPageText(i);
1845 m_pListbook->DeletePage(i);
1846 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1850 }
else if (pg == page) {
1852 m_pListbook->DeletePage(i);
1853 wxPanel* panel =
new wxPanel(m_pListbook);
1854 wxString toptitle = m_pListbook->GetPageText(i);
1855 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1862void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1863 int group_item_spacing) {
1864 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1867 std::make_shared<ConnectionsDlg>(m_pNMEAForm, TheConnectionParams());
1870 Bind(wxEVT_SIZE, [&](wxSizeEvent& ev) {
1871 comm_dialog->OnResize();
1876void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1877 int group_item_spacing) {
1878 itemPanelShip = AddPage(parent, _(
"Own ship"));
1880 ownShip =
new wxBoxSizer(wxVERTICAL);
1881 itemPanelShip->SetSizer(ownShip);
1884 wxStaticBox* osdBox =
1885 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1886 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1887 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1889 wxFlexGridSizer* dispOptionsGrid =
1890 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1891 dispOptionsGrid->AddGrowableCol(1);
1892 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1894 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1895 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1896 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1898 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1899 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
1901 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
1902 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
1903 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
1905 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1906 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
1908 wxStaticText* iconTypeTxt =
1909 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
1910 dispOptionsGrid->Add(iconTypeTxt, 0);
1912 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
1913 _(
"Real Scale Vector")};
1915 m_pShipIconType =
new wxChoice(
1916 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
1917 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
1918 dispOptionsGrid->Add(m_pShipIconType, 0,
1919 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
1920 group_item_spacing);
1922 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
1923 realSizes->AddGrowableCol(1);
1925 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
1928 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
1930 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
1931 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1934 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
1936 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1937 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1940 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
1942 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1943 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1945 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
1946 _(
"GPS Offset from Midship (m)")),
1948 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1949 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1952 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
1954 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1955 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1958 wxFlexGridSizer* rrSelect =
1959 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
1960 rrSelect->AddGrowableCol(1);
1961 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
1963 wxStaticText* rrTxt =
1964 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
1965 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
1967 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
1968 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
1969 _T(
"8" ), _T(
"9" ), _T(
"10" )};
1970 pNavAidRadarRingsNumberVisible =
1971 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
1972 m_pShipIconType->GetSize(), 11, rrAlt);
1973 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
1974 group_item_spacing);
1976 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1977 radarGrid->AddGrowableCol(1);
1978 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
1980 wxStaticText* distanceText =
1981 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
1982 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
1984 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL, _T(
""),
1985 wxDefaultPosition, wxSize(100, -1), 0);
1986 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
1987 group_item_spacing);
1989 wxStaticText* unitText =
1990 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
1991 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
1993 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"),
1994 _(
"Minutes (time)")};
1995 m_itemRadarRingsUnits =
1996 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
1997 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
1998 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2000 wxStaticText* colourText =
2001 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Color"));
2002 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2005 itemPanelShip, wxID_ANY, *wxRED, wxDefaultPosition,
2006 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2007 _T(
"ID_COLOUROSRANGECOLOUR" ));
2008 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2011 wxFlexGridSizer* shipToActiveGrid =
2012 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2013 shipToActiveGrid->AddGrowableCol(1);
2014 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2015 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2016 _(
"Show direction to Active Waypoint"));
2017 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2020 wxStaticText* shipToActiveText1 =
2021 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2022 shipToActiveGrid->Add(shipToActiveText1, 1,
2023 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2025 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
2026 _(
"Long dash"), _(
"Short dash")};
2027 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2028 m_shipToActiveStyle =
2029 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2030 LineStyleNChoices, LineStyleChoices, 0);
2031 m_shipToActiveStyle->SetSelection(0);
2032 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2034 wxStaticText* shipToActiveText2 =
2035 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2036 shipToActiveGrid->Add(shipToActiveText2, 1,
2037 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2039 wxString m_LineColorChoices[] = {
2040 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2041 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2042 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2043 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2045 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2046 m_shipToActiveColor =
2047 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2048 LineColorNChoices, m_LineColorChoices, 0);
2049 m_shipToActiveColor->SetSelection(0);
2050 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2053 wxStaticBox* trackText =
2054 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2055 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2056 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2057 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2059 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2060 _(
"Automatic Daily Tracks at midnight"));
2062 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2065 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2067#if wxUSE_TIMEPICKCTRL
2068 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2071 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2072 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2073 wxDefaultPosition, wxDefaultSize, 0);
2076 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2077 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2078 wxDefaultPosition, wxDefaultSize, 0);
2080 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2084 pTrackRotateComputerTime =
2085 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2086 wxDefaultPosition, wxDefaultSize, 0);
2087 trackSizer1->Add(pTrackRotateComputerTime, 0,
2088 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2091 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2092 wxDefaultPosition, wxDefaultSize, 0);
2093 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2097 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2098 wxDefaultPosition, wxDefaultSize, 0);
2099 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2102 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2104 wxFlexGridSizer* hTrackGrid =
2105 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2106 hTrackGrid->AddGrowableCol(1);
2107 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2110 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2111 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2113 wxStaticText* trackColourText =
2114 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Color"));
2115 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2118 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2119 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2120 _T(
"ID_COLOURTRACKCOLOUR" ));
2121 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2123 wxFlexGridSizer* pTrackGrid =
2124 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2125 pTrackGrid->AddGrowableCol(1);
2126 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2128 wxStaticText* tpText =
2129 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2130 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2132 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2133 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2134 m_pShipIconType->GetSize(), 3, trackAlt);
2135 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2136 group_item_spacing);
2139 wxStaticBox* ownshipcalcText =
2140 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Calculate values"));
2141 wxStaticBoxSizer* ownshipcalcSizer =
2142 new wxStaticBoxSizer(ownshipcalcText, wxVERTICAL);
2143 ownShip->Add(ownshipcalcSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2145 wxFlexGridSizer* dispOwnShipCalcOptionsGrid =
2146 new wxFlexGridSizer(2, 2, group_item_spacing, group_item_spacing);
2147 ownshipcalcSizer->Add(dispOwnShipCalcOptionsGrid, 0, wxTOP | wxALL | wxEXPAND,
2150 dispOwnShipCalcOptionsGrid->AddGrowableCol(1);
2152 pSogCogFromLLCheckBox =
2153 new wxCheckBox(itemPanelShip, ID_SOGCOGFROMLLCHECKBOX,
2154 _(
"Calculate SOG and COG from position changes"));
2155 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLCheckBox, 1, wxALL, 5);
2156 dispOwnShipCalcOptionsGrid->AddSpacer(0);
2158 wxStaticText* SogCogFromLLDampIntText =
new wxStaticText(
2159 itemPanelShip, wxID_STATIC, _(
"Min seconds between updates"));
2160 dispOwnShipCalcOptionsGrid->Add(SogCogFromLLDampIntText, 1, wxEXPAND | wxALL,
2161 group_item_spacing);
2163 pSogCogFromLLDampInterval =
new wxSpinCtrl(
2164 itemPanelShip, ID_SOGCOGDAMPINTTEXTCTRL, wxEmptyString, wxDefaultPosition,
2165 wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0);
2167 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLDampInterval, 0,
2168 wxALIGN_RIGHT | wxALL, group_item_spacing);
2171void options::CreatePanel_Routes(
size_t parent,
int border_size,
2172 int group_item_spacing) {
2173 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2175 Routes =
new wxBoxSizer(wxVERTICAL);
2176 itemPanelRoutes->SetSizer(Routes);
2178 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2180 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
2181 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
2182 _T(
"8" ), _T(
"9" ), _T(
"10" )};
2185 wxStaticBox* routeText =
2186 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2187 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2188 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2190 wxStaticBox* activeRouteText =
2191 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2192 wxStaticBoxSizer* activeRouteSizer =
2193 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2195 m_persist_active_route_chkbox =
new wxCheckBox(
2196 itemPanelRoutes, wxID_ANY,
2197 _(
"Persist active route, automatically activate on start up"));
2198 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2199 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2201 routeSizer->AddSpacer(5);
2204 wxFlexGridSizer* routepointiconSelect =
2205 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2206 routepointiconSelect->AddGrowableCol(1);
2207 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2210 wxStaticText* routepointiconTxt =
2211 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2212 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2213 group_item_spacing);
2216 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2217 0, NULL, wxCB_READONLY);
2218 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2219 wxALIGN_RIGHT | wxALL, group_item_spacing);
2221 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2224 int min_size = GetCharHeight() * 2;
2225 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2226 pRoutepointDefaultIconChoice->SetMinSize(
2227 wxSize(GetCharHeight() * 15, min_size));
2229 routeSizer->AddSpacer(5);
2231 wxFlexGridSizer* pRouteGrid =
2232 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2233 pRouteGrid->AddGrowableCol(1);
2234 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2236 wxStaticText* raText =
new wxStaticText(
2237 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Arrival Circle Radius (NMi)"));
2238 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2240 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2241 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2242 group_item_spacing);
2244 pAdvanceRouteWaypointOnArrivalOnly =
2245 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2246 _(
"Advance route waypoint on arrival only"));
2247 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2250 Routes->AddSpacer(8 * group_item_spacing);
2252 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2253 wxDefaultSize, wxLI_HORIZONTAL);
2254 Routes->Add(pln, 0, wxEXPAND);
2258 wxStaticBox* waypointText =
2259 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2260 wxStaticBoxSizer* waypointSizer =
2261 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2262 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2264 waypointSizer->AddSpacer(5);
2267 wxFlexGridSizer* waypointiconSelect =
2268 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2269 waypointiconSelect->AddGrowableCol(1);
2270 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2273 wxStaticText* waypointiconTxt =
2274 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2275 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2276 group_item_spacing);
2279 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2280 0, NULL, wxCB_READONLY);
2281 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2282 group_item_spacing);
2284 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2287 int rmin_size = GetCharHeight() * 2;
2288 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2289 pWaypointDefaultIconChoice->SetMinSize(
2290 wxSize(GetCharHeight() * 15, rmin_size));
2292 waypointSizer->AddSpacer(5);
2294 wxFlexGridSizer* ScaMinSizer =
2295 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2296 ScaMinSizer->AddGrowableCol(1);
2297 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2299 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2300 _(
"Show marks only at a chartscale greater than 1 :"));
2301 ScaMinSizer->Add(pScaMinChckB, 0);
2302 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2303 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2304 group_item_spacing);
2307 pScaMinOverruleChckB =
2308 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2309 _(
"Override the settings for chartscale based visibility "
2310 "and show always"));
2311 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2313 waypointSizer->AddSpacer(5);
2315 wxFlexGridSizer* waypointrrSelect =
2316 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2317 waypointrrSelect->AddGrowableCol(1);
2318 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2321 wxStaticText* waypointrrTxt =
2322 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2323 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2325 pWaypointRangeRingsNumber =
2326 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2327 m_pShipIconType->GetSize(), 11, rrAlt);
2328 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2329 group_item_spacing);
2332 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2333 waypointradarGrid->AddGrowableCol(1);
2334 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2336 wxStaticText* waypointdistanceText =
new wxStaticText(
2337 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2338 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2339 group_item_spacing);
2341 pWaypointRangeRingsStep =
2342 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
2343 wxSize(100, -1), 0);
2344 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2345 group_item_spacing);
2347 wxStaticText* waypointunitText =
2348 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2349 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2350 group_item_spacing);
2352 m_itemWaypointRangeRingsUnits =
2353 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2354 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2355 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2356 wxALIGN_RIGHT | wxALL, border_size);
2358 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2359 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colors"));
2360 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2363 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2364 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2365 _T(
"ID_COLOURWAYPOINTRANGERINGSCOLOUR" ));
2366 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2367 wxALIGN_RIGHT | wxALL, 1);
2372 Routes->AddSpacer(8 * group_item_spacing);
2373 wxStaticLine* pln1 =
2374 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2375 wxDefaultSize, wxLI_HORIZONTAL);
2376 Routes->Add(pln1, 0, wxEXPAND);
2379 wxStaticBox* waypointControl =
2380 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2381 wxStaticBoxSizer* ControlSizer =
2382 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2383 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2385 ControlSizer->AddSpacer(5);
2387 pWayPointPreventDragging =
new wxCheckBox(
2388 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2389 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2390 pWayPointPreventDragging->SetValue(FALSE);
2391 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2393 pConfirmObjectDeletion =
2394 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2395 _(
"Confirm deletion of tracks and routes"));
2396 pConfirmObjectDeletion->SetValue(FALSE);
2397 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2398 ControlSizer->AddSpacer(5);
2401 pWaypointDefaultIconChoice->Clear();
2403 bool fillCombo =
true;
2406 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2407 wxString* ps = pWayPointMan->GetIconDescription(i);
2408 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2410 pWaypointDefaultIconChoice->Append(*ps, bmp);
2415 int iconToSelect = -1;
2416 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2417 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2419 pWaypointDefaultIconChoice->Select(iconToSelect);
2425 pRoutepointDefaultIconChoice->Clear();
2430 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2431 wxString* ps = pWayPointMan->GetIconDescription(i);
2432 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2434 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2440 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2441 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2443 pRoutepointDefaultIconChoice->Select(iconToSelect);
2451void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2452 int group_item_spacing) {
2453 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2455 chartPanel =
new wxBoxSizer(wxVERTICAL);
2456 chartPanelWin->SetSizer(chartPanel);
2458 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2459 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2460 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2462 m_scrollWinChartList =
new wxScrolledWindow(
2463 chartPanelWin, wxID_ANY, wxDefaultPosition,
2464 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2466 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2473 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2475 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2476 m_scrollWinChartList->SetSizer(boxSizerCharts);
2478 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2479 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2481 wxString b1 = _(
"Add Directory...");
2482 wxString b2 = _(
"Remove Selected");
2483 wxString b3 = _(
"Compress Selected");
2491 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2492 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2494 cmdButtonSizer->AddSpacer(GetCharHeight());
2496 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2497 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2498 m_removeBtn->Disable();
2500 cmdButtonSizer->AddSpacer(GetCharHeight());
2503 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2504 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2505 m_compressBtn->Disable();
2507 m_compressBtn = NULL;
2511 if (g_Android_SDK_Version >= 30) {
2513 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2514 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2518 cmdButtonSizer->AddSpacer(GetCharHeight());
2520 wxStaticBox* itemStaticBoxUpdateStatic =
2521 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2522 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2523 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2524 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2526 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2527 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2529 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2530 _(
"Scan Charts and Update Database"));
2531 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2533 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2534 _(
"Force Full Database Rebuild"));
2535 itemFlexGridSizerUpdate->Add(pUpdateCheckBox, 1, wxALL, 5);
2537 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2538 _(
"Prepare all ENC Charts"));
2539 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2541 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2544 ActiveChartArray.Clear();
2545 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2546 ActiveChartArray.Add(m_CurrentDirList[i]);
2549 UpdateChartDirList();
2551 chartPanel->Layout();
2554void options::UpdateChartDirList() {
2556 m_scrollWinChartList->GetSizer()->Clear(
true);
2557 m_scrollWinChartList->ClearBackground();
2559 panelVector.clear();
2562 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2565 wxSize(-1, -1), ActiveChartArray[i]);
2566 chartPanel->SetSelected(
false);
2568 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2570 panelVector.push_back(chartPanel);
2573 m_scrollWinChartList->GetSizer()->Layout();
2575 chartPanelWin->ClearBackground();
2576 chartPanelWin->Layout();
2585 wxSize sza = GetSize();
2590 m_scrollWinChartList->GetParent()->Layout();
2593 m_scrollWinChartList->Scroll(0, 0);
2596void options::UpdateTemplateTitleText() {
2597 if (!m_templateTitleText)
return;
2599 wxString activeTitle;
2600 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2601 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2603 bool configCompare =
2604 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2605 if (!configCompare) activeTitle += _(
" [Modified]");
2606 m_templateTitleText->SetLabel(activeTitle);
2608 m_templateTitleText->SetLabel(_(
"None"));
2611void options::CreatePanel_Configs(
size_t parent,
int border_size,
2612 int group_item_spacing) {
2613 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2619 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2620 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2624 wxStaticBox* templateStatusBox =
2625 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2626 m_templateStatusBoxSizer =
2627 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2628 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2631 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2632 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2634 m_staticTextLastAppled =
new wxStaticText(
2635 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2636 m_staticTextLastAppled->Hide();
2638 statSizer->Add(m_staticTextLastAppled);
2640 m_templateTitleText =
2641 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2642 statSizer->Add(m_templateTitleText);
2643 m_templateTitleText->Hide();
2645 UpdateTemplateTitleText();
2647 wxStaticBox* configsBox =
2648 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2649 wxStaticBoxSizer* configSizer =
2650 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2651 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2653 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2654 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2656 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2657 cPanel->SetSizer(boxSizercPanel);
2659 m_scrollWinConfigList =
2660 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2661 wxBORDER_RAISED | wxVSCROLL);
2662 m_scrollWinConfigList->SetScrollRate(1, 1);
2663 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2665 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2667 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2668 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2670 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2671 configSizer->Add(btnSizer);
2674 wxButton* createButton =
2675 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2676 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2677 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2678 wxCommandEventHandler(options::OnCreateConfig), NULL,
2686 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2687 _(
"Delete Selected Config..."));
2688 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2689 group_item_spacing);
2690 m_configDeleteButton->Connect(
2691 wxEVT_COMMAND_BUTTON_CLICKED,
2692 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2694 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2695 _(
"Apply Selected Config"));
2696 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2697 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2698 wxCommandEventHandler(options::OnApplyConfig),
2705 SetConfigButtonState();
2709void options::ClearConfigList() {
2710 if (m_scrollWinConfigList) {
2711 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2712 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2713 wxWindowListNode* node = kids.Item(i);
2714 wxWindow* win = node->GetData();
2715 auto pcp =
dynamic_cast<wxPanel*
>(win);
2724 SetConfigButtonState();
2727void options::BuildConfigList() {
2728 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2730 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2732 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2734 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2735 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2736 pp->Connect(wxEVT_LEFT_DOWN,
2737 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2741 wxWindowList kids = pp->GetChildren();
2742 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2743 wxWindowListNode* node = kids.Item(i);
2744 wxWindow* win = node->GetData();
2745 win->Connect(wxEVT_LEFT_DOWN,
2746 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2752 m_boxSizerConfigs->Layout();
2754 m_selectedConfigPanelGUID = _T(
"");
2755 SetConfigButtonState();
2758void options::SetConfigButtonState() {
2759 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2760 if (m_selectedConfigPanelGUID.StartsWith(
2762 m_configDeleteButton->Disable();
2763 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2766void options::OnCreateConfig(wxCommandEvent& event) {
2768 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2770 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2771 if (retcode == wxID_OK) {
2772 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2773 UpdateTemplateTitleText();
2777 m_DisplayConfigsPage->Layout();
2779 SetConfigButtonState();
2783void options::OnEditConfig(wxCommandEvent& event) {}
2785void options::OnDeleteConfig(wxCommandEvent& event) {
2786 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2788 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2789 m_selectedConfigPanelGUID = _T(
"");
2794 m_DisplayConfigsPage->Layout();
2795 SetConfigButtonState();
2798void options::OnApplyConfig(wxCommandEvent& event) {
2799 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2802 wxString currentLocale = g_locale;
2806 evt.SetId(ID_APPLY);
2810 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2814 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2815 wxString activeTitle =
2816 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2817 m_templateTitleText->SetLabel(activeTitle);
2818 m_templateTitleText->Show();
2819 m_staticTextLastAppled->Show();
2820 m_templateStatusBoxSizer->Layout();
2822 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2823 _(
"OpenCPN Info"), wxOK);
2826 if (m_scrollWinConfigList) {
2827 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2828 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2829 wxWindowListNode* node = kids.Item(i);
2830 wxWindow* win = node->GetData();
2831 auto pcp =
dynamic_cast<wxPanel*
>(win);
2835 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2840 m_selectedConfigPanelGUID = wxEmptyString;
2842 m_returnChanges |= CONFIG_CHANGED;
2844 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2849void options::OnConfigMouseSelected(wxMouseEvent& event) {
2850 wxPanel* selectedPanel = NULL;
2851 wxObject* obj =
event.GetEventObject();
2853 auto panel =
dynamic_cast<wxPanel*
>(obj);
2855 selectedPanel = panel;
2859 auto win =
dynamic_cast<wxWindow*
>(obj);
2861 auto parentpanel =
dynamic_cast<wxPanel*
>(win->GetParent());
2863 selectedPanel = parentpanel;
2868 if (m_scrollWinConfigList) {
2869 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2870 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2871 wxWindowListNode* node = kids.Item(i);
2872 wxWindow* win = node->GetData();
2873 auto panel =
dynamic_cast<wxPanel*
>(win);
2875 if (panel == selectedPanel) {
2876 panel->SetBackgroundColour(wxSystemSettings::GetColour(
2877 wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
2879 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
2881 panel->SetBackgroundColour(m_panelBackgroundUnselected);
2883 panel->Refresh(
true);
2887 m_DisplayConfigsPage->Layout();
2888 SetConfigButtonState();
2892void options::CreatePanel_Advanced(
size_t parent,
int border_size,
2893 int group_item_spacing) {
2894 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
2898 double dpmm = g_Platform->GetDisplayDPmm();
2900 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2901 m_ChartDisplayPage->SetSizer(wrapperSizer);
2903 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
2906 itemBoxSizerUI->Add(0, border_size * 3);
2907 itemBoxSizerUI->Add(0, border_size * 3);
2910 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
2911 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
2913 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
2914 _(
"De-skew Raster Charts"));
2915 boxCharts->Add(pSkewComp, inputFlags);
2917 itemBoxSizerUI->Add(0, border_size * 3);
2918 itemBoxSizerUI->Add(0, border_size * 3);
2922 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
2923 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
2925 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
2926 _(
"Use Accelerated Graphics (OpenGL)"));
2927 OpenGLSizer->Add(pOpenGL, inputFlags);
2928 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
2930 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
2931 _(
"OpenGL Options") + _T(
"..."));
2932 OpenGLSizer->Add(bOpenGL, inputFlags);
2933 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
2935 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
2936 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
2941 itemBoxSizerUI->Add(0, border_size * 3);
2942 itemBoxSizerUI->Add(0, border_size * 3);
2946 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
2947 _(
"Chart Rotation Averaging Time"));
2949 wrapperSizer->Add(crat, 0,
2950 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
2951 group_item_spacing);
2953 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
2954 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
2957 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
2958 wxDefaultPosition, wxSize(sz.x / 5, -1), wxTE_RIGHT);
2959 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
2960 group_item_spacing);
2962 pCOGUPFilterRow->Add(
2963 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
2966 itemBoxSizerUI->Add(0, border_size * 3);
2967 itemBoxSizerUI->Add(0, border_size * 3);
2970 wxStaticText* zoomTextHead =
new wxStaticText(
2971 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
2972 zoomTextHead->Wrap(-1);
2973 itemBoxSizerUI->Add(
2975 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
2976 group_item_spacing);
2977 itemBoxSizerUI->Add(0, border_size * 1);
2979 itemBoxSizerUI->Add(
2980 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
2983 m_pSlider_Zoom_Raster =
2984 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
2985 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
2988 prepareSlider(m_pSlider_Zoom_Raster);
2991 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
2993 itemBoxSizerUI->Add(
2994 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
2997 m_pSlider_Zoom_Vector =
2998 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
2999 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3002 prepareSlider(m_pSlider_Zoom_Vector);
3005 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3007 itemBoxSizerUI->Add(
3008 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3010 m_pSlider_CM93_Zoom =
3011 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3012 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3013 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3016 prepareSlider(m_pSlider_CM93_Zoom);
3019 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3021 itemBoxSizerUI->Add(0, border_size * 3);
3022 itemBoxSizerUI->Add(0, border_size * 3);
3023 itemBoxSizerUI->Add(0, border_size * 3);
3026 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3027 _(
"Physical Screen Width")),
3029 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3030 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3032 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3033 pDPIRow->Add(pRBSizeAuto, inputFlags);
3034 pDPIRow->AddSpacer(10);
3035 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3036 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3037 pDPIRow->Add(pRBSizeManual, inputFlags);
3039 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3040 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3043 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3044 wxDefaultPosition, wxSize(sz.x / 5, -1), wxTE_RIGHT);
3045 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3047 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3051 itemBoxSizerUI->Add(
3052 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3054 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3055 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3057 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3058 _(
"Show extended chart bar information."));
3059 ChartBarSizer->Add(pChartBarEX, inputFlags);
3061 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3062 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3064 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3065 wxCommandEventHandler(options::OnSizeManualButton),
3071 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3072 itemBoxSizerUI->SetHGap(border_size);
3079 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3080 m_ChartDisplayPage->SetSizer(wrapperSizer);
3081 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3084 itemBoxSizerUI->Add(0, border_size * 3);
3085 itemBoxSizerUI->Add(0, border_size * 3);
3088 itemBoxSizerUI->Add(
3089 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3091 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3092 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3094 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3095 _(
"Show Skewed Raster Charts as North-Up"));
3096 boxCharts->Add(pSkewComp, verticleInputFlags);
3114 itemBoxSizerUI->Add(0, border_size * 3);
3115 itemBoxSizerUI->Add(0, border_size * 3);
3118 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3119 _(
"Chart Rotation Averaging Time")),
3121 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3122 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3123 group_item_spacing);
3126 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3127 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
3128 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3130 pCOGUPFilterRow->Add(
3131 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3135 itemBoxSizerUI->Add(0, border_size * 8);
3136 itemBoxSizerUI->Add(0, border_size * 8);
3139 wxStaticText* zoomTextHead =
new wxStaticText(
3140 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3142 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3143 itemBoxSizerUI->Add(0, border_size * 1);
3144 itemBoxSizerUI->Add(0, border_size * 1);
3146 wxStaticText* zoomText =
new wxStaticText(
3147 m_ChartDisplayPage, wxID_ANY,
3148 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3149With a higher value, the same zoom level shows a more detailed chart."));
3151 smallFont = *dialogFont;
3153 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3155 zoomText->SetFont(smallFont);
3156 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3164 itemBoxSizerUI->Add(
3165 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3167 m_pSlider_Zoom_Raster =
3168 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3169 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3172 prepareSlider(m_pSlider_Zoom_Raster);
3175 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3177 itemBoxSizerUI->Add(
3178 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3180 m_pSlider_Zoom_Vector =
3181 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3182 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3185 prepareSlider(m_pSlider_Zoom_Vector);
3188 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3191 itemBoxSizerUI->Add(0, border_size * 3);
3192 itemBoxSizerUI->Add(0, border_size * 3);
3194 itemBoxSizerUI->Add(
3195 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3197 m_pSlider_CM93_Zoom =
3198 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3199 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3200 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3203 prepareSlider(m_pSlider_CM93_Zoom);
3206 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3209 itemBoxSizerUI->Add(0, border_size * 3);
3210 itemBoxSizerUI->Add(0, border_size * 3);
3211 itemBoxSizerUI->Add(0, border_size * 3);
3212 itemBoxSizerUI->Add(0, border_size * 3);
3213 itemBoxSizerUI->Add(0, border_size * 3);
3214 itemBoxSizerUI->Add(0, border_size * 3);
3217 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3218 _(
"Physical Screen Width")),
3220 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3221 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3223 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3224 pDPIRow->Add(pRBSizeAuto, inputFlags);
3225 pDPIRow->AddSpacer(10);
3226 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3227 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3228 pDPIRow->Add(pRBSizeManual, inputFlags);
3230 pScreenMM =
new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3231 wxDefaultPosition, wxSize(3 * m_fontHeight, -1),
3233 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3235 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3238 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3239 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3241 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3242 wxCommandEventHandler(options::OnSizeManualButton),
3246 itemBoxSizerUI->Add(0, border_size * 3);
3247 itemBoxSizerUI->Add(0, border_size * 3);
3252 itemBoxSizerUI->Add(
3253 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3255 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3256 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3258 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3259 _(
"Use Accelerated Graphics (OpenGL)"));
3260 OpenGLSizer->Add(pOpenGL, inputFlags);
3261 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3263 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3264 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3270 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3271 _(
"Options") + _T(
"..."));
3272 OpenGLSizer->Add(bOpenGL, inputFlags);
3273 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3276 itemBoxSizerUI->Add(0, border_size * 3);
3277 itemBoxSizerUI->Add(0, border_size * 3);
3282 itemBoxSizerUI->Add(
3283 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3285 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3286 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3288 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3289 _(
"Show extended chart bar information."));
3290 ChartBarSizer->Add(pChartBarEX, inputFlags);
3302 m_ChartDisplayPage->Fit();
3306void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3307 int group_item_spacing) {
3308 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3311 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3312 ps57Ctl->SetSizer(vectorPanel);
3315 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3316 optionsColumn->SetHGap(border_size);
3317 optionsColumn->AddGrowableCol(0, 2);
3318 optionsColumn->AddGrowableCol(1, 3);
3319 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3322 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3323 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3328 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3330 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3331 _(
"Mariner's Standard")};
3332 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3333 wxDefaultSize, 4, pDispCatStrings);
3334 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3338 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3339 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3342 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3345 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3346 optionsColumn->Add(miscSizer, groupInputFlags);
3350 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3351 pCheck_SOUNDG->SetValue(FALSE);
3352 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3355 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3356 _(
"Chart Information Objects"));
3357 pCheck_META->SetValue(FALSE);
3358 miscSizer->Add(pCheck_META, verticleInputFlags);
3361 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3364 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3365 optionsColumn->Add(lightSizer, groupInputFlags);
3368 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3369 pCheck_ATONTEXT->SetValue(FALSE);
3370 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3373 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3374 pCheck_LDISTEXT->SetValue(FALSE);
3375 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3377 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3378 _(
"Extended Light Sectors"));
3379 pCheck_XLSECTTEXT->SetValue(FALSE);
3380 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3383 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3386 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3387 optionsColumn->Add(textSizer, groupInputFlags);
3389 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3390 _(
"National text on chart"));
3391 pCheck_NATIONALTEXT->SetValue(FALSE);
3392 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3394 pCheck_SHOWIMPTEXT =
3395 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3396 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3397 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3400 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3401 pCheck_DECLTEXT->SetValue(FALSE);
3402 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3404 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3406 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3407 _(
"Reduced Detail at Small Scale"));
3408 pCheck_SCAMIN->SetValue(FALSE);
3409 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3411 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3412 pCheck_SuperSCAMIN =
3413 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3414 _(
"Additional detail reduction at Small Scale"));
3415 pCheck_SuperSCAMIN->SetValue(FALSE);
3416 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3419 optionsColumn->Add(0, border_size * 4);
3420 optionsColumn->Add(0, border_size * 4);
3423 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3425 wxString pPointStyleStrings[] = {
3429 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3430 wxDefaultSize, 2, pPointStyleStrings);
3431 optionsColumn->Add(pPointStyle, inputFlags);
3433 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3435 wxString pBoundStyleStrings[] = {
3439 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3440 wxDefaultSize, 2, pBoundStyleStrings);
3441 optionsColumn->Add(pBoundStyle, inputFlags);
3443 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3445 wxString pColorNumStrings[] = {
3449 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3450 wxDefaultSize, 2, pColorNumStrings);
3451 optionsColumn->Add(p24Color, inputFlags);
3454 optionsColumn->Add(0, border_size * 4);
3455 optionsColumn->Add(0, border_size * 4);
3458 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3460 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3461 optionsColumn->Add(depShalRow);
3463 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3464 wxSize(60, -1), wxTE_RIGHT);
3465 depShalRow->Add(m_ShallowCtl, inputFlags);
3466 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3467 depShalRow->Add(m_depthUnitsShal, inputFlags);
3469 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3471 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3472 optionsColumn->Add(depSafeRow);
3473 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""),
3474 wxDefaultPosition, wxSize(60, -1), wxTE_RIGHT);
3475 depSafeRow->Add(m_SafetyCtl, inputFlags);
3476 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3477 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3479 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3481 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3482 optionsColumn->Add(depDeepRow);
3483 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""),
3484 wxDefaultPosition, wxSize(60, -1), wxTE_RIGHT);
3485 depDeepRow->Add(m_DeepCtl, inputFlags);
3486 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3487 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3490 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3491 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3493 wxStaticBox* marinersBox =
3494 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3495 wxStaticBoxSizer* marinersSizer =
3496 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3497 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3500 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3501 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3503 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3504 itemButtonSelectList =
3505 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3506 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3507 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3508 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3509 marinersSizer->Add(btnRow1);
3511 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3513 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3514 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3515 marinersSizer->Add(btnRow2);
3520 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3521 ps57Ctl->SetSizer(vectorPanel);
3523 wxBoxSizer* optionsColumn = vectorPanel;
3526 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3531 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3533 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3534 _(
"Mariner's Standard")};
3535 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3536 wxSize(350, -1), 4, pDispCatStrings);
3537 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3540 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3545 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3546 optionsColumn->Add(miscSizer, groupInputFlags);
3549 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3550 pCheck_SOUNDG->SetValue(FALSE);
3551 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3553 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3554 _(
"Chart Information Objects"));
3555 pCheck_META->SetValue(FALSE);
3556 miscSizer->Add(pCheck_META, inputFlags);
3558 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3559 optionsColumn->Add(lightSizer, groupInputFlags);
3562 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3563 pCheck_ATONTEXT->SetValue(FALSE);
3564 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3567 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3568 pCheck_LDISTEXT->SetValue(FALSE);
3569 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3571 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3572 _(
"Extended Light Sectors"));
3573 pCheck_XLSECTTEXT->SetValue(FALSE);
3574 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3576 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3577 optionsColumn->Add(textSizer, groupInputFlags);
3579 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3580 _(
"National text on chart"));
3581 pCheck_NATIONALTEXT->SetValue(FALSE);
3582 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3584 pCheck_SHOWIMPTEXT =
3585 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3586 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3587 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3590 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3591 pCheck_DECLTEXT->SetValue(FALSE);
3592 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3594 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3595 _(
"Reduced Detail at Small Scale"));
3596 pCheck_SCAMIN->SetValue(FALSE);
3597 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3599 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3600 pCheck_SuperSCAMIN =
3601 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3602 _(
"Additional detail reduction at Small Scale"));
3603 pCheck_SuperSCAMIN->SetValue(FALSE);
3604 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3607 optionsColumn->Add(0, border_size * 4);
3608 optionsColumn->Add(0, border_size * 4);
3612 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3613 StyleColumn->SetHGap(border_size);
3614 StyleColumn->AddGrowableCol(0, 2);
3615 StyleColumn->AddGrowableCol(1, 3);
3616 optionsColumn->Add(StyleColumn);
3618 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3620 wxString pPointStyleStrings[] = {
3624 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3625 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3626 pPointStyleStrings);
3628 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3631 StyleColumn->Add(pPointStyle, inputFlags);
3633 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3635 wxString pBoundStyleStrings[] = {
3639 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3640 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3641 pBoundStyleStrings);
3643 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3646 StyleColumn->Add(pBoundStyle, inputFlags);
3648 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3651 wxString pColorNumStrings[] = {
3655 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3656 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3659 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3661 StyleColumn->Add(p24Color, inputFlags);
3664 optionsColumn->Add(0, border_size * 4);
3665 optionsColumn->Add(0, border_size * 4);
3667 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3668 DepthColumn->SetHGap(border_size);
3669 DepthColumn->AddGrowableCol(0, 3);
3670 DepthColumn->AddGrowableCol(1, 2);
3671 DepthColumn->AddGrowableCol(2, 3);
3672 optionsColumn->Add(DepthColumn);
3675 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3678 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3679 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3680 DepthColumn->Add(m_ShallowCtl, inputFlags);
3681 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3682 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3684 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3687 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3688 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3689 DepthColumn->Add(m_SafetyCtl, inputFlags);
3690 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3691 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3693 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3696 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3697 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3698 DepthColumn->Add(m_DeepCtl, inputFlags);
3699 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3700 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3703 optionsColumn->Add(0, border_size * 4);
3704 optionsColumn->Add(0, border_size * 4);
3707 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3708 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3710 wxStaticBox* marinersBox =
3711 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3712 wxStaticBoxSizer* marinersSizer =
3713 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3714 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3716 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3717 itemButtonSelectList =
3718 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3719 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3720 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3721 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3722 marinersSizer->Add(btnRow1);
3724 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3726 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3727 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3728 marinersSizer->Add(btnRow2);
3731 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3733 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3737void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3738 int group_item_spacing) {
3739 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3741 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3742 tcPanel->SetSizer(mainHBoxSizer);
3744 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3745 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3746 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3749 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3750 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3752 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3756 tcDataSelected->DeleteAllItems();
3761 col0.SetText(_T(
""));
3763 col0.SetAlign(wxLIST_FORMAT_LEFT);
3765 tcDataSelected->InsertColumn(0, col0);
3768 unsigned int id = 0;
3769 for (
auto ds : TideCurrentDataSet) {
3772 tcDataSelected->InsertItem(li);
3774 wxString setName = ds;
3775 tcDataSelected->SetItem(
id, 0, setName);
3776 GetTextExtent(setName, &w1, &h);
3777 w = w1 > w ? w1 : w;
3780 tcDataSelected->SetColumnWidth(0, 20 + w);
3783 wxButton* insertButton =
3784 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3785 wxButton* removeButton =
3786 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3788 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3789 tcSizer->Add(btnSizer);
3791 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3792 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3795void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3796 int group_item_spacing) {
3801 wxNotebook* chartsPageNotebook = (wxNotebook*)m_pListbook->GetPage(parent);
3802 wxScrolledWindow* sw =
new ChartGroupsUI(chartsPageNotebook);
3803 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3804 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3807 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3810void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3811 int group_item_spacing) {
3813 m_border_size = border_size;
3814 m_group_item_spacing = group_item_spacing;
3816 m_UIcomplete = FALSE;
3821void ChartGroupsUI::CompletePanel(
void) {
3823 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3824 m_panel->SetSizer(m_topSizer);
3827 wxStaticText* allChartsLabel =
3828 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3829 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3831 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3832 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3834 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3835 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3839 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE, _T(
""),
3840 wxDefaultPosition, wxDefaultSize, wxVSCROLL);
3843 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE, _T(
""),
3844 wxDefaultPosition, wxDefaultSize, wxVSCROLL);
3846 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3848 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3849 m_pAddButton->Disable();
3850 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3851 m_pRemoveButton->Disable();
3853 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3854 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3856 m_pRemoveButton->Connect(
3857 wxEVT_COMMAND_BUTTON_CLICKED,
3858 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3860 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3861 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3862 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3864 sizerCharts->AddSpacer(20);
3867 wxStaticText* groupsLabel =
3868 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3869 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3871 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
3872 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
3874 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
3875 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
3876 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
3877 wxDefaultSize, wxNB_TOP);
3878 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
3880 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
3881 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
3885 wxPanel* allActiveGroup =
3886 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
3887 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
3889 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
3890 allActiveGroup->SetSizer(page0BoxSizer);
3892 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1, _T(
""),
3893 wxDefaultPosition, wxDefaultSize);
3896 iFont =
new wxFont(*dialogFont);
3897 iFont->SetStyle(wxFONTSTYLE_ITALIC);
3898 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
3900 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
3902 m_DirCtrlArray.Add(defaultAllCtl);
3906 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
3907 m_pDeleteGroupButton =
3908 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
3909 m_pDeleteGroupButton->Disable();
3911 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3912 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
3914 m_pDeleteGroupButton->Connect(
3915 wxEVT_COMMAND_BUTTON_CLICKED,
3916 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
3918 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
3919 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
3921 newDeleteGrp->AddSpacer(25);
3922 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
3923 m_group_item_spacing);
3924 newDeleteGrp->AddSpacer(15);
3925 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
3926 m_group_item_spacing);
3927 newDeleteGrp->AddSpacer(25);
3928 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3930 sizerGroups->AddSpacer(20);
3934 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
3935 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
3938 m_UIcomplete = TRUE;
3941void options::CreatePanel_Display(
size_t parent,
int border_size,
3942 int group_item_spacing) {
3943 pDisplayPanel = AddPage(parent, _(
"General"));
3946 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
3947 generalSizer->SetHGap(border_size);
3954 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3955 pDisplayPanel->SetSizer(wrapperSizer);
3956 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
3959 generalSizer->Add(0, border_size * 4);
3960 generalSizer->Add(0, border_size * 4);
3965 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
3967 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
3968 generalSizer->Add(boxNavMode, groupInputFlags);
3970 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
3971 boxNavMode->Add(rowOrientation);
3973 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
3974 rowOrientation->Add(pCBNorthUp, inputFlags);
3976 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
3977 rowOrientation->Add(pCBCourseUp,
3979 .Align(wxALIGN_CENTRE_VERTICAL)
3980 .Border(wxLEFT, group_item_spacing * 2));
3982 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
3983 _(
"Look Ahead Mode"));
3984 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
3987 generalSizer->Add(0, border_size * 4);
3988 generalSizer->Add(0, border_size * 4);
3992 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
3994 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3995 generalSizer->Add(boxCharts, groupInputFlags);
3997 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
3998 _(
"Enable Chart Quilting"));
3999 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4002 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4003 _(
"Preserve scale when switching charts"));
4004 boxCharts->Add(pPreserveScale, verticleInputFlags);
4007 generalSizer->Add(0, border_size * 4);
4008 generalSizer->Add(0, border_size * 4);
4012 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4014 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4015 generalSizer->Add(boxCtrls, groupInputFlags);
4017 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4018 _(
"Smooth Panning / Zooming"));
4019 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4021 pEnableZoomToCursor =
4022 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4023 pEnableZoomToCursor->SetValue(FALSE);
4024 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4027 generalSizer->Add(0, border_size * 4);
4028 generalSizer->Add(0, border_size * 4);
4033 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4035 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4036 generalSizer->Add(boxDisp, groupInputFlags);
4039 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4040 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4042 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4043 _(
"Show Chart Outlines"));
4044 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4046 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4047 _(
"Show Depth Units"));
4048 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4058 generalSizer->Add(0, border_size * 4);
4059 generalSizer->Add(0, border_size * 4);
4063 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4065 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4066 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4069 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4070 _(
"Live ETA at Cursor"));
4071 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4075 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4076 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4078 m_Text_def_boat_speed =
new wxStaticText(
4079 pDisplayPanel, wxID_ANY,
4080 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4082 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4083 pSDefaultBoatSpeed =
4084 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED, _T(
""),
4085 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4086 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4087 group_item_spacing);
4094 if (g_Platform->GetDisplayAreaCM2() > 100) {
4095 wxStaticBox* itemStaticBoxScreenConfig =
4096 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4097 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4098 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4099 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4102 wxString iconDir = g_Platform->GetSharedDataDir();
4103 appendOSDirSlash(&iconDir);
4104 iconDir.append(_T(
"uidata"));
4105 appendOSDirSlash(&iconDir);
4106 iconDir.append(_T(
"MUI_flat"));
4107 appendOSDirSlash(&iconDir);
4108 int bmpSize = GetCharHeight() * 3;
4111 LoadSVG(iconDir + _T(
"MUI_Sconfig_1.svg"), bmpSize, bmpSize);
4112 m_sconfigSelect_single =
4114 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4117 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4119 bmp = LoadSVG(iconDir + _T(
"MUI_Sconfig_2.svg"), bmpSize, bmpSize);
4120 m_sconfigSelect_twovertical =
4122 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4125 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4130 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4131 generalSizer->SetHGap(border_size);
4138 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4139 pDisplayPanel->SetSizer(wrapperSizer);
4140 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4143 generalSizer->Add(0, border_size * 4);
4144 generalSizer->Add(0, border_size * 4);
4149 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4151 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4152 generalSizer->Add(boxNavMode, groupInputFlags);
4154 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4155 boxNavMode->Add(rowOrientation);
4157 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4158 rowOrientation->Add(pCBNorthUp, inputFlags);
4160 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4161 rowOrientation->Add(pCBCourseUp,
4163 .Align(wxALIGN_CENTRE_VERTICAL)
4164 .Border(wxLEFT, group_item_spacing * 2));
4166 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4167 _(
"Look Ahead Mode"));
4168 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4171 generalSizer->Add(0, border_size * 4);
4172 generalSizer->Add(0, border_size * 4);
4176 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4178 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4179 generalSizer->Add(boxCharts, groupInputFlags);
4181 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4182 _(
"Enable Chart Quilting"));
4183 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4186 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4187 _(
"Preserve scale when switching charts"));
4188 boxCharts->Add(pPreserveScale, verticleInputFlags);
4191 generalSizer->Add(0, border_size * 4);
4192 generalSizer->Add(0, border_size * 4);
4196 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4198 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4199 generalSizer->Add(boxCtrls, groupInputFlags);
4201 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4202 _(
"Smooth Panning / Zooming"));
4203 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4204 pEnableZoomToCursor =
4205 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4206 pEnableZoomToCursor->SetValue(FALSE);
4207 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4210 pSmoothPanZoom->Hide();
4211 pEnableZoomToCursor->Hide();
4215 generalSizer->Add(0, border_size * 4);
4216 generalSizer->Add(0, border_size * 4);
4221 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4223 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4224 generalSizer->Add(boxDisp, groupInputFlags);
4227 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4228 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4230 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4231 _(
"Show Chart Outlines"));
4232 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4234 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4235 _(
"Show Depth Units"));
4236 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4246 generalSizer->Add(0, border_size * 4);
4247 generalSizer->Add(0, border_size * 4);
4251 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4253 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4254 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4257 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4258 _(
"Live ETA at Cursor"));
4259 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4263 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4264 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4265 m_Text_def_boat_speed =
new wxStaticText(
4266 pDisplayPanel, wxID_ANY,
4267 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4268 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4269 pSDefaultBoatSpeed =
4270 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED, _T(
""),
4271 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4272 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4273 group_item_spacing);
4279 if (g_Platform->GetDisplayAreaCM2() > 100) {
4281 wxStaticBox* itemStaticBoxScreenConfig =
4282 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4283 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4284 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4285 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4288 wxString iconDir = g_Platform->GetSharedDataDir();
4289 appendOSDirSlash(&iconDir);
4290 iconDir.append(_T(
"uidata"));
4291 appendOSDirSlash(&iconDir);
4292 iconDir.append(_T(
"MUI_flat"));
4293 appendOSDirSlash(&iconDir);
4294 int bmpSize = GetCharHeight() * 3;
4297 LoadSVG(iconDir + _T(
"MUI_Sconfig_1.svg"), bmpSize, bmpSize);
4298 m_sconfigSelect_single =
4300 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4303 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4305 bmp = LoadSVG(iconDir + _T(
"MUI_Sconfig_2.svg"), bmpSize, bmpSize);
4306 m_sconfigSelect_twovertical =
4308 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4311 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4317void options::CreatePanel_Units(
size_t parent,
int border_size,
4318 int group_item_spacing) {
4319 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4322 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4323 unitsSizer->SetHGap(border_size);
4327 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4328 panelUnits->SetSizer(wrapperSizer);
4330 wrapperSizer->Add(1, border_size * 24);
4331 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4334 unitsSizer->Add(0, border_size * 4);
4335 unitsSizer->Add(0, border_size * 4);
4338 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4340 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4341 _(
"Kilometers"), _(
"Meters")};
4342 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4344 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4345 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4348 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4350 unitsSizer->Add(pDistanceFormat, inputFlags);
4353 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4355 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4356 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4357 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4358 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4359 m_SpeedFormatsNChoices, pSpeedFormats);
4361 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4363 unitsSizer->Add(pSpeedFormat, inputFlags);
4366 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4368 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4369 int m_WindSpeedFormatsNChoices =
4370 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4372 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4373 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4376 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4378 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4381 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4383 wxString pDepthUnitStrings[] = {
4389 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4390 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4392 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4394 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4397 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4399 wxString pTempUnitStrings[] = {
4405 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4406 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4408 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4410 unitsSizer->Add(pTempFormat, inputFlags);
4413 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4414 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4417 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4419 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4420 _(
"Decimal Degrees"),
4421 _(
"Degrees, Minutes, Seconds")};
4422 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4423 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4424 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4425 m_SDMMFormatsNChoices, pSDMMFormats);
4427 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4429 unitsSizer->Add(pSDMMFormat, inputFlags);
4432 unitsSizer->Add(0, border_size * 4);
4433 unitsSizer->Add(0, border_size * 4);
4436 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4441 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4442 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4443 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4446 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4447 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4448 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4452 wxStaticBox* itemStaticBoxVar =
4453 new wxStaticBox(panelUnits, wxID_ANY, _T(
""));
4455 wxStaticBoxSizer* itemStaticBoxSizerVar =
4456 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4457 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4459 itemStaticBoxSizerVar->Add(0, border_size * 4);
4461 itemStaticTextUserVar =
4462 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4463 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4464 group_item_spacing);
4466 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4467 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4468 group_item_spacing);
4470 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL, _T(
""),
4471 wxDefaultPosition, wxSize(150, -1), wxTE_RIGHT);
4472 magVarSizer->AddSpacer(100);
4474 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4476 itemStaticTextUserVar2 =
4477 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4479 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4480 group_item_spacing);
4482 itemStaticBoxSizerVar->Add(0, border_size * 40);
4485 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4486 unitsSizer->SetHGap(border_size);
4490 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4491 panelUnits->SetSizer(wrapperSizer);
4492 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4495 unitsSizer->Add(0, border_size * 4);
4496 unitsSizer->Add(0, border_size * 4);
4499 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4501 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4502 _(
"Kilometers"), _(
"Meters")};
4503 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4504 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4505 wxDefaultPosition, wxDefaultSize,
4506 m_DistanceFormatsNChoices, pDistanceFormats);
4507 unitsSizer->Add(pDistanceFormat, inputFlags);
4510 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4512 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4513 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4515 new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE, wxDefaultPosition,
4516 wxDefaultSize, m_SpeedFormatsNChoices, pSpeedFormats);
4517 unitsSizer->Add(pSpeedFormat, inputFlags);
4520 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"WindSpeed")),
4522 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4523 int m_WindSpeedFormatsNChoices =
4524 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4525 pWindSpeedFormat =
new wxChoice(
4526 panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition, wxDefaultSize,
4527 m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4528 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4531 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4533 wxString pDepthUnitStrings[] = {
4539 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4540 wxDefaultSize, 3, pDepthUnitStrings);
4541 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4544 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4546 wxString pTempUnitStrings[] = {
4552 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4553 wxDefaultSize, 3, pTempUnitStrings);
4554 unitsSizer->Add(pTempFormat, inputFlags);
4557 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4558 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4561 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4563 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4564 _(
"Decimal Degrees"),
4565 _(
"Degrees, Minutes, Seconds")};
4566 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4568 new wxChoice(panelUnits, ID_SDMMFORMATCHOICE, wxDefaultPosition,
4569 wxDefaultSize, m_SDMMFormatsNChoices, pSDMMFormats);
4570 unitsSizer->Add(pSDMMFormat, inputFlags);
4573 unitsSizer->Add(0, border_size * 4);
4574 unitsSizer->Add(0, border_size * 4);
4577 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4580 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4581 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4584 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4585 _(
"Show true bearings and headings"));
4586 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4587 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4588 _(
"Show magnetic bearings and headings."));
4589 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4591 bearingsSizer->AddSpacer(10);
4594 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4595 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4597 itemStaticTextUserVar =
4598 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4599 itemStaticTextUserVar->SetLabel(
4600 _(
"WMM Plugin calculated magnetic variation"));
4602 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4603 group_item_spacing);
4605 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL, _T(
""),
4606 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4607 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4609 itemStaticTextUserVar2 =
4610 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4611 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4612 group_item_spacing);
4614 bearingsSizer->AddSpacer(10);
4616 wxStaticText* varText =
4617 new wxStaticText(panelUnits, wxID_ANY,
4618 _(
" To set the magnetic variation manually,\n you "
4619 "must disable the WMM plugin."));
4620 smallFont = *dialogFont;
4621 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4623 varText->SetFont(smallFont);
4625 bearingsSizer->Add(varText);
4634 OCPNSoundPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
4635 const wxSize& size, wxString title, wxString checkLegend,
4636 wxString selectLegend, wxString* pSoundFile);
4640 void OnButtonSelectSound(wxCommandEvent& event);
4641 void OnButtonSPTestSound(wxCommandEvent& event);
4642 wxString SelectSoundFile();
4643 void SetSoundFileLabel(wxString file);
4644 wxCheckBox* GetCheckBox() {
return m_pCheck_Sound; }
4645 wxString GetSoundFile() {
return m_sound_file; }
4647 wxCheckBox* m_pCheck_Sound;
4648 wxSize m_small_button_size;
4649 wxString m_sound_file;
4650 wxString* m_pSoundFile;
4651 wxStaticText* m_AudioFileNameText;
4654 wxButton* TestSound;
4661 bool m_soundPlaying;
4663 DECLARE_EVENT_TABLE()
4666#define ID_SELECTSOUND 9341
4667#define ID_TESTSOUND 9342
4670EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4671EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4676 const wxPoint& pos, const wxSize& size,
4677 wxString title, wxString checkLegend,
4678 wxString selectLegend, wxString* pSoundFile)
4679 : wxPanel(parent,
id, pos, size, wxBORDER_NONE), m_soundPlaying(false) {
4680 wxFont* pif = FontMgr::Get().
GetFont(_(
"Dialog"));
4683 m_pSoundFile = pSoundFile;
4684 if (pSoundFile) m_sound_file = *pSoundFile;
4686 m_sound = SoundFactory();
4688 int border_size = 4;
4689 int group_item_spacing = 2;
4691 int font_size_y, font_descent, font_lead;
4692 GetTextExtent(_T(
"0"), NULL, &font_size_y, &font_descent, &font_lead);
4693 m_small_button_size = wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4695 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4696 SetSizer(wrapperSizer);
4698 wxStaticBox* StaticBox1 =
new wxStaticBox(
this, wxID_ANY, title);
4699 wxStaticBoxSizer* StaticBoxSizer1 =
4700 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4701 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4703 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO, checkLegend);
4704 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4707 wxString LabelWrapped;
4713 g_pOptions->GetSize().x * 8 / 10);
4714 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4715 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4716 LabelWrapped +=
"\n";
4718 LabelWrapped +=
"\n";
4721 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4722 m_AudioFileNameText->Wrap(-1);
4723 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4725 SetSoundFileLabel(m_sound_file);
4728 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4729 soundSizer1->SetHGap(border_size * 2);
4730 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4732 SelSound =
new wxButton(
this, ID_SELECTSOUND, selectLegend, wxDefaultPosition,
4733 m_small_button_size, 0);
4734 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4735 soundSizer1->AddSpacer(group_item_spacing * 4);
4736 TestSound =
new wxButton(
this, ID_TESTSOUND, _(
"Test"), wxDefaultPosition,
4737 m_small_button_size, 0);
4738 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4739 auto sound_action = [
this](
ObservedEvt ev) { m_soundPlaying =
false; };
4740 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4743void OCPNSoundPanel::SetSoundFileLabel(wxString file) {
4744 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " + file);
4747 g_pOptions->GetSize().x * 8 / 10);
4748 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4749 wxString LabelWrapped;
4750 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4752 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4754 LabelWrapped += LabelWrappedArray[i];
4755 LabelWrapped +=
"\n";
4758 m_AudioFileNameText->SetLabel(LabelWrapped);
4762wxString OCPNSoundPanel::SelectSoundFile() {
4763 wxString sound_dir = g_Platform->GetSharedDataDir();
4764 sound_dir.Append(_T(
"sounds"));
4769 wxFileDialog* popenDialog =
new wxFileDialog(
4770 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4771 _T(
"WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN);
4773 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
4775 response = popenDialog->ShowModal();
4776 sel_file = popenDialog->GetPath();
4781 g_Platform->DoFileSelectorDialog(
this, &sel_file, _(
"Select Sound File"),
4782 sound_dir, wxEmptyString, wxT(
"*.*"));
4786 if (response == wxID_OK)
4787 return g_Platform->NormalizePath(sel_file);
4792void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4793 wxString sel_file = SelectSoundFile();
4795 if (!sel_file.IsEmpty()) {
4796 m_sound_file = g_Platform->NormalizePath(sel_file);
4797 if (m_pSoundFile) *m_pSoundFile = m_sound_file;
4799 SetSoundFileLabel(m_sound_file);
4804void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
4805 if (!m_soundPlaying) {
4806 m_sound->SetFinishedCallback(
4808 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
4809 m_soundPlaying =
true;
4815void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent& event) {
4816 if (event.IsChecked())
4817 m_pCheck_AlertAudio->SetValue(
true);
4819 if (!m_soundPanelSART->GetCheckBox()->GetValue() &&
4820 !m_soundPanelDSC->GetCheckBox()->GetValue())
4821 m_pCheck_AlertAudio->SetValue(
false);
4825void options::OnUXAudioEnableButtonClickSART(wxCommandEvent& event) {
4826 if (event.IsChecked())
4827 m_pCheck_AlertAudio->SetValue(
true);
4829 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
4830 !m_soundPanelDSC->GetCheckBox()->GetValue())
4831 m_pCheck_AlertAudio->SetValue(
false);
4835void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent& event) {
4836 if (event.IsChecked())
4837 m_pCheck_AlertAudio->SetValue(
true);
4839 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
4840 !m_soundPanelSART->GetCheckBox()->GetValue())
4841 m_pCheck_AlertAudio->SetValue(
false);
4845void options::CreatePanel_Sounds(
size_t parent,
int border_size,
4846 int group_item_spacing) {
4847 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
4849 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4850 panelSounds->SetSizer(wrapperSizer);
4854 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize,
4855 _(
"Anchor Alarm"), _(
"Play Sound on Anchor Alarm."),
4856 _(
"Select Anchor Alarm Sound"), &g_anchorwatch_sound_file);
4857 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
4861 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"AIS Alert"),
4862 _(
"Play Sound on AIS Alert."), _(
"Select AIS Alert Sound"),
4864 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
4866 m_soundPanelAIS->GetCheckBox()->Connect(
4867 wxEVT_COMMAND_CHECKBOX_CLICKED,
4868 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
4873 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"SART Alert"),
4874 _(
"Play Sound on AIS SART Alert."), _(
"Select AIS SART Alert Sound"),
4875 &g_SART_sound_file);
4876 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
4878 m_soundPanelSART->GetCheckBox()->Connect(
4879 wxEVT_COMMAND_CHECKBOX_CLICKED,
4880 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
4885 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"DSC Alert"),
4886 _(
"Play Sound on DSC notification."), _(
"Select DSC notification Sound"),
4888 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
4890 m_soundPanelDSC->GetCheckBox()->Connect(
4891 wxEVT_COMMAND_CHECKBOX_CLICKED,
4892 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
4896 wxStaticBox* StatBoxSoundConfig =
4897 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
4898 wxStaticBoxSizer* StatBoxSoundConfigSizer =
4899 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
4900 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
4902 auto sound = std::unique_ptr<OcpnSound>(SoundFactory());
4903 int deviceCount = sound->DeviceCount();
4904 wxLogMessage(
"options: got device count: %d", deviceCount);
4905 if (deviceCount >= 1) {
4906 wxArrayString labels;
4907 for (
int i = 0; i < deviceCount; i += 1) {
4908 wxString label(sound->GetDeviceInfo(i));
4910 std::ostringstream stm;
4912 label = _(
"Unknown device :") + stm.str();
4914 if (!sound->IsOutputDevice(i)) {
4915 std::ostringstream stm;
4917 label = _(
"Input device :") + stm.str();
4924 int iDefault = labels.Index(
"default");
4926 if (g_iSoundDeviceIndex == -1) {
4928 g_iSoundDeviceIndex = iDefault;
4930 g_iSoundDeviceIndex = 0;
4933 pSoundDeviceIndex =
new wxChoice();
4934 if (pSoundDeviceIndex) {
4935 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
4936 wxDefaultSize, labels);
4937 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
4938 pSoundDeviceIndex->Show();
4939 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
4940 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
4941 group_item_spacing);
4943 stSoundDeviceIndex =
4944 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
4945 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
4946 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
4951 if ((
bool)
dynamic_cast<SystemCmdSound*
>(SoundFactory())) {
4952 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
4953 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND,
4954 group_item_spacing);
4956 new wxTextCtrl(panelSounds, wxID_ANY, _T(
"" ), wxDefaultPosition,
4957 wxSize(450, -1), wxTE_LEFT);
4959 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
4960 wxALIGN_LEFT | wxALL);
4961 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
4965 if (!deviceCount) StatBoxSoundConfig->Hide();
4968 stSoundDeviceIndex->Hide();
4969 pSoundDeviceIndex->Hide();
4973void options::CreatePanel_MMSI(
size_t parent,
int border_size,
4974 int group_item_spacing) {
4975 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
4977 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
4978 panelMMSI->SetSizer(MMSISizer);
4981 wxStaticBox* itemStaticBoxMMSI =
4982 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
4983 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
4984 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
4985 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
4989 pPropsPanel->UpdateMMSIList();
4991 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
4993 panelMMSI->Layout();
4996void options::CreatePanel_AIS(
size_t parent,
int border_size,
4997 int group_item_spacing) {
4998 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5000 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5001 panelAIS->SetSizer(aisSizer);
5004 wxStaticBox* itemStaticBoxCPA =
5005 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5006 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5007 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5008 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5010 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5011 pCPAGrid->AddGrowableCol(1);
5012 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5014 m_pCheck_CPA_Max =
new wxCheckBox(
5016 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5017 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5019 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5020 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5023 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5024 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5027 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5028 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5030 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5031 wxCommandEventHandler(options::OnCPAWarnClick),
5034 m_pCheck_CPA_WarnT =
5035 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5036 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5038 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5039 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5040 group_item_spacing);
5043 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5044 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5045 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5047 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5048 pLostGrid->AddGrowableCol(1);
5049 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5051 m_pCheck_Mark_Lost =
5052 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5053 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5055 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5056 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5057 group_item_spacing);
5059 m_pCheck_Remove_Lost =
5060 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5061 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5063 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5064 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5065 group_item_spacing);
5067 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5070 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5071 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5072 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5074 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5075 pDisplayGrid->AddGrowableCol(1);
5076 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5078 m_pCheck_Show_COG =
new wxCheckBox(
5079 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5080 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5082 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5083 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5084 group_item_spacing);
5086 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5087 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5088 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5089 m_pCheck_Sync_OCOG_ACOG->Connect(
5090 wxEVT_COMMAND_CHECKBOX_CLICKED,
5091 wxCommandEventHandler(options::OnSyncCogPredClick), NULL,
this);
5093 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1, _T(
""));
5094 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5096 m_pCheck_Show_Tracks =
5097 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5098 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5100 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5101 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5102 group_item_spacing);
5104 m_pCheck_Hide_Moored =
new wxCheckBox(
5105 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5106 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5108 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5109 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5110 group_item_spacing);
5112 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5113 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5114 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5115 group_item_spacing);
5117 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5118 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5119 group_item_spacing);
5121 m_pCheck_Scale_Priority =
new wxCheckBox(
5123 _(
"Allow attenuation of less critical targets if more than ... targets"));
5124 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5126 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5127 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5128 group_item_spacing);
5130 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5131 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5132 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5134 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1, _T(
""));
5135 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5137 m_pCheck_Draw_Target_Size =
5138 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5139 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5141 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1, _T(
""));
5142 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5144 m_pCheck_Show_Target_Name =
new wxCheckBox(
5145 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5146 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5148 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5149 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5150 group_item_spacing);
5152 m_pCheck_use_Wpl =
new wxCheckBox(
5153 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5154 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5156 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5157 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5158 wxDefaultSize, 2, Wpl_Action);
5159 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5162 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5163 wxStaticBoxSizer* rolloverSizer =
5164 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5165 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5167 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5168 _(
"Enable route/AIS info block"));
5169 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5171 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5172 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5176 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5177 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5179 m_pCheck_Rollover_Class =
5180 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5181 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5183 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5184 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5186 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5187 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5190 wxStaticBox* alertBox =
5191 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5192 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5193 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5195 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5196 pAlertGrid->AddGrowableCol(1);
5197 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5199 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5200 _(
"Show CPA/TCPA Alert Dialog"));
5201 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5203 m_pCheck_AlertDialog->Connect(
5204 wxEVT_COMMAND_CHECKBOX_CLICKED,
5205 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5214 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1, _T(
""));
5215 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5217 m_pCheck_AlertAudio =
new wxCheckBox(
5218 panelAIS, ID_AISALERTAUDIO,
5219 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5220 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5222 m_pCheck_AlertAudio->Connect(
5223 wxEVT_COMMAND_CHECKBOX_CLICKED,
5224 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5227 wxButton* m_pPlay_Sound =
5228 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"), wxDefaultPosition,
5229 m_small_button_size, 0);
5230 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5232 m_pPlay_Sound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
5233 wxCommandEventHandler(options::OnButtonTestSound),
5239 m_pCheck_Alert_Moored =
new wxCheckBox(
5240 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5241 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5243 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1, _T(
""));
5244 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5246 m_pCheck_Ack_Timout =
new wxCheckBox(
5247 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5248 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5250 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5251 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5252 group_item_spacing);
5260 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5264 GetHandle()->setStyleSheet(getQtStyleSheet());
5269void options::CreatePanel_UI(
size_t parent,
int border_size,
5270 int group_item_spacing) {
5271 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5273 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5274 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5276 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5277 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5279 wxStaticBox* itemLangStaticBox =
5280 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5281 wxStaticBoxSizer* itemLangStaticBoxSizer =
5282 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5284 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5286 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG);
5288 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5291 m_itemLangListBox->Disable();
5294 wxStaticBox* itemFontStaticBox =
5295 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5297 wxSize fontChoiceSize = wxSize(-1, -1);
5299 int fLayout = wxHORIZONTAL;
5302 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5305 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5308 wxStaticBoxSizer* itemFontStaticBoxSizer =
5309 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5310 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5313 m_itemFontElementListBox =
5314 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5315 fontChoiceSize, 0, NULL, wxCB_SORT);
5318 for (
size_t i = 0; i < uniqueStrings.GetCount(); i++) {
5319 m_itemFontElementListBox->Append(uniqueStrings[i]);
5322 if (uniqueStrings.GetCount()) m_itemFontElementListBox->SetSelection(0);
5324 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5326 wxButton* itemFontChooseButton =
5327 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5328 wxDefaultPosition, wxDefaultSize, 0);
5329 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5330#if defined(__WXGTK__) || defined(__WXQT__)
5331 wxButton* itemFontColorButton =
5332 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5333 wxDefaultPosition, wxDefaultSize, 0);
5334 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5336 wxButton* itemFontResetButton =
5337 new wxButton(itemPanelFont, ID_BUTTONFONT_RESET, _(
"Reset to Default"),
5338 wxDefaultPosition, wxDefaultSize, 0);
5339 itemFontStaticBoxSizer->Add(itemFontResetButton, 0, wxALL, border_size);
5341 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5342 wxDefaultPosition, wxDefaultSize, 0);
5343 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5348 wxStaticBox* itemStyleStaticBox =
5349 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5350 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5351 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5352 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5354 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5356 wxArrayPtrVoid styles = g_StyleManager->GetArrayOfStyles();
5357 for (
unsigned int i = 0; i < styles.Count(); i++) {
5359 m_itemStyleListBox->Append(style->name);
5361 m_itemStyleListBox->SetStringSelection(
5362 g_StyleManager->GetCurrentStyle()->name);
5363 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5366 wxStaticBox* miscOptionsBox =
5367 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5368 wxStaticBoxSizer* miscOptions =
5369 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5370 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5373 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5374 pShowStatusBar->SetValue(FALSE);
5375 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5378 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5379 pShowMenuBar->SetValue(FALSE);
5380 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5384 pShowMenuBar->Hide();
5387 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5388 pShowChartBar->SetValue(g_bShowChartBar);
5389 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5391 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5392 _(
"Show Compass/GPS Status Window"));
5393 pShowCompassWin->SetValue(FALSE);
5394 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5396 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5397 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5399 pToolbarAutoHideCB =
5400 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5401 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5403 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
5404 wxSize(50, -1), wxTE_RIGHT);
5405 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5407 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5408 group_item_spacing);
5410 auto enable_debug_cb =
new wxCheckBox(itemPanelFont, wxID_ANY,
5411 _(
"Enable Debug in root context menu"));
5412 enable_debug_cb->Bind(wxEVT_CHECKBOX, [enable_debug_cb](wxCommandEvent&) {
5413 g_enable_root_menu_debug = enable_debug_cb->IsChecked();
5415 enable_debug_cb->SetValue(g_enable_root_menu_debug);
5416 miscOptions->Add(enable_debug_cb, 0, wxALL, group_item_spacing);
5418 wxBoxSizer* pShipsBellsSizer =
new wxBoxSizer(wxHORIZONTAL);
5419 miscOptions->Add(pShipsBellsSizer, 0, wxALL, group_item_spacing);
5422 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5423 pShipsBellsSizer->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5426 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5427 _(
"Enable Touchscreen interface"));
5428 miscOptions->Add(pMobile, 0, wxALL, border_size);
5430 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5431 _(
"Enable Scaled Graphics interface"));
5432 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5437 pResponsive->Hide();
5441 pResponsive->Hide();
5444 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5445 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5447 pZoomButtons->Hide();
5451 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5452 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5454 wxButton* itemEcdisHelp =
5455 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5456 wxDefaultPosition, wxDefaultSize, 0);
5457 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5460 pInlandEcdis->Hide();
5461 itemEcdisHelp->Hide();
5464 miscOptions->AddSpacer(10);
5466 wxFlexGridSizer* sliderSizer;
5467 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5468 sliderSizer->AddGrowableCol(1);
5469 sliderSizer->SetFlexibleDirection(wxBOTH);
5470 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5472 m_pSlider_GUI_Factor =
5473 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5474 m_sliderSize, SLIDER_STYLE);
5475 m_pSlider_GUI_Factor->Hide();
5476 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5477 _(
"User Interface scale factor")),
5479 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5480 m_pSlider_GUI_Factor->Show();
5483 prepareSlider(m_pSlider_GUI_Factor);
5486 m_pSlider_Chart_Factor =
5487 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5488 m_sliderSize, SLIDER_STYLE);
5489 m_pSlider_Chart_Factor->Hide();
5491 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5493 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5494 m_pSlider_Chart_Factor->Show();
5497 prepareSlider(m_pSlider_Chart_Factor);
5500 m_pSlider_Ship_Factor =
5501 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5502 m_sliderSize, SLIDER_STYLE);
5503 m_pSlider_Ship_Factor->Hide();
5505 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5507 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5508 m_pSlider_Ship_Factor->Show();
5511 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5514 m_pSlider_Text_Factor =
5515 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5516 m_sliderSize, SLIDER_STYLE);
5517 m_pSlider_Text_Factor->Hide();
5519 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5521 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5522 m_pSlider_Text_Factor->Show();
5525 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5528 m_pSlider_ENCText_Factor =
5529 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5530 m_sliderSize, SLIDER_STYLE);
5531 m_pSlider_ENCText_Factor->Hide();
5533 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5535 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5536 m_pSlider_ENCText_Factor->Show();
5539 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5542 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5543 _(
"Mouse wheel zoom sensitivity")),
5545 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5546 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5548 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5549 miscOptions->AddSpacer(20);
5552void options::OnResetFont(wxCommandEvent& event) {
5553 wxString itemElement;
5554 int i = m_itemFontElementListBox->GetSelection();
5556 itemElement = m_itemFontElementListBox->GetString(i);
5558 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5560 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5561 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5564 m_textSample->SetFont(*pFont);
5565 m_textSample->SetForegroundColour(colour);
5566 m_textSample->Refresh();
5569 gFrame->UpdateAllFonts();
5570 m_bfontChanged =
true;
5571 OnFontChoice(event);
5576void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5577 m_pCheck_AlertAudio->Enable(event.IsChecked());
5578 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5581void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5582 if (event.IsChecked()) {
5583 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5584 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5585 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5589void options::CreateListbookIcons() {
5592 if (!g_bresponsive) {
5595 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5597#if wxCHECK_VERSION(2, 8, 12)
5598 m_topImgList->Add(style->GetIcon(_T(
"Display"), sx, sy));
5599 m_topImgList->Add(style->GetIcon(_T(
"Charts"), sx, sy));
5600 m_topImgList->Add(style->GetIcon(_T(
"Connections"), sx, sy));
5601 m_topImgList->Add(style->GetIcon(_T(
"Ship"), sx, sy));
5602 m_topImgList->Add(style->GetIcon(_T(
"UI"), sx, sy));
5603 m_topImgList->Add(style->GetIcon(_T(
"Plugins"), sx, sy));
5607 bmp = style->GetIcon(_T(
"Display"));
5608 img = bmp.ConvertToImage();
5609 img.ConvertAlphaToMask(128);
5610 bmp = wxBitmap(img);
5611 m_topImgList->Add(bmp);
5612 bmp = style->GetIcon(_T(
"Charts"));
5613 img = bmp.ConvertToImage();
5614 img.ConvertAlphaToMask(128);
5615 bmp = wxBitmap(img);
5616 m_topImgList->Add(bmp);
5617 bmp = style->GetIcon(_T(
"Connections"));
5618 img = bmp.ConvertToImage();
5619 img.ConvertAlphaToMask(128);
5620 bmp = wxBitmap(img);
5621 m_topImgList->Add(bmp);
5622 bmp = style->GetIcon(_T(
"Ship"));
5623 img = bmp.ConvertToImage();
5624 img.ConvertAlphaToMask(128);
5625 bmp = wxBitmap(img);
5626 m_topImgList->Add(bmp);
5627 bmp = style->GetIcon(_T(
"UI"));
5628 img = bmp.ConvertToImage();
5629 img.ConvertAlphaToMask(128);
5630 bmp = wxBitmap(img);
5631 m_topImgList->Add(bmp);
5632 bmp = style->GetIcon(_T(
"Plugins"));
5633 img = bmp.ConvertToImage();
5634 img.ConvertAlphaToMask(128);
5635 bmp = wxBitmap(img);
5636 m_topImgList->Add(bmp);
5640 bmps = style->GetIcon(_T(
"Display"));
5641 int base_size = bmps.GetWidth();
5642 double tool_size = base_size;
5644 double premult = 1.0;
5648 double target_size = 6.0;
5650 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5651 premult = target_size / basic_tool_size_mm;
5654 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5655 postmult = wxMin(postmult, 3.0);
5656 postmult = wxMax(postmult, 1.0);
5658 int sizeTab = base_size * postmult * premult;
5660 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5664 bmp = style->GetIcon(_T(
"Display"));
5665 img = bmp.ConvertToImage();
5666 simg = img.Scale(sizeTab, sizeTab);
5667 bmp = wxBitmap(simg);
5668 m_topImgList->Add(bmp);
5669 bmp = style->GetIcon(_T(
"Charts"));
5670 img = bmp.ConvertToImage();
5671 simg = img.Scale(sizeTab, sizeTab);
5672 bmp = wxBitmap(simg);
5673 m_topImgList->Add(bmp);
5674 bmp = style->GetIcon(_T(
"Connections"));
5675 img = bmp.ConvertToImage();
5676 simg = img.Scale(sizeTab, sizeTab);
5677 bmp = wxBitmap(simg);
5678 m_topImgList->Add(bmp);
5679 bmp = style->GetIcon(_T(
"Ship"));
5680 img = bmp.ConvertToImage();
5681 simg = img.Scale(sizeTab, sizeTab);
5682 bmp = wxBitmap(simg);
5683 m_topImgList->Add(bmp);
5684 bmp = style->GetIcon(_T(
"UI"));
5685 img = bmp.ConvertToImage();
5686 simg = img.Scale(sizeTab, sizeTab);
5687 bmp = wxBitmap(simg);
5688 m_topImgList->Add(bmp);
5689 bmp = style->GetIcon(_T(
"Plugins"));
5690 img = bmp.ConvertToImage();
5691 simg = img.Scale(sizeTab, sizeTab);
5692 bmp = wxBitmap(simg);
5693 m_topImgList->Add(bmp);
5697void options::CreateControls(
void) {
5698 int border_size = 4;
5700 int group_item_spacing = 2;
5702 int font_size_y, font_descent, font_lead;
5703 GetTextExtent(_T(
"0"), NULL, &font_size_y, &font_descent, &font_lead);
5704 m_fontHeight = font_size_y + font_descent + font_lead;
5708 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5709 m_fontHeight * 8 / 10);
5712 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5716 m_small_button_size =
5717 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5719 m_nCharWidthMax = GetSize().x / GetCharWidth();
5722 pEnableZoomToCursor = NULL;
5723 pSmoothPanZoom = NULL;
5728 width = g_monitor_info[g_current_monitor].width;
5729 height = g_monitor_info[g_current_monitor].height;
5731 if (!g_bresponsive && height <= 800) {
5733 group_item_spacing = 1;
5737 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
5738 inputFlags = wxSizerFlags(0)
5739 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
5740 .Border(wxALL, group_item_spacing);
5741 verticleInputFlags =
5742 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
5743 groupLabelFlags = wxSizerFlags(0)
5744 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
5745 .Border(wxALL, group_item_spacing);
5746 groupLabelFlagsHoriz =
5747 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
5748 groupInputFlags = wxSizerFlags(0)
5749 .Align(wxALIGN_LEFT | wxALIGN_TOP)
5750 .Border(wxBOTTOM, group_item_spacing * 2)
5754 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
5759 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
5760 itemDialog1->SetSizer(itemBoxSizer2);
5764 wxFont* qFont = dialogFont;
5766 wxString wqs = getFontQtStylesheet(qFont);
5767 wxCharBuffer sbuf = wqs.ToUTF8();
5768 QString qsb = QString(sbuf.data());
5770 QString qsbq = getQtStyleSheet();
5772 itemDialog1->GetHandle()->setStyleSheet(qsb +
5779#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5781 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
5782 wxSize(-1, -1), flags);
5783 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
5784 wxListbookEventHandler(options::OnPageChange), NULL,
5788 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
5789 wxSize(-1, -1), flags);
5790 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5791 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
5798 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
5802 CreateListbookIcons();
5804 m_pListbook->SetImageList(m_topImgList);
5805 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
5807 wxBoxSizer* buttons =
new wxBoxSizer(wxHORIZONTAL);
5808 itemBoxSizer2->Add(buttons, 0, wxALIGN_RIGHT | wxALL, border_size);
5810 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
5811 m_OKButton->SetDefault();
5812 buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5814 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
5815 buttons->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5817 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
5818 buttons->Add(m_ApplyButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5820 m_pageDisplay = CreatePanel(_(
"Display"));
5821 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
5822 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
5823 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
5824 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
5826 m_pageCharts = CreatePanel(_(
"Charts"));
5827 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
5828 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
5831 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
5832 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
5835 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
5837#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5838 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5839 wxListbookEventHandler(options::OnChartsPageChange), NULL,
5842 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5843 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
5849 wxString ConnTab = _(
"Connections");
5852 m_pageConnections = CreatePanel(ConnTab);
5854 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
5856 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
5862 m_pageShips = CreatePanel(_(
"Ships"));
5863 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
5864 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
5866 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
5869 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
5871 wxString UITab = _(
"User Interface");
5874 m_pageUI = CreatePanel(UITab);
5875 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
5876 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
5878 m_pagePlugins = CreatePanel(_(
"Plugins"));
5879 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
5881 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
5882 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
5885 if (g_pi_manager) g_pi_manager->NotifySetupOptions();
5887 SetColorScheme(
static_cast<ColorScheme
>(0));
5898 SetSizeHints(-1, -1, width - marginx, height - marginy);
5907void options::SetInitialPage(
int page_sel,
int sub_page) {
5908 if (page_sel < (
int)m_pListbook->GetPageCount())
5909 m_pListbook->SetSelection(page_sel);
5911 m_pListbook->SetSelection(0);
5913 if (sub_page >= 0) {
5914 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
5915 wxNotebookPage* pg = m_pListbook->GetPage(i);
5916 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
5918 if (i == (
size_t)page_sel) {
5919 if (sub_page < (
int)nb->GetPageCount())
5920 nb->SetSelection(sub_page);
5922 nb->SetSelection(0);
5924 nb->ChangeSelection(0);
5930void options::SetColorScheme(ColorScheme cs) {
5933#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5934 wxListView* lv = m_pListbook->GetListView();
5935 lv->SetBackgroundColour(GetBackgroundColour());
5938 delete m_topImgList;
5939 CreateListbookIcons();
5940 m_pListbook->SetImageList(m_topImgList);
5948void options::OnAISRolloverClick(wxCommandEvent& event) {
5949 m_pCheck_Rollover_Class->Enable(event.IsChecked());
5950 m_pCheck_Rollover_COG->Enable(event.IsChecked());
5951 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
5952 pStatic_CallSign->Enable(event.IsChecked());
5955void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
5957 case ID_SCREENCONFIG1:
5958 if (m_sconfigSelect_twovertical)
5959 m_sconfigSelect_twovertical->SetSelected(
false);
5963 case ID_SCREENCONFIG2:
5964 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
5970void options::SetInitialSettings(
void) {
5973 m_returnChanges = 0;
5974 m_bfontChanged =
false;
5975 m_font_element_array.Clear();
5977 b_oldhaveWMM = b_haveWMM;
5978 auto loader = PluginLoader::getInstance();
5979 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
5982 switch (g_canvasConfig) {
5985 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
5986 if (m_sconfigSelect_twovertical)
5987 m_sconfigSelect_twovertical->SetSelected(
false);
5990 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
5991 if (m_sconfigSelect_twovertical)
5992 m_sconfigSelect_twovertical->SetSelected(
true);
5995 m_screenConfig = g_canvasConfig;
5999 ActiveChartArray.Clear();
6000 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6001 ActiveChartArray.Add(m_CurrentDirList[i]);
6005 if (m_pWorkDirList) {
6006 UpdateWorkArrayFromDisplayPanel();
6007 groupsPanel->SetDBDirs(*m_pWorkDirList);
6010 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6011 delete m_pGroupArray;
6012 m_pGroupArray = groupsPanel->CloneChartGroupArray(g_pGroupArray);
6013 groupsPanel->SetGroupArray(m_pGroupArray);
6014 groupsPanel->SetInitialSettings();
6018 pShowStatusBar->SetValue(g_bShowStatusBar);
6020 pShowMenuBar->SetValue(g_bShowMenuBar);
6022 pShowCompassWin->SetValue(g_bShowCompassWin);
6025 s.Printf(_T(
"%d"), g_COGAvgSec);
6026 pCOGUPUpdateSecs->SetValue(s);
6028 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6029 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6031 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6032 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6033 pMobile->SetValue(g_btouch);
6034 pResponsive->SetValue(g_bresponsive);
6035 pRollover->SetValue(g_bRollover);
6036 m_pCheck_Rollover_Class->Enable(g_bRollover);
6037 m_pCheck_Rollover_COG->Enable(g_bRollover);
6038 m_pCheck_Rollover_CPA->Enable(g_bRollover);
6039 pStatic_CallSign->Enable(g_bRollover);
6041 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6045 pInlandEcdis->SetValue(g_bInlandEcdis);
6047 pOpenGL->SetValue(g_bopengl);
6049 if (pSmoothPanZoom) pSmoothPanZoom->SetValue(g_bsmoothpanzoom);
6050 pCBTrueShow->SetValue(g_bShowTrue);
6051 pCBMagShow->SetValue(g_bShowMag);
6053 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6057 itemStaticTextUserVar->SetLabel(
6058 _(
"WMM Plugin calculated magnetic variation"));
6060 s.Printf(_T(
"%4.1f"), gVar);
6061 pMagVar->SetValue(s);
6063 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6065 s.Printf(_T(
"%4.1f"), g_UserVar);
6066 pMagVar->SetValue(s);
6069 int newLength = itemStaticTextUserVar->GetLabel().Length();
6072 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6073 wxSize sz = GetSize();
6074 SetSize(sz.x + 1, sz.y);
6078 itemStaticTextUserVar2->Enable(!b_haveWMM);
6079 pMagVar->Enable(!b_haveWMM);
6081 if (pSDisplayGrid) pSDisplayGrid->SetValue(g_bDisplayGrid);
6086 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6090 wxString stringDefaultBoatSpeed;
6091 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6092 g_defaultBoatSpeed = 6.0;
6093 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6095 stringDefaultBoatSpeed.Printf(_T(
"%d"), (
int)g_defaultBoatSpeedUserUnit);
6096 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6100 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6101 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6102 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6104 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6106 s.Printf(_T(
"%6.2f"), g_ownship_predictor_minutes);
6108 s.Printf(_T(
"%4.0f"), g_ownship_predictor_minutes);
6109 m_pText_OSCOG_Predictor->SetValue(s);
6111 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6112 g_ownship_HDTpredictor_miles) > 1e-4)
6113 s.Printf(_T(
"%6.2f"), g_ownship_HDTpredictor_miles);
6115 s.Printf(_T(
"%4.0f"), g_ownship_HDTpredictor_miles);
6116 m_pText_OSHDT_Predictor->SetValue(s);
6118 m_pShipIconType->SetSelection(g_OwnShipIconType);
6119 wxCommandEvent eDummy;
6120 OnShipTypeSelect(eDummy);
6121 m_pOSLength->SetValue(
6122 wxString::Format(_T(
"%.1f"), g_n_ownship_length_meters));
6123 m_pOSWidth->SetValue(wxString::Format(_T(
"%.1f"), g_n_ownship_beam_meters));
6124 m_pOSGPSOffsetX->SetValue(
6125 wxString::Format(_T(
"%.1f"), g_n_gps_antenna_offset_x));
6126 m_pOSGPSOffsetY->SetValue(
6127 wxString::Format(_T(
"%.1f"), g_n_gps_antenna_offset_y));
6128 m_pOSMinSize->SetValue(wxString::Format(_T(
"%d"), g_n_ownship_min_mm));
6129 m_pText_ACRadius->SetValue(
6130 wxString::Format(_T(
"%.3f"), g_n_arrival_circle_radius));
6133 if (g_iNavAidRadarRingsNumberVisible > 10)
6134 g_iNavAidRadarRingsNumberVisible = 10;
6135 pNavAidRadarRingsNumberVisible->SetSelection(
6136 g_iNavAidRadarRingsNumberVisible);
6137 buf.Printf(_T(
"%.3f"), g_fNavAidRadarRingsStep);
6138 pNavAidRadarRingsStep->SetValue(buf);
6139 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6140 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6142 pScaMinChckB->SetValue(g_bUseWptScaMin);
6143 m_pText_ScaMin->SetValue(wxString::Format(_T(
"%i"), g_iWpt_ScaMin));
6144 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6146 OnRadarringSelect(eDummy);
6148 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6149 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6150 buf.Printf(_T(
"%.3f"), g_fWaypointRangeRingsStep);
6151 pWaypointRangeRingsStep->SetValue(buf);
6152 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6153 m_colourWaypointRangeRingsColour->SetColour(g_colourWaypointRangeRingsColour);
6154 OnWaypointRangeRingSelect(eDummy);
6155 pShowshipToActive->SetValue(g_bShowShipToActive);
6156 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6157 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6159 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6160 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6162 pSogCogFromLLCheckBox->SetValue(g_own_ship_sog_cog_calc);
6163 pSogCogFromLLDampInterval->SetValue(g_own_ship_sog_cog_calc_damp_sec);
6165 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6167 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6168 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6170 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6172 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6175 pSDMMFormat->Select(g_iSDMMFormat);
6176 pDistanceFormat->Select(g_iDistanceFormat);
6177 pSpeedFormat->Select(g_iSpeedFormat);
6178 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6179 pTempFormat->Select(g_iTempFormat);
6181 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6182 g_bAdvanceRouteWaypointOnArrivalOnly);
6184 pTrackDaily->SetValue(g_bTrackDaily);
6185 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6186 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6187 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6188 TIME_TYPE_COMPUTER);
6189 pTrackHighlite->SetValue(g_bHighliteTracks);
6190 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6191 pTrackPrecision->SetSelection(g_nTrackPrecision);
6193 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6197 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6199 s.Printf(_T(
"%4.1f"), g_CPAMax_NM);
6200 m_pText_CPA_Max->SetValue(s);
6202 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6204 s.Printf(_T(
"%4.1f"), g_CPAWarn_NM);
6205 m_pText_CPA_Warn->SetValue(s);
6207 if (m_pCheck_CPA_Warn->GetValue()) {
6208 m_pCheck_CPA_WarnT->Enable();
6209 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6211 m_pCheck_CPA_WarnT->Disable();
6213 s.Printf(_T(
"%4.0f"), g_TCPA_Max);
6214 m_pText_CPA_WarnT->SetValue(s);
6217 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6219 s.Printf(_T(
"%4.0f"), g_MarkLost_Mins);
6220 m_pText_Mark_Lost->SetValue(s);
6222 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6224 s.Printf(_T(
"%4.0f"), g_RemoveLost_Mins);
6225 m_pText_Remove_Lost->SetValue(s);
6228 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6230 s.Printf(_T(
"%4.0f"), g_ShowCOG_Mins);
6231 m_pText_COG_Predictor->SetValue(s);
6233 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6234 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6236 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6238 s.Printf(_T(
"%4.0f"), g_AISShowTracks_Mins);
6239 m_pText_Track_Length->SetValue(s);
6241 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6243 s.Printf(_T(
"%4.1f"), g_ShowMoored_Kts);
6244 m_pText_Moored_Speed->SetValue(s);
6246 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6248 s.Printf(_T(
"%4.1f"), g_AIS_RealtPred_Kts);
6249 m_pText_RealtPred_Speed->SetValue(s);
6251 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6253 s.Printf(_T(
"%i"), g_ShowScaled_Num);
6254 m_pText_Scale_Priority->SetValue(s);
6256 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6258 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6259 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6261 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6263 s.Printf(_T(
"%d"), g_Show_Target_Name_Scale);
6264 m_pText_Show_Target_Name_Scale->SetValue(s);
6266 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6267 m_pWplAction->SetSelection(g_WplAction);
6270 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6271 if (g_bAIS_CPA_Alert) {
6272 m_pCheck_AlertAudio->Enable();
6273 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6275 m_pCheck_AlertAudio->Disable();
6276 m_pCheck_AlertAudio->SetValue(
false);
6279 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6281 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6282 s.Printf(_T(
"%4.0f"), g_AckTimeout_Mins);
6283 m_pText_ACK_Timeout->SetValue(s);
6286 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6287 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6288 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6291 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6292 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6293 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6295 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6296 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6298 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6299 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6300 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6301 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6302 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6303 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6305 if (!g_config_display_size_manual) {
6306 pRBSizeAuto->SetValue(TRUE);
6307 for (
const auto& mm : g_monitor_info) {
6308 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6310 screenmm.RemoveLast();
6311 pScreenMM->Disable();
6313 for (
const auto& mm : g_config_display_size_mm) {
6314 screenmm.Append(wxString::Format(
"%zu,", mm));
6316 screenmm.RemoveLast();
6317 pRBSizeManual->SetValue(TRUE);
6320 pScreenMM->SetValue(screenmm);
6322 pDepthUnitSelect->SetSelection(g_nDepthUnitDisplay);
6323 UpdateOptionsUnits();
6325 SetInitialVectorSettings();
6327 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6329 s.Printf(_T(
"%d"), g_nAutoHideToolbar);
6330 pToolbarHideSecs->SetValue(s);
6334 delete m_pSerialArray;
6335 m_pSerialArray = NULL;
6336 m_pSerialArray = EnumerateSerialPorts();
6337 m_bForceNewToolbaronCancel =
false;
6340void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6341 if (ps57CtlListBox) {
6343 ps57CtlListBox->Clear();
6344 marinersStdXref.clear();
6346 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6348 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6351 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6352 item = ps52plib->OBJLDescriptions[iPtr];
6354 item = wxString(pOLE->OBJLName, wxConvUTF8);
6360 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6361 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6362 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6364 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6365 (catl == DISPLAYBASE))
6367 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6370 bool benable =
true;
6371 if (cat > 0) benable = cat != DISPLAYBASE;
6376 int newpos = ps57CtlListBox->Append(item, benable,
false);
6377 marinersStdXref.push_back(newpos);
6378 for (
size_t i = 0; i < iPtr; i++) {
6379 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6383 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6385 if (cat == DISPLAYBASE) bviz =
true;
6388 if (cat == STANDARD) {
6393 ps57CtlListBox->Check(newpos, bviz);
6397 ps57CtlListBox->RunLayout();
6400 wxSize s = ps57CtlListBox->GetSize();
6401 ps57CtlListBox->SetSize(s.x, s.y - 1);
6405void options::SetInitialVectorSettings(
void) {
6406 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6410 m_bVectorInit =
true;
6411 resetMarStdList(
true,
false);
6414 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6418 switch (ps52plib->GetDisplayCategory()) {
6428 case (MARINERS_STANDARD):
6436 if (pDispCat) pDispCat->SetSelection(nset);
6440 bool benableMarStd =
false;
6442 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); i++) {
6445 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6446 benableMarStd =
true;
6455 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6456 itemButtonClearList->Enable(benableMarStd);
6457 itemButtonSelectList->Enable(benableMarStd);
6458 itemButtonSetStd->Enable(benableMarStd);
6461 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6462 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6463 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6464 if (pCheck_XLSECTTEXT)
6465 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6467 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6468 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6469 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6470 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6472 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6473 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6476 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6477 pPointStyle->SetSelection(0);
6479 pPointStyle->SetSelection(1);
6481 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6482 pBoundStyle->SetSelection(0);
6484 pBoundStyle->SetSelection(1);
6486 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6487 p24Color->SetSelection(0);
6489 p24Color->SetSelection(1);
6491 UpdateOptionsUnits();
6495void options::UpdateOptionsUnits(
void) {
6496 int depthUnit = pDepthUnitSelect->GetSelection();
6498 depthUnit = wxMax(depthUnit, 0);
6499 depthUnit = wxMin(depthUnit, 2);
6505 else if (depthUnit == 2)
6511 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6512 wxString depthUnitString = depthUnitStrings[depthUnit];
6513 m_depthUnitsShal->SetLabel(depthUnitString);
6514 m_depthUnitsSafe->SetLabel(depthUnitString);
6515 m_depthUnitsDeep->SetLabel(depthUnitString);
6518 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6520 m_ShallowCtl->SetValue(s);
6522 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6524 m_SafetyCtl->SetValue(s);
6526 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6528 m_DeepCtl->SetValue(s);
6558void options::OnSizeAutoButton(wxCommandEvent& event) {
6560 for (
const auto& mm : g_monitor_info) {
6561 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6563 screenmm.RemoveLast();
6564 pScreenMM->SetValue(screenmm);
6565 pScreenMM->Disable();
6566 g_config_display_size_manual = FALSE;
6569void options::OnSizeManualButton(wxCommandEvent& event) {
6571 if (g_config_display_size_mm.size() > 0 && g_config_display_size_mm[0] > 0) {
6572 for (
const auto& mm : g_config_display_size_mm) {
6573 screenmm.Append(wxString::Format(
"%zu,", mm));
6576 for (
const auto& mm : g_monitor_info) {
6577 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6580 screenmm.RemoveLast();
6581 pScreenMM->SetValue(screenmm);
6582 pScreenMM->Enable();
6583 g_config_display_size_manual = TRUE;
6586void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6588void options::OnCPAWarnClick(wxCommandEvent& event) {
6589 if (m_pCheck_CPA_Warn->GetValue()) {
6590 m_pCheck_CPA_WarnT->Enable();
6592 m_pCheck_CPA_WarnT->SetValue(FALSE);
6593 m_pCheck_CPA_WarnT->Disable();
6597void options::OnSyncCogPredClick(wxCommandEvent& event) {
6598 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6599 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6600 m_pText_COG_Predictor->Disable();
6603 s.Printf(_T(
"%4.0f"), g_ShowCOG_Mins);
6604 m_pText_COG_Predictor->SetValue(s);
6605 m_pText_COG_Predictor->Enable();
6609void options::OnShipTypeSelect(wxCommandEvent& event) {
6610 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6611 dispOptions->Layout();
6613 itemPanelShip->Layout();
6614 itemPanelShip->Refresh();
6618void options::OnRadarringSelect(wxCommandEvent& event) {
6619 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6620 dispOptions->Layout();
6622 itemPanelShip->Layout();
6623 itemPanelShip->Refresh();
6627void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6628 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6629 dispOptions->Layout();
6631 itemPanelRoutes->Layout();
6632 itemPanelRoutes->Refresh();
6636void options::OnGLClicked(wxCommandEvent& event) {
6641void options::OnOpenGLOptions(wxCommandEvent& event) {
6643 OpenGLOptionsDlg dlg(
this);
6645 if (dlg.ShowModal() == wxID_OK) {
6646 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6647 g_GLOptions.m_bUseAcceleratedPanning = g_bGLexpert
6648 ? dlg.GetAcceleratedPanning()
6649 : gFrame->GetPrimaryCanvas()
6651 ->CanAcceleratePanning();
6654 g_bSoftwareGL = dlg.GetSoftwareGL();
6656 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6657 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6661 g_GLOptions.m_bTextureCompressionCaching =
6662 dlg.GetTextureCompressionCaching();
6663 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6666 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6669 if (g_bopengl && g_glTextureManager &&
6670 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6672 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6674 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6675 ::wxBeginBusyCursor();
6676 gFrame->GetPrimaryCanvas()->GetglCanvas()->SetupCompression();
6677 g_glTextureManager->ClearAllRasterTextures();
6678 ::wxEndBusyCursor();
6681 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6684 if (dlg.GetRebuildCache()) {
6685 m_returnChanges = REBUILD_RASTER_CACHE;
6691void options::OnChartDirListSelect(wxCommandEvent& event) {
6693 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6694 m_removeBtn->Enable(selected);
6695 if (m_compressBtn) m_compressBtn->Enable(selected);
6699void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6702 const bool select = pDispCat->GetSelection() == 3;
6703 ps57CtlListBox->Enable(select);
6704 itemButtonClearList->Enable(select);
6705 itemButtonSelectList->Enable(select);
6706 itemButtonSetStd->Enable(select);
6712void options::OnButtonClearClick(wxCommandEvent& event) {
6713 resetMarStdList(
false,
false);
6722void options::OnButtonSelectClick(wxCommandEvent& event) {
6723 int nOBJL = ps57CtlListBox->GetCount();
6724 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
6729void options::OnButtonSetStd(wxCommandEvent& event) {
6730 resetMarStdList(
false,
true);
6735bool options::ShowToolTips(
void) {
return TRUE; }
6737void options::OnCharHook(wxKeyEvent& event) {
6738 if (event.GetKeyCode() == WXK_RETURN &&
6739 event.GetModifiers() == wxMOD_CONTROL) {
6740 wxCommandEvent okEvent;
6741 okEvent.SetId(xID_OK);
6742 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
6743 GetEventHandler()->AddPendingEvent(okEvent);
6748void options::OnButtonaddClick(wxCommandEvent& event) {
6750 int dresult = g_Platform->DoDirSelectorDialog(
6751 this, &selDir, _(
"Add a directory containing chart files"),
6752 *pInit_Chart_Dir,
false);
6754 if (dresult != wxID_CANCEL) AddChartDir(selDir);
6759void options::AddChartDir(
const wxString& dir) {
6760 wxFileName dirname = wxFileName(dir);
6761 pInit_Chart_Dir->Empty();
6766 f.MakeRelativeTo(g_Platform->GetHomeDir());
6767 dirAdd = f.GetFullPath();
6769 pInit_Chart_Dir->Append(dirname.GetPath());
6774 cdi.fullpath = dirAdd;
6775 ActiveChartArray.Add(cdi);
6777 UpdateChartDirList();
6779 k_charts |= CHANGE_CHARTS;
6781 pScanCheckBox->Disable();
6784void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
6787 ActiveChartArray.Clear();
6788 for (
size_t i = 0; i < p.GetCount(); i++) {
6789 ActiveChartArray.Add(p[i]);
6792 UpdateChartDirList();
6795void options::UpdateWorkArrayFromDisplayPanel(
void) {
6797 int n = ActiveChartArray.GetCount();
6798 if (m_pWorkDirList) {
6799 m_pWorkDirList->Clear();
6800 for (
int i = 0; i < n; i++) {
6801 dirname = ActiveChartArray[i].fullpath;
6802 if (!dirname.IsEmpty()) {
6805 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
6806 (dirname.Last() == wxChar(_T(
'\r'))))
6807 dirname.RemoveLast();
6813 bool b_added = FALSE;
6816 int nDir = m_CurrentDirList.GetCount();
6818 for (
int i = 0; i < nDir; i++) {
6819 if (m_CurrentDirList[i].fullpath == dirname) {
6821 m_pWorkDirList->Add(cdi);
6829 cdin.fullpath = dirname;
6830 m_pWorkDirList->Add(cdin);
6837void options::OnApplyClick(wxCommandEvent& event) {
6838 ApplyChanges(event);
6843 if ((m_returnChanges & FONT_CHANGED) ||
6844 (m_returnChanges & NEED_NEW_OPTIONS)) {
6845 gFrame->PrepareOptionsClose(
this, m_returnChanges);
6846 if (!(m_returnChanges & FONT_CHANGED_SAFE))
6847 gFrame->ScheduleReconfigAndSettingsReload(
true,
true);
6851 if ((m_returnChanges & CONFIG_CHANGED)) {
6852 gFrame->ScheduleReconfigAndSettingsReload(
true,
false);
6857void options::ApplyChanges(wxCommandEvent& event) {
6863 if (m_pShipIconType->GetSelection() > 0) {
6864 double n_ownship_length_meters;
6865 double n_ownship_beam_meters;
6866 double n_gps_antenna_offset_y;
6867 double n_gps_antenna_offset_x;
6868 long n_ownship_min_mm;
6869 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
6870 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
6871 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
6872 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
6873 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
6875 if (n_ownship_length_meters <= 0)
6876 msg += _(
"\n - your ship's length must be > 0");
6877 if (n_ownship_beam_meters <= 0)
6878 msg += _(
"\n - your ship's beam must be > 0");
6879 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
6881 "\n - your GPS offset from midship must be within your ship's beam");
6882 if (n_gps_antenna_offset_y < 0 ||
6883 n_gps_antenna_offset_y > n_ownship_length_meters)
6885 _(
"\n - your GPS offset from bow must be within your ship's length");
6886 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
6887 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
6888 if (!msg.IsEmpty()) {
6889 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
6890 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
6891 ::wxEndBusyCursor();
6892 event.SetInt(wxID_STOP);
6895 g_n_ownship_length_meters = n_ownship_length_meters;
6896 g_n_ownship_beam_meters = n_ownship_beam_meters;
6897 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
6898 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
6899 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
6901 g_OwnShipIconType = m_pShipIconType->GetSelection();
6902 g_bShowShipToActive = pShowshipToActive->GetValue();
6903 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
6904 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
6906 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
6907 g_n_arrival_circle_radius =
6908 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
6910 wxString* icon_name =
6911 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
6912 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
6915 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
6916 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
6918 g_bUseWptScaMin = pScaMinChckB->GetValue();
6919 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
6920 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
6923 if (m_bfontChanged) {
6925 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6926 gFrame->GetPrimaryCanvas()->GetglCanvas()->ResetGridFont();
6930 m_returnChanges |= FONT_CHANGED;
6934 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
6935 m_returnChanges |= FONT_CHANGED_SAFE;
6939 UpdateWorkArrayFromDisplayPanel();
6941 groupsPanel->SetDBDirs(*m_pWorkDirList);
6942 groupsPanel->m_treespopulated = FALSE;
6944 int k_force = FORCE_UPDATE;
6945 if (pUpdateCheckBox) {
6946 if (!pUpdateCheckBox->GetValue()) k_force = 0;
6947 pUpdateCheckBox->Enable();
6948 pUpdateCheckBox->SetValue(FALSE);
6953 m_returnChanges |= k_force;
6955 int k_scan = SCAN_UPDATE;
6956 if (pScanCheckBox) {
6957 if (!pScanCheckBox->GetValue()) k_scan = 0;
6958 pScanCheckBox->Enable();
6959 pScanCheckBox->SetValue(FALSE);
6964 m_returnChanges |= k_scan;
6968 if (groupsPanel->modified) {
6969 groupsPanel->EmptyChartGroupArray(g_pGroupArray);
6970 delete g_pGroupArray;
6971 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
6972 m_returnChanges |= GROUPS_CHANGED;
6977 g_bShowStatusBar = pShowStatusBar->GetValue();
6979 g_bShowMenuBar = pShowMenuBar->GetValue();
6981 g_bShowCompassWin = pShowCompassWin->GetValue();
6984 g_bShowChartBar = pShowChartBar->GetValue();
6986 wxString screenmm = pScreenMM->GetValue();
6987 wxStringTokenizer tkz(screenmm, _T(
"," ));
6988 g_config_display_size_mm.clear();
6989 while (tkz.HasMoreTokens()) {
6990 wxString token = tkz.GetNextToken();
6992 if (token.ToLong(&mm) && mm > 0) {
6993 g_config_display_size_mm.push_back(mm);
6995 g_config_display_size_mm.push_back(0);
6998 g_config_display_size_manual = pRBSizeManual->GetValue();
7001 comm_dialog->ApplySettings();
7003 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7004 if (pSDisplayGrid) g_bDisplayGrid = pSDisplayGrid->GetValue();
7007 bool temp_bquilting = pCDOQuilting->GetValue();
7010 g_bQuiltEnable = temp_bquilting;
7014 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7015 g_bskew_comp = pSkewComp->GetValue();
7016 g_btouch = pMobile->GetValue();
7017 g_bresponsive = pResponsive->GetValue();
7018 g_bRollover = pRollover->GetValue();
7019 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7021 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7024 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7025 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7026 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7031 g_bsmoothpanzoom = pSmoothPanZoom->GetValue();
7033 g_bsmoothpanzoom =
false;
7035 if (pSmoothPanZoom) g_bsmoothpanzoom = pSmoothPanZoom->GetValue();
7037 g_bsmoothpanzoom =
false;
7040 long update_val = 1;
7041 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7042 g_COGAvgSec = wxMin(
static_cast<int>(update_val), MAX_COG_AVERAGE_SECONDS);
7046 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7048 g_bShowTrue = pCBTrueShow->GetValue();
7049 g_bShowMag = pCBMagShow->GetValue();
7051 auto loader = PluginLoader::getInstance();
7052 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
7053 if (!b_haveWMM && !b_oldhaveWMM) {
7054 pMagVar->GetValue().ToDouble(&g_UserVar);
7058 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7059 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7062 g_iNavAidRadarRingsNumberVisible =
7063 pNavAidRadarRingsNumberVisible->GetSelection();
7064 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7065 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7066 g_fNavAidRadarRingsStep = temp_dbl;
7067 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7068 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7069 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7070 g_fWaypointRangeRingsStep = temp_dbl;
7071 g_iWaypointRangeRingsStepUnits =
7072 m_itemWaypointRangeRingsUnits->GetSelection();
7073 g_colourWaypointRangeRingsColour =
7074 m_colourWaypointRangeRingsColour->GetColour();
7075 g_colourWaypointRangeRingsColour =
7076 wxColour(g_colourWaypointRangeRingsColour.Red(),
7077 g_colourWaypointRangeRingsColour.Green(),
7078 g_colourWaypointRangeRingsColour.Blue());
7079 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7080 g_own_ship_sog_cog_calc = pSogCogFromLLCheckBox->GetValue();
7081 g_own_ship_sog_cog_calc_damp_sec = pSogCogFromLLDampInterval->GetValue();
7083 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7085 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7087 if (pCmdSoundString) {
7088 g_CmdSoundString = pCmdSoundString->GetValue();
7089 if (wxIsEmpty(g_CmdSoundString)) {
7090 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7091 pCmdSoundString->SetValue(g_CmdSoundString);
7095 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7096 if (pSoundDeviceIndex)
7097 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7099 g_iSDMMFormat = pSDMMFormat->GetSelection();
7100 g_iDistanceFormat = pDistanceFormat->GetSelection();
7101 g_iSpeedFormat = pSpeedFormat->GetSelection();
7102 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7103 g_iTempFormat = pTempFormat->GetSelection();
7106 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7107 if (pSDefaultBoatSpeed)
7108 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7109 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7110 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7111 getUsrSpeedUnit() +
")");
7113 g_bAdvanceRouteWaypointOnArrivalOnly =
7114 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7116 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7117 g_colourTrackLineColour =
7118 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7119 g_colourTrackLineColour.Blue());
7120 g_nTrackPrecision = pTrackPrecision->GetSelection();
7122 g_bTrackDaily = pTrackDaily->GetValue();
7124 g_track_rotate_time = 0;
7125#if wxUSE_TIMEPICKCTRL
7127 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7128 g_track_rotate_time = h * 3600 + m * 60 + s;
7131 if (pTrackRotateUTC->GetValue())
7132 g_track_rotate_time_type = TIME_TYPE_UTC;
7133 else if (pTrackRotateLMT->GetValue())
7134 g_track_rotate_time_type = TIME_TYPE_LMT;
7136 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7138 g_bHighliteTracks = pTrackHighlite->GetValue();
7140 if (pEnableZoomToCursor)
7141 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7143 g_bEnableZoomToCursor =
false;
7146 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7147 g_colourOwnshipRangeRingsColour =
7148 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7149 g_colourOwnshipRangeRingsColour.Green(),
7150 g_colourOwnshipRangeRingsColour.Blue());
7153 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7154 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7155 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7156 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7160 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7161 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7162 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7163 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7164 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7165 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7168 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7169 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7170 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7171 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7174 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7176 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7177 if (g_bSyncCogPredictors) {
7178 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7180 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7182 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7183 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7187 for (
const auto& it : g_pAIS->GetTargetList()) {
7188 auto pAISTarget = it.second;
7189 if (NULL != pAISTarget) {
7190 pAISTarget->b_show_track = g_bAISShowTracks;
7192 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
7193 if (pAISTarget->MMSI == g_MMSI_Props_Array[i]->MMSI) {
7195 if (TRACKTYPE_NEVER == props->TrackType) {
7196 pAISTarget->b_show_track =
false;
7198 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7199 pAISTarget->b_show_track =
true;
7206 std::map<int, Track*>::iterator it;
7207 it = g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7208 if (it != g_pAIS->m_persistent_tracks.end())
7209 pAISTarget->b_show_track =
true;
7214 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7215 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7217 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7218 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7220 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7222 m_pText_Scale_Priority->GetValue().ToLong(&l);
7223 g_ShowScaled_Num = (int)l;
7225 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7226 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7227 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7228 long ais_name_scale = 5000;
7229 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7230 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7231 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7232 g_WplAction = m_pWplAction->GetSelection();
7235 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7236 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7237 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7239 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7240 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7243 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7244 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7245 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7247 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7248 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7249 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7250 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7252 bool bchange_scale =
false;
7253 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7254 bchange_scale =
true;
7255 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7257 g_ChartScaleFactorExp =
7258 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7259 g_MarkScaleFactorExp = g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7260 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7261 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7262 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7263 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7265 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7266 g_mouse_zoom_sensitivity =
7271 if (pWayPointMan)
WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7279 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7280 g_bopengl = pOpenGL->GetValue();
7283 g_bChartBarEx = pChartBarEX->GetValue();
7286 int depthUnit = pDepthUnitSelect->GetSelection();
7287 g_nDepthUnitDisplay = depthUnit;
7290 bool bUserStdChange =
false;
7292 int nOBJL = ps57CtlListBox->GetCount();
7294 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7296 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7297 if (marinersStdXref[i] == iPtr) {
7302 assert(itemIndex >= 0);
7303 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7304 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7305 bUserStdChange =
true;
7306 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7312 ps52plib->GenerateStateHash();
7313 long stateHash = ps52plib->GetStateHash();
7315 if (m_returnChanges & GL_CHANGED) {
7318 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7320 ps52plib->ClearCNSYLUPArray();
7321 ps52plib->GenerateStateHash();
7325 enum _DisCat nset = OTHER;
7326 switch (pDispCat->GetSelection()) {
7337 nset = MARINERS_STANDARD;
7340 ps52plib->SetDisplayCategory(nset);
7343 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7344 if (pCheck_ATONTEXT)
7345 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7346 if (pCheck_LDISTEXT)
7347 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7348 if (pCheck_XLSECTTEXT)
7349 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7351 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7352 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7353 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7354 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7355 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7356 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7358 ps52plib->m_nSymbolStyle =
7359 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7361 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7363 : SYMBOLIZED_BOUNDARIES;
7364 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7365 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7367 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7368 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7376 else if (depthUnit == 2)
7379 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7380 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7382 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7386 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7387 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7389 if (m_DeepCtl->GetValue().ToDouble(&dval))
7390 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7392 ps52plib->UpdateMarinerParams();
7393 ps52plib->m_nDepthUnitDisplay = depthUnit;
7395 ps52plib->GenerateStateHash();
7398 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7399 m_returnChanges |= S52_CHANGED;
7401 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7405#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7407 wxString new_canon = _T(
"en_US");
7408 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7410 int nLang =
sizeof(lang_list) /
sizeof(
int);
7411 for (
int it = 0; it < nLang; it++) {
7412 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7414 wxString lang_canonical = pli->CanonicalName;
7415 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7416 if (lang_sel == test_string) {
7417 new_canon = lang_canonical;
7423 wxString locale_old = g_locale;
7424 g_locale = new_canon;
7426 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7428 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7431 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7432 m_returnChanges |= STYLE_CHANGED;
7434 wxSizeEvent nullEvent;
7435 gFrame->OnSize(nullEvent);
7438 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7439 g_bInlandEcdis = pInlandEcdis->GetValue();
7440 SwitchInlandEcdisMode(g_bInlandEcdis);
7441 m_returnChanges |= TOOLBAR_CHANGED;
7446 if (PluginLoader::getInstance()->UpdatePlugIns())
7447 m_returnChanges |= TOOLBAR_CHANGED;
7451 g_pi_manager->UpdateConfig();
7454 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
7456 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7457 m_groups_changed | k_plugins | k_tides;
7461 TideCurrentDataSet.clear();
7462 int nEntry = tcDataSelected->GetItemCount();
7463 for (
int i = 0; i < nEntry; i++) {
7464 wxString setName = tcDataSelected->GetItemText(i);
7465 TideCurrentDataSet.push_back(setName.ToStdString());
7468 if (g_canvasConfig != m_screenConfig) m_returnChanges |= CONFIG_CHANGED;
7469 g_canvasConfig = m_screenConfig;
7473 gFrame->ProcessOptionsDialog(m_returnChanges, m_pWorkDirList);
7482 gFrame->RefreshAllCanvas();
7486 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7489 UpdateTemplateTitleText();
7492 ::wxEndBusyCursor();
7495void options::OnXidOkClick(wxCommandEvent& event) {
7498 if (event.GetEventObject() == NULL)
return;
7500 ApplyChanges(event);
7503 gFrame->PrepareOptionsClose(
this, m_returnChanges);
7506 if ((m_returnChanges & CONFIG_CHANGED))
7507 gFrame->ScheduleReconfigAndSettingsReload(
false,
false);
7510 if ((m_returnChanges & FONT_CHANGED) &&
7511 !(m_returnChanges & FONT_CHANGED_SAFE))
7512 gFrame->ScheduleDeleteSettingsDialog();
7518void options::Finish(
void) {
7520 m_pListbook->ChangeSelection(0);
7521 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7522 wxNotebookPage* pg = m_pListbook->GetPage(i);
7523 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7524 if (nb) nb->ChangeSelection(0);
7527 lastWindowPos = GetPosition();
7528 lastWindowSize = GetSize();
7530 pConfig->SetPath(
"/Settings");
7531 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7532 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7535ArrayOfCDI options::GetSelectedChartDirs() {
7537 for (
size_t i = 0; i < panelVector.size(); i++) {
7538 if (panelVector[i]->IsSelected()) {
7539 rv.Add(panelVector[i]->GetCDI());
7546ArrayOfCDI options::GetUnSelectedChartDirs() {
7548 for (
size_t i = 0; i < panelVector.size(); i++) {
7549 if (!panelVector[i]->IsSelected()) {
7550 rv.Add(panelVector[i]->GetCDI());
7557void options::SetDirActionButtons() {
7558 ArrayOfCDI selArray = GetSelectedChartDirs();
7559 if (selArray.GetCount())
7560 m_removeBtn->Enable();
7562 m_removeBtn->Disable();
7565void options::OnButtondeleteClick(wxCommandEvent& event) {
7566 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7567 ActiveChartArray.Clear();
7568 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7569 ActiveChartArray.Add(unselArray[i]);
7572 UpdateChartDirList();
7574 UpdateWorkArrayFromDisplayPanel();
7577 if (m_pWorkDirList) {
7578 pActiveChartsList->DeleteAllItems();
7579 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7580 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7583 li.SetAlign(wxLIST_FORMAT_LEFT);
7584 li.SetText(dirname);
7586 long idx = pActiveChartsList->InsertItem(li);
7591 k_charts |= CHANGE_CHARTS;
7593 pScanCheckBox->Disable();
7598void options::OnButtonParseENC(wxCommandEvent& event) {
7599 gFrame->GetPrimaryCanvas()->EnablePaint(
false);
7601 extern void ParseAllENC(wxWindow * parent);
7603 ParseAllENC(g_pOptions);
7606 gFrame->ChartsRefresh();
7608 gFrame->GetPrimaryCanvas()->EnablePaint(
true);
7614static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
7617 lzma_action action = LZMA_RUN;
7621 uint8_t inbuf[BUFSIZ];
7622 uint8_t outbuf[BUFSIZ];
7635 strm->next_in = NULL;
7637 strm->next_out = outbuf;
7638 strm->avail_out =
sizeof(outbuf);
7644 if (strm->avail_in == 0 && !feof(infile)) {
7645 strm->next_in = inbuf;
7646 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
7648 if (ferror(infile)) {
7649 fprintf(stderr,
"Read error: %s\n", strerror(errno));
7657 if (feof(infile)) action = LZMA_FINISH;
7675 lzma_ret ret = lzma_code(strm, action);
7680 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
7685 size_t write_size =
sizeof(outbuf) - strm->avail_out;
7687 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
7688 fprintf(stderr,
"Write error: %s\n", strerror(errno));
7693 strm->next_out = outbuf;
7694 strm->avail_out =
sizeof(outbuf);
7699 if (ret != LZMA_OK) {
7706 if (ret == LZMA_STREAM_END)
return true;
7717 case LZMA_MEM_ERROR:
7718 msg =
"Memory allocation failed";
7721 case LZMA_DATA_ERROR:
7734 msg =
"File size limits exceeded";
7749 msg =
"Unknown error, possibly a bug";
7753 wxLogMessage(_T(
"LZMA Encoder error: %s (error code %u)\n"), msg, ret);
7760static bool CompressChart(wxString in, wxString out) {
7762 FILE* infile = fopen(in.mb_str(),
"rb");
7763 if (!infile)
return false;
7765 FILE* outfile = fopen(out.mb_str(),
"wb");
7771 lzma_stream strm = LZMA_STREAM_INIT;
7772 bool success =
false;
7773 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
7775 success = compress(&strm, infile, outfile);
7786void options::OnButtonmigrateClick(wxCommandEvent& event) {
7791 new MigrateAssistantDialog(gFrame,
true);
7792 g_migrateDialog->SetSize(gFrame->GetSize());
7793 g_migrateDialog->Centre();
7794 g_migrateDialog->Raise();
7795 g_migrateDialog->ShowModal();
7799void options::OnButtonEcdisHelp(wxCommandEvent& event) {
7800 wxString testFile =
"/doc/iECDIS/index.html";
7802 if (!::wxFileExists(testFile)) {
7803 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
7806 _(
"Would you like to visit the iECDIS Manual website for more "
7809 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
7810 wxYES_NO | wxCENTER, 60)) {
7811 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
7815 wxLaunchDefaultBrowser(
"file:///" + *GetpSharedDataLocation() + testFile);
7817 wxLaunchDefaultBrowser(
"file://" + *GetpSharedDataLocation() + testFile);
7822void options::OnButtoncompressClick(wxCommandEvent& event) {
7824 wxArrayInt pListBoxSelections;
7827 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
7828 wxLIST_STATE_SELECTED);
7829 if (item == -1)
break;
7834 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
7835This may make them incompatible with other programs or older versions of OpenCPN.\n\
7836Compressed charts may take slightly longer to load and display on some systems.\n\
7837They can be decompressed again using unxz or 7 zip programs."),
7838 _(
"OpenCPN Warning"),
7839 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
7843 wxArrayString filespecs;
7844 filespecs.Add(
"*.kap");
7845 filespecs.Add(
"*.KAP");
7846 filespecs.Add(
"*.000");
7849 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
7850 filespecs.Add(
"*.D");
7851 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
7852 filespecs.Add(
"*.Z");
7854 wxGenericProgressDialog prog1(
7855 _(
"OpenCPN Compress Charts"), wxEmptyString,
7856 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
7857 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
7858 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
7861 wxSize sz = prog1.GetSize();
7862 sz.x = gFrame->GetClientSize().x * 8 / 10;
7865 wxArrayString charts;
7866 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
7867 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
7868 if (dirname.IsEmpty())
continue;
7871 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7872 (dirname.Last() == wxChar(_T(
'\r'))))
7873 dirname.RemoveLast();
7875 if (!wxDir::Exists(dirname))
continue;
7878 wxArrayString FileList;
7879 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
7880 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
7882 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
7886 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
7887 charts.Add(FileList[j]);
7891 if (charts.GetCount() == 0) {
7892 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
7897 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
7898 wxGenericProgressDialog prog(
7899 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
7900 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
7901 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
7905 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
7907 prog.Update(i, charts[i], &skip);
7910 wxString compchart = charts[i] + _T(
".xz");
7911 if (CompressChart(charts[i], compchart)) {
7912 total_size += wxFileName::GetSize(charts[i]).ToULong();
7913 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
7914 wxRemoveFile(charts[i]);
7920 double total_size_mb = total_size / 1024.0 / 1024.0;
7921 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
7924 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
7926 count, total_size_mb, total_compressed_size_mb,
7927 total_size_mb - total_compressed_size_mb,
7928 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
7931 UpdateWorkArrayFromTextCtl();
7933 if (m_pWorkDirList) {
7934 pActiveChartsList->DeleteAllItems();
7935 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7936 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7939 li.SetAlign(wxLIST_FORMAT_LEFT);
7940 li.SetText(dirname);
7942 long idx = pActiveChartsList->InsertItem(li);
7946 k_charts |= CHANGE_CHARTS;
7948 pScanCheckBox->Disable();
7954void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
7956void options::OnCancelClick(wxCommandEvent& event) {
7957 m_pListbook->ChangeSelection(0);
7958 comm_dialog->CancelSettings();
7960 lastWindowPos = GetPosition();
7961 lastWindowSize = GetSize();
7963 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxCANCEL);
7965 pConfig->SetPath(
"/Settings");
7966 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7967 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7972void options::OnClose(wxCloseEvent& event) {
7974 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
7976 m_pListbook->ChangeSelection(0);
7978 lastWindowPos = GetPosition();
7979 lastWindowSize = GetSize();
7981 pConfig->SetPath(
"/Settings");
7982 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7983 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7985 gFrame->PrepareOptionsClose(
this, m_returnChanges);
7989void options::OnFontChoice(wxCommandEvent& event) {
7990 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
7991 m_font_element_array.Add(sel_text_element);
7993 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
7994 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
7996 m_textSample->SetFont(*pif);
7997 m_textSample->SetForegroundColour(init_color);
7998 m_itemBoxSizerFontPanel->Layout();
8002void options::OnChooseFont(wxCommandEvent& event) {
8004 androidDisableRotation();
8007 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8008 m_font_element_array.Add(sel_text_element);
8009 wxFontData font_data;
8011 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8012 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8014 wxFontData init_font_data;
8015 if (pif) init_font_data.SetInitialFont(*pif);
8016 init_font_data.SetColour(init_color);
8021 wxFont* qFont = dialogFont;
8024 int retval = dg.ShowModal();
8025 if (wxID_CANCEL != retval) {
8026 font_data = dg.GetFontData();
8027 wxFont font = font_data.GetChosenFont();
8028 wxFont* psfont =
new wxFont(font);
8029 wxColor color = font_data.GetColour();
8030 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8031 gFrame->UpdateAllFonts();
8032 m_bfontChanged =
true;
8033 OnFontChoice(event);
8039 wxFontDialog dg(
this, init_font_data);
8041 wxFontDialog dg(pParent, init_font_data);
8044 wxFont* qFont = dialogFont;
8051 wxSize proposed_size = GetSize();
8053 float font_size = dialogFont->GetPointSize();
8055 if ((proposed_size.y / font_size) < n_lines) {
8056 float new_font_size = proposed_size.y / n_lines;
8057 wxFont* smallFont =
new wxFont(*dialogFont);
8058 smallFont->SetPointSize(new_font_size);
8059 dg.SetFont(*smallFont);
8063 if (g_bresponsive) {
8064 dg.SetSize(GetSize());
8068 int retval = dg.ShowModal();
8069 if (wxID_CANCEL != retval) {
8070 font_data = dg.GetFontData();
8071 wxFont font = font_data.GetChosenFont();
8072 wxFont* psfont =
new wxFont(font);
8073 wxColor color = font_data.GetColour();
8074 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8075 gFrame->UpdateAllFonts();
8076 m_bfontChanged =
true;
8077 OnFontChoice(event);
8082 androidEnableRotation();
8088#if defined(__WXGTK__) || defined(__WXQT__)
8089void options::OnChooseFontColor(wxCommandEvent& event) {
8090 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8091 m_font_element_array.Add(sel_text_element);
8093 wxColourData colour_data;
8095 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8096 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8099 androidDisableRotation();
8101 unsigned int cco = 0;
8104 cco |= init_color.Red();
8106 cco |= init_color.Green();
8108 cco |= init_color.Blue();
8109 unsigned int cc = androidColorPicker(cco);
8112 unsigned char blue = (
unsigned char)cc % 256;
8113 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8115 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8116 cn.Set(red, green, blue);
8118 FontMgr::Get().
SetFont(sel_text_element, pif, cn);
8120 gFrame->UpdateAllFonts();
8121 m_bfontChanged =
true;
8123 androidEnableRotation();
8125 wxScrolledWindow* sw =
8126 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8128 wxColourData init_colour_data;
8129 init_colour_data.SetColour(init_color);
8131 wxColourDialog dg(sw, &init_colour_data);
8133 int retval = dg.ShowModal();
8134 if (wxID_CANCEL != retval) {
8135 colour_data = dg.GetColourData();
8137 wxColor color = colour_data.GetColour();
8138 FontMgr::Get().
SetFont(sel_text_element, pif, color);
8140 gFrame->UpdateAllFonts();
8141 m_bfontChanged =
true;
8142 OnFontChoice(event);
8151void options::OnChartsPageChange(wxListbookEvent& event) {
8152 unsigned int i =
event.GetSelection();
8154 UpdateChartDirList();
8159 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8163 UpdateWorkArrayFromDisplayPanel();
8164 groupsPanel->SetDBDirs(*m_pWorkDirList);
8165 groupsPanel->m_treespopulated = FALSE;
8167 if (!groupsPanel->m_settingscomplete) {
8168 ::wxBeginBusyCursor();
8169 groupsPanel->CompleteInitialSettings();
8170 ::wxEndBusyCursor();
8171 }
else if (!groupsPanel->m_treespopulated) {
8172 groupsPanel->PopulateTrees();
8173 groupsPanel->m_treespopulated = TRUE;
8175 }
else if (1 == i) {
8177 if (!m_bVectorInit) {
8178 SetInitialVectorSettings();
8179 UpdateOptionsUnits();
8186void options::OnPageChange(wxListbookEvent& event) {
8187 DoOnPageChange(event.GetSelection());
8190void options::OnSubNBPageChange(wxNotebookEvent& event) {
8193 if (event.GetEventObject()) {
8194 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8195 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8196 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8197 if (
dynamic_cast<wxNotebook*
>(parent)) {
8198 lastSubPage =
event.GetSelection();
8201 if (
dynamic_cast<wxListbook*
>(parent)) {
8202 lastSubPage =
event.GetSelection();
8209void options::OnTopNBPageChange(wxNotebookEvent& event) {
8210 DoOnPageChange(event.GetSelection());
8213void options::DoOnPageChange(
size_t page) {
8214 unsigned int i = page;
8217 if (page > 10)
return;
8225 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8226 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8232 k_charts = VISIT_CHARTS;
8233 UpdateChartDirList();
8236 else if (m_pageUI == i) {
8237 if (!m_itemLangListBox)
return;
8238#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8240 if (!m_bVisitLang) {
8241 ::wxBeginBusyCursor();
8243 int current_language = plocale_def_lang->GetLanguage();
8244 wxString current_sel = wxLocale::GetLanguageName(current_language);
8246 current_sel = GetOCPNKnownLanguage(g_locale);
8248 int nLang =
sizeof(lang_list) /
sizeof(
int);
8251 m_itemLangListBox->Append(_T(
"English (U.S.)"));
8253 wxString lang_dir = g_Platform->GetSharedDataDir() + _T(
"share/locale/");
8254 for (
int it = 1; it < nLang; it++) {
8255 if (wxLocale::IsAvailable(lang_list[it])) {
8256 wxLocale ltest(lang_list[it], 0);
8257 ltest.AddCatalog(_T(
"opencpn"));
8258 if (!ltest.IsLoaded(_T(
"opencpn")))
continue;
8261 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8262 wxString widgets_lang_name = loc_lang_name;
8263 wxString lang_canonical =
8264 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8267 wxString lang_suffix;
8268 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8271 wxString test_dir = lang_dir + lang_suffix;
8272 if (!wxDir::Exists(test_dir))
continue;
8274 m_itemLangListBox->Append(loc_lang_name);
8278 wxArrayString lang_array;
8281 lang_array.Add(_T(
"en_US"));
8282 for (
int it = 0; it < nLang; it++) {
8284 wxLog::EnableLogging(
8287 wxLocale ltest(lang_list[it], 0);
8288#if wxCHECK_VERSION(2, 9, 0)
8290 ltest.AddCatalogLookupPathPrefix(
8291 wxStandardPaths::Get().GetInstallPrefix() +
8292 _T(
"/share/locale" ));
8295 ltest.AddCatalog(_T(
"opencpn"));
8297 wxLog::EnableLogging(TRUE);
8298 if (ltest.IsLoaded(_T(
"opencpn"))) {
8299 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8302 s0 = x->CanonicalName;
8305 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8306 if (wxNOT_FOUND == lang_array.Index(s0)) {
8313 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8315 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8316 m_itemLangListBox->Append(loc_lang_name);
8332 delete plocale_def_lang;
8333 plocale_def_lang =
new wxLocale(current_language);
8335 setlocale(LC_NUMERIC,
"C");
8336 plocale_def_lang->AddCatalog(_T(
"opencpn"));
8338 m_itemLangListBox->SetStringSelection(current_sel);
8341 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8343 wxString clang = pli->Description;
8347 m_bVisitLang = TRUE;
8349 ::wxEndBusyCursor();
8352 }
else if (m_pagePlugins == i) {
8355 auto loader = PluginLoader::getInstance();
8356 if (LoadAllPlugIns(
false)) {
8357 delete m_pPlugInCtrl;
8358 m_pPlugInCtrl = NULL;
8359 delete m_PluginCatalogMgrPanel;
8360 m_PluginCatalogMgrPanel = NULL;
8361 itemBoxSizerPanelPlugins->Clear();
8364 if (!m_pPlugInCtrl) {
8366 ::wxBeginBusyCursor();
8369 wxDefaultPosition, wxDefaultSize);
8370 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8371 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8372 wxEXPAND | wxGROW | wxALL, 4);
8373 if (g_pi_manager) g_pi_manager->SetListPanelPtr(m_pPlugInCtrl);
8376 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8378 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8379 wxEXPAND | wxALL, 4);
8380 itemBoxSizerPanelPlugins->Layout();
8383 m_pPlugInCtrl->UpdateSelections();
8385 ::wxEndBusyCursor();
8387 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8390 k_plugins = TOOLBAR_CHANGED;
8394wxString options::SelectSoundFile() {
8395 wxString sound_dir = g_Platform->GetSharedDataDir();
8396 sound_dir.Append(_T(
"sounds"));
8401 wxFileDialog* popenDialog =
new wxFileDialog(
8402 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8403 _T(
"WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN);
8405 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8407 response = popenDialog->ShowModal();
8408 sel_file = popenDialog->GetPath();
8413 g_Platform->DoFileSelectorDialog(
this, &sel_file, _(
"Select Sound File"),
8414 sound_dir, wxEmptyString, wxT(
"*.*"));
8417 if (response == wxID_OK)
8418 return g_Platform->NormalizePath(sel_file);
8423void options::OnButtonSelectSound(wxCommandEvent& event) {
8424 wxString sel_file = SelectSoundFile();
8426 if (!sel_file.IsEmpty()) {
8427 g_sAIS_Alert_Sound_File = g_Platform->NormalizePath(sel_file);
8431void options::OnButtonTestSound(wxCommandEvent& event) {
8432 auto sound = SoundFactory();
8433 auto cmd_sound =
dynamic_cast<SystemCmdSound*
>(sound);
8434 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8436 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8440wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8441 wxString return_string;
8442 wxString dir_suffix;
8444#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8446 if (lang_canonical == _T(
"en_US")) {
8447 dir_suffix = _T(
"en");
8448 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8450 }
else if ((lang_canonical == _T(
"cs_CZ")) || (lang_canonical == _T(
"cs"))) {
8451 dir_suffix = _T(
"cs");
8452 return_string = wxString(
"Čeština", wxConvUTF8);
8454 }
else if ((lang_canonical == _T(
"da_DK")) || (lang_canonical == _T(
"da"))) {
8455 dir_suffix = _T(
"da");
8456 return_string = wxString(
"Dansk", wxConvUTF8);
8458 }
else if ((lang_canonical == _T(
"de_DE")) || (lang_canonical == _T(
"de"))) {
8459 dir_suffix = _T(
"de");
8460 return_string = wxString(
"Deutsch", wxConvUTF8);
8462 }
else if ((lang_canonical == _T(
"et_EE")) || (lang_canonical == _T(
"et"))) {
8463 dir_suffix = _T(
"et");
8464 return_string = wxString(
"Eesti", wxConvUTF8);
8466 }
else if ((lang_canonical == _T(
"es_ES")) || (lang_canonical == _T(
"es"))) {
8467 dir_suffix = _T(
"es");
8468 return_string = wxString(
"Español", wxConvUTF8);
8470 }
else if ((lang_canonical == _T(
"fr_FR")) || (lang_canonical == _T(
"fr"))) {
8471 dir_suffix = _T(
"fr");
8472 return_string = wxString(
"Français", wxConvUTF8);
8474 }
else if ((lang_canonical == _T(
"it_IT")) || (lang_canonical == _T(
"it"))) {
8475 dir_suffix = _T(
"it");
8476 return_string = wxString(
"Italiano", wxConvUTF8);
8478 }
else if ((lang_canonical == _T(
"nl_NL")) || (lang_canonical == _T(
"nl"))) {
8479 dir_suffix = _T(
"nl");
8480 return_string = wxString(
"Nederlands", wxConvUTF8);
8482 }
else if ((lang_canonical == _T(
"pl_PL")) || (lang_canonical == _T(
"pl"))) {
8483 dir_suffix = _T(
"pl");
8484 return_string = wxString(
"Polski", wxConvUTF8);
8486 }
else if ((lang_canonical == _T(
"pt_PT")) || (lang_canonical == _T(
"pt"))) {
8487 dir_suffix = _T(
"pt_PT");
8488 return_string = wxString(
"Português", wxConvUTF8);
8490 }
else if ((lang_canonical == _T(
"pt_BR")) ||
8491 (lang_canonical == _T(
"pt_BR"))) {
8492 dir_suffix = _T(
"pt_BR");
8493 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8495 }
else if ((lang_canonical == _T(
"ru_RU")) || (lang_canonical == _T(
"ru"))) {
8496 dir_suffix = _T(
"ru");
8497 return_string = wxString(
"Русский", wxConvUTF8);
8499 }
else if ((lang_canonical == _T(
"sv_SE")) || (lang_canonical == _T(
"sv"))) {
8500 dir_suffix = _T(
"sv");
8501 return_string = wxString(
"Svenska", wxConvUTF8);
8503 }
else if ((lang_canonical == _T(
"fi_FI")) || (lang_canonical == _T(
"fi"))) {
8504 dir_suffix = _T(
"fi_FI");
8505 return_string = wxString(
"Suomi", wxConvUTF8);
8507 }
else if ((lang_canonical == _T(
"nb_NO")) || (lang_canonical == _T(
"nb"))) {
8508 dir_suffix = _T(
"nb_NO");
8509 return_string = wxString(
"Norsk", wxConvUTF8);
8511 }
else if ((lang_canonical == _T(
"tr_TR")) || (lang_canonical == _T(
"tr"))) {
8512 dir_suffix = _T(
"tr_TR");
8513 return_string = wxString(
"Türkçe", wxConvUTF8);
8515 }
else if ((lang_canonical == _T(
"el_GR")) || (lang_canonical == _T(
"el"))) {
8516 dir_suffix = _T(
"el_GR");
8517 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8519 }
else if ((lang_canonical == _T(
"hu_HU")) || (lang_canonical == _T(
"hu"))) {
8520 dir_suffix = _T(
"hu_HU");
8521 return_string = wxString(
"Magyar", wxConvUTF8);
8523 }
else if ((lang_canonical == _T(
"zh_TW")) ||
8524 (lang_canonical == _T(
"zh_TW"))) {
8525 dir_suffix = _T(
"zh_TW");
8526 return_string = wxString(
"正體字", wxConvUTF8);
8528 }
else if ((lang_canonical == _T(
"zh_CN")) ||
8529 (lang_canonical == _T(
"zh_CN"))) {
8530 dir_suffix = _T(
"zh_CN");
8531 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8533 }
else if ((lang_canonical == _T(
"ca_ES")) || (lang_canonical == _T(
"ca"))) {
8534 dir_suffix = _T(
"ca_ES");
8535 return_string = wxString(
"Catalan", wxConvUTF8);
8537 }
else if ((lang_canonical == _T(
"gl_ES")) ||
8538 (lang_canonical == _T(
"gl_ES"))) {
8539 dir_suffix = _T(
"gl_ES");
8540 return_string = wxString(
"Galician", wxConvUTF8);
8542 }
else if ((lang_canonical == _T(
"ja_JP")) ||
8543 (lang_canonical == _T(
"ja_JP"))) {
8544 dir_suffix = _T(
"ja_JP");
8545 return_string = wxString(
"Japanese", wxConvUTF8);
8547 }
else if ((lang_canonical == _T(
"vi_VN")) ||
8548 (lang_canonical == _T(
"vi_VN"))) {
8549 dir_suffix = _T(
"vi_VN");
8550 return_string = wxString(
"Vietnamese", wxConvUTF8);
8553 dir_suffix = lang_canonical;
8554 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8556 return_string = info->Description;
8558 return_string = lang_canonical;
8561 lang_dir = dir_suffix;
8563 return return_string;
8566wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8568 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8571ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8572 ChartGroupArray* d =
new ChartGroupArray;
8573 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8576 pdg->m_group_name = psg->m_group_name;
8577 pdg->m_element_array.reserve(psg->m_element_array.size());
8579 for (
auto& elem : psg->m_element_array)
8580 pdg->m_element_array.push_back(elem);
8587void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8597EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8598EVT_NOTEBOOK_PAGE_CHANGED(
8600 ChartGroupsUI::OnGroupPageChange)
8604 m_GroupSelectedPage = -1;
8605 m_pActiveChartsTree = 0;
8607 lastSelectedCtl = NULL;
8608 allAvailableCtl = NULL;
8609 defaultAllCtl = NULL;
8611 m_pAddButton = NULL;
8612 m_pRemoveButton = NULL;
8613 m_pDeleteGroupButton = NULL;
8614 m_pNewGroupButton = NULL;
8615 m_pGroupArray = NULL;
8618 m_UIcomplete =
false;
8619 m_treespopulated =
false;
8623ChartGroupsUI::~ChartGroupsUI(
void) {
8624 m_DirCtrlArray.Clear();
8625 m_GroupNB->Disconnect(
8626 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
8627 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
8632void ChartGroupsUI::SetInitialSettings(
void) {
8633 m_settingscomplete = FALSE;
8634 m_treespopulated = FALSE;
8637void ChartGroupsUI::PopulateTrees(
void) {
8640 wxArrayString dir_array;
8641 int nDir = m_db_dirs.GetCount();
8642 for (
int i = 0; i < nDir; i++) {
8643 wxString dirname = m_db_dirs[i].fullpath;
8644 if (!dirname.IsEmpty()) dir_array.Add(dirname);
8647 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array,
8648 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
8650 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
8654 wxArrayString dir_array0;
8655 int nDir0 = m_db_dirs.GetCount();
8656 for (
int i = 0; i < nDir0; i++) {
8657 wxString dirname = m_db_dirs[i].fullpath;
8658 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
8660 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
8661 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
8664void ChartGroupsUI::CompleteInitialSettings(
void) {
8667 BuildNotebookPages(m_pGroupArray);
8669 m_panel->GetSizer()->Layout();
8671 m_settingscomplete = TRUE;
8672 m_treespopulated = TRUE;
8675void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
8676 const wxArrayString& dir_array,
8677 const wxColour& col, wxFont* pFont) {
8678 ptc->DeleteAllItems();
8680 wxDirItemData* rootData =
new wxDirItemData(_T(
"Dummy"), _T(
"Dummy"), TRUE);
8682 rootName = _T(
"Dummy");
8683 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
8684 ptc->SetItemHasChildren(m_rootId);
8687 int nDir = dir_array.GetCount();
8688 for (
int i = 0; i < nDir; i++) {
8689 wxString dirname = dir_array[i];
8690 if (!dirname.IsEmpty()) {
8691 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
8692 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
8695 ptc->SetItemText(
id, dirname);
8696 if (pFont) ptc->SetItemFont(
id, *pFont);
8700 ptc->SetItemTextColour(
id, col);
8702 ptc->SetItemHasChildren(
id);
8707void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
8708 wxString insert_candidate = allAvailableCtl->GetPath();
8709 if (!insert_candidate.IsEmpty()) {
8710 if (m_DirCtrlArray.GetCount()) {
8711 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8712 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8714 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8716 if (ptree->IsEmpty()) {
8717 wxDirItemData* rootData =
8718 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
8719 wxString rootName = _T(
"Dummy");
8720 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
8722 ptree->SetItemHasChildren(rootId);
8725 wxTreeItemId root_Id = ptree->GetRootItem();
8726 wxDirItemData* dir_item =
8727 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
8729 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
8730 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
8733 pGroup->m_element_array.push_back({insert_candidate});
8738 allAvailableCtl->GetTreeCtrl()->UnselectAll();
8739 m_pAddButton->Disable();
8741 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8743 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8744 if (ptree) ptree->Refresh();
8748void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
8749 if (m_DirCtrlArray.GetCount()) {
8750 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8751 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8754 wxString sel_item = pDirCtrl->GetPath();
8756 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8757 if (ptree && ptree->GetCount()) {
8758 wxTreeItemId
id = ptree->GetSelection();
8759 lastDeletedItem = id;
8761 wxString branch_adder;
8762 int group_item_index =
8763 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
8764 if (group_item_index >= 0) {
8766 pGroup->m_element_array[group_item_index];
8767 bool b_duplicate = FALSE;
8768 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
8770 if (pelement.m_missing_name_array[k] == sel_item) {
8776 pelement.m_missing_name_array.Add(sel_item);
8782 if (branch_adder == _T(
"")) {
8784 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
8787 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
8793 lastSelectedCtl->Unselect();
8794 lastSelectedCtl = 0;
8795 m_pRemoveButton->Disable();
8797 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8799 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8800 if (ptree) ptree->Refresh();
8808void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
8809 m_GroupSelectedPage =
event.GetSelection();
8810 allAvailableCtl->GetTreeCtrl()->UnselectAll();
8811 if (lastSelectedCtl) {
8812 lastSelectedCtl->UnselectAll();
8813 lastSelectedCtl = 0;
8815 m_pRemoveButton->Disable();
8816 m_pAddButton->Disable();
8819 if (m_GroupSelectedPage == 0) {
8820 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
8822 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
8826void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
8827 wxObject* evtObj =
event.GetEventObject();
8828 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
8829 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
8830 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
8831 m_pAddButton->Enable();
8833 m_pAddButton->Disable();
8836 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
8837 if (!lastSelectedCtl)
goto out;
8838 wxTreeItemId item = lastSelectedCtl->GetSelection();
8839 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
8842 wxGenericDirCtrl* dirCtrl =
8843 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
8844 if (!dirCtrl)
goto out;
8845 wxString itemPath = dirCtrl->GetPath();
8846 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
8848 m_pRemoveButton->Disable();
8856void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
8857 wxTextEntryDialog* pd =
new wxTextEntryDialog();
8859 pd->SetFont(*qFont);
8861 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
8864 androidDisableRotation();
8867 if (pd->ShowModal() == wxID_OK) {
8868 if (pd->GetValue().Length()) {
8869 AddEmptyGroupPage(pd->GetValue());
8871 pGroup->m_group_name = pd->GetValue();
8872 m_pGroupArray->Add(pGroup);
8874 m_GroupSelectedPage =
8875 m_GroupNB->GetPageCount() - 1;
8876 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
8877 m_pDeleteGroupButton->Enable();
8884 androidEnableRotation();
8888void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
8889 if (0 != m_GroupSelectedPage) {
8890 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
8891 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
8892 m_GroupNB->DeletePage(m_GroupSelectedPage);
8895 if (m_GroupSelectedPage <= 0) {
8896 m_pAddButton->Disable();
8897 m_pDeleteGroupButton->Disable();
8901int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
8902 wxTreeItemId item, wxString* pbranch_adder) {
8903 wxString branch_name;
8904 wxString branch_adder;
8906 wxTreeItemId current_node = item;
8907 while (current_node.IsOk()) {
8908 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
8909 if (!parent_node)
break;
8911 if (parent_node == ptree->GetRootItem()) {
8912 branch_name = ptree->GetItemText(current_node);
8916 branch_adder.Prepend(ptree->GetItemText(current_node));
8917 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
8919 current_node = ptree->GetItemParent(current_node);
8923 unsigned int target_item_index = -1;
8925 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
8926 const wxString& target = pGroup->m_element_array[i].m_element_name;
8927 if (branch_name == target) {
8928 target_item_index = i;
8933 if (pbranch_adder) *pbranch_adder = branch_adder;
8935 return target_item_index;
8938void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
8939 wxTreeItemId node =
event.GetItem();
8941 if (m_GroupSelectedPage <= 0)
return;
8942 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8943 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8944 if (!pDirCtrl)
return;
8946 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8947 wxString branch_adder;
8948 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
8949 if (target_item_index < 0)
return;
8951 pGroup->m_element_array[target_item_index];
8952 const wxString& branch_name = target_element.m_element_name;
8956 if (!target_element.m_missing_name_array.GetCount())
return;
8957 wxString full_root = branch_name;
8958 full_root += branch_adder;
8959 full_root += wxString(wxFILE_SEP_PATH);
8961 wxTreeItemIdValue cookie;
8962 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
8963 while (child.IsOk()) {
8964 wxString target_string = full_root;
8965 target_string += ptree->GetItemText(child);
8967 for (
unsigned int k = 0; k < target_element.m_missing_name_array.GetCount();
8969 if (target_element.m_missing_name_array[k] == target_string) {
8970 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
8974 child = ptree->GetNextChild(node, cookie);
8978void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
8981 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
8983 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
8986 int nItems = pGroup->m_element_array.size();
8987 for (
int i = 0; i < nItems; i++) {
8988 const wxString& itemname = pGroup->m_element_array[i].m_element_name;
8989 if (!itemname.IsEmpty()) {
8990 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
8992 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
8994 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
9000wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
9001 wxGenericDirCtrl* GroupDirCtl =
9002 new wxGenericDirCtrl(m_GroupNB, wxID_ANY, _T(
"TESTDIR"));
9003 m_GroupNB->AddPage(GroupDirCtl, label);
9005 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
9006 ptree->DeleteAllItems();
9008 wxDirItemData* rootData =
9009 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9010 wxString rootName = _T(
"Dummy");
9011 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9012 ptree->SetItemHasChildren(rootId);
9014 m_DirCtrlArray.Add(GroupDirCtl);
9019void ChartGroupsUI::ClearGroupPages() {
9020 if (m_GroupNB->GetPageCount() == 0)
return;
9022 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
9023 m_DirCtrlArray.RemoveAt(i);
9024 m_GroupNB->DeletePage(i);
9028void options::OnInsertTideDataLocation(wxCommandEvent& event) {
9030 int response = wxID_CANCEL;
9033 wxFileDialog* popenDialog =
new wxFileDialog(
9034 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir, wxT(
""),
9035 wxT(
"Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All ")
9036 wxT(
"files (*.*)|*.*"),
9039 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
9041 response = popenDialog->ShowModal();
9042 sel_file = popenDialog->GetPath();
9047 response = g_Platform->DoFileSelectorDialog(
this, &path,
9048 _(
"Select Tide/Current Data"),
9049 g_TCData_Dir, _T(
""), wxT(
"*.*"));
9053 if (response == wxID_OK) {
9055 int id = tcDataSelected->GetItemCount();
9057 long idx = tcDataSelected->InsertItem(li);
9058 tcDataSelected->SetItem(
id, 0, g_Platform->NormalizePath(sel_file));
9061 wxFileName fn(sel_file);
9062 wxString data_dir = fn.GetPath();
9063 g_TCData_Dir = g_Platform->NormalizePath(data_dir);
9067void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9070 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9071 wxLIST_STATE_SELECTED);
9072 if (item == -1)
break;
9073 tcDataSelected->DeleteItem(item);
9079enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9082BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9083EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9084EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9087OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9088 : wxDialog(parent, wxID_ANY, _T( "OpenGL Options" ), wxDefaultPosition,
9090 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9095 m_brebuild_cache(FALSE) {
9098 SetFont(*dialogFont);
9100 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9101 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9103 m_cbTextureCompression =
9104 new wxCheckBox(
this, wxID_ANY,
9105 g_bGLexpert ? _(
"Texture Compression")
9106 : _(
"Texture Compression with Caching"));
9107 m_cbTextureCompressionCaching =
9108 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9110 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9111 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9112 m_sTextureMemorySize->SetRange(1, 16384);
9114 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9115 wxButton* btnRebuild =
9116 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9117 wxButton* btnClear =
9118 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9119 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9120 if (!g_bopengl || g_raster_format == GL_RGB) btnRebuild->Disable();
9121 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9122 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9123 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9125 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9126 m_cbUseAcceleratedPanning =
9127 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9129 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9130 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9131 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9132 flexSizer->AddSpacer(0);
9133 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9134 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9135 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9136 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9137 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9138 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9139 flexSizer->AddSpacer(0);
9140 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9141 flexSizer->AddSpacer(0);
9142 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9143 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9144 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9145 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9146 flexSizer->AddSpacer(0);
9147 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9148 flexSizer->AddSpacer(0);
9149 flexSizer->AddSpacer(0);
9150 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9151 flexSizer->AddSpacer(0);
9152 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9153 flexSizer->AddGrowableCol(1);
9154 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9156 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9157 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9158 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9159 btnSizer->Realize();
9161 mainSizer->AddStretchSpacer();
9162 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9166 SetSizer(mainSizer);
9167 mainSizer->SetSizeHints(
this);
9171bool OpenGLOptionsDlg::GetAcceleratedPanning(
void)
const {
9172 return m_cbUseAcceleratedPanning->GetValue();
9175bool OpenGLOptionsDlg::GetTextureCompression(
void)
const {
9176 return m_cbTextureCompression->GetValue();
9179bool OpenGLOptionsDlg::GetPolygonSmoothing(
void)
const {
9180 return m_cbPolygonSmoothing->GetValue();
9183bool OpenGLOptionsDlg::GetLineSmoothing(
void)
const {
9184 return m_cbLineSmoothing->GetValue();
9187bool OpenGLOptionsDlg::GetSoftwareGL(
void)
const {
9188 return m_cbSoftwareGL->GetValue();
9191bool OpenGLOptionsDlg::GetTextureCompressionCaching(
void)
const {
9192 return m_cbTextureCompressionCaching->GetValue();
9195bool OpenGLOptionsDlg::GetRebuildCache(
void)
const {
return m_brebuild_cache; }
9197int OpenGLOptionsDlg::GetTextureMemorySize(
void)
const {
9198 return m_sTextureMemorySize->GetValue();
9201void OpenGLOptionsDlg::Populate(
void) {
9202 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9210 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9211 m_memorySize->Show(g_bGLexpert);
9212 m_sTextureMemorySize->Show(g_bGLexpert);
9214 m_cbTextureCompressionCaching->SetValue(
9215 g_GLOptions.m_bTextureCompressionCaching);
9216 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9218 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9219 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9221#if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9222 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9223 if (gFrame->GetPrimaryCanvas()
9225 ->GetVersionString()
9227 .Find(_T(
"MESA" )) != wxNOT_FOUND)
9228 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9231 m_cbSoftwareGL->Hide();
9235 SetFont(*dialogFont);
9238 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9239 if (gFrame->GetPrimaryCanvas()->GetglCanvas()->CanAcceleratePanning()) {
9240 m_cbUseAcceleratedPanning->Enable();
9241 m_cbUseAcceleratedPanning->SetValue(
9242 g_GLOptions.m_bUseAcceleratedPanning);
9244 m_cbUseAcceleratedPanning->SetValue(FALSE);
9245 m_cbUseAcceleratedPanning->Disable();
9248 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9251 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9252 m_cbUseAcceleratedPanning->Disable();
9256void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9257 if (g_GLOptions.m_bTextureCompressionCaching) {
9258 m_brebuild_cache = TRUE;
9259 EndModal(wxID_CANCEL);
9263void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9264 if (g_bopengl && g_glTextureManager) {
9265 ::wxBeginBusyCursor();
9266 g_glTextureManager->ClearAllRasterTextures();
9269 appendOSDirSlash(&path);
9270 path.append(_T(
"raster_texture_cache"));
9272 if (::wxDirExists(path)) {
9273 wxArrayString files;
9274 size_t nfiles = wxDir::GetAllFiles(path, &files);
9275 for (
unsigned int i = 0; i < files.GetCount(); i++)
9276 ::wxRemoveFile(files[i]);
9279 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9280 ::wxEndBusyCursor();
9284wxString OpenGLOptionsDlg::GetTextureCacheSize(
void) {
9286 appendOSDirSlash(&path);
9287 path.append(_T(
"raster_texture_cache"));
9288 long long total = 0;
9290 if (::wxDirExists(path)) {
9291 wxArrayString files;
9292 size_t nfiles = wxDir::GetAllFiles(path, &files);
9293 for (
unsigned int i = 0; i < files.GetCount(); i++)
9294 total += wxFile(files[i]).Length();
9296 double mb = total / (1024.0 * 1024.0);
9297 if (mb < 10000.0)
return wxString::Format(_T(
"%.1f MB" ), mb);
9299 return wxString::Format(_T(
"%.1f GB" ), mb);
9307EVT_PAINT(CanvasConfigSelect::OnPaint)
9311 wxWindowID
id, wxBitmap& bmp,
9312 const wxPoint& pos, const wxSize& size)
9313 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9314 m_parentOptions = parentOptions;
9319 int refHeight = GetCharHeight();
9321 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9322 bmp.GetSize().y + m_borderWidth * 2));
9324 Connect(wxEVT_LEFT_DOWN,
9325 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9328CanvasConfigSelect::~CanvasConfigSelect() {}
9330void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9336 if (m_parentOptions)
9337 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9340void CanvasConfigSelect::SetSelected(
bool selected) {
9341 m_bSelected = selected;
9345 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9348 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9354void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9356 GetSize(&width, &height);
9359 dc.SetBackground(*wxLIGHT_GREY);
9361 dc.SetPen(*wxTRANSPARENT_PEN);
9362 dc.SetBrush(wxBrush(GetBackgroundColour()));
9363 dc.DrawRectangle(GetVirtualSize());
9366 dc.SetBrush(wxBrush(m_boxColour));
9368 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9370 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9372 dc.SetBrush(wxBrush(m_boxColour));
9374 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9376 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9379 dc.DrawBitmap(m_bmpNormal, m_borderWidth, m_borderWidth,
false);
Global state for AIS decoder.
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.
Adds a std::shared<void> element to wxCommandEvent.
bool LoadAllPlugIns(bool enabled_plugins, bool keep_orphans=false)
Update catalog with imported metadata and load all plugin library files.
Represents the view port for chart display in OpenCPN.
EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Global variables reflecting command line options and arguments.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
Access checks for comm devices and dongle.