52#include <wx/clrpicker.h>
55#include <wx/display.h>
56#include <wx/fontdata.h>
57#include <wx/fontdlg.h>
58#include <wx/imaglist.h>
59#include <wx/listbox.h>
60#include <wx/mediactrl.h>
61#include <wx/odcombo.h>
62#include <wx/progdlg.h>
63#include <wx/radiobox.h>
65#include <wx/renderer.h>
66#include <wx/statline.h>
67#include <wx/stdpaths.h>
68#include <wx/textwrapper.h>
69#include <wx/tokenzr.h>
71#if defined(__WXGTK__) || defined(__WXQT__)
72#include <wx/colordlg.h>
83#include "o_sound/o_sound.h"
131static inline wxString ttDistance() {
133 "Horizontal measurements and distances. Examples: Distance between "
134 "geographic positions, visibility range, radar range.");
136static inline wxString ttSpeed() {
137 return _(
"Vessel and surface speed measurements");
139static inline wxString ttWindSpeed() {
140 return _(
"Wind speed measurements and forecasts");
142static inline wxString ttDepth() {
143 return _(
"Measurements below the water surface");
145static inline wxString ttHeight() {
147 "Vertical measurements above reference datum. Examples: Tide level, wave "
148 "height, air gap, mast clearance, elevation above reference datum.");
150static inline wxString ttTemp() {
151 return _(
"Temperature measurements (air, water, engine)");
153static inline wxString ttCoordFormat() {
154 return _(
"Coordinate display format for latitude and longitude");
162#include "androidUTIL.h"
166#include <QtWidgets/QScroller>
170#if wxCHECK_VERSION(3, 2, 0)
171#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
173#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS
176#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
179#define ID_CHOICE_NMEA wxID_HIGHEST + 1
185extern wxLocale* plocale_def_lang;
193extern int g_Android_SDK_Version;
194extern MigrateAssistantDialog* g_migrateDialog;
197static wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
199static wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
202static int lang_list[] = {
203 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
204 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
205 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
206 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
207 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
208 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
209 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
210 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
212 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
213 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
214 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
215 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
216 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
217 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
225 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
226 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
227 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
228 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
229 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
230 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
231 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
232 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
233 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
234 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
235 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
236 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
237 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
238 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
239 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
240 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
241 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
242 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
243 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
244 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
245 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
246 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
247 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
248 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
249 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
252 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
253 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
254 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
255 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
256 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
258 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
259 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
260 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
261 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
262 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
263 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
264 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
265 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
266 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
267 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
268 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
269 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
270 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
271 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
272 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
273 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
274 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
275 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
276 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
278 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
279 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
280 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
281 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
282 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
283 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
284 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
285 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
286 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
287 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
288 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
289 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
290 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
294void prepareSlider(wxSlider* slider) {
295 slider->GetHandle()->setStyleSheet(
296 prepareAndroidSliderStyleSheet(slider->GetSize().x));
297 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
298 slider->GetHandle()->grabGesture(Qt::PanGesture);
299 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
305class ChartDirPanelHardBreakWrapper :
public wxTextWrapper {
307 ChartDirPanelHardBreakWrapper(wxWindow* win,
const wxString& text,
312 wxString textMod = text;
313 textMod.Replace(
" ",
"^");
316 wxString sep = wxFileName::GetPathSeparator();
317 textMod.Replace(sep,
" ");
319 Wrap(win, textMod, widthMax);
322 for (
size_t i = 0; i < m_array.GetCount(); i++) {
323 wxString a = m_array[i];
325 if (m_array.GetCount() > 1) {
326 if (i < m_array.GetCount() - 1) a += sep;
332 wxString
const& GetWrapped()
const {
return m_wrapped; }
333 int const GetLineCount()
const {
return m_lineCount; }
334 wxArrayString GetLineArray() {
return m_array; }
337 virtual void OnOutputLine(
const wxString& line) {
341 virtual void OnNewLine() {
349 wxArrayString m_array;
352class OCPNChartDirPanel :
public wxPanel {
354 OCPNChartDirPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
356 ~OCPNChartDirPanel();
358 void DoChartSelected();
359 void SetSelected(
bool selected);
360 void OnPaint(wxPaintEvent& event);
362 void OnSize(wxSizeEvent& event);
364 int GetUnselectedHeight() {
return m_unselectedHeight; }
365 int GetRefHeight() {
return m_refHeight; }
366 bool IsSelected() {
return m_bSelected; }
367 void OnClickDown(wxMouseEvent& event);
368 void OnClickUp(wxMouseEvent& event);
373 wxColour m_boxColour;
374 int m_unselectedHeight;
375 wxString m_pChartDir;
379 DECLARE_EVENT_TABLE()
383EVT_PAINT(OCPNChartDirPanel::OnPaint)
385EVT_SIZE(OCPNChartDirPanel::OnSize)
389 const wxPoint& pos, const wxSize& size,
391 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
392 m_pChartDir = cdi.fullpath;
395 if (cdi.fullpath.StartsWith(
396 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
397 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
402 m_refHeight = GetCharHeight();
404 m_unselectedHeight = 2 * m_refHeight;
410 SetMinSize(wxSize(-1, m_unselectedHeight));
412 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
415 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
420OCPNChartDirPanel::~OCPNChartDirPanel() {}
422static wxStopWatch swclick;
424static int downx, downy;
427void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
430 event.GetPosition(&downx, &downy);
436void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
438 qDebug() << swclick.Time();
439 if (swclick.Time() < 200) {
441 event.GetPosition(&upx, &upy);
442 if ((fabs(upx - downx) < GetCharWidth()) &&
443 (fabs(upy - downy) < GetCharWidth())) {
451void OCPNChartDirPanel::DoChartSelected() {
461void OCPNChartDirPanel::SetSelected(
bool selected) {
462 m_bSelected = selected;
466 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
469 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
474 g_pOptions->SetDirActionButtons();
481void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
482 if (m_pChartDir.Length()) {
484 GetClientSize(&x, &y);
486 ChartDirPanelHardBreakWrapper wrapper(
this, m_pChartDir, x * 9 / 10);
487 wxArrayString nameWrapped = wrapper.GetLineArray();
489 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
495void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
497 GetSize(&width, &height);
500 dc.SetPen(*wxTRANSPARENT_PEN);
501 dc.SetBrush(wxBrush(GetBackgroundColour()));
502 dc.DrawRectangle(GetVirtualSize());
504 wxString nameString = m_pChartDir;
505 ChartDirPanelHardBreakWrapper wrapper(
this, nameString, width * 9 / 10);
506 wxArrayString nameWrapped = wrapper.GetLineArray();
508 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
509 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
510 GetParent()->GetSizer()->Layout();
514 dc.SetBrush(wxBrush(m_boxColour));
516 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
518 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
520 int offset = height / 10;
521 int text_x = offset * 2;
523 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
526 dc.SetTextForeground(
527 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
529 int yd = height * 20 / 100;
530 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
532 dc.DrawText(nameWrapped[i], text_x, yd);
534 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
535 yd += GetCharHeight();
539 dc.SetBrush(wxBrush(m_boxColour));
542 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME),
545 int offset = height / 10;
546 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
547 height - (2 * offset), height / 10);
549 int text_x = offset * 2;
551 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
554 dc.SetTextForeground(
555 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
557 int yd = height * 20 / 100;
558 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
560 dc.DrawText(nameWrapped[i], text_x, yd);
562 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
563 yd += GetCharHeight();
571static bool LoadAllPlugIns(
bool load_enabled) {
572 g_Platform->ShowBusySpinner();
573 bool b = PluginLoader::GetInstance()->LoadAllPlugIns(load_enabled);
574 g_Platform->HideBusySpinner();
578class OCPNCheckedListCtrl :
public wxScrolledWindow {
580 OCPNCheckedListCtrl() {}
582 OCPNCheckedListCtrl(wxWindow* parent, wxWindowID
id = -1,
583 const wxPoint& pt = wxDefaultPosition,
584 const wxSize& sz = wxDefaultSize,
585 long style = wxHSCROLL | wxVSCROLL,
586 const wxString& name =
"scrolledWindow") {
587 Create(parent,
id, pt, sz, style, name);
590 bool Create(wxWindow* parent, wxWindowID
id = -1,
591 const wxPoint& pt = wxDefaultPosition,
592 const wxSize& sz = wxDefaultSize,
593 long style = wxHSCROLL | wxVSCROLL,
594 const wxString& name =
"scrolledWindow");
596 virtual ~OCPNCheckedListCtrl() {}
598 unsigned int Append(wxString& label,
bool benable =
true,
599 bool bsizerLayout =
true);
600 unsigned int GetCount() {
return m_list.size(); }
605 void Check(
int index,
bool val);
606 bool IsChecked(
int index);
611 std::vector<wxCheckBox*> m_list;
614bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
615 const wxPoint& pt,
const wxSize& sz,
616 long style,
const wxString& name) {
617 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
620 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
621 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
625 m_sizer =
new wxBoxSizer(wxVERTICAL);
631unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable,
633 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
635 cb->SetValue(!benable);
637 if (bsizerLayout) m_sizer->Layout();
639 m_list.push_back(cb);
641 return m_list.size() - 1;
644void OCPNCheckedListCtrl::Check(
int index,
bool val) {
645 wxCheckBox* cb = m_list[index];
646 if (cb) cb->SetValue(val);
649bool OCPNCheckedListCtrl::IsChecked(
int index) {
650 wxCheckBox* cb = m_list[index];
651 return cb ? cb->GetValue() :
false;
654void OCPNCheckedListCtrl::RunLayout() { m_sizer->Layout(); }
656void OCPNCheckedListCtrl::Clear() {
657 for (
auto cb : m_list)
delete cb;
663void appendOSDirSlash(wxString* pString);
672EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
673EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
677 const wxString& caption,
678 const wxPoint& pos, const wxSize& size,
680 : wxDialog(parent,
id, caption, pos, size,
681 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
683 GetSizer()->SetSizeHints(
this);
687ConfigCreateDialog::~ConfigCreateDialog() {}
689void ConfigCreateDialog::CreateControls() {
690 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
693 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
694 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
696 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
697 wxSize(40 * GetCharHeight(), -1), 0);
698 mainSizer->Add(m_TitleCtl, 0,
699 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
701 mainSizer->AddSpacer(2 * GetCharHeight());
703 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
704 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
707 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
708 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
709 mainSizer->Add(m_DescriptionCtl, 0,
710 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
712 mainSizer->AddSpacer(2 * GetCharHeight());
717 _(
"Create a private configuration template based on current settings.\n\
718This template will be saved, and may be selected for further use at any time.\n\
720 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
722 mainSizer->AddSpacer(2 * GetCharHeight());
724 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
725 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
727 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
728 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
730 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
731 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
732 m_OKButton->SetDefault();
735void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
736 EndModal(wxID_CANCEL);
739void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
740 const wxString& title = m_TitleCtl->GetValue();
741 const wxString& desc = m_DescriptionCtl->GetValue();
742 m_createdTemplateGUID = ConfigMgr::Get().CreateNamedConfig(title, desc,
"");
751EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
752EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
756 wxWindowID
id, const wxString& caption,
757 const wxPoint& pos, const wxSize& size,
759 : wxDialog(parent,
id, caption, pos, size,
760 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
763 GetSizer()->SetSizeHints(
this);
767MMSIEditDialog::~MMSIEditDialog() {
delete m_MMSICtl; }
769void MMSIEditDialog::CreateControls() {
770 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
773 wxStaticBox* mmsiBox =
774 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
776 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
777 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
779 wxStaticText* mmsiLabel =
new wxStaticText(
this, wxID_STATIC, _(
"MMSI"));
780 mmsiLabel->SetToolTip(
781 _(
"Maritime Mobile Service Identity - A unique 9-digit number assigned "
782 "to a vessel or navigation aid. Used to identify vessels and devices "
783 "in AIS transmissions and DSC calls."));
784 mmsiSizer->Add(mmsiLabel, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
786 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
787 wxDefaultPosition, wxSize(180, -1), 0);
788 m_MMSICtl->SetToolTip(
789 _(
"Enter the 9-digit MMSI number for this vessel or station"));
790 mmsiSizer->Add(m_MMSICtl, 0,
791 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
792 m_MMSICtl->Bind(wxEVT_TEXT, &MMSIEditDialog::OnMMSIChanged,
this);
794 wxStaticText* userLabelText =
new wxStaticText(
this, wxID_STATIC, _(
"Name"));
795 userLabelText->SetToolTip(
796 _(
"Display name for this vessel or device - can override names received "
798 mmsiSizer->Add(userLabelText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
800 m_ShipNameCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
801 wxDefaultPosition, wxSize(180, -1), 0);
802 m_ShipNameCtl->SetToolTip(_(
803 "Set the name for this vessel or device. If specified, this name takes "
804 "precedence over names received via AIS messages. Note that standard AIS "
805 "only supports uppercase letters (A-Z), numbers, and limited "
806 "punctuation. Your manual entries are stored in the mmsitoname.csv file "
807 "and preserved across sessions."));
808 mmsiSizer->Add(m_ShipNameCtl, 0,
809 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
811 wxStaticBox* trackBox =
new wxStaticBox(
this, wxID_ANY, _(
"Tracking"));
812 trackBox->SetToolTip(_(
"Control how tracks are created for this MMSI"));
813 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackBox, wxVERTICAL);
815 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
817 m_rbTypeTrackDefault =
818 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
819 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
820 m_rbTypeTrackDefault->SetToolTip(
821 _(
"Use the global tracking settings for this vessel"));
822 m_rbTypeTrackDefault->SetValue(TRUE);
823 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
825 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
826 m_rbTypeTrackAlways->SetToolTip(_(
827 "Always create a track for this vessel, regardless of global settings"));
828 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
830 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
831 m_rbTypeTrackNever->SetToolTip(
832 _(
"Never create a track for this vessel, regardless of global settings"));
833 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
835 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
836 m_cbTrackPersist->SetToolTip(
837 _(
"Save this vessel's track between OpenCPN sessions. Useful for vessels "
838 "you want to monitor continuously over time."));
839 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
841 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
842 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
844 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
845 m_IgnoreButton->SetToolTip(
846 _(
"When checked, AIS data for this MMSI will be ignored and the vessel "
847 "will not appear on the chart. Useful for suppressing shore stations, "
848 "permanently moored vessels, or duplicate AIS signals that you don't "
849 "need to monitor."));
850 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
852 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
853 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
854 m_MOBButton->SetToolTip(
855 _(
"When checked, OpenCPN will display a special icon for this device, "
856 "sound a distinctive alarm, and automatically create a temporary MOB "
857 "route from your vessel to this device in emergency. For crew safety "
858 "devices, you can assign the crew member's name using the Name "
859 "field above for quick identification."));
860 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
863 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
864 m_VDMButton->SetToolTip(
865 _(
"When checked, converts AIS messages for this vessel from AIVDM (other "
866 "vessel) to AIVDO (own vessel) format."));
867 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
869 m_FollowerButton =
new wxCheckBox(
870 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
871 m_FollowerButton->SetToolTip(
872 _(
"When checked, disables CPA (Closest Point of Approach) alerts for "
873 "this vessel as it's considered intentionally following your vessel. "
874 "Follower vessels are displayed with a special own-ship style icon."));
875 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
877 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
878 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
880 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
881 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
883 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
884 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
885 m_OKButton->SetDefault();
889 if (m_props->MMSI > 0)
890 sMMSI.Printf(
"%d", m_props->MMSI);
893 m_MMSICtl->AppendText(sMMSI);
896 if (!m_props->m_ShipName.IsEmpty()) {
897 m_ShipNameCtl->SetValue(m_props->m_ShipName);
900 switch (m_props->TrackType) {
901 case TRACKTYPE_ALWAYS:
902 m_rbTypeTrackAlways->SetValue(TRUE);
904 case TRACKTYPE_NEVER:
905 m_rbTypeTrackNever->SetValue(TRUE);
911 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
912 m_IgnoreButton->SetValue(m_props->m_bignore);
913 m_MOBButton->SetValue(m_props->m_bMOB);
914 m_VDMButton->SetValue(m_props->m_bVDM);
915 m_FollowerButton->SetValue(m_props->m_bFollower);
917 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
920void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
922void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
923 EndModal(wxID_CANCEL);
926void MMSIEditDialog::Persist() {
928 if (m_rbTypeTrackDefault->GetValue())
929 m_props->TrackType = TRACKTYPE_DEFAULT;
930 else if (m_rbTypeTrackAlways->GetValue())
931 m_props->TrackType = TRACKTYPE_ALWAYS;
933 m_props->TrackType = TRACKTYPE_NEVER;
935 m_props->m_bignore = m_IgnoreButton->GetValue();
936 m_props->m_bMOB = m_MOBButton->GetValue();
937 m_props->m_bVDM = m_VDMButton->GetValue();
938 m_props->m_bFollower = m_FollowerButton->GetValue();
939 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
942 wxString shipName = m_ShipNameCtl->GetValue().Upper();
943 if (!shipName.IsEmpty()) {
944 m_props->m_ShipName = shipName;
947 wxString mmsi = m_MMSICtl->GetValue();
948 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
949 g_pAIS->UpdateMMSItoNameFile(mmsi, shipName);
954 else if (m_props->m_ShipName == wxEmptyString) {
955 auto proptarget =
g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
957 wxString s = proptarget->GetFullName();
958 m_props->m_ShipName = s;
960 wxString GetShipNameFromFile(
int);
961 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
967void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
971 m_MMSICtl->GetValue().ToLong(&nmmsi);
972 m_props->MMSI = nmmsi;
975 if (m_MMSICtl->GetValue().Length() != 9) {
976 OCPNMessageDialog* dlg =
new OCPNMessageDialog(
978 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
979 "your entries and cancel if necessary."),
980 _(
"OpenCPN Info"), wxOK | wxCANCEL);
982 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
983 if (retcode == wxID_OK) {
994void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
996void MMSIEditDialog::OnMMSIChanged(wxCommandEvent& event) {
997 wxString mmsi = m_MMSICtl->GetValue();
1000 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1002 wxString shipName =
g_pAIS->GetMMSItoNameEntry(mmsi);
1005 if (shipName.IsEmpty()) {
1006 auto target =
g_pAIS->Get_Target_Data_From_MMSI(wxAtoi(mmsi));
1008 shipName = target->GetFullName();
1013 if (!shipName.IsEmpty()) {
1014 m_ShipNameCtl->SetValue(shipName);
1022EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1023EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1024EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1025 MMSIListCtrl::OnListItemRightClick)
1026EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1027EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1031 const wxSize& size,
long style)
1032 : wxListCtrl(parent,
id, pos, size, style) {
1036MMSIListCtrl::~MMSIListCtrl() {}
1038wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1042 if (!props)
return ret;
1045 if (props->MMSI > 0) ret = wxString::Format(
"%d", props->MMSI);
1048 switch (props->TrackType) {
1049 case TRACKTYPE_DEFAULT:
1052 case TRACKTYPE_ALWAYS:
1055 case TRACKTYPE_NEVER:
1061 if (props->m_bPersistentTrack) ret.Append(
", ").Append(_(
"Persistent"));
1064 if (props->m_bignore) ret =
"X";
1067 if (props->m_bMOB) ret =
"X";
1070 if (props->m_bVDM) ret =
"X";
1073 if (props->m_bFollower) ret =
"X";
1076 ret = props->m_ShipName;
1085void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1087void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1089 MmsiProperties* props_new =
new MmsiProperties(*props);
1091 MMSIEditDialog* pd =
1092 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1093 wxDefaultPosition, wxSize(200, 200));
1095 if (pd->ShowModal() == wxID_OK) {
1105void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1106 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1107 if (m_context_item == wxNOT_FOUND)
return;
1108 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1110 wxMenuItem* item_edit =
1111 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") +
"...");
1114 item_edit->SetFont(sFont);
1116 menu->Append(item_edit);
1118 wxMenuItem* item_delete =
1119 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1121 item_delete->SetFont(sFont);
1123 menu->Append(item_delete);
1127 item_edit->SetFont(*qFont);
1128 item_delete->SetFont(*qFont);
1131 wxPoint p = ScreenToClient(wxGetMousePosition());
1132 PopupMenu(menu, p.x, p.y);
1138void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1139 int context_item = m_context_item;
1144 switch (event.GetId()) {
1145 case ID_DEF_MENU_MMSI_EDIT: {
1146 MmsiProperties* props_new =
new MmsiProperties(*props);
1147 MMSIEditDialog* pd =
1148 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1149 wxDefaultPosition, wxSize(200, 200));
1151 if (pd->ShowModal() == wxID_OK) {
1154 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1164 case ID_DEF_MENU_MMSI_DELETE:
1173MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1174 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1181 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1184 wxString MMSI_props_column_spec =
"120;120;100;100;100;100;100;100";
1186 wxStringTokenizer tkz(MMSI_props_column_spec,
";");
1187 wxString s_width = tkz.GetNextToken();
1191 m_pListCtrlMMSI =
new MMSIListCtrl(
1192 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1193 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1202 int dx = GetCharWidth();
1204 GetTextExtent(
"W", &dx, NULL, NULL, NULL, qFont);
1207 m_pListCtrlMMSI->InsertColumn(mlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, dx * 10);
1208 m_pListCtrlMMSI->InsertColumn(mlTrackMode, _(
"Track Mode"),
1209 wxLIST_FORMAT_CENTER, dx * 20);
1210 m_pListCtrlMMSI->InsertColumn(mlIgnore, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1212 m_pListCtrlMMSI->InsertColumn(mlMOB, _(
"MOB"), wxLIST_FORMAT_CENTER, dx * 5);
1213 m_pListCtrlMMSI->InsertColumn(mlVDM, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1215 m_pListCtrlMMSI->InsertColumn(mlShipName, _(
"Ship name"),
1216 wxLIST_FORMAT_CENTER, dx * 20);
1217 m_pListCtrlMMSI->InsertColumn(mlFollower, _(
"Follower"), wxLIST_FORMAT_CENTER,
1220 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1222 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1224 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1225 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1227 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1234 SetSize(GetSize().x, GetSize().y - 1);
1236 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1239MMSI_Props_Panel::~MMSI_Props_Panel() {}
1241void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1242 MmsiProperties* props =
new MmsiProperties(-1);
1244 MMSIEditDialog* pd =
1245 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1246 wxDefaultPosition, wxSize(200, 200));
1249 if (pd->ShowModal() == wxID_OK) {
1257void MMSI_Props_Panel::UpdateMMSIList() {
1259 long selItemID = wxNOT_FOUND;
1260 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1261 wxLIST_STATE_SELECTED);
1263 int selMMSI = wxNOT_FOUND;
1266 m_pListCtrlMMSI->DeleteAllItems();
1271 m_pListCtrlMMSI->InsertItem(item);
1272 for (
int j = 0; j < mlFollower + 1; j++) {
1274 item.SetText(m_pListCtrlMMSI->OnGetItemText(i, j));
1275 m_pListCtrlMMSI->SetItem(item);
1280 long item_sel = wxNOT_FOUND;
1281 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1291 m_pListCtrlMMSI->SetItemState(item_sel,
1292 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1293 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1296 m_pListCtrlMMSI->Refresh(FALSE);
1300void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1306class OCPNFatCombo :
public wxOwnerDrawnComboBox {
1310 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value =
"",
1311 const wxPoint& pos = wxDefaultPosition,
1312 const wxSize& size = wxDefaultSize,
int n = 0,
1313 const wxString choices[] = NULL,
long style = 0,
1314 const wxValidator& validator = wxDefaultValidator,
1315 const wxString& name =
"OCPNFatCombo");
1319 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1320 wxCoord OnMeasureItem(
size_t item)
const;
1321 wxCoord OnMeasureItemWidth(
size_t item)
const;
1322 bool SetFont(
const wxFont& font);
1324 int Append(
const wxString& item, wxBitmap bmp);
1327 const wxFont* dfont;
1331 ArrayOfBitmaps bmpArray;
1334OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1336OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1337 const wxString& value,
const wxPoint& pos,
1338 const wxSize& size,
int n,
const wxString choices[],
1339 long style,
const wxValidator& validator,
1340 const wxString& name)
1341 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1344 GetFont().GetPointSize() /
g_Platform->getFontPointsperPixel();
1345 itemHeight = (int)wxRound(fontHeight);
1346 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1349OCPNFatCombo::~OCPNFatCombo() {}
1351bool OCPNFatCombo::SetFont(
const wxFont& font) {
1356void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1363 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1364 wxBrush br = wxBrush(bg);
1365 wxBrush sv = dc.GetBrush();
1367 dc.DrawRectangle(0, 0, rect.width, rect.height);
1369 dc.SetTextForeground(wxColour(0, 0, 0));
1371 if (flags & wxODCB_PAINTING_CONTROL) {
1372 wxString text = GetValue();
1374 dc.DrawText(text, rect.x + margin_x + offset_x,
1375 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1377 dc.SetBackground(wxBrush(br));
1379 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1380 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1384wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1385 if (item < bmpArray.GetCount())
1386 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1388 return itemHeight * 12 / 10;
1391wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1393int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1395 int idx = wxOwnerDrawnComboBox::Append(item);
1400void OCPNFatCombo::Clear() {
1401 wxOwnerDrawnComboBox::Clear();
1405BEGIN_EVENT_TABLE(
options, wxDialog)
1406EVT_INIT_DIALOG(options::OnDialogInit)
1407EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1408EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1409EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1410EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1411EVT_BUTTON(ID_REBUILDBUTTON, options::OnButtonRebuildChartDb)
1412EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1413EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1414EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1415EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1416EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1417EVT_BUTTON(xID_OK, options::OnXidOkClick)
1418EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1419EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1420EVT_BUTTON(ID_BUTTONFONT_RESET, options::OnResetFont)
1421EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1423EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1424EVT_CLOSE(options::OnClose)
1426#if defined(__WXGTK__) || defined(__WXQT__)
1427EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1430EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1432EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1433EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1434EVT_CHOICE(ID_HEIGHTUNITSCHOICE, options::OnUnitsChoice)
1435EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1436EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1437EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1438EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1439EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1440EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1441EVT_CHAR_HOOK(options::OnCharHook)
1446 const wxString& caption, const wxPoint& pos,
1447 const wxSize& size,
long style)
1448 : pTrackRotateTime(0), m_callbacks(callbacks) {
1453 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1455 wxDialog::Create(parent,
id, caption, pos, size, style,
"Options");
1456 SetFont(*dialogFont);
1459 RecalculateSize(size.x, size.y);
1461 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1463 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1464 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1465 PluginLoader::GetInstance()->LoadAllPlugIns(
false);
1466 m_pPlugInCtrl->ReloadPluginPanels();
1468 auto action = [&](wxCommandEvent& evt) {
1469 g_persist_active_route = m_persist_active_route_chkbox->IsChecked();
1471 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1472 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1475 m_OnChartDb_finalize_listener.Init(
1476 GuiEvents::GetInstance().on_finalize_chartdbs,
1477 [&](
ObservedEvt& ev) { OptionsFinalizeChartDBUpdate(); });
1478 Bind(wxEVT_SYS_COLOUR_CHANGED,
1479 [&](wxSysColourChangedEvent& ev) { OnColorChange(ev); });
1482options::~options() {
1484 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1486 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1487 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1490 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1492 delete m_pSerialArray;
1493 delete m_pGroupArray;
1494 delete m_topImgList;
1498 delete m_pPlugInCtrl;
1501 delete m_PluginCatalogMgrPanel;
1505#ifdef OCPN_OPTIONS_USE_LISTBOOK
1506void options::OnColorChange() {
1507 auto foreground = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT);
1508 auto background = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
1509 m_pListbook->GetListView()->SetBackgroundColour(background);
1510 m_pListbook->GetListView()->SetForegroundColour(foreground);
1513void options::OnColorChange() {}
1516void options::OnColorChange(wxSysColourChangedEvent& ev) {
1522bool options::SendIdleEvents(wxIdleEvent& event) {
1523 if (IsShown())
return wxDialog::SendIdleEvents(event);
1527void options::OptionsFinalizeChartDBUpdate() {
1532 g_GLOptions.m_bTextureCompressionCaching = m_bTextureCacheingSave;
1534 m_OKButton->Enable();
1535 m_CancelButton->Enable();
1536 m_ApplyButton->Enable();
1539void options::RecalculateSize(
int hint_x,
int hint_y) {
1540 if (!g_bresponsive) {
1541 m_nCharWidthMax = GetSize().x / GetCharWidth();
1545 if ((hint_x < 200) || (hint_y < 200)) {
1547 int display_width, display_height;
1551 if (display_height < 600) {
1554 vectorPanel->SetSizeHints(ps57Ctl);
1564 esize.x = GetCharWidth() * 110;
1565 esize.y = GetCharHeight() * 40;
1567 wxSize dsize = GetParent()->GetSize();
1568 esize.y = wxMin(esize.y, dsize.y - 0 );
1569 esize.x = wxMin(esize.x, dsize.x - 0 );
1572 wxSize fsize = GetSize();
1573 wxSize canvas_size = GetParent()->GetSize();
1574 wxPoint screen_pos = GetParent()->GetScreenPosition();
1575 int xp = (canvas_size.x - fsize.x) / 2;
1576 int yp = (canvas_size.y - fsize.y) / 2;
1577 Move(screen_pos.x + xp, screen_pos.y + yp);
1579 m_nCharWidthMax = GetSize().x / GetCharWidth();
1582void options::Init() {
1583 m_pWorkDirList = NULL;
1585 pShowStatusBar = NULL;
1586 pShowMenuBar = NULL;
1587 pShowCompassWin = NULL;
1590 m_scrollWinChartList = NULL;
1591 ps57CtlListBox = NULL;
1593 m_pSerialArray = NULL;
1594 pUpdateCheckBox = NULL;
1595 pParseENCButton = NULL;
1601 pSoundDeviceIndex = NULL;
1605 pCBLookAhead = NULL;
1606 pCDOQuilting = NULL;
1607 pPreserveScale = NULL;
1608 pSmoothPanZoom = NULL;
1609 pEnableZoomToCursor = NULL;
1610 pSDisplayGrid = NULL;
1611 pCDOOutlines = NULL;
1612 pSDepthUnits = NULL;
1614 pSDefaultBoatSpeed = NULL;
1617 itemActiveChartStaticBox = NULL;
1619 pCheck_SOUNDG = NULL;
1621 pCheck_SHOWIMPTEXT = NULL;
1622 pCheck_SCAMIN = NULL;
1623 pCheck_ATONTEXT = NULL;
1624 pCheck_LDISTEXT = NULL;
1625 pCheck_XLSECTTEXT = NULL;
1627 m_bVisitLang = FALSE;
1628 m_bVisitPlugins = FALSE;
1629 m_itemFontElementListBox = NULL;
1630 m_textSample = NULL;
1631 m_topImgList = NULL;
1634 m_pGroupArray = NULL;
1635 m_groups_changed = 0;
1638 m_pageConnections = -1;
1643 m_pageConnections = -1;
1645 pEnableTenHertz =
nullptr;
1647 auto loader = PluginLoader::GetInstance();
1648 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
1649 b_oldhaveWMM = b_haveWMM;
1654 m_bForceNewToolbaronCancel =
false;
1656 m_cs = (ColorScheme)0;
1659 m_pPlugInCtrl = NULL;
1660 m_PluginCatalogMgrPanel = NULL;
1674 m_bVectorInit =
false;
1679 pCmdSoundString = NULL;
1681 m_sconfigSelect_single = NULL;
1682 m_sconfigSelect_twovertical = NULL;
1685 dc.SetFont(*dialogFont);
1687 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, dialogFont);
1689 m_colourPickerDefaultSize =
1702 auto sound_action = [](ObservedEvt ev) {
1703 auto sound =
static_cast<o_sound::Sound*
>(ev.GetClientData());
1717 {_(
"Nautical miles"), DISTANCE_NMI},
1718 {_(
"Statute miles"), DISTANCE_MI},
1719 {_(
"Kilometers"), DISTANCE_KM},
1720 {_(
"Meters"), DISTANCE_M}};
1722static const int kNumDistanceFormats =
1726static int GetDistanceFormatIndex(
int enumValue) {
1727 for (
int i = 0; i < kNumDistanceFormats; i++) {
1728 if (kDistanceFormats[i].enumValue == enumValue) {
1736static int GetDistanceFormatEnum(
int index) {
1737 if (index >= 0 && index < kNumDistanceFormats) {
1738 return kDistanceFormats[index].enumValue;
1740 return DISTANCE_NMI;
1743#if defined(__GNUC__) && __GNUC__ < 8
1746static const wxString BAD_ACCESS_MSG = _(
1747 "The device selected is not accessible; opencpn will likely not be able\n"
1748 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1749 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1750 "with the following contents:\n\n"
1751 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1752 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1753 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1754 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1758static const wxString BAD_ACCESS_MSG = _(R
"(
1759The device selected is not accessible; opencpn will likely not be able
1760to use this device as-is. You might want to exit OpenCPN, reboot and
1761retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1762with the following contents:
1764 KERNEL=="ttyUSB*", MODE="0666"
1765 KERNEL=="ttyACM*", MODE="0666"
1766 KERNEL=="ttyS*", MODE="0666"
1768For more info, see the file LINUX_DEVICES.md in the distribution docs.
1773void options::OnDialogInit(wxInitDialogEvent& event) {}
1775void options::CheckDeviceAccess( wxString& path) {}
1777size_t options::CreatePanel(
const wxString& title) {
1778 size_t id = m_pListbook->GetPageCount();
1781 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1782 wxDefaultSize, wxTAB_TRAVERSAL, title);
1783 m_pListbook->AddPage(panel, title, FALSE,
id);
1787wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1788 if (parent > m_pListbook->GetPageCount() - 1) {
1790 wxString::Format(
"Warning: invalid parent in options::AddPage( %d, ",
1795 wxNotebookPage* page = m_pListbook->GetPage(parent);
1797 wxScrolledWindow* sw;
1799 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1800 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1802 for (
size_t i_page = 0; i_page < nb->GetPageCount(); i_page++) {
1803 wxString candidate_title = nb->GetPageText(i_page);
1804 if (candidate_title.IsSameAs(title))
1805 return static_cast<wxScrolledWindow*
>(nb->GetPage(i_page));
1808 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1810 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1811 nb->AddPage(sw, title);
1812 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1813 wxString toptitle = m_pListbook->GetPageText(parent);
1814 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1815 wxDefaultSize, wxNB_TOP);
1818 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1819 m_pListbook->SetSelection(0);
1820 m_pListbook->RemovePage(parent + 1);
1821 wxString previoustitle = page->GetName();
1823 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1824 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1826 nb->AddPage(page, previoustitle);
1830 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1832 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1833 nb->AddPage(sw, title);
1834 nb->ChangeSelection(0);
1836 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1837 wxDefaultSize, style, title);
1838 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1839 wxString toptitle = m_pListbook->GetPageText(parent);
1840 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1841 m_pListbook->SetSelection(0);
1842 m_pListbook->DeletePage(parent + 1);
1846 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1852bool options::DeletePluginPage(wxScrolledWindow* page) {
1853 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1854 wxNotebookPage* pg = m_pListbook->GetPage(i);
1855 auto nb =
dynamic_cast<wxNotebook*
>(pg);
1858 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1859 wxNotebookPage* spg = nb->GetPage(j);
1862 if (nb->GetPageCount() != 1)
return TRUE;
1864 spg = nb->GetPage(0);
1865 spg->Reparent(m_pListbook);
1867 wxString toptitle = m_pListbook->GetPageText(i);
1868 m_pListbook->DeletePage(i);
1869 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1873 }
else if (pg == page) {
1875 m_pListbook->DeletePage(i);
1876 wxPanel* panel =
new wxPanel(m_pListbook);
1877 wxString toptitle = m_pListbook->GetPageText(i);
1878 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1885void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1886 int group_item_spacing) {
1887 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1893 Bind(wxEVT_SIZE, [&](wxSizeEvent& ev) {
1894 auto w = m_pListbook->GetCurrentPage();
1895 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
1899 comm_dialog->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1903void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1904 int group_item_spacing) {
1905 itemPanelShip = AddPage(parent, _(
"Own ship"));
1907 ownShip =
new wxBoxSizer(wxVERTICAL);
1908 itemPanelShip->SetSizer(ownShip);
1911 wxStaticBox* osdBox =
1912 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1913 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1914 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1916 wxFlexGridSizer* dispOptionsGrid =
1917 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1918 dispOptionsGrid->AddGrowableCol(1);
1919 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1921 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1922 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1923 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1925 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1926 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
1928 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
1929 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
1930 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
1932 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1933 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
1935 wxStaticText* iconTypeTxt =
1936 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
1937 dispOptionsGrid->Add(iconTypeTxt, 0);
1939 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
1940 _(
"Real Scale Vector")};
1942 m_pShipIconType =
new wxChoice(
1943 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
1944 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
1945 dispOptionsGrid->Add(m_pShipIconType, 0,
1946 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
1947 group_item_spacing);
1949 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
1950 realSizes->AddGrowableCol(1);
1952 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
1955 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
1957 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
1958 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1961 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
1963 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1964 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1967 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
1969 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1970 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1972 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
1973 _(
"GPS Offset from Midship (m)")),
1975 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1976 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1979 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
1981 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1982 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1985 wxFlexGridSizer* rrSelect =
1986 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
1987 rrSelect->AddGrowableCol(1);
1988 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
1990 wxStaticText* rrTxt =
1991 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
1992 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
1994 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
1995 "6",
"7",
"8",
"9",
"10"};
1996 pNavAidRadarRingsNumberVisible =
1997 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
1998 m_pShipIconType->GetSize(), 11, rrAlt);
1999 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
2000 group_item_spacing);
2002 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2003 radarGrid->AddGrowableCol(1);
2004 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
2006 wxStaticText* distanceText =
2007 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
2008 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
2010 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL,
"",
2011 wxDefaultPosition, wxSize(100, -1), 0);
2012 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
2013 group_item_spacing);
2015 wxStaticText* unitText =
2016 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
2017 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
2019 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"),
2020 _(
"Minutes (time)")};
2021 m_itemRadarRingsUnits =
2022 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
2023 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
2024 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2026 wxStaticText* colourText =
2027 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Color"));
2028 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2030 m_colourOwnshipRangeRingColour =
2031 new OCPNColourPickerCtrl(itemPanelShip, wxID_ANY, *wxRED,
2032 wxDefaultPosition, m_colourPickerDefaultSize, 0,
2033 wxDefaultValidator,
"ID_COLOUROSRANGECOLOUR");
2034 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2037 wxFlexGridSizer* shipToActiveGrid =
2038 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2039 shipToActiveGrid->AddGrowableCol(1);
2040 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2041 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2042 _(
"Show direction to Active Waypoint"));
2043 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2046 wxStaticText* shipToActiveText1 =
2047 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2048 shipToActiveGrid->Add(shipToActiveText1, 1,
2049 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2051 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
2052 _(
"Long dash"), _(
"Short dash")};
2053 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2054 m_shipToActiveStyle =
2055 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2056 LineStyleNChoices, LineStyleChoices, 0);
2057 m_shipToActiveStyle->SetSelection(0);
2058 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2060 wxStaticText* shipToActiveText2 =
2061 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2062 shipToActiveGrid->Add(shipToActiveText2, 1,
2063 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2065 wxString m_LineColorChoices[] = {
2066 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2067 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2068 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2069 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2071 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2072 m_shipToActiveColor =
2073 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2074 LineColorNChoices, m_LineColorChoices, 0);
2075 m_shipToActiveColor->SetSelection(0);
2076 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2079 wxStaticBox* shipdata =
2080 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Ship's identifier"));
2081 wxStaticBoxSizer* datasizer =
new wxStaticBoxSizer(shipdata, wxVERTICAL);
2082 ownShip->Add(datasizer, 0, wxGROW | wxALL, border_size);
2084 wxFlexGridSizer* ownmmsisizer =
2085 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2086 ownmmsisizer->AddGrowableCol(1);
2087 datasizer->Add(ownmmsisizer, 0, wxALL | wxEXPAND, border_size);
2091 wxStaticText* pStatic_ownshipmmsi =
2092 new wxStaticText(itemPanelShip, wxID_ANY,
2093 _(
"Own ship's MMSI. (If available) Nine digits"));
2094 ownmmsisizer->Add(pStatic_ownshipmmsi, 0);
2097 const wxString AllowDigits[] = {
"0",
"1",
"2",
"3",
"4",
2098 "5",
"6",
"7",
"8",
"9"};
2099 wxArrayString ArrayAllowDigits(10, AllowDigits);
2100 wxTextValidator mmsiVal(wxFILTER_INCLUDE_CHAR_LIST);
2101 mmsiVal.SetIncludes(ArrayAllowDigits);
2102 m_pTxt_OwnMMSI =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"",
2103 wxDefaultPosition, wxDefaultSize, 0, mmsiVal);
2104 ownmmsisizer->Add(m_pTxt_OwnMMSI, 0, wxALIGN_RIGHT);
2107 wxStaticBox* trackText =
2108 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2109 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2110 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2111 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2113 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2114 _(
"Automatic Daily Tracks at midnight"));
2116 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2119 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2121#if wxUSE_TIMEPICKCTRL
2122 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2125 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2126 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2127 wxDefaultPosition, wxDefaultSize, 0);
2130 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2131 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2132 wxDefaultPosition, wxDefaultSize, 0);
2134 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2138 pTrackRotateComputerTime =
2139 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2140 wxDefaultPosition, wxDefaultSize, 0);
2141 trackSizer1->Add(pTrackRotateComputerTime, 0,
2142 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2145 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2146 wxDefaultPosition, wxDefaultSize, 0);
2147 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2151 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2152 wxDefaultPosition, wxDefaultSize, 0);
2153 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2156 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2158 wxFlexGridSizer* hTrackGrid =
2159 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2160 hTrackGrid->AddGrowableCol(1);
2161 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2164 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2165 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2167 wxStaticText* trackColourText =
2168 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Color"));
2169 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2171 m_colourTrackLineColour =
new OCPNColourPickerCtrl(
2172 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2173 m_colourPickerDefaultSize, 0, wxDefaultValidator,
"ID_COLOURTRACKCOLOUR");
2174 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2176 wxFlexGridSizer* pTrackGrid =
2177 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2178 pTrackGrid->AddGrowableCol(1);
2179 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2181 wxStaticText* tpText =
2182 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2183 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2185 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2186 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2187 m_pShipIconType->GetSize(), 3, trackAlt);
2188 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2189 group_item_spacing);
2192void options::CreatePanel_Routes(
size_t parent,
int border_size,
2193 int group_item_spacing) {
2194 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2196 Routes =
new wxBoxSizer(wxVERTICAL);
2197 itemPanelRoutes->SetSizer(Routes);
2199 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2201 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
2202 "6",
"7",
"8",
"9",
"10"};
2205 wxStaticBox* routeText =
2206 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2207 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2208 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2210 wxStaticBox* activeRouteText =
2211 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2212 wxStaticBoxSizer* activeRouteSizer =
2213 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2215 m_persist_active_route_chkbox =
new wxCheckBox(
2216 itemPanelRoutes, wxID_ANY,
2217 _(
"Persist active route, automatically activate on start up"));
2218 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2219 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2221 routeSizer->AddSpacer(5);
2224 wxFlexGridSizer* routepointiconSelect =
2225 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2226 routepointiconSelect->AddGrowableCol(1);
2227 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2230 wxStaticText* routepointiconTxt =
2231 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2232 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2233 group_item_spacing);
2235 pRoutepointDefaultIconChoice =
new OCPNIconCombo(
2236 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2237 0, NULL, wxCB_READONLY);
2238 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2239 wxALIGN_RIGHT | wxALL, group_item_spacing);
2241 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2244 int min_size = GetCharHeight() * 2;
2245 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2246 pRoutepointDefaultIconChoice->SetMinSize(
2247 wxSize(GetCharHeight() * 15, min_size));
2249 routeSizer->AddSpacer(5);
2251 wxFlexGridSizer* pRouteGrid =
2252 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2253 pRouteGrid->AddGrowableCol(1);
2254 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2256 wxStaticText* raText =
new wxStaticText(itemPanelRoutes, wxID_STATIC,
2257 _(
"Waypoint Arrival Distance (NMi)"));
2258 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2260 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2261 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2262 group_item_spacing);
2264 pAdvanceRouteWaypointOnArrivalOnly =
2265 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2266 _(
"Advance route waypoint on arrival only"));
2267 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2270 Routes->AddSpacer(8 * group_item_spacing);
2272 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2273 wxDefaultSize, wxLI_HORIZONTAL);
2274 Routes->Add(pln, 0, wxEXPAND);
2278 wxStaticBox* waypointText =
2279 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2280 wxStaticBoxSizer* waypointSizer =
2281 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2282 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2284 waypointSizer->AddSpacer(5);
2287 wxFlexGridSizer* waypointiconSelect =
2288 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2289 waypointiconSelect->AddGrowableCol(1);
2290 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2293 wxStaticText* waypointiconTxt =
2294 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2295 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2296 group_item_spacing);
2298 pWaypointDefaultIconChoice =
new OCPNIconCombo(
2299 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2300 0, NULL, wxCB_READONLY);
2301 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2302 group_item_spacing);
2304 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2307 int rmin_size = GetCharHeight() * 2;
2308 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2309 pWaypointDefaultIconChoice->SetMinSize(
2310 wxSize(GetCharHeight() * 15, rmin_size));
2312 waypointSizer->AddSpacer(5);
2314 wxFlexGridSizer* ScaMinSizer =
2315 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2316 ScaMinSizer->AddGrowableCol(1);
2317 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2319 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2320 _(
"Show marks only at a chartscale greater than 1 :"));
2321 ScaMinSizer->Add(pScaMinChckB, 0);
2322 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2323 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2324 group_item_spacing);
2326 wxFlexGridSizer* ScaMaxSizer =
2327 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2328 ScaMaxSizer->AddGrowableCol(1);
2329 waypointSizer->Add(ScaMaxSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2330 wxStaticText* scaMaxLabel =
2331 new wxStaticText(itemPanelRoutes, wxID_ANY,
2332 _(
"Show marks only at a chartscale smaller than 1 :"));
2333 ScaMaxSizer->Add(scaMaxLabel, 0);
2334 m_pText_ScaMax =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2335 ScaMaxSizer->Add(m_pText_ScaMax, 0, wxALL | wxALIGN_RIGHT,
2336 group_item_spacing);
2339 pScaMinOverruleChckB =
2340 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2341 _(
"Override the settings for chartscale based visibility "
2342 "and show always"));
2343 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2345 waypointSizer->AddSpacer(5);
2347 wxFlexGridSizer* waypointrrSelect =
2348 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2349 waypointrrSelect->AddGrowableCol(1);
2350 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2353 wxStaticText* waypointrrTxt =
2354 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2355 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2357 pWaypointRangeRingsNumber =
2358 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2359 m_pShipIconType->GetSize(), 11, rrAlt);
2360 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2361 group_item_spacing);
2364 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2365 waypointradarGrid->AddGrowableCol(1);
2366 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2368 wxStaticText* waypointdistanceText =
new wxStaticText(
2369 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2370 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2371 group_item_spacing);
2373 pWaypointRangeRingsStep =
2374 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2375 wxSize(100, -1), 0);
2376 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2377 group_item_spacing);
2379 wxStaticText* waypointunitText =
2380 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2381 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2382 group_item_spacing);
2384 m_itemWaypointRangeRingsUnits =
2385 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2386 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2387 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2388 wxALIGN_RIGHT | wxALL, border_size);
2390 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2391 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colors"));
2392 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2394 m_colourWaypointRangeRingsColour =
new OCPNColourPickerCtrl(
2395 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2396 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2397 "ID_COLOURWAYPOINTRANGERINGSCOLOUR");
2398 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2399 wxALIGN_RIGHT | wxALL, 1);
2404 Routes->AddSpacer(8 * group_item_spacing);
2405 wxStaticLine* pln1 =
2406 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2407 wxDefaultSize, wxLI_HORIZONTAL);
2408 Routes->Add(pln1, 0, wxEXPAND);
2411 wxStaticBox* waypointControl =
2412 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2413 wxStaticBoxSizer* ControlSizer =
2414 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2415 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2417 ControlSizer->AddSpacer(5);
2419 pWayPointPreventDragging =
new wxCheckBox(
2420 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2421 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2422 pWayPointPreventDragging->SetValue(FALSE);
2423 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2425 pConfirmObjectDeletion =
2426 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2427 _(
"Confirm deletion of tracks and routes"));
2428 pConfirmObjectDeletion->SetValue(FALSE);
2429 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2430 ControlSizer->AddSpacer(5);
2433 pWaypointDefaultIconChoice->Clear();
2435 bool fillCombo =
true;
2438 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2439 wxString* ps = pWayPointMan->GetIconDescription(i);
2440 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2442 pWaypointDefaultIconChoice->Append(*ps, bmp);
2447 int iconToSelect = -1;
2448 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2449 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2451 pWaypointDefaultIconChoice->Select(iconToSelect);
2457 pRoutepointDefaultIconChoice->Clear();
2462 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2463 wxString* ps = pWayPointMan->GetIconDescription(i);
2464 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2466 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2472 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2473 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2475 pRoutepointDefaultIconChoice->Select(iconToSelect);
2483void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2484 int group_item_spacing) {
2485 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2487 chartPanel =
new wxBoxSizer(wxVERTICAL);
2488 chartPanelWin->SetSizer(chartPanel);
2490 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2491 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2492 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2494 m_scrollWinChartList =
new wxScrolledWindow(
2495 chartPanelWin, wxID_ANY, wxDefaultPosition,
2496 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2498 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2505 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2507 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2508 m_scrollWinChartList->SetSizer(boxSizerCharts);
2510 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2511 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2513 wxString b1 = _(
"Add Directory...");
2514 wxString b2 = _(
"Remove Selected");
2515 wxString b3 = _(
"Compress Selected");
2523 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2524 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2526 cmdButtonSizer->AddSpacer(GetCharHeight());
2528 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2529 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2530 m_removeBtn->Disable();
2532 cmdButtonSizer->AddSpacer(GetCharHeight());
2535 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2536 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2537 m_compressBtn->Disable();
2539 m_compressBtn = NULL;
2543 if (g_Android_SDK_Version >= 30) {
2545 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2546 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2550 cmdButtonSizer->AddSpacer(GetCharHeight());
2552 wxStaticBox* itemStaticBoxUpdateStatic =
2553 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2554 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2555 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2556 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2558 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2559 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2561 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2562 _(
"Scan Charts and Update Database"));
2563 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2565 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2566 _(
"Force Full Database Rebuild"));
2568 pUpdateCheckBox->Hide();
2570 pRebuildChartDatabase =
new wxButton(chartPanelWin, ID_REBUILDBUTTON,
2571 _(
"Rebuild Chart Database"));
2572 itemFlexGridSizerUpdate->Add(pRebuildChartDatabase, 1, wxALL, 5);
2574 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2575 _(
"Prepare all ENC Charts"));
2576 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2578 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2581 ActiveChartArray.Clear();
2582 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2583 ActiveChartArray.Add(m_CurrentDirList[i]);
2586 UpdateChartDirList();
2588 chartPanel->Layout();
2591void options::UpdateChartDirList() {
2593 m_scrollWinChartList->GetSizer()->Clear(
true);
2594 m_scrollWinChartList->ClearBackground();
2596 panelVector.clear();
2599 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2600 OCPNChartDirPanel* chartPanel =
2601 new OCPNChartDirPanel(m_scrollWinChartList, wxID_ANY, wxDefaultPosition,
2602 wxSize(-1, -1), ActiveChartArray[i]);
2603 chartPanel->SetSelected(
false);
2605 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2607 panelVector.push_back(chartPanel);
2610 m_scrollWinChartList->GetSizer()->Layout();
2612 chartPanelWin->ClearBackground();
2613 chartPanelWin->Layout();
2622 wxSize sza = GetSize();
2627 m_scrollWinChartList->GetParent()->Layout();
2630 m_scrollWinChartList->Scroll(0, 0);
2633void options::UpdateTemplateTitleText() {
2634 if (!m_templateTitleText)
return;
2636 wxString activeTitle;
2637 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2638 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2640 bool configCompare =
2641 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2642 if (!configCompare) activeTitle += _(
" [Modified]");
2643 m_templateTitleText->SetLabel(activeTitle);
2645 m_templateTitleText->SetLabel(_(
"None"));
2648void options::CreatePanel_Configs(
size_t parent,
int border_size,
2649 int group_item_spacing) {
2650 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2656 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2657 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2661 wxStaticBox* templateStatusBox =
2662 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2663 m_templateStatusBoxSizer =
2664 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2665 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2668 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2669 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2671 m_staticTextLastAppled =
new wxStaticText(
2672 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2673 m_staticTextLastAppled->Hide();
2675 statSizer->Add(m_staticTextLastAppled);
2677 m_templateTitleText =
2678 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2679 statSizer->Add(m_templateTitleText);
2680 m_templateTitleText->Hide();
2682 UpdateTemplateTitleText();
2684 wxStaticBox* configsBox =
2685 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2686 wxStaticBoxSizer* configSizer =
2687 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2688 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2690 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2691 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2693 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2694 cPanel->SetSizer(boxSizercPanel);
2696 m_scrollWinConfigList =
2697 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2698 wxBORDER_RAISED | wxVSCROLL);
2699 m_scrollWinConfigList->SetScrollRate(1, 1);
2700 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2702 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2704 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2705 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2707 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2708 configSizer->Add(btnSizer);
2711 wxButton* createButton =
2712 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2713 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2714 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2715 wxCommandEventHandler(options::OnCreateConfig), NULL,
2723 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2724 _(
"Delete Selected Config..."));
2725 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2726 group_item_spacing);
2727 m_configDeleteButton->Connect(
2728 wxEVT_COMMAND_BUTTON_CLICKED,
2729 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2731 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2732 _(
"Apply Selected Config"));
2733 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2734 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2735 wxCommandEventHandler(options::OnApplyConfig),
2742 SetConfigButtonState();
2746void options::ClearConfigList() {
2747 if (m_scrollWinConfigList) {
2748 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2749 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2750 wxWindowList::compatibility_iterator node = kids.Item(i);
2751 wxWindow* win = node->GetData();
2752 auto pcp =
dynamic_cast<wxPanel*
>(win);
2754 auto cPanel =
dynamic_cast<ConfigPanel*
>(pcp);
2761 SetConfigButtonState();
2764void options::BuildConfigList() {
2765 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2767 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2769 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2771 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2772 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2773 pp->Connect(wxEVT_LEFT_DOWN,
2774 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2778 wxWindowList kids = pp->GetChildren();
2779 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2780 wxWindowList::compatibility_iterator node = kids.Item(i);
2781 wxWindow* win = node->GetData();
2782 win->Connect(wxEVT_LEFT_DOWN,
2783 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2789 m_boxSizerConfigs->Layout();
2791 m_selectedConfigPanelGUID =
"";
2792 SetConfigButtonState();
2795void options::SetConfigButtonState() {
2796 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2797 if (m_selectedConfigPanelGUID.StartsWith(
2799 m_configDeleteButton->Disable();
2800 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2803void options::OnCreateConfig(wxCommandEvent& event) {
2804 ConfigCreateDialog* pd =
new ConfigCreateDialog(
2805 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2807 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2808 if (retcode == wxID_OK) {
2809 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2810 UpdateTemplateTitleText();
2814 m_DisplayConfigsPage->Layout();
2816 SetConfigButtonState();
2820void options::OnEditConfig(wxCommandEvent& event) {}
2822void options::OnDeleteConfig(wxCommandEvent& event) {
2823 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2825 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2826 m_selectedConfigPanelGUID =
"";
2831 m_DisplayConfigsPage->Layout();
2832 SetConfigButtonState();
2835void options::OnApplyConfig(wxCommandEvent& event) {
2836 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2839 wxString currentLocale = g_locale;
2843 evt.SetId(ID_APPLY);
2847 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2851 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2852 wxString activeTitle =
2853 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2854 m_templateTitleText->SetLabel(activeTitle);
2855 m_templateTitleText->Show();
2856 m_staticTextLastAppled->Show();
2857 m_templateStatusBoxSizer->Layout();
2859 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2860 _(
"OpenCPN Info"), wxOK);
2863 if (m_scrollWinConfigList) {
2864 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2865 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2866 wxWindowList::compatibility_iterator node = kids.Item(i);
2867 wxWindow* win = node->GetData();
2868 auto pcp =
dynamic_cast<wxPanel*
>(win);
2870 auto cPanel =
dynamic_cast<ConfigPanel*
>(pcp);
2872 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2877 m_selectedConfigPanelGUID = wxEmptyString;
2879 m_returnChanges |= CONFIG_CHANGED;
2881 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2886void options::OnConfigMouseSelected(wxMouseEvent& event) {
2887 wxPanel* selectedPanel = NULL;
2888 wxObject* obj =
event.GetEventObject();
2890 auto panel =
dynamic_cast<wxPanel*
>(obj);
2892 selectedPanel = panel;
2896 auto win =
dynamic_cast<wxWindow*
>(obj);
2898 auto parentpanel =
dynamic_cast<wxPanel*
>(win->GetParent());
2900 selectedPanel = parentpanel;
2905 if (m_scrollWinConfigList) {
2906 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2907 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2908 wxWindowList::compatibility_iterator node = kids.Item(i);
2909 wxWindow* win = node->GetData();
2910 auto panel =
dynamic_cast<wxPanel*
>(win);
2912 if (panel == selectedPanel) {
2913 panel->SetBackgroundColour(wxSystemSettings::GetColour(
2914 wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
2915 auto cPanel =
dynamic_cast<ConfigPanel*
>(panel);
2916 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
2918 panel->SetBackgroundColour(m_panelBackgroundUnselected);
2920 panel->Refresh(
true);
2924 m_DisplayConfigsPage->Layout();
2925 SetConfigButtonState();
2929void options::CreatePanel_Advanced(
size_t parent,
int border_size,
2930 int group_item_spacing) {
2931 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
2937 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2938 m_ChartDisplayPage->SetSizer(wrapperSizer);
2940 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
2943 itemBoxSizerUI->Add(0, border_size * 3);
2944 itemBoxSizerUI->Add(0, border_size * 3);
2947 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
2948 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
2950 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
2951 _(
"De-skew Raster Charts"));
2952 boxCharts->Add(pSkewComp, inputFlags);
2954 itemBoxSizerUI->Add(0, border_size * 3);
2955 itemBoxSizerUI->Add(0, border_size * 3);
2959 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
2960 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
2962 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
2963 _(
"Use Accelerated Graphics (OpenGL)"));
2964 OpenGLSizer->Add(pOpenGL, inputFlags);
2965 pOpenGL->Enable(!g_bdisable_opengl &&
g_Platform->IsGLCapable());
2967 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
2968 _(
"OpenGL Options") +
"...");
2969 OpenGLSizer->Add(bOpenGL, inputFlags);
2971 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
2972 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
2977 itemBoxSizerUI->Add(0, border_size * 3);
2978 itemBoxSizerUI->Add(0, border_size * 3);
2982 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
2983 _(
"Chart Rotation Averaging Time"));
2985 wrapperSizer->Add(crat, 0,
2986 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
2987 group_item_spacing);
2989 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
2990 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
2993 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2994 wxSize(sz.x / 5, -1), wxTE_RIGHT);
2995 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
2996 group_item_spacing);
2998 pCOGUPFilterRow->Add(
2999 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3002 itemBoxSizerUI->Add(0, border_size * 3);
3003 itemBoxSizerUI->Add(0, border_size * 3);
3006 wxStaticText* zoomTextHead =
new wxStaticText(
3007 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3008 zoomTextHead->Wrap(-1);
3009 itemBoxSizerUI->Add(
3011 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3012 group_item_spacing);
3013 itemBoxSizerUI->Add(0, border_size * 1);
3015 itemBoxSizerUI->Add(
3016 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3019 m_pSlider_Zoom_Raster =
3020 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3021 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3024 prepareSlider(m_pSlider_Zoom_Raster);
3027 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3029 itemBoxSizerUI->Add(
3030 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3033 m_pSlider_Zoom_Vector =
3034 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3035 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3038 prepareSlider(m_pSlider_Zoom_Vector);
3041 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3043 itemBoxSizerUI->Add(
3044 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3046 m_pSlider_CM93_Zoom =
3047 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3048 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3049 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3052 prepareSlider(m_pSlider_CM93_Zoom);
3055 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3057 itemBoxSizerUI->Add(0, border_size * 3);
3058 itemBoxSizerUI->Add(0, border_size * 3);
3059 itemBoxSizerUI->Add(0, border_size * 3);
3063 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3064 _(
"Physical Screen Width")),
3066 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3067 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3069 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3070 pDPIRow->Add(pRBSizeAuto, inputFlags);
3071 pDPIRow->AddSpacer(10);
3072 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3073 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3074 pDPIRow->Add(pRBSizeManual, inputFlags);
3076 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3077 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3080 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3081 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3082 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3084 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3088 itemBoxSizerUI->Add(
3089 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3091 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3092 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3094 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3095 _(
"Show extended chart bar information."));
3096 ChartBarSizer->Add(pChartBarEX, inputFlags);
3099 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3100 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3102 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3103 wxCommandEventHandler(options::OnSizeManualButton),
3109 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3110 itemBoxSizerUI->SetHGap(border_size);
3117 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3118 m_ChartDisplayPage->SetSizer(wrapperSizer);
3119 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3122 itemBoxSizerUI->Add(0, border_size * 3);
3123 itemBoxSizerUI->Add(0, border_size * 3);
3126 itemBoxSizerUI->Add(
3127 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3129 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3130 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3132 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3133 _(
"Show Skewed Raster Charts as North-Up"));
3134 boxCharts->Add(pSkewComp, verticleInputFlags);
3152 itemBoxSizerUI->Add(0, border_size * 3);
3153 itemBoxSizerUI->Add(0, border_size * 3);
3156 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3157 _(
"Chart Rotation Averaging Time")),
3159 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3160 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3161 group_item_spacing);
3164 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3165 wxSize(50, -1), wxTE_RIGHT);
3166 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3168 pCOGUPFilterRow->Add(
3169 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3173 itemBoxSizerUI->Add(0, border_size * 8);
3174 itemBoxSizerUI->Add(0, border_size * 8);
3177 wxStaticText* zoomTextHead =
new wxStaticText(
3178 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3180 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3181 itemBoxSizerUI->Add(0, border_size * 1);
3182 itemBoxSizerUI->Add(0, border_size * 1);
3184 wxStaticText* zoomText =
new wxStaticText(
3185 m_ChartDisplayPage, wxID_ANY,
3186 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3187With a higher value, the same zoom level shows a more detailed chart."));
3189 smallFont = *dialogFont;
3191 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3193 zoomText->SetFont(smallFont);
3194 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3202 itemBoxSizerUI->Add(
3203 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3205 m_pSlider_Zoom_Raster =
3206 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3207 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3210 prepareSlider(m_pSlider_Zoom_Raster);
3213 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3215 itemBoxSizerUI->Add(
3216 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3218 m_pSlider_Zoom_Vector =
3219 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3220 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3223 prepareSlider(m_pSlider_Zoom_Vector);
3226 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3229 itemBoxSizerUI->Add(0, border_size * 3);
3230 itemBoxSizerUI->Add(0, border_size * 3);
3232 itemBoxSizerUI->Add(
3233 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3235 m_pSlider_CM93_Zoom =
3236 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3237 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3238 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3241 prepareSlider(m_pSlider_CM93_Zoom);
3244 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3247 itemBoxSizerUI->Add(0, border_size * 3);
3248 itemBoxSizerUI->Add(0, border_size * 3);
3249 itemBoxSizerUI->Add(0, border_size * 3);
3250 itemBoxSizerUI->Add(0, border_size * 3);
3251 itemBoxSizerUI->Add(0, border_size * 3);
3252 itemBoxSizerUI->Add(0, border_size * 3);
3256 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3257 _(
"Physical Screen Width")),
3259 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3260 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3262 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3263 pDPIRow->Add(pRBSizeAuto, inputFlags);
3264 pDPIRow->AddSpacer(10);
3265 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3266 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3267 pDPIRow->Add(pRBSizeManual, inputFlags);
3270 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3271 wxSize(3 * m_fontHeight, -1), wxTE_RIGHT);
3272 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3274 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3277 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3278 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3280 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3281 wxCommandEventHandler(options::OnSizeManualButton),
3285 itemBoxSizerUI->Add(0, border_size * 3);
3286 itemBoxSizerUI->Add(0, border_size * 3);
3291 itemBoxSizerUI->Add(
3292 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3294 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3295 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3297 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3298 _(
"Use Accelerated Graphics (OpenGL)"));
3299 OpenGLSizer->Add(pOpenGL, inputFlags);
3300 pOpenGL->Enable(!g_bdisable_opengl &&
g_Platform->IsGLCapable());
3302 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3303 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3309 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3310 _(
"Options") +
"...");
3311 OpenGLSizer->Add(bOpenGL, inputFlags);
3314 itemBoxSizerUI->Add(0, border_size * 3);
3315 itemBoxSizerUI->Add(0, border_size * 3);
3320 itemBoxSizerUI->Add(
3321 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3323 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3324 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3326 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3327 _(
"Show extended chart bar information."));
3328 ChartBarSizer->Add(pChartBarEX, inputFlags);
3340 m_ChartDisplayPage->Fit();
3344void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3345 int group_item_spacing) {
3346 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3349 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3350 ps57Ctl->SetSizer(vectorPanel);
3353 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3354 optionsColumn->SetHGap(border_size);
3355 optionsColumn->AddGrowableCol(0, 2);
3356 optionsColumn->AddGrowableCol(1, 3);
3357 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3360 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3361 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3366 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3368 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3369 _(
"Mariner's Standard")};
3370 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3371 wxDefaultSize, 4, pDispCatStrings);
3372 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3376 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3377 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3380 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3383 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3384 optionsColumn->Add(miscSizer, groupInputFlags);
3388 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3389 pCheck_SOUNDG->SetValue(FALSE);
3390 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3393 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3394 _(
"Chart Information Objects"));
3395 pCheck_META->SetValue(FALSE);
3396 miscSizer->Add(pCheck_META, verticleInputFlags);
3399 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3402 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3403 optionsColumn->Add(lightSizer, groupInputFlags);
3406 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3407 pCheck_ATONTEXT->SetValue(FALSE);
3408 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3411 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3412 pCheck_LDISTEXT->SetValue(FALSE);
3413 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3415 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3416 _(
"Extended Light Sectors"));
3417 pCheck_XLSECTTEXT->SetValue(FALSE);
3418 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3421 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3424 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3425 optionsColumn->Add(textSizer, groupInputFlags);
3427 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3428 _(
"National text on chart"));
3429 pCheck_NATIONALTEXT->SetValue(FALSE);
3430 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3432 pCheck_SHOWIMPTEXT =
3433 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3434 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3435 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3438 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3439 pCheck_DECLTEXT->SetValue(FALSE);
3440 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3442 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3444 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3445 _(
"Reduced Detail at Small Scale"));
3446 pCheck_SCAMIN->SetValue(FALSE);
3447 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3449 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3450 pCheck_SuperSCAMIN =
3451 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3452 _(
"Additional detail reduction at Small Scale"));
3453 pCheck_SuperSCAMIN->SetValue(FALSE);
3454 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3457 optionsColumn->Add(0, border_size * 4);
3458 optionsColumn->Add(0, border_size * 4);
3460 wxSize item_size = wxSize(-1, -1);
3462 item_size = wxSize(m_fontHeight * 3, m_fontHeight);
3466 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3468 wxString pPointStyleStrings[] = {
3472 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3473 item_size, 2, pPointStyleStrings);
3474 optionsColumn->Add(pPointStyle, inputFlags);
3476 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3478 wxString pBoundStyleStrings[] = {
3482 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3483 item_size, 2, pBoundStyleStrings);
3484 optionsColumn->Add(pBoundStyle, inputFlags);
3486 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3488 wxString pColorNumStrings[] = {
3492 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3493 item_size, 2, pColorNumStrings);
3494 optionsColumn->Add(p24Color, inputFlags);
3497 optionsColumn->Add(0, border_size * 4);
3498 optionsColumn->Add(0, border_size * 4);
3500 item_size = wxSize(60, -1);
3502 item_size = wxSize(m_fontHeight * 2, m_fontHeight);
3506 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3508 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3509 optionsColumn->Add(depShalRow);
3510 m_ShallowCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3511 item_size, wxTE_RIGHT);
3512 depShalRow->Add(m_ShallowCtl, inputFlags);
3513 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3514 depShalRow->Add(m_depthUnitsShal, inputFlags);
3516 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3518 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3519 optionsColumn->Add(depSafeRow);
3520 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3521 item_size, wxTE_RIGHT);
3522 depSafeRow->Add(m_SafetyCtl, inputFlags);
3523 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3524 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3526 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3528 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3529 optionsColumn->Add(depDeepRow);
3530 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3531 item_size, wxTE_RIGHT);
3532 depDeepRow->Add(m_DeepCtl, inputFlags);
3533 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3534 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3537 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3538 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3540 wxStaticBox* marinersBox =
3541 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3542 wxStaticBoxSizer* marinersSizer =
3543 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3544 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3546 ps57CtlListBox =
new OCPNCheckedListCtrl(
3547 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3548 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3550 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3551 itemButtonSelectList =
3552 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3553 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3554 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3555 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3556 marinersSizer->Add(btnRow1);
3558 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3560 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3561 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3562 marinersSizer->Add(btnRow2);
3567 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3568 ps57Ctl->SetSizer(vectorPanel);
3570 wxBoxSizer* optionsColumn = vectorPanel;
3573 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3578 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3580 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3581 _(
"Mariner's Standard")};
3582 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3583 wxSize(350, -1), 4, pDispCatStrings);
3584 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3587 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3592 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3593 optionsColumn->Add(miscSizer, groupInputFlags);
3596 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3597 pCheck_SOUNDG->SetValue(FALSE);
3598 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3600 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3601 _(
"Chart Information Objects"));
3602 pCheck_META->SetValue(FALSE);
3603 miscSizer->Add(pCheck_META, inputFlags);
3605 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3606 optionsColumn->Add(lightSizer, groupInputFlags);
3609 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3610 pCheck_ATONTEXT->SetValue(FALSE);
3611 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3614 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3615 pCheck_LDISTEXT->SetValue(FALSE);
3616 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3618 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3619 _(
"Extended Light Sectors"));
3620 pCheck_XLSECTTEXT->SetValue(FALSE);
3621 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3623 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3624 optionsColumn->Add(textSizer, groupInputFlags);
3626 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3627 _(
"National text on chart"));
3628 pCheck_NATIONALTEXT->SetValue(FALSE);
3629 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3631 pCheck_SHOWIMPTEXT =
3632 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3633 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3634 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3637 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3638 pCheck_DECLTEXT->SetValue(FALSE);
3639 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3641 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3642 _(
"Reduced Detail at Small Scale"));
3643 pCheck_SCAMIN->SetValue(FALSE);
3644 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3646 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3647 pCheck_SuperSCAMIN =
3648 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3649 _(
"Additional detail reduction at Small Scale"));
3650 pCheck_SuperSCAMIN->SetValue(FALSE);
3651 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3654 optionsColumn->Add(0, border_size * 4);
3655 optionsColumn->Add(0, border_size * 4);
3659 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3660 StyleColumn->SetHGap(border_size);
3661 StyleColumn->AddGrowableCol(0, 2);
3662 StyleColumn->AddGrowableCol(1, 3);
3663 optionsColumn->Add(StyleColumn);
3665 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3667 wxString pPointStyleStrings[] = {
3671 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3672 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3673 pPointStyleStrings);
3675 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3678 StyleColumn->Add(pPointStyle, inputFlags);
3680 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3682 wxString pBoundStyleStrings[] = {
3686 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3687 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3688 pBoundStyleStrings);
3690 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3693 StyleColumn->Add(pBoundStyle, inputFlags);
3695 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3698 wxString pColorNumStrings[] = {
3702 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3703 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3706 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3708 StyleColumn->Add(p24Color, inputFlags);
3711 optionsColumn->Add(0, border_size * 4);
3712 optionsColumn->Add(0, border_size * 4);
3714 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3715 DepthColumn->SetHGap(border_size);
3716 DepthColumn->AddGrowableCol(0, 3);
3717 DepthColumn->AddGrowableCol(1, 2);
3718 DepthColumn->AddGrowableCol(2, 3);
3719 optionsColumn->Add(DepthColumn);
3722 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3725 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3726 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3727 DepthColumn->Add(m_ShallowCtl, inputFlags);
3728 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3729 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3731 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3734 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3735 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3736 DepthColumn->Add(m_SafetyCtl, inputFlags);
3737 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3738 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3740 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3743 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3744 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3745 DepthColumn->Add(m_DeepCtl, inputFlags);
3746 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3747 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3750 optionsColumn->Add(0, border_size * 4);
3751 optionsColumn->Add(0, border_size * 4);
3754 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3755 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3757 wxStaticBox* marinersBox =
3758 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3759 wxStaticBoxSizer* marinersSizer =
3760 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3761 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3763 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3764 itemButtonSelectList =
3765 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3766 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3767 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3768 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3769 marinersSizer->Add(btnRow1);
3771 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3773 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3774 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3775 marinersSizer->Add(btnRow2);
3777 ps57CtlListBox =
new OCPNCheckedListCtrl(
3778 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3780 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3784void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3785 int group_item_spacing) {
3786 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3788 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3789 tcPanel->SetSizer(mainHBoxSizer);
3791 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3792 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3793 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3796 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3797 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3799 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3803 tcDataSelected->DeleteAllItems();
3810 col0.SetAlign(wxLIST_FORMAT_LEFT);
3812 tcDataSelected->InsertColumn(0, col0);
3815 unsigned int id = 0;
3816 for (
auto ds : TideCurrentDataSet) {
3819 tcDataSelected->InsertItem(li);
3821 wxString setName = ds;
3822 tcDataSelected->SetItem(
id, 0, setName);
3823 GetTextExtent(setName, &w1, &h);
3824 w = w1 > w ? w1 : w;
3830 tcDataSelected->SetColumnWidth(0, 20 + w);
3834 wxButton* insertButton =
3835 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3836 wxButton* removeButton =
3837 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3839 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3840 tcSizer->Add(btnSizer);
3842 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3843 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3846void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3847 int group_item_spacing) {
3852 wxNotebook* chartsPageNotebook = (wxNotebook*)m_pListbook->GetPage(parent);
3853 wxScrolledWindow* sw =
new ChartGroupsUI(chartsPageNotebook);
3854 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3855 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3856 groupsPanel =
dynamic_cast<ChartGroupsUI*
>(sw);
3858 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3861void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3862 int group_item_spacing) {
3864 m_border_size = border_size;
3865 m_group_item_spacing = group_item_spacing;
3867 m_UIcomplete = FALSE;
3872void ChartGroupsUI::CompletePanel() {
3874 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3875 m_panel->SetSizer(m_topSizer);
3878 wxStaticText* allChartsLabel =
3879 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3880 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3882 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3883 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3885 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3886 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3890 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3891 wxDefaultSize, wxVSCROLL);
3894 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3895 wxDefaultSize, wxVSCROLL);
3897 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3899 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3900 m_pAddButton->Disable();
3901 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3902 m_pRemoveButton->Disable();
3904 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3905 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3907 m_pRemoveButton->Connect(
3908 wxEVT_COMMAND_BUTTON_CLICKED,
3909 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3911 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3912 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3913 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3915 sizerCharts->AddSpacer(20);
3918 wxStaticText* groupsLabel =
3919 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3920 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3922 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
3923 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
3925 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
3926 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
3927 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
3928 wxDefaultSize, wxNB_TOP);
3929 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
3931 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
3932 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
3936 wxPanel* allActiveGroup =
3937 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
3938 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
3940 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
3941 allActiveGroup->SetSizer(page0BoxSizer);
3943 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1,
"",
3944 wxDefaultPosition, wxDefaultSize);
3947 iFont =
new wxFont(*dialogFont);
3948 iFont->SetStyle(wxFONTSTYLE_ITALIC);
3949 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
3951 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
3953 m_DirCtrlArray.Add(defaultAllCtl);
3957 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
3958 m_pDeleteGroupButton =
3959 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
3960 m_pDeleteGroupButton->Disable();
3962 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3963 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
3965 m_pDeleteGroupButton->Connect(
3966 wxEVT_COMMAND_BUTTON_CLICKED,
3967 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
3969 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
3970 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
3972 newDeleteGrp->AddSpacer(25);
3973 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
3974 m_group_item_spacing);
3975 newDeleteGrp->AddSpacer(15);
3976 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
3977 m_group_item_spacing);
3978 newDeleteGrp->AddSpacer(25);
3979 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3981 sizerGroups->AddSpacer(20);
3985 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
3986 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
3989 m_UIcomplete = TRUE;
3992void options::CreatePanel_Display(
size_t parent,
int border_size,
3993 int group_item_spacing) {
3994 pDisplayPanel = AddPage(parent, _(
"General"));
3997 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
3998 generalSizer->SetHGap(border_size);
4005 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4006 pDisplayPanel->SetSizer(wrapperSizer);
4007 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4010 generalSizer->Add(0, border_size * 4);
4011 generalSizer->Add(0, border_size * 4);
4016 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4018 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4019 generalSizer->Add(boxNavMode, groupInputFlags);
4021 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4022 boxNavMode->Add(rowOrientation);
4024 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4025 rowOrientation->Add(pCBNorthUp, inputFlags);
4027 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4028 rowOrientation->Add(pCBCourseUp,
4030 .Align(wxALIGN_CENTRE_VERTICAL)
4031 .Border(wxLEFT, group_item_spacing * 2));
4033 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4034 _(
"Look Ahead Mode"));
4035 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4038 generalSizer->Add(0, border_size * 4);
4039 generalSizer->Add(0, border_size * 4);
4043 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4045 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4046 generalSizer->Add(boxCharts, groupInputFlags);
4048 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4049 _(
"Enable Chart Quilting"));
4050 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4053 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4054 _(
"Preserve scale when switching charts"));
4055 boxCharts->Add(pPreserveScale, verticleInputFlags);
4058 generalSizer->Add(0, border_size * 4);
4059 generalSizer->Add(0, border_size * 4);
4063 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4065 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4066 generalSizer->Add(boxCtrls, groupInputFlags);
4068 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4069 _(
"Smooth Panning / Zooming"));
4070 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4072 pEnableZoomToCursor =
4073 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4074 pEnableZoomToCursor->SetValue(FALSE);
4075 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4077 pEnableTenHertz =
nullptr;
4079 pEnableTenHertz =
new wxCheckBox(pDisplayPanel, ID_TENHZCHECKBOX,
4080 _(
"Enable Ten Hz screen update"));
4081 pEnableTenHertz->SetValue(FALSE);
4082 boxCtrls->Add(pEnableTenHertz, verticleInputFlags);
4087 generalSizer->Add(0, border_size * 4);
4088 generalSizer->Add(0, border_size * 4);
4092 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4094 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4095 generalSizer->Add(boxDisp, groupInputFlags);
4098 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4099 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4101 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4102 _(
"Show Chart Outlines"));
4103 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4105 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4106 _(
"Show Depth Units"));
4107 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4117 generalSizer->Add(0, border_size * 4);
4118 generalSizer->Add(0, border_size * 4);
4122 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4124 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4125 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4128 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4129 _(
"Live ETA at Cursor"));
4130 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4134 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4135 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4137 m_Text_def_boat_speed =
new wxStaticText(
4138 pDisplayPanel, wxID_ANY,
4139 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4141 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4142 pSDefaultBoatSpeed =
4143 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4144 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4145 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4146 group_item_spacing);
4154 wxStaticBox* itemStaticBoxScreenConfig =
4155 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4156 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4157 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4158 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4161 wxString iconDir =
g_Platform->GetSharedDataDir();
4162 appendOSDirSlash(&iconDir);
4163 iconDir.append(
"uidata");
4164 appendOSDirSlash(&iconDir);
4165 iconDir.append(
"MUI_flat");
4166 appendOSDirSlash(&iconDir);
4167 int bmpSize = GetCharHeight() * 3;
4169 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4170 m_sconfigSelect_single =
4171 new CanvasConfigSelect(pDisplayPanel,
this, ID_SCREENCONFIG1, bmp);
4172 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4175 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4177 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4178 m_sconfigSelect_twovertical =
4179 new CanvasConfigSelect(pDisplayPanel,
this, ID_SCREENCONFIG2, bmp);
4180 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4183 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4188 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4189 generalSizer->SetHGap(border_size);
4196 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4197 pDisplayPanel->SetSizer(wrapperSizer);
4198 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4201 generalSizer->Add(0, border_size * 4);
4202 generalSizer->Add(0, border_size * 4);
4207 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4209 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4210 generalSizer->Add(boxNavMode, groupInputFlags);
4212 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4213 boxNavMode->Add(rowOrientation);
4215 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4216 rowOrientation->Add(pCBNorthUp, inputFlags);
4218 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4219 rowOrientation->Add(pCBCourseUp,
4221 .Align(wxALIGN_CENTRE_VERTICAL)
4222 .Border(wxLEFT, group_item_spacing * 2));
4224 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4225 _(
"Look Ahead Mode"));
4226 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4229 generalSizer->Add(0, border_size * 4);
4230 generalSizer->Add(0, border_size * 4);
4234 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4236 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4237 generalSizer->Add(boxCharts, groupInputFlags);
4239 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4240 _(
"Enable Chart Quilting"));
4241 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4244 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4245 _(
"Preserve scale when switching charts"));
4246 boxCharts->Add(pPreserveScale, verticleInputFlags);
4249 generalSizer->Add(0, border_size * 4);
4250 generalSizer->Add(0, border_size * 4);
4254 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4256 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4257 generalSizer->Add(boxCtrls, groupInputFlags);
4259 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4260 _(
"Smooth Panning / Zooming"));
4261 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4262 pEnableZoomToCursor =
4263 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4264 pEnableZoomToCursor->SetValue(FALSE);
4265 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4268 pSmoothPanZoom->Hide();
4269 pEnableZoomToCursor->Hide();
4273 generalSizer->Add(0, border_size * 4);
4274 generalSizer->Add(0, border_size * 4);
4279 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4281 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4282 generalSizer->Add(boxDisp, groupInputFlags);
4285 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4286 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4288 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4289 _(
"Show Chart Outlines"));
4290 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4292 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4293 _(
"Show Depth Units"));
4294 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4304 generalSizer->Add(0, border_size * 4);
4305 generalSizer->Add(0, border_size * 4);
4309 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4311 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4312 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4315 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4316 _(
"Live ETA at Cursor"));
4317 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4321 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4322 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4323 m_Text_def_boat_speed =
new wxStaticText(
4324 pDisplayPanel, wxID_ANY,
4325 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4326 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4327 pSDefaultBoatSpeed =
4328 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4329 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4330 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4331 group_item_spacing);
4339 wxStaticBox* itemStaticBoxScreenConfig =
4340 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4341 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4342 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4343 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4346 wxString iconDir =
g_Platform->GetSharedDataDir();
4347 appendOSDirSlash(&iconDir);
4348 iconDir.append(
"uidata");
4349 appendOSDirSlash(&iconDir);
4350 iconDir.append(
"MUI_flat");
4351 appendOSDirSlash(&iconDir);
4352 int bmpSize = GetCharHeight() * 3;
4354 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4355 m_sconfigSelect_single =
4356 new CanvasConfigSelect(pDisplayPanel,
this, ID_SCREENCONFIG1, bmp);
4357 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4360 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4362 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4363 m_sconfigSelect_twovertical =
4364 new CanvasConfigSelect(pDisplayPanel,
this, ID_SCREENCONFIG2, bmp);
4365 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4368 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4374void options::CreatePanel_Units(
size_t parent,
int border_size,
4375 int group_item_spacing) {
4376 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4379 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4380 unitsSizer->SetHGap(border_size);
4384 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4385 panelUnits->SetSizer(wrapperSizer);
4387 wrapperSizer->Add(1, border_size * 24);
4388 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4391 unitsSizer->Add(0, border_size * 4);
4392 unitsSizer->Add(0, border_size * 4);
4395 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4397 wxString pDistanceFormats[kNumDistanceFormats];
4398 for (
int i = 0; i < kNumDistanceFormats; i++) {
4399 pDistanceFormats[i] = kDistanceFormats[i].label;
4401 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4403 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4404 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4407 pDistanceFormat->SetToolTip(ttDistance());
4409 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4411 unitsSizer->Add(pDistanceFormat, inputFlags);
4414 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4416 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4417 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4418 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4419 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4420 m_SpeedFormatsNChoices, pSpeedFormats);
4421 pSpeedFormat->SetToolTip(ttSpeed());
4423 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4425 unitsSizer->Add(pSpeedFormat, inputFlags);
4428 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4430 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4431 int m_WindSpeedFormatsNChoices =
4432 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4434 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4435 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4437 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4439 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4441 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4444 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4446 wxString pDepthUnitStrings[] = {
4452 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4453 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4455 pDepthUnitSelect->SetToolTip(ttDepth());
4457 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4459 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4462 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4464 wxString pHeightUnitStrings[] = {
4469 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4470 wxSize(m_fontHeight * 4, -1), 2, pHeightUnitStrings);
4473 pHeightUnitSelect->SetToolTip(ttHeight());
4475 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4477 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4480 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4482 wxString pTempUnitStrings[] = {
4488 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4489 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4490 pTempFormat->SetToolTip(ttTemp());
4492 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4494 unitsSizer->Add(pTempFormat, inputFlags);
4497 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4498 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4501 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4503 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4504 _(
"Decimal Degrees"),
4505 _(
"Degrees, Minutes, Seconds")};
4506 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4507 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4508 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4509 m_SDMMFormatsNChoices, pSDMMFormats);
4510 pSDMMFormat->SetToolTip(ttCoordFormat());
4512 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4514 unitsSizer->Add(pSDMMFormat, inputFlags);
4517 unitsSizer->Add(0, border_size * 4);
4518 unitsSizer->Add(0, border_size * 4);
4522 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4525 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4526 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4527 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4528 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4531 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4532 wxDefaultPosition, wxDefaultSize, 0);
4534 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4535 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4536 wxDefaultPosition, wxDefaultSize, 0);
4538 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4541 unitsSizer->Add(0, border_size * 4);
4542 unitsSizer->Add(0, border_size * 4);
4545 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4550 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4551 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4552 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4555 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4556 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4557 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4561 wxStaticBox* itemStaticBoxVar =
new wxStaticBox(panelUnits, wxID_ANY,
"");
4563 wxStaticBoxSizer* itemStaticBoxSizerVar =
4564 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4565 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4567 itemStaticBoxSizerVar->Add(0, border_size * 4);
4569 itemStaticTextUserVar =
4570 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4571 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4572 group_item_spacing);
4574 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4575 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4576 group_item_spacing);
4578 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4579 wxSize(150, -1), wxTE_RIGHT);
4580 magVarSizer->AddSpacer(100);
4582 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4584 itemStaticTextUserVar2 =
4585 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4587 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4588 group_item_spacing);
4590 itemStaticBoxSizerVar->Add(0, border_size * 40);
4593 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4594 unitsSizer->SetHGap(border_size);
4596 int item_h_size = -1;
4598 item_h_size = m_fontHeight * 4;
4603 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4604 panelUnits->SetSizer(wrapperSizer);
4605 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4608 unitsSizer->Add(0, border_size * 4);
4609 unitsSizer->Add(0, border_size * 4);
4612 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4614 wxString pDistanceFormats[kNumDistanceFormats];
4615 for (
int i = 0; i < kNumDistanceFormats; i++) {
4616 pDistanceFormats[i] = kDistanceFormats[i].label;
4618 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4619 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4620 wxDefaultPosition, wxSize(item_h_size, -1),
4621 m_DistanceFormatsNChoices, pDistanceFormats);
4622 pDistanceFormat->SetToolTip(ttDistance());
4624 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4626 unitsSizer->Add(pDistanceFormat, inputFlags);
4629 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4631 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4632 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4633 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4634 wxDefaultPosition, wxSize(item_h_size, -1),
4635 m_SpeedFormatsNChoices, pSpeedFormats);
4636 pSpeedFormat->SetToolTip(ttSpeed());
4638 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4640 unitsSizer->Add(pSpeedFormat, inputFlags);
4643 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4645 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4646 int m_WindSpeedFormatsNChoices =
4647 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4648 pWindSpeedFormat =
new wxChoice(
4649 panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4650 wxSize(item_h_size, -1), m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4651 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4653 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4655 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4658 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4660 wxString pDepthUnitStrings[] = {
4666 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4667 wxSize(item_h_size, -1), 3, pDepthUnitStrings);
4668 pDepthUnitSelect->SetToolTip(ttDepth());
4670 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4672 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4675 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4677 wxString pHeightUnitStrings[] = {
4682 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4683 wxSize(item_h_size, -1), 2, pHeightUnitStrings);
4684 pHeightUnitSelect->SetToolTip(ttHeight());
4686 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4688 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4691 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4693 wxString pTempUnitStrings[] = {
4699 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4700 wxSize(item_h_size, -1), 3, pTempUnitStrings);
4701 pTempFormat->SetToolTip(ttTemp());
4703 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4705 unitsSizer->Add(pTempFormat, inputFlags);
4708 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4709 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4712 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4714 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4715 _(
"Decimal Degrees"),
4716 _(
"Degrees, Minutes, Seconds")};
4717 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4718 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4719 wxDefaultPosition, wxSize(item_h_size, -1),
4720 m_SDMMFormatsNChoices, pSDMMFormats);
4721 pSDMMFormat->SetToolTip(ttCoordFormat());
4723 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4725 unitsSizer->Add(pSDMMFormat, inputFlags);
4728 unitsSizer->Add(0, border_size * 4);
4729 unitsSizer->Add(0, border_size * 4);
4733 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4736 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4737 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4738 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4739 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4742 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4743 wxDefaultPosition, wxDefaultSize, 0);
4745 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4746 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4747 wxDefaultPosition, wxDefaultSize, 0);
4749 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4752 unitsSizer->Add(0, border_size * 4);
4753 unitsSizer->Add(0, border_size * 4);
4756 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4759 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4760 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4763 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4764 _(
"Show true bearings and headings"));
4765 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4766 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4767 _(
"Show magnetic bearings and headings."));
4768 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4770 bearingsSizer->AddSpacer(10);
4773 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4774 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4776 itemStaticTextUserVar =
4777 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4778 itemStaticTextUserVar->SetLabel(
4779 _(
"WMM Plugin calculated magnetic variation"));
4781 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4782 group_item_spacing);
4784 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4785 wxSize(50, -1), wxTE_RIGHT);
4786 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4788 itemStaticTextUserVar2 =
4789 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4790 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4791 group_item_spacing);
4793 bearingsSizer->AddSpacer(10);
4795 wxStaticText* varText =
4796 new wxStaticText(panelUnits, wxID_ANY,
4797 _(
" To set the magnetic variation manually,\n you "
4798 "must disable the WMM plugin."));
4799 smallFont = *dialogFont;
4800 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4802 varText->SetFont(smallFont);
4804 bearingsSizer->Add(varText);
4811class OCPNSoundPanel :
public wxPanel {
4813 OCPNSoundPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
4814 const wxSize& size, wxString title, wxString checkLegend,
4815 wxString selectLegend, wxString* pSoundFile);
4817 ~OCPNSoundPanel() {
delete m_sound; }
4819 void OnButtonSelectSound(wxCommandEvent& event);
4820 void OnButtonSPTestSound(wxCommandEvent& event);
4821 wxString SelectSoundFile();
4822 void SetSoundFileLabel(wxString file);
4823 wxCheckBox* GetCheckBox() {
return m_pCheck_Sound; }
4824 wxString GetSoundFile() {
return m_sound_file; }
4826 wxCheckBox* m_pCheck_Sound;
4827 wxSize m_small_button_size;
4828 wxString m_sound_file;
4829 wxString* m_pSoundFile;
4830 wxStaticText* m_AudioFileNameText;
4833 wxButton* TestSound;
4834 o_sound::Sound* m_sound;
4840 bool m_soundPlaying;
4842 DECLARE_EVENT_TABLE()
4845#define ID_SELECTSOUND 9341
4846#define ID_TESTSOUND 9342
4849EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4850EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4855 const wxPoint& pos, const wxSize& size,
4856 wxString title, wxString checkLegend,
4857 wxString selectLegend, wxString* pSoundFile)
4858 : wxPanel(parent,
id, pos, size, wxBORDER_NONE), m_soundPlaying(false) {
4859 wxFont* pif = FontMgr::Get().GetFont(_(
"Dialog"));
4862 m_pSoundFile = pSoundFile;
4863 if (pSoundFile) m_sound_file = *pSoundFile;
4865 m_sound = o_sound::Factory();
4867 int border_size = 4;
4868 int group_item_spacing = 2;
4870 int font_size_y, font_descent, font_lead;
4871 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
4872 m_small_button_size = wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4874 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4875 SetSizer(wrapperSizer);
4877 wxStaticBox* StaticBox1 =
new wxStaticBox(
this, wxID_ANY, title);
4878 wxStaticBoxSizer* StaticBoxSizer1 =
4879 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4880 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4882 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO, checkLegend);
4883 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4886 wxString LabelWrapped;
4892 g_pOptions->GetSize().x * 8 / 10);
4893 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4894 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4895 LabelWrapped +=
"\n";
4897 LabelWrapped +=
"\n";
4900 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4901 m_AudioFileNameText->Wrap(-1);
4902 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4904 SetSoundFileLabel(m_sound_file);
4907 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4908 soundSizer1->SetHGap(border_size * 2);
4909 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4911 SelSound =
new wxButton(
this, ID_SELECTSOUND, selectLegend, wxDefaultPosition,
4912 m_small_button_size, 0);
4913 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4914 soundSizer1->AddSpacer(group_item_spacing * 4);
4915 TestSound =
new wxButton(
this, ID_TESTSOUND, _(
"Test"), wxDefaultPosition,
4916 m_small_button_size, 0);
4917 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4918 auto sound_action = [
this](
ObservedEvt ev) { m_soundPlaying =
false; };
4919 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4922void OCPNSoundPanel::SetSoundFileLabel(wxString file) {
4923 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " + file);
4925 ChartDirPanelHardBreakWrapper wrapper(
this, soundLabel,
4926 g_pOptions->GetSize().x * 8 / 10);
4927 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4928 wxString LabelWrapped;
4929 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4931 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4933 LabelWrapped += LabelWrappedArray[i];
4934 LabelWrapped +=
"\n";
4937 m_AudioFileNameText->SetLabel(LabelWrapped);
4941wxString OCPNSoundPanel::SelectSoundFile() {
4942 wxString sound_dir =
g_Platform->GetSharedDataDir();
4943 sound_dir.Append(
"sounds");
4948 wxFileDialog* popenDialog =
new wxFileDialog(
4949 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4950 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
4952 popenDialog =
g_Platform->AdjustFileDialogFont(
this, popenDialog);
4954 response = popenDialog->ShowModal();
4955 sel_file = popenDialog->GetPath();
4960 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
4964 if (response == wxID_OK)
4970void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4971 wxString sel_file = SelectSoundFile();
4973 if (!sel_file.IsEmpty()) {
4974 m_sound_file =
g_Platform->NormalizePath(sel_file);
4975 if (m_pSoundFile) *m_pSoundFile = m_sound_file;
4977 SetSoundFileLabel(m_sound_file);
4982void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
4983 if (!m_soundPlaying) {
4984 m_sound->SetFinishedCallback(
4986 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
4987 m_soundPlaying =
true;
4993void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent& event) {
4994 if (event.IsChecked())
4995 m_pCheck_AlertAudio->SetValue(
true);
4997 if (!m_soundPanelSART->GetCheckBox()->GetValue() &&
4998 !m_soundPanelDSC->GetCheckBox()->GetValue())
4999 m_pCheck_AlertAudio->SetValue(
false);
5003void options::OnUXAudioEnableButtonClickSART(wxCommandEvent& event) {
5004 if (event.IsChecked())
5005 m_pCheck_AlertAudio->SetValue(
true);
5007 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5008 !m_soundPanelDSC->GetCheckBox()->GetValue())
5009 m_pCheck_AlertAudio->SetValue(
false);
5013void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent& event) {
5014 if (event.IsChecked())
5015 m_pCheck_AlertAudio->SetValue(
true);
5017 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5018 !m_soundPanelSART->GetCheckBox()->GetValue())
5019 m_pCheck_AlertAudio->SetValue(
false);
5023void options::CreatePanel_Sounds(
size_t parent,
int border_size,
5024 int group_item_spacing) {
5025 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
5027 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
5028 panelSounds->SetSizer(wrapperSizer);
5031 m_soundPanelAnchor =
new OCPNSoundPanel(
5032 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize,
5033 _(
"Anchor Alarm"), _(
"Play Sound on Anchor Alarm."),
5034 _(
"Select Anchor Alarm Sound"), &g_anchorwatch_sound_file);
5035 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
5038 m_soundPanelAIS =
new OCPNSoundPanel(
5039 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"AIS Alert"),
5040 _(
"Play Sound on AIS Alert."), _(
"Select AIS Alert Sound"),
5042 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
5044 m_soundPanelAIS->GetCheckBox()->Connect(
5045 wxEVT_COMMAND_CHECKBOX_CLICKED,
5046 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
5050 m_soundPanelSART =
new OCPNSoundPanel(
5051 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"SART Alert"),
5052 _(
"Play Sound on AIS SART Alert."), _(
"Select AIS SART Alert Sound"),
5053 &g_SART_sound_file);
5054 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
5056 m_soundPanelSART->GetCheckBox()->Connect(
5057 wxEVT_COMMAND_CHECKBOX_CLICKED,
5058 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
5062 m_soundPanelDSC =
new OCPNSoundPanel(
5063 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"DSC Alert"),
5064 _(
"Play Sound on DSC notification."), _(
"Select DSC notification Sound"),
5066 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
5068 m_soundPanelDSC->GetCheckBox()->Connect(
5069 wxEVT_COMMAND_CHECKBOX_CLICKED,
5070 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
5074 wxStaticBox* StatBoxSoundConfig =
5075 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
5076 wxStaticBoxSizer* StatBoxSoundConfigSizer =
5077 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
5078 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
5080 auto sound = std::unique_ptr<o_sound::Sound>(o_sound::Factory());
5081 int deviceCount = sound->DeviceCount();
5082 wxLogMessage(
"options: got device count: %d", deviceCount);
5083 if (deviceCount >= 1) {
5084 wxArrayString labels;
5085 for (
int i = 0; i < deviceCount; i += 1) {
5086 wxString label(sound->GetDeviceInfo(i));
5088 std::ostringstream stm;
5090 label = _(
"Unknown device :") + stm.str();
5092 if (!sound->IsOutputDevice(i)) {
5093 std::ostringstream stm;
5095 label = _(
"Input device :") + stm.str();
5102 int iDefault = labels.Index(
"default");
5104 if (g_iSoundDeviceIndex == -1) {
5106 g_iSoundDeviceIndex = iDefault;
5108 g_iSoundDeviceIndex = 0;
5111 pSoundDeviceIndex =
new wxChoice();
5112 if (pSoundDeviceIndex) {
5113 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
5114 wxDefaultSize, labels);
5115 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
5116 pSoundDeviceIndex->Show();
5117 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
5118 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
5119 group_item_spacing);
5121 stSoundDeviceIndex =
5122 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
5123 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
5124 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
5129 if ((
bool)
dynamic_cast<o_sound::SystemCmdSound*
>(o_sound::Factory())) {
5130 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
5131 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND,
5132 group_item_spacing);
5134 new wxTextCtrl(panelSounds, wxID_ANY,
"", wxDefaultPosition,
5135 wxSize(450, -1), wxTE_LEFT);
5137 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
5138 wxALIGN_LEFT | wxALL);
5139 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
5143 if (!deviceCount) StatBoxSoundConfig->Hide();
5146 stSoundDeviceIndex->Hide();
5147 pSoundDeviceIndex->Hide();
5151void options::CreatePanel_MMSI(
size_t parent,
int border_size,
5152 int group_item_spacing) {
5153 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
5155 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
5156 panelMMSI->SetSizer(MMSISizer);
5159 wxStaticBox* itemStaticBoxMMSI =
5160 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
5161 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
5162 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
5163 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
5165 pPropsPanel =
new MMSI_Props_Panel(panelMMSI);
5167 pPropsPanel->UpdateMMSIList();
5169 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
5171 panelMMSI->Layout();
5174void options::CreatePanel_AIS(
size_t parent,
int border_size,
5175 int group_item_spacing) {
5176 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5178 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5179 panelAIS->SetSizer(aisSizer);
5182 wxStaticBox* itemStaticBoxCPA =
5183 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5184 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5185 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5186 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5188 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5189 pCPAGrid->AddGrowableCol(1);
5190 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5192 m_pCheck_CPA_Max =
new wxCheckBox(
5194 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5195 m_pCheck_CPA_Max->SetToolTip(
5196 _(
"Disable CPA (Closest Point of Approach) and TCPA (Time to CPA) alerts "
5197 "for targets beyond this distance from your vessel"));
5198 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5200 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5201 m_pText_CPA_Max->SetToolTip(
5202 _(
"Maximum distance in nautical miles at which Closest Point of Approach "
5203 "alerts will be triggered"));
5204 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5207 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5208 m_pCheck_CPA_Warn->SetToolTip(
5209 _(
"Enable warning alerts when targets have a Closest Point of Approach "
5210 "less than this distance"));
5211 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5214 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5215 m_pText_CPA_Warn->SetToolTip(
5216 _(
"Distance threshold in nautical miles for CPA warning alerts"));
5217 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5219 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5220 wxCommandEventHandler(options::OnCPAWarnClick),
5223 m_pCheck_CPA_WarnT =
5224 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5225 m_pCheck_CPA_WarnT->SetToolTip(
5226 _(
"Additional time constraint - alerts only occur if the Time to Closest "
5227 "Point of Approach is less than this value"));
5228 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5230 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5231 m_pText_CPA_WarnT->SetToolTip(
5232 _(
"Time threshold in minutes for TCPA constraints"));
5233 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5234 group_item_spacing);
5237 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5238 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5239 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5241 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5242 pLostGrid->AddGrowableCol(1);
5243 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5245 m_pCheck_Mark_Lost =
5246 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5247 m_pCheck_Mark_Lost->SetToolTip(
5248 _(
"Targets will be considered lost when no update is received for this "
5250 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5252 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5253 m_pText_Mark_Lost->SetToolTip(
5254 _(
"Time in minutes after which targets with no updates are marked as "
5256 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5257 group_item_spacing);
5259 m_pCheck_Remove_Lost =
5260 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5261 m_pCheck_Remove_Lost->SetToolTip(
5262 _(
"Lost targets will be completely removed from display after this "
5263 "additional time period"));
5264 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5266 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5267 m_pText_Remove_Lost->SetToolTip(_(
5268 "Time in minutes after which lost targets are removed from the display"));
5269 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5270 group_item_spacing);
5272 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5275 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5276 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5277 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5279 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5280 pDisplayGrid->AddGrowableCol(1);
5281 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5283 m_pCheck_Show_COG =
new wxCheckBox(
5284 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5285 m_pCheck_Show_COG->SetToolTip(
5286 _(
"Display a predictor arrow for each AIS target, showing its projected "
5287 "course over ground for the specified number of minutes."));
5288 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5290 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5291 m_pText_COG_Predictor->SetToolTip(
5292 _(
"Set the length in minutes for the COG predictor arrow for AIS "
5294 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5295 group_item_spacing);
5297 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5298 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5299 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5300 m_pCheck_Sync_OCOG_ACOG->Connect(
5301 wxEVT_COMMAND_CHECKBOX_CLICKED,
5302 wxCommandEventHandler(options::OnSyncCogPredClick), NULL,
this);
5304 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1,
"");
5305 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5307 m_pCheck_Show_Tracks =
5308 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5309 m_pCheck_Show_Tracks->SetToolTip(
5310 _(
"Display the recent track (history) of each AIS target for the "
5311 "specified number of minutes."));
5312 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5314 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5315 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5316 group_item_spacing);
5318 m_pCheck_Hide_Moored =
new wxCheckBox(
5319 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5320 m_pCheck_Hide_Moored->SetToolTip(
5321 _(
"Hide AIS targets that are moving slower than this speed, typically "
5322 "indicating they are anchored or moored."));
5323 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5325 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5326 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5327 group_item_spacing);
5329 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5330 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5331 m_pCheck_Draw_Realtime_Prediction->SetToolTip(
5332 _(
"Show a real-time prediction vector for AIS targets moving faster than "
5334 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5335 group_item_spacing);
5337 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5338 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5339 group_item_spacing);
5341 m_pCheck_Scale_Priority =
new wxCheckBox(
5343 _(
"Allow attenuation of less critical targets if more than ... targets"));
5344 m_pCheck_Scale_Priority->SetToolTip(
5345 _(
"Reduce the display prominence of less critical AIS targets when the "
5346 "number of targets exceeds the specified value."));
5347 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5349 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5350 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5351 group_item_spacing);
5353 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5354 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5355 m_pCheck_Show_Area_Notices->SetToolTip(
5356 _(
"Display area notices received via AIS binary messages on the chart."));
5357 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5359 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1,
"");
5360 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5362 m_pCheck_Draw_Target_Size =
5363 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5364 m_pCheck_Draw_Target_Size->SetToolTip(
5365 _(
"Display AIS targets using their actual reported size and shape on the "
5367 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5369 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1,
"");
5370 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5372 m_pCheck_Show_Target_Name =
new wxCheckBox(
5373 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5374 m_pCheck_Show_Target_Name->SetToolTip(
5375 _(
"Display the name of AIS targets when the chart scale is greater than "
5376 "the specified value."));
5377 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5379 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5380 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5381 group_item_spacing);
5383 m_pCheck_use_Wpl =
new wxCheckBox(
5384 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5385 m_pCheck_use_Wpl->SetToolTip(
5386 _(
"Enable processing of WPL (Waypoint Location) position messages from "
5387 "AIS and select the action to take when received."));
5388 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5390 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5391 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5392 wxDefaultSize, 2, Wpl_Action);
5393 m_pWplAction->SetToolTip(
5394 _(
"Select the action to perform when a WPL message is received: create "
5395 "an Automatic Packet Reporting System (APRS) report or a mark on the "
5397 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5400 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5401 wxStaticBoxSizer* rolloverSizer =
5402 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5403 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5405 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5406 _(
"Enable route/AIS info block"));
5407 pRollover->SetToolTip(
5408 _(
"Show a popup info block with details about routes and AIS targets "
5409 "when hovering over them."));
5410 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5412 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5413 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5417 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5418 pStatic_CallSign->SetToolTip(
5419 _(
"Display the ship name and MMSI (call sign) in the rollover info "
5421 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5423 m_pCheck_Rollover_Class =
5424 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5425 m_pCheck_Rollover_Class->SetToolTip(
5426 _(
"Show the AIS class, type, and status in the rollover info block."));
5427 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5429 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5430 m_pCheck_Rollover_COG->SetToolTip(
5431 _(
"Show speed over ground (SOG) and course over ground (COG) in the "
5432 "rollover info block."));
5433 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5435 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5436 m_pCheck_Rollover_CPA->SetToolTip(
5437 _(
"Show Closest Point of Approach (CPA) and time to CPA (TCPA) in the "
5438 "rollover info block."));
5439 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5442 wxStaticBox* alertBox =
5443 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5444 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5445 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5447 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5448 pAlertGrid->AddGrowableCol(1);
5449 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5451 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5452 _(
"Show CPA/TCPA Alert Dialog"));
5453 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5455 m_pCheck_AlertDialog->Connect(
5456 wxEVT_COMMAND_CHECKBOX_CLICKED,
5457 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5466 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1,
"");
5467 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5469 m_pCheck_AlertAudio =
new wxCheckBox(
5470 panelAIS, ID_AISALERTAUDIO,
5471 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5472 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5474 m_pCheck_AlertAudio->Connect(
5475 wxEVT_COMMAND_CHECKBOX_CLICKED,
5476 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5479 wxButton* m_pPlay_Sound =
5480 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"), wxDefaultPosition,
5481 m_small_button_size, 0);
5482 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5484 m_pPlay_Sound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
5485 wxCommandEventHandler(options::OnButtonTestSound),
5491 m_pCheck_Alert_Moored =
new wxCheckBox(
5492 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5493 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5495 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1,
"");
5496 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5498 m_pCheck_Ack_Timout =
new wxCheckBox(
5499 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5500 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5502 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5503 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5504 group_item_spacing);
5509class MouseZoomSlider :
public wxSlider {
5511 MouseZoomSlider(wxWindow* parent, wxSize size)
5512 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5516 GetHandle()->setStyleSheet(getQtStyleSheet());
5521void options::CreatePanel_UI(
size_t parent,
int border_size,
5522 int group_item_spacing) {
5523 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5525 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5526 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5528 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5529 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5531 wxStaticBox* itemLangStaticBox =
5532 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5533 wxStaticBoxSizer* itemLangStaticBoxSizer =
5534 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5536 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5538 wxSize langChoiceSize = wxSize(-1, -1);
5541 langChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5544 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG,
5545 wxDefaultPosition, langChoiceSize);
5547 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5554 wxStaticBox* itemFontStaticBox =
5555 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5557 wxSize fontChoiceSize = wxSize(-1, -1);
5559 int fLayout = wxHORIZONTAL;
5562 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5565 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5568 wxStaticBoxSizer* itemFontStaticBoxSizer =
5569 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5570 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5573 m_itemFontElementListBox =
5574 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5575 fontChoiceSize, 0, NULL, wxCB_SORT);
5577 wxArrayString uniqueStrings = FontMgr::Get().GetDialogStrings(g_locale);
5578 for (
size_t i = 0; i < uniqueStrings.GetCount(); i++) {
5579 m_itemFontElementListBox->Append(uniqueStrings[i]);
5582 if (uniqueStrings.GetCount()) m_itemFontElementListBox->SetSelection(0);
5584 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5586 wxButton* itemFontChooseButton =
5587 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5588 wxDefaultPosition, wxDefaultSize, 0);
5589 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5590#if defined(__WXGTK__) || defined(__WXQT__)
5591 wxButton* itemFontColorButton =
5592 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5593 wxDefaultPosition, wxDefaultSize, 0);
5594 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5596 wxButton* itemFontResetButton =
5597 new wxButton(itemPanelFont, ID_BUTTONFONT_RESET, _(
"Reset to Default"),
5598 wxDefaultPosition, wxDefaultSize, 0);
5599 itemFontStaticBoxSizer->Add(itemFontResetButton, 0, wxALL, border_size);
5601 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5602 wxDefaultPosition, wxDefaultSize, 0);
5603 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5608 wxStaticBox* itemStyleStaticBox =
5609 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5610 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5611 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5612 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5614 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5617 for (
unsigned int i = 0; i < styles.Count(); i++) {
5618 ocpnStyle::Style* style = (ocpnStyle::Style*)(styles[i]);
5619 m_itemStyleListBox->Append(style->name);
5621 m_itemStyleListBox->SetStringSelection(
5623 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5626 wxStaticBox* miscOptionsBox =
5627 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5628 wxStaticBoxSizer* miscOptions =
5629 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5630 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5633 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5634 pShowStatusBar->SetValue(FALSE);
5635 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5638 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5639 pShowMenuBar->SetValue(FALSE);
5640 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5644 pShowMenuBar->Hide();
5647 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5648 pShowChartBar->SetValue(g_bShowChartBar);
5649 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5651 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5652 _(
"Show Compass/GPS Status Window"));
5653 pShowCompassWin->SetValue(FALSE);
5654 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5656 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5657 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5659 pToolbarAutoHideCB =
5660 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5661 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5663 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL,
"", wxDefaultPosition,
5664 wxSize(50, -1), wxTE_RIGHT);
5665 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5667 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5668 group_item_spacing);
5670 auto enable_debug_cb =
new wxCheckBox(itemPanelFont, wxID_ANY,
5671 _(
"Enable Debug in root context menu"));
5672 enable_debug_cb->Bind(wxEVT_CHECKBOX, [enable_debug_cb](wxCommandEvent&) {
5673 g_enable_root_menu_debug = enable_debug_cb->IsChecked();
5675 enable_debug_cb->SetValue(g_enable_root_menu_debug);
5676 miscOptions->Add(enable_debug_cb, 0, wxALL, border_size);
5680 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5681 miscOptions->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5684 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5685 _(
"Enable Touchscreen interface"));
5686 miscOptions->Add(pMobile, 0, wxALL, border_size);
5688 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5689 _(
"Enable Scaled Graphics interface"));
5690 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5695 pResponsive->Hide();
5699 pResponsive->Hide();
5702 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5703 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5705 pZoomButtons->Hide();
5708 pHiconColors =
new wxCheckBox(itemPanelFont, ID_HICONCOLORS,
5709 _(
"Use High Contrast Chart Colors"));
5710 miscOptions->Add(pHiconColors, 0, wxALL, border_size);
5713 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5714 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5716 wxButton* itemEcdisHelp =
5717 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5718 wxDefaultPosition, wxDefaultSize, 0);
5719 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5722 pInlandEcdis->Hide();
5723 itemEcdisHelp->Hide();
5726 miscOptions->AddSpacer(10);
5728 wxFlexGridSizer* sliderSizer;
5729 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5730 sliderSizer->AddGrowableCol(1);
5731 sliderSizer->SetFlexibleDirection(wxBOTH);
5732 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5734 m_pSlider_GUI_Factor =
5735 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5736 m_sliderSize, SLIDER_STYLE);
5737 m_pSlider_GUI_Factor->Hide();
5738 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5739 _(
"User Interface scale factor")),
5741 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5742 m_pSlider_GUI_Factor->Show();
5745 prepareSlider(m_pSlider_GUI_Factor);
5748 m_pSlider_Chart_Factor =
5749 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5750 m_sliderSize, SLIDER_STYLE);
5751 m_pSlider_Chart_Factor->Hide();
5753 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5755 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5756 m_pSlider_Chart_Factor->Show();
5759 prepareSlider(m_pSlider_Chart_Factor);
5762 m_pSlider_Ship_Factor =
5763 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5764 m_sliderSize, SLIDER_STYLE);
5765 m_pSlider_Ship_Factor->Hide();
5767 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5769 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5770 m_pSlider_Ship_Factor->Show();
5773 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5776 m_pSlider_Text_Factor =
5777 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5778 m_sliderSize, SLIDER_STYLE);
5779 m_pSlider_Text_Factor->Hide();
5781 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5783 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5784 m_pSlider_Text_Factor->Show();
5787 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5790 m_pSlider_ENCText_Factor =
5791 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5792 m_sliderSize, SLIDER_STYLE);
5793 m_pSlider_ENCText_Factor->Hide();
5795 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5797 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5798 m_pSlider_ENCText_Factor->Show();
5801 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5804 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5805 _(
"Mouse wheel zoom sensitivity")),
5807 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5808 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5810 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5811 miscOptions->AddSpacer(20);
5814void options::OnResetFont(wxCommandEvent& event) {
5815 wxString itemElement;
5816 int i = m_itemFontElementListBox->GetSelection();
5818 itemElement = m_itemFontElementListBox->GetString(i);
5820 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5822 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5823 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5826 m_textSample->SetFont(*pFont);
5827 m_textSample->SetForegroundColour(colour);
5828 m_textSample->Refresh();
5831 top_frame::Get()->UpdateAllFonts();
5832 m_bfontChanged =
true;
5833 OnFontChoice(event);
5838void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5839 m_pCheck_AlertAudio->Enable(event.IsChecked());
5840 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5843void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5844 if (event.IsChecked()) {
5845 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5846 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5847 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5851void options::CreateListbookIcons() {
5854 if (!g_bresponsive) {
5857 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5859#if wxCHECK_VERSION(2, 8, 12)
5860 m_topImgList->Add(style->GetIcon(
"Display", sx, sy));
5861 m_topImgList->Add(style->GetIcon(
"Charts", sx, sy));
5862 m_topImgList->Add(style->GetIcon(
"Connections", sx, sy));
5863 m_topImgList->Add(style->GetIcon(
"Ship", sx, sy));
5864 m_topImgList->Add(style->GetIcon(
"UI", sx, sy));
5865 m_topImgList->Add(style->GetIcon(
"Plugins", sx, sy));
5869 bmp = style->GetIcon(
"Display");
5870 img = bmp.ConvertToImage();
5871 img.ConvertAlphaToMask(128);
5872 bmp = wxBitmap(img);
5873 m_topImgList->Add(bmp);
5874 bmp = style->GetIcon(
"Charts");
5875 img = bmp.ConvertToImage();
5876 img.ConvertAlphaToMask(128);
5877 bmp = wxBitmap(img);
5878 m_topImgList->Add(bmp);
5879 bmp = style->GetIcon(
"Connections");
5880 img = bmp.ConvertToImage();
5881 img.ConvertAlphaToMask(128);
5882 bmp = wxBitmap(img);
5883 m_topImgList->Add(bmp);
5884 bmp = style->GetIcon(
"Ship");
5885 img = bmp.ConvertToImage();
5886 img.ConvertAlphaToMask(128);
5887 bmp = wxBitmap(img);
5888 m_topImgList->Add(bmp);
5889 bmp = style->GetIcon(
"UI");
5890 img = bmp.ConvertToImage();
5891 img.ConvertAlphaToMask(128);
5892 bmp = wxBitmap(img);
5893 m_topImgList->Add(bmp);
5894 bmp = style->GetIcon(
"Plugins");
5895 img = bmp.ConvertToImage();
5896 img.ConvertAlphaToMask(128);
5897 bmp = wxBitmap(img);
5898 m_topImgList->Add(bmp);
5902 bmps = style->GetIcon(
"Display");
5903 int base_size = bmps.GetWidth();
5904 double tool_size = base_size;
5906 double premult = 1.0;
5910 double target_size = 6.0;
5912 double basic_tool_size_mm = tool_size /
g_Platform->GetDisplayDPmm();
5913 premult = target_size / basic_tool_size_mm;
5916 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5917 postmult = wxMin(postmult, 3.0);
5918 postmult = wxMax(postmult, 1.0);
5920 int sizeTab = base_size * postmult * premult;
5922 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5926 bmp = style->GetIcon(
"Display");
5927 img = bmp.ConvertToImage();
5928 simg = img.Scale(sizeTab, sizeTab);
5929 bmp = wxBitmap(simg);
5930 m_topImgList->Add(bmp);
5931 bmp = style->GetIcon(
"Charts");
5932 img = bmp.ConvertToImage();
5933 simg = img.Scale(sizeTab, sizeTab);
5934 bmp = wxBitmap(simg);
5935 m_topImgList->Add(bmp);
5936 bmp = style->GetIcon(
"Connections");
5937 img = bmp.ConvertToImage();
5938 simg = img.Scale(sizeTab, sizeTab);
5939 bmp = wxBitmap(simg);
5940 m_topImgList->Add(bmp);
5941 bmp = style->GetIcon(
"Ship");
5942 img = bmp.ConvertToImage();
5943 simg = img.Scale(sizeTab, sizeTab);
5944 bmp = wxBitmap(simg);
5945 m_topImgList->Add(bmp);
5946 bmp = style->GetIcon(
"UI");
5947 img = bmp.ConvertToImage();
5948 simg = img.Scale(sizeTab, sizeTab);
5949 bmp = wxBitmap(simg);
5950 m_topImgList->Add(bmp);
5951 bmp = style->GetIcon(
"Plugins");
5952 img = bmp.ConvertToImage();
5953 simg = img.Scale(sizeTab, sizeTab);
5954 bmp = wxBitmap(simg);
5955 m_topImgList->Add(bmp);
5959void options::CreateControls() {
5960 int border_size = 4;
5962 int group_item_spacing = 2;
5964 int font_size_y, font_descent, font_lead;
5965 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
5966 m_fontHeight = font_size_y + font_descent + font_lead;
5971 m_fontHeight * 8 / 10);
5978 m_small_button_size =
5979 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5981 m_nCharWidthMax = GetSize().x / GetCharWidth();
5984 pEnableZoomToCursor = NULL;
5985 pSmoothPanZoom = NULL;
5993 if (!g_bresponsive && height <= 800) {
5995 group_item_spacing = 1;
5999 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
6000 inputFlags = wxSizerFlags(0)
6001 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
6002 .Border(wxALL, group_item_spacing);
6003 verticleInputFlags =
6004 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
6005 groupLabelFlags = wxSizerFlags(0)
6006 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
6007 .Border(wxALL, group_item_spacing);
6008 groupLabelFlagsHoriz =
6009 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
6010 groupInputFlags = wxSizerFlags(0)
6011 .Align(wxALIGN_LEFT | wxALIGN_TOP)
6012 .Border(wxBOTTOM, group_item_spacing * 2)
6016 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
6019 options* itemDialog1 =
this;
6021 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
6022 itemDialog1->SetSizer(itemBoxSizer2);
6026 wxFont* qFont = dialogFont;
6028 wxString wqs = getFontQtStylesheet(qFont);
6029 wxCharBuffer sbuf = wqs.ToUTF8();
6030 QString qsb = QString(sbuf.data());
6032 QString qsbq = getQtStyleSheet();
6034 itemDialog1->GetHandle()->setStyleSheet(qsb +
6041#ifdef OCPN_OPTIONS_USE_LISTBOOK
6043 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6044 wxSize(-1, -1), flags);
6045 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
6046 wxListbookEventHandler(options::OnPageChange), NULL,
6050 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6051 wxSize(-1, -1), flags);
6052 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6053 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
6060 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
6064 CreateListbookIcons();
6066 m_pListbook->SetImageList(m_topImgList);
6067 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
6069 m_OK_Cancel_Apply_buttons =
new wxBoxSizer(wxHORIZONTAL);
6070 itemBoxSizer2->Add(m_OK_Cancel_Apply_buttons, 0, wxALIGN_RIGHT | wxALL,
6073 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
6074 m_OKButton->SetDefault();
6075 m_OK_Cancel_Apply_buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
6078 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
6079 m_OK_Cancel_Apply_buttons->Add(m_CancelButton, 0,
6080 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6082 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
6083 m_OK_Cancel_Apply_buttons->Add(m_ApplyButton, 0,
6084 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6086 m_pageDisplay = CreatePanel(_(
"Display"));
6087 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
6088 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
6089 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
6090 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
6092 m_pageCharts = CreatePanel(_(
"Charts"));
6093 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
6094 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
6097 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
6098 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
6101 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
6103#ifdef OCPN_OPTIONS_USE_LISTBOOK
6104 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6105 wxListbookEventHandler(options::OnChartsPageChange), NULL,
6108 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6109 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
6115 wxString ConnTab = _(
"Connections");
6117 ConnTab = _(
"Connect");
6119 m_pageConnections = CreatePanel(ConnTab);
6120 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6124 m_pageShips = CreatePanel(_(
"Ships"));
6125 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
6126 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
6127 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
6129 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
6131 wxString UITab = _(
"User Interface");
6135 m_pageUI = CreatePanel(UITab);
6136 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
6137 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
6139 m_pagePlugins = CreatePanel(_(
"Plugins"));
6140 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
6142 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
6143 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
6149 SetColorScheme(
static_cast<ColorScheme
>(0));
6160 SetSizeHints(-1, -1, width - marginx, height - marginy);
6169void options::SetInitialPage(
int page_sel,
int sub_page) {
6170 if (page_sel < (
int)m_pListbook->GetPageCount())
6171 m_pListbook->SetSelection(page_sel);
6173 m_pListbook->SetSelection(0);
6175 if (sub_page >= 0) {
6176 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
6177 wxNotebookPage* pg = m_pListbook->GetPage(i);
6178 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
6180 if (i == (
size_t)page_sel) {
6181 if (sub_page < (
int)nb->GetPageCount())
6182 nb->SetSelection(sub_page);
6184 nb->SetSelection(0);
6186 nb->ChangeSelection(0);
6192void options::SetColorScheme(ColorScheme cs) {
6195#ifdef OCPN_OPTIONS_USE_LISTBOOK
6196 wxListView* lv = m_pListbook->GetListView();
6197 lv->SetBackgroundColour(GetBackgroundColour());
6200 delete m_topImgList;
6201 CreateListbookIcons();
6202 m_pListbook->SetImageList(m_topImgList);
6210 comm_dialog->SetColorScheme(cs);
6213void options::OnAISRolloverClick(wxCommandEvent& event) {
6214 m_pCheck_Rollover_Class->Enable(event.IsChecked());
6215 m_pCheck_Rollover_COG->Enable(event.IsChecked());
6216 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
6217 pStatic_CallSign->Enable(event.IsChecked());
6220void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
6222 case ID_SCREENCONFIG1:
6223 if (m_sconfigSelect_twovertical)
6224 m_sconfigSelect_twovertical->SetSelected(
false);
6228 case ID_SCREENCONFIG2:
6229 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6235void options::SetInitialSettings() {
6238 m_returnChanges = 0;
6239 m_bfontChanged =
false;
6240 m_font_element_array.Clear();
6242 b_oldhaveWMM = b_haveWMM;
6243 auto loader = PluginLoader::GetInstance();
6244 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
6247 switch (g_canvasConfig) {
6250 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
6251 if (m_sconfigSelect_twovertical)
6252 m_sconfigSelect_twovertical->SetSelected(
false);
6255 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6256 if (m_sconfigSelect_twovertical)
6257 m_sconfigSelect_twovertical->SetSelected(
true);
6260 m_screenConfig = g_canvasConfig;
6264 ActiveChartArray.Clear();
6265 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6266 ActiveChartArray.Add(m_CurrentDirList[i]);
6270 if (m_pWorkDirList) {
6271 UpdateWorkArrayFromDisplayPanel();
6272 groupsPanel->SetDBDirs(*m_pWorkDirList);
6275 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6276 delete m_pGroupArray;
6277 m_pGroupArray = groupsPanel->CloneChartGroupArray(
g_pGroupArray);
6278 groupsPanel->SetGroupArray(m_pGroupArray);
6279 groupsPanel->SetInitialSettings();
6283 pShowStatusBar->SetValue(g_bShowStatusBar);
6285 pShowMenuBar->SetValue(g_bShowMenuBar);
6287 pShowCompassWin->SetValue(g_bShowCompassWin);
6291 pCOGUPUpdateSecs->SetValue(s);
6293 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6294 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6296 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6297 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6298 pMobile->SetValue(g_btouch);
6299 pResponsive->SetValue(g_bresponsive);
6306 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6310 pInlandEcdis->SetValue(g_bInlandEcdis);
6311 pHiconColors->SetValue(g_hicon_colors);
6314 pOpenGL->SetValue(g_bopengl);
6315 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6316 w->Enable(pOpenGL->IsChecked());
6319 pCBTrueShow->SetValue(g_bShowTrue);
6320 pCBMagShow->SetValue(g_bShowMag);
6322 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6326 itemStaticTextUserVar->SetLabel(
6327 _(
"WMM Plugin calculated magnetic variation"));
6329 s.Printf(
"%4.1f",
gVar);
6330 pMagVar->SetValue(s);
6332 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6334 s.Printf(
"%4.1f", g_UserVar);
6335 pMagVar->SetValue(s);
6338 int newLength = itemStaticTextUserVar->GetLabel().Length();
6341 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6342 wxSize sz = GetSize();
6343 SetSize(sz.x + 1, sz.y);
6347 itemStaticTextUserVar2->Enable(!b_haveWMM);
6348 pMagVar->Enable(!b_haveWMM);
6355 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6359 wxString stringDefaultBoatSpeed;
6360 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6361 g_defaultBoatSpeed = 6.0;
6362 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6364 stringDefaultBoatSpeed.Printf(
"%d", (
int)g_defaultBoatSpeedUserUnit);
6365 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6369 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6370 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6371 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6373 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6375 s.Printf(
"%6.2f", g_ownship_predictor_minutes);
6377 s.Printf(
"%4.0f", g_ownship_predictor_minutes);
6378 m_pText_OSCOG_Predictor->SetValue(s);
6380 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6381 g_ownship_HDTpredictor_miles) > 1e-4)
6382 s.Printf(
"%6.2f", g_ownship_HDTpredictor_miles);
6384 s.Printf(
"%4.0f", g_ownship_HDTpredictor_miles);
6385 m_pText_OSHDT_Predictor->SetValue(s);
6389 m_pTxt_OwnMMSI->SetValue(s);
6391 m_pTxt_OwnMMSI->SetValue(
"");
6393 m_pShipIconType->SetSelection(g_OwnShipIconType);
6394 wxCommandEvent eDummy;
6395 OnShipTypeSelect(eDummy);
6396 m_pOSLength->SetValue(wxString::Format(
"%.1f", g_n_ownship_length_meters));
6397 m_pOSWidth->SetValue(wxString::Format(
"%.1f", g_n_ownship_beam_meters));
6398 m_pOSGPSOffsetX->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_x));
6399 m_pOSGPSOffsetY->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_y));
6400 m_pOSMinSize->SetValue(wxString::Format(
"%d", g_n_ownship_min_mm));
6401 m_pText_ACRadius->SetValue(
6402 wxString::Format(
"%.3f", g_n_arrival_circle_radius));
6405 if (g_iNavAidRadarRingsNumberVisible > 10)
6406 g_iNavAidRadarRingsNumberVisible = 10;
6407 pNavAidRadarRingsNumberVisible->SetSelection(
6408 g_iNavAidRadarRingsNumberVisible);
6409 buf.Printf(
"%.3f", g_fNavAidRadarRingsStep);
6410 pNavAidRadarRingsStep->SetValue(buf);
6411 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6412 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6414 pScaMinChckB->SetValue(g_bUseWptScaMin);
6415 m_pText_ScaMin->SetValue(wxString::Format(
"%i", g_iWpt_ScaMin));
6416 m_pText_ScaMax->SetValue(wxString::Format(
"%i", g_iWpt_ScaMax));
6417 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6419 OnRadarringSelect(eDummy);
6421 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6422 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6423 buf.Printf(
"%.3f", g_fWaypointRangeRingsStep);
6424 pWaypointRangeRingsStep->SetValue(buf);
6425 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6427 OnWaypointRangeRingSelect(eDummy);
6428 pShowshipToActive->SetValue(g_bShowShipToActive);
6429 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6430 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6432 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6433 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6435 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6436 if (pEnableTenHertz) pEnableTenHertz->SetValue(g_btenhertz);
6438 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6439 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6441 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6443 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6446 pSDMMFormat->Select(g_iSDMMFormat);
6450 pDistanceFormat->SetSelection(distance_ui_index);
6453 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6455 if (pHeightUnitSelect) pHeightUnitSelect->SetSelection(
g_iHeightFormat);
6457 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6458 g_bAdvanceRouteWaypointOnArrivalOnly);
6469 pTrackDaily->SetValue(g_bTrackDaily);
6470 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6471 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6472 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6473 TIME_TYPE_COMPUTER);
6474 pTrackHighlite->SetValue(g_bHighliteTracks);
6475 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6476 pTrackPrecision->SetSelection(g_nTrackPrecision);
6478 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6482 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6484 s.Printf(
"%4.1f", g_CPAMax_NM);
6485 m_pText_CPA_Max->SetValue(s);
6487 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6489 s.Printf(
"%4.1f", g_CPAWarn_NM);
6490 m_pText_CPA_Warn->SetValue(s);
6492 if (m_pCheck_CPA_Warn->GetValue()) {
6493 m_pCheck_CPA_WarnT->Enable();
6494 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6496 m_pCheck_CPA_WarnT->Disable();
6498 s.Printf(
"%4.0f", g_TCPA_Max);
6499 m_pText_CPA_WarnT->SetValue(s);
6502 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6504 s.Printf(
"%4.0f", g_MarkLost_Mins);
6505 m_pText_Mark_Lost->SetValue(s);
6507 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6509 s.Printf(
"%4.0f", g_RemoveLost_Mins);
6510 m_pText_Remove_Lost->SetValue(s);
6513 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6515 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6516 m_pText_COG_Predictor->SetValue(s);
6518 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6519 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6521 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6523 s.Printf(
"%4.0f", g_AISShowTracks_Mins);
6524 m_pText_Track_Length->SetValue(s);
6526 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6528 s.Printf(
"%4.1f", g_ShowMoored_Kts);
6529 m_pText_Moored_Speed->SetValue(s);
6531 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6533 s.Printf(
"%4.1f", g_AIS_RealtPred_Kts);
6534 m_pText_RealtPred_Speed->SetValue(s);
6536 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6538 s.Printf(
"%i", g_ShowScaled_Num);
6539 m_pText_Scale_Priority->SetValue(s);
6541 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6543 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6544 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6546 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6548 s.Printf(
"%d", g_Show_Target_Name_Scale);
6549 m_pText_Show_Target_Name_Scale->SetValue(s);
6551 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6552 m_pWplAction->SetSelection(g_WplAction);
6555 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6556 if (g_bAIS_CPA_Alert) {
6557 m_pCheck_AlertAudio->Enable();
6558 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6560 m_pCheck_AlertAudio->Disable();
6561 m_pCheck_AlertAudio->SetValue(
false);
6564 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6566 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6567 s.Printf(
"%4.0f", g_AckTimeout_Mins);
6568 m_pText_ACK_Timeout->SetValue(s);
6571 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6572 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6573 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6576 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6577 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6578 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6580 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6581 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6583 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6584 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6585 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6586 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6587 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6588 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6591 if (!g_config_display_size_manual) {
6592 pRBSizeAuto->SetValue(TRUE);
6594 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6596 screenmm.RemoveLast();
6597 pScreenMM->Disable();
6600 screenmm.Append(wxString::Format(
"%zu,", mm));
6602 screenmm.RemoveLast();
6603 pRBSizeManual->SetValue(TRUE);
6606 pScreenMM->SetValue(screenmm);
6610 UpdateOptionsUnits();
6612 SetInitialVectorSettings();
6614 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6616 s.Printf(
"%d", g_nAutoHideToolbar);
6617 pToolbarHideSecs->SetValue(s);
6621 delete m_pSerialArray;
6622 m_pSerialArray = NULL;
6624 m_bForceNewToolbaronCancel =
false;
6627void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6628 if (ps57CtlListBox) {
6630 ps57CtlListBox->Clear();
6631 marinersStdXref.clear();
6633 ps57CtlListBox->Freeze();
6635 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6637 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6640 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6641 item = ps52plib->OBJLDescriptions[iPtr];
6643 item = wxString(pOLE->OBJLName, wxConvUTF8);
6649 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6650 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6651 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6653 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6654 (catl == DISPLAYBASE))
6656 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6659 bool benable =
true;
6660 if (cat > 0) benable = cat != DISPLAYBASE;
6665 int newpos = ps57CtlListBox->Append(item, benable,
false);
6666 marinersStdXref.push_back(newpos);
6667 for (
size_t i = 0; i < iPtr; i++) {
6668 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6672 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6674 if (cat == DISPLAYBASE) bviz =
true;
6677 if (cat == STANDARD) {
6682 ps57CtlListBox->Check(newpos, bviz);
6684 ps57CtlListBox->Thaw();
6687 ps57CtlListBox->RunLayout();
6690 wxSize s = ps57CtlListBox->GetSize();
6691 ps57CtlListBox->SetSize(s.x, s.y - 1);
6695void options::SetInitialVectorSettings() {
6696 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6700 m_bVectorInit =
true;
6701 resetMarStdList(
true,
false);
6704 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6708 switch (ps52plib->GetDisplayCategory()) {
6718 case (MARINERS_STANDARD):
6726 if (pDispCat) pDispCat->SetSelection(nset);
6730 bool benableMarStd =
false;
6732 for (
unsigned int i = 0; i <
g_canvasArray.GetCount(); i++) {
6735 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6736 benableMarStd =
true;
6745 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6746 itemButtonClearList->Enable(benableMarStd);
6747 itemButtonSelectList->Enable(benableMarStd);
6748 itemButtonSetStd->Enable(benableMarStd);
6751 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6752 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6753 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6754 if (pCheck_XLSECTTEXT)
6755 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6757 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6758 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6759 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6760 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6762 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6763 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6766 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6767 pPointStyle->SetSelection(0);
6769 pPointStyle->SetSelection(1);
6771 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6772 pBoundStyle->SetSelection(0);
6774 pBoundStyle->SetSelection(1);
6776 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6777 p24Color->SetSelection(0);
6779 p24Color->SetSelection(1);
6781 UpdateOptionsUnits();
6785void options::UpdateOptionsUnits() {
6786 int depthUnit = pDepthUnitSelect->GetSelection();
6788 depthUnit = wxMax(depthUnit, 0);
6789 depthUnit = wxMin(depthUnit, 2);
6795 else if (depthUnit == 2)
6801 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6802 wxString depthUnitString = depthUnitStrings[depthUnit];
6803 m_depthUnitsShal->SetLabel(depthUnitString);
6804 m_depthUnitsSafe->SetLabel(depthUnitString);
6805 m_depthUnitsDeep->SetLabel(depthUnitString);
6808 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6810 m_ShallowCtl->SetValue(s);
6812 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6814 m_SafetyCtl->SetValue(s);
6816 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6818 m_DeepCtl->SetValue(s);
6848void options::OnSizeAutoButton(wxCommandEvent& event) {
6851 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6853 screenmm.RemoveLast();
6854 pScreenMM->SetValue(screenmm);
6855 pScreenMM->Disable();
6856 g_config_display_size_manual = FALSE;
6859void options::OnSizeManualButton(wxCommandEvent& event) {
6863 screenmm.Append(wxString::Format(
"%zu,", mm));
6867 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6870 screenmm.RemoveLast();
6871 pScreenMM->SetValue(screenmm);
6872 pScreenMM->Enable();
6873 g_config_display_size_manual = TRUE;
6876void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6878void options::OnCPAWarnClick(wxCommandEvent& event) {
6879 if (m_pCheck_CPA_Warn->GetValue()) {
6880 m_pCheck_CPA_WarnT->Enable();
6882 m_pCheck_CPA_WarnT->SetValue(FALSE);
6883 m_pCheck_CPA_WarnT->Disable();
6887void options::OnSyncCogPredClick(wxCommandEvent& event) {
6888 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6889 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6890 m_pText_COG_Predictor->Disable();
6893 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6894 m_pText_COG_Predictor->SetValue(s);
6895 m_pText_COG_Predictor->Enable();
6899void options::OnShipTypeSelect(wxCommandEvent& event) {
6900 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6901 dispOptions->Layout();
6903 itemPanelShip->Layout();
6904 itemPanelShip->Refresh();
6908void options::OnRadarringSelect(wxCommandEvent& event) {
6909 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6910 dispOptions->Layout();
6912 itemPanelShip->Layout();
6913 itemPanelShip->Refresh();
6917void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6918 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6919 dispOptions->Layout();
6921 itemPanelRoutes->Layout();
6922 itemPanelRoutes->Refresh();
6926void options::OnGLClicked(wxCommandEvent& event) {
6929 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6930 w->Enable(pOpenGL->IsChecked());
6933void options::OnOpenGLOptions(wxCommandEvent& event) {
6935 OpenGLOptionsDlg dlg(
this);
6937 if (dlg.ShowModal() == wxID_OK) {
6938 if (top_frame::Get()->GetWxGlCanvas()) {
6939 g_GLOptions.m_bUseAcceleratedPanning =
6940 g_bGLexpert ? dlg.GetAcceleratedPanning()
6942 ->GetAbstractPrimaryCanvas()
6943 ->CanAccelerateGlPanning();
6946 g_bSoftwareGL = dlg.GetSoftwareGL();
6948 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6949 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6953 g_GLOptions.m_bTextureCompressionCaching =
6954 dlg.GetTextureCompressionCaching();
6955 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6958 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6962 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6964 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6966 if (top_frame::Get()->GetWxGlCanvas()) {
6967 ::wxBeginBusyCursor();
6968 top_frame::Get()->GetAbstractPrimaryCanvas()->SetupGlCompression();
6970 ::wxEndBusyCursor();
6973 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6976 if (dlg.GetRebuildCache()) {
6977 m_returnChanges = REBUILD_RASTER_CACHE;
6983void options::OnChartDirListSelect(wxCommandEvent& event) {
6985 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6986 m_removeBtn->Enable(selected);
6987 if (m_compressBtn) m_compressBtn->Enable(selected);
6991void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6994 const bool select = pDispCat->GetSelection() == 3;
6995 ps57CtlListBox->Enable(select);
6996 itemButtonClearList->Enable(select);
6997 itemButtonSelectList->Enable(select);
6998 itemButtonSetStd->Enable(select);
7004void options::OnButtonClearClick(wxCommandEvent& event) {
7005 resetMarStdList(
false,
false);
7014void options::OnButtonSelectClick(wxCommandEvent& event) {
7015 int nOBJL = ps57CtlListBox->GetCount();
7016 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
7021void options::OnButtonSetStd(wxCommandEvent& event) {
7022 resetMarStdList(
false,
true);
7027bool options::ShowToolTips() {
return TRUE; }
7029void options::OnCharHook(wxKeyEvent& event) {
7030 if (event.GetKeyCode() == WXK_RETURN &&
7031 event.GetModifiers() == wxMOD_CONTROL) {
7032 wxCommandEvent okEvent;
7033 okEvent.SetId(xID_OK);
7034 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
7035 GetEventHandler()->AddPendingEvent(okEvent);
7040void options::OnButtonaddClick(wxCommandEvent& event) {
7042 int dresult =
g_Platform->DoDirSelectorDialog(
7043 this, &selDir, _(
"Add a directory containing chart files"),
7044 *pInit_Chart_Dir,
false);
7046 if (dresult != wxID_CANCEL) AddChartDir(selDir);
7051void options::AddChartDir(
const wxString& dir) {
7052 wxFileName dirname = wxFileName(dir);
7053 pInit_Chart_Dir->Empty();
7059 dirAdd = f.GetFullPath();
7061 pInit_Chart_Dir->Append(dirname.GetPath());
7066 cdi.fullpath = dirAdd;
7067 ActiveChartArray.Add(cdi);
7069 UpdateChartDirList();
7071 k_charts |= CHANGE_CHARTS;
7073 pScanCheckBox->Disable();
7076void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
7079 ActiveChartArray.Clear();
7080 for (
size_t i = 0; i < p.GetCount(); i++) {
7081 ActiveChartArray.Add(p[i]);
7084 UpdateChartDirList();
7087void options::UpdateWorkArrayFromDisplayPanel() {
7089 int n = ActiveChartArray.GetCount();
7090 if (m_pWorkDirList) {
7091 m_pWorkDirList->Clear();
7092 for (
int i = 0; i < n; i++) {
7093 dirname = ActiveChartArray[i].fullpath;
7094 if (!dirname.IsEmpty()) {
7097 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7098 (dirname.Last() == wxChar(_T(
'\r'))))
7099 dirname.RemoveLast();
7105 bool b_added = FALSE;
7108 int nDir = m_CurrentDirList.GetCount();
7110 for (
int i = 0; i < nDir; i++) {
7111 if (m_CurrentDirList[i].fullpath == dirname) {
7112 ChartDirInfo cdi = m_CurrentDirList[i];
7113 m_pWorkDirList->Add(cdi);
7121 cdin.fullpath = dirname;
7122 m_pWorkDirList->Add(cdin);
7129void options::OnApplyClick(wxCommandEvent& event) {
7130 ApplyChanges(event);
7135 if ((m_returnChanges & FONT_CHANGED) ||
7136 (m_returnChanges & NEED_NEW_OPTIONS)) {
7141 m_callbacks.prepare_close(
this, m_returnChanges);
7142 if (!(m_returnChanges & FONT_CHANGED_SAFE))
7143 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
true);
7147 if ((m_returnChanges & CONFIG_CHANGED)) {
7148 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
false);
7153void options::ApplyChanges(wxCommandEvent& event) {
7159 if (m_pShipIconType->GetSelection() > 0) {
7160 double n_ownship_length_meters;
7161 double n_ownship_beam_meters;
7162 double n_gps_antenna_offset_y;
7163 double n_gps_antenna_offset_x;
7164 long n_ownship_min_mm;
7165 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
7166 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
7167 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
7168 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
7169 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
7171 if (n_ownship_length_meters <= 0)
7172 msg += _(
"\n - your ship's length must be > 0");
7173 if (n_ownship_beam_meters <= 0)
7174 msg += _(
"\n - your ship's beam must be > 0");
7175 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
7177 "\n - your GPS offset from midship must be within your ship's beam");
7178 if (n_gps_antenna_offset_y < 0 ||
7179 n_gps_antenna_offset_y > n_ownship_length_meters)
7181 _(
"\n - your GPS offset from bow must be within your ship's length");
7182 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
7183 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
7184 if (!msg.IsEmpty()) {
7185 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
7186 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
7187 ::wxEndBusyCursor();
7188 event.SetInt(wxID_STOP);
7191 g_n_ownship_length_meters = n_ownship_length_meters;
7192 g_n_ownship_beam_meters = n_ownship_beam_meters;
7193 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
7194 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
7195 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
7197 g_OwnShipIconType = m_pShipIconType->GetSelection();
7198 g_bShowShipToActive = pShowshipToActive->GetValue();
7199 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
7200 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
7202 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
7203 g_n_arrival_circle_radius =
7204 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
7206 wxString* icon_name =
7207 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
7208 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
7211 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
7212 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
7214 g_bUseWptScaMin = pScaMinChckB->GetValue();
7215 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
7216 g_iWpt_ScaMax = wxAtoi(m_pText_ScaMax->GetValue());
7217 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
7220 if (m_bfontChanged) {
7222 if (top_frame::Get()->GetWxGlCanvas()) {
7223 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7226 if (top_frame::Get()->GetAbstractPrimaryCanvas()) {
7227 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7230 m_returnChanges |= FONT_CHANGED;
7234 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
7235 m_returnChanges |= FONT_CHANGED_SAFE;
7239 UpdateWorkArrayFromDisplayPanel();
7241 groupsPanel->SetDBDirs(*m_pWorkDirList);
7242 groupsPanel->m_treespopulated = FALSE;
7244 int k_force = FORCE_UPDATE;
7245 if (pUpdateCheckBox) {
7246 if (!pUpdateCheckBox->GetValue()) k_force = 0;
7247 pUpdateCheckBox->Enable();
7248 pUpdateCheckBox->SetValue(FALSE);
7253 m_returnChanges |= k_force;
7255 int k_scan = SCAN_UPDATE;
7256 if (pScanCheckBox) {
7257 if (!pScanCheckBox->GetValue()) k_scan = 0;
7258 pScanCheckBox->Enable();
7259 pScanCheckBox->SetValue(FALSE);
7264 m_returnChanges |= k_scan;
7266 pConfig->UpdateChartDirs(*m_pWorkDirList);
7270 if (groupsPanel->modified) {
7273 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
7274 m_returnChanges |= GROUPS_CHANGED;
7279 g_bShowStatusBar = pShowStatusBar->GetValue();
7282 bool bmenu_shown = g_bShowMenuBar;
7283 if (pShowMenuBar->GetValue() != bmenu_shown)
7284 m_returnChanges |= MENU_CHANGED;
7285 g_bShowMenuBar = pShowMenuBar->GetValue();
7288 g_bShowCompassWin = pShowCompassWin->GetValue();
7291 g_bShowChartBar = pShowChartBar->GetValue();
7293 wxString screenmm = pScreenMM->GetValue();
7294 wxStringTokenizer tkz(screenmm,
",");
7296 while (tkz.HasMoreTokens()) {
7297 wxString token = tkz.GetNextToken();
7299 if (token.ToLong(&mm) && mm > 0) {
7305 g_config_display_size_manual = pRBSizeManual->GetValue();
7309 comm_dialog->ApplySettings();
7311 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7315 bool temp_bquilting = pCDOQuilting->GetValue();
7318 g_bQuiltEnable = temp_bquilting;
7322 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7323 g_bskew_comp = pSkewComp->GetValue();
7324 g_btouch = pMobile->GetValue();
7325 g_bresponsive = pResponsive->GetValue();
7327 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7329 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7332 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7333 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7334 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7348 long update_val = 1;
7349 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7350 g_COGAvgSec = wxMin(
static_cast<int>(update_val), kMaxCogAverageSeconds);
7354 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7356 g_bShowTrue = pCBTrueShow->GetValue();
7357 g_bShowMag = pCBMagShow->GetValue();
7359 auto loader = PluginLoader::GetInstance();
7360 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
7361 if (!b_haveWMM && !b_oldhaveWMM) {
7362 pMagVar->GetValue().ToDouble(&g_UserVar);
7367 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7368 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7371 g_iNavAidRadarRingsNumberVisible =
7372 pNavAidRadarRingsNumberVisible->GetSelection();
7373 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7374 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7375 g_fNavAidRadarRingsStep = temp_dbl;
7376 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7377 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7378 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7379 g_fWaypointRangeRingsStep = temp_dbl;
7380 g_iWaypointRangeRingsStepUnits =
7381 m_itemWaypointRangeRingsUnits->GetSelection();
7383 m_colourWaypointRangeRingsColour->GetColour();
7388 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7390 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7392 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7394 if (pCmdSoundString) {
7395 g_CmdSoundString = pCmdSoundString->GetValue();
7396 if (wxIsEmpty(g_CmdSoundString)) {
7397 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7398 pCmdSoundString->SetValue(g_CmdSoundString);
7402 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7403 if (pSoundDeviceIndex)
7404 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7406 g_iSDMMFormat = pSDMMFormat->GetSelection();
7409 int sel = pDistanceFormat->GetSelection();
7413 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7415 if (pHeightUnitSelect)
g_iHeightFormat = pHeightUnitSelect->GetSelection();
7418 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7419 if (pSDefaultBoatSpeed)
7420 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7421 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7422 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7423 getUsrSpeedUnit() +
")");
7425 g_bAdvanceRouteWaypointOnArrivalOnly =
7426 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7428 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7429 g_colourTrackLineColour =
7430 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7431 g_colourTrackLineColour.Blue());
7432 g_nTrackPrecision = pTrackPrecision->GetSelection();
7434 g_bTrackDaily = pTrackDaily->GetValue();
7436 g_track_rotate_time = 0;
7437#if wxUSE_TIMEPICKCTRL
7439 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7440 g_track_rotate_time = h * 3600 + m * 60 + s;
7443 if (pTrackRotateUTC->GetValue())
7444 g_track_rotate_time_type = TIME_TYPE_UTC;
7445 else if (pTrackRotateLMT->GetValue())
7446 g_track_rotate_time_type = TIME_TYPE_LMT;
7448 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7450 g_bHighliteTracks = pTrackHighlite->GetValue();
7457 if (pEnableZoomToCursor)
7458 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7460 if (pEnableTenHertz) g_btenhertz = pEnableTenHertz->GetValue();
7463 g_bEnableZoomToCursor =
false;
7466 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7467 g_colourOwnshipRangeRingsColour =
7468 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7469 g_colourOwnshipRangeRingsColour.Green(),
7470 g_colourOwnshipRangeRingsColour.Blue());
7473 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7474 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7475 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7476 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7480 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7481 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7482 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7483 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7484 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7485 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7488 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7489 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7490 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7491 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7494 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7496 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7497 if (g_bSyncCogPredictors) {
7498 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7500 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7502 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7503 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7507 for (
const auto& it :
g_pAIS->GetTargetList()) {
7508 auto pAISTarget = it.second;
7509 if (NULL != pAISTarget) {
7510 pAISTarget->b_show_track = g_bAISShowTracks;
7515 if (TRACKTYPE_NEVER == props->TrackType) {
7516 pAISTarget->b_show_track =
false;
7518 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7519 pAISTarget->b_show_track =
true;
7526 std::map<int, Track*>::iterator it;
7527 it =
g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7528 if (it !=
g_pAIS->m_persistent_tracks.end())
7529 pAISTarget->b_show_track =
true;
7530 pAISTarget->b_show_track_old = g_bAISShowTracks;
7535 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7536 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7538 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7539 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7541 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7543 m_pText_Scale_Priority->GetValue().ToLong(&l);
7544 g_ShowScaled_Num = (int)l;
7546 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7547 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7548 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7549 long ais_name_scale = 5000;
7550 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7551 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7552 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7553 g_WplAction = m_pWplAction->GetSelection();
7556 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7557 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7558 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7560 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7561 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7564 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7565 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7566 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7568 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7569 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7570 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7571 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7573 bool bchange_scale =
false;
7574 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7575 bchange_scale =
true;
7576 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7579 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7580 g_MarkScaleFactorExp =
g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7581 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7582 g_ShipScaleFactorExp =
g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7583 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7584 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7586 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7587 g_mouse_zoom_sensitivity =
7592 if (pWayPointMan) WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7600 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7601 g_bopengl = pOpenGL->GetValue();
7604 g_bChartBarEx = pChartBarEX->GetValue();
7607 int depthUnit = pDepthUnitSelect->GetSelection();
7611 bool bUserStdChange =
false;
7613 int nOBJL = ps57CtlListBox->GetCount();
7615 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7617 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7618 if (marinersStdXref[i] == iPtr) {
7623 assert(itemIndex >= 0);
7624 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7625 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7626 bUserStdChange =
true;
7627 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7633 ps52plib->GenerateStateHash();
7634 long stateHash = ps52plib->GetStateHash();
7636 if (m_returnChanges & GL_CHANGED) {
7639 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7641 ps52plib->ClearCNSYLUPArray();
7642 ps52plib->GenerateStateHash();
7646 enum _DisCat nset = OTHER;
7647 switch (pDispCat->GetSelection()) {
7658 nset = MARINERS_STANDARD;
7661 ps52plib->SetDisplayCategory(nset);
7664 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7665 if (pCheck_ATONTEXT)
7666 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7667 if (pCheck_LDISTEXT)
7668 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7669 if (pCheck_XLSECTTEXT)
7670 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7672 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7673 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7674 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7675 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7676 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7677 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7679 ps52plib->m_nSymbolStyle =
7680 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7682 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7684 : SYMBOLIZED_BOUNDARIES;
7685 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7686 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7688 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7689 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7697 else if (depthUnit == 2)
7700 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7701 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7703 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7707 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7708 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7710 if (m_DeepCtl->GetValue().ToDouble(&dval))
7711 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7713 ps52plib->UpdateMarinerParams();
7714 ps52plib->m_nDepthUnitDisplay = depthUnit;
7718 ps52plib->GenerateStateHash();
7721 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7722 m_returnChanges |= S52_CHANGED;
7724 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7728#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7730 wxString new_canon =
"en_US";
7731 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7733 int nLang =
sizeof(lang_list) /
sizeof(
int);
7734 for (
int it = 0; it < nLang; it++) {
7735 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7737 wxString lang_canonical = pli->CanonicalName;
7738 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7739 if (lang_sel == test_string) {
7740 new_canon = lang_canonical;
7746 wxString locale_old = g_locale;
7747 g_locale = new_canon;
7749 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7755 m_returnChanges |= STYLE_CHANGED;
7757 wxSizeEvent nullEvent;
7758 top_frame::Get()->OnSize(nullEvent);
7761 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7762 g_bInlandEcdis = pInlandEcdis->GetValue();
7763 SwitchInlandEcdisMode(g_bInlandEcdis);
7764 m_returnChanges |= TOOLBAR_CHANGED;
7767 if (pHiconColors) g_hicon_colors = pHiconColors->GetValue();
7771 if (PluginLoader::GetInstance()->UpdatePlugIns())
7772 m_returnChanges |= TOOLBAR_CHANGED;
7778 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7779 m_groups_changed | k_plugins;
7784 wxString string_acc;
7785 for (wxString entry : TideCurrentDataSet) {
7786 string_acc += entry;
7789 wxString string_acc_control;
7790 for (
int i = 0; i < tcDataSelected->GetItemCount(); i++) {
7791 wxString setName = tcDataSelected->GetItemText(i);
7792 string_acc_control += setName;
7795 if (!string_acc.IsSameAs(string_acc_control)) {
7796 TideCurrentDataSet.clear();
7797 int nEntry = tcDataSelected->GetItemCount();
7798 for (
int i = 0; i < nEntry; i++) {
7799 wxString setName = tcDataSelected->GetItemText(i);
7800 TideCurrentDataSet.push_back(setName.ToStdString());
7802 m_returnChanges |= TIDES_CHANGED;
7805 if (g_canvasConfig != m_screenConfig) m_returnChanges |= CONFIG_CHANGED;
7806 g_canvasConfig = m_screenConfig;
7808 UpdateWorkArrayFromDisplayPanel();
7811 if ((m_returnChanges & VISIT_CHARTS) &&
7812 ((m_returnChanges & CHANGE_CHARTS) || (m_returnChanges & SCAN_UPDATE))) {
7813 DoDBSUpdate((m_returnChanges & FORCE_UPDATE) == FORCE_UPDATE);
7815 bool b_groupchange =
ChartData->ScrubGroupArray();
7817 if (b_groupchange ||
7818 ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)) {
7819 pConfig->DestroyConfigGroups();
7822 if ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)
7826 m_callbacks.process_dialog(m_returnChanges, m_pWorkDirList);
7830 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7833 top_frame::Get()->RefreshAllCanvas();
7836 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7838 if (m_bVisitPlugins) m_returnChanges |= FORCE_RELOAD;
7841 UpdateTemplateTitleText();
7844 ::wxEndBusyCursor();
7847void options::OnXidOkClick(wxCommandEvent& event) {
7850 if (event.GetEventObject() == NULL)
return;
7852 ApplyChanges(event);
7855 m_callbacks.prepare_close(
this, m_returnChanges);
7858 if ((m_returnChanges & CONFIG_CHANGED) || (m_returnChanges & GL_CHANGED))
7859 top_frame::Get()->ScheduleReconfigAndSettingsReload(
false,
false);
7862 if ((m_returnChanges & FONT_CHANGED) &&
7863 !(m_returnChanges & FONT_CHANGED_SAFE))
7864 top_frame::Get()->ScheduleDeleteSettingsDialog();
7867 if (m_returnChanges & LOCALE_CHANGED)
7868 top_frame::Get()->ScheduleDeleteSettingsDialog();
7870 if ((m_returnChanges & FONT_CHANGED) ||
7871 (m_returnChanges & NEED_NEW_OPTIONS)) {
7878 if (m_returnChanges & FORCE_RELOAD) top_frame::Get()->ScheduleReloadCharts();
7884void options::Finish() {
7886 m_pListbook->ChangeSelection(0);
7887 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7888 wxNotebookPage* pg = m_pListbook->GetPage(i);
7889 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7890 if (nb) nb->ChangeSelection(0);
7893 lastWindowPos = GetPosition();
7894 lastWindowSize = GetSize();
7896 pConfig->SetPath(
"/Settings");
7897 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7898 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7901ArrayOfCDI options::GetSelectedChartDirs() {
7903 for (
size_t i = 0; i < panelVector.size(); i++) {
7904 if (panelVector[i]->IsSelected()) {
7905 rv.Add(panelVector[i]->GetCDI());
7912ArrayOfCDI options::GetUnSelectedChartDirs() {
7914 for (
size_t i = 0; i < panelVector.size(); i++) {
7915 if (!panelVector[i]->IsSelected()) {
7916 rv.Add(panelVector[i]->GetCDI());
7923void options::SetDirActionButtons() {
7924 ArrayOfCDI selArray = GetSelectedChartDirs();
7925 if (selArray.GetCount())
7926 m_removeBtn->Enable();
7928 m_removeBtn->Disable();
7931void options::OnButtondeleteClick(wxCommandEvent& event) {
7932 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7933 ActiveChartArray.Clear();
7934 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7935 ActiveChartArray.Add(unselArray[i]);
7938 UpdateChartDirList();
7940 UpdateWorkArrayFromDisplayPanel();
7943 if (m_pWorkDirList) {
7944 pActiveChartsList->DeleteAllItems();
7945 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7946 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7949 li.SetAlign(wxLIST_FORMAT_LEFT);
7950 li.SetText(dirname);
7952 long idx = pActiveChartsList->InsertItem(li);
7957 k_charts |= CHANGE_CHARTS;
7959 pScanCheckBox->Disable();
7964void options::DoDBSUpdate(
bool force_full) {
7965 m_OKButton->Disable();
7966 m_CancelButton->Disable();
7967 m_ApplyButton->Disable();
7969 wxString longmsg = _(
"OpenCPN Chart Update");
7971 ".................................................................."
7974 m_pCBDSprog =
new wxGenericProgressDialog();
7977 m_pCBDSprog->SetFont(*qFont);
7980 m_pCBDSprog->Create(_(
"OpenCPN Chart Update"), longmsg, 100,
nullptr,
7983 DimeControl(m_pCBDSprog);
7984 m_pCBDSprog->Show();
7989 m_bTextureCacheingSave = g_GLOptions.m_bTextureCompressionCaching;
7990 g_GLOptions.m_bTextureCompressionCaching =
false;
7992 ChartData->UpdateChartDatabaseInplace(*m_pWorkDirList, force_full,
7996void options::OnButtonRebuildChartDb(wxCommandEvent& event) {
8000void options::OnButtonParseENC(wxCommandEvent& event) {
8001 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
false);
8003 extern void ParseAllENC(wxWindow * parent);
8005 ParseAllENC(g_pOptions);
8008 top_frame::Get()->ChartsRefresh();
8010 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
true);
8016static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
8019 lzma_action action = LZMA_RUN;
8023 uint8_t inbuf[BUFSIZ];
8024 uint8_t outbuf[BUFSIZ];
8037 strm->next_in = NULL;
8039 strm->next_out = outbuf;
8040 strm->avail_out =
sizeof(outbuf);
8046 if (strm->avail_in == 0 && !feof(infile)) {
8047 strm->next_in = inbuf;
8048 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
8050 if (ferror(infile)) {
8051 fprintf(stderr,
"Read error: %s\n", strerror(errno));
8059 if (feof(infile)) action = LZMA_FINISH;
8077 lzma_ret ret = lzma_code(strm, action);
8082 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
8087 size_t write_size =
sizeof(outbuf) - strm->avail_out;
8089 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
8090 fprintf(stderr,
"Write error: %s\n", strerror(errno));
8095 strm->next_out = outbuf;
8096 strm->avail_out =
sizeof(outbuf);
8101 if (ret != LZMA_OK) {
8108 if (ret == LZMA_STREAM_END)
return true;
8119 case LZMA_MEM_ERROR:
8120 msg =
"Memory allocation failed";
8123 case LZMA_DATA_ERROR:
8136 msg =
"File size limits exceeded";
8151 msg =
"Unknown error, possibly a bug";
8155 wxLogMessage(
"LZMA Encoder error: %s (error code %u)\n", msg, ret);
8162static bool CompressChart(wxString in, wxString out) {
8164 FILE* infile = fopen(in.mb_str(),
"rb");
8165 if (!infile)
return false;
8167 FILE* outfile = fopen(out.mb_str(),
"wb");
8173 lzma_stream strm = LZMA_STREAM_INIT;
8174 bool success =
false;
8175 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
8177 success = compress(&strm, infile, outfile);
8188void options::OnButtonmigrateClick(wxCommandEvent& event) {
8194 new MigrateAssistantDialog(wxTheApp->GetTopWindow(),
true);
8195 g_migrateDialog->SetSize(top_frame::Get()->GetSize());
8196 g_migrateDialog->Centre();
8197 g_migrateDialog->Raise();
8198 g_migrateDialog->ShowModal();
8202void options::OnButtonEcdisHelp(wxCommandEvent& event) {
8203 wxString testFile =
"/doc/iECDIS/index.html";
8205 if (!::wxFileExists(testFile)) {
8206 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
8209 _(
"Would you like to visit the iECDIS Manual website for more "
8212 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
8213 wxYES_NO | wxCENTER, 60)) {
8214 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
8225void options::OnButtoncompressClick(wxCommandEvent& event) {
8227 wxArrayInt pListBoxSelections;
8230 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
8231 wxLIST_STATE_SELECTED);
8232 if (item == -1)
break;
8237 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
8238This may make them incompatible with other programs or older versions of OpenCPN.\n\
8239Compressed charts may take slightly longer to load and display on some systems.\n\
8240They can be decompressed again using unxz or 7 zip programs."),
8241 _(
"OpenCPN Warning"),
8242 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
8246 wxArrayString filespecs;
8247 filespecs.Add(
"*.kap");
8248 filespecs.Add(
"*.KAP");
8249 filespecs.Add(
"*.000");
8252 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
8253 filespecs.Add(
"*.D");
8254 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
8255 filespecs.Add(
"*.Z");
8257 wxGenericProgressDialog prog1(
8258 _(
"OpenCPN Compress Charts"), wxEmptyString,
8259 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
8260 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8261 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8264 wxSize sz = prog1.GetSize();
8265 sz.x = top_frame::Get()->GetClientSize().x * 8 / 10;
8268 wxArrayString charts;
8269 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
8270 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
8271 if (dirname.IsEmpty())
continue;
8274 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
8275 (dirname.Last() == wxChar(_T(
'\r'))))
8276 dirname.RemoveLast();
8278 if (!wxDir::Exists(dirname))
continue;
8281 wxArrayString FileList;
8282 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
8283 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
8285 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
8289 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
8290 charts.Add(FileList[j]);
8294 if (charts.GetCount() == 0) {
8295 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
8300 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
8301 wxGenericProgressDialog prog(
8302 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
8303 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8304 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8308 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
8310 prog.Update(i, charts[i], &skip);
8313 wxString compchart = charts[i] +
".xz";
8314 if (CompressChart(charts[i], compchart)) {
8315 total_size += wxFileName::GetSize(charts[i]).ToULong();
8316 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
8317 wxRemoveFile(charts[i]);
8323 double total_size_mb = total_size / 1024.0 / 1024.0;
8324 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
8327 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
8329 count, total_size_mb, total_compressed_size_mb,
8330 total_size_mb - total_compressed_size_mb,
8331 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
8334 UpdateWorkArrayFromTextCtl();
8336 if (m_pWorkDirList) {
8337 pActiveChartsList->DeleteAllItems();
8338 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
8339 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
8342 li.SetAlign(wxLIST_FORMAT_LEFT);
8343 li.SetText(dirname);
8345 long idx = pActiveChartsList->InsertItem(li);
8349 k_charts |= CHANGE_CHARTS;
8351 pScanCheckBox->Disable();
8357void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
8359void options::OnCancelClick(wxCommandEvent& event) {
8360 m_pListbook->ChangeSelection(0);
8361 comm_dialog->CancelSettings();
8363 lastWindowPos = GetPosition();
8364 lastWindowSize = GetSize();
8366 pConfig->SetPath(
"/Settings");
8367 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8368 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8371 androidEnableBackButton(
true);
8372 androidEnableRotation();
8373 androidEnableOptionItems(
true);
8376 top_frame::Get()->ThawCharts();
8378 top_frame::Get()->EnableSettingsTool(
true);
8381void options::OnClose(wxCloseEvent& event) {
8382 m_pListbook->ChangeSelection(0);
8384 lastWindowPos = GetPosition();
8385 lastWindowSize = GetSize();
8387 pConfig->SetPath(
"/Settings");
8388 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8389 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8391 m_callbacks.prepare_close(
this, m_returnChanges);
8395void options::OnFontChoice(wxCommandEvent& event) {
8396 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8397 m_font_element_array.Add(sel_text_element);
8399 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8400 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8402 m_textSample->SetFont(*pif);
8403 m_textSample->SetForegroundColour(init_color);
8404 m_itemBoxSizerFontPanel->Layout();
8408void options::OnChooseFont(wxCommandEvent& event) {
8410 androidDisableRotation();
8413 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8414 m_font_element_array.Add(sel_text_element);
8415 wxFontData font_data;
8417 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8418 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8420 wxFontData init_font_data;
8421 if (pif) init_font_data.SetInitialFont(*pif);
8422 init_font_data.SetColour(init_color);
8426 ocpnGenericFontDialog dg(
this, init_font_data);
8427 wxFont* qFont = dialogFont;
8430 int retval = dg.ShowModal();
8431 if (wxID_CANCEL != retval) {
8432 font_data = dg.GetFontData();
8433 wxFont font = font_data.GetChosenFont();
8434 wxFont* psfont =
new wxFont(font);
8435 wxColor color = font_data.GetColour();
8436 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8437 top_frame::Get()->UpdateAllFonts();
8438 m_bfontChanged =
true;
8439 OnFontChoice(event);
8445 wxFontDialog dg(
this, init_font_data);
8447 wxFontDialog dg(pParent, init_font_data);
8450 wxFont* qFont = dialogFont;
8457 wxSize proposed_size = GetSize();
8459 float font_size = dialogFont->GetPointSize();
8461 if ((proposed_size.y / font_size) < n_lines) {
8462 float new_font_size = proposed_size.y / n_lines;
8463 wxFont* smallFont =
new wxFont(*dialogFont);
8464 smallFont->SetPointSize(new_font_size);
8465 dg.SetFont(*smallFont);
8469 if (g_bresponsive) {
8470 dg.SetSize(GetSize());
8474 int retval = dg.ShowModal();
8475 if (wxID_CANCEL != retval) {
8476 font_data = dg.GetFontData();
8477 wxFont font = font_data.GetChosenFont();
8478 wxFont* psfont =
new wxFont(font);
8479 wxColor color = font_data.GetColour();
8480 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8481 top_frame::Get()->UpdateAllFonts();
8482 m_bfontChanged =
true;
8483 OnFontChoice(event);
8488 androidEnableRotation();
8494#if defined(__WXGTK__) || defined(__WXQT__)
8495void options::OnChooseFontColor(wxCommandEvent& event) {
8496 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8497 m_font_element_array.Add(sel_text_element);
8499 wxColourData colour_data;
8501 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8502 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8505 androidDisableRotation();
8507 unsigned int cco = 0;
8510 cco |= init_color.Red();
8512 cco |= init_color.Green();
8514 cco |= init_color.Blue();
8515 unsigned int cc = androidColorPicker(cco);
8518 unsigned char blue = (
unsigned char)cc % 256;
8519 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8521 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8522 cn.Set(red, green, blue);
8524 FontMgr::Get().
SetFont(sel_text_element, pif, cn);
8526 top_frame::Get()->UpdateAllFonts();
8527 m_bfontChanged =
true;
8529 androidEnableRotation();
8531 wxScrolledWindow* sw =
8532 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8534 wxColourData init_colour_data;
8535 init_colour_data.SetColour(init_color);
8537 wxColourDialog dg(sw, &init_colour_data);
8539 int retval = dg.ShowModal();
8540 if (wxID_CANCEL != retval) {
8541 colour_data = dg.GetColourData();
8543 wxColor color = colour_data.GetColour();
8544 FontMgr::Get().
SetFont(sel_text_element, pif, color);
8546 top_frame::Get()->UpdateAllFonts();
8547 m_bfontChanged =
true;
8548 OnFontChoice(event);
8557void options::OnChartsPageChange(wxListbookEvent& event) {
8558 unsigned int i =
event.GetSelection();
8560 UpdateChartDirList();
8565 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8569 UpdateWorkArrayFromDisplayPanel();
8570 groupsPanel->SetDBDirs(*m_pWorkDirList);
8571 groupsPanel->m_treespopulated = FALSE;
8573 if (!groupsPanel->m_settingscomplete) {
8574 ::wxBeginBusyCursor();
8575 groupsPanel->CompleteInitialSettings();
8576 ::wxEndBusyCursor();
8577 }
else if (!groupsPanel->m_treespopulated) {
8578 groupsPanel->PopulateTrees();
8579 groupsPanel->m_treespopulated = TRUE;
8581 }
else if (1 == i) {
8583 if (!m_bVectorInit) {
8584 SetInitialVectorSettings();
8585 UpdateOptionsUnits();
8592void options::OnPageChange(wxListbookEvent& event) {
8593 DoOnPageChange(event.GetSelection());
8596void options::OnSubNBPageChange(wxNotebookEvent& event) {
8599 if (event.GetEventObject()) {
8600 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8601 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8602 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8603 if (
dynamic_cast<wxNotebook*
>(parent)) {
8604 lastSubPage =
event.GetSelection();
8607 if (
dynamic_cast<wxListbook*
>(parent)) {
8608 lastSubPage =
event.GetSelection();
8615void options::OnTopNBPageChange(wxNotebookEvent& event) {
8616 DoOnPageChange(event.GetSelection());
8619void options::DoOnPageChange(
size_t page) {
8620 unsigned int i = page;
8623 if (page > 10)
return;
8631 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8632 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8638 k_charts = VISIT_CHARTS;
8639 UpdateChartDirList();
8642 else if (m_pageConnections == i) {
8644 wxWindow* w = m_pListbook->GetCurrentPage();
8645 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
8648 else if (m_pageUI == i) {
8649 if (!m_itemLangListBox)
return;
8650#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8652 if (!m_bVisitLang) {
8653 ::wxBeginBusyCursor();
8655 int current_language = plocale_def_lang->GetLanguage();
8656 wxString current_sel = wxLocale::GetLanguageName(current_language);
8658 current_sel = GetOCPNKnownLanguage(g_locale);
8660 int nLang =
sizeof(lang_list) /
sizeof(
int);
8663 m_itemLangListBox->Append(
"English (U.S.)");
8665 wxString lang_dir =
g_Platform->GetSharedDataDir() +
"share/locale/";
8666 for (
int it = 1; it < nLang; it++) {
8667 if (wxLocale::IsAvailable(lang_list[it])) {
8668 wxLocale ltest(lang_list[it], 0);
8669 ltest.AddCatalog(
"opencpn");
8670 if (!ltest.IsLoaded(
"opencpn"))
continue;
8673 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8674 wxString widgets_lang_name = loc_lang_name;
8675 wxString lang_canonical =
8676 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8679 wxString lang_suffix;
8680 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8683 wxString test_dir = lang_dir + lang_suffix;
8684 if (!wxDir::Exists(test_dir))
continue;
8686 m_itemLangListBox->Append(loc_lang_name);
8690 wxArrayString lang_array;
8693 lang_array.Add(
"en_US");
8694 for (
int it = 0; it < nLang; it++) {
8696 wxLog::EnableLogging(
8699 wxLocale ltest(lang_list[it], 0);
8700#if wxCHECK_VERSION(2, 9, 0)
8702 ltest.AddCatalogLookupPathPrefix(
8703 wxStandardPaths::Get().GetInstallPrefix() +
"/share/locale");
8706 ltest.AddCatalog(
"opencpn");
8708 wxLog::EnableLogging(TRUE);
8709 if (ltest.IsLoaded(
"opencpn")) {
8710 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8713 s0 = x->CanonicalName;
8716 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8717 if (wxNOT_FOUND == lang_array.Index(s0)) {
8724 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8726 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8727 m_itemLangListBox->Append(loc_lang_name);
8743 delete plocale_def_lang;
8744 plocale_def_lang =
new wxLocale(current_language);
8746 setlocale(LC_NUMERIC,
"C");
8747 plocale_def_lang->AddCatalog(
"opencpn");
8749 m_itemLangListBox->SetStringSelection(current_sel);
8752 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8754 wxString clang = pli->Description;
8758 m_bVisitLang = TRUE;
8760 ::wxEndBusyCursor();
8763 }
else if (m_pagePlugins == i) {
8764 m_bVisitPlugins = TRUE;
8765 top_frame::Get()->FreezeCharts();
8769 auto loader = PluginLoader::GetInstance();
8770 if (LoadAllPlugIns(
false)) {
8771 delete m_pPlugInCtrl;
8772 m_pPlugInCtrl = NULL;
8773 delete m_PluginCatalogMgrPanel;
8774 m_PluginCatalogMgrPanel = NULL;
8775 itemBoxSizerPanelPlugins->Clear();
8778 if (!m_pPlugInCtrl) {
8780 ::wxBeginBusyCursor();
8782 m_pPlugInCtrl =
new PluginListPanel(itemPanelPlugins, ID_PANELPIM,
8783 wxDefaultPosition, wxDefaultSize);
8784 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8785 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8786 wxEXPAND | wxGROW | wxALL, 4);
8789 m_PluginCatalogMgrPanel =
new CatalogMgrPanel(itemPanelPlugins);
8790 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8792 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8793 wxEXPAND | wxALL, 4);
8794 itemBoxSizerPanelPlugins->Layout();
8797 m_pPlugInCtrl->UpdateSelections();
8799 ::wxEndBusyCursor();
8801 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8802 obs::GlobalVar<wxString> compat_os(&g_compatOS);
8804 k_plugins = TOOLBAR_CHANGED;
8806 k_plugins |= FORCE_RELOAD;
8810wxString options::SelectSoundFile() {
8811 wxString sound_dir =
g_Platform->GetSharedDataDir();
8812 sound_dir.Append(
"sounds");
8817 wxFileDialog* popenDialog =
new wxFileDialog(
8818 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8819 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
8821 popenDialog =
g_Platform->AdjustFileDialogFont(
this, popenDialog);
8823 response = popenDialog->ShowModal();
8824 sel_file = popenDialog->GetPath();
8829 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
8832 if (response == wxID_OK)
8838void options::OnButtonSelectSound(wxCommandEvent& event) {
8839 wxString sel_file = SelectSoundFile();
8841 if (!sel_file.IsEmpty()) {
8842 g_sAIS_Alert_Sound_File =
g_Platform->NormalizePath(sel_file);
8846void options::OnButtonTestSound(wxCommandEvent& event) {
8847 auto sound = o_sound::Factory();
8848 auto cmd_sound =
dynamic_cast<o_sound::SystemCmdSound*
>(sound);
8849 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8850 sound->SetFinishedCallback([&](
void* snd) {
m_on_sound_done.Notify(snd); });
8851 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8855wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8856 wxString return_string;
8857 wxString dir_suffix;
8859#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8861 if (lang_canonical ==
"en_US") {
8863 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8865 }
else if ((lang_canonical ==
"cs_CZ") || (lang_canonical ==
"cs")) {
8867 return_string = wxString(
"Čeština", wxConvUTF8);
8869 }
else if ((lang_canonical ==
"da_DK") || (lang_canonical ==
"da")) {
8871 return_string = wxString(
"Dansk", wxConvUTF8);
8873 }
else if ((lang_canonical ==
"de_DE") || (lang_canonical ==
"de")) {
8875 return_string = wxString(
"Deutsch", wxConvUTF8);
8877 }
else if ((lang_canonical ==
"et_EE") || (lang_canonical ==
"et")) {
8879 return_string = wxString(
"Eesti", wxConvUTF8);
8881 }
else if ((lang_canonical ==
"es_ES") || (lang_canonical ==
"es")) {
8883 return_string = wxString(
"Español", wxConvUTF8);
8885 }
else if ((lang_canonical ==
"fr_FR") || (lang_canonical ==
"fr")) {
8887 return_string = wxString(
"Français", wxConvUTF8);
8889 }
else if ((lang_canonical ==
"it_IT") || (lang_canonical ==
"it")) {
8891 return_string = wxString(
"Italiano", wxConvUTF8);
8893 }
else if ((lang_canonical ==
"nl_NL") || (lang_canonical ==
"nl")) {
8895 return_string = wxString(
"Nederlands", wxConvUTF8);
8897 }
else if ((lang_canonical ==
"pl_PL") || (lang_canonical ==
"pl")) {
8899 return_string = wxString(
"Polski", wxConvUTF8);
8901 }
else if ((lang_canonical ==
"pt_PT") || (lang_canonical ==
"pt")) {
8902 dir_suffix =
"pt_PT";
8903 return_string = wxString(
"Português", wxConvUTF8);
8905 }
else if ((lang_canonical ==
"pt_BR") || (lang_canonical ==
"pt_BR")) {
8906 dir_suffix =
"pt_BR";
8907 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8909 }
else if ((lang_canonical ==
"ru_RU") || (lang_canonical ==
"ru")) {
8911 return_string = wxString(
"Русский", wxConvUTF8);
8913 }
else if ((lang_canonical ==
"sv_SE") || (lang_canonical ==
"sv")) {
8915 return_string = wxString(
"Svenska", wxConvUTF8);
8917 }
else if ((lang_canonical ==
"fi_FI") || (lang_canonical ==
"fi")) {
8918 dir_suffix =
"fi_FI";
8919 return_string = wxString(
"Suomi", wxConvUTF8);
8921 }
else if ((lang_canonical ==
"nb_NO") || (lang_canonical ==
"nb")) {
8922 dir_suffix =
"nb_NO";
8923 return_string = wxString(
"Norsk", wxConvUTF8);
8925 }
else if ((lang_canonical ==
"tr_TR") || (lang_canonical ==
"tr")) {
8926 dir_suffix =
"tr_TR";
8927 return_string = wxString(
"Türkçe", wxConvUTF8);
8929 }
else if ((lang_canonical ==
"el_GR") || (lang_canonical ==
"el")) {
8930 dir_suffix =
"el_GR";
8931 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8933 }
else if ((lang_canonical ==
"hu_HU") || (lang_canonical ==
"hu")) {
8934 dir_suffix =
"hu_HU";
8935 return_string = wxString(
"Magyar", wxConvUTF8);
8937 }
else if ((lang_canonical ==
"zh_TW") || (lang_canonical ==
"zh_TW")) {
8938 dir_suffix =
"zh_TW";
8939 return_string = wxString(
"正體字", wxConvUTF8);
8941 }
else if ((lang_canonical ==
"zh_CN") || (lang_canonical ==
"zh_CN")) {
8942 dir_suffix =
"zh_CN";
8943 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8945 }
else if ((lang_canonical ==
"ca_ES") || (lang_canonical ==
"ca")) {
8946 dir_suffix =
"ca_ES";
8947 return_string = wxString(
"Catalan", wxConvUTF8);
8949 }
else if ((lang_canonical ==
"gl_ES") || (lang_canonical ==
"gl_ES")) {
8950 dir_suffix =
"gl_ES";
8951 return_string = wxString(
"Galician", wxConvUTF8);
8953 }
else if ((lang_canonical ==
"ja_JP") || (lang_canonical ==
"ja_JP")) {
8954 dir_suffix =
"ja_JP";
8955 return_string = wxString(
"Japanese", wxConvUTF8);
8957 }
else if ((lang_canonical ==
"vi_VN") || (lang_canonical ==
"vi_VN")) {
8958 dir_suffix =
"vi_VN";
8959 return_string = wxString(
"Vietnamese", wxConvUTF8);
8962 dir_suffix = lang_canonical;
8963 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8965 return_string = info->Description;
8967 return_string = lang_canonical;
8970 lang_dir = dir_suffix;
8972 return return_string;
8975wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8977 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8980ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8981 ChartGroupArray* d =
new ChartGroupArray;
8982 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8983 ChartGroup* psg = s->Item(i);
8984 ChartGroup* pdg =
new ChartGroup;
8985 pdg->m_group_name = psg->m_group_name;
8986 pdg->m_element_array.reserve(psg->m_element_array.size());
8988 for (
auto& elem : psg->m_element_array)
8989 pdg->m_element_array.push_back(elem);
8996void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
9006EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
9007EVT_NOTEBOOK_PAGE_CHANGED(
9009 ChartGroupsUI::OnGroupPageChange)
9013 m_GroupSelectedPage = -1;
9014 m_pActiveChartsTree = 0;
9016 lastSelectedCtl = NULL;
9017 allAvailableCtl = NULL;
9018 defaultAllCtl = NULL;
9020 m_pAddButton = NULL;
9021 m_pRemoveButton = NULL;
9022 m_pDeleteGroupButton = NULL;
9023 m_pNewGroupButton = NULL;
9024 m_pGroupArray = NULL;
9027 m_UIcomplete =
false;
9028 m_treespopulated =
false;
9032ChartGroupsUI::~ChartGroupsUI() {
9033 m_DirCtrlArray.Clear();
9034 m_GroupNB->Disconnect(
9035 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
9036 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
9041void ChartGroupsUI::SetInitialSettings() {
9042 m_settingscomplete = FALSE;
9043 m_treespopulated = FALSE;
9046void ChartGroupsUI::PopulateTrees() {
9049 wxArrayString dir_array;
9050 int nDir = m_db_dirs.GetCount();
9051 for (
int i = 0; i < nDir; i++) {
9052 wxString dirname = m_db_dirs[i].fullpath;
9053 if (!dirname.IsEmpty()) dir_array.Add(dirname);
9056 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array,
9057 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
9059 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
9063 wxArrayString dir_array0;
9064 int nDir0 = m_db_dirs.GetCount();
9065 for (
int i = 0; i < nDir0; i++) {
9066 wxString dirname = m_db_dirs[i].fullpath;
9067 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
9069 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
9070 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
9073void ChartGroupsUI::CompleteInitialSettings() {
9076 BuildNotebookPages(m_pGroupArray);
9078 m_panel->GetSizer()->Layout();
9080 m_settingscomplete = TRUE;
9081 m_treespopulated = TRUE;
9084void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
9085 const wxArrayString& dir_array,
9086 const wxColour& col, wxFont* pFont) {
9087 ptc->DeleteAllItems();
9089 wxDirItemData* rootData =
new wxDirItemData(
"Dummy",
"Dummy", TRUE);
9092 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
9093 ptc->SetItemHasChildren(m_rootId);
9096 int nDir = dir_array.GetCount();
9097 for (
int i = 0; i < nDir; i++) {
9098 wxString dirname = dir_array[i];
9099 if (!dirname.IsEmpty()) {
9100 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
9101 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
9104 ptc->SetItemText(
id, dirname);
9105 if (pFont) ptc->SetItemFont(
id, *pFont);
9109 ptc->SetItemTextColour(
id, col);
9111 ptc->SetItemHasChildren(
id);
9116void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
9117 wxString insert_candidate = allAvailableCtl->GetPath();
9118 if (!insert_candidate.IsEmpty()) {
9119 if (m_DirCtrlArray.GetCount()) {
9120 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9121 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9123 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9125 if (ptree->IsEmpty()) {
9126 wxDirItemData* rootData =
9127 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9128 wxString rootName =
"Dummy";
9129 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9131 ptree->SetItemHasChildren(rootId);
9134 wxTreeItemId root_Id = ptree->GetRootItem();
9135 wxDirItemData* dir_item =
9136 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
9138 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
9139 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
9142 pGroup->m_element_array.push_back({insert_candidate});
9147 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9148 m_pAddButton->Disable();
9150 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9152 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9153 if (ptree) ptree->Refresh();
9157void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
9158 if (m_DirCtrlArray.GetCount()) {
9159 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9160 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9163 wxString sel_item = pDirCtrl->GetPath();
9165 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9166 if (ptree && ptree->GetCount()) {
9167 wxTreeItemId
id = ptree->GetSelection();
9168 lastDeletedItem = id;
9170 wxString branch_adder;
9171 int group_item_index =
9172 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
9173 if (group_item_index >= 0) {
9174 ChartGroupElement& pelement =
9175 pGroup->m_element_array[group_item_index];
9176 bool b_duplicate = FALSE;
9177 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
9179 if (pelement.m_missing_name_array[k] == sel_item) {
9185 pelement.m_missing_name_array.Add(sel_item);
9191 if (branch_adder ==
"") {
9193 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
9196 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
9202 lastSelectedCtl->Unselect();
9203 lastSelectedCtl = 0;
9204 m_pRemoveButton->Disable();
9206 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9208 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9209 if (ptree) ptree->Refresh();
9217void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
9218 m_GroupSelectedPage =
event.GetSelection();
9219 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9220 if (lastSelectedCtl) {
9221 lastSelectedCtl->UnselectAll();
9222 lastSelectedCtl = 0;
9224 m_pRemoveButton->Disable();
9225 m_pAddButton->Disable();
9228 if (m_GroupSelectedPage == 0) {
9229 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
9231 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
9235void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
9236 wxObject* evtObj =
event.GetEventObject();
9237 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
9238 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
9239 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9240 m_pAddButton->Enable();
9242 m_pAddButton->Disable();
9245 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
9246 if (!lastSelectedCtl)
goto out;
9247 wxTreeItemId item = lastSelectedCtl->GetSelection();
9248 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9251 wxGenericDirCtrl* dirCtrl =
9252 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
9253 if (!dirCtrl)
goto out;
9254 wxString itemPath = dirCtrl->GetPath();
9255 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
9257 m_pRemoveButton->Disable();
9265void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
9266 wxTextEntryDialog* pd =
new wxTextEntryDialog();
9268 pd->SetFont(*qFont);
9270 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
9273 androidDisableRotation();
9276 if (pd->ShowModal() == wxID_OK) {
9277 if (pd->GetValue().Length()) {
9278 AddEmptyGroupPage(pd->GetValue());
9279 ChartGroup* pGroup =
new ChartGroup;
9280 pGroup->m_group_name = pd->GetValue();
9281 m_pGroupArray->Add(pGroup);
9283 m_GroupSelectedPage =
9284 m_GroupNB->GetPageCount() - 1;
9285 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
9286 m_pDeleteGroupButton->Enable();
9293 androidEnableRotation();
9297void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
9298 if (0 != m_GroupSelectedPage) {
9299 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
9300 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
9301 m_GroupNB->DeletePage(m_GroupSelectedPage);
9304 if (m_GroupSelectedPage <= 0) {
9305 m_pAddButton->Disable();
9306 m_pDeleteGroupButton->Disable();
9310int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
9311 wxTreeItemId item, wxString* pbranch_adder) {
9312 wxString branch_name;
9313 wxString branch_adder;
9315 wxTreeItemId current_node = item;
9316 while (current_node.IsOk()) {
9317 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
9318 if (!parent_node)
break;
9320 if (parent_node == ptree->GetRootItem()) {
9321 branch_name = ptree->GetItemText(current_node);
9325 branch_adder.Prepend(ptree->GetItemText(current_node));
9326 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
9328 current_node = ptree->GetItemParent(current_node);
9332 unsigned int target_item_index = -1;
9334 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
9335 const wxString& target = pGroup->m_element_array[i].m_element_name;
9336 if (branch_name == target) {
9337 target_item_index = i;
9342 if (pbranch_adder) *pbranch_adder = branch_adder;
9344 return target_item_index;
9347void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
9348 wxTreeItemId node =
event.GetItem();
9350 if (m_GroupSelectedPage <= 0)
return;
9351 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9352 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9353 if (!pDirCtrl)
return;
9355 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9356 wxString branch_adder;
9357 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
9358 if (target_item_index < 0)
return;
9359 const ChartGroupElement& target_element =
9360 pGroup->m_element_array[target_item_index];
9361 const wxString& branch_name = target_element.m_element_name;
9365 if (!target_element.m_missing_name_array.GetCount())
return;
9366 wxString full_root = branch_name;
9367 full_root += branch_adder;
9368 full_root += wxString(wxFILE_SEP_PATH);
9370 wxTreeItemIdValue cookie;
9371 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
9372 while (child.IsOk()) {
9373 wxString target_string = full_root;
9374 target_string += ptree->GetItemText(child);
9376 for (
unsigned int k = 0; k < target_element.m_missing_name_array.GetCount();
9378 if (target_element.m_missing_name_array[k] == target_string) {
9379 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
9383 child = ptree->GetNextChild(node, cookie);
9387void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
9390 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
9391 ChartGroup* pGroup = pGroupArray->Item(i);
9392 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
9395 int nItems = pGroup->m_element_array.size();
9396 for (
int i = 0; i < nItems; i++) {
9397 const wxString& itemname = pGroup->m_element_array[i].m_element_name;
9398 if (!itemname.IsEmpty()) {
9399 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
9401 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
9403 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
9409wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
9410 wxGenericDirCtrl* GroupDirCtl =
9411 new wxGenericDirCtrl(m_GroupNB, wxID_ANY,
"TESTDIR");
9412 m_GroupNB->AddPage(GroupDirCtl, label);
9414 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
9415 ptree->DeleteAllItems();
9417 wxDirItemData* rootData =
9418 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9419 wxString rootName =
"Dummy";
9420 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9421 ptree->SetItemHasChildren(rootId);
9423 m_DirCtrlArray.Add(GroupDirCtl);
9428void ChartGroupsUI::ClearGroupPages() {
9429 if (m_GroupNB->GetPageCount() == 0)
return;
9431 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
9432 m_DirCtrlArray.RemoveAt(i);
9433 m_GroupNB->DeletePage(i);
9437void options::OnInsertTideDataLocation(wxCommandEvent& event) {
9439 int response = wxID_CANCEL;
9442 wxFileDialog* popenDialog =
new wxFileDialog(
9443 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
9444 "Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All "
9448 popenDialog =
g_Platform->AdjustFileDialogFont(
this, popenDialog);
9450 response = popenDialog->ShowModal();
9451 sel_file = popenDialog->GetPath();
9457 this, &path, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
"*.*");
9461 if (response == wxID_OK) {
9463 int id = tcDataSelected->GetItemCount();
9465 long idx = tcDataSelected->InsertItem(li);
9466 tcDataSelected->SetItem(
id, 0,
g_Platform->NormalizePath(sel_file));
9469 wxFileName fn(sel_file);
9470 wxString data_dir = fn.GetPath();
9471 g_TCData_Dir =
g_Platform->NormalizePath(data_dir);
9475void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9478 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9479 wxLIST_STATE_SELECTED);
9480 if (item == -1)
break;
9481 tcDataSelected->DeleteItem(item);
9487enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9490BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9491EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9492EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9495OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9496 : wxDialog(parent, wxID_ANY,
"OpenGL Options", wxDefaultPosition,
9498 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9503 m_brebuild_cache(FALSE) {
9506 SetFont(*dialogFont);
9508 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9509 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9511 m_cbTextureCompression =
9512 new wxCheckBox(
this, wxID_ANY,
9513 g_bGLexpert ? _(
"Texture Compression")
9514 : _(
"Texture Compression with Caching"));
9515 m_cbTextureCompressionCaching =
9516 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9518 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9519 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9520 m_sTextureMemorySize->SetRange(1, 16384);
9522 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9523 wxButton* btnRebuild =
9524 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9525 wxButton* btnClear =
9526 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9527 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9529 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9530 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9531 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9533 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9534 m_cbUseAcceleratedPanning =
9535 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9537 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9538 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9539 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9540 flexSizer->AddSpacer(0);
9541 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9542 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9543 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9544 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9545 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9546 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9547 flexSizer->AddSpacer(0);
9548 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9549 flexSizer->AddSpacer(0);
9550 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9551 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9552 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9553 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9554 flexSizer->AddSpacer(0);
9555 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9556 flexSizer->AddSpacer(0);
9557 flexSizer->AddSpacer(0);
9558 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9559 flexSizer->AddSpacer(0);
9560 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9561 flexSizer->AddGrowableCol(1);
9562 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9564 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9565 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9566 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9567 btnSizer->Realize();
9569 mainSizer->AddStretchSpacer();
9570 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9574 SetSizer(mainSizer);
9575 mainSizer->SetSizeHints(
this);
9579bool OpenGLOptionsDlg::GetAcceleratedPanning()
const {
9580 return m_cbUseAcceleratedPanning->GetValue();
9583bool OpenGLOptionsDlg::GetTextureCompression()
const {
9584 return m_cbTextureCompression->GetValue();
9587bool OpenGLOptionsDlg::GetPolygonSmoothing()
const {
9588 return m_cbPolygonSmoothing->GetValue();
9591bool OpenGLOptionsDlg::GetLineSmoothing()
const {
9592 return m_cbLineSmoothing->GetValue();
9595bool OpenGLOptionsDlg::GetSoftwareGL()
const {
9596 return m_cbSoftwareGL->GetValue();
9599bool OpenGLOptionsDlg::GetTextureCompressionCaching()
const {
9600 return m_cbTextureCompressionCaching->GetValue();
9603bool OpenGLOptionsDlg::GetRebuildCache()
const {
return m_brebuild_cache; }
9605int OpenGLOptionsDlg::GetTextureMemorySize()
const {
9606 return m_sTextureMemorySize->GetValue();
9609void OpenGLOptionsDlg::Populate() {
9610 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9618 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9619 m_memorySize->Show(g_bGLexpert);
9620 m_sTextureMemorySize->Show(g_bGLexpert);
9622 m_cbTextureCompressionCaching->SetValue(
9623 g_GLOptions.m_bTextureCompressionCaching);
9624 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9626 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9627 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9629#if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9630 if (top_frame::Get()->GetWxGlCanvas()) {
9631 if (top_frame::Get()->GetGlVersionString().Upper().Find(
"MESA") !=
9633 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9636 m_cbSoftwareGL->Hide();
9640 SetFont(*dialogFont);
9643 if (top_frame::Get()->GetWxGlCanvas()) {
9644 if (top_frame::Get()
9645 ->GetAbstractPrimaryCanvas()
9646 ->CanAccelerateGlPanning()) {
9647 m_cbUseAcceleratedPanning->Enable();
9648 m_cbUseAcceleratedPanning->SetValue(
9649 g_GLOptions.m_bUseAcceleratedPanning);
9651 m_cbUseAcceleratedPanning->SetValue(FALSE);
9652 m_cbUseAcceleratedPanning->Disable();
9655 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9658 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9659 m_cbUseAcceleratedPanning->Disable();
9663void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9664 if (g_GLOptions.m_bTextureCompressionCaching) {
9665 m_brebuild_cache = TRUE;
9666 EndModal(wxID_CANCEL);
9670void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9672 ::wxBeginBusyCursor();
9675 wxString path = g_Platform->GetPrivateDataDir();
9676 appendOSDirSlash(&path);
9677 path.append(
"raster_texture_cache");
9679 if (::wxDirExists(path)) {
9680 wxArrayString files;
9681 size_t nfiles = wxDir::GetAllFiles(path, &files);
9682 for (
unsigned int i = 0; i < files.GetCount(); i++)
9683 ::wxRemoveFile(files[i]);
9686 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9687 ::wxEndBusyCursor();
9691wxString OpenGLOptionsDlg::GetTextureCacheSize() {
9692 wxString path = g_Platform->GetPrivateDataDir();
9693 appendOSDirSlash(&path);
9694 path.append(
"raster_texture_cache");
9695 long long total = 0;
9697 if (::wxDirExists(path)) {
9698 wxArrayString files;
9699 size_t nfiles = wxDir::GetAllFiles(path, &files);
9700 for (
unsigned int i = 0; i < files.GetCount(); i++)
9701 total += wxFile(files[i]).Length();
9703 double mb = total / (1024.0 * 1024.0);
9704 if (mb < 10000.0)
return wxString::Format(
"%.1f MB", mb);
9706 return wxString::Format(
"%.1f GB", mb);
9714EVT_PAINT(CanvasConfigSelect::OnPaint)
9718 wxWindowID
id, wxBitmap& bmp,
9719 const wxPoint& pos, const wxSize& size)
9720 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9721 m_parentOptions = parentOptions;
9726 int refHeight = GetCharHeight();
9728 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9729 bmp.GetSize().y + m_borderWidth * 2));
9731 Connect(wxEVT_LEFT_DOWN,
9732 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9735CanvasConfigSelect::~CanvasConfigSelect() {}
9737void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9743 if (m_parentOptions)
9744 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9747void CanvasConfigSelect::SetSelected(
bool selected) {
9748 m_bSelected = selected;
9752 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9755 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9761void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9763 GetSize(&width, &height);
9766 dc.SetBackground(*wxLIGHT_GREY);
9768 dc.SetPen(*wxTRANSPARENT_PEN);
9769 dc.SetBrush(wxBrush(GetBackgroundColour()));
9770 dc.DrawRectangle(GetVirtualSize());
9773 dc.SetBrush(wxBrush(m_boxColour));
9775 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9777 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9779 dc.SetBrush(wxBrush(m_boxColour));
9781 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9783 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9786 dc.DrawBitmap(m_bmpNormal, m_borderWidth, m_borderWidth,
false);
ArrayOfMmsiProperties g_MMSI_Props_Array
Global instance.
unsigned g_OwnShipmmsi
Global instance.
AisDecoder * g_pAIS
Global instance.
Class AisDecoder and helpers.
Global state for AIS decoder.
Wrapper for creating a ChartCtx based on global vars.
ChartDB * ChartData
Global instance.
ChartGroupArray * g_pGroupArray
Global instance.
Basic chart info storage.
arrayofCanvasPtr g_canvasArray
Global instance.
Generic Chart canvas base.
Represents a user-defined collection of logically related charts.
ConfigCreateDialog(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
Class ConfigCreateDialog.
wxColour GetFontColor(const wxString &TextElement) const
Gets the text color for a UI element.
bool SetFont(const wxString &TextElement, wxFont *pFont, wxColour color)
Sets the default font properties for a UI element.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Get a font object for a UI element.
MMSIEditDialog(MmsiProperties *props, wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
Class MMSIEditDialog.
Process incoming AIS messages.
static double ui_to_config(int slider_pos)
Convert a slider scale 1-100 value to configuration value 1.02..3.0.
obs::EventVar m_on_sp_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Custom event class for OpenCPN's notification system.
Generic event handling between for example MVC Model and Controller based on a shared EventVar variab...
Wrapper for global variable, supports notification events when value changes.
Define an action to be performed when a KeyProvider is notified.
obs::EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
wxRadioButton * pTimezoneUTC
Specify date/time should be formatted in UTC.
wxRadioButton * pTimezoneLocalTime
Specify date/time should be formatted in timezone as configured in the operating system.
Class cm93chart and helpers – CM93 chart state.
Global variables reflecting command line options and arguments.
Communication drivers factory and support.
Config file user configuration interface.
int g_iTempFormat
User-selected temperature unit format for display and input.
bool g_bsmoothpanzoom
Controls how the chart panning and zooming smoothing is done during user interactions.
int g_iHeightFormat
User-selected height (vertical, above reference datum) unit format for display and input.
int g_nDepthUnitDisplay
User-selected depth (below surface) unit format for display and input.
bool g_bRollover
enable/disable mouse rollover GUI effects
int g_iSpeedFormat
User-selected speed unit format for display and input.
int g_COGAvgSec
COG average period for Course Up Mode (sec).
int g_iDistanceFormat
User-selected distance (horizontal) unit format for display and input.
wxString g_datetime_format
Date/time format to use when formatting date/time strings.
std::vector< size_t > g_config_display_size_mm
Size of pysical screen in millimeters.
bool g_bDisplayGrid
Should lat/lon grid be displayed ?
Global variables stored in configuration file.
std::vector< ConnectionParams * > & TheConnectionParams()
Return global list of connections.
Panel for editing a connection.
Options | Connections GUI tab managing connections
std::vector< OCPN_MonitorInfo > g_monitor_info
Information about the monitors connected to the system.
A common variable shared between producer and consumer which supports Listen() and Notify().
GLuint g_raster_format
Global instance.
OpenGL chart rendering canvas.
glTextureManager * g_glTextureManager
Global instance.
Global variables Listen()/Notify() wrapper.
Misc GUI event vars, a singleton.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
wxFont GetOCPNGUIScaledFont(wxString item)
Retrieves a font optimized for touch and high-resolution interfaces.
size_t g_current_monitor
Current monitor displaying main application frame.
Miscellaneous globals primarely used by gui layer, not persisted in configuration file.
GUI constant definitions.
Waypoint properties maintenance dialog.
Multiplexer class and helpers.
MyConfig * pConfig
Global instance.
Navigation Utility Functions without GUI dependencies.
Generic font dialog for OpenCPN.
wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
wxString * GetpSharedDataLocation()
Gets shared application data location.
double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
options * g_options
Global instance.
options * g_options
Global instance.
double gVar
Magnetic variation in degrees.
Position, course, speed, etc.
PlugInManager * g_pi_manager
Global instance.
wxColour g_colourWaypointRangeRingsColour
Global instance.
float g_ChartScaleFactorExp
Global instance.
Serial ports support, notably enumeration.
wxArrayString * EnumerateSerialPorts(void)
Enumerate all serial ports.
ocpnStyle::StyleManager * g_StyleManager
Global instance.
wxBitmap LoadSVG(const wxString filename, const unsigned int width, const unsigned int height, wxBitmap *default_bitmap, bool use_cache)
Load SVG file and return it's bitmap representation of requested size In case file can't be loaded an...
Abstract gFrame/MyFrame interface.
Access checks for comm devices and dongle.
Low-level USB device management.
WaypointMan drawing stuff.