43#include <wx/progdlg.h>
44#include <wx/radiobox.h>
45#include <wx/listbox.h>
46#include <wx/imaglist.h>
47#include <wx/display.h>
50#include <wx/clrpicker.h>
51#include <wx/fontdata.h>
52#include <wx/fontdlg.h>
53#include <wx/stdpaths.h>
54#include <wx/tokenzr.h>
55#include <wx/mediactrl.h>
57#include <wx/odcombo.h>
58#include <wx/statline.h>
60#include <wx/textwrapper.h>
62#include "comm_drv_factory.h"
64#include "conn_params_panel.h"
66#if wxCHECK_VERSION(2, 9, \
68#include <wx/renderer.h>
70#if defined(__WXGTK__) || defined(__WXQT__)
71#include <wx/colordlg.h>
75#include "config_vars.h"
78#include "ocpn_frame.h"
82#include "glChartCanvas.h"
83extern GLuint g_raster_format;
89#include "multiplexer.h"
91#include "OCPN_Sound.h"
92#include "SoundFactory.h"
93#include "SystemCmdSound.h"
95#include "SystemCmdSound.h"
97#include "NMEALogWindow.h"
98#include "wx28compat.h"
104#include "ais_decoder.h"
105#include "ais_target_data.h"
107#include "usb_devices.h"
109#include "navutil_base.h"
116#include "udev_rule_mgr.h"
119#ifdef __OCPN__ANDROID__
120#include "androidUTIL.h"
123#ifdef __OCPN__ANDROID__
124#include <QtWidgets/QScroller>
127#include "OCPNPlatform.h"
128#include "ConfigMgr.h"
130#include "observable_globvar.h"
131#include "ser_ports.h"
132#include "svg_utils.h"
133#include "waypointman_gui.h"
135#if !defined(__WXOSX__)
136#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
138#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS
141wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
143wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
149extern bool g_bSoftwareGL;
150extern bool g_bShowFPS;
152extern bool g_bShowOutlines;
153extern bool g_bShowChartBar;
154extern bool g_bShowDepthUnits;
155extern bool g_bskew_comp;
156extern bool g_bopengl;
157extern bool g_bsmoothpanzoom;
158extern bool g_bShowTrue, g_bShowMag;
160extern int g_chart_zoom_modifier_raster;
161extern int g_chart_zoom_modifier_vector;
162extern int g_NMEAAPBPrecision;
163extern int g_nDepthUnitDisplay;
164extern bool g_bUIexpert;
166extern wxString* pInit_Chart_Dir;
168extern bool g_bfilter_cogsog;
169extern int g_COGFilterSec;
170extern int g_SOGFilterSec;
175extern bool g_bDisplayGrid;
178extern bool g_bShowLiveETA;
179extern double g_defaultBoatSpeed;
180extern double g_defaultBoatSpeedUserUnit;
183extern bool g_bCPAMax;
184extern double g_CPAMax_NM;
185extern bool g_bCPAWarn;
186extern double g_CPAWarn_NM;
187extern bool g_bTCPA_Max;
188extern double g_TCPA_Max;
189extern bool g_bMarkLost;
190extern double g_MarkLost_Mins;
191extern bool g_bRemoveLost;
192extern double g_RemoveLost_Mins;
193extern bool g_bShowCOG;
194extern double g_ShowCOG_Mins;
195extern bool g_bSyncCogPredictors;
196extern bool g_bAISShowTracks;
197extern double g_AISShowTracks_Mins;
198extern double g_ShowMoored_Kts;
199extern bool g_bHideMoored;
200extern bool g_bAllowShowScaled;
201extern int g_ShowScaled_Num;
202extern bool g_bAIS_CPA_Alert;
203extern bool g_bAIS_CPA_Alert_Audio;
204extern wxString g_sAIS_Alert_Sound_File;
205extern bool g_bAIS_CPA_Alert_Suppress_Moored;
206extern bool g_bShowAreaNotices;
207extern bool g_bDrawAISSize;
208extern bool g_bDrawAISRealtime;
209extern double g_AIS_RealtPred_Kts;
210extern bool g_bShowAISName;
211extern int g_Show_Target_Name_Scale;
212extern int g_WplAction;
214extern int g_iNavAidRadarRingsNumberVisible;
215extern float g_fNavAidRadarRingsStep;
216extern int g_pNavAidRadarRingsStepUnits;
217extern int g_iWaypointRangeRingsNumber;
218extern float g_fWaypointRangeRingsStep;
219extern int g_iWaypointRangeRingsStepUnits;
220extern wxColour g_colourWaypointRangeRingsColour;
221extern bool g_bWayPointPreventDragging;
222extern wxColour g_colourOwnshipRangeRingsColour;
223extern bool g_bShowShipToActive;
224extern int g_shipToActiveStyle;
225extern int g_shipToActiveColor;
227extern bool g_own_ship_sog_cog_calc;
228extern int g_own_ship_sog_cog_calc_damp_sec;
230extern bool g_bPreserveScaleOnX;
231extern bool g_bPlayShipsBells;
233extern wxString g_CmdSoundString;
235extern int g_iSoundDeviceIndex;
236extern bool g_bFullscreenToolbar;
237extern bool g_bTransparentToolbar;
238extern bool g_bTransparentToolbarInOpenGLOK;
240extern int g_OwnShipIconType;
241extern double g_n_ownship_length_meters;
242extern double g_n_ownship_beam_meters;
243extern double g_n_gps_antenna_offset_y;
244extern double g_n_gps_antenna_offset_x;
245extern int g_n_ownship_min_mm;
246extern double g_n_arrival_circle_radius;
248extern bool g_bEnableZoomToCursor;
249extern bool g_bTrackDaily;
250extern int g_track_rotate_time;
251extern int g_track_rotate_time_type;
252extern bool g_bHighliteTracks;
253extern double g_TrackDeltaDistance;
254extern double g_TrackDeltaDistance;
255extern int g_nTrackPrecision;
256extern wxColour g_colourTrackLineColour;
258extern int g_iSDMMFormat;
259extern int g_iDistanceFormat;
260extern int g_iSpeedFormat;
261extern int g_iTempFormat;
263extern bool g_bAdvanceRouteWaypointOnArrivalOnly;
265extern int g_cm93_zoom_factor;
267extern int g_COGAvgSec;
269extern bool g_bCourseUp;
270extern bool g_bLookAhead;
272extern double g_ownship_predictor_minutes;
273extern double g_ownship_HDTpredictor_miles;
275extern bool g_bAISRolloverShowClass;
276extern bool g_bAISRolloverShowCOG;
277extern bool g_bAISRolloverShowCPA;
279extern bool g_bAIS_ACK_Timeout;
280extern double g_AckTimeout_Mins;
282extern bool g_bQuiltEnable;
283extern bool g_bFullScreenQuilt;
284extern bool g_bConfirmObjectDelete;
285extern wxString g_compatOS;
287#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
288extern wxLocale* plocale_def_lang;
291extern double g_mouse_zoom_sensitivity;
292extern int g_mouse_zoom_sensitivity_ui;
294extern OcpnSound* g_anchorwatch_sound;
295extern wxString g_anchorwatch_sound_file;
296extern wxString g_DSC_sound_file;
297extern wxString g_SART_sound_file;
298extern wxString g_AIS_sound_file;
299extern bool g_bAIS_GCPA_Alert_Audio;
300extern bool g_bAIS_SART_Alert_Audio;
301extern bool g_bAIS_DSC_Alert_Audio;
302extern bool g_bAnchor_Alert_Audio;
304extern bool g_bMagneticAPB;
306extern bool g_fog_overzoom;
307extern bool g_oz_vector_scale;
308extern bool g_bShowStatusBar;
310extern s52plib* ps52plib;
312extern wxString g_locale;
313extern bool g_bportable;
314extern bool g_bdisable_opengl;
316extern ChartGroupArray* g_pGroupArray;
323extern bool g_bGLexpert;
325#define ID_CHOICE_NMEA wxID_HIGHEST + 1
327extern wxArrayString TideCurrentDataSet;
328extern wxString g_TCData_Dir;
334extern bool g_bShowMenuBar;
335extern bool g_bShowCompassWin;
338extern bool g_bresponsive;
339extern bool g_bAutoHideToolbar;
340extern int g_nAutoHideToolbar;
341extern int g_GUIScaleFactor;
342extern int g_ChartScaleFactor;
343extern float g_ChartScaleFactorExp;
344extern float g_MarkScaleFactorExp;
345extern bool g_bRollover;
346extern int g_ShipScaleFactor;
347extern float g_ShipScaleFactorExp;
348extern int g_ENCSoundingScaleFactor;
349extern int g_ENCTextScaleFactor;
350extern bool g_bShowMuiZoomButtons;
352extern double g_config_display_size_mm;
353extern bool g_config_display_size_manual;
354extern bool g_bInlandEcdis;
355extern unsigned int g_canvasConfig;
357extern wxString g_lastAppliedTemplateGUID;
358extern wxString g_default_wp_icon;
359extern wxString g_default_routepoint_icon;
360extern int g_iWpt_ScaMin;
361extern bool g_bUseWptScaMin;
362bool g_bOverruleScaMin;
363extern int osMajor, osMinor;
364extern bool g_bShowMuiZoomButtons;
367#ifdef __OCPN__ANDROID__
368extern int g_Android_SDK_Version;
372extern wxString GetShipNameFromFile(
int);
374WX_DEFINE_ARRAY_PTR(
ChartCanvas*, arrayofCanvasPtr);
375extern arrayofCanvasPtr g_canvasArray;
377#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
378static int lang_list[] = {
379 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
380 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
381 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
382 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
383 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
384 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
385 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
386 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
388 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
389 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
390 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
391 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
392 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
393 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
401 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
402 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
403 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
404 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
405 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
406 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
407 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
408 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
409 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
410 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
411 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
412 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
413 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
414 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
415 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
416 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
417 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
418 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
419 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
420 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
421 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
422 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
423 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
424 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
425 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
428 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
429 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
430 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
431 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
432 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
434 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
435 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
436 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
437 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
438 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
439 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
440 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
441 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
442 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
443 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
444 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
445 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
446 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
447 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
448 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
449 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
450 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
451 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
452 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
454 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
455 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
456 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
457 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
458 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
459 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
460 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
461 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
462 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
463 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
464 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
465 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
466 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
469#ifdef __OCPN__ANDROID__
470void prepareSlider(wxSlider* slider) {
471 slider->GetHandle()->setStyleSheet(
472 prepareAndroidSliderStyleSheet(slider->GetSize().x));
473 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
474 slider->GetHandle()->grabGesture(Qt::PanGesture);
475 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
480#if wxCHECK_VERSION(2, 9, 0)
481int wxCALLBACK SortConnectionOnPriority(wxIntPtr item1, wxIntPtr item2,
484int wxCALLBACK SortConnectionOnPriority(
long item1,
long item2,
long list)
487 wxListCtrl* lc =
reinterpret_cast<wxListCtrl*
>(list);
490 it1.SetId(lc->FindItem(-1, item1));
492 it1.SetMask(it1.GetMask() | wxLIST_MASK_TEXT);
494 it2.SetId(lc->FindItem(-1, item2));
496 it2.SetMask(it2.GetMask() | wxLIST_MASK_TEXT);
502 return it1.GetText().CmpNoCase(it2.GetText());
504 return it2.GetText().CmpNoCase(it1.GetText());
517 wxString textMod = text;
518 textMod.Replace(
" ",
"^");
521 wxString sep = wxFileName::GetPathSeparator();
522 textMod.Replace(sep,
" ");
524 Wrap(win, textMod, widthMax);
527 for (
size_t i = 0; i < m_array.GetCount(); i++) {
528 wxString a = m_array[i];
530 if (m_array.GetCount() > 1) {
531 if (i < m_array.GetCount() - 1) a += sep;
537 wxString
const& GetWrapped()
const {
return m_wrapped; }
538 int const GetLineCount()
const {
return m_lineCount; }
539 wxArrayString GetLineArray() {
return m_array; }
542 virtual void OnOutputLine(
const wxString& line) {
546 virtual void OnNewLine() {
554 wxArrayString m_array;
563 void DoChartSelected();
564 void SetSelected(
bool selected);
565 void OnPaint(wxPaintEvent& event);
567 void OnSize(wxSizeEvent& event);
569 int GetUnselectedHeight() {
return m_unselectedHeight; }
570 int GetRefHeight() {
return m_refHeight; }
571 bool IsSelected() {
return m_bSelected; }
572 void OnClickDown(wxMouseEvent& event);
573 void OnClickUp(wxMouseEvent& event);
578 wxColour m_boxColour;
579 int m_unselectedHeight;
580 wxString m_pChartDir;
584 DECLARE_EVENT_TABLE()
588EVT_PAINT(OCPNChartDirPanel::OnPaint)
590EVT_SIZE(OCPNChartDirPanel::OnSize)
594 const wxPoint& pos, const wxSize& size,
596 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
597 m_pChartDir = cdi.fullpath;
600 if (cdi.fullpath.StartsWith(
601 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
602 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
607 m_refHeight = GetCharHeight();
609 m_unselectedHeight = 2 * m_refHeight;
615 SetMinSize(wxSize(-1, m_unselectedHeight));
617 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
619#ifdef __OCPN__ANDROID__
620 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
625OCPNChartDirPanel::~OCPNChartDirPanel() {}
627static wxStopWatch swclick;
628#ifdef __OCPN__ANDROID__
629static int downx, downy;
632void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
633#ifdef __OCPN__ANDROID__
635 event.GetPosition(&downx, &downy);
641void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
642#ifdef __OCPN__ANDROID__
643 qDebug() << swclick.Time();
644 if (swclick.Time() < 200) {
646 event.GetPosition(&upx, &upy);
647 if ((fabs(upx - downx) < GetCharWidth()) &&
648 (fabs(upy - downy) < GetCharWidth())) {
656void OCPNChartDirPanel::DoChartSelected() {
666void OCPNChartDirPanel::SetSelected(
bool selected) {
667 m_bSelected = selected;
671 GetGlobalColor(_T(
"UIBCK"), &colour);
672 m_boxColour = colour;
674 GetGlobalColor(_T(
"DILG0"), &colour);
675 m_boxColour = colour;
680 g_pOptions->SetDirActionButtons();
687void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
688 if (m_pChartDir.Length()) {
690 GetClientSize(&x, &y);
693 wxArrayString nameWrapped = wrapper.GetLineArray();
695 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
701void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
703 GetSize(&width, &height);
706 dc.SetPen(*wxTRANSPARENT_PEN);
707 dc.SetBrush(wxBrush(GetBackgroundColour()));
708 dc.DrawRectangle(GetVirtualSize());
712 wxString nameString = m_pChartDir;
714 wxArrayString nameWrapped = wrapper.GetLineArray();
716 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
717 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
718 GetParent()->GetSizer()->Layout();
722 dc.SetBrush(wxBrush(m_boxColour));
724 GetGlobalColor(_T (
"UITX1" ), &c);
725 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
727 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
729 int offset = height / 10;
730 int text_x = offset * 2;
732 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
735 dc.SetTextForeground(wxColour(64, 64, 64));
737 int yd = height * 20 / 100;
738 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
740 dc.DrawText(nameWrapped[i], text_x, yd);
742 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
743 yd += GetCharHeight();
747 dc.SetBrush(wxBrush(m_boxColour));
749 GetGlobalColor(_T (
"GREY1" ), &c);
750 dc.SetPen(wxPen(c, 1));
752 int offset = height / 10;
753 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
754 height - (2 * offset), height / 10);
756 int text_x = offset * 2;
758 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
761 dc.SetTextForeground(wxColour(64, 64, 64));
763 int yd = height * 20 / 100;
764 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
766 dc.DrawText(nameWrapped[i], text_x, yd);
768 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
769 yd += GetCharHeight();
778static bool LoadAllPlugIns(
bool load_enabled) {
779 g_Platform->ShowBusySpinner();
780 bool b = PluginLoader::getInstance()->LoadAllPlugIns(load_enabled);
781 g_Platform->HideBusySpinner();
785WX_DECLARE_LIST(wxCheckBox, CBList);
792 const wxPoint& pt = wxDefaultPosition,
793 const wxSize& sz = wxDefaultSize,
794 long style = wxHSCROLL | wxVSCROLL,
795 const wxString& name = _T(
"scrolledWindow")) {
796 Create(parent,
id, pt, sz, style, name);
799 bool Create(wxWindow* parent, wxWindowID
id = -1,
800 const wxPoint& pt = wxDefaultPosition,
801 const wxSize& sz = wxDefaultSize,
802 long style = wxHSCROLL | wxVSCROLL,
803 const wxString& name = _T(
"scrolledWindow"));
807 unsigned int Append(wxString& label,
bool benable =
true);
808 unsigned int GetCount() {
return m_list.GetCount(); }
811 void Check(
int index,
bool val);
812 bool IsChecked(
int index);
820#include <wx/listimpl.cpp>
821WX_DEFINE_LIST(CBList);
823bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
824 const wxPoint& pt,
const wxSize& sz,
825 long style,
const wxString& name) {
826 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
828#ifdef __OCPN__ANDROID__
829 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
830 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
834 m_sizer =
new wxBoxSizer(wxVERTICAL);
840unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable) {
841 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
843 cb->SetValue(!benable);
849 return m_list.GetCount() - 1;
852void OCPNCheckedListCtrl::Check(
int index,
bool val) {
853 CBList::Node* node = m_list.Item(index);
854 wxCheckBox* cb = node->GetData();
856 if (cb) cb->SetValue(val);
859bool OCPNCheckedListCtrl::IsChecked(
int index) {
860 CBList::Node* node = m_list.Item(index);
861 wxCheckBox* cb = node->GetData();
864 return cb->GetValue();
869void OCPNCheckedListCtrl::Clear() {
870 for (
unsigned int i = 0; i < m_list.GetCount(); i++) {
871 wxCheckBox* cb = m_list[i];
879void appendOSDirSlash(wxString* pString);
881extern ArrayOfMmsiProperties g_MMSI_Props_Array;
888EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
889EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
893 const wxString& caption,
894 const wxPoint& pos, const wxSize& size,
896 : wxDialog(parent,
id, caption, pos, size,
897 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
899 GetSizer()->SetSizeHints(
this);
903ConfigCreateDialog::~ConfigCreateDialog(
void) {}
905void ConfigCreateDialog::CreateControls(
void) {
906 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
909 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
910 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
912 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
913 wxSize(40 * GetCharHeight(), -1), 0);
914 mainSizer->Add(m_TitleCtl, 0,
915 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
917 mainSizer->AddSpacer(2 * GetCharHeight());
919 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
920 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
923 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
924 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
925 mainSizer->Add(m_DescriptionCtl, 0,
926 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
928 mainSizer->AddSpacer(2 * GetCharHeight());
933 _(
"Create a private configuration template based on current settings.\n\
934This template will be saved, and may be selected for further use at any time.\n\
936 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
938 mainSizer->AddSpacer(2 * GetCharHeight());
940 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
941 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
943 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
944 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
946 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
947 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
948 m_OKButton->SetDefault();
951void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
952 EndModal(wxID_CANCEL);
955void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
956 const wxString& title = m_TitleCtl->GetValue();
957 const wxString& desc = m_DescriptionCtl->GetValue();
958 m_createdTemplateGUID =
959 ConfigMgr::Get().CreateNamedConfig(title, desc, _T(
""));
968EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
969EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
973 wxWindowID
id, const wxString& caption,
974 const wxPoint& pos, const wxSize& size,
976 : wxDialog(parent,
id, caption, pos, size,
977 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
980 GetSizer()->SetSizeHints(
this);
984MMSIEditDialog::~MMSIEditDialog(
void) {
delete m_MMSICtl; }
986void MMSIEditDialog::CreateControls(
void) {
987 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
990 wxStaticBox* mmsiBox =
991 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
993 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
994 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
996 mmsiSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"MMSI")), 0,
997 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
999 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
1000 wxDefaultPosition, wxSize(180, -1), 0);
1001 mmsiSizer->Add(m_MMSICtl, 0,
1002 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
1004 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(
1005 new wxStaticBox(
this, wxID_ANY, _(
"Tracking")), wxVERTICAL);
1007 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
1009 m_rbTypeTrackDefault =
1010 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
1011 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
1012 m_rbTypeTrackDefault->SetValue(TRUE);
1013 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
1015 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
1016 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
1018 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
1019 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
1021 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
1022 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
1024 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
1025 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
1027 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
1028 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
1030 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
1031 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
1032 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
1035 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
1036 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
1038 m_FollowerButton =
new wxCheckBox(
1039 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
1040 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
1042 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
1043 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
1045 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
1046 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1048 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
1049 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1050 m_OKButton->SetDefault();
1054 if (m_props->MMSI > 0)
1055 sMMSI.Printf(_T(
"%d"), m_props->MMSI);
1058 m_MMSICtl->AppendText(sMMSI);
1060 switch (m_props->TrackType) {
1061 case TRACKTYPE_ALWAYS:
1062 m_rbTypeTrackAlways->SetValue(TRUE);
1064 case TRACKTYPE_NEVER:
1065 m_rbTypeTrackNever->SetValue(TRUE);
1071 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
1072 m_IgnoreButton->SetValue(m_props->m_bignore);
1073 m_MOBButton->SetValue(m_props->m_bMOB);
1074 m_VDMButton->SetValue(m_props->m_bVDM);
1075 m_FollowerButton->SetValue(m_props->m_bFollower);
1077 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1080void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1082void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
1083 EndModal(wxID_CANCEL);
1086void MMSIEditDialog::Persist() {
1088 if (m_rbTypeTrackDefault->GetValue())
1089 m_props->TrackType = TRACKTYPE_DEFAULT;
1090 else if (m_rbTypeTrackAlways->GetValue())
1091 m_props->TrackType = TRACKTYPE_ALWAYS;
1093 m_props->TrackType = TRACKTYPE_NEVER;
1095 m_props->m_bignore = m_IgnoreButton->GetValue();
1096 m_props->m_bMOB = m_MOBButton->GetValue();
1097 m_props->m_bVDM = m_VDMButton->GetValue();
1098 m_props->m_bFollower = m_FollowerButton->GetValue();
1099 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
1100 if (m_props->m_ShipName == wxEmptyString) {
1101 auto proptarget = g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
1103 wxString s = proptarget->GetFullName();
1104 m_props->m_ShipName = s;
1106 wxString GetShipNameFromFile(
int);
1107 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
1113void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
1117 m_MMSICtl->GetValue().ToLong(&nmmsi);
1118 m_props->MMSI = nmmsi;
1121 if (m_MMSICtl->GetValue().Length() != 9) {
1124 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
1125 "your entries and cancel if necessary."),
1126 _(
"OpenCPN Info"), wxOK | wxCANCEL);
1128 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
1129 if (retcode == wxID_OK) {
1140void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
1143EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1144EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1145EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1146 MMSIListCtrl::OnListItemRightClick)
1147EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1148EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1152 const wxSize& size,
long style)
1153 : wxListCtrl(parent,
id, pos, size, style) {
1157MMSIListCtrl::~MMSIListCtrl(
void) {}
1159wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1163 if (!props)
return ret;
1166 if (props->MMSI > 0) ret = wxString::Format(_T(
"%d" ), props->MMSI);
1169 switch (props->TrackType) {
1170 case TRACKTYPE_DEFAULT:
1173 case TRACKTYPE_ALWAYS:
1176 case TRACKTYPE_NEVER:
1182 if (props->m_bPersistentTrack)
1183 ret.Append(_T(
", " )).Append(_(
"Persistent"));
1186 if (props->m_bignore) ret = _T(
"X" );
1189 if (props->m_bMOB) ret = _T(
"X" );
1192 if (props->m_bVDM) ret = _T(
"X" );
1195 if (props->m_bFollower) ret = _T(
"X");
1198 ret = props->m_ShipName;
1207void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1209void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1210 MmsiProperties* props = g_MMSI_Props_Array.Item(event.GetIndex());
1214 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1215 wxDefaultPosition, wxSize(200, 200));
1217 if (pd->ShowModal() == wxID_OK) {
1218 g_MMSI_Props_Array.RemoveAt(event.GetIndex());
1220 g_MMSI_Props_Array.Insert(props_new, event.GetIndex());
1227void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1228 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1229 if (m_context_item == wxNOT_FOUND)
return;
1230 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1231 wxMenuItem* item_edit =
1232 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") + _T(
"..."));
1233 menu->Append(item_edit);
1234 wxMenuItem* item_delete =
1235 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1236 menu->Append(item_delete);
1239 wxFont* qFont = GetOCPNScaledFont(_(
"Menu"));
1240 item_edit->SetFont(*qFont);
1241 item_delete->SetFont(*qFont);
1244 wxPoint p = ScreenToClient(wxGetMousePosition());
1245 PopupMenu(menu, p.x, p.y);
1247 SetItemCount(g_MMSI_Props_Array.GetCount());
1251void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1252 int context_item = m_context_item;
1257 switch (event.GetId()) {
1258 case ID_DEF_MENU_MMSI_EDIT: {
1261 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1262 wxDefaultPosition, wxSize(200, 200));
1264 if (pd->ShowModal() == wxID_OK) {
1265 g_MMSI_Props_Array.RemoveAt(context_item);
1267 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1268 g_MMSI_Props_Array.Insert(props_new, context_item);
1275 case ID_DEF_MENU_MMSI_DELETE:
1276 g_MMSI_Props_Array.RemoveAt(context_item);
1282MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1283 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1287 wxFont* qFont = GetOCPNScaledFont(_(
"Dialog"));
1290 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1293 wxString MMSI_props_column_spec = _T(
"120;120;100;100;100;100;100;100");
1295 wxStringTokenizer tkz(MMSI_props_column_spec, _T(
";"));
1296 wxString s_width = tkz.GetNextToken();
1301 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1302 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1303 wxBORDER_SUNKEN | wxLC_VIRTUAL);
1311 int dx = GetCharWidth();
1314 if (s_width.ToLong(&lwidth)) {
1315 width = wxMax(dx * 2, lwidth);
1316 width = wxMin(width, dx * 13);
1318 m_pListCtrlMMSI->InsertColumn(tlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, width);
1320 s_width = tkz.GetNextToken();
1322 if (s_width.ToLong(&lwidth)) {
1323 width = wxMax(dx * 2, lwidth);
1324 width = wxMin(width, dx * 25);
1326 m_pListCtrlMMSI->InsertColumn(tlCLASS, _(
"Track Mode"), wxLIST_FORMAT_CENTER,
1329 s_width = tkz.GetNextToken();
1331 if (s_width.ToLong(&lwidth)) {
1332 width = wxMax(dx * 2, lwidth);
1333 width = wxMin(width, dx * 10);
1335 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1338 s_width = tkz.GetNextToken();
1340 if (s_width.ToLong(&lwidth)) {
1341 width = wxMax(dx * 2, lwidth);
1342 width = wxMin(width, dx * 10);
1344 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"MOB"), wxLIST_FORMAT_CENTER, width);
1346 s_width = tkz.GetNextToken();
1348 if (s_width.ToLong(&lwidth)) {
1349 width = wxMax(dx * 2, lwidth);
1350 width = wxMin(width, dx * 15);
1352 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1355 s_width = tkz.GetNextToken();
1357 if (s_width.ToLong(&lwidth)) {
1358 width = wxMax(dx * 2, lwidth);
1359 width = wxMin(width, dx * 30);
1361 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ship name"), wxLIST_FORMAT_CENTER,
1364 s_width = tkz.GetNextToken();
1366 if (s_width.ToLong(&lwidth)) {
1367 width = wxMax(dx * 2, lwidth);
1368 width = wxMin(width, dx * 10);
1370 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Follower"), wxLIST_FORMAT_CENTER,
1373 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1375 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1377 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1378 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1380 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1387 SetSize(GetSize().x, GetSize().y - 1);
1389 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1392MMSI_Props_Panel::~MMSI_Props_Panel(
void) {}
1394void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1398 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1399 wxDefaultPosition, wxSize(200, 200));
1402 pd->ShowWindowModalThenDo([
this, pd, props](
int retcode) {
1403 if (retcode == wxID_OK) {
1404 g_MMSI_Props_Array.Add(props);
1412void MMSI_Props_Panel::UpdateMMSIList(
void) {
1414 long selItemID = wxNOT_FOUND;
1415 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1416 wxLIST_STATE_SELECTED);
1418 int selMMSI = wxNOT_FOUND;
1419 if (selItemID != wxNOT_FOUND) selMMSI = g_MMSI_Props_Array[selItemID]->MMSI;
1421 m_pListCtrlMMSI->SetItemCount(g_MMSI_Props_Array.GetCount());
1424 long item_sel = wxNOT_FOUND;
1425 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1426 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
1427 if (g_MMSI_Props_Array[i]->MMSI == selMMSI) {
1434 if (g_MMSI_Props_Array.GetCount() > 0)
1435 m_pListCtrlMMSI->SetItemState(item_sel,
1436 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1437 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1440 m_pListCtrlMMSI->Refresh(FALSE);
1444void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1454 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value = _T(
""),
1455 const wxPoint& pos = wxDefaultPosition,
1456 const wxSize& size = wxDefaultSize,
int n = 0,
1457 const wxString choices[] = NULL,
long style = 0,
1458 const wxValidator& validator = wxDefaultValidator,
1459 const wxString& name = _T(
"OCPNFatCombo"));
1463 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1464 wxCoord OnMeasureItem(
size_t item)
const;
1465 wxCoord OnMeasureItemWidth(
size_t item)
const;
1466 bool SetFont(
const wxFont& font);
1468 int Append(
const wxString& item, wxBitmap bmp);
1471 const wxFont* dfont;
1475 ArrayOfBitmaps bmpArray;
1478OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1480OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1481 const wxString& value,
const wxPoint& pos,
1482 const wxSize& size,
int n,
const wxString choices[],
1483 long style,
const wxValidator& validator,
1484 const wxString& name)
1485 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1488 GetFont().GetPointSize() / g_Platform->getFontPointsperPixel();
1489 itemHeight = (int)wxRound(fontHeight);
1490 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1493OCPNFatCombo::~OCPNFatCombo() {}
1495bool OCPNFatCombo::SetFont(
const wxFont& font) {
1500void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1507 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1508 wxBrush br = wxBrush(bg);
1509 wxBrush sv = dc.GetBrush();
1511 dc.DrawRectangle(0, 0, rect.width, rect.height);
1513 dc.SetTextForeground(wxColour(0, 0, 0));
1515 if (flags & wxODCB_PAINTING_CONTROL) {
1516 wxString text = GetValue();
1518 dc.DrawText(text, rect.x + margin_x + offset_x,
1519 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1521 dc.SetBackground(wxBrush(br));
1523 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1524 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1528wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1529 if (item < bmpArray.GetCount())
1530 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1532 return itemHeight * 12 / 10;
1535wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1537int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1539 int idx = wxOwnerDrawnComboBox::Append(item);
1544void OCPNFatCombo::Clear(
void) {
1545 wxOwnerDrawnComboBox::Clear();
1549BEGIN_EVENT_TABLE(
options, wxDialog)
1550EVT_INIT_DIALOG(options::OnDialogInit)
1551EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1552EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1553EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1554EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1555EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1556EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1557EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1558EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1559EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1560EVT_BUTTON(xID_OK, options::OnXidOkClick)
1561EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1562EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1563EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1565EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1566EVT_CLOSE(options::OnClose)
1568#if defined(__WXGTK__) || defined(__WXQT__)
1569EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1572EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1574EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1575EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1576EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1577EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1578EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1579EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1580EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1581EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1582EVT_CHAR_HOOK(options::OnCharHook)
1587 const wxPoint& pos, const wxSize& size,
long style) {
1592 long wstyle = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER;
1593 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1595 wxDialog::Create(parent,
id, caption, pos, size, wstyle);
1596 SetFont(*dialogFont);
1603 if (((size.x < 200) || (size.y < 200)) && !g_bresponsive) Fit();
1607 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1609 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1610 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1611 PluginLoader::getInstance()->LoadAllPlugIns(
false);
1612 m_pPlugInCtrl->ReloadPluginPanels();
1616options::~options(
void) {
1618 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1620 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1621 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1624 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1627 delete m_pSerialArray;
1628 delete m_pGroupArray;
1629 delete m_topImgList;
1633 delete m_pPlugInCtrl;
1634 if (g_pi_manager) g_pi_manager->SetListPanelPtr(NULL);
1635#ifndef __OCPN__ANDROID__
1636 delete m_PluginCatalogMgrPanel;
1641#if wxCHECK_VERSION(3, 0, 0)
1642bool options::SendIdleEvents(wxIdleEvent& event) {
1643 if (IsShown())
return wxDialog::SendIdleEvents(event);
1648void options::RecalculateSize(
void) {
1649 if (!g_bresponsive) {
1650 m_nCharWidthMax = GetSize().x / GetCharWidth();
1653 wxSize canvas_size = gFrame->GetSize();
1654 wxSize fitted_size = GetSize();
1656 fitted_size.x = wxMin(fitted_size.x, canvas_size.x);
1657 fitted_size.y = wxMin(fitted_size.y, canvas_size.y);
1659 SetSize(fitted_size);
1668 esize.x = GetCharWidth() * 110;
1669 esize.y = GetCharHeight() * 40;
1671 wxSize dsize = GetParent()->GetSize();
1672 esize.y = wxMin(esize.y, dsize.y - 0 );
1673 esize.x = wxMin(esize.x, dsize.x - 0 );
1676 wxSize fsize = GetSize();
1677 wxSize canvas_size = GetParent()->GetSize();
1678 wxPoint screen_pos = GetParent()->GetScreenPosition();
1679 int xp = (canvas_size.x - fsize.x) / 2;
1680 int yp = (canvas_size.y - fsize.y) / 2;
1681 Move(screen_pos.x + xp, screen_pos.y + yp);
1683 m_nCharWidthMax = GetSize().x / GetCharWidth();
1686void options::Init(
void) {
1687 m_pWorkDirList = NULL;
1689 pShowStatusBar = NULL;
1690 pShowMenuBar = NULL;
1691 pShowCompassWin = NULL;
1694 m_scrollWinChartList = NULL;
1695 ps57CtlListBox = NULL;
1697 m_pSerialArray = NULL;
1698 pUpdateCheckBox = NULL;
1699 pParseENCButton = NULL;
1706 pSoundDeviceIndex = NULL;
1710 pCBLookAhead = NULL;
1711 pCDOQuilting = NULL;
1712 pPreserveScale = NULL;
1713 pSmoothPanZoom = NULL;
1714 pEnableZoomToCursor = NULL;
1715 pSDisplayGrid = NULL;
1716 pCDOOutlines = NULL;
1717 pSDepthUnits = NULL;
1719 pSDefaultBoatSpeed = NULL;
1722 itemActiveChartStaticBox = NULL;
1724 pCheck_SOUNDG = NULL;
1726 pCheck_SHOWIMPTEXT = NULL;
1727 pCheck_SCAMIN = NULL;
1728 pCheck_ATONTEXT = NULL;
1729 pCheck_LDISTEXT = NULL;
1730 pCheck_XLSECTTEXT = NULL;
1732 m_bVisitLang = FALSE;
1733 m_itemFontElementListBox = NULL;
1734 m_textSample = NULL;
1735 m_topImgList = NULL;
1738 m_pGroupArray = NULL;
1739 m_groups_changed = 0;
1742 m_pageConnections = -1;
1747 m_pageConnections = -1;
1750 auto loader = PluginLoader::getInstance();
1751 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
1752 b_oldhaveWMM = b_haveWMM;
1757 m_bForceNewToolbaronCancel =
false;
1759 m_cs = (ColorScheme)0;
1762 m_pPlugInCtrl = NULL;
1763 m_PluginCatalogMgrPanel = NULL;
1769#ifdef __OCPN__ANDROID__
1779 dialogFont = GetOCPNScaledFont(_(
"Dialog"));
1781 dialogFontPlus =
new wxFont(
1783 dialogFontPlus->SetPointSize((dialogFontPlus->GetPointSize() * 1.2) +
1785 dialogFontPlus->SetWeight(wxFONTWEIGHT_BOLD);
1787 m_bVectorInit =
false;
1792 pCmdSoundString = NULL;
1794 m_sconfigSelect_single = NULL;
1795 m_sconfigSelect_twovertical = NULL;
1798 dc.SetFont(*dialogFont);
1800 dc.GetTextExtent(_T(
"H"), &width, &height, NULL, NULL, dialogFont);
1802 m_colourPickerDefaultSize = wxSize(4 * height, height * 2);
1810 double dsizemm = g_Platform->GetDisplaySizeMM();
1815#if defined(__GNUC__) && __GNUC__ < 8
1818static const wxString BAD_ACCESS_MSG = _(
1819 "The device selected is not accessible; opencpn will likely not be able\n"
1820 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1821 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1822 "with the following contents:\n\n"
1823 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1824 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1825 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1826 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1830static const wxString BAD_ACCESS_MSG = _(R
"(
1831The device selected is not accessible; opencpn will likely not be able
1832to use this device as-is. You might want to exit OpenCPN, reboot and
1833retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1834with the following contents:
1836 KERNEL=="ttyUSB*", MODE="0666"
1837 KERNEL=="ttyACM*", MODE="0666"
1838 KERNEL=="ttyS*", MODE="0666"
1840For more info, see the file LINUX_DEVICES.md in the distribution docs.
1845void options::OnDialogInit(wxInitDialogEvent& event) {}
1847void options::CheckDeviceAccess( wxString& path) {}
1849size_t options::CreatePanel(
const wxString& title) {
1850 size_t id = m_pListbook->GetPageCount();
1853 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1854 wxDefaultSize, wxTAB_TRAVERSAL, title);
1855 m_pListbook->AddPage(panel, title, FALSE,
id);
1859wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1860 if (parent > m_pListbook->GetPageCount() - 1) {
1863 _T(
"Warning: invalid parent in options::AddPage( %d, "), parent) +
1867 wxNotebookPage* page = m_pListbook->GetPage(parent);
1869 wxScrolledWindow* sw;
1871 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1872 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1873 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1875 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1876 nb->AddPage(sw, title);
1877 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1878 wxString toptitle = m_pListbook->GetPageText(parent);
1879 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1880 wxDefaultSize, wxNB_TOP);
1883 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1884 m_pListbook->SetSelection(0);
1885 m_pListbook->RemovePage(parent + 1);
1886 wxString previoustitle = page->GetName();
1888 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1889 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1891 nb->AddPage(page, previoustitle);
1895 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1897 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1898 nb->AddPage(sw, title);
1899 nb->ChangeSelection(0);
1901 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1902 wxDefaultSize, style, title);
1903 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1904 wxString toptitle = m_pListbook->GetPageText(parent);
1905 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1906 m_pListbook->SetSelection(0);
1907 m_pListbook->DeletePage(parent + 1);
1910#ifdef __OCPN__ANDROID__
1911 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1917bool options::DeletePluginPage(wxScrolledWindow* page) {
1918 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1919 wxNotebookPage* pg = m_pListbook->GetPage(i);
1920 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
1923 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1924 wxNotebookPage* spg = nb->GetPage(j);
1927 if (nb->GetPageCount() != 1)
return TRUE;
1929 spg = nb->GetPage(0);
1930 spg->Reparent(m_pListbook);
1932 wxString toptitle = m_pListbook->GetPageText(i);
1933 m_pListbook->DeletePage(i);
1934 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1938 }
else if (pg == page) {
1940 m_pListbook->DeletePage(i);
1941 wxPanel* panel =
new wxPanel(m_pListbook);
1942 wxString toptitle = m_pListbook->GetPageText(i);
1943 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1950void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1951 int group_item_spacing) {
1952 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1954 comm_dialog = std::make_shared<ConnectionsDialog>(m_pNMEAForm,
this);
1957 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
1958 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
1964void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1965 int group_item_spacing) {
1966 itemPanelShip = AddPage(parent, _(
"Own ship"));
1968 ownShip =
new wxBoxSizer(wxVERTICAL);
1969 itemPanelShip->SetSizer(ownShip);
1972 wxStaticBox* osdBox =
1973 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1974 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1975 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1977 wxFlexGridSizer* dispOptionsGrid =
1978 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1979 dispOptionsGrid->AddGrowableCol(1);
1980 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1982 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1983 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1984 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1986 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1987 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
1989 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
1990 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
1991 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
1993 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1994 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
1996 wxStaticText* iconTypeTxt =
1997 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
1998 dispOptionsGrid->Add(iconTypeTxt, 0);
2000 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
2001 _(
"Real Scale Vector")};
2003 m_pShipIconType =
new wxChoice(
2004 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
2005 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
2006 dispOptionsGrid->Add(m_pShipIconType, 0,
2007 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
2008 group_item_spacing);
2010 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
2011 realSizes->AddGrowableCol(1);
2013 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
2016 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
2018 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
2019 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2022 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
2024 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2025 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2028 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
2030 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2031 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2033 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
2034 _(
"GPS Offset from Midship (m)")),
2036 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2037 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2040 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
2042 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
2043 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
2046 wxFlexGridSizer* rrSelect =
2047 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2048 rrSelect->AddGrowableCol(1);
2049 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2051 wxStaticText* rrTxt =
2052 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
2053 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2055 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
2056 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
2057 _T(
"8" ), _T(
"9" ), _T(
"10" )};
2058 pNavAidRadarRingsNumberVisible =
2059 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
2060 m_pShipIconType->GetSize(), 11, rrAlt);
2061 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
2062 group_item_spacing);
2064 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2065 radarGrid->AddGrowableCol(1);
2066 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
2068 wxStaticText* distanceText =
2069 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
2070 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
2072 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL, _T(
""),
2073 wxDefaultPosition, wxSize(100, -1), 0);
2074 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
2075 group_item_spacing);
2077 wxStaticText* unitText =
2078 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
2079 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
2081 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2082 m_itemRadarRingsUnits =
2083 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
2084 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2085 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2087 wxStaticText* colourText =
2088 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Colour"));
2089 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2092 itemPanelShip, wxID_ANY, *wxRED, wxDefaultPosition,
2093 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2094 _T(
"ID_COLOUROSRANGECOLOUR" ));
2095 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2098 wxFlexGridSizer* shipToActiveGrid =
2099 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2100 shipToActiveGrid->AddGrowableCol(1);
2101 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2102 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2103 _(
"Show direction to Active Waypoint"));
2104 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2107 wxStaticText* shipToActiveText1 =
2108 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2109 shipToActiveGrid->Add(shipToActiveText1, 1,
2110 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2112 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"),
2113 _(
"Dot"), _(
"Long dash"),
2114 _(
"Short dash"), _(
"Dot dash")};
2115 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2116 m_shipToActiveStyle =
2117 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2118 LineStyleNChoices, LineStyleChoices, 0);
2119 m_shipToActiveStyle->SetSelection(0);
2120 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2122 wxStaticText* shipToActiveText2 =
2123 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2124 shipToActiveGrid->Add(shipToActiveText2, 1,
2125 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2127 wxString m_LineColorChoices[] = {
2128 (
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2129 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2130 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2131 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2133 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2134 m_shipToActiveColor =
2135 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2136 LineColorNChoices, m_LineColorChoices, 0);
2137 m_shipToActiveColor->SetSelection(0);
2138 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2141 wxStaticBox* trackText =
2142 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2143 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2144 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2145 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2147 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2148 _(
"Automatic Daily Tracks at midnight"));
2150 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2153 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2155#if wxCHECK_VERSION(2, 9, 0)
2156#if wxUSE_TIMEPICKCTRL
2157 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2160 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2161 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2162 wxDefaultPosition, wxDefaultSize, 0);
2165 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2166 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2167 wxDefaultPosition, wxDefaultSize, 0);
2169 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2174 pTrackRotateComputerTime =
2175 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2176 wxDefaultPosition, wxDefaultSize, 0);
2177 trackSizer1->Add(pTrackRotateComputerTime, 0,
2178 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2181 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2182 wxDefaultPosition, wxDefaultSize, 0);
2183 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2187 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2188 wxDefaultPosition, wxDefaultSize, 0);
2189 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2192 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2194 wxFlexGridSizer* hTrackGrid =
2195 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2196 hTrackGrid->AddGrowableCol(1);
2197 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2200 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2201 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2203 wxStaticText* trackColourText =
2204 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Colour"));
2205 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2208 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2209 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2210 _T(
"ID_COLOURTRACKCOLOUR" ));
2211 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2213 wxFlexGridSizer* pTrackGrid =
2214 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2215 pTrackGrid->AddGrowableCol(1);
2216 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2218 wxStaticText* tpText =
2219 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2220 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2222 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2223 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2224 m_pShipIconType->GetSize(), 3, trackAlt);
2225 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2226 group_item_spacing);
2229 wxStaticBox* ownshipcalcText =
2230 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Calculate values"));
2231 wxStaticBoxSizer* ownshipcalcSizer =
2232 new wxStaticBoxSizer(ownshipcalcText, wxVERTICAL);
2233 ownShip->Add(ownshipcalcSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2235 wxFlexGridSizer* dispOwnShipCalcOptionsGrid =
2236 new wxFlexGridSizer(2, 2, group_item_spacing, group_item_spacing);
2237 ownshipcalcSizer->Add(dispOwnShipCalcOptionsGrid, 0, wxTOP | wxALL | wxEXPAND,
2240 dispOwnShipCalcOptionsGrid->AddGrowableCol(1);
2242 pSogCogFromLLCheckBox =
2243 new wxCheckBox(itemPanelShip, ID_SOGCOGFROMLLCHECKBOX,
2244 _(
"Calculate SOG and COG from position changes"));
2245 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLCheckBox, 1, wxALL, 5);
2246 dispOwnShipCalcOptionsGrid->AddSpacer(0);
2248 wxStaticText* SogCogFromLLDampIntText =
new wxStaticText(
2249 itemPanelShip, wxID_STATIC, _(
"Min seconds between updates"));
2250 dispOwnShipCalcOptionsGrid->Add(SogCogFromLLDampIntText, 1, wxEXPAND | wxALL,
2251 group_item_spacing);
2253 pSogCogFromLLDampInterval =
new wxSpinCtrl(
2254 itemPanelShip, ID_SOGCOGDAMPINTTEXTCTRL, wxEmptyString, wxDefaultPosition,
2255 wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0);
2257 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLDampInterval, 0,
2258 wxALIGN_RIGHT | wxALL, group_item_spacing);
2263void options::CreatePanel_Routes(
size_t parent,
int border_size,
2264 int group_item_spacing) {
2265 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2267 Routes =
new wxBoxSizer(wxVERTICAL);
2268 itemPanelRoutes->SetSizer(Routes);
2270 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2272 wxString rrAlt[] = {_(
"None"), _T(
"1" ), _T(
"2" ), _T(
"3" ),
2273 _T(
"4" ), _T(
"5" ), _T(
"6" ), _T(
"7" ),
2274 _T(
"8" ), _T(
"9" ), _T(
"10" )};
2277 wxStaticBox* routeText =
2278 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2279 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2280 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2282 routeSizer->AddSpacer(5);
2285 wxFlexGridSizer* routepointiconSelect =
2286 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2287 routepointiconSelect->AddGrowableCol(1);
2288 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2291 wxStaticText* routepointiconTxt =
2292 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2293 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2294 group_item_spacing);
2297 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2298 0, NULL, wxCB_READONLY);
2299 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2300 wxALIGN_RIGHT | wxALL, group_item_spacing);
2302 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2305 int min_size = GetCharHeight() * 2;
2306 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2307 pRoutepointDefaultIconChoice->SetMinSize(
2308 wxSize(GetCharHeight() * 15, min_size));
2310 routeSizer->AddSpacer(5);
2312 wxFlexGridSizer* pRouteGrid =
2313 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2314 pRouteGrid->AddGrowableCol(1);
2315 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2317 wxStaticText* raText =
new wxStaticText(
2318 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Arrival Circle Radius (NMi)"));
2319 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2321 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2322 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2323 group_item_spacing);
2325 pAdvanceRouteWaypointOnArrivalOnly =
2326 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2327 _(
"Advance route waypoint on arrival only"));
2328 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2331 Routes->AddSpacer(8 * group_item_spacing);
2333 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2334 wxDefaultSize, wxLI_HORIZONTAL);
2335 Routes->Add(pln, 0, wxEXPAND);
2339 wxStaticBox* waypointText =
2340 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Waypoints"));
2341 wxStaticBoxSizer* waypointSizer =
2342 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2343 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2345 waypointSizer->AddSpacer(5);
2348 wxFlexGridSizer* waypointiconSelect =
2349 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2350 waypointiconSelect->AddGrowableCol(1);
2351 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2354 wxStaticText* waypointiconTxt =
2355 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2356 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2357 group_item_spacing);
2360 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2361 0, NULL, wxCB_READONLY);
2362 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2363 group_item_spacing);
2365 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2368 int rmin_size = GetCharHeight() * 2;
2369 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2370 pWaypointDefaultIconChoice->SetMinSize(
2371 wxSize(GetCharHeight() * 15, rmin_size));
2373 waypointSizer->AddSpacer(5);
2375 wxFlexGridSizer* ScaMinSizer =
2376 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2377 ScaMinSizer->AddGrowableCol(1);
2378 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2380 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2381 _(
"Show waypoints only at a chartscale greater than 1 :"));
2382 ScaMinSizer->Add(pScaMinChckB, 0);
2383 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2384 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2385 group_item_spacing);
2388 pScaMinOverruleChckB =
2389 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2390 _(
"Override the settings for chartscale based visibility "
2391 "and show always"));
2392 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2394 waypointSizer->AddSpacer(5);
2396 wxFlexGridSizer* waypointrrSelect =
2397 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2398 waypointrrSelect->AddGrowableCol(1);
2399 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2402 wxStaticText* waypointrrTxt =
2403 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint range rings"));
2404 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2406 pWaypointRangeRingsNumber =
2407 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2408 m_pShipIconType->GetSize(), 11, rrAlt);
2409 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2410 group_item_spacing);
2413 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2414 waypointradarGrid->AddGrowableCol(1);
2415 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2417 wxStaticText* waypointdistanceText =
new wxStaticText(
2418 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2419 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2420 group_item_spacing);
2422 pWaypointRangeRingsStep =
2423 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
2424 wxSize(100, -1), 0);
2425 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2426 group_item_spacing);
2428 wxStaticText* waypointunitText =
2429 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2430 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2431 group_item_spacing);
2433 m_itemWaypointRangeRingsUnits =
2434 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2435 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2436 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2437 wxALIGN_RIGHT | wxALL, border_size);
2439 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2440 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colours"));
2441 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2444 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2445 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2446 _T(
"ID_COLOURWAYPOINTRANGERINGSCOLOUR" ));
2447 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2448 wxALIGN_RIGHT | wxALL, 1);
2453 Routes->AddSpacer(8 * group_item_spacing);
2454 wxStaticLine* pln1 =
2455 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2456 wxDefaultSize, wxLI_HORIZONTAL);
2457 Routes->Add(pln1, 0, wxEXPAND);
2460 wxStaticBox* waypointControl =
2461 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2462 wxStaticBoxSizer* ControlSizer =
2463 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2464 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2466 ControlSizer->AddSpacer(5);
2468 pWayPointPreventDragging =
new wxCheckBox(
2469 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2470 _(
"Lock Waypoints (Unless waypoint property dialog visible)"));
2471 pWayPointPreventDragging->SetValue(FALSE);
2472 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2474 pConfirmObjectDeletion =
2475 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2476 _(
"Confirm deletion of tracks and routes"));
2477 pConfirmObjectDeletion->SetValue(FALSE);
2478 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2479 ControlSizer->AddSpacer(5);
2482 pWaypointDefaultIconChoice->Clear();
2484 bool fillCombo =
true;
2487 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2488 wxString* ps = pWayPointMan->GetIconDescription(i);
2489 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2491 pWaypointDefaultIconChoice->Append(*ps, bmp);
2496 int iconToSelect = -1;
2497 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2498 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2500 pWaypointDefaultIconChoice->Select(iconToSelect);
2506 pRoutepointDefaultIconChoice->Clear();
2511 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2512 wxString* ps = pWayPointMan->GetIconDescription(i);
2513 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2515 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2521 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2522 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2524 pRoutepointDefaultIconChoice->Select(iconToSelect);
2532void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2533 int group_item_spacing) {
2534 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2536 chartPanel =
new wxBoxSizer(wxVERTICAL);
2537 chartPanelWin->SetSizer(chartPanel);
2539 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2540 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2541 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2543 m_scrollWinChartList =
new wxScrolledWindow(
2544 chartPanelWin, wxID_ANY, wxDefaultPosition,
2545 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2547 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2549#ifndef __OCPN__ANDROID__
2554 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2556 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2557 m_scrollWinChartList->SetSizer(boxSizerCharts);
2559 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2560 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2562 wxString b1 = _(
"Add Directory...");
2563 wxString b2 = _(
"Remove Selected");
2564 wxString b3 = _(
"Compress Selected");
2572 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2573 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2575 cmdButtonSizer->AddSpacer(GetCharHeight());
2577 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2578 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2579 m_removeBtn->Disable();
2581 cmdButtonSizer->AddSpacer(GetCharHeight());
2584 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2585 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2586 m_compressBtn->Disable();
2588 m_compressBtn = NULL;
2591#ifdef __OCPN__ANDROID__
2592 if (g_Android_SDK_Version >= 30) {
2594 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2595 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2599 cmdButtonSizer->AddSpacer(GetCharHeight());
2601 wxStaticBox* itemStaticBoxUpdateStatic =
2602 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2603 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2604 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2605 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2607 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2608 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2610 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2611 _(
"Scan Charts and Update Database"));
2612 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2614 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2615 _(
"Force Full Database Rebuild"));
2616 itemFlexGridSizerUpdate->Add(pUpdateCheckBox, 1, wxALL, 5);
2618 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2619 _(
"Prepare all ENC Charts"));
2620 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2622 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2625 ActiveChartArray.Clear();
2626 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2627 ActiveChartArray.Add(m_CurrentDirList[i]);
2630 UpdateChartDirList();
2632 chartPanel->Layout();
2635void options::UpdateChartDirList() {
2637 m_scrollWinChartList->GetSizer()->Clear(
true);
2638 m_scrollWinChartList->ClearBackground();
2640 panelVector.clear();
2643 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2646 wxSize(-1, -1), ActiveChartArray[i]);
2647 chartPanel->SetSelected(
false);
2649 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2651 panelVector.push_back(chartPanel);
2654 m_scrollWinChartList->GetSizer()->Layout();
2656 chartPanelWin->ClearBackground();
2657 chartPanelWin->Layout();
2664#ifdef __OCPN__ANDROID__
2666 wxSize sza = GetSize();
2671 m_scrollWinChartList->GetParent()->Layout();
2674 m_scrollWinChartList->Scroll(0, 0);
2677void options::UpdateTemplateTitleText() {
2678 if (!m_templateTitleText)
return;
2680 wxString activeTitle;
2681 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2682 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2684 bool configCompare =
2685 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2686 if (!configCompare) activeTitle += _(
" [Modified]");
2687 m_templateTitleText->SetLabel(activeTitle);
2689 m_templateTitleText->SetLabel(_(
"None"));
2692void options::CreatePanel_Configs(
size_t parent,
int border_size,
2693 int group_item_spacing) {
2694 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2700 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2701 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2705 wxStaticBox* templateStatusBox =
2706 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2707 m_templateStatusBoxSizer =
2708 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2709 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2712 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2713 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2715 m_staticTextLastAppled =
new wxStaticText(
2716 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2717 m_staticTextLastAppled->Hide();
2719 statSizer->Add(m_staticTextLastAppled);
2721 m_templateTitleText =
2722 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2723 statSizer->Add(m_templateTitleText);
2724 m_templateTitleText->Hide();
2726 UpdateTemplateTitleText();
2728 wxStaticBox* configsBox =
2729 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2730 wxStaticBoxSizer* configSizer =
2731 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2732 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2734 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2735 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2737 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2738 cPanel->SetSizer(boxSizercPanel);
2740 m_scrollWinConfigList =
2741 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2742 wxBORDER_RAISED | wxVSCROLL);
2743 m_scrollWinConfigList->SetScrollRate(1, 1);
2744 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2746 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2748 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2749 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2751 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2752 configSizer->Add(btnSizer);
2755 wxButton* createButton =
2756 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2757 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2758 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2759 wxCommandEventHandler(options::OnCreateConfig), NULL,
2767 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2768 _(
"Delete Selected Config..."));
2769 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2770 group_item_spacing);
2771 m_configDeleteButton->Connect(
2772 wxEVT_COMMAND_BUTTON_CLICKED,
2773 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2775 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2776 _(
"Apply Selected Config"));
2777 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2778 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2779 wxCommandEventHandler(options::OnApplyConfig),
2786 SetConfigButtonState();
2790void options::ClearConfigList() {
2791 if (m_scrollWinConfigList) {
2792 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2793 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2794 wxWindowListNode* node = kids.Item(i);
2795 wxWindow* win = node->GetData();
2796 wxPanel* pcp = wxDynamicCast(win, wxPanel);
2805 SetConfigButtonState();
2808void options::BuildConfigList() {
2809 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2811 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2813 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2815 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2816 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2817 pp->Connect(wxEVT_LEFT_DOWN,
2818 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2822 wxWindowList kids = pp->GetChildren();
2823 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2824 wxWindowListNode* node = kids.Item(i);
2825 wxWindow* win = node->GetData();
2826 win->Connect(wxEVT_LEFT_DOWN,
2827 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2833 m_boxSizerConfigs->Layout();
2835 m_selectedConfigPanelGUID = _T(
"");
2836 SetConfigButtonState();
2839void options::SetConfigButtonState() {
2840 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2841 if (m_selectedConfigPanelGUID.StartsWith(
2843 m_configDeleteButton->Disable();
2844 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2847void options::OnCreateConfig(wxCommandEvent& event) {
2849 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2851 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2852 if (retcode == wxID_OK) {
2853 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2854 UpdateTemplateTitleText();
2858 m_DisplayConfigsPage->Layout();
2860 SetConfigButtonState();
2864void options::OnEditConfig(wxCommandEvent& event) {}
2866void options::OnDeleteConfig(wxCommandEvent& event) {
2867 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2869 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2870 m_selectedConfigPanelGUID = _T(
"");
2875 m_DisplayConfigsPage->Layout();
2876 SetConfigButtonState();
2879void options::OnApplyConfig(wxCommandEvent& event) {
2880 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2883 wxString currentLocale = g_locale;
2887 evt.SetId(ID_APPLY);
2891 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2895 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2896 wxString activeTitle =
2897 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2898 m_templateTitleText->SetLabel(activeTitle);
2899 m_templateTitleText->Show();
2900 m_staticTextLastAppled->Show();
2901 m_templateStatusBoxSizer->Layout();
2903 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2904 _(
"OpenCPN Info"), wxOK);
2907 if (m_scrollWinConfigList) {
2908 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2909 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2910 wxWindowListNode* node = kids.Item(i);
2911 wxWindow* win = node->GetData();
2912 wxPanel* pcp = wxDynamicCast(win, wxPanel);
2916 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2921 m_selectedConfigPanelGUID = wxEmptyString;
2923 m_returnChanges |= CONFIG_CHANGED;
2925 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2930void options::OnConfigMouseSelected(wxMouseEvent& event) {
2931 wxPanel* selectedPanel = NULL;
2932 wxObject* obj =
event.GetEventObject();
2934 wxPanel* panel = wxDynamicCast(obj, wxPanel);
2936 selectedPanel = panel;
2940 wxWindow* win = wxDynamicCast(obj, wxWindow);
2942 wxPanel* parentpanel = wxDynamicCast(win->GetParent(), wxPanel);
2944 selectedPanel = parentpanel;
2949 if (m_scrollWinConfigList) {
2950 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2951 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2952 wxWindowListNode* node = kids.Item(i);
2953 wxWindow* win = node->GetData();
2954 wxPanel* panel = wxDynamicCast(win, wxPanel);
2956 if (panel == selectedPanel) {
2958 GetGlobalColor(_T(
"UIBCK"), &colour);
2959 panel->SetBackgroundColour(colour);
2961 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
2963 panel->SetBackgroundColour(m_panelBackgroundUnselected);
2965 panel->Refresh(
true);
2969 m_DisplayConfigsPage->Layout();
2970 SetConfigButtonState();
2974void options::CreatePanel_Advanced(
size_t parent,
int border_size,
2975 int group_item_spacing) {
2976 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
2979 wxSize sz = g_Platform->getDisplaySize();
2980 double dpmm = g_Platform->GetDisplayDPmm();
2982 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2983 m_ChartDisplayPage->SetSizer(wrapperSizer);
2985 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
2988 itemBoxSizerUI->Add(0, border_size * 3);
2989 itemBoxSizerUI->Add(0, border_size * 3);
2992 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
2993 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
2995 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
2996 _(
"De-skew Raster Charts"));
2997 boxCharts->Add(pSkewComp, inputFlags);
2999 itemBoxSizerUI->Add(0, border_size * 3);
3000 itemBoxSizerUI->Add(0, border_size * 3);
3003 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
3004 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3006 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3007 _(
"Use Accelerated Graphics (OpenGL)"));
3008 OpenGLSizer->Add(pOpenGL, inputFlags);
3009 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3011 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3012 _(
"OpenGL Options") + _T(
"..."));
3013 OpenGLSizer->Add(bOpenGL, inputFlags);
3014 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3016#ifdef __OCPN__ANDROID__
3021 itemBoxSizerUI->Add(0, border_size * 3);
3022 itemBoxSizerUI->Add(0, border_size * 3);
3025 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3026 _(
"Chart Rotation Averaging Time"));
3028 wrapperSizer->Add(crat, 0,
3029 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3030 group_item_spacing);
3032 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3033 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
3036 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3037 wxDefaultPosition, wxSize(sz.x / 5, -1), wxTE_RIGHT);
3038 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
3039 group_item_spacing);
3041 pCOGUPFilterRow->Add(
3042 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3045 itemBoxSizerUI->Add(0, border_size * 3);
3046 itemBoxSizerUI->Add(0, border_size * 3);
3049 wxStaticText* zoomTextHead =
new wxStaticText(
3050 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3051 zoomTextHead->Wrap(-1);
3052 itemBoxSizerUI->Add(
3054 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3055 group_item_spacing);
3056 itemBoxSizerUI->Add(0, border_size * 1);
3058 itemBoxSizerUI->Add(
3059 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3062 m_pSlider_Zoom_Raster =
3063 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3064 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3066#ifdef __OCPN__ANDROID__
3067 prepareSlider(m_pSlider_Zoom_Raster);
3070 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3072 itemBoxSizerUI->Add(
3073 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3076 m_pSlider_Zoom_Vector =
3077 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3078 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3080#ifdef __OCPN__ANDROID__
3081 prepareSlider(m_pSlider_Zoom_Vector);
3084 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3086 itemBoxSizerUI->Add(
3087 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3089 m_pSlider_CM93_Zoom =
3090 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3091 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3092 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3094#ifdef __OCPN__ANDROID__
3095 prepareSlider(m_pSlider_CM93_Zoom);
3098 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3100 itemBoxSizerUI->Add(0, border_size * 3);
3101 itemBoxSizerUI->Add(0, border_size * 3);
3102 itemBoxSizerUI->Add(0, border_size * 3);
3105 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3106 _(
"Physical Screen Width")),
3108 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3109 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3111 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3112 pDPIRow->Add(pRBSizeAuto, inputFlags);
3113 pDPIRow->AddSpacer(10);
3114 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3115 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3116 pDPIRow->Add(pRBSizeManual, inputFlags);
3118 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3119 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3122 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3123 wxDefaultPosition, wxSize(sz.x / 5, -1), wxTE_RIGHT);
3124 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3126 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3129 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3130 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3132 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3133 wxCommandEventHandler(options::OnSizeManualButton),
3139 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3140 itemBoxSizerUI->SetHGap(border_size);
3147 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3148 m_ChartDisplayPage->SetSizer(wrapperSizer);
3149 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3152 itemBoxSizerUI->Add(0, border_size * 3);
3153 itemBoxSizerUI->Add(0, border_size * 3);
3156 itemBoxSizerUI->Add(
3157 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3159 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3160 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3162 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3163 _(
"Show Skewed Raster Charts as North-Up"));
3164 boxCharts->Add(pSkewComp, verticleInputFlags);
3182 itemBoxSizerUI->Add(0, border_size * 3);
3183 itemBoxSizerUI->Add(0, border_size * 3);
3186 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3187 _(
"Chart Rotation Averaging Time")),
3189 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3190 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3191 group_item_spacing);
3194 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3195 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
3196 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3198 pCOGUPFilterRow->Add(
3199 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3203 itemBoxSizerUI->Add(0, border_size * 8);
3204 itemBoxSizerUI->Add(0, border_size * 8);
3207 wxStaticText* zoomTextHead =
new wxStaticText(
3208 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3210 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3211 itemBoxSizerUI->Add(0, border_size * 1);
3212 itemBoxSizerUI->Add(0, border_size * 1);
3214 wxStaticText* zoomText =
new wxStaticText(
3215 m_ChartDisplayPage, wxID_ANY,
3216 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3217With a higher value, the same zoom level shows a more detailed chart."));
3219 smallFont = *dialogFont;
3221 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3223 zoomText->SetFont(smallFont);
3224 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3232 itemBoxSizerUI->Add(
3233 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3235 m_pSlider_Zoom_Raster =
3236 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3237 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3239#ifdef __OCPN__ANDROID__
3240 prepareSlider(m_pSlider_Zoom_Raster);
3243 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3245 itemBoxSizerUI->Add(
3246 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3248 m_pSlider_Zoom_Vector =
3249 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3250 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3252#ifdef __OCPN__ANDROID__
3253 prepareSlider(m_pSlider_Zoom_Vector);
3256 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3259 itemBoxSizerUI->Add(0, border_size * 3);
3260 itemBoxSizerUI->Add(0, border_size * 3);
3262 itemBoxSizerUI->Add(
3263 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3265 m_pSlider_CM93_Zoom =
3266 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3267 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3268 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3270#ifdef __OCPN__ANDROID__
3271 prepareSlider(m_pSlider_CM93_Zoom);
3274 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3277 itemBoxSizerUI->Add(0, border_size * 3);
3278 itemBoxSizerUI->Add(0, border_size * 3);
3279 itemBoxSizerUI->Add(0, border_size * 3);
3280 itemBoxSizerUI->Add(0, border_size * 3);
3281 itemBoxSizerUI->Add(0, border_size * 3);
3282 itemBoxSizerUI->Add(0, border_size * 3);
3285 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3286 _(
"Physical Screen Width")),
3288 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3289 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3291 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3292 pDPIRow->Add(pRBSizeAuto, inputFlags);
3293 pDPIRow->AddSpacer(10);
3294 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3295 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3296 pDPIRow->Add(pRBSizeManual, inputFlags);
3298 pScreenMM =
new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL, _T(
""),
3299 wxDefaultPosition, wxSize(3 * m_fontHeight, -1),
3301 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3303 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3306 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3307 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3309 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3310 wxCommandEventHandler(options::OnSizeManualButton),
3314 itemBoxSizerUI->Add(0, border_size * 3);
3315 itemBoxSizerUI->Add(0, border_size * 3);
3318 itemBoxSizerUI->Add(
3319 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3321 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3322 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3324 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3325 _(
"Use Accelerated Graphics (OpenGL)"));
3326 OpenGLSizer->Add(pOpenGL, inputFlags);
3327 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3329#ifdef __OCPN__ANDROID__
3333 wxButton* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3334 _(
"Options") + _T(
"..."));
3335 OpenGLSizer->Add(bOpenGL, inputFlags);
3336 bOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3338 itemBoxSizerUI->Add(0, border_size * 3);
3350void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3351 int group_item_spacing) {
3352 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3355 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3356 ps57Ctl->SetSizer(vectorPanel);
3359 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3360 optionsColumn->SetHGap(border_size);
3361 optionsColumn->AddGrowableCol(0, 2);
3362 optionsColumn->AddGrowableCol(1, 3);
3363 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3366 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3367 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3372 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3374 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3375 _(
"Mariner's Standard")};
3376 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3377 wxDefaultSize, 4, pDispCatStrings);
3378 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3382 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3383 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3386 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display")),
3389 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3390 optionsColumn->Add(miscSizer, groupInputFlags);
3394 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3395 pCheck_SOUNDG->SetValue(FALSE);
3396 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3399 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3400 _(
"Chart Information Objects"));
3401 pCheck_META->SetValue(FALSE);
3402 miscSizer->Add(pCheck_META, verticleInputFlags);
3405 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3408 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3409 optionsColumn->Add(lightSizer, groupInputFlags);
3412 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3413 pCheck_ATONTEXT->SetValue(FALSE);
3414 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3417 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3418 pCheck_LDISTEXT->SetValue(FALSE);
3419 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3421 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3422 _(
"Extended Light Sectors"));
3423 pCheck_XLSECTTEXT->SetValue(FALSE);
3424 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3427 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3430 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3431 optionsColumn->Add(textSizer, groupInputFlags);
3433 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3434 _(
"National text on chart"));
3435 pCheck_NATIONALTEXT->SetValue(FALSE);
3436 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3438 pCheck_SHOWIMPTEXT =
3439 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3440 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3441 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3444 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3445 pCheck_DECLTEXT->SetValue(FALSE);
3446 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3448 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3450 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3451 _(
"Reduced Detail at Small Scale"));
3452 pCheck_SCAMIN->SetValue(FALSE);
3453 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3455 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3457 pCheck_SuperSCAMIN =
new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3458 _(
"Additonal detail reduction at Small Scale"));
3459 pCheck_SuperSCAMIN->SetValue(FALSE);
3460 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3463 optionsColumn->Add(0, border_size * 4);
3464 optionsColumn->Add(0, border_size * 4);
3467 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3469 wxString pPointStyleStrings[] = {
3473 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3474 wxDefaultSize, 2, pPointStyleStrings);
3475 optionsColumn->Add(pPointStyle, inputFlags);
3477 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3479 wxString pBoundStyleStrings[] = {
3483 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3484 wxDefaultSize, 2, pBoundStyleStrings);
3485 optionsColumn->Add(pBoundStyle, inputFlags);
3487 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3489 wxString pColorNumStrings[] = {
3493 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3494 wxDefaultSize, 2, pColorNumStrings);
3495 optionsColumn->Add(p24Color, inputFlags);
3498 optionsColumn->Add(0, border_size * 4);
3499 optionsColumn->Add(0, border_size * 4);
3502 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3504 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3505 optionsColumn->Add(depShalRow);
3507 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3508 wxSize(60, -1), wxTE_RIGHT);
3509 depShalRow->Add(m_ShallowCtl, inputFlags);
3510 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3511 depShalRow->Add(m_depthUnitsShal, inputFlags);
3513 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3515 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3516 optionsColumn->Add(depSafeRow);
3517 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""),
3518 wxDefaultPosition, wxSize(60, -1), wxTE_RIGHT);
3519 depSafeRow->Add(m_SafetyCtl, inputFlags);
3520 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3521 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3523 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3525 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3526 optionsColumn->Add(depDeepRow);
3527 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""),
3528 wxDefaultPosition, wxSize(60, -1), wxTE_RIGHT);
3529 depDeepRow->Add(m_DeepCtl, inputFlags);
3530 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3531 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3534 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3535 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3537 wxStaticBox* marinersBox =
3538 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3539 wxStaticBoxSizer* marinersSizer =
3540 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3541 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3544 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3545 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3547 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3548 itemButtonSelectList =
3549 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3550 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3551 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3552 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3553 marinersSizer->Add(btnRow1);
3555 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3557 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3558 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3559 marinersSizer->Add(btnRow2);
3564 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3565 ps57Ctl->SetSizer(vectorPanel);
3567 wxBoxSizer* optionsColumn = vectorPanel;
3570 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3575 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3577 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3578 _(
"Mariner's Standard")};
3579 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3580 wxSize(350, -1), 4, pDispCatStrings);
3581 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3584 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _T(
"")));
3589 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3590 optionsColumn->Add(miscSizer, groupInputFlags);
3593 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3594 pCheck_SOUNDG->SetValue(FALSE);
3595 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3597 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3598 _(
"Chart Information Objects"));
3599 pCheck_META->SetValue(FALSE);
3600 miscSizer->Add(pCheck_META, inputFlags);
3602 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3603 optionsColumn->Add(lightSizer, groupInputFlags);
3606 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3607 pCheck_ATONTEXT->SetValue(FALSE);
3608 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3611 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3612 pCheck_LDISTEXT->SetValue(FALSE);
3613 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3615 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3616 _(
"Extended Light Sectors"));
3617 pCheck_XLSECTTEXT->SetValue(FALSE);
3618 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3620 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3621 optionsColumn->Add(textSizer, groupInputFlags);
3623 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3624 _(
"National text on chart"));
3625 pCheck_NATIONALTEXT->SetValue(FALSE);
3626 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3628 pCheck_SHOWIMPTEXT =
3629 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3630 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3631 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3634 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3635 pCheck_DECLTEXT->SetValue(FALSE);
3636 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3638 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3639 _(
"Reduced Detail at Small Scale"));
3640 pCheck_SCAMIN->SetValue(FALSE);
3641 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3643 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3645 pCheck_SuperSCAMIN =
new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3646 _(
"Additonal detail reduction at Small Scale"));
3647 pCheck_SuperSCAMIN->SetValue(FALSE);
3648 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3651 optionsColumn->Add(0, border_size * 4);
3652 optionsColumn->Add(0, border_size * 4);
3656 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3657 StyleColumn->SetHGap(border_size);
3658 StyleColumn->AddGrowableCol(0, 2);
3659 StyleColumn->AddGrowableCol(1, 3);
3660 optionsColumn->Add(StyleColumn);
3662 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3664 wxString pPointStyleStrings[] = {
3668 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3669 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3670 pPointStyleStrings);
3671#ifdef __OCPN__ANDROID__
3672 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3675 StyleColumn->Add(pPointStyle, inputFlags);
3677 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3679 wxString pBoundStyleStrings[] = {
3683 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3684 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3685 pBoundStyleStrings);
3686#ifdef __OCPN__ANDROID__
3687 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3690 StyleColumn->Add(pBoundStyle, inputFlags);
3692 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3695 wxString pColorNumStrings[] = {
3699 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3700 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3702#ifdef __OCPN__ANDROID__
3703 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3705 StyleColumn->Add(p24Color, inputFlags);
3708 optionsColumn->Add(0, border_size * 4);
3709 optionsColumn->Add(0, border_size * 4);
3711 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3712 DepthColumn->SetHGap(border_size);
3713 DepthColumn->AddGrowableCol(0, 3);
3714 DepthColumn->AddGrowableCol(1, 2);
3715 DepthColumn->AddGrowableCol(2, 3);
3716 optionsColumn->Add(DepthColumn);
3719 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3722 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3723 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3724 DepthColumn->Add(m_ShallowCtl, inputFlags);
3725 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3726 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3728 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3731 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3732 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3733 DepthColumn->Add(m_SafetyCtl, inputFlags);
3734 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3735 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3737 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3740 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
3741 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3742 DepthColumn->Add(m_DeepCtl, inputFlags);
3743 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3744 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3747 optionsColumn->Add(0, border_size * 4);
3748 optionsColumn->Add(0, border_size * 4);
3751 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3752 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3754 wxStaticBox* marinersBox =
3755 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3756 wxStaticBoxSizer* marinersSizer =
3757 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3758 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3760 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3761 itemButtonSelectList =
3762 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3763 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3764 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3765 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3766 marinersSizer->Add(btnRow1);
3768 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3770 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3771 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3772 marinersSizer->Add(btnRow2);
3781 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3784 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3788void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3789 int group_item_spacing) {
3790 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3792 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3793 tcPanel->SetSizer(mainHBoxSizer);
3795 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3796 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3797 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3800 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3801 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3803 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3807 tcDataSelected->DeleteAllItems();
3812 col0.SetText(_T(
""));
3814 col0.SetAlign(wxLIST_FORMAT_LEFT);
3816 tcDataSelected->InsertColumn(0, col0);
3819 for (
unsigned int id = 0;
id < TideCurrentDataSet.Count();
id++) {
3822 long idx = tcDataSelected->InsertItem(li);
3824 wxString setName = TideCurrentDataSet[id];
3825 tcDataSelected->SetItem(
id, 0, setName);
3826 GetTextExtent(setName, &w1, &h);
3827 w = w1 > w ? w1 : w;
3829 tcDataSelected->SetColumnWidth(0, 20 + w);
3832 wxButton* insertButton =
3833 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3834 wxButton* removeButton =
3835 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3837 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3838 tcSizer->Add(btnSizer);
3840 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3841 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3844void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3845 int group_item_spacing) {
3850 wxWindow* chartsPage = m_pListbook->GetPage(parent);
3853 groupsPanel->m_panel = AddPage(parent, _(
"Chart Groups"));
3855 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3858void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3859 int group_item_spacing) {
3861 m_border_size = border_size;
3862 m_group_item_spacing = group_item_spacing;
3864 m_UIcomplete = FALSE;
3869void ChartGroupsUI::CompletePanel(
void) {
3870 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3871 m_panel->SetSizer(m_topSizer);
3874 wxStaticText* allChartsLabel =
3875 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3876 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3878 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3879 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3881 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3882 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3884#ifdef __OCPN__ANDROID__
3886 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE, _T(
""),
3887 wxDefaultPosition, wxDefaultSize, wxVSCROLL);
3890 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE, _T(
""),
3891 wxDefaultPosition, wxDefaultSize, wxVSCROLL);
3893 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3895 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3896 m_pAddButton->Disable();
3897 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3898 m_pRemoveButton->Disable();
3900 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3901 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3903 m_pRemoveButton->Connect(
3904 wxEVT_COMMAND_BUTTON_CLICKED,
3905 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3907 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3908 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3909 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3911 sizerCharts->AddSpacer(20);
3914 wxStaticText* groupsLabel =
3915 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3916 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3918 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
3919 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
3921 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
3922 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
3923 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
3924 wxDefaultSize, wxNB_TOP);
3925 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
3927 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
3928 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
3932 wxPanel* allActiveGroup =
3933 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
3934 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
3936 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
3937 allActiveGroup->SetSizer(page0BoxSizer);
3939 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1, _T(
""),
3940 wxDefaultPosition, wxDefaultSize);
3943 iFont =
new wxFont(*dialogFont);
3944 iFont->SetStyle(wxFONTSTYLE_ITALIC);
3945 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
3947 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
3949 m_DirCtrlArray.Add(defaultAllCtl);
3953 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
3954 m_pDeleteGroupButton =
3955 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
3956 m_pDeleteGroupButton->Disable();
3958 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3959 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
3961 m_pDeleteGroupButton->Connect(
3962 wxEVT_COMMAND_BUTTON_CLICKED,
3963 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
3965 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
3966 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
3968 newDeleteGrp->AddSpacer(25);
3969 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
3970 m_group_item_spacing);
3971 newDeleteGrp->AddSpacer(15);
3972 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
3973 m_group_item_spacing);
3974 newDeleteGrp->AddSpacer(25);
3975 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3977 sizerGroups->AddSpacer(20);
3981 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
3982 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
3985 m_UIcomplete = TRUE;
3988void options::CreatePanel_Display(
size_t parent,
int border_size,
3989 int group_item_spacing) {
3990 pDisplayPanel = AddPage(parent, _(
"General"));
3993 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
3994 generalSizer->SetHGap(border_size);
4001 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4002 pDisplayPanel->SetSizer(wrapperSizer);
4003 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4006 generalSizer->Add(0, border_size * 4);
4007 generalSizer->Add(0, border_size * 4);
4012 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4014 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4015 generalSizer->Add(boxNavMode, groupInputFlags);
4017 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4018 boxNavMode->Add(rowOrientation);
4020 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4021 rowOrientation->Add(pCBNorthUp, inputFlags);
4023 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4024 rowOrientation->Add(pCBCourseUp,
4026 .Align(wxALIGN_CENTRE_VERTICAL)
4027 .Border(wxLEFT, group_item_spacing * 2));
4029 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4030 _(
"Look Ahead Mode"));
4031 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4034 generalSizer->Add(0, border_size * 4);
4035 generalSizer->Add(0, border_size * 4);
4039 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4041 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4042 generalSizer->Add(boxCharts, groupInputFlags);
4044 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4045 _(
"Enable Chart Quilting"));
4046 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4049 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4050 _(
"Preserve scale when switching charts"));
4051 boxCharts->Add(pPreserveScale, verticleInputFlags);
4054 generalSizer->Add(0, border_size * 4);
4055 generalSizer->Add(0, border_size * 4);
4059 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4061 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4062 generalSizer->Add(boxCtrls, groupInputFlags);
4064 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4065 _(
"Smooth Panning / Zooming"));
4066 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4068 pEnableZoomToCursor =
4069 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4070 pEnableZoomToCursor->SetValue(FALSE);
4071 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4074 generalSizer->Add(0, border_size * 4);
4075 generalSizer->Add(0, border_size * 4);
4080 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4082 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4083 generalSizer->Add(boxDisp, groupInputFlags);
4086 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4087 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4089 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4090 _(
"Show Chart Outlines"));
4091 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4093 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4094 _(
"Show Depth Units"));
4095 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4105 generalSizer->Add(0, border_size * 4);
4106 generalSizer->Add(0, border_size * 4);
4110 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4112 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4113 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4116 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4117 _(
"Live ETA at Cursor"));
4118 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4122 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4123 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4124 defaultBoatSpeedSizer->Add(
4125 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Default Boat Speed ")),
4126 groupLabelFlagsHoriz);
4127 pSDefaultBoatSpeed =
4128 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED, _T(
""),
4129 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4130 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4131 group_item_spacing);
4136#ifndef __OCPN__ANDROID__
4138 if (g_Platform->GetDisplayAreaCM2() > 100) {
4139 wxStaticBox* itemStaticBoxScreenConfig =
4140 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4141 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4142 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4143 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4146 wxString iconDir = g_Platform->GetSharedDataDir();
4147 appendOSDirSlash(&iconDir);
4148 iconDir.append(_T(
"uidata"));
4149 appendOSDirSlash(&iconDir);
4150 iconDir.append(_T(
"MUI_flat"));
4151 appendOSDirSlash(&iconDir);
4152 int bmpSize = GetCharHeight() * 3;
4155 LoadSVG(iconDir + _T(
"MUI_Sconfig_1.svg"), bmpSize, bmpSize);
4156 m_sconfigSelect_single =
4158 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4161 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4163 bmp = LoadSVG(iconDir + _T(
"MUI_Sconfig_2.svg"), bmpSize, bmpSize);
4164 m_sconfigSelect_twovertical =
4166 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4169 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4174 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4175 generalSizer->SetHGap(border_size);
4182 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4183 pDisplayPanel->SetSizer(wrapperSizer);
4184 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4187 generalSizer->Add(0, border_size * 4);
4188 generalSizer->Add(0, border_size * 4);
4193 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4195 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4196 generalSizer->Add(boxNavMode, groupInputFlags);
4198 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4199 boxNavMode->Add(rowOrientation);
4201 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4202 rowOrientation->Add(pCBNorthUp, inputFlags);
4204 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4205 rowOrientation->Add(pCBCourseUp,
4207 .Align(wxALIGN_CENTRE_VERTICAL)
4208 .Border(wxLEFT, group_item_spacing * 2));
4210 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4211 _(
"Look Ahead Mode"));
4212 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4215 generalSizer->Add(0, border_size * 4);
4216 generalSizer->Add(0, border_size * 4);
4220 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4222 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4223 generalSizer->Add(boxCharts, groupInputFlags);
4225 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4226 _(
"Enable Chart Quilting"));
4227 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4230 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4231 _(
"Preserve scale when switching charts"));
4232 boxCharts->Add(pPreserveScale, verticleInputFlags);
4235 generalSizer->Add(0, border_size * 4);
4236 generalSizer->Add(0, border_size * 4);
4240 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4242 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4243 generalSizer->Add(boxCtrls, groupInputFlags);
4245 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4246 _(
"Smooth Panning / Zooming"));
4247 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4248 pEnableZoomToCursor =
4249 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4250 pEnableZoomToCursor->SetValue(FALSE);
4251 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4253#ifdef __OCPN__ANDROID__
4254 pSmoothPanZoom->Hide();
4255 pEnableZoomToCursor->Hide();
4259 generalSizer->Add(0, border_size * 4);
4260 generalSizer->Add(0, border_size * 4);
4265 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4267 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4268 generalSizer->Add(boxDisp, groupInputFlags);
4271 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4272 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4274 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4275 _(
"Show Chart Outlines"));
4276 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4278 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4279 _(
"Show Depth Units"));
4280 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4290 generalSizer->Add(0, border_size * 4);
4291 generalSizer->Add(0, border_size * 4);
4295 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4297 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4298 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4301 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4302 _(
"Live ETA at Cursor"));
4303 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4307 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4308 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4309 defaultBoatSpeedSizer->Add(
4310 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Default Boat Speed ")),
4311 groupLabelFlagsHoriz);
4312 pSDefaultBoatSpeed =
4313 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED, _T(
""),
4314 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4315 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4316 group_item_spacing);
4321#ifndef __OCPN__ANDROID__
4322 if (g_Platform->GetDisplayAreaCM2() > 100) {
4324 wxStaticBox* itemStaticBoxScreenConfig =
4325 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4326 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4327 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4328 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4331 wxString iconDir = g_Platform->GetSharedDataDir();
4332 appendOSDirSlash(&iconDir);
4333 iconDir.append(_T(
"uidata"));
4334 appendOSDirSlash(&iconDir);
4335 iconDir.append(_T(
"MUI_flat"));
4336 appendOSDirSlash(&iconDir);
4337 int bmpSize = GetCharHeight() * 3;
4340 LoadSVG(iconDir + _T(
"MUI_Sconfig_1.svg"), bmpSize, bmpSize);
4341 m_sconfigSelect_single =
4343 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4346 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4348 bmp = LoadSVG(iconDir + _T(
"MUI_Sconfig_2.svg"), bmpSize, bmpSize);
4349 m_sconfigSelect_twovertical =
4351 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4354 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4360void options::CreatePanel_Units(
size_t parent,
int border_size,
4361 int group_item_spacing) {
4362 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4365 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4366 unitsSizer->SetHGap(border_size);
4370 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4371 panelUnits->SetSizer(wrapperSizer);
4373 wrapperSizer->Add(1, border_size * 24);
4374 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4377 unitsSizer->Add(0, border_size * 4);
4378 unitsSizer->Add(0, border_size * 4);
4381 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4383 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4384 _(
"Kilometers"), _(
"Meters")};
4385 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4387 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4388 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4390#ifdef __OCPN__ANDROID__
4391 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4393 unitsSizer->Add(pDistanceFormat, inputFlags);
4396 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4398 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4399 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4400 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4401 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4402 m_SpeedFormatsNChoices, pSpeedFormats);
4403#ifdef __OCPN__ANDROID__
4404 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4406 unitsSizer->Add(pSpeedFormat, inputFlags);
4409 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4411 wxString pDepthUnitStrings[] = {
4417 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4418 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4419#ifdef __OCPN__ANDROID__
4420 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4422 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4425 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4427 wxString pTempUnitStrings[] = {
4433 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4434 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4435#ifdef __OCPN__ANDROID__
4436 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4438 unitsSizer->Add(pTempFormat, inputFlags);
4441 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4442 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4445 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4447 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4448 _(
"Decimal Degrees"),
4449 _(
"Degrees, Minutes, Seconds")};
4450 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4451 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4452 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4453 m_SDMMFormatsNChoices, pSDMMFormats);
4454#ifdef __OCPN__ANDROID__
4455 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4457 unitsSizer->Add(pSDMMFormat, inputFlags);
4460 unitsSizer->Add(0, border_size * 4);
4461 unitsSizer->Add(0, border_size * 4);
4464 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4469 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4470 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4471 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4474 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4475 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4476 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4480 wxStaticBox* itemStaticBoxVar =
4481 new wxStaticBox(panelUnits, wxID_ANY, _T(
""));
4483 wxStaticBoxSizer* itemStaticBoxSizerVar =
4484 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4485 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4487 itemStaticBoxSizerVar->Add(0, border_size * 4);
4489 itemStaticTextUserVar =
4490 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4491 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4492 group_item_spacing);
4494 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4495 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4496 group_item_spacing);
4498 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL, _T(
""),
4499 wxDefaultPosition, wxSize(150, -1), wxTE_RIGHT);
4500 magVarSizer->AddSpacer(100);
4502 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4504 itemStaticTextUserVar2 =
4505 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4507 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4508 group_item_spacing);
4510 itemStaticBoxSizerVar->Add(0, border_size * 40);
4513 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4514 unitsSizer->SetHGap(border_size);
4518 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4519 panelUnits->SetSizer(wrapperSizer);
4520 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4523 unitsSizer->Add(0, border_size * 4);
4524 unitsSizer->Add(0, border_size * 4);
4527 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4529 wxString pDistanceFormats[] = {_(
"Nautical miles"), _(
"Statute miles"),
4530 _(
"Kilometers"), _(
"Meters")};
4531 int m_DistanceFormatsNChoices =
sizeof(pDistanceFormats) /
sizeof(wxString);
4532 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4533 wxDefaultPosition, wxDefaultSize,
4534 m_DistanceFormatsNChoices, pDistanceFormats);
4535 unitsSizer->Add(pDistanceFormat, inputFlags);
4538 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4540 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4541 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4543 new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE, wxDefaultPosition,
4544 wxDefaultSize, m_SpeedFormatsNChoices, pSpeedFormats);
4545 unitsSizer->Add(pSpeedFormat, inputFlags);
4548 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4550 wxString pDepthUnitStrings[] = {
4556 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4557 wxDefaultSize, 3, pDepthUnitStrings);
4558 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4561 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4563 wxString pTempUnitStrings[] = {
4569 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4570 wxDefaultSize, 3, pTempUnitStrings);
4571 unitsSizer->Add(pTempFormat, inputFlags);
4574 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4575 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _T(
"")));
4578 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4580 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4581 _(
"Decimal Degrees"),
4582 _(
"Degrees, Minutes, Seconds")};
4583 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4585 new wxChoice(panelUnits, ID_SDMMFORMATCHOICE, wxDefaultPosition,
4586 wxDefaultSize, m_SDMMFormatsNChoices, pSDMMFormats);
4587 unitsSizer->Add(pSDMMFormat, inputFlags);
4590 unitsSizer->Add(0, border_size * 4);
4591 unitsSizer->Add(0, border_size * 4);
4594 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4597 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4598 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4601 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4602 _(
"Show true bearings and headings"));
4603 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4604 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4605 _(
"Show magnetic bearings and headings."));
4606 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4608 bearingsSizer->AddSpacer(10);
4611 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4612 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4614 itemStaticTextUserVar =
4615 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4616 itemStaticTextUserVar->SetLabel(
4617 _(
"WMM Plugin calculated magnetic variation"));
4619 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4620 group_item_spacing);
4622 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL, _T(
""),
4623 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4624 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4626 itemStaticTextUserVar2 =
4627 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4628 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4629 group_item_spacing);
4631 bearingsSizer->AddSpacer(10);
4633 wxStaticText* varText =
4634 new wxStaticText(panelUnits, wxID_ANY,
4635 _(
" To set the magnetic variation manually,\n you "
4636 "must disable the WMM plugin."));
4637 smallFont = *dialogFont;
4638 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4640 varText->SetFont(smallFont);
4642 bearingsSizer->Add(varText);
4649 OCPNSoundPanel( wxWindow *parent, wxWindowID
id,
const wxPoint &pos,
const wxSize &size,
4651 wxString checkLegend,
4652 wxString selectLegend,
4653 wxString *pSoundFile
4658 void OnButtonSelectSound(wxCommandEvent& event);
4659 void OnButtonTestSound(wxCommandEvent& event);
4660 wxString SelectSoundFile();
4661 void SetSoundFileLabel(wxString file);
4662 wxCheckBox *GetCheckBox(){
return m_pCheck_Sound; }
4664 wxCheckBox *m_pCheck_Sound;
4665 wxSize m_small_button_size;
4666 wxString m_sound_file;
4667 wxString *m_pSoundFile;
4668 wxStaticText *m_AudioFileNameText;
4671 wxButton* TestSound;
4673 DECLARE_EVENT_TABLE()
4676#define ID_SELECTSOUND 9341
4677#define ID_TESTSOUND 9342
4681EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4682EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonTestSound)
4689 wxString checkLegend,
4690 wxString selectLegend,
4691 wxString *pSoundFile)
4692:wxPanel(parent,
id, pos, size, wxBORDER_NONE)
4694 wxFont* pif = FontMgr::Get().GetFont(_T(
"Dialog"));
4697 m_pSoundFile = pSoundFile;
4699 m_sound_file = *pSoundFile;
4701 int border_size = 4;
4702 int group_item_spacing = 2;
4704 int font_size_y, font_descent, font_lead;
4705 GetTextExtent(_T(
"0"), NULL, &font_size_y, &font_descent, &font_lead);
4706 m_small_button_size =
4707 wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4710 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4711 SetSizer(wrapperSizer);
4713 wxStaticBox* StaticBox1 =
4714 new wxStaticBox(
this, wxID_ANY, title);
4715 wxStaticBoxSizer* StaticBoxSizer1 =
4716 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4717 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4719 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO,
4721 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4724 wxString LabelWrapped;
4726#ifdef __OCPN__ANDROID__
4730 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4731 for (
unsigned int i=0 ; i < LabelWrappedArray.GetCount() ; i++){
4732 LabelWrapped +=
"\n";
4734 LabelWrapped +=
"\n";
4737 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4738 m_AudioFileNameText->Wrap(-1);
4739 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4741 SetSoundFileLabel(m_sound_file);
4744 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4745 soundSizer1->SetHGap(border_size * 2);
4746 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4748 SelSound =
new wxButton(
4749 this, ID_SELECTSOUND, selectLegend,
4750 wxDefaultPosition, m_small_button_size, 0);
4751 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT,
4752 group_item_spacing);
4753 soundSizer1->AddSpacer(group_item_spacing * 4);
4754 TestSound =
new wxButton(
4755 this, ID_TESTSOUND, _(
"Test"),
4756 wxDefaultPosition, m_small_button_size, 0);
4757 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT,
4758 group_item_spacing);
4762void OCPNSoundPanel::SetSoundFileLabel(wxString file)
4764 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " +
4768 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4769 wxString LabelWrapped;
4770 for (
unsigned int i=0 ; i < LabelWrappedArray.GetCount() ; i++){
4772 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4774 LabelWrapped += LabelWrappedArray[i];
4775 LabelWrapped +=
"\n";
4778 m_AudioFileNameText->SetLabel(LabelWrapped);
4784wxString OCPNSoundPanel::SelectSoundFile() {
4785 wxString sound_dir = g_Platform->GetSharedDataDir();
4786 sound_dir.Append(_T(
"sounds"));
4790#ifndef __OCPN__ANDROID__
4791 wxFileDialog* popenDialog =
new wxFileDialog(
4792 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4793 _T(
"WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN);
4795 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
4797 response = popenDialog->ShowModal();
4798 sel_file = popenDialog->GetPath();
4803 g_Platform->DoFileSelectorDialog(
this, &sel_file, _(
"Select Sound File"),
4804 sound_dir, wxEmptyString, wxT(
"*.*"));
4808 if (response == wxID_OK)
4809 return g_Platform->NormalizePath(sel_file);
4814void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4815 wxString sel_file = SelectSoundFile();
4817 if (!sel_file.IsEmpty()) {
4818 m_sound_file = g_Platform->NormalizePath(sel_file);
4820 *m_pSoundFile = m_sound_file;
4822 SetSoundFileLabel(m_sound_file);
4827void OCPNSoundPanel::OnButtonTestSound(wxCommandEvent& event) {
4828 auto sound = SoundFactory();
4829 auto cmd_sound =
dynamic_cast<SystemCmdSound*
>(sound);
4830 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
4831 sound->SetFinishedCallback([sound](
void*) {
delete sound; });
4832 sound->Load(m_sound_file, g_iSoundDeviceIndex);
4841void options::CreatePanel_Sounds(
size_t parent,
int border_size,
4842 int group_item_spacing) {
4844 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
4846 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4847 panelSounds->SetSizer(wrapperSizer);
4851 wxDefaultPosition, wxDefaultSize,
4853 _(
"Play Sound on Anchor Alarm."),
4854 _(
"Select Anchor Alarm Sound"),
4855 &g_anchorwatch_sound_file
4857 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
4862 wxDefaultPosition, wxDefaultSize,
4864 _(
"Play Sound on AIS Alert."),
4865 _(
"Select AIS Alert Sound"),
4868 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
4873 wxDefaultPosition, wxDefaultSize,
4875 _(
"Play Sound on AIS SART Alert."),
4876 _(
"Select AIS SART Alert Sound"),
4879 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
4883 wxDefaultPosition, wxDefaultSize,
4885 _(
"Play Sound on DSC notification."),
4886 _(
"Select DSC notification Sound"),
4889 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
4892void options::CreatePanel_MMSI(
size_t parent,
int border_size,
4893 int group_item_spacing) {
4894 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
4896 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
4897 panelMMSI->SetSizer(MMSISizer);
4900 wxStaticBox* itemStaticBoxMMSI =
4901 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
4902 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
4903 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
4904 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
4908 pPropsPanel->UpdateMMSIList();
4910 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
4912 panelMMSI->Layout();
4915void options::CreatePanel_AIS(
size_t parent,
int border_size,
4916 int group_item_spacing) {
4917 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
4919 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
4920 panelAIS->SetSizer(aisSizer);
4923 wxStaticBox* itemStaticBoxCPA =
4924 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
4925 wxStaticBoxSizer* itemStaticBoxSizerCPA =
4926 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
4927 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
4929 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
4930 pCPAGrid->AddGrowableCol(1);
4931 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
4933 m_pCheck_CPA_Max =
new wxCheckBox(
4935 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
4936 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
4938 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
4939 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4942 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
4943 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
4946 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
4947 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4949 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
4950 wxCommandEventHandler(options::OnCPAWarnClick),
4953 m_pCheck_CPA_WarnT =
4954 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
4955 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
4957 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
4958 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
4959 group_item_spacing);
4962 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
4963 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
4964 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
4966 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
4967 pLostGrid->AddGrowableCol(1);
4968 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
4970 m_pCheck_Mark_Lost =
4971 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
4972 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
4974 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
4975 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
4976 group_item_spacing);
4978 m_pCheck_Remove_Lost =
4979 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
4980 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
4982 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
4983 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
4984 group_item_spacing);
4986 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
4989 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
4990 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
4991 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
4993 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
4994 pDisplayGrid->AddGrowableCol(1);
4995 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
4997 m_pCheck_Show_COG =
new wxCheckBox(
4998 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
4999 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5001 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5002 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5003 group_item_spacing);
5005 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5006 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5007 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5008 m_pCheck_Sync_OCOG_ACOG->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5009 wxCommandEventHandler(options::OnSyncCogPredClick),
5012 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1, _T(
""));
5013 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5015 m_pCheck_Show_Tracks =
5016 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5017 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5019 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5020 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5021 group_item_spacing);
5023 m_pCheck_Hide_Moored =
new wxCheckBox(
5024 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5025 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5027 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5028 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5029 group_item_spacing);
5031 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5032 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5033 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5034 group_item_spacing);
5036 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5037 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5038 group_item_spacing);
5040 m_pCheck_Scale_Priority =
new wxCheckBox(
5042 _(
"Allow attenuation of less critical targets if more than ... targets"));
5043 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5045 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5046 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5047 group_item_spacing);
5049 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5050 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5051 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5053 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1, _T(
""));
5054 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5056 m_pCheck_Draw_Target_Size =
5057 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5058 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5060 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1, _T(
""));
5061 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5063 m_pCheck_Show_Target_Name =
new wxCheckBox(
5064 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5065 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5067 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5068 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5069 group_item_spacing);
5071 m_pCheck_use_Wpl =
new wxCheckBox(
5072 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5073 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5075 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5076 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5077 wxDefaultSize, 2, Wpl_Action);
5078 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5081 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5082 wxStaticBoxSizer* rolloverSizer =
5083 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5084 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5086 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5087 _(
"Enable route/AIS info block"));
5088 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5090 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5091 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5095 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5096 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5098 m_pCheck_Rollover_Class =
5099 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5100 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5102 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5103 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5105 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5106 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5109 wxStaticBox* alertBox =
5110 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5111 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5112 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5114 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5115 pAlertGrid->AddGrowableCol(1);
5116 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5118 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5119 _(
"Show CPA/TCPA Alert Dialog"));
5120 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5122 m_pCheck_AlertDialog->Connect(
5123 wxEVT_COMMAND_CHECKBOX_CLICKED,
5124 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5133 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1, _T(
""));
5134 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5136 m_pCheck_AlertAudio =
new wxCheckBox(
5137 panelAIS, ID_AISALERTAUDIO,
5138 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5139 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5141 m_pCheck_AlertAudio->Connect(
5142 wxEVT_COMMAND_CHECKBOX_CLICKED,
5143 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5152 wxStaticText* pStatic_Dummy5b =
new wxStaticText(panelAIS, -1, _T(
""));
5153 pAlertGrid->Add(pStatic_Dummy5b, 1, wxALL, group_item_spacing);
5155 m_pCheck_Alert_Moored =
new wxCheckBox(
5156 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5157 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5159 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1, _T(
""));
5160 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5162 m_pCheck_Ack_Timout =
new wxCheckBox(
5163 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5164 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5166 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5167 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5168 group_item_spacing);
5176 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5179#ifdef __OCPN__ANDROID__
5180 GetHandle()->setStyleSheet(getQtStyleSheet());
5185void options::CreatePanel_UI(
size_t parent,
int border_size,
5186 int group_item_spacing) {
5187 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5189 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5190 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5192 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5193 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5195 wxStaticBox* itemLangStaticBox =
5196 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5197 wxStaticBoxSizer* itemLangStaticBoxSizer =
5198 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5200 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5202 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG);
5204 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5206#ifdef __OCPN__ANDROID__
5207 m_itemLangListBox->Disable();
5210 wxStaticBox* itemFontStaticBox =
5211 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5213 wxSize fontChoiceSize = wxSize(-1, -1);
5215 int fLayout = wxHORIZONTAL;
5216#ifdef __OCPN__ANDROID__
5218 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5221 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5224 wxStaticBoxSizer* itemFontStaticBoxSizer =
5225 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5226 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5229 m_itemFontElementListBox =
5230 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5231 fontChoiceSize, 0, NULL, wxCB_SORT);
5233 int nFonts = FontMgr::Get().GetNumFonts();
5234 for (
int it = 0; it < nFonts; it++) {
5235 const wxString& t = FontMgr::Get().GetDialogString(it);
5237 if (FontMgr::Get().GetConfigString(it).StartsWith(g_locale)) {
5238 m_itemFontElementListBox->Append(t);
5242 if (nFonts) m_itemFontElementListBox->SetSelection(0);
5244 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5246 wxButton* itemFontChooseButton =
5247 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5248 wxDefaultPosition, wxDefaultSize, 0);
5249 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5250#if defined(__WXGTK__) || defined(__WXQT__)
5251 wxButton* itemFontColorButton =
5252 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5253 wxDefaultPosition, wxDefaultSize, 0);
5254 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5256 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5257 wxDefaultPosition, wxDefaultSize, 0);
5258 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5263 wxStaticBox* itemStyleStaticBox =
5264 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5265 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5266 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5267 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5269 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5271 wxArrayPtrVoid styles = g_StyleManager->GetArrayOfStyles();
5272 for (
unsigned int i = 0; i < styles.Count(); i++) {
5274 m_itemStyleListBox->Append(style->name);
5276 m_itemStyleListBox->SetStringSelection(
5277 g_StyleManager->GetCurrentStyle()->name);
5278 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5281 wxStaticBox* miscOptionsBox =
5282 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5283 wxStaticBoxSizer* miscOptions =
5284 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5285 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5288 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5289 pShowStatusBar->SetValue(FALSE);
5290 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5293 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5294 pShowMenuBar->SetValue(FALSE);
5295 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5298#ifdef __OCPN__ANDROID__
5299 pShowMenuBar->Hide();
5302 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5303 pShowChartBar->SetValue(g_bShowChartBar);
5304 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5306 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5307 _(
"Show Compass/GPS Status Window"));
5308 pShowCompassWin->SetValue(FALSE);
5309 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5311 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5312 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5314 pToolbarAutoHideCB =
5315 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5316 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5319 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL, _T(
""), wxDefaultPosition,
5320 wxSize(50, -1), wxTE_RIGHT);
5321 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5323 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5324 group_item_spacing);
5326 wxBoxSizer* pShipsBellsSizer =
new wxBoxSizer(wxHORIZONTAL);
5327 miscOptions->Add(pShipsBellsSizer, 0, wxALL, group_item_spacing);
5330 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5331 pShipsBellsSizer->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5333#ifndef __OCPN__ANDROID__
5334 if (g_bUIexpert && (
bool)
dynamic_cast<SystemCmdSound*
>(SoundFactory())) {
5335 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
5336 pShipsBellsSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5338 new wxTextCtrl(itemPanelFont, wxID_ANY, _T(
"" ), wxDefaultPosition,
5339 wxSize(450, -1), wxTE_LEFT);
5341 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Audio Play command:")), 0,
5342 wxALIGN_CENTER_HORIZONTAL | wxALL);
5343 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
5347 auto sound = std::unique_ptr<OcpnSound>(SoundFactory());
5348 int deviceCount = sound->DeviceCount();
5349 wxLogMessage(
"options: got device count: %d", deviceCount);
5350 if (deviceCount >= 1) {
5351 wxArrayString labels;
5352 for (
int i = 0; i < deviceCount; i += 1) {
5353 wxString label(sound->GetDeviceInfo(i));
5355 std::ostringstream stm;
5357 label = _(
"Unknown device :") + stm.str();
5359 if (!sound->IsOutputDevice(i)) {
5360 std::ostringstream stm;
5362 label = _(
"Input device :") + stm.str();
5369 int iDefault = labels.Index(
"default");
5371 if (g_iSoundDeviceIndex == -1) {
5373 g_iSoundDeviceIndex = iDefault;
5375 g_iSoundDeviceIndex = 0;
5378 pSoundDeviceIndex =
new wxChoice();
5379 if (pSoundDeviceIndex) {
5380 pSoundDeviceIndex->Create(itemPanelFont, wxID_ANY, wxDefaultPosition,
5381 wxDefaultSize, labels);
5382 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
5383 pSoundDeviceIndex->Show();
5384 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
5385 miscOptions->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
5386 group_item_spacing);
5388 stSoundDeviceIndex =
5389 new wxStaticText(itemPanelFont, wxID_STATIC, _(
"Sound Device"));
5390 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
5391 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
5394#ifdef __OCPN__ANDROID__
5395 stSoundDeviceIndex->Hide();
5396 pSoundDeviceIndex->Hide();
5400 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5401 _(
"Enable Touchscreen interface"));
5402 miscOptions->Add(pMobile, 0, wxALL, border_size);
5404 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5405 _(
"Enable Scaled Graphics interface"));
5406 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5409#ifdef __OCPN__ANDROID__
5411 pResponsive->Hide();
5415 pResponsive->Hide();
5418 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5419 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5420#ifndef __OCPN__ANDROID__
5421 pZoomButtons->Hide();
5424 pInlandEcdis =
new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX,
5425 _(
"Use Inland ECDIS"));
5426 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5428 wxButton* itemEcdisHelp =
5429 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5430 wxDefaultPosition, wxDefaultSize, 0);
5431 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5433#ifdef __OCPN__ANDROID__
5434 pInlandEcdis->Hide();
5435 itemEcdisHelp->Hide();
5438 miscOptions->AddSpacer(10);
5440 wxFlexGridSizer* sliderSizer;
5441 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5442 sliderSizer->AddGrowableCol(1);
5443 sliderSizer->SetFlexibleDirection(wxBOTH);
5444 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5446 m_pSlider_GUI_Factor =
5447 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5448 m_sliderSize, SLIDER_STYLE);
5449 m_pSlider_GUI_Factor->Hide();
5450 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5451 _(
"User Interface scale factor")),
5453 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5454 m_pSlider_GUI_Factor->Show();
5456#ifdef __OCPN__ANDROID__
5457 prepareSlider(m_pSlider_GUI_Factor);
5460 m_pSlider_Chart_Factor =
5461 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5462 m_sliderSize, SLIDER_STYLE);
5463 m_pSlider_Chart_Factor->Hide();
5465 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5467 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5468 m_pSlider_Chart_Factor->Show();
5470#ifdef __OCPN__ANDROID__
5471 prepareSlider(m_pSlider_Chart_Factor);
5474 m_pSlider_Ship_Factor =
5475 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5476 m_sliderSize, SLIDER_STYLE);
5477 m_pSlider_Ship_Factor->Hide();
5479 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5481 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5482 m_pSlider_Ship_Factor->Show();
5484#ifdef __OCPN__ANDROID__
5485 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5488 m_pSlider_Text_Factor =
5489 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5490 m_sliderSize, SLIDER_STYLE);
5491 m_pSlider_Text_Factor->Hide();
5493 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5495 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5496 m_pSlider_Text_Factor->Show();
5498#ifdef __OCPN__ANDROID__
5499 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5502 m_pSlider_ENCText_Factor =
5503 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5504 m_sliderSize, SLIDER_STYLE);
5505 m_pSlider_ENCText_Factor->Hide();
5507 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5509 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5510 m_pSlider_ENCText_Factor->Show();
5512#ifdef __OCPN__ANDROID__
5513 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5517 new wxStaticText(itemPanelFont, wxID_ANY,
"Mouse wheel zoom sensitivity"),
5519 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5520 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5522 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5523 miscOptions->AddSpacer(20);
5526void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5527 if (event.IsChecked()) {
5528 m_pCheck_AlertAudio->Enable();
5529 m_soundPanelAIS->GetCheckBox()->Enable();
5530 m_soundPanelSART->GetCheckBox()->Enable();
5531 m_soundPanelDSC->GetCheckBox()->Enable();
5533 m_pCheck_AlertAudio->Disable();
5534 m_soundPanelAIS->GetCheckBox()->Disable();
5535 m_soundPanelSART->GetCheckBox()->Disable();
5536 m_soundPanelDSC->GetCheckBox()->Disable();
5540void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5541 if (event.IsChecked()) {
5542 m_soundPanelAIS->GetCheckBox()->Enable();
5543 m_soundPanelSART->GetCheckBox()->Enable();
5544 m_soundPanelDSC->GetCheckBox()->Enable();
5546 m_soundPanelAIS->GetCheckBox()->Disable();
5547 m_soundPanelSART->GetCheckBox()->Disable();
5548 m_soundPanelDSC->GetCheckBox()->Disable();
5552void options::CreateListbookIcons() {
5555 if (!g_bresponsive) {
5558 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5560#if wxCHECK_VERSION(2, 8, 12)
5561 m_topImgList->Add(style->GetIcon(_T(
"Display"), sx, sy));
5562 m_topImgList->Add(style->GetIcon(_T(
"Charts"), sx, sy));
5563 m_topImgList->Add(style->GetIcon(_T(
"Connections"), sx, sy));
5564 m_topImgList->Add(style->GetIcon(_T(
"Ship"), sx, sy));
5565 m_topImgList->Add(style->GetIcon(_T(
"UI"), sx, sy));
5566 m_topImgList->Add(style->GetIcon(_T(
"Plugins"), sx, sy));
5570 bmp = style->GetIcon(_T(
"Display"));
5571 img = bmp.ConvertToImage();
5572 img.ConvertAlphaToMask(128);
5573 bmp = wxBitmap(img);
5574 m_topImgList->Add(bmp);
5575 bmp = style->GetIcon(_T(
"Charts"));
5576 img = bmp.ConvertToImage();
5577 img.ConvertAlphaToMask(128);
5578 bmp = wxBitmap(img);
5579 m_topImgList->Add(bmp);
5580 bmp = style->GetIcon(_T(
"Connections"));
5581 img = bmp.ConvertToImage();
5582 img.ConvertAlphaToMask(128);
5583 bmp = wxBitmap(img);
5584 m_topImgList->Add(bmp);
5585 bmp = style->GetIcon(_T(
"Ship"));
5586 img = bmp.ConvertToImage();
5587 img.ConvertAlphaToMask(128);
5588 bmp = wxBitmap(img);
5589 m_topImgList->Add(bmp);
5590 bmp = style->GetIcon(_T(
"UI"));
5591 img = bmp.ConvertToImage();
5592 img.ConvertAlphaToMask(128);
5593 bmp = wxBitmap(img);
5594 m_topImgList->Add(bmp);
5595 bmp = style->GetIcon(_T(
"Plugins"));
5596 img = bmp.ConvertToImage();
5597 img.ConvertAlphaToMask(128);
5598 bmp = wxBitmap(img);
5599 m_topImgList->Add(bmp);
5603 bmps = style->GetIcon(_T(
"Display"));
5604 int base_size = bmps.GetWidth();
5605 double tool_size = base_size;
5607 double premult = 1.0;
5611 double target_size = 6.0;
5613 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5614 premult = target_size / basic_tool_size_mm;
5617 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5618 postmult = wxMin(postmult, 3.0);
5619 postmult = wxMax(postmult, 1.0);
5621 int sizeTab = base_size * postmult * premult;
5623 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5627 bmp = style->GetIcon(_T(
"Display"));
5628 img = bmp.ConvertToImage();
5629 simg = img.Scale(sizeTab, sizeTab);
5630 bmp = wxBitmap(simg);
5631 m_topImgList->Add(bmp);
5632 bmp = style->GetIcon(_T(
"Charts"));
5633 img = bmp.ConvertToImage();
5634 simg = img.Scale(sizeTab, sizeTab);
5635 bmp = wxBitmap(simg);
5636 m_topImgList->Add(bmp);
5637 bmp = style->GetIcon(_T(
"Connections"));
5638 img = bmp.ConvertToImage();
5639 simg = img.Scale(sizeTab, sizeTab);
5640 bmp = wxBitmap(simg);
5641 m_topImgList->Add(bmp);
5642 bmp = style->GetIcon(_T(
"Ship"));
5643 img = bmp.ConvertToImage();
5644 simg = img.Scale(sizeTab, sizeTab);
5645 bmp = wxBitmap(simg);
5646 m_topImgList->Add(bmp);
5647 bmp = style->GetIcon(_T(
"UI"));
5648 img = bmp.ConvertToImage();
5649 simg = img.Scale(sizeTab, sizeTab);
5650 bmp = wxBitmap(simg);
5651 m_topImgList->Add(bmp);
5652 bmp = style->GetIcon(_T(
"Plugins"));
5653 img = bmp.ConvertToImage();
5654 simg = img.Scale(sizeTab, sizeTab);
5655 bmp = wxBitmap(simg);
5656 m_topImgList->Add(bmp);
5660void options::CreateControls(
void) {
5661 int border_size = 4;
5663 int group_item_spacing = 2;
5665 int font_size_y, font_descent, font_lead;
5666 GetTextExtent(_T(
"0"), NULL, &font_size_y, &font_descent, &font_lead);
5667 m_fontHeight = font_size_y + font_descent + font_lead;
5669#ifdef __OCPN__ANDROID__
5671 wxSize(wxMin(m_fontHeight * 8, g_Platform->getDisplaySize().x / 2),
5672 m_fontHeight * 8 / 10);
5675 wxSize(wxMin(m_fontHeight * 8, g_Platform->getDisplaySize().x / 2),
5679 m_small_button_size =
5680 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5682 m_nCharWidthMax = GetSize().x / GetCharWidth();
5685 pEnableZoomToCursor = NULL;
5686 pSmoothPanZoom = NULL;
5691 ::wxDisplaySize(&width, &height);
5693 if (!g_bresponsive && height <= 800) {
5695 group_item_spacing = 1;
5699 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
5700 inputFlags = wxSizerFlags(0)
5701 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
5702 .Border(wxALL, group_item_spacing);
5703 verticleInputFlags =
5704 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
5705 groupLabelFlags = wxSizerFlags(0)
5706 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
5707 .Border(wxALL, group_item_spacing);
5708 groupLabelFlagsHoriz =
5709 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
5710 groupInputFlags = wxSizerFlags(0)
5711 .Align(wxALIGN_LEFT | wxALIGN_TOP)
5712 .Border(wxBOTTOM, group_item_spacing * 2)
5716 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
5721 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
5722 itemDialog1->SetSizer(itemBoxSizer2);
5724#ifdef __OCPN__ANDROID__
5726 wxFont* qFont = dialogFont;
5728 wxString wqs = getFontQtStylesheet(qFont);
5729 wxCharBuffer sbuf = wqs.ToUTF8();
5730 QString qsb = QString(sbuf.data());
5732 QString qsbq = getQtStyleSheet();
5734 itemDialog1->GetHandle()->setStyleSheet(qsb +
5741#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5743 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
5744 wxSize(-1, -1), flags);
5745 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
5746 wxListbookEventHandler(options::OnPageChange), NULL,
5750 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
5751 wxSize(-1, -1), flags);
5752 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5753 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
5757#ifdef __OCPN__ANDROID__
5760 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
5764 CreateListbookIcons();
5766 m_pListbook->SetImageList(m_topImgList);
5767 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
5769 wxBoxSizer* buttons =
new wxBoxSizer(wxHORIZONTAL);
5770 itemBoxSizer2->Add(buttons, 0, wxALIGN_RIGHT | wxALL, border_size);
5772 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"OK"));
5773 m_OKButton->SetDefault();
5774 buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5776 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
5777 buttons->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5779 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
5780 buttons->Add(m_ApplyButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
5782 m_pageDisplay = CreatePanel(_(
"Display"));
5783 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
5784 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
5785 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
5786 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
5788 m_pageCharts = CreatePanel(_(
"Charts"));
5789 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
5790 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
5792 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
5794 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
5797 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
5799#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5800 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5801 wxListbookEventHandler(options::OnChartsPageChange), NULL,
5804 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
5805 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
5811 wxString ConnTab = _(
"Connections");
5812 if (g_Platform->GetDisplayDIPMult(gFrame) < 1)
5813 ConnTab = _(
"Connect");
5815 m_pageConnections = CreatePanel(ConnTab);
5816#ifndef __OCPN__ANDROID__
5817 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
5819 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
5825 m_pageShips = CreatePanel(_(
"Ships"));
5826 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
5827 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
5828#ifndef __OCPN__ANDROID__
5829 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
5832 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
5834 wxString UITab = _(
"User Interface");
5835 if (g_Platform->GetDisplayDIPMult(gFrame) < 1)
5838 m_pageUI = CreatePanel(UITab);
5839 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
5840 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
5842 m_pagePlugins = CreatePanel(_(
"Plugins"));
5843 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
5845 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
5846 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
5849 if (g_pi_manager) g_pi_manager->NotifySetupOptions();
5851 SetColorScheme(
static_cast<ColorScheme
>(0));
5862 SetSizeHints(-1, -1, width - marginx, height - marginy);
5866 vectorPanel->SetSizeHints(ps57Ctl);
5869void options::SetInitialPage(
int page_sel,
int sub_page) {
5870 if (page_sel < (
int)m_pListbook->GetPageCount())
5871 m_pListbook->SetSelection(page_sel);
5873 m_pListbook->SetSelection(0);
5875 if (sub_page >= 0) {
5876 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
5877 wxNotebookPage* pg = m_pListbook->GetPage(i);
5878 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
5880 if (i == (
size_t)page_sel) {
5881 if (sub_page < (
int)nb->GetPageCount())
5882 nb->SetSelection(sub_page);
5884 nb->SetSelection(0);
5886 nb->ChangeSelection(0);
5892void options::SetColorScheme(ColorScheme cs) {
5895#ifdef __OCPN__OPTIONS_USE_LISTBOOK__
5896 wxListView* lv = m_pListbook->GetListView();
5897 lv->SetBackgroundColour(GetBackgroundColour());
5900 delete m_topImgList;
5901 CreateListbookIcons();
5902 m_pListbook->SetImageList(m_topImgList);
5910void options::OnAISRolloverClick(wxCommandEvent& event) {
5911 m_pCheck_Rollover_Class->Enable(event.IsChecked());
5912 m_pCheck_Rollover_COG->Enable(event.IsChecked());
5913 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
5914 pStatic_CallSign->Enable(event.IsChecked());
5917void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
5919 case ID_SCREENCONFIG1:
5920 if (m_sconfigSelect_twovertical)
5921 m_sconfigSelect_twovertical->SetSelected(
false);
5925 case ID_SCREENCONFIG2:
5926 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
5932void options::SetInitialSettings(
void) {
5935 m_returnChanges = 0;
5936 m_bfontChanged =
false;
5938 b_oldhaveWMM = b_haveWMM;
5939 auto loader = PluginLoader::getInstance();
5940 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
5943 switch (g_canvasConfig) {
5946 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
5947 if (m_sconfigSelect_twovertical)
5948 m_sconfigSelect_twovertical->SetSelected(
false);
5951 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
5952 if (m_sconfigSelect_twovertical)
5953 m_sconfigSelect_twovertical->SetSelected(
true);
5956 m_screenConfig = g_canvasConfig;
5960 ActiveChartArray.Clear();
5961 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
5962 ActiveChartArray.Add(m_CurrentDirList[i]);
5966 if (m_pWorkDirList) {
5967 UpdateWorkArrayFromDisplayPanel();
5968 groupsPanel->SetDBDirs(*m_pWorkDirList);
5971 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
5972 delete m_pGroupArray;
5973 m_pGroupArray = groupsPanel->CloneChartGroupArray(g_pGroupArray);
5974 groupsPanel->SetGroupArray(m_pGroupArray);
5975 groupsPanel->SetInitialSettings();
5979 pShowStatusBar->SetValue(g_bShowStatusBar);
5981 pShowMenuBar->SetValue(g_bShowMenuBar);
5983 pShowCompassWin->SetValue(g_bShowCompassWin);
5986 s.Printf(_T(
"%d"), g_COGAvgSec);
5987 pCOGUPUpdateSecs->SetValue(s);
5989 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
5990 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
5992 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
5993 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
5994 pMobile->SetValue(g_btouch);
5995 pResponsive->SetValue(g_bresponsive);
5996 pRollover->SetValue(g_bRollover);
5997 m_pCheck_Rollover_Class->Enable(g_bRollover);
5998 m_pCheck_Rollover_COG->Enable(g_bRollover);
5999 m_pCheck_Rollover_CPA->Enable(g_bRollover);
6000 pStatic_CallSign->Enable(g_bRollover);
6002 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6006 pInlandEcdis->SetValue(g_bInlandEcdis);
6007 pOpenGL->SetValue(g_bopengl);
6008 if (pSmoothPanZoom) pSmoothPanZoom->SetValue(g_bsmoothpanzoom);
6009 pCBTrueShow->SetValue(g_bShowTrue);
6010 pCBMagShow->SetValue(g_bShowMag);
6012 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6016 itemStaticTextUserVar->SetLabel(
6017 _(
"WMM Plugin calculated magnetic variation"));
6019 s.Printf(_T(
"%4.1f"), gVar);
6020 pMagVar->SetValue(s);
6022 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6024 s.Printf(_T(
"%4.1f"), g_UserVar);
6025 pMagVar->SetValue(s);
6028 int newLength = itemStaticTextUserVar->GetLabel().Length();
6031 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6032 wxSize sz = GetSize();
6033 SetSize(sz.x + 1, sz.y);
6037 itemStaticTextUserVar2->Enable(!b_haveWMM);
6038 pMagVar->Enable(!b_haveWMM);
6040 if (pSDisplayGrid) pSDisplayGrid->SetValue(g_bDisplayGrid);
6045 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6049 wxString stringDefaultBoatSpeed;
6050 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6051 g_defaultBoatSpeed = 6.0;
6052 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6054 stringDefaultBoatSpeed.Printf(_T(
"%d"), (
int)g_defaultBoatSpeedUserUnit);
6055 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6059 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6060 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6061 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6063 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6065 s.Printf(_T(
"%6.2f"), g_ownship_predictor_minutes);
6067 s.Printf(_T(
"%4.0f"), g_ownship_predictor_minutes);
6068 m_pText_OSCOG_Predictor->SetValue(s);
6070 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6071 g_ownship_HDTpredictor_miles) > 1e-4)
6072 s.Printf(_T(
"%6.2f"), g_ownship_HDTpredictor_miles);
6074 s.Printf(_T(
"%4.0f"), g_ownship_HDTpredictor_miles);
6075 m_pText_OSHDT_Predictor->SetValue(s);
6077 m_pShipIconType->SetSelection(g_OwnShipIconType);
6078 wxCommandEvent eDummy;
6079 OnShipTypeSelect(eDummy);
6080 m_pOSLength->SetValue(
6081 wxString::Format(_T(
"%.1f"), g_n_ownship_length_meters));
6082 m_pOSWidth->SetValue(wxString::Format(_T(
"%.1f"), g_n_ownship_beam_meters));
6083 m_pOSGPSOffsetX->SetValue(
6084 wxString::Format(_T(
"%.1f"), g_n_gps_antenna_offset_x));
6085 m_pOSGPSOffsetY->SetValue(
6086 wxString::Format(_T(
"%.1f"), g_n_gps_antenna_offset_y));
6087 m_pOSMinSize->SetValue(wxString::Format(_T(
"%d"), g_n_ownship_min_mm));
6088 m_pText_ACRadius->SetValue(
6089 wxString::Format(_T(
"%.3f"), g_n_arrival_circle_radius));
6092 if (g_iNavAidRadarRingsNumberVisible > 10)
6093 g_iNavAidRadarRingsNumberVisible = 10;
6094 pNavAidRadarRingsNumberVisible->SetSelection(
6095 g_iNavAidRadarRingsNumberVisible);
6096 buf.Printf(_T(
"%.3f"), g_fNavAidRadarRingsStep);
6097 pNavAidRadarRingsStep->SetValue(buf);
6098 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6099 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6101 pScaMinChckB->SetValue(g_bUseWptScaMin);
6102 m_pText_ScaMin->SetValue(wxString::Format(_T(
"%i"), g_iWpt_ScaMin));
6103 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6105 OnRadarringSelect(eDummy);
6107 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6108 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6109 buf.Printf(_T(
"%.3f"), g_fWaypointRangeRingsStep);
6110 pWaypointRangeRingsStep->SetValue(buf);
6111 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6112 m_colourWaypointRangeRingsColour->SetColour(g_colourWaypointRangeRingsColour);
6113 OnWaypointRangeRingSelect(eDummy);
6114 pShowshipToActive->SetValue(g_bShowShipToActive);
6115 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6116 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6118 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6119 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6121 pSogCogFromLLCheckBox->SetValue(g_own_ship_sog_cog_calc);
6122 pSogCogFromLLDampInterval->SetValue(g_own_ship_sog_cog_calc_damp_sec);
6124 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6126 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6127 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6129 if (g_bUIexpert && pCmdSoundString)
6130 pCmdSoundString->SetValue(g_CmdSoundString);
6132 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6135 pSDMMFormat->Select(g_iSDMMFormat);
6136 pDistanceFormat->Select(g_iDistanceFormat);
6137 pSpeedFormat->Select(g_iSpeedFormat);
6138 pTempFormat->Select(g_iTempFormat);
6140 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6141 g_bAdvanceRouteWaypointOnArrivalOnly);
6143 pTrackDaily->SetValue(g_bTrackDaily);
6144 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6145 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6146 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6147 TIME_TYPE_COMPUTER);
6148 pTrackHighlite->SetValue(g_bHighliteTracks);
6149 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6150 pTrackPrecision->SetSelection(g_nTrackPrecision);
6152 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6156 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6158 s.Printf(_T(
"%4.1f"), g_CPAMax_NM);
6159 m_pText_CPA_Max->SetValue(s);
6161 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6163 s.Printf(_T(
"%4.1f"), g_CPAWarn_NM);
6164 m_pText_CPA_Warn->SetValue(s);
6166 if (m_pCheck_CPA_Warn->GetValue()) {
6167 m_pCheck_CPA_WarnT->Enable();
6168 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6170 m_pCheck_CPA_WarnT->Disable();
6172 s.Printf(_T(
"%4.0f"), g_TCPA_Max);
6173 m_pText_CPA_WarnT->SetValue(s);
6176 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6178 s.Printf(_T(
"%4.0f"), g_MarkLost_Mins);
6179 m_pText_Mark_Lost->SetValue(s);
6181 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6183 s.Printf(_T(
"%4.0f"), g_RemoveLost_Mins);
6184 m_pText_Remove_Lost->SetValue(s);
6187 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6189 s.Printf(_T(
"%4.0f"), g_ShowCOG_Mins);
6190 m_pText_COG_Predictor->SetValue(s);
6192 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6193 if(g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6195 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6197 s.Printf(_T(
"%4.0f"), g_AISShowTracks_Mins);
6198 m_pText_Track_Length->SetValue(s);
6200 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6202 s.Printf(_T(
"%4.1f"), g_ShowMoored_Kts);
6203 m_pText_Moored_Speed->SetValue(s);
6205 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6207 s.Printf(_T(
"%4.1f"), g_AIS_RealtPred_Kts);
6208 m_pText_RealtPred_Speed->SetValue(s);
6210 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6212 s.Printf(_T(
"%i"), g_ShowScaled_Num);
6213 m_pText_Scale_Priority->SetValue(s);
6215 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6217 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6218 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6220 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6222 s.Printf(_T(
"%d"), g_Show_Target_Name_Scale);
6223 m_pText_Show_Target_Name_Scale->SetValue(s);
6225 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6226 m_pWplAction->SetSelection(g_WplAction);
6229 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6230 if (m_pCheck_AlertDialog->GetValue()) {
6231 m_pCheck_AlertAudio->Enable();
6232 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6234 m_pCheck_AlertAudio->Disable();
6235 m_pCheck_AlertAudio->SetValue(
false);
6238 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6240 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6241 s.Printf(_T(
"%4.0f"), g_AckTimeout_Mins);
6242 m_pText_ACK_Timeout->SetValue(s);
6245 if (m_pCheck_AlertDialog
6248 m_soundPanelAIS->GetCheckBox()->Enable(m_pCheck_AlertAudio->GetValue());
6249 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6250 m_soundPanelSART->GetCheckBox()->Enable(m_pCheck_AlertAudio->GetValue());
6251 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6252 m_soundPanelDSC->GetCheckBox()->Enable(m_pCheck_AlertAudio->GetValue());
6253 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6255 m_soundPanelAIS->GetCheckBox()->Disable();
6256 m_soundPanelAIS->GetCheckBox()->SetValue(
false);
6257 m_soundPanelSART->GetCheckBox()->Disable();
6258 m_soundPanelSART->GetCheckBox()->SetValue(
false);
6259 m_soundPanelDSC->GetCheckBox()->Disable();
6260 m_soundPanelDSC->GetCheckBox()->SetValue(
false);
6264 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6265 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6266 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6268 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6269 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6271 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6272 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6273 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6274 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6275 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6276 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6279 if (!g_config_display_size_manual) {
6280 pRBSizeAuto->SetValue(TRUE);
6281 screenmm.Printf(_T(
"%d"),
int(g_Platform->GetDisplaySizeMM()));
6282 pScreenMM->Disable();
6284 screenmm.Printf(_T(
"%d"),
int(g_config_display_size_mm));
6285 pRBSizeManual->SetValue(TRUE);
6288 pScreenMM->SetValue(screenmm);
6291 pDepthUnitSelect->SetSelection(g_nDepthUnitDisplay);
6292 UpdateOptionsUnits();
6294 SetInitialVectorSettings();
6296 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6298 s.Printf(_T(
"%d"), g_nAutoHideToolbar);
6299 pToolbarHideSecs->SetValue(s);
6304 delete m_pSerialArray;
6305 m_pSerialArray = NULL;
6306 m_pSerialArray = EnumerateSerialPorts();
6308 comm_dialog->SetInitialSettings();
6310 m_bForceNewToolbaronCancel =
false;
6313void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6314 if (ps57CtlListBox) {
6316 ps57CtlListBox->Clear();
6317 marinersStdXref.clear();
6319 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6321 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6324 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6325 item = ps52plib->OBJLDescriptions[iPtr];
6327 item = wxString(pOLE->OBJLName, wxConvUTF8);
6333 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6334 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6335 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6337 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6338 (catl == DISPLAYBASE))
6340 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6343 bool benable =
true;
6344 if (cat > 0) benable = cat != DISPLAYBASE;
6349 int newpos = ps57CtlListBox->Append(item, benable);
6350 marinersStdXref.push_back(newpos);
6351 for (
size_t i = 0; i < iPtr; i++) {
6352 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6356 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6358 if (cat == DISPLAYBASE) bviz =
true;
6361 if (cat == STANDARD) {
6366 ps57CtlListBox->Check(newpos, bviz);
6369 wxSize s = ps57CtlListBox->GetSize();
6370 ps57CtlListBox->SetSize(s.x, s.y - 1);
6374void options::SetInitialVectorSettings(
void) {
6375 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6379 m_bVectorInit =
true;
6380 resetMarStdList(
true,
false);
6382#ifdef __OCPN__ANDROID__
6383 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6387 switch (ps52plib->GetDisplayCategory()) {
6397 case (MARINERS_STANDARD):
6405 if (pDispCat) pDispCat->SetSelection(nset);
6409 bool benableMarStd =
false;
6411 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); i++) {
6414 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD)
6415 benableMarStd =
true;
6422 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6423 itemButtonClearList->Enable(benableMarStd);
6424 itemButtonSelectList->Enable(benableMarStd);
6425 itemButtonSetStd->Enable(benableMarStd);
6428 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6429 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6430 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6431 if (pCheck_XLSECTTEXT)
6432 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6434 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6435 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6436 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6437 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6439 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6440 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6443 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6444 pPointStyle->SetSelection(0);
6446 pPointStyle->SetSelection(1);
6448 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6449 pBoundStyle->SetSelection(0);
6451 pBoundStyle->SetSelection(1);
6453 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6454 p24Color->SetSelection(0);
6456 p24Color->SetSelection(1);
6458 UpdateOptionsUnits();
6462void options::UpdateOptionsUnits(
void) {
6463 int depthUnit = pDepthUnitSelect->GetSelection();
6465 depthUnit = wxMax(depthUnit, 0);
6466 depthUnit = wxMin(depthUnit, 2);
6472 else if (depthUnit == 2)
6478 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6479 wxString depthUnitString = depthUnitStrings[depthUnit];
6480 m_depthUnitsShal->SetLabel(depthUnitString);
6481 m_depthUnitsSafe->SetLabel(depthUnitString);
6482 m_depthUnitsDeep->SetLabel(depthUnitString);
6485 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6487 m_ShallowCtl->SetValue(s);
6489 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6491 m_SafetyCtl->SetValue(s);
6493 s.Printf(_T(
"%6.2f" ), S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6495 m_DeepCtl->SetValue(s);
6525void options::OnSizeAutoButton(wxCommandEvent& event) {
6526 wxString screenmm = wxString::Format(
6527 _T(
"%d" ),
static_cast<int>(g_Platform->GetDisplaySizeMM()));
6528 pScreenMM->SetValue(screenmm);
6529 pScreenMM->Disable();
6530 g_config_display_size_manual = FALSE;
6533void options::OnSizeManualButton(wxCommandEvent& event) {
6534 wxString screenmm = wxString::Format(
6535 _T(
"%d" ),
static_cast<int>(g_config_display_size_mm > 0
6536 ? g_config_display_size_mm
6537 : g_Platform->GetDisplaySizeMM()));
6538 pScreenMM->SetValue(screenmm);
6539 pScreenMM->Enable();
6540 g_config_display_size_manual = TRUE;
6543void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6545void options::OnCPAWarnClick(wxCommandEvent& event) {
6546 if (m_pCheck_CPA_Warn->GetValue()) {
6547 m_pCheck_CPA_WarnT->Enable();
6549 m_pCheck_CPA_WarnT->SetValue(FALSE);
6550 m_pCheck_CPA_WarnT->Disable();
6554void options::OnSyncCogPredClick(wxCommandEvent &event) {
6555 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6556 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6557 m_pText_COG_Predictor->Disable();
6561 s.Printf(_T(
"%4.0f"), g_ShowCOG_Mins);
6562 m_pText_COG_Predictor->SetValue(s);
6563 m_pText_COG_Predictor->Enable();
6567void options::OnShipTypeSelect(wxCommandEvent& event) {
6568 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6569 dispOptions->Layout();
6571 itemPanelShip->Layout();
6572 itemPanelShip->Refresh();
6576void options::OnRadarringSelect(wxCommandEvent& event) {
6577 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6578 dispOptions->Layout();
6580 itemPanelShip->Layout();
6581 itemPanelShip->Refresh();
6585void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6586 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6587 dispOptions->Layout();
6589 itemPanelRoutes->Layout();
6590 itemPanelRoutes->Refresh();
6594void options::OnGLClicked(wxCommandEvent& event) {
6599void options::OnOpenGLOptions(wxCommandEvent& event) {
6601 OpenGLOptionsDlg dlg(
this);
6603 if (dlg.ShowModal() == wxID_OK) {
6604 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6605 g_GLOptions.m_bUseAcceleratedPanning = g_bGLexpert
6606 ? dlg.GetAcceleratedPanning()
6607 : gFrame->GetPrimaryCanvas()
6609 ->CanAcceleratePanning();
6612 g_bShowFPS = dlg.GetShowFPS();
6613 g_bSoftwareGL = dlg.GetSoftwareGL();
6615 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6616 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6620 g_GLOptions.m_bTextureCompressionCaching =
6621 dlg.GetTextureCompressionCaching();
6622 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6625 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6628 if (g_bopengl && g_glTextureManager &&
6629 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6631 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6633 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6634 ::wxBeginBusyCursor();
6635 gFrame->GetPrimaryCanvas()->GetglCanvas()->SetupCompression();
6636 g_glTextureManager->ClearAllRasterTextures();
6637 ::wxEndBusyCursor();
6640 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6643 if (dlg.GetRebuildCache()) {
6644 m_returnChanges = REBUILD_RASTER_CACHE;
6650void options::OnChartDirListSelect(wxCommandEvent& event) {
6652 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6653 m_removeBtn->Enable(selected);
6654 if (m_compressBtn) m_compressBtn->Enable(selected);
6658void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6661 const bool select = pDispCat->GetSelection() == 3;
6662 ps57CtlListBox->Enable(select);
6663 itemButtonClearList->Enable(select);
6664 itemButtonSelectList->Enable(select);
6665 itemButtonSetStd->Enable(select);
6671void options::OnButtonClearClick(wxCommandEvent& event) {
6672 resetMarStdList(
false,
false);
6681void options::OnButtonSelectClick(wxCommandEvent& event) {
6682 int nOBJL = ps57CtlListBox->GetCount();
6683 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
6688void options::OnButtonSetStd(wxCommandEvent& event) {
6689 resetMarStdList(
false,
true);
6694bool options::ShowToolTips(
void) {
return TRUE; }
6696void options::OnCharHook(wxKeyEvent& event) {
6697 if (event.GetKeyCode() == WXK_RETURN &&
6698 event.GetModifiers() == wxMOD_CONTROL) {
6699 wxCommandEvent okEvent;
6700 okEvent.SetId(xID_OK);
6701 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
6702 GetEventHandler()->AddPendingEvent(okEvent);
6707void options::OnButtonaddClick(wxCommandEvent& event) {
6709 int dresult = g_Platform->DoDirSelectorDialog(
6710 this, &selDir, _(
"Add a directory containing chart files"),
6711 *pInit_Chart_Dir,
false);
6713 if (dresult != wxID_CANCEL) AddChartDir(selDir);
6718void options::AddChartDir(
const wxString& dir) {
6719 wxFileName dirname = wxFileName(dir);
6720 pInit_Chart_Dir->Empty();
6725 f.MakeRelativeTo(g_Platform->GetHomeDir());
6726 dirAdd = f.GetFullPath();
6728 pInit_Chart_Dir->Append(dirname.GetPath());
6733 cdi.fullpath = dirAdd;
6734 ActiveChartArray.Add(cdi);
6736 UpdateChartDirList();
6738 k_charts |= CHANGE_CHARTS;
6740 pScanCheckBox->Disable();
6743void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
6746 ActiveChartArray.Clear();
6747 for (
size_t i = 0; i < p.GetCount(); i++) {
6748 ActiveChartArray.Add(p[i]);
6751 UpdateChartDirList();
6754void options::UpdateWorkArrayFromDisplayPanel(
void) {
6756 int n = ActiveChartArray.GetCount();
6757 if (m_pWorkDirList) {
6758 m_pWorkDirList->Clear();
6759 for (
int i = 0; i < n; i++) {
6760 dirname = ActiveChartArray[i].fullpath;
6761 if (!dirname.IsEmpty()) {
6764 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
6765 (dirname.Last() == wxChar(_T(
'\r'))))
6766 dirname.RemoveLast();
6772 bool b_added = FALSE;
6775 int nDir = m_CurrentDirList.GetCount();
6777 for (
int i = 0; i < nDir; i++) {
6778 if (m_CurrentDirList[i].fullpath == dirname) {
6780 m_pWorkDirList->Add(cdi);
6788 cdin.fullpath = dirname;
6789 m_pWorkDirList->Add(cdin);
6797void options::OnApplyClick(wxCommandEvent& event) {
6803 if (m_pShipIconType->GetSelection() > 0) {
6804 double n_ownship_length_meters;
6805 double n_ownship_beam_meters;
6806 double n_gps_antenna_offset_y;
6807 double n_gps_antenna_offset_x;
6808 long n_ownship_min_mm;
6809 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
6810 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
6811 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
6812 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
6813 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
6815 if (n_ownship_length_meters <= 0)
6816 msg += _(
"\n - your ship's length must be > 0");
6817 if (n_ownship_beam_meters <= 0)
6818 msg += _(
"\n - your ship's beam must be > 0");
6819 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
6821 "\n - your GPS offset from midship must be within your ship's beam");
6822 if (n_gps_antenna_offset_y < 0 ||
6823 n_gps_antenna_offset_y > n_ownship_length_meters)
6825 _(
"\n - your GPS offset from bow must be within your ship's length");
6826 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
6827 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
6828 if (!msg.IsEmpty()) {
6829 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
6830 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
6831 ::wxEndBusyCursor();
6832 event.SetInt(wxID_STOP);
6835 g_n_ownship_length_meters = n_ownship_length_meters;
6836 g_n_ownship_beam_meters = n_ownship_beam_meters;
6837 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
6838 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
6839 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
6841 g_OwnShipIconType = m_pShipIconType->GetSelection();
6842 g_bShowShipToActive = pShowshipToActive->GetValue();
6843 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
6844 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
6846 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
6847 g_n_arrival_circle_radius =
6848 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
6850 wxString* icon_name =
6851 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
6852 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
6855 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
6856 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
6858 g_bUseWptScaMin = pScaMinChckB->GetValue();
6859 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
6860 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
6863 if (m_bfontChanged){
6864 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
6865 gFrame->GetPrimaryCanvas()->GetglCanvas()->ResetGridFont();
6867 m_returnChanges |= FONT_CHANGED;
6871 UpdateWorkArrayFromDisplayPanel();
6873 groupsPanel->SetDBDirs(*m_pWorkDirList);
6874 groupsPanel->m_treespopulated = FALSE;
6876 int k_force = FORCE_UPDATE;
6877 if (pUpdateCheckBox) {
6878 if (!pUpdateCheckBox->GetValue()) k_force = 0;
6879 pUpdateCheckBox->Enable();
6880 pUpdateCheckBox->SetValue(FALSE);
6885 m_returnChanges |= k_force;
6887 int k_scan = SCAN_UPDATE;
6888 if (pScanCheckBox) {
6889 if (!pScanCheckBox->GetValue()) k_scan = 0;
6890 pScanCheckBox->Enable();
6891 pScanCheckBox->SetValue(FALSE);
6896 m_returnChanges |= k_scan;
6900 if (groupsPanel->modified) {
6901 groupsPanel->EmptyChartGroupArray(g_pGroupArray);
6902 delete g_pGroupArray;
6903 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
6904 m_returnChanges |= GROUPS_CHANGED;
6909 g_bShowStatusBar = pShowStatusBar->GetValue();
6911 g_bShowMenuBar = pShowMenuBar->GetValue();
6913 g_bShowCompassWin = pShowCompassWin->GetValue();
6916 g_bShowChartBar = pShowChartBar->GetValue();
6918 wxString screenmm = pScreenMM->GetValue();
6920 screenmm.ToLong(&mm);
6921 g_config_display_size_mm = mm > 0 ? mm : -1;
6922 g_config_display_size_manual = pRBSizeManual->GetValue();
6925 comm_dialog->ApplySettings();
6927 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
6928 if (pSDisplayGrid) g_bDisplayGrid = pSDisplayGrid->GetValue();
6931 bool temp_bquilting = pCDOQuilting->GetValue();
6934 g_bQuiltEnable = temp_bquilting;
6938 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
6939 g_bskew_comp = pSkewComp->GetValue();
6940 g_btouch = pMobile->GetValue();
6941 g_bresponsive = pResponsive->GetValue();
6942 g_bRollover = pRollover->GetValue();
6943 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
6945 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
6948 pToolbarHideSecs->GetValue().ToLong(&hide_val);
6949 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
6950 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
6955 g_bsmoothpanzoom = pSmoothPanZoom->GetValue();
6956#ifdef __OCPN__ANDROID__
6957 g_bsmoothpanzoom =
false;
6959 if (pSmoothPanZoom) g_bsmoothpanzoom = pSmoothPanZoom->GetValue();
6960#ifdef __OCPN__ANDROID__
6961 g_bsmoothpanzoom =
false;
6964 long update_val = 1;
6965 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
6966 g_COGAvgSec = wxMin(
static_cast<int>(update_val), MAX_COG_AVERAGE_SECONDS);
6970 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
6972 g_bShowTrue = pCBTrueShow->GetValue();
6973 g_bShowMag = pCBMagShow->GetValue();
6975 auto loader = PluginLoader::getInstance();
6976 b_haveWMM = loader && loader->IsPlugInAvailable(_T(
"WMM"));
6977 if (!b_haveWMM && !b_oldhaveWMM) {
6978 pMagVar->GetValue().ToDouble(&g_UserVar);
6982 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
6983 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
6986 g_iNavAidRadarRingsNumberVisible =
6987 pNavAidRadarRingsNumberVisible->GetSelection();
6988 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
6989 g_fNavAidRadarRingsStep = temp_dbl;
6990 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
6991 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
6992 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
6993 g_fWaypointRangeRingsStep = temp_dbl;
6994 g_iWaypointRangeRingsStepUnits =
6995 m_itemWaypointRangeRingsUnits->GetSelection();
6996 g_colourWaypointRangeRingsColour =
6997 m_colourWaypointRangeRingsColour->GetColour();
6998 g_colourWaypointRangeRingsColour =
6999 wxColour(g_colourWaypointRangeRingsColour.Red(),
7000 g_colourWaypointRangeRingsColour.Green(),
7001 g_colourWaypointRangeRingsColour.Blue());
7002 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7003 g_own_ship_sog_cog_calc = pSogCogFromLLCheckBox->GetValue();
7004 g_own_ship_sog_cog_calc_damp_sec = pSogCogFromLLDampInterval->GetValue();
7006 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7008 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7010 if (g_bUIexpert && pCmdSoundString) {
7011 g_CmdSoundString = pCmdSoundString->GetValue();
7012 if (wxIsEmpty(g_CmdSoundString)) {
7013 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7014 pCmdSoundString->SetValue(g_CmdSoundString);
7018 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7019 if (pSoundDeviceIndex)
7020 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7022 g_iSDMMFormat = pSDMMFormat->GetSelection();
7023 g_iDistanceFormat = pDistanceFormat->GetSelection();
7024 g_iSpeedFormat = pSpeedFormat->GetSelection();
7025 g_iTempFormat = pTempFormat->GetSelection();
7028 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7029 if (pSDefaultBoatSpeed)
7030 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7031 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7033 g_bAdvanceRouteWaypointOnArrivalOnly =
7034 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7036 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7037 g_colourTrackLineColour =
7038 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7039 g_colourTrackLineColour.Blue());
7040 g_nTrackPrecision = pTrackPrecision->GetSelection();
7042 g_bTrackDaily = pTrackDaily->GetValue();
7044 g_track_rotate_time = 0;
7045#if wxCHECK_VERSION(2, 9, 0)
7046#if wxUSE_TIMEPICKCTRL
7048 if (pTrackRotateTime->GetTime(&h, &m, &s))
7049 g_track_rotate_time = h * 3600 + m * 60 + s;
7053 if (pTrackRotateUTC->GetValue())
7054 g_track_rotate_time_type = TIME_TYPE_UTC;
7055 else if (pTrackRotateLMT->GetValue())
7056 g_track_rotate_time_type = TIME_TYPE_LMT;
7058 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7060 g_bHighliteTracks = pTrackHighlite->GetValue();
7062 if (pEnableZoomToCursor)
7063 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7064#ifdef __OCPN__ANDROID__
7065 g_bEnableZoomToCursor =
false;
7068 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7069 g_colourOwnshipRangeRingsColour =
7070 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7071 g_colourOwnshipRangeRingsColour.Green(),
7072 g_colourOwnshipRangeRingsColour.Blue());
7075 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7076 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7077 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7078 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7082 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7083 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7084 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7085 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7086 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7087 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7090 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7091 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7092 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7093 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7096 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7098 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7099 if (g_bSyncCogPredictors) {
7100 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7102 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7104 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7105 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7109 for (
const auto& it : g_pAIS->GetTargetList()) {
7110 auto pAISTarget = it.second;
7111 if (NULL != pAISTarget) {
7112 pAISTarget->b_show_track = g_bAISShowTracks;
7114 for (
unsigned int i = 0; i < g_MMSI_Props_Array.GetCount(); i++) {
7115 if (pAISTarget->MMSI == g_MMSI_Props_Array[i]->MMSI) {
7117 if (TRACKTYPE_NEVER == props->TrackType) {
7118 pAISTarget->b_show_track =
false;
7121 else if (TRACKTYPE_ALWAYS == props->TrackType) {
7122 pAISTarget->b_show_track =
true;
7133 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7134 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7136 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7137 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7139 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7141 m_pText_Scale_Priority->GetValue().ToLong(&l);
7142 g_ShowScaled_Num = (int)l;
7144 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7145 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7146 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7147 long ais_name_scale = 5000;
7148 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7149 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7150 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7151 g_WplAction = m_pWplAction->GetSelection();
7154 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7155 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7156 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7158 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7159 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7162 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7163 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7164 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7166 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7167 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7168 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7169 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7170 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7171 g_ChartScaleFactorExp =
7172 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7173 g_MarkScaleFactorExp =
7174 g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7175 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7176 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7177 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7178 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7180 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7181 g_mouse_zoom_sensitivity =
7193 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7194 g_bopengl = pOpenGL->GetValue();
7197 int depthUnit = pDepthUnitSelect->GetSelection();
7198 g_nDepthUnitDisplay = depthUnit;
7201 bool bUserStdChange =
false;
7203 int nOBJL = ps57CtlListBox->GetCount();
7205 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7207 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7208 if (marinersStdXref[i] == iPtr) {
7213 assert(itemIndex >= 0);
7214 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7215 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7216 bUserStdChange =
true;
7217 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7223 ps52plib->GenerateStateHash();
7224 long stateHash = ps52plib->GetStateHash();
7226 if (m_returnChanges & GL_CHANGED) {
7229 ps52plib->FlushSymbolCaches();
7231 ps52plib->ClearCNSYLUPArray();
7232 ps52plib->GenerateStateHash();
7236 enum _DisCat nset = OTHER;
7237 switch (pDispCat->GetSelection()) {
7248 nset = MARINERS_STANDARD;
7251 ps52plib->SetDisplayCategory(nset);
7254 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7255 if (pCheck_ATONTEXT)
7256 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7257 if (pCheck_LDISTEXT)
7258 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7259 if (pCheck_XLSECTTEXT)
7260 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7262 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7263 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7264 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7265 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7266 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7267 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7269 ps52plib->m_nSymbolStyle =
7270 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7272 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7274 : SYMBOLIZED_BOUNDARIES;
7275 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7276 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7278 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7279 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7287 else if (depthUnit == 2)
7290 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7291 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7293 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7297 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7298 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7300 if (m_DeepCtl->GetValue().ToDouble(&dval))
7301 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7303 ps52plib->UpdateMarinerParams();
7304 ps52plib->m_nDepthUnitDisplay = depthUnit;
7306 ps52plib->GenerateStateHash();
7309 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7310 m_returnChanges |= S52_CHANGED;
7314#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7316 wxString new_canon = _T(
"en_US");
7317 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7319 int nLang =
sizeof(lang_list) /
sizeof(
int);
7320 for (
int it = 0; it < nLang; it++) {
7321 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7323 wxString lang_canonical = pli->CanonicalName;
7324 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7325 if (lang_sel == test_string) {
7326 new_canon = lang_canonical;
7332 wxString locale_old = g_locale;
7333 g_locale = new_canon;
7335 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7337 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7340 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7341 m_returnChanges |= STYLE_CHANGED;
7343 wxSizeEvent nullEvent;
7344 gFrame->OnSize(nullEvent);
7347 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7348 g_bInlandEcdis = pInlandEcdis->GetValue();
7349 SwitchInlandEcdisMode(g_bInlandEcdis);
7350 m_returnChanges |= TOOLBAR_CHANGED;
7355 if (PluginLoader::getInstance()->UpdatePlugIns())
7356 m_returnChanges |= TOOLBAR_CHANGED;
7359 if (m_pPlugInCtrl) m_pPlugInCtrl->UpdatePluginsOrder();
7360 g_pi_manager->UpdateConfig();
7363 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
7365 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7366 m_groups_changed | k_plugins | k_tides;
7370 TideCurrentDataSet.Clear();
7371 int nEntry = tcDataSelected->GetItemCount();
7372 for (
int i = 0; i < nEntry; i++) {
7373 wxString setName = tcDataSelected->GetItemText(i);
7374 TideCurrentDataSet.Add(setName);
7377 if (event.GetId() != ID_APPLY)
7378 g_canvasConfig = m_screenConfig;
7380 if (event.GetId() == ID_APPLY) {
7381 gFrame->ProcessOptionsDialog(m_returnChanges, m_pWorkDirList);
7387 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7390 gFrame->RefreshAllCanvas();
7394 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7397 UpdateTemplateTitleText();
7400 ::wxEndBusyCursor();
7403void options::OnXidOkClick(wxCommandEvent& event) {
7406 if (event.GetEventObject() == NULL)
return;
7408 OnApplyClick(event);
7409 if (event.GetInt() == wxID_STOP)
return;
7414void options::Finish(
void) {
7416 m_pListbook->ChangeSelection(0);
7417 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7418 wxNotebookPage* pg = m_pListbook->GetPage(i);
7419 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7420 if (nb) nb->ChangeSelection(0);
7423 lastWindowPos = GetPosition();
7424 lastWindowSize = GetSize();
7426 pConfig->SetPath(
"/Settings");
7427 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7428 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7430 SetReturnCode(m_returnChanges);
7431 EndModal(m_returnChanges);
7434ArrayOfCDI options::GetSelectedChartDirs() {
7436 for (
size_t i = 0; i < panelVector.size(); i++) {
7437 if (panelVector[i]->IsSelected()) {
7438 rv.Add(panelVector[i]->GetCDI());
7445ArrayOfCDI options::GetUnSelectedChartDirs() {
7447 for (
size_t i = 0; i < panelVector.size(); i++) {
7448 if (!panelVector[i]->IsSelected()) {
7449 rv.Add(panelVector[i]->GetCDI());
7456void options::SetDirActionButtons() {
7457 ArrayOfCDI selArray = GetSelectedChartDirs();
7458 if (selArray.GetCount())
7459 m_removeBtn->Enable();
7461 m_removeBtn->Disable();
7464void options::OnButtondeleteClick(wxCommandEvent& event) {
7465 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7466 ActiveChartArray.Clear();
7467 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7468 ActiveChartArray.Add(unselArray[i]);
7471 UpdateChartDirList();
7473 UpdateWorkArrayFromDisplayPanel();
7476 if (m_pWorkDirList) {
7477 pActiveChartsList->DeleteAllItems();
7478 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7479 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7482 li.SetAlign(wxLIST_FORMAT_LEFT);
7483 li.SetText(dirname);
7485 long idx = pActiveChartsList->InsertItem(li);
7490 k_charts |= CHANGE_CHARTS;
7492 pScanCheckBox->Disable();
7497void options::OnButtonParseENC(wxCommandEvent& event) {
7498 gFrame->GetPrimaryCanvas()->EnablePaint(
false);
7500 extern void ParseAllENC(wxWindow * parent);
7502 ParseAllENC(g_pOptions);
7505 gFrame->ChartsRefresh();
7507 gFrame->GetPrimaryCanvas()->EnablePaint(
true);
7513static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
7516 lzma_action action = LZMA_RUN;
7520 uint8_t inbuf[BUFSIZ];
7521 uint8_t outbuf[BUFSIZ];
7534 strm->next_in = NULL;
7536 strm->next_out = outbuf;
7537 strm->avail_out =
sizeof(outbuf);
7543 if (strm->avail_in == 0 && !feof(infile)) {
7544 strm->next_in = inbuf;
7545 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
7547 if (ferror(infile)) {
7548 fprintf(stderr,
"Read error: %s\n", strerror(errno));
7556 if (feof(infile)) action = LZMA_FINISH;
7574 lzma_ret ret = lzma_code(strm, action);
7579 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
7584 size_t write_size =
sizeof(outbuf) - strm->avail_out;
7586 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
7587 fprintf(stderr,
"Write error: %s\n", strerror(errno));
7592 strm->next_out = outbuf;
7593 strm->avail_out =
sizeof(outbuf);
7598 if (ret != LZMA_OK) {
7605 if (ret == LZMA_STREAM_END)
return true;
7616 case LZMA_MEM_ERROR:
7617 msg =
"Memory allocation failed";
7620 case LZMA_DATA_ERROR:
7633 msg =
"File size limits exceeded";
7648 msg =
"Unknown error, possibly a bug";
7652 wxLogMessage(_T(
"LZMA Encoder error: %s (error code %u)\n"), msg, ret);
7659static bool CompressChart(wxString in, wxString out) {
7661 FILE* infile = fopen(in.mb_str(),
"rb");
7662 if (!infile)
return false;
7664 FILE* outfile = fopen(out.mb_str(),
"wb");
7670 lzma_stream strm = LZMA_STREAM_INIT;
7671 bool success =
false;
7672 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
7674 success = compress(&strm, infile, outfile);
7685void options::OnButtonmigrateClick(wxCommandEvent& event) {
7686#ifdef __OCPN__ANDROID__
7691 g_migrateDialog->SetSize(gFrame->GetSize());
7692 g_migrateDialog->Centre();
7693 g_migrateDialog->Raise();
7694 g_migrateDialog->ShowModal();
7698void options::OnButtonEcdisHelp(wxCommandEvent& event) {
7700 wxString testFile =
"/doc/iECDIS/index.html";
7702 if (!::wxFileExists(testFile)) {
7703 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
7706 _(
"Would you like to visit the iECDIS Manual website for more "
7710 OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"), wxYES_NO | wxCENTER, 60)) {
7711 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
7715 wxLaunchDefaultBrowser(
"file:///" + *GetpSharedDataLocation() +
7718 wxLaunchDefaultBrowser(
"file://" + *GetpSharedDataLocation() +
7725void options::OnButtoncompressClick(wxCommandEvent& event) {
7727 wxArrayInt pListBoxSelections;
7730 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
7731 wxLIST_STATE_SELECTED);
7732 if (item == -1)
break;
7737 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
7738This may make them incompatible with other programs or older versions of OpenCPN.\n\
7739Compressed charts may take slightly longer to load and display on some systems.\n\
7740They can be decompressed again using unxz or 7 zip programs."),
7741 _(
"OpenCPN Warning"),
7742 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
7746 wxArrayString filespecs;
7747 filespecs.Add(
"*.kap");
7748 filespecs.Add(
"*.KAP");
7749 filespecs.Add(
"*.000");
7752 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
7753 filespecs.Add(
"*.D");
7754 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
7755 filespecs.Add(
"*.Z");
7757 wxGenericProgressDialog prog1(
7758 _(
"OpenCPN Compress Charts"), wxEmptyString,
7759 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
7760 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
7761 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
7764 wxSize sz = prog1.GetSize();
7765 sz.x = gFrame->GetClientSize().x * 8 / 10;
7768 wxArrayString charts;
7769 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
7770 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
7771 if (dirname.IsEmpty())
continue;
7774 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7775 (dirname.Last() == wxChar(_T(
'\r'))))
7776 dirname.RemoveLast();
7778 if (!wxDir::Exists(dirname))
continue;
7781 wxArrayString FileList;
7782 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
7783 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
7785 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
7789 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
7790 charts.Add(FileList[j]);
7794 if (charts.GetCount() == 0) {
7795 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
7800 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
7801 wxGenericProgressDialog prog(
7802 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
7803 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
7804 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
7808 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
7810 prog.Update(i, charts[i], &skip);
7813 wxString compchart = charts[i] + _T(
".xz");
7814 if (CompressChart(charts[i], compchart)) {
7815 total_size += wxFileName::GetSize(charts[i]).ToULong();
7816 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
7817 wxRemoveFile(charts[i]);
7823 double total_size_mb = total_size / 1024.0 / 1024.0;
7824 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
7827 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
7829 count, total_size_mb, total_compressed_size_mb,
7830 total_size_mb - total_compressed_size_mb,
7831 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
7834 UpdateWorkArrayFromTextCtl();
7836 if (m_pWorkDirList) {
7837 pActiveChartsList->DeleteAllItems();
7838 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7839 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7842 li.SetAlign(wxLIST_FORMAT_LEFT);
7843 li.SetText(dirname);
7845 long idx = pActiveChartsList->InsertItem(li);
7849 k_charts |= CHANGE_CHARTS;
7851 pScanCheckBox->Disable();
7857void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
7859void options::OnCancelClick(wxCommandEvent& event) {
7860 m_pListbook->ChangeSelection(0);
7862 lastWindowPos = GetPosition();
7863 lastWindowSize = GetSize();
7865 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxCANCEL);
7867 pConfig->SetPath(
"/Settings");
7868 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7869 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7872 if (m_bForceNewToolbaronCancel) rv = TOOLBAR_CHANGED;
7876void options::OnClose(wxCloseEvent& event) {
7878 if (g_pi_manager) g_pi_manager->CloseAllPlugInPanels((
int)wxOK);
7880 m_pListbook->ChangeSelection(0);
7882 lastWindowPos = GetPosition();
7883 lastWindowSize = GetSize();
7885 pConfig->SetPath(
"/Settings");
7886 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7887 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7892void options::OnFontChoice(wxCommandEvent& event) {
7893 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
7895 wxFont* pif = FontMgr::Get().GetFont(sel_text_element);
7896 wxColour init_color = FontMgr::Get().GetFontColor(sel_text_element);
7898 m_textSample->SetFont(*pif);
7899 m_textSample->SetForegroundColour(init_color);
7900 m_itemBoxSizerFontPanel->Layout();
7904void options::OnChooseFont(wxCommandEvent& event) {
7905#ifdef __OCPN__ANDROID__
7906 androidDisableRotation();
7909 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
7910 wxFontData font_data;
7912 wxFont* pif = FontMgr::Get().GetFont(sel_text_element);
7913 wxColour init_color = FontMgr::Get().GetFontColor(sel_text_element);
7915 wxFontData init_font_data;
7916 if (pif) init_font_data.SetInitialFont(*pif);
7917 init_font_data.SetColour(init_color);
7920 wxFontDialog dg(
this, init_font_data);
7922 wxFontDialog dg(pParent, init_font_data);
7925 wxFont* qFont = dialogFont;
7931 wxSize proposed_size = GetSize();
7933 float font_size = dialogFont->GetPointSize();
7935 if ((proposed_size.y / font_size) < n_lines) {
7936 float new_font_size = proposed_size.y / n_lines;
7937 wxFont* smallFont =
new wxFont(*dialogFont);
7938 smallFont->SetPointSize(new_font_size);
7939 dg.SetFont(*smallFont);
7943 if (g_bresponsive) {
7944 dg.SetSize(GetSize());
7948 int retval = dg.ShowModal();
7949 if (wxID_CANCEL != retval) {
7950 font_data = dg.GetFontData();
7951 wxFont font = font_data.GetChosenFont();
7952 wxFont* psfont =
new wxFont(font);
7953 wxColor color = font_data.GetColour();
7954 FontMgr::Get().SetFont(sel_text_element, psfont, color);
7955 pParent->UpdateAllFonts();
7956 m_bfontChanged =
true;
7957 OnFontChoice(event);
7960#ifdef __OCPN__ANDROID__
7961 androidEnableRotation();
7967#if defined(__WXGTK__) || defined(__WXQT__)
7968void options::OnChooseFontColor(wxCommandEvent& event) {
7969 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
7971 wxColourData colour_data;
7973 wxFont* pif = FontMgr::Get().GetFont(sel_text_element);
7974 wxColour init_color = FontMgr::Get().GetFontColor(sel_text_element);
7976#ifdef __OCPN__ANDROID__
7977 androidDisableRotation();
7979 unsigned int cco = 0;
7982 cco |= init_color.Red();
7984 cco |= init_color.Green();
7986 cco |= init_color.Blue();
7987 unsigned int cc = androidColorPicker(cco);
7990 unsigned char blue = (
unsigned char)cc % 256;
7991 unsigned char green = (
unsigned char)(cc >> 8) % 256;
7993 unsigned char red = (
unsigned char)(cc >> 16) % 256;
7994 cn.Set(red, green, blue);
7996 FontMgr::Get().SetFont(sel_text_element, pif, cn);
7998 pParent->UpdateAllFonts();
7999 m_bfontChanged =
true;
8001 androidEnableRotation();
8003 wxScrolledWindow* sw =
8004 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8006 wxColourData init_colour_data;
8007 init_colour_data.SetColour(init_color);
8009 wxColourDialog dg(sw, &init_colour_data);
8011 int retval = dg.ShowModal();
8012 if (wxID_CANCEL != retval) {
8013 colour_data = dg.GetColourData();
8015 wxColor color = colour_data.GetColour();
8016 FontMgr::Get().SetFont(sel_text_element, pif, color);
8018 pParent->UpdateAllFonts();
8019 m_bfontChanged =
true;
8020 OnFontChoice(event);
8029void options::OnChartsPageChange(wxListbookEvent& event) {
8030 unsigned int i =
event.GetSelection();
8032 UpdateChartDirList();
8037 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8039 if (!groupsPanel->m_settingscomplete) {
8040 ::wxBeginBusyCursor();
8041 groupsPanel->CompleteInitialSettings();
8042 ::wxEndBusyCursor();
8043 }
else if (!groupsPanel->m_treespopulated) {
8044 groupsPanel->PopulateTrees();
8045 groupsPanel->m_treespopulated = TRUE;
8047 }
else if (1 == i) {
8049 if (!m_bVectorInit) {
8050 SetInitialVectorSettings();
8051 UpdateOptionsUnits();
8058void options::OnPageChange(wxListbookEvent& event) {
8059 DoOnPageChange(event.GetSelection());
8062void options::OnSubNBPageChange(wxNotebookEvent& event) {
8065 if (event.GetEventObject()) {
8066 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8067 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8068 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8069 if (
dynamic_cast<wxNotebook*
>(parent)) {
8070 lastSubPage =
event.GetSelection();
8073 if (
dynamic_cast<wxListbook*
>(parent)) {
8074 lastSubPage =
event.GetSelection();
8081void options::OnTopNBPageChange(wxNotebookEvent& event) {
8082 DoOnPageChange(event.GetSelection());
8085void options::DoOnPageChange(
size_t page) {
8086 unsigned int i = page;
8089 if (page > 10)
return;
8093#ifndef __OCPN__ANDROID__
8095 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8096 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8103 k_charts = VISIT_CHARTS;
8104 UpdateChartDirList();
8107 else if (m_pageUI == i) {
8108 if (!m_itemLangListBox)
return;
8109#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8111 if (!m_bVisitLang) {
8112 ::wxBeginBusyCursor();
8114 int current_language = plocale_def_lang->GetLanguage();
8115 wxString current_sel = wxLocale::GetLanguageName(current_language);
8117 current_sel = GetOCPNKnownLanguage(g_locale);
8119 int nLang =
sizeof(lang_list) /
sizeof(
int);
8123 m_itemLangListBox->Append(_T(
"English (U.S.)"));
8125 wxString lang_dir = g_Platform->GetSharedDataDir() + _T(
"share/locale/");
8126 for (
int it = 1; it < nLang; it++) {
8127 if (wxLocale::IsAvailable(lang_list[it])) {
8128 wxLocale ltest(lang_list[it], 0);
8129 ltest.AddCatalog(_T(
"opencpn"));
8130 if (!ltest.IsLoaded(_T(
"opencpn")))
continue;
8133 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8134 wxString widgets_lang_name = loc_lang_name;
8135 wxString lang_canonical =
8136 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8139 wxString lang_suffix;
8140 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8143 wxString test_dir = lang_dir + lang_suffix;
8144 if (!wxDir::Exists(test_dir))
8147 m_itemLangListBox->Append(loc_lang_name);
8151 wxArrayString lang_array;
8154 lang_array.Add(_T(
"en_US"));
8156 for (
int it = 0; it < nLang; it++) {
8158 wxLog::EnableLogging(
8161 wxLocale ltest(lang_list[it], 0);
8162#if wxCHECK_VERSION(2, 9, 0)
8164 ltest.AddCatalogLookupPathPrefix(
8165 wxStandardPaths::Get().GetInstallPrefix() +
8166 _T(
"/share/locale" ));
8169 ltest.AddCatalog(_T(
"opencpn"));
8171 wxLog::EnableLogging(TRUE);
8173 if (ltest.IsLoaded(_T(
"opencpn"))) {
8175 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8176 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8177 if (wxNOT_FOUND == lang_array.Index(s0)) lang_array.Add(s0);
8182 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8184 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8185 m_itemLangListBox->Append(loc_lang_name);
8202 delete plocale_def_lang;
8203 plocale_def_lang =
new wxLocale(current_language);
8205 setlocale(LC_NUMERIC,
"C");
8206 plocale_def_lang->AddCatalog(_T(
"opencpn"));
8208 m_itemLangListBox->SetStringSelection(current_sel);
8211 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8213 wxString clang = pli->Description;
8217 m_bVisitLang = TRUE;
8219 ::wxEndBusyCursor();
8222 }
else if (m_pagePlugins == i) {
8225 auto loader = PluginLoader::getInstance();
8226 if (LoadAllPlugIns(
false)) {
8227 delete m_pPlugInCtrl;
8228 m_pPlugInCtrl = NULL;
8229 delete m_PluginCatalogMgrPanel;
8230 m_PluginCatalogMgrPanel = NULL;
8231 itemBoxSizerPanelPlugins->Clear();
8234 if (!m_pPlugInCtrl) {
8236 ::wxBeginBusyCursor();
8241 PluginLoader::getInstance()->GetPlugInArray());
8242 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8243 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8244 wxEXPAND | wxGROW | wxALL, 4);
8245 if (g_pi_manager) g_pi_manager->SetListPanelPtr(m_pPlugInCtrl);
8248 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8250 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8251 wxEXPAND | wxALL, 4);
8252 itemBoxSizerPanelPlugins->Layout();
8255 m_pPlugInCtrl->UpdateSelections();
8257 ::wxEndBusyCursor();
8259 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8262 k_plugins = TOOLBAR_CHANGED;
8266wxString options::SelectSoundFile() {
8267 wxString sound_dir = g_Platform->GetSharedDataDir();
8268 sound_dir.Append(_T(
"sounds"));
8272#ifndef __OCPN__ANDROID__
8273 wxFileDialog* popenDialog =
new wxFileDialog(
8274 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8275 _T(
"WAV files (*.wav)|*.wav|All files (*.*)|*.*"), wxFD_OPEN);
8277 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8279 response = popenDialog->ShowModal();
8280 sel_file = popenDialog->GetPath();
8285 g_Platform->DoFileSelectorDialog(
this, &sel_file, _(
"Select Sound File"),
8286 sound_dir, wxEmptyString, wxT(
"*.*"));
8289 if (response == wxID_OK)
8290 return g_Platform->NormalizePath(sel_file);
8295void options::OnButtonSelectSound(wxCommandEvent& event) {
8296 wxString sel_file = SelectSoundFile();
8298 if (!sel_file.IsEmpty()) {
8299 g_sAIS_Alert_Sound_File = g_Platform->NormalizePath(sel_file);
8303void options::OnButtonTestSound(wxCommandEvent& event) {
8304 auto sound = SoundFactory();
8305 auto cmd_sound =
dynamic_cast<SystemCmdSound*
>(sound);
8306 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8307 sound->SetFinishedCallback([sound](
void*) {
delete sound; });
8308 sound->Load(g_sAIS_Alert_Sound_File, g_iSoundDeviceIndex);
8312wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8313 wxString return_string;
8314 wxString dir_suffix;
8316#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8318 if (lang_canonical == _T(
"en_US")) {
8319 dir_suffix = _T(
"en");
8320 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8322 }
else if ((lang_canonical == _T(
"cs_CZ")) || (lang_canonical == _T(
"cs"))) {
8323 dir_suffix = _T(
"cs");
8324 return_string = wxString(
"Čeština", wxConvUTF8);
8326 }
else if ((lang_canonical == _T(
"da_DK")) || (lang_canonical == _T(
"da"))) {
8327 dir_suffix = _T(
"da");
8328 return_string = wxString(
"Dansk", wxConvUTF8);
8330 }
else if ((lang_canonical == _T(
"de_DE")) || (lang_canonical == _T(
"de"))) {
8331 dir_suffix = _T(
"de");
8332 return_string = wxString(
"Deutsch", wxConvUTF8);
8334 }
else if ((lang_canonical == _T(
"et_EE")) || (lang_canonical == _T(
"et"))) {
8335 dir_suffix = _T(
"et");
8336 return_string = wxString(
"Eesti", wxConvUTF8);
8338 }
else if ((lang_canonical == _T(
"es_ES")) || (lang_canonical == _T(
"es"))) {
8339 dir_suffix = _T(
"es");
8340 return_string = wxString(
"Español", wxConvUTF8);
8342 }
else if ((lang_canonical == _T(
"fr_FR")) || (lang_canonical == _T(
"fr"))) {
8343 dir_suffix = _T(
"fr");
8344 return_string = wxString(
"Français", wxConvUTF8);
8346 }
else if ((lang_canonical == _T(
"it_IT")) || (lang_canonical == _T(
"it"))) {
8347 dir_suffix = _T(
"it");
8348 return_string = wxString(
"Italiano", wxConvUTF8);
8350 }
else if ((lang_canonical == _T(
"nl_NL")) || (lang_canonical == _T(
"nl"))) {
8351 dir_suffix = _T(
"nl");
8352 return_string = wxString(
"Nederlands", wxConvUTF8);
8354 }
else if ((lang_canonical == _T(
"pl_PL")) || (lang_canonical == _T(
"pl"))) {
8355 dir_suffix = _T(
"pl");
8356 return_string = wxString(
"Polski", wxConvUTF8);
8358 }
else if ((lang_canonical == _T(
"pt_PT")) || (lang_canonical == _T(
"pt"))) {
8359 dir_suffix = _T(
"pt_PT");
8360 return_string = wxString(
"Português", wxConvUTF8);
8362 }
else if ((lang_canonical == _T(
"pt_BR")) || (lang_canonical == _T(
"pt_BR"))) {
8363 dir_suffix = _T(
"pt_BR");
8364 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8366 }
else if ((lang_canonical == _T(
"ru_RU")) || (lang_canonical == _T(
"ru"))) {
8367 dir_suffix = _T(
"ru");
8368 return_string = wxString(
"Русский", wxConvUTF8);
8370 }
else if ((lang_canonical == _T(
"sv_SE")) || (lang_canonical == _T(
"sv"))) {
8371 dir_suffix = _T(
"sv");
8372 return_string = wxString(
"Svenska", wxConvUTF8);
8374 }
else if ((lang_canonical == _T(
"fi_FI")) || (lang_canonical == _T(
"fi"))) {
8375 dir_suffix = _T(
"fi_FI");
8376 return_string = wxString(
"Suomi", wxConvUTF8);
8378 }
else if ((lang_canonical == _T(
"nb_NO")) || (lang_canonical == _T(
"nb"))) {
8379 dir_suffix = _T(
"nb_NO");
8380 return_string = wxString(
"Norsk", wxConvUTF8);
8382 }
else if ((lang_canonical == _T(
"tr_TR")) || (lang_canonical == _T(
"tr"))) {
8383 dir_suffix = _T(
"tr_TR");
8384 return_string = wxString(
"Türkçe", wxConvUTF8);
8386 }
else if ((lang_canonical == _T(
"el_GR")) || (lang_canonical == _T(
"el"))) {
8387 dir_suffix = _T(
"el_GR");
8388 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8390 }
else if ((lang_canonical == _T(
"hu_HU")) || (lang_canonical == _T(
"hu"))) {
8391 dir_suffix = _T(
"hu_HU");
8392 return_string = wxString(
"Magyar", wxConvUTF8);
8394 }
else if ((lang_canonical == _T(
"zh_TW")) || (lang_canonical == _T(
"zh_TW"))) {
8395 dir_suffix = _T(
"zh_TW");
8396 return_string = wxString(
"正體字", wxConvUTF8);
8398 }
else if ((lang_canonical == _T(
"zh_CN")) || (lang_canonical == _T(
"zh_CN"))) {
8399 dir_suffix = _T(
"zh_CN");
8400 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8402 }
else if ((lang_canonical == _T(
"ca_ES")) || (lang_canonical == _T(
"ca"))) {
8403 dir_suffix = _T(
"ca_ES");
8404 return_string = wxString(
"Catalan", wxConvUTF8);
8406 }
else if ((lang_canonical == _T(
"gl_ES")) || (lang_canonical == _T(
"gl_ES"))) {
8407 dir_suffix = _T(
"gl_ES");
8408 return_string = wxString(
"Galician", wxConvUTF8);
8410 }
else if ((lang_canonical == _T(
"ja_JP")) || (lang_canonical == _T(
"ja_JP"))) {
8411 dir_suffix = _T(
"ja_JP");
8412 return_string = wxString(
"Japanese", wxConvUTF8);
8414 }
else if ((lang_canonical == _T(
"vi_VN")) || (lang_canonical == _T(
"vi_VN"))) {
8415 dir_suffix = _T(
"vi_VN");
8416 return_string = wxString(
"Vietnamese", wxConvUTF8);
8419 dir_suffix = lang_canonical;
8420 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8422 return_string = info->Description;
8424 return_string = lang_canonical;
8427 lang_dir = dir_suffix;
8429 return return_string;
8433wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8435 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8438ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8439 ChartGroupArray* d =
new ChartGroupArray;
8440 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8443 pdg->m_group_name = psg->m_group_name;
8444 pdg->m_element_array.reserve(psg->m_element_array.size());
8446 for (
auto& elem : psg->m_element_array)
8447 pdg->m_element_array.push_back(elem);
8454void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8464EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8465EVT_NOTEBOOK_PAGE_CHANGED(
8467 ChartGroupsUI::OnGroupPageChange)
8471 m_GroupSelectedPage = -1;
8472 m_pActiveChartsTree = 0;
8474 lastSelectedCtl = NULL;
8475 allAvailableCtl = NULL;
8476 defaultAllCtl = NULL;
8478 m_pAddButton = NULL;
8479 m_pRemoveButton = NULL;
8480 m_pDeleteGroupButton = NULL;
8481 m_pNewGroupButton = NULL;
8482 m_pGroupArray = NULL;
8485 m_UIcomplete =
false;
8486 m_treespopulated =
false;
8487 dialogFont = GetOCPNScaledFont(_(
"Dialog"));
8490ChartGroupsUI::~ChartGroupsUI(
void) {
8491 m_DirCtrlArray.Clear();
8492 m_GroupNB->Disconnect(
8493 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
8494 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
8499void ChartGroupsUI::SetInitialSettings(
void) {
8500 m_settingscomplete = FALSE;
8501 m_treespopulated = FALSE;
8504void ChartGroupsUI::PopulateTrees(
void) {
8507 wxArrayString dir_array;
8508 int nDir = m_db_dirs.GetCount();
8509 for (
int i = 0; i < nDir; i++) {
8510 wxString dirname = m_db_dirs[i].fullpath;
8511 if (!dirname.IsEmpty()) dir_array.Add(dirname);
8514 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array, wxColour(0, 0, 0),
8516 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
8520 wxArrayString dir_array0;
8521 int nDir0 = m_db_dirs.GetCount();
8522 for (
int i = 0; i < nDir0; i++) {
8523 wxString dirname = m_db_dirs[i].fullpath;
8524 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
8526 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
8527 wxColour(128, 128, 128), iFont);
8530void ChartGroupsUI::CompleteInitialSettings(
void) {
8533 BuildNotebookPages(m_pGroupArray);
8535 m_panel->GetSizer()->Layout();
8537 m_settingscomplete = TRUE;
8538 m_treespopulated = TRUE;
8541void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
8542 const wxArrayString& dir_array,
8543 const wxColour& col, wxFont* pFont) {
8544 ptc->DeleteAllItems();
8546 wxDirItemData* rootData =
new wxDirItemData(_T(
"Dummy"), _T(
"Dummy"), TRUE);
8548 rootName = _T(
"Dummy");
8549 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
8550 ptc->SetItemHasChildren(m_rootId);
8553 int nDir = dir_array.GetCount();
8554 for (
int i = 0; i < nDir; i++) {
8555 wxString dirname = dir_array[i];
8556 if (!dirname.IsEmpty()) {
8557 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
8558 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
8561 ptc->SetItemText(
id, dirname);
8562 if (pFont) ptc->SetItemFont(
id, *pFont);
8566 ptc->SetItemTextColour(
id, col);
8568 ptc->SetItemHasChildren(
id);
8573void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
8574 wxString insert_candidate = allAvailableCtl->GetPath();
8575 if (!insert_candidate.IsEmpty()) {
8576 if (m_DirCtrlArray.GetCount()) {
8577 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8578 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8580 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8582 if (ptree->IsEmpty()) {
8583 wxDirItemData* rootData =
8584 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
8585 wxString rootName = _T(
"Dummy");
8586 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
8588 ptree->SetItemHasChildren(rootId);
8591 wxTreeItemId root_Id = ptree->GetRootItem();
8592 wxDirItemData* dir_item =
8593 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
8595 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
8596 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
8599 pGroup->m_element_array.push_back({insert_candidate});
8604 allAvailableCtl->GetTreeCtrl()->UnselectAll();
8605 m_pAddButton->Disable();
8607 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8609 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8610 if (ptree) ptree->Refresh();
8614void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
8615 if (m_DirCtrlArray.GetCount()) {
8616 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8617 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8620 wxString sel_item = pDirCtrl->GetPath();
8622 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8623 if (ptree && ptree->GetCount()) {
8624 wxTreeItemId
id = ptree->GetSelection();
8625 lastDeletedItem = id;
8627 wxString branch_adder;
8628 int group_item_index =
8629 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
8630 if (group_item_index >= 0) {
8632 pGroup->m_element_array[group_item_index];
8633 bool b_duplicate = FALSE;
8634 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
8636 if (pelement.m_missing_name_array[k] == sel_item) {
8642 pelement.m_missing_name_array.Add(sel_item);
8648 if (branch_adder == _T(
"")) {
8650 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
8653 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
8659 lastSelectedCtl->Unselect();
8660 lastSelectedCtl = 0;
8661 m_pRemoveButton->Disable();
8663 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8665 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8666 if (ptree) ptree->Refresh();
8674void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
8675 m_GroupSelectedPage =
event.GetSelection();
8676 allAvailableCtl->GetTreeCtrl()->UnselectAll();
8677 if (lastSelectedCtl) {
8678 lastSelectedCtl->UnselectAll();
8679 lastSelectedCtl = 0;
8681 m_pRemoveButton->Disable();
8682 m_pAddButton->Disable();
8685 if (m_GroupSelectedPage == 0) {
8686 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
8688 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
8692void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
8693 wxObject* evtObj =
event.GetEventObject();
8694 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
8695 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
8696 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
8697 m_pAddButton->Enable();
8699 m_pAddButton->Disable();
8702 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
8703 if (!lastSelectedCtl)
goto out;
8704 wxTreeItemId item = lastSelectedCtl->GetSelection();
8705 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
8708 wxGenericDirCtrl* dirCtrl =
8709 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
8710 if (!dirCtrl)
goto out;
8711 wxString itemPath = dirCtrl->GetPath();
8712 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
8714 m_pRemoveButton->Disable();
8722void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
8723 wxTextEntryDialog* pd =
new wxTextEntryDialog();
8724 wxFont* qFont = GetOCPNScaledFont(_(
"Dialog"));
8725 pd->SetFont(*qFont);
8727 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
8729#ifdef __OCPN__ANDROID__
8730 androidDisableRotation();
8733 if (pd->ShowModal() == wxID_OK) {
8734 if (pd->GetValue().Length()) {
8735 AddEmptyGroupPage(pd->GetValue());
8737 pGroup->m_group_name = pd->GetValue();
8738 m_pGroupArray->Add(pGroup);
8740 m_GroupSelectedPage =
8741 m_GroupNB->GetPageCount() - 1;
8742 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
8743 m_pDeleteGroupButton->Enable();
8749#ifdef __OCPN__ANDROID__
8750 androidEnableRotation();
8754void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
8755 if (0 != m_GroupSelectedPage) {
8756 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
8757 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
8758 m_GroupNB->DeletePage(m_GroupSelectedPage);
8761 if (m_GroupSelectedPage <= 0) {
8762 m_pAddButton->Disable();
8763 m_pDeleteGroupButton->Disable();
8767int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
8768 wxTreeItemId item, wxString* pbranch_adder) {
8769 wxString branch_name;
8770 wxString branch_adder;
8772 wxTreeItemId current_node = item;
8773 while (current_node.IsOk()) {
8774 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
8775 if (!parent_node)
break;
8777 if (parent_node == ptree->GetRootItem()) {
8778 branch_name = ptree->GetItemText(current_node);
8782 branch_adder.Prepend(ptree->GetItemText(current_node));
8783 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
8785 current_node = ptree->GetItemParent(current_node);
8789 unsigned int target_item_index = -1;
8791 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
8792 const wxString &target = pGroup->m_element_array[i].m_element_name;
8793 if (branch_name == target) {
8794 target_item_index = i;
8799 if (pbranch_adder) *pbranch_adder = branch_adder;
8801 return target_item_index;
8804void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
8805 wxTreeItemId node =
event.GetItem();
8807 if (m_GroupSelectedPage <= 0)
return;
8808 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
8809 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
8810 if (!pDirCtrl)
return;
8812 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
8813 wxString branch_adder;
8814 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
8815 if (target_item_index < 0)
return;
8817 pGroup->m_element_array[target_item_index];
8818 const wxString &branch_name = target_element.m_element_name;
8822 if (!target_element.m_missing_name_array.GetCount())
return;
8823 wxString full_root = branch_name;
8824 full_root += branch_adder;
8825 full_root += wxString(wxFILE_SEP_PATH);
8827 wxTreeItemIdValue cookie;
8828 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
8829 while (child.IsOk()) {
8830 wxString target_string = full_root;
8831 target_string += ptree->GetItemText(child);
8833 for (
unsigned int k = 0;
8834 k < target_element.m_missing_name_array.GetCount(); k++) {
8835 if (target_element.m_missing_name_array[k] == target_string) {
8836 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
8840 child = ptree->GetNextChild(node, cookie);
8844void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
8847 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
8849 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
8852 int nItems = pGroup->m_element_array.size();
8853 for (
int i = 0; i < nItems; i++) {
8854 const wxString &itemname = pGroup->m_element_array[i].m_element_name;
8855 if (!itemname.IsEmpty()) {
8856 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
8858 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
8860 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
8866wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
8867 wxGenericDirCtrl* GroupDirCtl =
8868 new wxGenericDirCtrl(m_GroupNB, wxID_ANY, _T(
"TESTDIR"));
8869 m_GroupNB->AddPage(GroupDirCtl, label);
8871 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
8872 ptree->DeleteAllItems();
8874 wxDirItemData* rootData =
8875 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
8876 wxString rootName = _T(
"Dummy");
8877 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
8878 ptree->SetItemHasChildren(rootId);
8880 m_DirCtrlArray.Add(GroupDirCtl);
8885void ChartGroupsUI::ClearGroupPages() {
8886 if (m_GroupNB->GetPageCount() == 0)
return;
8888 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
8889 m_DirCtrlArray.RemoveAt(i);
8890 m_GroupNB->DeletePage(i);
8894void options::OnInsertTideDataLocation(wxCommandEvent& event) {
8896 int response = wxID_CANCEL;
8898#ifndef __OCPN__ANDROID__
8899 wxFileDialog* popenDialog =
new wxFileDialog(
8900 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir, wxT(
""),
8901 wxT(
"Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All ")
8902 wxT(
"files (*.*)|*.*"),
8905 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8907 response = popenDialog->ShowModal();
8908 sel_file = popenDialog->GetPath();
8913 response = g_Platform->DoFileSelectorDialog(
this, &path,
8914 _(
"Select Tide/Current Data"),
8915 g_TCData_Dir, _T(
""), wxT(
"*.*"));
8919 if (response == wxID_OK) {
8921 int id = tcDataSelected->GetItemCount();
8923 long idx = tcDataSelected->InsertItem(li);
8924 tcDataSelected->SetItem(
id, 0, g_Platform->NormalizePath(sel_file));
8927 wxFileName fn(sel_file);
8928 wxString data_dir = fn.GetPath();
8929 g_TCData_Dir = g_Platform->NormalizePath(data_dir);
8933void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
8936 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
8937 wxLIST_STATE_SELECTED);
8938 if (item == -1)
break;
8939 tcDataSelected->DeleteItem(item);
8946enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
8949BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
8950EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
8951EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
8954OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
8955 : wxDialog(parent, wxID_ANY, _T( "OpenGL Options" ), wxDefaultPosition,
8957 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
8962 m_brebuild_cache(FALSE) {
8964 wxFont* dialogFont = GetOCPNScaledFont(_(
"Dialog"));
8965 SetFont(*dialogFont);
8967 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
8968 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
8970 m_cbTextureCompression =
8971 new wxCheckBox(
this, wxID_ANY,
8972 g_bGLexpert ? _(
"Texture Compression")
8973 : _(
"Texture Compression with Caching"));
8974 m_cbTextureCompressionCaching =
8975 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
8977 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
8978 m_sTextureMemorySize =
new wxSpinCtrl(
this);
8979 m_sTextureMemorySize->SetRange(1, 16384);
8981 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
8982 wxButton* btnRebuild =
8983 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
8984 wxButton* btnClear =
8985 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
8986 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
8987 if (!g_bopengl || g_raster_format == GL_RGB) btnRebuild->Disable();
8988 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
8989 m_cbShowFPS =
new wxCheckBox(
this, wxID_ANY, _(
"Show FPS"));
8990 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
8991 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
8993 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
8994 m_cbUseAcceleratedPanning =
8995 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
8997 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
8998 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
8999 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9000 flexSizer->AddSpacer(0);
9001 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9002 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9003 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9004 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9005 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9006 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9007 flexSizer->AddSpacer(0);
9008 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9009 flexSizer->AddSpacer(0);
9010 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9011 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9012 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9013 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9014 flexSizer->AddSpacer(0);
9015 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9016 flexSizer->AddSpacer(0);
9017 flexSizer->Add(m_cbShowFPS, 0, wxALL | wxEXPAND, 5);
9018 flexSizer->AddSpacer(0);
9019 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9020 flexSizer->AddSpacer(0);
9021 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9022 flexSizer->AddGrowableCol(1);
9023 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9025 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9026 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9027 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9028 btnSizer->Realize();
9030 mainSizer->AddStretchSpacer();
9031 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9035 SetSizer(mainSizer);
9036 mainSizer->SetSizeHints(
this);
9040bool OpenGLOptionsDlg::GetAcceleratedPanning(
void)
const {
9041 return m_cbUseAcceleratedPanning->GetValue();
9044bool OpenGLOptionsDlg::GetTextureCompression(
void)
const {
9045 return m_cbTextureCompression->GetValue();
9048bool OpenGLOptionsDlg::GetPolygonSmoothing(
void)
const {
9049 return m_cbPolygonSmoothing->GetValue();
9052bool OpenGLOptionsDlg::GetLineSmoothing(
void)
const {
9053 return m_cbLineSmoothing->GetValue();
9056bool OpenGLOptionsDlg::GetShowFPS(
void)
const {
9057 return m_cbShowFPS->GetValue();
9060bool OpenGLOptionsDlg::GetSoftwareGL(
void)
const {
9061 return m_cbSoftwareGL->GetValue();
9064bool OpenGLOptionsDlg::GetTextureCompressionCaching(
void)
const {
9065 return m_cbTextureCompressionCaching->GetValue();
9068bool OpenGLOptionsDlg::GetRebuildCache(
void)
const {
return m_brebuild_cache; }
9070int OpenGLOptionsDlg::GetTextureMemorySize(
void)
const {
9071 return m_sTextureMemorySize->GetValue();
9074void OpenGLOptionsDlg::Populate(
void) {
9076 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9084 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9085 m_memorySize->Show(g_bGLexpert);
9086 m_sTextureMemorySize->Show(g_bGLexpert);
9088 m_cbTextureCompressionCaching->SetValue(
9089 g_GLOptions.m_bTextureCompressionCaching);
9090 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9092 m_cbShowFPS->SetValue(g_bShowFPS);
9093 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9094 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9096#if defined(__UNIX__) && !defined(__OCPN__ANDROID__) && !defined(__WXOSX__)
9097 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9098 if (gFrame->GetPrimaryCanvas()
9100 ->GetVersionString()
9102 .Find(_T(
"MESA" )) != wxNOT_FOUND)
9103 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9106 m_cbSoftwareGL->Hide();
9109 wxFont* dialogFont = GetOCPNScaledFont(_(
"Dialog"));
9110 SetFont(*dialogFont);
9113 if (gFrame->GetPrimaryCanvas()->GetglCanvas()) {
9114 if (gFrame->GetPrimaryCanvas()->GetglCanvas()->CanAcceleratePanning()) {
9115 m_cbUseAcceleratedPanning->Enable();
9116 m_cbUseAcceleratedPanning->SetValue(
9117 g_GLOptions.m_bUseAcceleratedPanning);
9119 m_cbUseAcceleratedPanning->SetValue(FALSE);
9120 m_cbUseAcceleratedPanning->Disable();
9123 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9126 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9127 m_cbUseAcceleratedPanning->Disable();
9131void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9132 if (g_GLOptions.m_bTextureCompressionCaching) {
9133 m_brebuild_cache = TRUE;
9134 EndModal(wxID_CANCEL);
9138void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9139 if (g_bopengl && g_glTextureManager) {
9140 ::wxBeginBusyCursor();
9141 g_glTextureManager->ClearAllRasterTextures();
9143 wxString path = g_Platform->GetPrivateDataDir();
9144 appendOSDirSlash(&path);
9145 path.append(_T(
"raster_texture_cache"));
9147 if (::wxDirExists(path)) {
9148 wxArrayString files;
9149 size_t nfiles = wxDir::GetAllFiles(path, &files);
9150 for (
unsigned int i = 0; i < files.GetCount(); i++)
9151 ::wxRemoveFile(files[i]);
9154 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9155 ::wxEndBusyCursor();
9159wxString OpenGLOptionsDlg::GetTextureCacheSize(
void) {
9160 wxString path = g_Platform->GetPrivateDataDir();
9161 appendOSDirSlash(&path);
9162 path.append(_T(
"raster_texture_cache"));
9163 long long total = 0;
9165 if (::wxDirExists(path)) {
9166 wxArrayString files;
9167 size_t nfiles = wxDir::GetAllFiles(path, &files);
9168 for (
unsigned int i = 0; i < files.GetCount(); i++)
9169 total += wxFile(files[i]).Length();
9171 double mb = total / (1024.0 * 1024.0);
9172 if (mb < 10000.0)
return wxString::Format(_T(
"%.1f MB" ), mb);
9174 return wxString::Format(_T(
"%.1f GB" ), mb);
9182EVT_PAINT(CanvasConfigSelect::OnPaint)
9186 wxWindowID
id, wxBitmap& bmp,
9187 const wxPoint& pos, const wxSize& size)
9188 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9189 m_parentOptions = parentOptions;
9194 int refHeight = GetCharHeight();
9196 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9197 bmp.GetSize().y + m_borderWidth * 2));
9199 Connect(wxEVT_LEFT_DOWN,
9200 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9203CanvasConfigSelect::~CanvasConfigSelect() {}
9205void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9211 if (m_parentOptions)
9212 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9215void CanvasConfigSelect::SetSelected(
bool selected) {
9216 m_bSelected = selected;
9220 GetGlobalColor(_T(
"UIBCK"), &colour);
9221 m_boxColour = colour;
9223 GetGlobalColor(_T(
"DILG0"), &colour);
9224 m_boxColour = colour;
9230void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9232 GetSize(&width, &height);
9235 dc.SetBackground(*wxLIGHT_GREY);
9237 dc.SetPen(*wxTRANSPARENT_PEN);
9238 dc.SetBrush(wxBrush(GetBackgroundColour()));
9239 dc.DrawRectangle(GetVirtualSize());
9244 dc.SetBrush(wxBrush(m_boxColour));
9246 GetGlobalColor(_T (
"UITX1" ), &c);
9247 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
9249 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9251 dc.SetBrush(wxBrush(m_boxColour));
9253 GetGlobalColor(_T (
"UITX1" ), &c);
9254 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
9256 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9259 dc.DrawBitmap(m_bmpNormal, m_borderWidth, m_borderWidth,
false);
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.