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>
81#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
181using CBList = std::list<wxCheckBox*>;
187extern wxLocale* plocale_def_lang;
195extern int g_Android_SDK_Version;
196extern MigrateAssistantDialog* g_migrateDialog;
199static wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
201static wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
204static int lang_list[] = {
205 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
206 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
207 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
208 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
209 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
210 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
211 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
212 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
214 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
215 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
216 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
217 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
218 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
219 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
227 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
228 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
229 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
230 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
231 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
232 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
233 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
234 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
235 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
236 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
237 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
238 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
239 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
240 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
241 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
242 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
243 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
244 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
245 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
246 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
247 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
248 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
249 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
250 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
251 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
254 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
255 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
256 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
257 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
258 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
260 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
261 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
262 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
263 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
264 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
265 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
266 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
267 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
268 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
269 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
270 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
271 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
272 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
273 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
274 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
275 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
276 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
277 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
278 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
280 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
281 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
282 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
283 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
284 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
285 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
286 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
287 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
288 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
289 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
290 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
291 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
292 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
296void prepareSlider(wxSlider* slider) {
297 slider->GetHandle()->setStyleSheet(
298 prepareAndroidSliderStyleSheet(slider->GetSize().x));
299 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
300 slider->GetHandle()->grabGesture(Qt::PanGesture);
301 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
314 wxString textMod = text;
315 textMod.Replace(
" ",
"^");
318 wxString sep = wxFileName::GetPathSeparator();
319 textMod.Replace(sep,
" ");
321 Wrap(win, textMod, widthMax);
324 for (
size_t i = 0; i < m_array.GetCount(); i++) {
325 wxString a = m_array[i];
327 if (m_array.GetCount() > 1) {
328 if (i < m_array.GetCount() - 1) a += sep;
334 wxString
const& GetWrapped()
const {
return m_wrapped; }
335 int const GetLineCount()
const {
return m_lineCount; }
336 wxArrayString GetLineArray() {
return m_array; }
339 virtual void OnOutputLine(
const wxString& line) {
343 virtual void OnNewLine() {
351 wxArrayString m_array;
360 void DoChartSelected();
361 void SetSelected(
bool selected);
362 void OnPaint(wxPaintEvent& event);
364 void OnSize(wxSizeEvent& event);
366 int GetUnselectedHeight() {
return m_unselectedHeight; }
367 int GetRefHeight() {
return m_refHeight; }
368 bool IsSelected() {
return m_bSelected; }
369 void OnClickDown(wxMouseEvent& event);
370 void OnClickUp(wxMouseEvent& event);
375 wxColour m_boxColour;
376 int m_unselectedHeight;
377 wxString m_pChartDir;
381 DECLARE_EVENT_TABLE()
385EVT_PAINT(OCPNChartDirPanel::OnPaint)
387EVT_SIZE(OCPNChartDirPanel::OnSize)
391 const wxPoint& pos, const wxSize& size,
393 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
394 m_pChartDir = cdi.fullpath;
397 if (cdi.fullpath.StartsWith(
398 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
399 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
404 m_refHeight = GetCharHeight();
406 m_unselectedHeight = 2 * m_refHeight;
412 SetMinSize(wxSize(-1, m_unselectedHeight));
414 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
417 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
422OCPNChartDirPanel::~OCPNChartDirPanel() {}
424static wxStopWatch swclick;
426static int downx, downy;
429void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
432 event.GetPosition(&downx, &downy);
438void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
440 qDebug() << swclick.Time();
441 if (swclick.Time() < 200) {
443 event.GetPosition(&upx, &upy);
444 if ((fabs(upx - downx) < GetCharWidth()) &&
445 (fabs(upy - downy) < GetCharWidth())) {
453void OCPNChartDirPanel::DoChartSelected() {
463void OCPNChartDirPanel::SetSelected(
bool selected) {
464 m_bSelected = selected;
468 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
471 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
476 g_pOptions->SetDirActionButtons();
483void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
484 if (m_pChartDir.Length()) {
486 GetClientSize(&x, &y);
489 wxArrayString nameWrapped = wrapper.GetLineArray();
491 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
497void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
499 GetSize(&width, &height);
502 dc.SetPen(*wxTRANSPARENT_PEN);
503 dc.SetBrush(wxBrush(GetBackgroundColour()));
504 dc.DrawRectangle(GetVirtualSize());
506 wxString nameString = m_pChartDir;
508 wxArrayString nameWrapped = wrapper.GetLineArray();
510 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
511 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
512 GetParent()->GetSizer()->Layout();
516 dc.SetBrush(wxBrush(m_boxColour));
518 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
520 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
522 int offset = height / 10;
523 int text_x = offset * 2;
525 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
528 dc.SetTextForeground(
529 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
531 int yd = height * 20 / 100;
532 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
534 dc.DrawText(nameWrapped[i], text_x, yd);
536 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
537 yd += GetCharHeight();
541 dc.SetBrush(wxBrush(m_boxColour));
544 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME),
547 int offset = height / 10;
548 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
549 height - (2 * offset), height / 10);
551 int text_x = offset * 2;
553 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
556 dc.SetTextForeground(
557 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
559 int yd = height * 20 / 100;
560 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
562 dc.DrawText(nameWrapped[i], text_x, yd);
564 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
565 yd += GetCharHeight();
573static bool LoadAllPlugIns(
bool load_enabled) {
574 g_Platform->ShowBusySpinner();
575 bool b = PluginLoader::GetInstance()->
LoadAllPlugIns(load_enabled);
576 g_Platform->HideBusySpinner();
585 const wxPoint& pt = wxDefaultPosition,
586 const wxSize& sz = wxDefaultSize,
587 long style = wxHSCROLL | wxVSCROLL,
588 const wxString& name =
"scrolledWindow") {
589 Create(parent,
id, pt, sz, style, name);
592 bool Create(wxWindow* parent, wxWindowID
id = -1,
593 const wxPoint& pt = wxDefaultPosition,
594 const wxSize& sz = wxDefaultSize,
595 long style = wxHSCROLL | wxVSCROLL,
596 const wxString& name =
"scrolledWindow");
600 unsigned int Append(wxString& label,
bool benable =
true,
601 bool bsizerLayout =
true);
602 unsigned int GetCount() {
return m_list.size(); }
607 void Check(
int index,
bool val);
608 bool IsChecked(
int index);
616bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
617 const wxPoint& pt,
const wxSize& sz,
618 long style,
const wxString& name) {
619 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
622 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
623 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
627 m_sizer =
new wxBoxSizer(wxVERTICAL);
633unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable,
635 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
637 cb->SetValue(!benable);
639 if (bsizerLayout) m_sizer->Layout();
641 m_list.push_back(cb);
643 return m_list.size() - 1;
646void OCPNCheckedListCtrl::Check(
int index,
bool val) {
647 auto it = m_list.begin();
648 std::advance(it, index);
649 wxCheckBox* cb = *it;
651 if (cb) cb->SetValue(val);
654bool OCPNCheckedListCtrl::IsChecked(
int index) {
655 auto it = m_list.begin();
656 std::advance(it, index);
657 wxCheckBox* cb = *it;
659 return cb ? cb->GetValue() :
false;
662void OCPNCheckedListCtrl::RunLayout() { m_sizer->Layout(); }
664void OCPNCheckedListCtrl::Clear() {
670void appendOSDirSlash(wxString* pString);
679EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
680EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
684 const wxString& caption,
685 const wxPoint& pos, const wxSize& size,
687 : wxDialog(parent,
id, caption, pos, size,
688 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
690 GetSizer()->SetSizeHints(
this);
694ConfigCreateDialog::~ConfigCreateDialog() {}
696void ConfigCreateDialog::CreateControls() {
697 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
700 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
701 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
703 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
704 wxSize(40 * GetCharHeight(), -1), 0);
705 mainSizer->Add(m_TitleCtl, 0,
706 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
708 mainSizer->AddSpacer(2 * GetCharHeight());
710 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
711 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
714 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
715 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
716 mainSizer->Add(m_DescriptionCtl, 0,
717 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
719 mainSizer->AddSpacer(2 * GetCharHeight());
724 _(
"Create a private configuration template based on current settings.\n\
725This template will be saved, and may be selected for further use at any time.\n\
727 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
729 mainSizer->AddSpacer(2 * GetCharHeight());
731 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
732 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
734 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
735 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
737 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
738 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
739 m_OKButton->SetDefault();
742void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
743 EndModal(wxID_CANCEL);
746void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
747 const wxString& title = m_TitleCtl->GetValue();
748 const wxString& desc = m_DescriptionCtl->GetValue();
749 m_createdTemplateGUID = ConfigMgr::Get().CreateNamedConfig(title, desc,
"");
758EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
759EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
763 wxWindowID
id, const wxString& caption,
764 const wxPoint& pos, const wxSize& size,
766 : wxDialog(parent,
id, caption, pos, size,
767 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
770 GetSizer()->SetSizeHints(
this);
774MMSIEditDialog::~MMSIEditDialog() {
delete m_MMSICtl; }
776void MMSIEditDialog::CreateControls() {
777 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
780 wxStaticBox* mmsiBox =
781 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
783 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
784 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
786 wxStaticText* mmsiLabel =
new wxStaticText(
this, wxID_STATIC, _(
"MMSI"));
787 mmsiLabel->SetToolTip(
788 _(
"Maritime Mobile Service Identity - A unique 9-digit number assigned "
789 "to a vessel or navigation aid. Used to identify vessels and devices "
790 "in AIS transmissions and DSC calls."));
791 mmsiSizer->Add(mmsiLabel, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
793 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
794 wxDefaultPosition, wxSize(180, -1), 0);
795 m_MMSICtl->SetToolTip(
796 _(
"Enter the 9-digit MMSI number for this vessel or station"));
797 mmsiSizer->Add(m_MMSICtl, 0,
798 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
799 m_MMSICtl->Bind(wxEVT_TEXT, &MMSIEditDialog::OnMMSIChanged,
this);
801 wxStaticText* userLabelText =
new wxStaticText(
this, wxID_STATIC, _(
"Name"));
802 userLabelText->SetToolTip(
803 _(
"Display name for this vessel or device - can override names received "
805 mmsiSizer->Add(userLabelText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
807 m_ShipNameCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
808 wxDefaultPosition, wxSize(180, -1), 0);
809 m_ShipNameCtl->SetToolTip(_(
810 "Set the name for this vessel or device. If specified, this name takes "
811 "precedence over names received via AIS messages. Note that standard AIS "
812 "only supports uppercase letters (A-Z), numbers, and limited "
813 "punctuation. Your manual entries are stored in the mmsitoname.csv file "
814 "and preserved across sessions."));
815 mmsiSizer->Add(m_ShipNameCtl, 0,
816 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
818 wxStaticBox* trackBox =
new wxStaticBox(
this, wxID_ANY, _(
"Tracking"));
819 trackBox->SetToolTip(_(
"Control how tracks are created for this MMSI"));
820 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackBox, wxVERTICAL);
822 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
824 m_rbTypeTrackDefault =
825 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
826 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
827 m_rbTypeTrackDefault->SetToolTip(
828 _(
"Use the global tracking settings for this vessel"));
829 m_rbTypeTrackDefault->SetValue(TRUE);
830 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
832 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
833 m_rbTypeTrackAlways->SetToolTip(_(
834 "Always create a track for this vessel, regardless of global settings"));
835 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
837 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
838 m_rbTypeTrackNever->SetToolTip(
839 _(
"Never create a track for this vessel, regardless of global settings"));
840 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
842 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
843 m_cbTrackPersist->SetToolTip(
844 _(
"Save this vessel's track between OpenCPN sessions. Useful for vessels "
845 "you want to monitor continuously over time."));
846 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
848 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
849 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
851 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
852 m_IgnoreButton->SetToolTip(
853 _(
"When checked, AIS data for this MMSI will be ignored and the vessel "
854 "will not appear on the chart. Useful for suppressing shore stations, "
855 "permanently moored vessels, or duplicate AIS signals that you don't "
856 "need to monitor."));
857 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
859 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
860 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
861 m_MOBButton->SetToolTip(
862 _(
"When checked, OpenCPN will display a special icon for this device, "
863 "sound a distinctive alarm, and automatically create a temporary MOB "
864 "route from your vessel to this device in emergency. For crew safety "
865 "devices, you can assign the crew member's name using the Name "
866 "field above for quick identification."));
867 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
870 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
871 m_VDMButton->SetToolTip(
872 _(
"When checked, converts AIS messages for this vessel from AIVDM (other "
873 "vessel) to AIVDO (own vessel) format."));
874 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
876 m_FollowerButton =
new wxCheckBox(
877 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
878 m_FollowerButton->SetToolTip(
879 _(
"When checked, disables CPA (Closest Point of Approach) alerts for "
880 "this vessel as it's considered intentionally following your vessel. "
881 "Follower vessels are displayed with a special own-ship style icon."));
882 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
884 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
885 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
887 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
888 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
890 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
891 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
892 m_OKButton->SetDefault();
896 if (m_props->MMSI > 0)
897 sMMSI.Printf(
"%d", m_props->MMSI);
900 m_MMSICtl->AppendText(sMMSI);
903 if (!m_props->m_ShipName.IsEmpty()) {
904 m_ShipNameCtl->SetValue(m_props->m_ShipName);
907 switch (m_props->TrackType) {
908 case TRACKTYPE_ALWAYS:
909 m_rbTypeTrackAlways->SetValue(TRUE);
911 case TRACKTYPE_NEVER:
912 m_rbTypeTrackNever->SetValue(TRUE);
918 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
919 m_IgnoreButton->SetValue(m_props->m_bignore);
920 m_MOBButton->SetValue(m_props->m_bMOB);
921 m_VDMButton->SetValue(m_props->m_bVDM);
922 m_FollowerButton->SetValue(m_props->m_bFollower);
924 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
927void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
929void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
930 EndModal(wxID_CANCEL);
933void MMSIEditDialog::Persist() {
935 if (m_rbTypeTrackDefault->GetValue())
936 m_props->TrackType = TRACKTYPE_DEFAULT;
937 else if (m_rbTypeTrackAlways->GetValue())
938 m_props->TrackType = TRACKTYPE_ALWAYS;
940 m_props->TrackType = TRACKTYPE_NEVER;
942 m_props->m_bignore = m_IgnoreButton->GetValue();
943 m_props->m_bMOB = m_MOBButton->GetValue();
944 m_props->m_bVDM = m_VDMButton->GetValue();
945 m_props->m_bFollower = m_FollowerButton->GetValue();
946 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
949 wxString shipName = m_ShipNameCtl->GetValue().Upper();
950 if (!shipName.IsEmpty()) {
951 m_props->m_ShipName = shipName;
954 wxString mmsi = m_MMSICtl->GetValue();
955 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
956 g_pAIS->UpdateMMSItoNameFile(mmsi, shipName);
961 else if (m_props->m_ShipName == wxEmptyString) {
962 auto proptarget =
g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
964 wxString s = proptarget->GetFullName();
965 m_props->m_ShipName = s;
967 wxString GetShipNameFromFile(
int);
968 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
974void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
978 m_MMSICtl->GetValue().ToLong(&nmmsi);
979 m_props->MMSI = nmmsi;
982 if (m_MMSICtl->GetValue().Length() != 9) {
985 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
986 "your entries and cancel if necessary."),
987 _(
"OpenCPN Info"), wxOK | wxCANCEL);
989 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
990 if (retcode == wxID_OK) {
1001void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
1003void MMSIEditDialog::OnMMSIChanged(wxCommandEvent& event) {
1004 wxString mmsi = m_MMSICtl->GetValue();
1007 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1009 wxString shipName =
g_pAIS->GetMMSItoNameEntry(mmsi);
1012 if (shipName.IsEmpty()) {
1013 auto target =
g_pAIS->Get_Target_Data_From_MMSI(wxAtoi(mmsi));
1015 shipName = target->GetFullName();
1020 if (!shipName.IsEmpty()) {
1021 m_ShipNameCtl->SetValue(shipName);
1029EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1030EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1031EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1032 MMSIListCtrl::OnListItemRightClick)
1033EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1034EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1038 const wxSize& size,
long style)
1039 : wxListCtrl(parent,
id, pos, size, style) {
1043MMSIListCtrl::~MMSIListCtrl() {}
1045wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1049 if (!props)
return ret;
1052 if (props->MMSI > 0) ret = wxString::Format(
"%d", props->MMSI);
1055 switch (props->TrackType) {
1056 case TRACKTYPE_DEFAULT:
1059 case TRACKTYPE_ALWAYS:
1062 case TRACKTYPE_NEVER:
1068 if (props->m_bPersistentTrack) ret.Append(
", ").Append(_(
"Persistent"));
1071 if (props->m_bignore) ret =
"X";
1074 if (props->m_bMOB) ret =
"X";
1077 if (props->m_bVDM) ret =
"X";
1080 if (props->m_bFollower) ret =
"X";
1083 ret = props->m_ShipName;
1092void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1094void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1099 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1100 wxDefaultPosition, wxSize(200, 200));
1102 if (pd->ShowModal() == wxID_OK) {
1112void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1113 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1114 if (m_context_item == wxNOT_FOUND)
return;
1115 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1116 wxMenuItem* item_edit =
1117 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") +
"...");
1118 menu->Append(item_edit);
1119 wxMenuItem* item_delete =
1120 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1121 menu->Append(item_delete);
1125 item_edit->SetFont(*qFont);
1126 item_delete->SetFont(*qFont);
1129 wxPoint p = ScreenToClient(wxGetMousePosition());
1130 PopupMenu(menu, p.x, p.y);
1136void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1137 int context_item = m_context_item;
1142 switch (event.GetId()) {
1143 case ID_DEF_MENU_MMSI_EDIT: {
1146 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1147 wxDefaultPosition, wxSize(200, 200));
1149 if (pd->ShowModal() == wxID_OK) {
1152 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1160 case ID_DEF_MENU_MMSI_DELETE:
1167MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1168 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1175 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1178 wxString MMSI_props_column_spec =
"120;120;100;100;100;100;100;100";
1180 wxStringTokenizer tkz(MMSI_props_column_spec,
";");
1181 wxString s_width = tkz.GetNextToken();
1186 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1187 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1188 wxBORDER_SUNKEN | wxLC_VIRTUAL);
1196 int dx = GetCharWidth();
1199 if (s_width.ToLong(&lwidth)) {
1200 width = wxMax(dx * 2, lwidth);
1201 width = wxMin(width, dx * 13);
1203 m_pListCtrlMMSI->InsertColumn(tlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, width);
1205 s_width = tkz.GetNextToken();
1207 if (s_width.ToLong(&lwidth)) {
1208 width = wxMax(dx * 2, lwidth);
1209 width = wxMin(width, dx * 25);
1211 m_pListCtrlMMSI->InsertColumn(tlCLASS, _(
"Track Mode"), wxLIST_FORMAT_CENTER,
1214 s_width = tkz.GetNextToken();
1216 if (s_width.ToLong(&lwidth)) {
1217 width = wxMax(dx * 2, lwidth);
1218 width = wxMin(width, dx * 10);
1220 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1223 s_width = tkz.GetNextToken();
1225 if (s_width.ToLong(&lwidth)) {
1226 width = wxMax(dx * 2, lwidth);
1227 width = wxMin(width, dx * 10);
1229 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"MOB"), wxLIST_FORMAT_CENTER, width);
1231 s_width = tkz.GetNextToken();
1233 if (s_width.ToLong(&lwidth)) {
1234 width = wxMax(dx * 2, lwidth);
1235 width = wxMin(width, dx * 15);
1237 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1240 s_width = tkz.GetNextToken();
1242 if (s_width.ToLong(&lwidth)) {
1243 width = wxMax(dx * 2, lwidth);
1244 width = wxMin(width, dx * 30);
1246 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ship name"), wxLIST_FORMAT_CENTER,
1249 s_width = tkz.GetNextToken();
1251 if (s_width.ToLong(&lwidth)) {
1252 width = wxMax(dx * 2, lwidth);
1253 width = wxMin(width, dx * 10);
1255 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Follower"), wxLIST_FORMAT_CENTER,
1258 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1260 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1262 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1263 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1265 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1272 SetSize(GetSize().x, GetSize().y - 1);
1274 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1277MMSI_Props_Panel::~MMSI_Props_Panel() {}
1279void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1283 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1284 wxDefaultPosition, wxSize(200, 200));
1287 pd->ShowWindowModalThenDo([
this, pd, props](
int retcode) {
1288 if (retcode == wxID_OK) {
1297void MMSI_Props_Panel::UpdateMMSIList() {
1299 long selItemID = wxNOT_FOUND;
1300 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1301 wxLIST_STATE_SELECTED);
1303 int selMMSI = wxNOT_FOUND;
1309 long item_sel = wxNOT_FOUND;
1310 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1320 m_pListCtrlMMSI->SetItemState(item_sel,
1321 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1322 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1325 m_pListCtrlMMSI->Refresh(FALSE);
1329void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1339 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value =
"",
1340 const wxPoint& pos = wxDefaultPosition,
1341 const wxSize& size = wxDefaultSize,
int n = 0,
1342 const wxString choices[] = NULL,
long style = 0,
1343 const wxValidator& validator = wxDefaultValidator,
1344 const wxString& name =
"OCPNFatCombo");
1348 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1349 wxCoord OnMeasureItem(
size_t item)
const;
1350 wxCoord OnMeasureItemWidth(
size_t item)
const;
1351 bool SetFont(
const wxFont& font);
1353 int Append(
const wxString& item, wxBitmap bmp);
1356 const wxFont* dfont;
1360 ArrayOfBitmaps bmpArray;
1363OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1365OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1366 const wxString& value,
const wxPoint& pos,
1367 const wxSize& size,
int n,
const wxString choices[],
1368 long style,
const wxValidator& validator,
1369 const wxString& name)
1370 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1373 GetFont().GetPointSize() / g_Platform->getFontPointsperPixel();
1374 itemHeight = (int)wxRound(fontHeight);
1375 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1378OCPNFatCombo::~OCPNFatCombo() {}
1380bool OCPNFatCombo::SetFont(
const wxFont& font) {
1385void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1392 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1393 wxBrush br = wxBrush(bg);
1394 wxBrush sv = dc.GetBrush();
1396 dc.DrawRectangle(0, 0, rect.width, rect.height);
1398 dc.SetTextForeground(wxColour(0, 0, 0));
1400 if (flags & wxODCB_PAINTING_CONTROL) {
1401 wxString text = GetValue();
1403 dc.DrawText(text, rect.x + margin_x + offset_x,
1404 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1406 dc.SetBackground(wxBrush(br));
1408 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1409 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1413wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1414 if (item < bmpArray.GetCount())
1415 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1417 return itemHeight * 12 / 10;
1420wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1422int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1424 int idx = wxOwnerDrawnComboBox::Append(item);
1429void OCPNFatCombo::Clear() {
1430 wxOwnerDrawnComboBox::Clear();
1434BEGIN_EVENT_TABLE(
options, wxDialog)
1435EVT_INIT_DIALOG(options::OnDialogInit)
1436EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1437EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1438EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1439EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1440EVT_BUTTON(ID_REBUILDBUTTON, options::OnButtonRebuildChartDb)
1441EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1442EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1443EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1444EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1445EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1446EVT_BUTTON(xID_OK, options::OnXidOkClick)
1447EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1448EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1449EVT_BUTTON(ID_BUTTONFONT_RESET, options::OnResetFont)
1450EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1452EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1453EVT_CLOSE(options::OnClose)
1455#if defined(__WXGTK__) || defined(__WXQT__)
1456EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1459EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1461EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1462EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1463EVT_CHOICE(ID_HEIGHTUNITSCHOICE, options::OnUnitsChoice)
1464EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1465EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1466EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1467EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1468EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1469EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1470EVT_CHAR_HOOK(options::OnCharHook)
1475 const wxString& caption, const wxPoint& pos,
1476 const wxSize& size,
long style)
1477 : pTrackRotateTime(0), m_callbacks(callbacks) {
1482 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1484 wxDialog::Create(parent,
id, caption, pos, size, style,
"Options");
1485 SetFont(*dialogFont);
1488 RecalculateSize(size.x, size.y);
1490 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1492 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1493 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1495 m_pPlugInCtrl->ReloadPluginPanels();
1497 auto action = [&](wxCommandEvent& evt) {
1498 g_persist_active_route = m_persist_active_route_chkbox->IsChecked();
1500 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1501 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1503 m_OnChartDb_finalize_listener.Init(
1504 GuiEvents::GetInstance().on_finalize_chartdbs,
1505 [&](
ObservedEvt& ev) { OptionsFinalizeChartDBUpdate(); });
1508options::~options() {
1510 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1512 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1513 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1516 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1518 delete m_pSerialArray;
1519 delete m_pGroupArray;
1520 delete m_topImgList;
1524 delete m_pPlugInCtrl;
1527 delete m_PluginCatalogMgrPanel;
1532bool options::SendIdleEvents(wxIdleEvent& event) {
1533 if (IsShown())
return wxDialog::SendIdleEvents(event);
1537void options::OptionsFinalizeChartDBUpdate() {
1542void options::RecalculateSize(
int hint_x,
int hint_y) {
1543 if (!g_bresponsive) {
1544 m_nCharWidthMax = GetSize().x / GetCharWidth();
1548 if ((hint_x < 200) || (hint_y < 200)) {
1550 int display_width, display_height;
1554 if (display_height < 600) {
1557 vectorPanel->SetSizeHints(ps57Ctl);
1567 esize.x = GetCharWidth() * 110;
1568 esize.y = GetCharHeight() * 40;
1570 wxSize dsize = GetParent()->GetSize();
1571 esize.y = wxMin(esize.y, dsize.y - 0 );
1572 esize.x = wxMin(esize.x, dsize.x - 0 );
1575 wxSize fsize = GetSize();
1576 wxSize canvas_size = GetParent()->GetSize();
1577 wxPoint screen_pos = GetParent()->GetScreenPosition();
1578 int xp = (canvas_size.x - fsize.x) / 2;
1579 int yp = (canvas_size.y - fsize.y) / 2;
1580 Move(screen_pos.x + xp, screen_pos.y + yp);
1582 m_nCharWidthMax = GetSize().x / GetCharWidth();
1585void options::Init() {
1586 m_pWorkDirList = NULL;
1588 pShowStatusBar = NULL;
1589 pShowMenuBar = NULL;
1590 pShowCompassWin = NULL;
1593 m_scrollWinChartList = NULL;
1594 ps57CtlListBox = NULL;
1596 m_pSerialArray = NULL;
1597 pUpdateCheckBox = NULL;
1598 pParseENCButton = NULL;
1604 pSoundDeviceIndex = NULL;
1608 pCBLookAhead = NULL;
1609 pCDOQuilting = NULL;
1610 pPreserveScale = NULL;
1611 pSmoothPanZoom = NULL;
1612 pEnableZoomToCursor = NULL;
1613 pSDisplayGrid = NULL;
1614 pCDOOutlines = NULL;
1615 pSDepthUnits = NULL;
1617 pSDefaultBoatSpeed = NULL;
1620 itemActiveChartStaticBox = NULL;
1622 pCheck_SOUNDG = NULL;
1624 pCheck_SHOWIMPTEXT = NULL;
1625 pCheck_SCAMIN = NULL;
1626 pCheck_ATONTEXT = NULL;
1627 pCheck_LDISTEXT = NULL;
1628 pCheck_XLSECTTEXT = NULL;
1630 m_bVisitLang = FALSE;
1631 m_bVisitPlugins = FALSE;
1632 m_itemFontElementListBox = NULL;
1633 m_textSample = NULL;
1634 m_topImgList = NULL;
1637 m_pGroupArray = NULL;
1638 m_groups_changed = 0;
1641 m_pageConnections = -1;
1646 m_pageConnections = -1;
1648 pEnableTenHertz =
nullptr;
1650 auto loader = PluginLoader::GetInstance();
1651 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
1652 b_oldhaveWMM = b_haveWMM;
1657 m_bForceNewToolbaronCancel =
false;
1659 m_cs = (ColorScheme)0;
1662 m_pPlugInCtrl = NULL;
1663 m_PluginCatalogMgrPanel = NULL;
1677 m_bVectorInit =
false;
1682 pCmdSoundString = NULL;
1684 m_sconfigSelect_single = NULL;
1685 m_sconfigSelect_twovertical = NULL;
1688 dc.SetFont(*dialogFont);
1690 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, dialogFont);
1692 m_colourPickerDefaultSize =
1706 auto sound =
static_cast<o_sound::Sound*
>(ev.GetClientData());
1720 {_(
"Nautical miles"), DISTANCE_NMI},
1721 {_(
"Statute miles"), DISTANCE_MI},
1722 {_(
"Kilometers"), DISTANCE_KM},
1723 {_(
"Meters"), DISTANCE_M}};
1725static const int kNumDistanceFormats =
1729static int GetDistanceFormatIndex(
int enumValue) {
1730 for (
int i = 0; i < kNumDistanceFormats; i++) {
1731 if (kDistanceFormats[i].enumValue == enumValue) {
1739static int GetDistanceFormatEnum(
int index) {
1740 if (index >= 0 && index < kNumDistanceFormats) {
1741 return kDistanceFormats[index].enumValue;
1743 return DISTANCE_NMI;
1746#if defined(__GNUC__) && __GNUC__ < 8
1749static const wxString BAD_ACCESS_MSG = _(
1750 "The device selected is not accessible; opencpn will likely not be able\n"
1751 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1752 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1753 "with the following contents:\n\n"
1754 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1755 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1756 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1757 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1761static const wxString BAD_ACCESS_MSG = _(R
"(
1762The device selected is not accessible; opencpn will likely not be able
1763to use this device as-is. You might want to exit OpenCPN, reboot and
1764retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1765with the following contents:
1767 KERNEL=="ttyUSB*", MODE="0666"
1768 KERNEL=="ttyACM*", MODE="0666"
1769 KERNEL=="ttyS*", MODE="0666"
1771For more info, see the file LINUX_DEVICES.md in the distribution docs.
1776void options::OnDialogInit(wxInitDialogEvent& event) {}
1778void options::CheckDeviceAccess( wxString& path) {}
1780size_t options::CreatePanel(
const wxString& title) {
1781 size_t id = m_pListbook->GetPageCount();
1784 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1785 wxDefaultSize, wxTAB_TRAVERSAL, title);
1786 m_pListbook->AddPage(panel, title, FALSE,
id);
1790wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1791 if (parent > m_pListbook->GetPageCount() - 1) {
1793 wxString::Format(
"Warning: invalid parent in options::AddPage( %d, ",
1798 wxNotebookPage* page = m_pListbook->GetPage(parent);
1800 wxScrolledWindow* sw;
1802 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1803 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1805 for (
size_t i_page = 0; i_page < nb->GetPageCount(); i_page++) {
1806 wxString candidate_title = nb->GetPageText(i_page);
1807 if (candidate_title.IsSameAs(title))
1808 return static_cast<wxScrolledWindow*
>(nb->GetPage(i_page));
1811 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1813 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1814 nb->AddPage(sw, title);
1815 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1816 wxString toptitle = m_pListbook->GetPageText(parent);
1817 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1818 wxDefaultSize, wxNB_TOP);
1821 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1822 m_pListbook->SetSelection(0);
1823 m_pListbook->RemovePage(parent + 1);
1824 wxString previoustitle = page->GetName();
1826 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1827 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1829 nb->AddPage(page, previoustitle);
1833 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1835 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1836 nb->AddPage(sw, title);
1837 nb->ChangeSelection(0);
1839 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1840 wxDefaultSize, style, title);
1841 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1842 wxString toptitle = m_pListbook->GetPageText(parent);
1843 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1844 m_pListbook->SetSelection(0);
1845 m_pListbook->DeletePage(parent + 1);
1849 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1855bool options::DeletePluginPage(wxScrolledWindow* page) {
1856 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1857 wxNotebookPage* pg = m_pListbook->GetPage(i);
1858 auto nb =
dynamic_cast<wxNotebook*
>(pg);
1861 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1862 wxNotebookPage* spg = nb->GetPage(j);
1865 if (nb->GetPageCount() != 1)
return TRUE;
1867 spg = nb->GetPage(0);
1868 spg->Reparent(m_pListbook);
1870 wxString toptitle = m_pListbook->GetPageText(i);
1871 m_pListbook->DeletePage(i);
1872 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1876 }
else if (pg == page) {
1878 m_pListbook->DeletePage(i);
1879 wxPanel* panel =
new wxPanel(m_pListbook);
1880 wxString toptitle = m_pListbook->GetPageText(i);
1881 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1888void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1889 int group_item_spacing) {
1890 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1893 std::make_shared<ConnectionsDlg>(m_pNMEAForm, TheConnectionParams());
1896 Bind(wxEVT_SIZE, [&](wxSizeEvent& ev) {
1897 auto w = m_pListbook->GetCurrentPage();
1898 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
1902 comm_dialog->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1906void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1907 int group_item_spacing) {
1908 itemPanelShip = AddPage(parent, _(
"Own ship"));
1910 ownShip =
new wxBoxSizer(wxVERTICAL);
1911 itemPanelShip->SetSizer(ownShip);
1914 wxStaticBox* osdBox =
1915 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1916 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1917 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1919 wxFlexGridSizer* dispOptionsGrid =
1920 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1921 dispOptionsGrid->AddGrowableCol(1);
1922 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1924 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1925 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1926 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1928 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1929 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
1931 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
1932 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
1933 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
1935 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1936 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
1938 wxStaticText* iconTypeTxt =
1939 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
1940 dispOptionsGrid->Add(iconTypeTxt, 0);
1942 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
1943 _(
"Real Scale Vector")};
1945 m_pShipIconType =
new wxChoice(
1946 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
1947 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
1948 dispOptionsGrid->Add(m_pShipIconType, 0,
1949 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
1950 group_item_spacing);
1952 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
1953 realSizes->AddGrowableCol(1);
1955 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
1958 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
1960 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
1961 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1964 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
1966 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1967 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1970 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
1972 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1973 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1975 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
1976 _(
"GPS Offset from Midship (m)")),
1978 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1979 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1982 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
1984 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1985 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1988 wxFlexGridSizer* rrSelect =
1989 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
1990 rrSelect->AddGrowableCol(1);
1991 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
1993 wxStaticText* rrTxt =
1994 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
1995 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
1997 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
1998 "6",
"7",
"8",
"9",
"10"};
1999 pNavAidRadarRingsNumberVisible =
2000 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
2001 m_pShipIconType->GetSize(), 11, rrAlt);
2002 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
2003 group_item_spacing);
2005 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2006 radarGrid->AddGrowableCol(1);
2007 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
2009 wxStaticText* distanceText =
2010 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
2011 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
2013 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL,
"",
2014 wxDefaultPosition, wxSize(100, -1), 0);
2015 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
2016 group_item_spacing);
2018 wxStaticText* unitText =
2019 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
2020 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
2022 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"),
2023 _(
"Minutes (time)")};
2024 m_itemRadarRingsUnits =
2025 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
2026 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
2027 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2029 wxStaticText* colourText =
2030 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Color"));
2031 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2033 m_colourOwnshipRangeRingColour =
2035 wxDefaultPosition, m_colourPickerDefaultSize, 0,
2036 wxDefaultValidator,
"ID_COLOUROSRANGECOLOUR");
2037 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2040 wxFlexGridSizer* shipToActiveGrid =
2041 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2042 shipToActiveGrid->AddGrowableCol(1);
2043 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2044 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2045 _(
"Show direction to Active Waypoint"));
2046 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2049 wxStaticText* shipToActiveText1 =
2050 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2051 shipToActiveGrid->Add(shipToActiveText1, 1,
2052 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2054 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
2055 _(
"Long dash"), _(
"Short dash")};
2056 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2057 m_shipToActiveStyle =
2058 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2059 LineStyleNChoices, LineStyleChoices, 0);
2060 m_shipToActiveStyle->SetSelection(0);
2061 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2063 wxStaticText* shipToActiveText2 =
2064 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2065 shipToActiveGrid->Add(shipToActiveText2, 1,
2066 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2068 wxString m_LineColorChoices[] = {
2069 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2070 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2071 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2072 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2074 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2075 m_shipToActiveColor =
2076 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2077 LineColorNChoices, m_LineColorChoices, 0);
2078 m_shipToActiveColor->SetSelection(0);
2079 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2082 wxStaticBox* shipdata =
2083 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Ship's identifier"));
2084 wxStaticBoxSizer* datasizer =
new wxStaticBoxSizer(shipdata, wxVERTICAL);
2085 ownShip->Add(datasizer, 0, wxGROW | wxALL, border_size);
2087 wxFlexGridSizer* ownmmsisizer =
2088 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2089 ownmmsisizer->AddGrowableCol(1);
2090 datasizer->Add(ownmmsisizer, 0, wxALL | wxEXPAND, border_size);
2094 wxStaticText* pStatic_ownshipmmsi =
2095 new wxStaticText(itemPanelShip, wxID_ANY,
2096 _(
"Own ship's MMSI. (If available) Nine digits"));
2097 ownmmsisizer->Add(pStatic_ownshipmmsi, 0);
2100 const wxString AllowDigits[] = {
"0",
"1",
"2",
"3",
"4",
2101 "5",
"6",
"7",
"8",
"9"};
2102 wxArrayString ArrayAllowDigits(10, AllowDigits);
2103 wxTextValidator mmsiVal(wxFILTER_INCLUDE_CHAR_LIST);
2104 mmsiVal.SetIncludes(ArrayAllowDigits);
2105 m_pTxt_OwnMMSI =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"",
2106 wxDefaultPosition, wxDefaultSize, 0, mmsiVal);
2107 ownmmsisizer->Add(m_pTxt_OwnMMSI, 0, wxALIGN_RIGHT);
2110 wxStaticBox* trackText =
2111 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2112 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2113 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2114 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2116 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2117 _(
"Automatic Daily Tracks at midnight"));
2119 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2122 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2124#if wxUSE_TIMEPICKCTRL
2125 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2128 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2129 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2130 wxDefaultPosition, wxDefaultSize, 0);
2133 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2134 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2135 wxDefaultPosition, wxDefaultSize, 0);
2137 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2141 pTrackRotateComputerTime =
2142 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2143 wxDefaultPosition, wxDefaultSize, 0);
2144 trackSizer1->Add(pTrackRotateComputerTime, 0,
2145 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2148 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2149 wxDefaultPosition, wxDefaultSize, 0);
2150 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2154 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2155 wxDefaultPosition, wxDefaultSize, 0);
2156 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2159 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2161 wxFlexGridSizer* hTrackGrid =
2162 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2163 hTrackGrid->AddGrowableCol(1);
2164 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2167 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2168 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2170 wxStaticText* trackColourText =
2171 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Color"));
2172 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2175 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2176 m_colourPickerDefaultSize, 0, wxDefaultValidator,
"ID_COLOURTRACKCOLOUR");
2177 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2179 wxFlexGridSizer* pTrackGrid =
2180 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2181 pTrackGrid->AddGrowableCol(1);
2182 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2184 wxStaticText* tpText =
2185 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2186 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2188 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2189 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2190 m_pShipIconType->GetSize(), 3, trackAlt);
2191 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2192 group_item_spacing);
2195 wxStaticBox* ownshipcalcText =
2196 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Calculate values"));
2197 wxStaticBoxSizer* ownshipcalcSizer =
2198 new wxStaticBoxSizer(ownshipcalcText, wxVERTICAL);
2199 ownShip->Add(ownshipcalcSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2201 wxFlexGridSizer* dispOwnShipCalcOptionsGrid =
2202 new wxFlexGridSizer(2, 2, group_item_spacing, group_item_spacing);
2203 ownshipcalcSizer->Add(dispOwnShipCalcOptionsGrid, 0, wxTOP | wxALL | wxEXPAND,
2206 dispOwnShipCalcOptionsGrid->AddGrowableCol(1);
2208 pSogCogFromLLCheckBox =
2209 new wxCheckBox(itemPanelShip, ID_SOGCOGFROMLLCHECKBOX,
2210 _(
"Calculate SOG and COG from position changes"));
2211 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLCheckBox, 1, wxALL, 5);
2212 dispOwnShipCalcOptionsGrid->AddSpacer(0);
2214 wxStaticText* SogCogFromLLDampIntText =
new wxStaticText(
2215 itemPanelShip, wxID_STATIC, _(
"Min seconds between updates"));
2216 dispOwnShipCalcOptionsGrid->Add(SogCogFromLLDampIntText, 1, wxEXPAND | wxALL,
2217 group_item_spacing);
2219 pSogCogFromLLDampInterval =
new wxSpinCtrl(
2220 itemPanelShip, ID_SOGCOGDAMPINTTEXTCTRL, wxEmptyString, wxDefaultPosition,
2221 wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0);
2223 dispOwnShipCalcOptionsGrid->Add(pSogCogFromLLDampInterval, 0,
2224 wxALIGN_RIGHT | wxALL, group_item_spacing);
2227void options::CreatePanel_Routes(
size_t parent,
int border_size,
2228 int group_item_spacing) {
2229 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2231 Routes =
new wxBoxSizer(wxVERTICAL);
2232 itemPanelRoutes->SetSizer(Routes);
2234 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2236 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
2237 "6",
"7",
"8",
"9",
"10"};
2240 wxStaticBox* routeText =
2241 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2242 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2243 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2245 wxStaticBox* activeRouteText =
2246 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2247 wxStaticBoxSizer* activeRouteSizer =
2248 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2250 m_persist_active_route_chkbox =
new wxCheckBox(
2251 itemPanelRoutes, wxID_ANY,
2252 _(
"Persist active route, automatically activate on start up"));
2253 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2254 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2256 routeSizer->AddSpacer(5);
2259 wxFlexGridSizer* routepointiconSelect =
2260 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2261 routepointiconSelect->AddGrowableCol(1);
2262 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2265 wxStaticText* routepointiconTxt =
2266 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2267 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2268 group_item_spacing);
2271 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2272 0, NULL, wxCB_READONLY);
2273 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2274 wxALIGN_RIGHT | wxALL, group_item_spacing);
2276 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2279 int min_size = GetCharHeight() * 2;
2280 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2281 pRoutepointDefaultIconChoice->SetMinSize(
2282 wxSize(GetCharHeight() * 15, min_size));
2284 routeSizer->AddSpacer(5);
2286 wxFlexGridSizer* pRouteGrid =
2287 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2288 pRouteGrid->AddGrowableCol(1);
2289 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2291 wxStaticText* raText =
new wxStaticText(
2292 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Arrival Circle Radius (NMi)"));
2293 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2295 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2296 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2297 group_item_spacing);
2299 pAdvanceRouteWaypointOnArrivalOnly =
2300 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2301 _(
"Advance route waypoint on arrival only"));
2302 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2305 Routes->AddSpacer(8 * group_item_spacing);
2307 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2308 wxDefaultSize, wxLI_HORIZONTAL);
2309 Routes->Add(pln, 0, wxEXPAND);
2313 wxStaticBox* waypointText =
2314 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2315 wxStaticBoxSizer* waypointSizer =
2316 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2317 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2319 waypointSizer->AddSpacer(5);
2322 wxFlexGridSizer* waypointiconSelect =
2323 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2324 waypointiconSelect->AddGrowableCol(1);
2325 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2328 wxStaticText* waypointiconTxt =
2329 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2330 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2331 group_item_spacing);
2334 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2335 0, NULL, wxCB_READONLY);
2336 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2337 group_item_spacing);
2339 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2342 int rmin_size = GetCharHeight() * 2;
2343 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2344 pWaypointDefaultIconChoice->SetMinSize(
2345 wxSize(GetCharHeight() * 15, rmin_size));
2347 waypointSizer->AddSpacer(5);
2349 wxFlexGridSizer* ScaMinSizer =
2350 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2351 ScaMinSizer->AddGrowableCol(1);
2352 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2354 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2355 _(
"Show marks only at a chartscale greater than 1 :"));
2356 ScaMinSizer->Add(pScaMinChckB, 0);
2357 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2358 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2359 group_item_spacing);
2361 wxFlexGridSizer* ScaMaxSizer =
2362 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2363 ScaMaxSizer->AddGrowableCol(1);
2364 waypointSizer->Add(ScaMaxSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2365 wxStaticText* scaMaxLabel =
2366 new wxStaticText(itemPanelRoutes, wxID_ANY,
2367 _(
"Show marks only at a chartscale smaller than 1 :"));
2368 ScaMaxSizer->Add(scaMaxLabel, 0);
2369 m_pText_ScaMax =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2370 ScaMaxSizer->Add(m_pText_ScaMax, 0, wxALL | wxALIGN_RIGHT,
2371 group_item_spacing);
2374 pScaMinOverruleChckB =
2375 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2376 _(
"Override the settings for chartscale based visibility "
2377 "and show always"));
2378 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2380 waypointSizer->AddSpacer(5);
2382 wxFlexGridSizer* waypointrrSelect =
2383 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2384 waypointrrSelect->AddGrowableCol(1);
2385 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2388 wxStaticText* waypointrrTxt =
2389 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2390 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2392 pWaypointRangeRingsNumber =
2393 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2394 m_pShipIconType->GetSize(), 11, rrAlt);
2395 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2396 group_item_spacing);
2399 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2400 waypointradarGrid->AddGrowableCol(1);
2401 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2403 wxStaticText* waypointdistanceText =
new wxStaticText(
2404 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2405 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2406 group_item_spacing);
2408 pWaypointRangeRingsStep =
2409 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2410 wxSize(100, -1), 0);
2411 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2412 group_item_spacing);
2414 wxStaticText* waypointunitText =
2415 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2416 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2417 group_item_spacing);
2419 m_itemWaypointRangeRingsUnits =
2420 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2421 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2422 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2423 wxALIGN_RIGHT | wxALL, border_size);
2425 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2426 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colors"));
2427 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2430 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2431 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2432 "ID_COLOURWAYPOINTRANGERINGSCOLOUR");
2433 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2434 wxALIGN_RIGHT | wxALL, 1);
2439 Routes->AddSpacer(8 * group_item_spacing);
2440 wxStaticLine* pln1 =
2441 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2442 wxDefaultSize, wxLI_HORIZONTAL);
2443 Routes->Add(pln1, 0, wxEXPAND);
2446 wxStaticBox* waypointControl =
2447 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2448 wxStaticBoxSizer* ControlSizer =
2449 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2450 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2452 ControlSizer->AddSpacer(5);
2454 pWayPointPreventDragging =
new wxCheckBox(
2455 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2456 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2457 pWayPointPreventDragging->SetValue(FALSE);
2458 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2460 pConfirmObjectDeletion =
2461 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2462 _(
"Confirm deletion of tracks and routes"));
2463 pConfirmObjectDeletion->SetValue(FALSE);
2464 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2465 ControlSizer->AddSpacer(5);
2468 pWaypointDefaultIconChoice->Clear();
2470 bool fillCombo =
true;
2473 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2474 wxString* ps = pWayPointMan->GetIconDescription(i);
2475 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2477 pWaypointDefaultIconChoice->Append(*ps, bmp);
2482 int iconToSelect = -1;
2483 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2484 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2486 pWaypointDefaultIconChoice->Select(iconToSelect);
2492 pRoutepointDefaultIconChoice->Clear();
2497 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2498 wxString* ps = pWayPointMan->GetIconDescription(i);
2499 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2501 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2507 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2508 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2510 pRoutepointDefaultIconChoice->Select(iconToSelect);
2518void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2519 int group_item_spacing) {
2520 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2522 chartPanel =
new wxBoxSizer(wxVERTICAL);
2523 chartPanelWin->SetSizer(chartPanel);
2525 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2526 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2527 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2529 m_scrollWinChartList =
new wxScrolledWindow(
2530 chartPanelWin, wxID_ANY, wxDefaultPosition,
2531 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2533 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2540 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2542 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2543 m_scrollWinChartList->SetSizer(boxSizerCharts);
2545 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2546 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2548 wxString b1 = _(
"Add Directory...");
2549 wxString b2 = _(
"Remove Selected");
2550 wxString b3 = _(
"Compress Selected");
2558 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2559 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2561 cmdButtonSizer->AddSpacer(GetCharHeight());
2563 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2564 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2565 m_removeBtn->Disable();
2567 cmdButtonSizer->AddSpacer(GetCharHeight());
2570 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2571 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2572 m_compressBtn->Disable();
2574 m_compressBtn = NULL;
2578 if (g_Android_SDK_Version >= 30) {
2580 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2581 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2585 cmdButtonSizer->AddSpacer(GetCharHeight());
2587 wxStaticBox* itemStaticBoxUpdateStatic =
2588 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2589 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2590 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2591 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2593 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2594 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2596 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2597 _(
"Scan Charts and Update Database"));
2598 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2600 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2601 _(
"Force Full Database Rebuild"));
2603 pUpdateCheckBox->Hide();
2605 pRebuildChartDatabase =
new wxButton(chartPanelWin, ID_REBUILDBUTTON,
2606 _(
"Rebuild Chart Database"));
2607 itemFlexGridSizerUpdate->Add(pRebuildChartDatabase, 1, wxALL, 5);
2609 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2610 _(
"Prepare all ENC Charts"));
2611 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2613 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2616 ActiveChartArray.Clear();
2617 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2618 ActiveChartArray.Add(m_CurrentDirList[i]);
2621 UpdateChartDirList();
2623 chartPanel->Layout();
2626void options::UpdateChartDirList() {
2628 m_scrollWinChartList->GetSizer()->Clear(
true);
2629 m_scrollWinChartList->ClearBackground();
2631 panelVector.clear();
2634 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2637 wxSize(-1, -1), ActiveChartArray[i]);
2638 chartPanel->SetSelected(
false);
2640 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2642 panelVector.push_back(chartPanel);
2645 m_scrollWinChartList->GetSizer()->Layout();
2647 chartPanelWin->ClearBackground();
2648 chartPanelWin->Layout();
2657 wxSize sza = GetSize();
2662 m_scrollWinChartList->GetParent()->Layout();
2665 m_scrollWinChartList->Scroll(0, 0);
2668void options::UpdateTemplateTitleText() {
2669 if (!m_templateTitleText)
return;
2671 wxString activeTitle;
2672 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2673 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2675 bool configCompare =
2676 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2677 if (!configCompare) activeTitle += _(
" [Modified]");
2678 m_templateTitleText->SetLabel(activeTitle);
2680 m_templateTitleText->SetLabel(_(
"None"));
2683void options::CreatePanel_Configs(
size_t parent,
int border_size,
2684 int group_item_spacing) {
2685 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2691 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2692 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2696 wxStaticBox* templateStatusBox =
2697 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2698 m_templateStatusBoxSizer =
2699 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2700 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2703 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2704 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2706 m_staticTextLastAppled =
new wxStaticText(
2707 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2708 m_staticTextLastAppled->Hide();
2710 statSizer->Add(m_staticTextLastAppled);
2712 m_templateTitleText =
2713 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2714 statSizer->Add(m_templateTitleText);
2715 m_templateTitleText->Hide();
2717 UpdateTemplateTitleText();
2719 wxStaticBox* configsBox =
2720 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2721 wxStaticBoxSizer* configSizer =
2722 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2723 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2725 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2726 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2728 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2729 cPanel->SetSizer(boxSizercPanel);
2731 m_scrollWinConfigList =
2732 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2733 wxBORDER_RAISED | wxVSCROLL);
2734 m_scrollWinConfigList->SetScrollRate(1, 1);
2735 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2737 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2739 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2740 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2742 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2743 configSizer->Add(btnSizer);
2746 wxButton* createButton =
2747 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2748 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2749 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2750 wxCommandEventHandler(options::OnCreateConfig), NULL,
2758 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2759 _(
"Delete Selected Config..."));
2760 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2761 group_item_spacing);
2762 m_configDeleteButton->Connect(
2763 wxEVT_COMMAND_BUTTON_CLICKED,
2764 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2766 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2767 _(
"Apply Selected Config"));
2768 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2769 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2770 wxCommandEventHandler(options::OnApplyConfig),
2777 SetConfigButtonState();
2781void options::ClearConfigList() {
2782 if (m_scrollWinConfigList) {
2783 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2784 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2785 wxWindowListNode* node = kids.Item(i);
2786 wxWindow* win = node->GetData();
2787 auto pcp =
dynamic_cast<wxPanel*
>(win);
2796 SetConfigButtonState();
2799void options::BuildConfigList() {
2800 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2802 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2804 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2806 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2807 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2808 pp->Connect(wxEVT_LEFT_DOWN,
2809 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2813 wxWindowList kids = pp->GetChildren();
2814 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2815 wxWindowListNode* node = kids.Item(i);
2816 wxWindow* win = node->GetData();
2817 win->Connect(wxEVT_LEFT_DOWN,
2818 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2824 m_boxSizerConfigs->Layout();
2826 m_selectedConfigPanelGUID =
"";
2827 SetConfigButtonState();
2830void options::SetConfigButtonState() {
2831 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2832 if (m_selectedConfigPanelGUID.StartsWith(
2834 m_configDeleteButton->Disable();
2835 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2838void options::OnCreateConfig(wxCommandEvent& event) {
2840 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2842 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2843 if (retcode == wxID_OK) {
2844 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2845 UpdateTemplateTitleText();
2849 m_DisplayConfigsPage->Layout();
2851 SetConfigButtonState();
2855void options::OnEditConfig(wxCommandEvent& event) {}
2857void options::OnDeleteConfig(wxCommandEvent& event) {
2858 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2860 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2861 m_selectedConfigPanelGUID =
"";
2866 m_DisplayConfigsPage->Layout();
2867 SetConfigButtonState();
2870void options::OnApplyConfig(wxCommandEvent& event) {
2871 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2874 wxString currentLocale = g_locale;
2878 evt.SetId(ID_APPLY);
2882 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2886 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2887 wxString activeTitle =
2888 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2889 m_templateTitleText->SetLabel(activeTitle);
2890 m_templateTitleText->Show();
2891 m_staticTextLastAppled->Show();
2892 m_templateStatusBoxSizer->Layout();
2894 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2895 _(
"OpenCPN Info"), wxOK);
2898 if (m_scrollWinConfigList) {
2899 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2900 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2901 wxWindowListNode* node = kids.Item(i);
2902 wxWindow* win = node->GetData();
2903 auto pcp =
dynamic_cast<wxPanel*
>(win);
2907 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2912 m_selectedConfigPanelGUID = wxEmptyString;
2914 m_returnChanges |= CONFIG_CHANGED;
2916 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2921void options::OnConfigMouseSelected(wxMouseEvent& event) {
2922 wxPanel* selectedPanel = NULL;
2923 wxObject* obj =
event.GetEventObject();
2925 auto panel =
dynamic_cast<wxPanel*
>(obj);
2927 selectedPanel = panel;
2931 auto win =
dynamic_cast<wxWindow*
>(obj);
2933 auto parentpanel =
dynamic_cast<wxPanel*
>(win->GetParent());
2935 selectedPanel = parentpanel;
2940 if (m_scrollWinConfigList) {
2941 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2942 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2943 wxWindowListNode* node = kids.Item(i);
2944 wxWindow* win = node->GetData();
2945 auto panel =
dynamic_cast<wxPanel*
>(win);
2947 if (panel == selectedPanel) {
2948 panel->SetBackgroundColour(wxSystemSettings::GetColour(
2949 wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
2951 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
2953 panel->SetBackgroundColour(m_panelBackgroundUnselected);
2955 panel->Refresh(
true);
2959 m_DisplayConfigsPage->Layout();
2960 SetConfigButtonState();
2964void options::CreatePanel_Advanced(
size_t parent,
int border_size,
2965 int group_item_spacing) {
2966 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
2970 double dpmm = g_Platform->GetDisplayDPmm();
2972 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2973 m_ChartDisplayPage->SetSizer(wrapperSizer);
2975 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
2978 itemBoxSizerUI->Add(0, border_size * 3);
2979 itemBoxSizerUI->Add(0, border_size * 3);
2982 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
2983 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
2985 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
2986 _(
"De-skew Raster Charts"));
2987 boxCharts->Add(pSkewComp, inputFlags);
2989 itemBoxSizerUI->Add(0, border_size * 3);
2990 itemBoxSizerUI->Add(0, border_size * 3);
2994 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
2995 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
2997 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
2998 _(
"Use Accelerated Graphics (OpenGL)"));
2999 OpenGLSizer->Add(pOpenGL, inputFlags);
3000 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3002 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3003 _(
"OpenGL Options") +
"...");
3004 OpenGLSizer->Add(bOpenGL, inputFlags);
3006 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3007 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3012 itemBoxSizerUI->Add(0, border_size * 3);
3013 itemBoxSizerUI->Add(0, border_size * 3);
3017 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3018 _(
"Chart Rotation Averaging Time"));
3020 wrapperSizer->Add(crat, 0,
3021 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3022 group_item_spacing);
3024 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3025 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
3028 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3029 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3030 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
3031 group_item_spacing);
3033 pCOGUPFilterRow->Add(
3034 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3037 itemBoxSizerUI->Add(0, border_size * 3);
3038 itemBoxSizerUI->Add(0, border_size * 3);
3041 wxStaticText* zoomTextHead =
new wxStaticText(
3042 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3043 zoomTextHead->Wrap(-1);
3044 itemBoxSizerUI->Add(
3046 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3047 group_item_spacing);
3048 itemBoxSizerUI->Add(0, border_size * 1);
3050 itemBoxSizerUI->Add(
3051 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3054 m_pSlider_Zoom_Raster =
3055 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3056 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3059 prepareSlider(m_pSlider_Zoom_Raster);
3062 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3064 itemBoxSizerUI->Add(
3065 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3068 m_pSlider_Zoom_Vector =
3069 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3070 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3073 prepareSlider(m_pSlider_Zoom_Vector);
3076 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3078 itemBoxSizerUI->Add(
3079 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3081 m_pSlider_CM93_Zoom =
3082 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3083 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3084 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3087 prepareSlider(m_pSlider_CM93_Zoom);
3090 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3092 itemBoxSizerUI->Add(0, border_size * 3);
3093 itemBoxSizerUI->Add(0, border_size * 3);
3094 itemBoxSizerUI->Add(0, border_size * 3);
3097 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3098 _(
"Physical Screen Width")),
3100 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3101 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3103 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3104 pDPIRow->Add(pRBSizeAuto, inputFlags);
3105 pDPIRow->AddSpacer(10);
3106 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3107 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3108 pDPIRow->Add(pRBSizeManual, inputFlags);
3110 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3111 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3114 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3115 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3116 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3118 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3122 itemBoxSizerUI->Add(
3123 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3125 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3126 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3128 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3129 _(
"Show extended chart bar information."));
3130 ChartBarSizer->Add(pChartBarEX, inputFlags);
3132 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3133 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3135 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3136 wxCommandEventHandler(options::OnSizeManualButton),
3142 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3143 itemBoxSizerUI->SetHGap(border_size);
3150 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3151 m_ChartDisplayPage->SetSizer(wrapperSizer);
3152 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3155 itemBoxSizerUI->Add(0, border_size * 3);
3156 itemBoxSizerUI->Add(0, border_size * 3);
3159 itemBoxSizerUI->Add(
3160 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3162 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3163 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3165 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3166 _(
"Show Skewed Raster Charts as North-Up"));
3167 boxCharts->Add(pSkewComp, verticleInputFlags);
3185 itemBoxSizerUI->Add(0, border_size * 3);
3186 itemBoxSizerUI->Add(0, border_size * 3);
3189 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3190 _(
"Chart Rotation Averaging Time")),
3192 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3193 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3194 group_item_spacing);
3197 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3198 wxSize(50, -1), wxTE_RIGHT);
3199 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3201 pCOGUPFilterRow->Add(
3202 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3206 itemBoxSizerUI->Add(0, border_size * 8);
3207 itemBoxSizerUI->Add(0, border_size * 8);
3210 wxStaticText* zoomTextHead =
new wxStaticText(
3211 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3213 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3214 itemBoxSizerUI->Add(0, border_size * 1);
3215 itemBoxSizerUI->Add(0, border_size * 1);
3217 wxStaticText* zoomText =
new wxStaticText(
3218 m_ChartDisplayPage, wxID_ANY,
3219 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3220With a higher value, the same zoom level shows a more detailed chart."));
3222 smallFont = *dialogFont;
3224 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3226 zoomText->SetFont(smallFont);
3227 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3235 itemBoxSizerUI->Add(
3236 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3238 m_pSlider_Zoom_Raster =
3239 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3240 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3243 prepareSlider(m_pSlider_Zoom_Raster);
3246 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3248 itemBoxSizerUI->Add(
3249 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3251 m_pSlider_Zoom_Vector =
3252 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3253 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3256 prepareSlider(m_pSlider_Zoom_Vector);
3259 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3262 itemBoxSizerUI->Add(0, border_size * 3);
3263 itemBoxSizerUI->Add(0, border_size * 3);
3265 itemBoxSizerUI->Add(
3266 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3268 m_pSlider_CM93_Zoom =
3269 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3270 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3271 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3274 prepareSlider(m_pSlider_CM93_Zoom);
3277 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3280 itemBoxSizerUI->Add(0, border_size * 3);
3281 itemBoxSizerUI->Add(0, border_size * 3);
3282 itemBoxSizerUI->Add(0, border_size * 3);
3283 itemBoxSizerUI->Add(0, border_size * 3);
3284 itemBoxSizerUI->Add(0, border_size * 3);
3285 itemBoxSizerUI->Add(0, border_size * 3);
3288 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3289 _(
"Physical Screen Width")),
3291 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3292 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3294 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3295 pDPIRow->Add(pRBSizeAuto, inputFlags);
3296 pDPIRow->AddSpacer(10);
3297 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3298 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3299 pDPIRow->Add(pRBSizeManual, inputFlags);
3302 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3303 wxSize(3 * m_fontHeight, -1), wxTE_RIGHT);
3304 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3306 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3309 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3310 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3312 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3313 wxCommandEventHandler(options::OnSizeManualButton),
3317 itemBoxSizerUI->Add(0, border_size * 3);
3318 itemBoxSizerUI->Add(0, border_size * 3);
3323 itemBoxSizerUI->Add(
3324 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3326 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3327 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3329 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3330 _(
"Use Accelerated Graphics (OpenGL)"));
3331 OpenGLSizer->Add(pOpenGL, inputFlags);
3332 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3334 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3335 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3341 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3342 _(
"Options") +
"...");
3343 OpenGLSizer->Add(bOpenGL, inputFlags);
3346 itemBoxSizerUI->Add(0, border_size * 3);
3347 itemBoxSizerUI->Add(0, border_size * 3);
3352 itemBoxSizerUI->Add(
3353 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3355 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3356 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3358 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3359 _(
"Show extended chart bar information."));
3360 ChartBarSizer->Add(pChartBarEX, inputFlags);
3372 m_ChartDisplayPage->Fit();
3376void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3377 int group_item_spacing) {
3378 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3381 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3382 ps57Ctl->SetSizer(vectorPanel);
3385 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3386 optionsColumn->SetHGap(border_size);
3387 optionsColumn->AddGrowableCol(0, 2);
3388 optionsColumn->AddGrowableCol(1, 3);
3389 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3392 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3393 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3398 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3400 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3401 _(
"Mariner's Standard")};
3402 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3403 wxDefaultSize, 4, pDispCatStrings);
3404 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3408 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3409 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3412 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3415 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3416 optionsColumn->Add(miscSizer, groupInputFlags);
3420 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3421 pCheck_SOUNDG->SetValue(FALSE);
3422 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3425 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3426 _(
"Chart Information Objects"));
3427 pCheck_META->SetValue(FALSE);
3428 miscSizer->Add(pCheck_META, verticleInputFlags);
3431 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3434 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3435 optionsColumn->Add(lightSizer, groupInputFlags);
3438 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3439 pCheck_ATONTEXT->SetValue(FALSE);
3440 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3443 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3444 pCheck_LDISTEXT->SetValue(FALSE);
3445 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3447 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3448 _(
"Extended Light Sectors"));
3449 pCheck_XLSECTTEXT->SetValue(FALSE);
3450 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3453 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3456 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3457 optionsColumn->Add(textSizer, groupInputFlags);
3459 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3460 _(
"National text on chart"));
3461 pCheck_NATIONALTEXT->SetValue(FALSE);
3462 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3464 pCheck_SHOWIMPTEXT =
3465 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3466 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3467 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3470 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3471 pCheck_DECLTEXT->SetValue(FALSE);
3472 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3474 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3476 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3477 _(
"Reduced Detail at Small Scale"));
3478 pCheck_SCAMIN->SetValue(FALSE);
3479 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3481 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3482 pCheck_SuperSCAMIN =
3483 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3484 _(
"Additional detail reduction at Small Scale"));
3485 pCheck_SuperSCAMIN->SetValue(FALSE);
3486 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3489 optionsColumn->Add(0, border_size * 4);
3490 optionsColumn->Add(0, border_size * 4);
3492 wxSize item_size = wxSize(-1, -1);
3494 item_size = wxSize(m_fontHeight * 3, m_fontHeight);
3498 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3500 wxString pPointStyleStrings[] = {
3504 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3505 item_size, 2, pPointStyleStrings);
3506 optionsColumn->Add(pPointStyle, inputFlags);
3508 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3510 wxString pBoundStyleStrings[] = {
3514 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3515 item_size, 2, pBoundStyleStrings);
3516 optionsColumn->Add(pBoundStyle, inputFlags);
3518 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3520 wxString pColorNumStrings[] = {
3524 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3525 item_size, 2, pColorNumStrings);
3526 optionsColumn->Add(p24Color, inputFlags);
3529 optionsColumn->Add(0, border_size * 4);
3530 optionsColumn->Add(0, border_size * 4);
3532 item_size = wxSize(60, -1);
3534 item_size = wxSize(m_fontHeight * 2, m_fontHeight);
3538 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3540 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3541 optionsColumn->Add(depShalRow);
3542 m_ShallowCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3543 item_size, wxTE_RIGHT);
3544 depShalRow->Add(m_ShallowCtl, inputFlags);
3545 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3546 depShalRow->Add(m_depthUnitsShal, inputFlags);
3548 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3550 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3551 optionsColumn->Add(depSafeRow);
3552 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3553 item_size, wxTE_RIGHT);
3554 depSafeRow->Add(m_SafetyCtl, inputFlags);
3555 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3556 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3558 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3560 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3561 optionsColumn->Add(depDeepRow);
3562 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3563 item_size, wxTE_RIGHT);
3564 depDeepRow->Add(m_DeepCtl, inputFlags);
3565 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3566 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3569 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3570 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3572 wxStaticBox* marinersBox =
3573 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3574 wxStaticBoxSizer* marinersSizer =
3575 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3576 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3579 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3580 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3582 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3583 itemButtonSelectList =
3584 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3585 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3586 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3587 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3588 marinersSizer->Add(btnRow1);
3590 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3592 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3593 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3594 marinersSizer->Add(btnRow2);
3599 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3600 ps57Ctl->SetSizer(vectorPanel);
3602 wxBoxSizer* optionsColumn = vectorPanel;
3605 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3610 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3612 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3613 _(
"Mariner's Standard")};
3614 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3615 wxSize(350, -1), 4, pDispCatStrings);
3616 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3619 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3624 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3625 optionsColumn->Add(miscSizer, groupInputFlags);
3628 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3629 pCheck_SOUNDG->SetValue(FALSE);
3630 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3632 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3633 _(
"Chart Information Objects"));
3634 pCheck_META->SetValue(FALSE);
3635 miscSizer->Add(pCheck_META, inputFlags);
3637 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3638 optionsColumn->Add(lightSizer, groupInputFlags);
3641 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3642 pCheck_ATONTEXT->SetValue(FALSE);
3643 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3646 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3647 pCheck_LDISTEXT->SetValue(FALSE);
3648 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3650 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3651 _(
"Extended Light Sectors"));
3652 pCheck_XLSECTTEXT->SetValue(FALSE);
3653 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3655 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3656 optionsColumn->Add(textSizer, groupInputFlags);
3658 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3659 _(
"National text on chart"));
3660 pCheck_NATIONALTEXT->SetValue(FALSE);
3661 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3663 pCheck_SHOWIMPTEXT =
3664 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3665 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3666 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3669 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3670 pCheck_DECLTEXT->SetValue(FALSE);
3671 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3673 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3674 _(
"Reduced Detail at Small Scale"));
3675 pCheck_SCAMIN->SetValue(FALSE);
3676 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3678 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3679 pCheck_SuperSCAMIN =
3680 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3681 _(
"Additional detail reduction at Small Scale"));
3682 pCheck_SuperSCAMIN->SetValue(FALSE);
3683 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3686 optionsColumn->Add(0, border_size * 4);
3687 optionsColumn->Add(0, border_size * 4);
3691 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3692 StyleColumn->SetHGap(border_size);
3693 StyleColumn->AddGrowableCol(0, 2);
3694 StyleColumn->AddGrowableCol(1, 3);
3695 optionsColumn->Add(StyleColumn);
3697 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3699 wxString pPointStyleStrings[] = {
3703 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3704 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3705 pPointStyleStrings);
3707 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3710 StyleColumn->Add(pPointStyle, inputFlags);
3712 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3714 wxString pBoundStyleStrings[] = {
3718 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3719 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3720 pBoundStyleStrings);
3722 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3725 StyleColumn->Add(pBoundStyle, inputFlags);
3727 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3730 wxString pColorNumStrings[] = {
3734 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3735 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3738 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3740 StyleColumn->Add(p24Color, inputFlags);
3743 optionsColumn->Add(0, border_size * 4);
3744 optionsColumn->Add(0, border_size * 4);
3746 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3747 DepthColumn->SetHGap(border_size);
3748 DepthColumn->AddGrowableCol(0, 3);
3749 DepthColumn->AddGrowableCol(1, 2);
3750 DepthColumn->AddGrowableCol(2, 3);
3751 optionsColumn->Add(DepthColumn);
3754 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3757 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3758 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3759 DepthColumn->Add(m_ShallowCtl, inputFlags);
3760 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3761 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3763 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3766 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3767 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3768 DepthColumn->Add(m_SafetyCtl, inputFlags);
3769 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3770 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3772 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3775 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3776 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3777 DepthColumn->Add(m_DeepCtl, inputFlags);
3778 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3779 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3782 optionsColumn->Add(0, border_size * 4);
3783 optionsColumn->Add(0, border_size * 4);
3786 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3787 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3789 wxStaticBox* marinersBox =
3790 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3791 wxStaticBoxSizer* marinersSizer =
3792 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3793 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3795 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3796 itemButtonSelectList =
3797 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3798 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3799 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3800 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3801 marinersSizer->Add(btnRow1);
3803 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3805 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3806 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3807 marinersSizer->Add(btnRow2);
3810 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3812 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3816void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3817 int group_item_spacing) {
3818 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3820 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3821 tcPanel->SetSizer(mainHBoxSizer);
3823 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3824 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3825 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3828 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3829 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3831 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3835 tcDataSelected->DeleteAllItems();
3842 col0.SetAlign(wxLIST_FORMAT_LEFT);
3844 tcDataSelected->InsertColumn(0, col0);
3847 unsigned int id = 0;
3848 for (
auto ds : TideCurrentDataSet) {
3851 tcDataSelected->InsertItem(li);
3853 wxString setName = ds;
3854 tcDataSelected->SetItem(
id, 0, setName);
3855 GetTextExtent(setName, &w1, &h);
3856 w = w1 > w ? w1 : w;
3859 tcDataSelected->SetColumnWidth(0, 20 + w);
3862 wxButton* insertButton =
3863 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3864 wxButton* removeButton =
3865 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3867 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3868 tcSizer->Add(btnSizer);
3870 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3871 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3874void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3875 int group_item_spacing) {
3880 wxNotebook* chartsPageNotebook = (wxNotebook*)m_pListbook->GetPage(parent);
3881 wxScrolledWindow* sw =
new ChartGroupsUI(chartsPageNotebook);
3882 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3883 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3886 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3889void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3890 int group_item_spacing) {
3892 m_border_size = border_size;
3893 m_group_item_spacing = group_item_spacing;
3895 m_UIcomplete = FALSE;
3900void ChartGroupsUI::CompletePanel() {
3902 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3903 m_panel->SetSizer(m_topSizer);
3906 wxStaticText* allChartsLabel =
3907 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3908 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3910 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3911 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3913 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3914 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3918 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3919 wxDefaultSize, wxVSCROLL);
3922 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3923 wxDefaultSize, wxVSCROLL);
3925 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3927 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3928 m_pAddButton->Disable();
3929 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3930 m_pRemoveButton->Disable();
3932 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3933 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3935 m_pRemoveButton->Connect(
3936 wxEVT_COMMAND_BUTTON_CLICKED,
3937 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3939 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3940 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3941 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3943 sizerCharts->AddSpacer(20);
3946 wxStaticText* groupsLabel =
3947 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3948 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3950 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
3951 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
3953 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
3954 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
3955 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
3956 wxDefaultSize, wxNB_TOP);
3957 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
3959 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
3960 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
3964 wxPanel* allActiveGroup =
3965 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
3966 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
3968 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
3969 allActiveGroup->SetSizer(page0BoxSizer);
3971 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1,
"",
3972 wxDefaultPosition, wxDefaultSize);
3975 iFont =
new wxFont(*dialogFont);
3976 iFont->SetStyle(wxFONTSTYLE_ITALIC);
3977 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
3979 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
3981 m_DirCtrlArray.Add(defaultAllCtl);
3985 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
3986 m_pDeleteGroupButton =
3987 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
3988 m_pDeleteGroupButton->Disable();
3990 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3991 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
3993 m_pDeleteGroupButton->Connect(
3994 wxEVT_COMMAND_BUTTON_CLICKED,
3995 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
3997 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
3998 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
4000 newDeleteGrp->AddSpacer(25);
4001 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
4002 m_group_item_spacing);
4003 newDeleteGrp->AddSpacer(15);
4004 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
4005 m_group_item_spacing);
4006 newDeleteGrp->AddSpacer(25);
4007 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
4009 sizerGroups->AddSpacer(20);
4013 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
4014 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
4017 m_UIcomplete = TRUE;
4020void options::CreatePanel_Display(
size_t parent,
int border_size,
4021 int group_item_spacing) {
4022 pDisplayPanel = AddPage(parent, _(
"General"));
4025 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4026 generalSizer->SetHGap(border_size);
4033 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4034 pDisplayPanel->SetSizer(wrapperSizer);
4035 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4038 generalSizer->Add(0, border_size * 4);
4039 generalSizer->Add(0, border_size * 4);
4044 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4046 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4047 generalSizer->Add(boxNavMode, groupInputFlags);
4049 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4050 boxNavMode->Add(rowOrientation);
4052 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4053 rowOrientation->Add(pCBNorthUp, inputFlags);
4055 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4056 rowOrientation->Add(pCBCourseUp,
4058 .Align(wxALIGN_CENTRE_VERTICAL)
4059 .Border(wxLEFT, group_item_spacing * 2));
4061 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4062 _(
"Look Ahead Mode"));
4063 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4066 generalSizer->Add(0, border_size * 4);
4067 generalSizer->Add(0, border_size * 4);
4071 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4073 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4074 generalSizer->Add(boxCharts, groupInputFlags);
4076 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4077 _(
"Enable Chart Quilting"));
4078 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4081 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4082 _(
"Preserve scale when switching charts"));
4083 boxCharts->Add(pPreserveScale, verticleInputFlags);
4086 generalSizer->Add(0, border_size * 4);
4087 generalSizer->Add(0, border_size * 4);
4091 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4093 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4094 generalSizer->Add(boxCtrls, groupInputFlags);
4096 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4097 _(
"Smooth Panning / Zooming"));
4098 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4100 pEnableZoomToCursor =
4101 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4102 pEnableZoomToCursor->SetValue(FALSE);
4103 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4105 pEnableTenHertz =
nullptr;
4107 pEnableTenHertz =
new wxCheckBox(pDisplayPanel, ID_TENHZCHECKBOX,
4108 _(
"Enable Ten Hz screen update"));
4109 pEnableTenHertz->SetValue(FALSE);
4110 boxCtrls->Add(pEnableTenHertz, verticleInputFlags);
4115 generalSizer->Add(0, border_size * 4);
4116 generalSizer->Add(0, border_size * 4);
4120 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4122 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4123 generalSizer->Add(boxDisp, groupInputFlags);
4126 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4127 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4129 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4130 _(
"Show Chart Outlines"));
4131 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4133 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4134 _(
"Show Depth Units"));
4135 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4145 generalSizer->Add(0, border_size * 4);
4146 generalSizer->Add(0, border_size * 4);
4150 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4152 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4153 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4156 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4157 _(
"Live ETA at Cursor"));
4158 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4162 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4163 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4165 m_Text_def_boat_speed =
new wxStaticText(
4166 pDisplayPanel, wxID_ANY,
4167 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4169 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4170 pSDefaultBoatSpeed =
4171 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4172 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4173 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4174 group_item_spacing);
4181 if (g_Platform->GetDisplayAreaCM2() > 100) {
4182 wxStaticBox* itemStaticBoxScreenConfig =
4183 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4184 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4185 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4186 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4189 wxString iconDir = g_Platform->GetSharedDataDir();
4190 appendOSDirSlash(&iconDir);
4191 iconDir.append(
"uidata");
4192 appendOSDirSlash(&iconDir);
4193 iconDir.append(
"MUI_flat");
4194 appendOSDirSlash(&iconDir);
4195 int bmpSize = GetCharHeight() * 3;
4197 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4198 m_sconfigSelect_single =
4200 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4203 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4205 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4206 m_sconfigSelect_twovertical =
4208 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4211 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4216 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4217 generalSizer->SetHGap(border_size);
4224 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4225 pDisplayPanel->SetSizer(wrapperSizer);
4226 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4229 generalSizer->Add(0, border_size * 4);
4230 generalSizer->Add(0, border_size * 4);
4235 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4237 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4238 generalSizer->Add(boxNavMode, groupInputFlags);
4240 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4241 boxNavMode->Add(rowOrientation);
4243 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4244 rowOrientation->Add(pCBNorthUp, inputFlags);
4246 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4247 rowOrientation->Add(pCBCourseUp,
4249 .Align(wxALIGN_CENTRE_VERTICAL)
4250 .Border(wxLEFT, group_item_spacing * 2));
4252 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4253 _(
"Look Ahead Mode"));
4254 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4257 generalSizer->Add(0, border_size * 4);
4258 generalSizer->Add(0, border_size * 4);
4262 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4264 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4265 generalSizer->Add(boxCharts, groupInputFlags);
4267 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4268 _(
"Enable Chart Quilting"));
4269 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4272 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4273 _(
"Preserve scale when switching charts"));
4274 boxCharts->Add(pPreserveScale, verticleInputFlags);
4277 generalSizer->Add(0, border_size * 4);
4278 generalSizer->Add(0, border_size * 4);
4282 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4284 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4285 generalSizer->Add(boxCtrls, groupInputFlags);
4287 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4288 _(
"Smooth Panning / Zooming"));
4289 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4290 pEnableZoomToCursor =
4291 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4292 pEnableZoomToCursor->SetValue(FALSE);
4293 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4296 pSmoothPanZoom->Hide();
4297 pEnableZoomToCursor->Hide();
4301 generalSizer->Add(0, border_size * 4);
4302 generalSizer->Add(0, border_size * 4);
4307 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4309 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4310 generalSizer->Add(boxDisp, groupInputFlags);
4313 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4314 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4316 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4317 _(
"Show Chart Outlines"));
4318 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4320 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4321 _(
"Show Depth Units"));
4322 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4332 generalSizer->Add(0, border_size * 4);
4333 generalSizer->Add(0, border_size * 4);
4337 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4339 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4340 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4343 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4344 _(
"Live ETA at Cursor"));
4345 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4349 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4350 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4351 m_Text_def_boat_speed =
new wxStaticText(
4352 pDisplayPanel, wxID_ANY,
4353 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4354 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4355 pSDefaultBoatSpeed =
4356 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4357 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4358 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4359 group_item_spacing);
4365 if (g_Platform->GetDisplayAreaCM2() > 100) {
4367 wxStaticBox* itemStaticBoxScreenConfig =
4368 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4369 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4370 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4371 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4374 wxString iconDir = g_Platform->GetSharedDataDir();
4375 appendOSDirSlash(&iconDir);
4376 iconDir.append(
"uidata");
4377 appendOSDirSlash(&iconDir);
4378 iconDir.append(
"MUI_flat");
4379 appendOSDirSlash(&iconDir);
4380 int bmpSize = GetCharHeight() * 3;
4382 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4383 m_sconfigSelect_single =
4385 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4388 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4390 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4391 m_sconfigSelect_twovertical =
4393 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4396 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4402void options::CreatePanel_Units(
size_t parent,
int border_size,
4403 int group_item_spacing) {
4404 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4407 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4408 unitsSizer->SetHGap(border_size);
4412 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4413 panelUnits->SetSizer(wrapperSizer);
4415 wrapperSizer->Add(1, border_size * 24);
4416 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4419 unitsSizer->Add(0, border_size * 4);
4420 unitsSizer->Add(0, border_size * 4);
4423 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4425 wxString pDistanceFormats[kNumDistanceFormats];
4426 for (
int i = 0; i < kNumDistanceFormats; i++) {
4427 pDistanceFormats[i] = kDistanceFormats[i].label;
4429 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4431 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4432 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4435 pDistanceFormat->SetToolTip(ttDistance());
4437 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4439 unitsSizer->Add(pDistanceFormat, inputFlags);
4442 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4444 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4445 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4446 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4447 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4448 m_SpeedFormatsNChoices, pSpeedFormats);
4449 pSpeedFormat->SetToolTip(ttSpeed());
4451 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4453 unitsSizer->Add(pSpeedFormat, inputFlags);
4456 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4458 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4459 int m_WindSpeedFormatsNChoices =
4460 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4462 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4463 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4465 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4467 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4469 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4472 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4474 wxString pDepthUnitStrings[] = {
4480 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4481 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4483 pDepthUnitSelect->SetToolTip(ttDepth());
4485 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4487 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4490 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4492 wxString pHeightUnitStrings[] = {
4497 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4498 wxSize(m_fontHeight * 4, -1), 2, pHeightUnitStrings);
4501 pHeightUnitSelect->SetToolTip(ttHeight());
4503 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4505 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4508 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4510 wxString pTempUnitStrings[] = {
4516 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4517 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4518 pTempFormat->SetToolTip(ttTemp());
4520 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4522 unitsSizer->Add(pTempFormat, inputFlags);
4525 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4526 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4529 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4531 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4532 _(
"Decimal Degrees"),
4533 _(
"Degrees, Minutes, Seconds")};
4534 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4535 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4536 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4537 m_SDMMFormatsNChoices, pSDMMFormats);
4538 pSDMMFormat->SetToolTip(ttCoordFormat());
4540 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4542 unitsSizer->Add(pSDMMFormat, inputFlags);
4545 unitsSizer->Add(0, border_size * 4);
4546 unitsSizer->Add(0, border_size * 4);
4550 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4553 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4554 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4555 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4556 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4559 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4560 wxDefaultPosition, wxDefaultSize, 0);
4562 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4563 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4564 wxDefaultPosition, wxDefaultSize, 0);
4566 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4569 unitsSizer->Add(0, border_size * 4);
4570 unitsSizer->Add(0, border_size * 4);
4573 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4578 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4579 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4580 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4583 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4584 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4585 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4589 wxStaticBox* itemStaticBoxVar =
new wxStaticBox(panelUnits, wxID_ANY,
"");
4591 wxStaticBoxSizer* itemStaticBoxSizerVar =
4592 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4593 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4595 itemStaticBoxSizerVar->Add(0, border_size * 4);
4597 itemStaticTextUserVar =
4598 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4599 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4600 group_item_spacing);
4602 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4603 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4604 group_item_spacing);
4606 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4607 wxSize(150, -1), wxTE_RIGHT);
4608 magVarSizer->AddSpacer(100);
4610 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4612 itemStaticTextUserVar2 =
4613 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4615 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4616 group_item_spacing);
4618 itemStaticBoxSizerVar->Add(0, border_size * 40);
4621 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4622 unitsSizer->SetHGap(border_size);
4624 int item_h_size = -1;
4626 item_h_size = m_fontHeight * 4;
4631 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4632 panelUnits->SetSizer(wrapperSizer);
4633 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4636 unitsSizer->Add(0, border_size * 4);
4637 unitsSizer->Add(0, border_size * 4);
4640 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4642 wxString pDistanceFormats[kNumDistanceFormats];
4643 for (
int i = 0; i < kNumDistanceFormats; i++) {
4644 pDistanceFormats[i] = kDistanceFormats[i].label;
4646 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4647 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4648 wxDefaultPosition, wxSize(item_h_size, -1),
4649 m_DistanceFormatsNChoices, pDistanceFormats);
4650 pDistanceFormat->SetToolTip(ttDistance());
4652 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4654 unitsSizer->Add(pDistanceFormat, inputFlags);
4657 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4659 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4660 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4661 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4662 wxDefaultPosition, wxSize(item_h_size, -1),
4663 m_SpeedFormatsNChoices, pSpeedFormats);
4664 pSpeedFormat->SetToolTip(ttSpeed());
4666 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4668 unitsSizer->Add(pSpeedFormat, inputFlags);
4671 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4673 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4674 int m_WindSpeedFormatsNChoices =
4675 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4676 pWindSpeedFormat =
new wxChoice(
4677 panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4678 wxSize(item_h_size, -1), m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4679 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4681 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4683 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4686 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4688 wxString pDepthUnitStrings[] = {
4694 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4695 wxSize(item_h_size, -1), 3, pDepthUnitStrings);
4696 pDepthUnitSelect->SetToolTip(ttDepth());
4698 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4700 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4703 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4705 wxString pHeightUnitStrings[] = {
4710 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4711 wxSize(item_h_size, -1), 2, pHeightUnitStrings);
4712 pHeightUnitSelect->SetToolTip(ttHeight());
4714 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4716 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4719 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4721 wxString pTempUnitStrings[] = {
4727 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4728 wxSize(item_h_size, -1), 3, pTempUnitStrings);
4729 pTempFormat->SetToolTip(ttTemp());
4731 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4733 unitsSizer->Add(pTempFormat, inputFlags);
4736 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4737 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4740 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4742 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4743 _(
"Decimal Degrees"),
4744 _(
"Degrees, Minutes, Seconds")};
4745 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4746 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4747 wxDefaultPosition, wxSize(item_h_size, -1),
4748 m_SDMMFormatsNChoices, pSDMMFormats);
4749 pSDMMFormat->SetToolTip(ttCoordFormat());
4751 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4753 unitsSizer->Add(pSDMMFormat, inputFlags);
4756 unitsSizer->Add(0, border_size * 4);
4757 unitsSizer->Add(0, border_size * 4);
4761 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4764 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4765 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4766 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4767 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4770 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4771 wxDefaultPosition, wxDefaultSize, 0);
4773 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4774 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4775 wxDefaultPosition, wxDefaultSize, 0);
4777 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4780 unitsSizer->Add(0, border_size * 4);
4781 unitsSizer->Add(0, border_size * 4);
4784 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4787 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4788 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4791 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4792 _(
"Show true bearings and headings"));
4793 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4794 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4795 _(
"Show magnetic bearings and headings."));
4796 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4798 bearingsSizer->AddSpacer(10);
4801 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4802 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4804 itemStaticTextUserVar =
4805 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4806 itemStaticTextUserVar->SetLabel(
4807 _(
"WMM Plugin calculated magnetic variation"));
4809 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4810 group_item_spacing);
4812 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4813 wxSize(50, -1), wxTE_RIGHT);
4814 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4816 itemStaticTextUserVar2 =
4817 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4818 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4819 group_item_spacing);
4821 bearingsSizer->AddSpacer(10);
4823 wxStaticText* varText =
4824 new wxStaticText(panelUnits, wxID_ANY,
4825 _(
" To set the magnetic variation manually,\n you "
4826 "must disable the WMM plugin."));
4827 smallFont = *dialogFont;
4828 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4830 varText->SetFont(smallFont);
4832 bearingsSizer->Add(varText);
4841 OCPNSoundPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
4842 const wxSize& size, wxString title, wxString checkLegend,
4843 wxString selectLegend, wxString* pSoundFile);
4847 void OnButtonSelectSound(wxCommandEvent& event);
4848 void OnButtonSPTestSound(wxCommandEvent& event);
4849 wxString SelectSoundFile();
4850 void SetSoundFileLabel(wxString file);
4851 wxCheckBox* GetCheckBox() {
return m_pCheck_Sound; }
4852 wxString GetSoundFile() {
return m_sound_file; }
4854 wxCheckBox* m_pCheck_Sound;
4855 wxSize m_small_button_size;
4856 wxString m_sound_file;
4857 wxString* m_pSoundFile;
4858 wxStaticText* m_AudioFileNameText;
4861 wxButton* TestSound;
4862 o_sound::Sound* m_sound;
4868 bool m_soundPlaying;
4870 DECLARE_EVENT_TABLE()
4873#define ID_SELECTSOUND 9341
4874#define ID_TESTSOUND 9342
4877EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4878EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4883 const wxPoint& pos, const wxSize& size,
4884 wxString title, wxString checkLegend,
4885 wxString selectLegend, wxString* pSoundFile)
4886 : wxPanel(parent,
id, pos, size, wxBORDER_NONE), m_soundPlaying(false) {
4887 wxFont* pif = FontMgr::Get().
GetFont(_(
"Dialog"));
4890 m_pSoundFile = pSoundFile;
4891 if (pSoundFile) m_sound_file = *pSoundFile;
4893 m_sound = o_sound::Factory();
4895 int border_size = 4;
4896 int group_item_spacing = 2;
4898 int font_size_y, font_descent, font_lead;
4899 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
4900 m_small_button_size = wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4902 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4903 SetSizer(wrapperSizer);
4905 wxStaticBox* StaticBox1 =
new wxStaticBox(
this, wxID_ANY, title);
4906 wxStaticBoxSizer* StaticBoxSizer1 =
4907 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4908 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4910 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO, checkLegend);
4911 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4914 wxString LabelWrapped;
4920 g_pOptions->GetSize().x * 8 / 10);
4921 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4922 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4923 LabelWrapped +=
"\n";
4925 LabelWrapped +=
"\n";
4928 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4929 m_AudioFileNameText->Wrap(-1);
4930 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4932 SetSoundFileLabel(m_sound_file);
4935 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4936 soundSizer1->SetHGap(border_size * 2);
4937 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4939 SelSound =
new wxButton(
this, ID_SELECTSOUND, selectLegend, wxDefaultPosition,
4940 m_small_button_size, 0);
4941 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4942 soundSizer1->AddSpacer(group_item_spacing * 4);
4943 TestSound =
new wxButton(
this, ID_TESTSOUND, _(
"Test"), wxDefaultPosition,
4944 m_small_button_size, 0);
4945 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4946 auto sound_action = [
this](
ObservedEvt ev) { m_soundPlaying =
false; };
4947 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4950void OCPNSoundPanel::SetSoundFileLabel(wxString file) {
4951 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " + file);
4954 g_pOptions->GetSize().x * 8 / 10);
4955 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4956 wxString LabelWrapped;
4957 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4959 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4961 LabelWrapped += LabelWrappedArray[i];
4962 LabelWrapped +=
"\n";
4965 m_AudioFileNameText->SetLabel(LabelWrapped);
4969wxString OCPNSoundPanel::SelectSoundFile() {
4970 wxString sound_dir = g_Platform->GetSharedDataDir();
4971 sound_dir.Append(
"sounds");
4976 wxFileDialog* popenDialog =
new wxFileDialog(
4977 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4978 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
4980 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
4982 response = popenDialog->ShowModal();
4983 sel_file = popenDialog->GetPath();
4987 response = g_Platform->DoFileSelectorDialog(
4988 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
4992 if (response == wxID_OK)
4993 return g_Platform->NormalizePath(sel_file);
4998void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4999 wxString sel_file = SelectSoundFile();
5001 if (!sel_file.IsEmpty()) {
5002 m_sound_file = g_Platform->NormalizePath(sel_file);
5003 if (m_pSoundFile) *m_pSoundFile = m_sound_file;
5005 SetSoundFileLabel(m_sound_file);
5010void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
5011 if (!m_soundPlaying) {
5012 m_sound->SetFinishedCallback(
5014 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
5015 m_soundPlaying =
true;
5021void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent& event) {
5022 if (event.IsChecked())
5023 m_pCheck_AlertAudio->SetValue(
true);
5025 if (!m_soundPanelSART->GetCheckBox()->GetValue() &&
5026 !m_soundPanelDSC->GetCheckBox()->GetValue())
5027 m_pCheck_AlertAudio->SetValue(
false);
5031void options::OnUXAudioEnableButtonClickSART(wxCommandEvent& event) {
5032 if (event.IsChecked())
5033 m_pCheck_AlertAudio->SetValue(
true);
5035 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5036 !m_soundPanelDSC->GetCheckBox()->GetValue())
5037 m_pCheck_AlertAudio->SetValue(
false);
5041void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent& event) {
5042 if (event.IsChecked())
5043 m_pCheck_AlertAudio->SetValue(
true);
5045 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5046 !m_soundPanelSART->GetCheckBox()->GetValue())
5047 m_pCheck_AlertAudio->SetValue(
false);
5051void options::CreatePanel_Sounds(
size_t parent,
int border_size,
5052 int group_item_spacing) {
5053 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
5055 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
5056 panelSounds->SetSizer(wrapperSizer);
5060 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize,
5061 _(
"Anchor Alarm"), _(
"Play Sound on Anchor Alarm."),
5062 _(
"Select Anchor Alarm Sound"), &g_anchorwatch_sound_file);
5063 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
5067 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"AIS Alert"),
5068 _(
"Play Sound on AIS Alert."), _(
"Select AIS Alert Sound"),
5070 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
5072 m_soundPanelAIS->GetCheckBox()->Connect(
5073 wxEVT_COMMAND_CHECKBOX_CLICKED,
5074 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
5079 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"SART Alert"),
5080 _(
"Play Sound on AIS SART Alert."), _(
"Select AIS SART Alert Sound"),
5081 &g_SART_sound_file);
5082 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
5084 m_soundPanelSART->GetCheckBox()->Connect(
5085 wxEVT_COMMAND_CHECKBOX_CLICKED,
5086 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
5091 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"DSC Alert"),
5092 _(
"Play Sound on DSC notification."), _(
"Select DSC notification Sound"),
5094 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
5096 m_soundPanelDSC->GetCheckBox()->Connect(
5097 wxEVT_COMMAND_CHECKBOX_CLICKED,
5098 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
5102 wxStaticBox* StatBoxSoundConfig =
5103 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
5104 wxStaticBoxSizer* StatBoxSoundConfigSizer =
5105 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
5106 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
5108 auto sound = std::unique_ptr<o_sound::Sound>(o_sound::Factory());
5109 int deviceCount = sound->DeviceCount();
5110 wxLogMessage(
"options: got device count: %d", deviceCount);
5111 if (deviceCount >= 1) {
5112 wxArrayString labels;
5113 for (
int i = 0; i < deviceCount; i += 1) {
5114 wxString label(sound->GetDeviceInfo(i));
5116 std::ostringstream stm;
5118 label = _(
"Unknown device :") + stm.str();
5120 if (!sound->IsOutputDevice(i)) {
5121 std::ostringstream stm;
5123 label = _(
"Input device :") + stm.str();
5130 int iDefault = labels.Index(
"default");
5132 if (g_iSoundDeviceIndex == -1) {
5134 g_iSoundDeviceIndex = iDefault;
5136 g_iSoundDeviceIndex = 0;
5139 pSoundDeviceIndex =
new wxChoice();
5140 if (pSoundDeviceIndex) {
5141 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
5142 wxDefaultSize, labels);
5143 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
5144 pSoundDeviceIndex->Show();
5145 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
5146 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
5147 group_item_spacing);
5149 stSoundDeviceIndex =
5150 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
5151 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
5152 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
5157 if ((
bool)
dynamic_cast<o_sound::SystemCmdSound*
>(o_sound::Factory())) {
5158 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
5159 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND,
5160 group_item_spacing);
5162 new wxTextCtrl(panelSounds, wxID_ANY,
"", wxDefaultPosition,
5163 wxSize(450, -1), wxTE_LEFT);
5165 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
5166 wxALIGN_LEFT | wxALL);
5167 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
5171 if (!deviceCount) StatBoxSoundConfig->Hide();
5174 stSoundDeviceIndex->Hide();
5175 pSoundDeviceIndex->Hide();
5179void options::CreatePanel_MMSI(
size_t parent,
int border_size,
5180 int group_item_spacing) {
5181 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
5183 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
5184 panelMMSI->SetSizer(MMSISizer);
5187 wxStaticBox* itemStaticBoxMMSI =
5188 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
5189 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
5190 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
5191 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
5195 pPropsPanel->UpdateMMSIList();
5197 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
5199 panelMMSI->Layout();
5202void options::CreatePanel_AIS(
size_t parent,
int border_size,
5203 int group_item_spacing) {
5204 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5206 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5207 panelAIS->SetSizer(aisSizer);
5210 wxStaticBox* itemStaticBoxCPA =
5211 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5212 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5213 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5214 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5216 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5217 pCPAGrid->AddGrowableCol(1);
5218 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5220 m_pCheck_CPA_Max =
new wxCheckBox(
5222 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5223 m_pCheck_CPA_Max->SetToolTip(
5224 _(
"Disable CPA (Closest Point of Approach) and TCPA (Time to CPA) alerts "
5225 "for targets beyond this distance from your vessel"));
5226 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5228 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5229 m_pText_CPA_Max->SetToolTip(
5230 _(
"Maximum distance in nautical miles at which Closest Point of Approach "
5231 "alerts will be triggered"));
5232 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5235 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5236 m_pCheck_CPA_Warn->SetToolTip(
5237 _(
"Enable warning alerts when targets have a Closest Point of Approach "
5238 "less than this distance"));
5239 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5242 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5243 m_pText_CPA_Warn->SetToolTip(
5244 _(
"Distance threshold in nautical miles for CPA warning alerts"));
5245 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5247 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5248 wxCommandEventHandler(options::OnCPAWarnClick),
5251 m_pCheck_CPA_WarnT =
5252 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5253 m_pCheck_CPA_WarnT->SetToolTip(
5254 _(
"Additional time constraint - alerts only occur if the Time to Closest "
5255 "Point of Approach is less than this value"));
5256 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5258 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5259 m_pText_CPA_WarnT->SetToolTip(
5260 _(
"Time threshold in minutes for TCPA constraints"));
5261 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5262 group_item_spacing);
5265 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5266 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5267 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5269 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5270 pLostGrid->AddGrowableCol(1);
5271 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5273 m_pCheck_Mark_Lost =
5274 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5275 m_pCheck_Mark_Lost->SetToolTip(
5276 _(
"Targets will be considered lost when no update is received for this "
5278 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5280 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5281 m_pText_Mark_Lost->SetToolTip(
5282 _(
"Time in minutes after which targets with no updates are marked as "
5284 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5285 group_item_spacing);
5287 m_pCheck_Remove_Lost =
5288 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5289 m_pCheck_Remove_Lost->SetToolTip(
5290 _(
"Lost targets will be completely removed from display after this "
5291 "additional time period"));
5292 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5294 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5295 m_pText_Remove_Lost->SetToolTip(_(
5296 "Time in minutes after which lost targets are removed from the display"));
5297 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5298 group_item_spacing);
5300 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5303 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5304 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5305 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5307 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5308 pDisplayGrid->AddGrowableCol(1);
5309 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5311 m_pCheck_Show_COG =
new wxCheckBox(
5312 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5313 m_pCheck_Show_COG->SetToolTip(
5314 _(
"Display a predictor arrow for each AIS target, showing its projected "
5315 "course over ground for the specified number of minutes."));
5316 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5318 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5319 m_pText_COG_Predictor->SetToolTip(
5320 _(
"Set the length in minutes for the COG predictor arrow for AIS "
5322 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5323 group_item_spacing);
5325 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5326 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5327 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5328 m_pCheck_Sync_OCOG_ACOG->Connect(
5329 wxEVT_COMMAND_CHECKBOX_CLICKED,
5330 wxCommandEventHandler(options::OnSyncCogPredClick), NULL,
this);
5332 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1,
"");
5333 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5335 m_pCheck_Show_Tracks =
5336 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5337 m_pCheck_Show_Tracks->SetToolTip(
5338 _(
"Display the recent track (history) of each AIS target for the "
5339 "specified number of minutes."));
5340 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5342 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5343 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5344 group_item_spacing);
5346 m_pCheck_Hide_Moored =
new wxCheckBox(
5347 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5348 m_pCheck_Hide_Moored->SetToolTip(
5349 _(
"Hide AIS targets that are moving slower than this speed, typically "
5350 "indicating they are anchored or moored."));
5351 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5353 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5354 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5355 group_item_spacing);
5357 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5358 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5359 m_pCheck_Draw_Realtime_Prediction->SetToolTip(
5360 _(
"Show a real-time prediction vector for AIS targets moving faster than "
5362 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5363 group_item_spacing);
5365 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5366 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5367 group_item_spacing);
5369 m_pCheck_Scale_Priority =
new wxCheckBox(
5371 _(
"Allow attenuation of less critical targets if more than ... targets"));
5372 m_pCheck_Scale_Priority->SetToolTip(
5373 _(
"Reduce the display prominence of less critical AIS targets when the "
5374 "number of targets exceeds the specified value."));
5375 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5377 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5378 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5379 group_item_spacing);
5381 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5382 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5383 m_pCheck_Show_Area_Notices->SetToolTip(
5384 _(
"Display area notices received via AIS binary messages on the chart."));
5385 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5387 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1,
"");
5388 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5390 m_pCheck_Draw_Target_Size =
5391 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5392 m_pCheck_Draw_Target_Size->SetToolTip(
5393 _(
"Display AIS targets using their actual reported size and shape on the "
5395 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5397 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1,
"");
5398 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5400 m_pCheck_Show_Target_Name =
new wxCheckBox(
5401 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5402 m_pCheck_Show_Target_Name->SetToolTip(
5403 _(
"Display the name of AIS targets when the chart scale is greater than "
5404 "the specified value."));
5405 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5407 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5408 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5409 group_item_spacing);
5411 m_pCheck_use_Wpl =
new wxCheckBox(
5412 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5413 m_pCheck_use_Wpl->SetToolTip(
5414 _(
"Enable processing of WPL (Waypoint Location) position messages from "
5415 "AIS and select the action to take when received."));
5416 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5418 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5419 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5420 wxDefaultSize, 2, Wpl_Action);
5421 m_pWplAction->SetToolTip(
5422 _(
"Select the action to perform when a WPL message is received: create "
5423 "an Automatic Packet Reporting System (APRS) report or a mark on the "
5425 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5428 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5429 wxStaticBoxSizer* rolloverSizer =
5430 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5431 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5433 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5434 _(
"Enable route/AIS info block"));
5435 pRollover->SetToolTip(
5436 _(
"Show a popup info block with details about routes and AIS targets "
5437 "when hovering over them."));
5438 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5440 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5441 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5445 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5446 pStatic_CallSign->SetToolTip(
5447 _(
"Display the ship name and MMSI (call sign) in the rollover info "
5449 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5451 m_pCheck_Rollover_Class =
5452 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5453 m_pCheck_Rollover_Class->SetToolTip(
5454 _(
"Show the AIS class, type, and status in the rollover info block."));
5455 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5457 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5458 m_pCheck_Rollover_COG->SetToolTip(
5459 _(
"Show speed over ground (SOG) and course over ground (COG) in the "
5460 "rollover info block."));
5461 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5463 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5464 m_pCheck_Rollover_CPA->SetToolTip(
5465 _(
"Show Closest Point of Approach (CPA) and time to CPA (TCPA) in the "
5466 "rollover info block."));
5467 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5470 wxStaticBox* alertBox =
5471 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5472 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5473 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5475 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5476 pAlertGrid->AddGrowableCol(1);
5477 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5479 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5480 _(
"Show CPA/TCPA Alert Dialog"));
5481 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5483 m_pCheck_AlertDialog->Connect(
5484 wxEVT_COMMAND_CHECKBOX_CLICKED,
5485 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5494 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1,
"");
5495 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5497 m_pCheck_AlertAudio =
new wxCheckBox(
5498 panelAIS, ID_AISALERTAUDIO,
5499 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5500 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5502 m_pCheck_AlertAudio->Connect(
5503 wxEVT_COMMAND_CHECKBOX_CLICKED,
5504 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5507 wxButton* m_pPlay_Sound =
5508 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"), wxDefaultPosition,
5509 m_small_button_size, 0);
5510 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5512 m_pPlay_Sound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
5513 wxCommandEventHandler(options::OnButtonTestSound),
5519 m_pCheck_Alert_Moored =
new wxCheckBox(
5520 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5521 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5523 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1,
"");
5524 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5526 m_pCheck_Ack_Timout =
new wxCheckBox(
5527 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5528 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5530 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5531 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5532 group_item_spacing);
5540 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5544 GetHandle()->setStyleSheet(getQtStyleSheet());
5549void options::CreatePanel_UI(
size_t parent,
int border_size,
5550 int group_item_spacing) {
5551 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5553 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5554 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5556 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5557 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5559 wxStaticBox* itemLangStaticBox =
5560 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5561 wxStaticBoxSizer* itemLangStaticBoxSizer =
5562 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5564 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5566 wxSize langChoiceSize = wxSize(-1, -1);
5569 langChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5572 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG,
5573 wxDefaultPosition, langChoiceSize);
5575 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5582 wxStaticBox* itemFontStaticBox =
5583 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5585 wxSize fontChoiceSize = wxSize(-1, -1);
5587 int fLayout = wxHORIZONTAL;
5590 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5593 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5596 wxStaticBoxSizer* itemFontStaticBoxSizer =
5597 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5598 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5601 m_itemFontElementListBox =
5602 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5603 fontChoiceSize, 0, NULL, wxCB_SORT);
5606 for (
size_t i = 0; i < uniqueStrings.GetCount(); i++) {
5607 m_itemFontElementListBox->Append(uniqueStrings[i]);
5610 if (uniqueStrings.GetCount()) m_itemFontElementListBox->SetSelection(0);
5612 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5614 wxButton* itemFontChooseButton =
5615 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5616 wxDefaultPosition, wxDefaultSize, 0);
5617 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5618#if defined(__WXGTK__) || defined(__WXQT__)
5619 wxButton* itemFontColorButton =
5620 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5621 wxDefaultPosition, wxDefaultSize, 0);
5622 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5624 wxButton* itemFontResetButton =
5625 new wxButton(itemPanelFont, ID_BUTTONFONT_RESET, _(
"Reset to Default"),
5626 wxDefaultPosition, wxDefaultSize, 0);
5627 itemFontStaticBoxSizer->Add(itemFontResetButton, 0, wxALL, border_size);
5629 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5630 wxDefaultPosition, wxDefaultSize, 0);
5631 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5636 wxStaticBox* itemStyleStaticBox =
5637 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5638 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5639 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5640 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5642 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5644 wxArrayPtrVoid styles = g_StyleManager->GetArrayOfStyles();
5645 for (
unsigned int i = 0; i < styles.Count(); i++) {
5647 m_itemStyleListBox->Append(style->name);
5649 m_itemStyleListBox->SetStringSelection(
5650 g_StyleManager->GetCurrentStyle()->name);
5651 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5654 wxStaticBox* miscOptionsBox =
5655 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5656 wxStaticBoxSizer* miscOptions =
5657 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5658 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5661 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5662 pShowStatusBar->SetValue(FALSE);
5663 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5666 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5667 pShowMenuBar->SetValue(FALSE);
5668 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5672 pShowMenuBar->Hide();
5675 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5676 pShowChartBar->SetValue(g_bShowChartBar);
5677 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5679 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5680 _(
"Show Compass/GPS Status Window"));
5681 pShowCompassWin->SetValue(FALSE);
5682 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5684 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5685 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5687 pToolbarAutoHideCB =
5688 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5689 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5691 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL,
"", wxDefaultPosition,
5692 wxSize(50, -1), wxTE_RIGHT);
5693 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5695 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5696 group_item_spacing);
5698 auto enable_debug_cb =
new wxCheckBox(itemPanelFont, wxID_ANY,
5699 _(
"Enable Debug in root context menu"));
5700 enable_debug_cb->Bind(wxEVT_CHECKBOX, [enable_debug_cb](wxCommandEvent&) {
5701 g_enable_root_menu_debug = enable_debug_cb->IsChecked();
5703 enable_debug_cb->SetValue(g_enable_root_menu_debug);
5704 miscOptions->Add(enable_debug_cb, 0, wxALL, border_size);
5708 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5709 miscOptions->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5712 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5713 _(
"Enable Touchscreen interface"));
5714 miscOptions->Add(pMobile, 0, wxALL, border_size);
5716 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5717 _(
"Enable Scaled Graphics interface"));
5718 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5723 pResponsive->Hide();
5727 pResponsive->Hide();
5730 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5731 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5733 pZoomButtons->Hide();
5737 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5738 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5740 wxButton* itemEcdisHelp =
5741 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5742 wxDefaultPosition, wxDefaultSize, 0);
5743 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5746 pInlandEcdis->Hide();
5747 itemEcdisHelp->Hide();
5750 miscOptions->AddSpacer(10);
5752 wxFlexGridSizer* sliderSizer;
5753 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5754 sliderSizer->AddGrowableCol(1);
5755 sliderSizer->SetFlexibleDirection(wxBOTH);
5756 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5758 m_pSlider_GUI_Factor =
5759 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5760 m_sliderSize, SLIDER_STYLE);
5761 m_pSlider_GUI_Factor->Hide();
5762 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5763 _(
"User Interface scale factor")),
5765 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5766 m_pSlider_GUI_Factor->Show();
5769 prepareSlider(m_pSlider_GUI_Factor);
5772 m_pSlider_Chart_Factor =
5773 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5774 m_sliderSize, SLIDER_STYLE);
5775 m_pSlider_Chart_Factor->Hide();
5777 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5779 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5780 m_pSlider_Chart_Factor->Show();
5783 prepareSlider(m_pSlider_Chart_Factor);
5786 m_pSlider_Ship_Factor =
5787 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5788 m_sliderSize, SLIDER_STYLE);
5789 m_pSlider_Ship_Factor->Hide();
5791 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5793 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5794 m_pSlider_Ship_Factor->Show();
5797 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5800 m_pSlider_Text_Factor =
5801 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5802 m_sliderSize, SLIDER_STYLE);
5803 m_pSlider_Text_Factor->Hide();
5805 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5807 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5808 m_pSlider_Text_Factor->Show();
5811 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5814 m_pSlider_ENCText_Factor =
5815 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5816 m_sliderSize, SLIDER_STYLE);
5817 m_pSlider_ENCText_Factor->Hide();
5819 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5821 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5822 m_pSlider_ENCText_Factor->Show();
5825 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5828 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5829 _(
"Mouse wheel zoom sensitivity")),
5831 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5832 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5834 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5835 miscOptions->AddSpacer(20);
5838void options::OnResetFont(wxCommandEvent& event) {
5839 wxString itemElement;
5840 int i = m_itemFontElementListBox->GetSelection();
5842 itemElement = m_itemFontElementListBox->GetString(i);
5844 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5846 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5847 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5850 m_textSample->SetFont(*pFont);
5851 m_textSample->SetForegroundColour(colour);
5852 m_textSample->Refresh();
5855 top_frame::Get()->UpdateAllFonts();
5856 m_bfontChanged =
true;
5857 OnFontChoice(event);
5862void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5863 m_pCheck_AlertAudio->Enable(event.IsChecked());
5864 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5867void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5868 if (event.IsChecked()) {
5869 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5870 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5871 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5875void options::CreateListbookIcons() {
5878 if (!g_bresponsive) {
5881 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5883#if wxCHECK_VERSION(2, 8, 12)
5884 m_topImgList->Add(style->GetIcon(
"Display", sx, sy));
5885 m_topImgList->Add(style->GetIcon(
"Charts", sx, sy));
5886 m_topImgList->Add(style->GetIcon(
"Connections", sx, sy));
5887 m_topImgList->Add(style->GetIcon(
"Ship", sx, sy));
5888 m_topImgList->Add(style->GetIcon(
"UI", sx, sy));
5889 m_topImgList->Add(style->GetIcon(
"Plugins", sx, sy));
5893 bmp = style->GetIcon(
"Display");
5894 img = bmp.ConvertToImage();
5895 img.ConvertAlphaToMask(128);
5896 bmp = wxBitmap(img);
5897 m_topImgList->Add(bmp);
5898 bmp = style->GetIcon(
"Charts");
5899 img = bmp.ConvertToImage();
5900 img.ConvertAlphaToMask(128);
5901 bmp = wxBitmap(img);
5902 m_topImgList->Add(bmp);
5903 bmp = style->GetIcon(
"Connections");
5904 img = bmp.ConvertToImage();
5905 img.ConvertAlphaToMask(128);
5906 bmp = wxBitmap(img);
5907 m_topImgList->Add(bmp);
5908 bmp = style->GetIcon(
"Ship");
5909 img = bmp.ConvertToImage();
5910 img.ConvertAlphaToMask(128);
5911 bmp = wxBitmap(img);
5912 m_topImgList->Add(bmp);
5913 bmp = style->GetIcon(
"UI");
5914 img = bmp.ConvertToImage();
5915 img.ConvertAlphaToMask(128);
5916 bmp = wxBitmap(img);
5917 m_topImgList->Add(bmp);
5918 bmp = style->GetIcon(
"Plugins");
5919 img = bmp.ConvertToImage();
5920 img.ConvertAlphaToMask(128);
5921 bmp = wxBitmap(img);
5922 m_topImgList->Add(bmp);
5926 bmps = style->GetIcon(
"Display");
5927 int base_size = bmps.GetWidth();
5928 double tool_size = base_size;
5930 double premult = 1.0;
5934 double target_size = 6.0;
5936 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5937 premult = target_size / basic_tool_size_mm;
5940 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5941 postmult = wxMin(postmult, 3.0);
5942 postmult = wxMax(postmult, 1.0);
5944 int sizeTab = base_size * postmult * premult;
5946 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5950 bmp = style->GetIcon(
"Display");
5951 img = bmp.ConvertToImage();
5952 simg = img.Scale(sizeTab, sizeTab);
5953 bmp = wxBitmap(simg);
5954 m_topImgList->Add(bmp);
5955 bmp = style->GetIcon(
"Charts");
5956 img = bmp.ConvertToImage();
5957 simg = img.Scale(sizeTab, sizeTab);
5958 bmp = wxBitmap(simg);
5959 m_topImgList->Add(bmp);
5960 bmp = style->GetIcon(
"Connections");
5961 img = bmp.ConvertToImage();
5962 simg = img.Scale(sizeTab, sizeTab);
5963 bmp = wxBitmap(simg);
5964 m_topImgList->Add(bmp);
5965 bmp = style->GetIcon(
"Ship");
5966 img = bmp.ConvertToImage();
5967 simg = img.Scale(sizeTab, sizeTab);
5968 bmp = wxBitmap(simg);
5969 m_topImgList->Add(bmp);
5970 bmp = style->GetIcon(
"UI");
5971 img = bmp.ConvertToImage();
5972 simg = img.Scale(sizeTab, sizeTab);
5973 bmp = wxBitmap(simg);
5974 m_topImgList->Add(bmp);
5975 bmp = style->GetIcon(
"Plugins");
5976 img = bmp.ConvertToImage();
5977 simg = img.Scale(sizeTab, sizeTab);
5978 bmp = wxBitmap(simg);
5979 m_topImgList->Add(bmp);
5983void options::CreateControls() {
5984 int border_size = 4;
5986 int group_item_spacing = 2;
5988 int font_size_y, font_descent, font_lead;
5989 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
5990 m_fontHeight = font_size_y + font_descent + font_lead;
5994 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5995 m_fontHeight * 8 / 10);
5998 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
6002 m_small_button_size =
6003 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
6005 m_nCharWidthMax = GetSize().x / GetCharWidth();
6008 pEnableZoomToCursor = NULL;
6009 pSmoothPanZoom = NULL;
6017 if (!g_bresponsive && height <= 800) {
6019 group_item_spacing = 1;
6023 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
6024 inputFlags = wxSizerFlags(0)
6025 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
6026 .Border(wxALL, group_item_spacing);
6027 verticleInputFlags =
6028 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
6029 groupLabelFlags = wxSizerFlags(0)
6030 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
6031 .Border(wxALL, group_item_spacing);
6032 groupLabelFlagsHoriz =
6033 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
6034 groupInputFlags = wxSizerFlags(0)
6035 .Align(wxALIGN_LEFT | wxALIGN_TOP)
6036 .Border(wxBOTTOM, group_item_spacing * 2)
6040 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
6045 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
6046 itemDialog1->SetSizer(itemBoxSizer2);
6050 wxFont* qFont = dialogFont;
6052 wxString wqs = getFontQtStylesheet(qFont);
6053 wxCharBuffer sbuf = wqs.ToUTF8();
6054 QString qsb = QString(sbuf.data());
6056 QString qsbq = getQtStyleSheet();
6058 itemDialog1->GetHandle()->setStyleSheet(qsb +
6065#ifdef OCPN_OPTIONS_USE_LISTBOOK
6067 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6068 wxSize(-1, -1), flags);
6069 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
6070 wxListbookEventHandler(options::OnPageChange), NULL,
6074 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6075 wxSize(-1, -1), flags);
6076 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6077 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
6084 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
6088 CreateListbookIcons();
6090 m_pListbook->SetImageList(m_topImgList);
6091 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
6093 m_OK_Cancel_Apply_buttons =
new wxBoxSizer(wxHORIZONTAL);
6094 itemBoxSizer2->Add(m_OK_Cancel_Apply_buttons, 0, wxALIGN_RIGHT | wxALL,
6097 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
6098 m_OKButton->SetDefault();
6099 m_OK_Cancel_Apply_buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
6102 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
6103 m_OK_Cancel_Apply_buttons->Add(m_CancelButton, 0,
6104 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6106 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
6107 m_OK_Cancel_Apply_buttons->Add(m_ApplyButton, 0,
6108 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6110 m_pageDisplay = CreatePanel(_(
"Display"));
6111 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
6112 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
6113 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
6114 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
6116 m_pageCharts = CreatePanel(_(
"Charts"));
6117 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
6118 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
6121 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
6122 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
6125 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
6127#ifdef OCPN_OPTIONS_USE_LISTBOOK
6128 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6129 wxListbookEventHandler(options::OnChartsPageChange), NULL,
6132 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6133 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
6139 wxString ConnTab = _(
"Connections");
6141 ConnTab = _(
"Connect");
6143 m_pageConnections = CreatePanel(ConnTab);
6144 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6148 m_pageShips = CreatePanel(_(
"Ships"));
6149 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
6150 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
6151 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
6153 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
6155 wxString UITab = _(
"User Interface");
6159 m_pageUI = CreatePanel(UITab);
6160 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
6161 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
6163 m_pagePlugins = CreatePanel(_(
"Plugins"));
6164 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
6166 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
6167 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
6172 SetColorScheme(
static_cast<ColorScheme
>(0));
6183 SetSizeHints(-1, -1, width - marginx, height - marginy);
6192void options::SetInitialPage(
int page_sel,
int sub_page) {
6193 if (page_sel < (
int)m_pListbook->GetPageCount())
6194 m_pListbook->SetSelection(page_sel);
6196 m_pListbook->SetSelection(0);
6198 if (sub_page >= 0) {
6199 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
6200 wxNotebookPage* pg = m_pListbook->GetPage(i);
6201 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
6203 if (i == (
size_t)page_sel) {
6204 if (sub_page < (
int)nb->GetPageCount())
6205 nb->SetSelection(sub_page);
6207 nb->SetSelection(0);
6209 nb->ChangeSelection(0);
6215void options::SetColorScheme(ColorScheme cs) {
6218#ifdef OCPN_OPTIONS_USE_LISTBOOK
6219 wxListView* lv = m_pListbook->GetListView();
6220 lv->SetBackgroundColour(GetBackgroundColour());
6223 delete m_topImgList;
6224 CreateListbookIcons();
6225 m_pListbook->SetImageList(m_topImgList);
6233 comm_dialog->SetColorScheme(cs);
6236void options::OnAISRolloverClick(wxCommandEvent& event) {
6237 m_pCheck_Rollover_Class->Enable(event.IsChecked());
6238 m_pCheck_Rollover_COG->Enable(event.IsChecked());
6239 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
6240 pStatic_CallSign->Enable(event.IsChecked());
6243void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
6245 case ID_SCREENCONFIG1:
6246 if (m_sconfigSelect_twovertical)
6247 m_sconfigSelect_twovertical->SetSelected(
false);
6251 case ID_SCREENCONFIG2:
6252 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6258void options::SetInitialSettings() {
6261 m_returnChanges = 0;
6262 m_bfontChanged =
false;
6263 m_font_element_array.Clear();
6265 b_oldhaveWMM = b_haveWMM;
6266 auto loader = PluginLoader::GetInstance();
6267 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
6270 switch (g_canvasConfig) {
6273 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
6274 if (m_sconfigSelect_twovertical)
6275 m_sconfigSelect_twovertical->SetSelected(
false);
6278 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6279 if (m_sconfigSelect_twovertical)
6280 m_sconfigSelect_twovertical->SetSelected(
true);
6283 m_screenConfig = g_canvasConfig;
6287 ActiveChartArray.Clear();
6288 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6289 ActiveChartArray.Add(m_CurrentDirList[i]);
6293 if (m_pWorkDirList) {
6294 UpdateWorkArrayFromDisplayPanel();
6295 groupsPanel->SetDBDirs(*m_pWorkDirList);
6298 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6299 delete m_pGroupArray;
6300 m_pGroupArray = groupsPanel->CloneChartGroupArray(
g_pGroupArray);
6301 groupsPanel->SetGroupArray(m_pGroupArray);
6302 groupsPanel->SetInitialSettings();
6306 pShowStatusBar->SetValue(g_bShowStatusBar);
6308 pShowMenuBar->SetValue(g_bShowMenuBar);
6310 pShowCompassWin->SetValue(g_bShowCompassWin);
6314 pCOGUPUpdateSecs->SetValue(s);
6316 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6317 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6319 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6320 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6321 pMobile->SetValue(g_btouch);
6322 pResponsive->SetValue(g_bresponsive);
6329 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6333 pInlandEcdis->SetValue(g_bInlandEcdis);
6335 pOpenGL->SetValue(g_bopengl);
6336 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6337 w->Enable(pOpenGL->IsChecked());
6340 pCBTrueShow->SetValue(g_bShowTrue);
6341 pCBMagShow->SetValue(g_bShowMag);
6343 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6347 itemStaticTextUserVar->SetLabel(
6348 _(
"WMM Plugin calculated magnetic variation"));
6350 s.Printf(
"%4.1f",
gVar);
6351 pMagVar->SetValue(s);
6353 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6355 s.Printf(
"%4.1f", g_UserVar);
6356 pMagVar->SetValue(s);
6359 int newLength = itemStaticTextUserVar->GetLabel().Length();
6362 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6363 wxSize sz = GetSize();
6364 SetSize(sz.x + 1, sz.y);
6368 itemStaticTextUserVar2->Enable(!b_haveWMM);
6369 pMagVar->Enable(!b_haveWMM);
6376 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6380 wxString stringDefaultBoatSpeed;
6381 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6382 g_defaultBoatSpeed = 6.0;
6383 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6385 stringDefaultBoatSpeed.Printf(
"%d", (
int)g_defaultBoatSpeedUserUnit);
6386 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6390 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6391 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6392 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6394 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6396 s.Printf(
"%6.2f", g_ownship_predictor_minutes);
6398 s.Printf(
"%4.0f", g_ownship_predictor_minutes);
6399 m_pText_OSCOG_Predictor->SetValue(s);
6401 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6402 g_ownship_HDTpredictor_miles) > 1e-4)
6403 s.Printf(
"%6.2f", g_ownship_HDTpredictor_miles);
6405 s.Printf(
"%4.0f", g_ownship_HDTpredictor_miles);
6406 m_pText_OSHDT_Predictor->SetValue(s);
6410 m_pTxt_OwnMMSI->SetValue(s);
6412 m_pTxt_OwnMMSI->SetValue(
"");
6414 m_pShipIconType->SetSelection(g_OwnShipIconType);
6415 wxCommandEvent eDummy;
6416 OnShipTypeSelect(eDummy);
6417 m_pOSLength->SetValue(wxString::Format(
"%.1f", g_n_ownship_length_meters));
6418 m_pOSWidth->SetValue(wxString::Format(
"%.1f", g_n_ownship_beam_meters));
6419 m_pOSGPSOffsetX->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_x));
6420 m_pOSGPSOffsetY->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_y));
6421 m_pOSMinSize->SetValue(wxString::Format(
"%d", g_n_ownship_min_mm));
6422 m_pText_ACRadius->SetValue(
6423 wxString::Format(
"%.3f", g_n_arrival_circle_radius));
6426 if (g_iNavAidRadarRingsNumberVisible > 10)
6427 g_iNavAidRadarRingsNumberVisible = 10;
6428 pNavAidRadarRingsNumberVisible->SetSelection(
6429 g_iNavAidRadarRingsNumberVisible);
6430 buf.Printf(
"%.3f", g_fNavAidRadarRingsStep);
6431 pNavAidRadarRingsStep->SetValue(buf);
6432 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6433 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6435 pScaMinChckB->SetValue(g_bUseWptScaMin);
6436 m_pText_ScaMin->SetValue(wxString::Format(
"%i", g_iWpt_ScaMin));
6437 m_pText_ScaMax->SetValue(wxString::Format(
"%i", g_iWpt_ScaMax));
6438 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6440 OnRadarringSelect(eDummy);
6442 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6443 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6444 buf.Printf(
"%.3f", g_fWaypointRangeRingsStep);
6445 pWaypointRangeRingsStep->SetValue(buf);
6446 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6448 OnWaypointRangeRingSelect(eDummy);
6449 pShowshipToActive->SetValue(g_bShowShipToActive);
6450 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6451 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6453 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6454 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6456 pSogCogFromLLCheckBox->SetValue(g_own_ship_sog_cog_calc);
6457 pSogCogFromLLDampInterval->SetValue(g_own_ship_sog_cog_calc_damp_sec);
6459 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6460 if (pEnableTenHertz) pEnableTenHertz->SetValue(g_btenhertz);
6462 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6463 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6465 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6467 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6470 pSDMMFormat->Select(g_iSDMMFormat);
6474 pDistanceFormat->SetSelection(distance_ui_index);
6477 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6479 if (pHeightUnitSelect) pHeightUnitSelect->SetSelection(
g_iHeightFormat);
6481 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6482 g_bAdvanceRouteWaypointOnArrivalOnly);
6493 pTrackDaily->SetValue(g_bTrackDaily);
6494 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6495 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6496 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6497 TIME_TYPE_COMPUTER);
6498 pTrackHighlite->SetValue(g_bHighliteTracks);
6499 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6500 pTrackPrecision->SetSelection(g_nTrackPrecision);
6502 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6506 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6508 s.Printf(
"%4.1f", g_CPAMax_NM);
6509 m_pText_CPA_Max->SetValue(s);
6511 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6513 s.Printf(
"%4.1f", g_CPAWarn_NM);
6514 m_pText_CPA_Warn->SetValue(s);
6516 if (m_pCheck_CPA_Warn->GetValue()) {
6517 m_pCheck_CPA_WarnT->Enable();
6518 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6520 m_pCheck_CPA_WarnT->Disable();
6522 s.Printf(
"%4.0f", g_TCPA_Max);
6523 m_pText_CPA_WarnT->SetValue(s);
6526 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6528 s.Printf(
"%4.0f", g_MarkLost_Mins);
6529 m_pText_Mark_Lost->SetValue(s);
6531 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6533 s.Printf(
"%4.0f", g_RemoveLost_Mins);
6534 m_pText_Remove_Lost->SetValue(s);
6537 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6539 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6540 m_pText_COG_Predictor->SetValue(s);
6542 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6543 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6545 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6547 s.Printf(
"%4.0f", g_AISShowTracks_Mins);
6548 m_pText_Track_Length->SetValue(s);
6550 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6552 s.Printf(
"%4.1f", g_ShowMoored_Kts);
6553 m_pText_Moored_Speed->SetValue(s);
6555 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6557 s.Printf(
"%4.1f", g_AIS_RealtPred_Kts);
6558 m_pText_RealtPred_Speed->SetValue(s);
6560 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6562 s.Printf(
"%i", g_ShowScaled_Num);
6563 m_pText_Scale_Priority->SetValue(s);
6565 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6567 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6568 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6570 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6572 s.Printf(
"%d", g_Show_Target_Name_Scale);
6573 m_pText_Show_Target_Name_Scale->SetValue(s);
6575 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6576 m_pWplAction->SetSelection(g_WplAction);
6579 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6580 if (g_bAIS_CPA_Alert) {
6581 m_pCheck_AlertAudio->Enable();
6582 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6584 m_pCheck_AlertAudio->Disable();
6585 m_pCheck_AlertAudio->SetValue(
false);
6588 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6590 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6591 s.Printf(
"%4.0f", g_AckTimeout_Mins);
6592 m_pText_ACK_Timeout->SetValue(s);
6595 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6596 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6597 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6600 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6601 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6602 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6604 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6605 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6607 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6608 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6609 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6610 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6611 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6612 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6614 if (!g_config_display_size_manual) {
6615 pRBSizeAuto->SetValue(TRUE);
6617 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6619 screenmm.RemoveLast();
6620 pScreenMM->Disable();
6623 screenmm.Append(wxString::Format(
"%zu,", mm));
6625 screenmm.RemoveLast();
6626 pRBSizeManual->SetValue(TRUE);
6629 pScreenMM->SetValue(screenmm);
6632 UpdateOptionsUnits();
6634 SetInitialVectorSettings();
6636 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6638 s.Printf(
"%d", g_nAutoHideToolbar);
6639 pToolbarHideSecs->SetValue(s);
6643 delete m_pSerialArray;
6644 m_pSerialArray = NULL;
6646 m_bForceNewToolbaronCancel =
false;
6649void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6650 if (ps57CtlListBox) {
6652 ps57CtlListBox->Clear();
6653 marinersStdXref.clear();
6655 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6657 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6660 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6661 item = ps52plib->OBJLDescriptions[iPtr];
6663 item = wxString(pOLE->OBJLName, wxConvUTF8);
6669 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6670 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6671 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6673 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6674 (catl == DISPLAYBASE))
6676 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6679 bool benable =
true;
6680 if (cat > 0) benable = cat != DISPLAYBASE;
6685 int newpos = ps57CtlListBox->Append(item, benable,
false);
6686 marinersStdXref.push_back(newpos);
6687 for (
size_t i = 0; i < iPtr; i++) {
6688 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6692 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6694 if (cat == DISPLAYBASE) bviz =
true;
6697 if (cat == STANDARD) {
6702 ps57CtlListBox->Check(newpos, bviz);
6706 ps57CtlListBox->RunLayout();
6709 wxSize s = ps57CtlListBox->GetSize();
6710 ps57CtlListBox->SetSize(s.x, s.y - 1);
6714void options::SetInitialVectorSettings() {
6715 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6719 m_bVectorInit =
true;
6720 resetMarStdList(
true,
false);
6723 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6727 switch (ps52plib->GetDisplayCategory()) {
6737 case (MARINERS_STANDARD):
6745 if (pDispCat) pDispCat->SetSelection(nset);
6749 bool benableMarStd =
false;
6751 for (
unsigned int i = 0; i <
g_canvasArray.GetCount(); i++) {
6754 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6755 benableMarStd =
true;
6764 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6765 itemButtonClearList->Enable(benableMarStd);
6766 itemButtonSelectList->Enable(benableMarStd);
6767 itemButtonSetStd->Enable(benableMarStd);
6770 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6771 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6772 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6773 if (pCheck_XLSECTTEXT)
6774 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6776 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6777 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6778 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6779 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6781 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6782 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6785 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6786 pPointStyle->SetSelection(0);
6788 pPointStyle->SetSelection(1);
6790 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6791 pBoundStyle->SetSelection(0);
6793 pBoundStyle->SetSelection(1);
6795 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6796 p24Color->SetSelection(0);
6798 p24Color->SetSelection(1);
6800 UpdateOptionsUnits();
6804void options::UpdateOptionsUnits() {
6805 int depthUnit = pDepthUnitSelect->GetSelection();
6807 depthUnit = wxMax(depthUnit, 0);
6808 depthUnit = wxMin(depthUnit, 2);
6814 else if (depthUnit == 2)
6820 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6821 wxString depthUnitString = depthUnitStrings[depthUnit];
6822 m_depthUnitsShal->SetLabel(depthUnitString);
6823 m_depthUnitsSafe->SetLabel(depthUnitString);
6824 m_depthUnitsDeep->SetLabel(depthUnitString);
6827 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6829 m_ShallowCtl->SetValue(s);
6831 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6833 m_SafetyCtl->SetValue(s);
6835 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6837 m_DeepCtl->SetValue(s);
6867void options::OnSizeAutoButton(wxCommandEvent& event) {
6870 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6872 screenmm.RemoveLast();
6873 pScreenMM->SetValue(screenmm);
6874 pScreenMM->Disable();
6875 g_config_display_size_manual = FALSE;
6878void options::OnSizeManualButton(wxCommandEvent& event) {
6882 screenmm.Append(wxString::Format(
"%zu,", mm));
6886 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6889 screenmm.RemoveLast();
6890 pScreenMM->SetValue(screenmm);
6891 pScreenMM->Enable();
6892 g_config_display_size_manual = TRUE;
6895void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6897void options::OnCPAWarnClick(wxCommandEvent& event) {
6898 if (m_pCheck_CPA_Warn->GetValue()) {
6899 m_pCheck_CPA_WarnT->Enable();
6901 m_pCheck_CPA_WarnT->SetValue(FALSE);
6902 m_pCheck_CPA_WarnT->Disable();
6906void options::OnSyncCogPredClick(wxCommandEvent& event) {
6907 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6908 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6909 m_pText_COG_Predictor->Disable();
6912 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6913 m_pText_COG_Predictor->SetValue(s);
6914 m_pText_COG_Predictor->Enable();
6918void options::OnShipTypeSelect(wxCommandEvent& event) {
6919 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6920 dispOptions->Layout();
6922 itemPanelShip->Layout();
6923 itemPanelShip->Refresh();
6927void options::OnRadarringSelect(wxCommandEvent& event) {
6928 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6929 dispOptions->Layout();
6931 itemPanelShip->Layout();
6932 itemPanelShip->Refresh();
6936void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6937 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6938 dispOptions->Layout();
6940 itemPanelRoutes->Layout();
6941 itemPanelRoutes->Refresh();
6945void options::OnGLClicked(wxCommandEvent& event) {
6948 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6949 w->Enable(pOpenGL->IsChecked());
6952void options::OnOpenGLOptions(wxCommandEvent& event) {
6954 OpenGLOptionsDlg dlg(
this);
6956 if (dlg.ShowModal() == wxID_OK) {
6957 if (top_frame::Get()->GetWxGlCanvas()) {
6958 g_GLOptions.m_bUseAcceleratedPanning =
6959 g_bGLexpert ? dlg.GetAcceleratedPanning()
6961 ->GetAbstractPrimaryCanvas()
6962 ->CanAccelerateGlPanning();
6965 g_bSoftwareGL = dlg.GetSoftwareGL();
6967 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6968 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6972 g_GLOptions.m_bTextureCompressionCaching =
6973 dlg.GetTextureCompressionCaching();
6974 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6977 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6981 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6983 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6985 if (top_frame::Get()->GetWxGlCanvas()) {
6986 ::wxBeginBusyCursor();
6987 top_frame::Get()->GetAbstractPrimaryCanvas()->SetupGlCompression();
6989 ::wxEndBusyCursor();
6992 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6995 if (dlg.GetRebuildCache()) {
6996 m_returnChanges = REBUILD_RASTER_CACHE;
7002void options::OnChartDirListSelect(wxCommandEvent& event) {
7004 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
7005 m_removeBtn->Enable(selected);
7006 if (m_compressBtn) m_compressBtn->Enable(selected);
7010void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
7013 const bool select = pDispCat->GetSelection() == 3;
7014 ps57CtlListBox->Enable(select);
7015 itemButtonClearList->Enable(select);
7016 itemButtonSelectList->Enable(select);
7017 itemButtonSetStd->Enable(select);
7023void options::OnButtonClearClick(wxCommandEvent& event) {
7024 resetMarStdList(
false,
false);
7033void options::OnButtonSelectClick(wxCommandEvent& event) {
7034 int nOBJL = ps57CtlListBox->GetCount();
7035 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
7040void options::OnButtonSetStd(wxCommandEvent& event) {
7041 resetMarStdList(
false,
true);
7046bool options::ShowToolTips() {
return TRUE; }
7048void options::OnCharHook(wxKeyEvent& event) {
7049 if (event.GetKeyCode() == WXK_RETURN &&
7050 event.GetModifiers() == wxMOD_CONTROL) {
7051 wxCommandEvent okEvent;
7052 okEvent.SetId(xID_OK);
7053 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
7054 GetEventHandler()->AddPendingEvent(okEvent);
7059void options::OnButtonaddClick(wxCommandEvent& event) {
7061 int dresult = g_Platform->DoDirSelectorDialog(
7062 this, &selDir, _(
"Add a directory containing chart files"),
7063 *pInit_Chart_Dir,
false);
7065 if (dresult != wxID_CANCEL) AddChartDir(selDir);
7070void options::AddChartDir(
const wxString& dir) {
7071 wxFileName dirname = wxFileName(dir);
7072 pInit_Chart_Dir->Empty();
7077 f.MakeRelativeTo(g_Platform->GetHomeDir());
7078 dirAdd = f.GetFullPath();
7080 pInit_Chart_Dir->Append(dirname.GetPath());
7085 cdi.fullpath = dirAdd;
7086 ActiveChartArray.Add(cdi);
7088 UpdateChartDirList();
7090 k_charts |= CHANGE_CHARTS;
7092 pScanCheckBox->Disable();
7095void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
7098 ActiveChartArray.Clear();
7099 for (
size_t i = 0; i < p.GetCount(); i++) {
7100 ActiveChartArray.Add(p[i]);
7103 UpdateChartDirList();
7106void options::UpdateWorkArrayFromDisplayPanel() {
7108 int n = ActiveChartArray.GetCount();
7109 if (m_pWorkDirList) {
7110 m_pWorkDirList->Clear();
7111 for (
int i = 0; i < n; i++) {
7112 dirname = ActiveChartArray[i].fullpath;
7113 if (!dirname.IsEmpty()) {
7116 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7117 (dirname.Last() == wxChar(_T(
'\r'))))
7118 dirname.RemoveLast();
7124 bool b_added = FALSE;
7127 int nDir = m_CurrentDirList.GetCount();
7129 for (
int i = 0; i < nDir; i++) {
7130 if (m_CurrentDirList[i].fullpath == dirname) {
7132 m_pWorkDirList->Add(cdi);
7140 cdin.fullpath = dirname;
7141 m_pWorkDirList->Add(cdin);
7148void options::OnApplyClick(wxCommandEvent& event) {
7149 ApplyChanges(event);
7154 if ((m_returnChanges & FONT_CHANGED) ||
7155 (m_returnChanges & NEED_NEW_OPTIONS)) {
7156 m_callbacks.prepare_close(
this, m_returnChanges);
7157 if (!(m_returnChanges & FONT_CHANGED_SAFE))
7158 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
true);
7162 if ((m_returnChanges & CONFIG_CHANGED)) {
7163 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
false);
7168void options::ApplyChanges(wxCommandEvent& event) {
7174 if (m_pShipIconType->GetSelection() > 0) {
7175 double n_ownship_length_meters;
7176 double n_ownship_beam_meters;
7177 double n_gps_antenna_offset_y;
7178 double n_gps_antenna_offset_x;
7179 long n_ownship_min_mm;
7180 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
7181 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
7182 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
7183 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
7184 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
7186 if (n_ownship_length_meters <= 0)
7187 msg += _(
"\n - your ship's length must be > 0");
7188 if (n_ownship_beam_meters <= 0)
7189 msg += _(
"\n - your ship's beam must be > 0");
7190 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
7192 "\n - your GPS offset from midship must be within your ship's beam");
7193 if (n_gps_antenna_offset_y < 0 ||
7194 n_gps_antenna_offset_y > n_ownship_length_meters)
7196 _(
"\n - your GPS offset from bow must be within your ship's length");
7197 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
7198 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
7199 if (!msg.IsEmpty()) {
7200 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
7201 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
7202 ::wxEndBusyCursor();
7203 event.SetInt(wxID_STOP);
7206 g_n_ownship_length_meters = n_ownship_length_meters;
7207 g_n_ownship_beam_meters = n_ownship_beam_meters;
7208 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
7209 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
7210 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
7212 g_OwnShipIconType = m_pShipIconType->GetSelection();
7213 g_bShowShipToActive = pShowshipToActive->GetValue();
7214 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
7215 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
7217 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
7218 g_n_arrival_circle_radius =
7219 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
7221 wxString* icon_name =
7222 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
7223 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
7226 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
7227 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
7229 g_bUseWptScaMin = pScaMinChckB->GetValue();
7230 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
7231 g_iWpt_ScaMax = wxAtoi(m_pText_ScaMax->GetValue());
7232 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
7235 if (m_bfontChanged) {
7237 if (top_frame::Get()->GetWxGlCanvas()) {
7238 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7241 if (top_frame::Get()->GetAbstractPrimaryCanvas()) {
7242 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7245 m_returnChanges |= FONT_CHANGED;
7249 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
7250 m_returnChanges |= FONT_CHANGED_SAFE;
7254 UpdateWorkArrayFromDisplayPanel();
7256 groupsPanel->SetDBDirs(*m_pWorkDirList);
7257 groupsPanel->m_treespopulated = FALSE;
7259 int k_force = FORCE_UPDATE;
7260 if (pUpdateCheckBox) {
7261 if (!pUpdateCheckBox->GetValue()) k_force = 0;
7262 pUpdateCheckBox->Enable();
7263 pUpdateCheckBox->SetValue(FALSE);
7268 m_returnChanges |= k_force;
7270 int k_scan = SCAN_UPDATE;
7271 if (pScanCheckBox) {
7272 if (!pScanCheckBox->GetValue()) k_scan = 0;
7273 pScanCheckBox->Enable();
7274 pScanCheckBox->SetValue(FALSE);
7279 m_returnChanges |= k_scan;
7281 pConfig->UpdateChartDirs(*m_pWorkDirList);
7285 if (groupsPanel->modified) {
7288 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
7289 m_returnChanges |= GROUPS_CHANGED;
7294 g_bShowStatusBar = pShowStatusBar->GetValue();
7296 g_bShowMenuBar = pShowMenuBar->GetValue();
7298 g_bShowCompassWin = pShowCompassWin->GetValue();
7301 g_bShowChartBar = pShowChartBar->GetValue();
7303 wxString screenmm = pScreenMM->GetValue();
7304 wxStringTokenizer tkz(screenmm,
",");
7306 while (tkz.HasMoreTokens()) {
7307 wxString token = tkz.GetNextToken();
7309 if (token.ToLong(&mm) && mm > 0) {
7315 g_config_display_size_manual = pRBSizeManual->GetValue();
7318 comm_dialog->ApplySettings();
7320 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7324 bool temp_bquilting = pCDOQuilting->GetValue();
7327 g_bQuiltEnable = temp_bquilting;
7331 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7332 g_bskew_comp = pSkewComp->GetValue();
7333 g_btouch = pMobile->GetValue();
7334 g_bresponsive = pResponsive->GetValue();
7336 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7338 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7341 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7342 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7343 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7357 long update_val = 1;
7358 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7359 g_COGAvgSec = wxMin(
static_cast<int>(update_val), kMaxCogAverageSeconds);
7363 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7365 g_bShowTrue = pCBTrueShow->GetValue();
7366 g_bShowMag = pCBMagShow->GetValue();
7368 auto loader = PluginLoader::GetInstance();
7369 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
7370 if (!b_haveWMM && !b_oldhaveWMM) {
7371 pMagVar->GetValue().ToDouble(&g_UserVar);
7376 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7377 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7380 g_iNavAidRadarRingsNumberVisible =
7381 pNavAidRadarRingsNumberVisible->GetSelection();
7382 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7383 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7384 g_fNavAidRadarRingsStep = temp_dbl;
7385 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7386 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7387 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7388 g_fWaypointRangeRingsStep = temp_dbl;
7389 g_iWaypointRangeRingsStepUnits =
7390 m_itemWaypointRangeRingsUnits->GetSelection();
7392 m_colourWaypointRangeRingsColour->GetColour();
7397 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7398 g_own_ship_sog_cog_calc = pSogCogFromLLCheckBox->GetValue();
7399 g_own_ship_sog_cog_calc_damp_sec = pSogCogFromLLDampInterval->GetValue();
7401 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7403 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7405 if (pCmdSoundString) {
7406 g_CmdSoundString = pCmdSoundString->GetValue();
7407 if (wxIsEmpty(g_CmdSoundString)) {
7408 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7409 pCmdSoundString->SetValue(g_CmdSoundString);
7413 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7414 if (pSoundDeviceIndex)
7415 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7417 g_iSDMMFormat = pSDMMFormat->GetSelection();
7420 int sel = pDistanceFormat->GetSelection();
7424 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7426 if (pHeightUnitSelect)
g_iHeightFormat = pHeightUnitSelect->GetSelection();
7429 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7430 if (pSDefaultBoatSpeed)
7431 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7432 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7433 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7434 getUsrSpeedUnit() +
")");
7436 g_bAdvanceRouteWaypointOnArrivalOnly =
7437 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7439 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7440 g_colourTrackLineColour =
7441 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7442 g_colourTrackLineColour.Blue());
7443 g_nTrackPrecision = pTrackPrecision->GetSelection();
7445 g_bTrackDaily = pTrackDaily->GetValue();
7447 g_track_rotate_time = 0;
7448#if wxUSE_TIMEPICKCTRL
7450 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7451 g_track_rotate_time = h * 3600 + m * 60 + s;
7454 if (pTrackRotateUTC->GetValue())
7455 g_track_rotate_time_type = TIME_TYPE_UTC;
7456 else if (pTrackRotateLMT->GetValue())
7457 g_track_rotate_time_type = TIME_TYPE_LMT;
7459 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7461 g_bHighliteTracks = pTrackHighlite->GetValue();
7468 if (pEnableZoomToCursor)
7469 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7471 if (pEnableTenHertz) g_btenhertz = pEnableTenHertz->GetValue();
7474 g_bEnableZoomToCursor =
false;
7477 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7478 g_colourOwnshipRangeRingsColour =
7479 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7480 g_colourOwnshipRangeRingsColour.Green(),
7481 g_colourOwnshipRangeRingsColour.Blue());
7484 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7485 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7486 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7487 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7491 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7492 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7493 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7494 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7495 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7496 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7499 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7500 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7501 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7502 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7505 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7507 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7508 if (g_bSyncCogPredictors) {
7509 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7511 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7513 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7514 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7518 for (
const auto& it :
g_pAIS->GetTargetList()) {
7519 auto pAISTarget = it.second;
7520 if (NULL != pAISTarget) {
7521 pAISTarget->b_show_track = g_bAISShowTracks;
7526 if (TRACKTYPE_NEVER == props->TrackType) {
7527 pAISTarget->b_show_track =
false;
7529 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7530 pAISTarget->b_show_track =
true;
7537 std::map<int, Track*>::iterator it;
7538 it =
g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7539 if (it !=
g_pAIS->m_persistent_tracks.end())
7540 pAISTarget->b_show_track =
true;
7541 pAISTarget->b_show_track_old = g_bAISShowTracks;
7546 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7547 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7549 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7550 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7552 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7554 m_pText_Scale_Priority->GetValue().ToLong(&l);
7555 g_ShowScaled_Num = (int)l;
7557 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7558 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7559 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7560 long ais_name_scale = 5000;
7561 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7562 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7563 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7564 g_WplAction = m_pWplAction->GetSelection();
7567 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7568 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7569 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7571 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7572 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7575 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7576 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7577 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7579 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7580 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7581 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7582 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7584 bool bchange_scale =
false;
7585 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7586 bchange_scale =
true;
7587 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7590 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7591 g_MarkScaleFactorExp = g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7592 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7593 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7594 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7595 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7597 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7598 g_mouse_zoom_sensitivity =
7603 if (pWayPointMan)
WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7611 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7612 g_bopengl = pOpenGL->GetValue();
7615 g_bChartBarEx = pChartBarEX->GetValue();
7618 int depthUnit = pDepthUnitSelect->GetSelection();
7622 bool bUserStdChange =
false;
7624 int nOBJL = ps57CtlListBox->GetCount();
7626 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7628 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7629 if (marinersStdXref[i] == iPtr) {
7634 assert(itemIndex >= 0);
7635 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7636 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7637 bUserStdChange =
true;
7638 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7644 ps52plib->GenerateStateHash();
7645 long stateHash = ps52plib->GetStateHash();
7647 if (m_returnChanges & GL_CHANGED) {
7650 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7652 ps52plib->ClearCNSYLUPArray();
7653 ps52plib->GenerateStateHash();
7657 enum _DisCat nset = OTHER;
7658 switch (pDispCat->GetSelection()) {
7669 nset = MARINERS_STANDARD;
7672 ps52plib->SetDisplayCategory(nset);
7675 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7676 if (pCheck_ATONTEXT)
7677 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7678 if (pCheck_LDISTEXT)
7679 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7680 if (pCheck_XLSECTTEXT)
7681 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7683 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7684 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7685 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7686 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7687 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7688 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7690 ps52plib->m_nSymbolStyle =
7691 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7693 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7695 : SYMBOLIZED_BOUNDARIES;
7696 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7697 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7699 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7700 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7708 else if (depthUnit == 2)
7711 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7712 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7714 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7718 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7719 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7721 if (m_DeepCtl->GetValue().ToDouble(&dval))
7722 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7724 ps52plib->UpdateMarinerParams();
7725 ps52plib->m_nDepthUnitDisplay = depthUnit;
7729 ps52plib->GenerateStateHash();
7732 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7733 m_returnChanges |= S52_CHANGED;
7735 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7739#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7741 wxString new_canon =
"en_US";
7742 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7744 int nLang =
sizeof(lang_list) /
sizeof(
int);
7745 for (
int it = 0; it < nLang; it++) {
7746 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7748 wxString lang_canonical = pli->CanonicalName;
7749 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7750 if (lang_sel == test_string) {
7751 new_canon = lang_canonical;
7757 wxString locale_old = g_locale;
7758 g_locale = new_canon;
7760 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7762 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7765 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7766 m_returnChanges |= STYLE_CHANGED;
7768 wxSizeEvent nullEvent;
7769 top_frame::Get()->OnSize(nullEvent);
7772 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7773 g_bInlandEcdis = pInlandEcdis->GetValue();
7774 SwitchInlandEcdisMode(g_bInlandEcdis);
7775 m_returnChanges |= TOOLBAR_CHANGED;
7780 if (PluginLoader::GetInstance()->UpdatePlugIns())
7781 m_returnChanges |= TOOLBAR_CHANGED;
7790 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7791 m_groups_changed | k_plugins;
7796 wxString string_acc;
7797 for (wxString entry : TideCurrentDataSet) {
7798 string_acc += entry;
7801 wxString string_acc_control;
7802 for (
int i = 0; i < tcDataSelected->GetItemCount(); i++) {
7803 wxString setName = tcDataSelected->GetItemText(i);
7804 string_acc_control += setName;
7807 if (!string_acc.IsSameAs(string_acc_control)) {
7808 TideCurrentDataSet.clear();
7809 int nEntry = tcDataSelected->GetItemCount();
7810 for (
int i = 0; i < nEntry; i++) {
7811 wxString setName = tcDataSelected->GetItemText(i);
7812 TideCurrentDataSet.push_back(setName.ToStdString());
7814 m_returnChanges |= TIDES_CHANGED;
7817 if (g_canvasConfig != m_screenConfig) m_returnChanges |= CONFIG_CHANGED;
7818 g_canvasConfig = m_screenConfig;
7820 UpdateWorkArrayFromDisplayPanel();
7823 if ((m_returnChanges & VISIT_CHARTS) &&
7824 ((m_returnChanges & CHANGE_CHARTS) || (m_returnChanges & SCAN_UPDATE))) {
7825 DoDBSUpdate((m_returnChanges & FORCE_UPDATE) == FORCE_UPDATE);
7827 bool b_groupchange =
ChartData->ScrubGroupArray();
7829 if (b_groupchange ||
7830 ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)) {
7831 pConfig->DestroyConfigGroups();
7834 if ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)
7838 m_callbacks.process_dialog(m_returnChanges, m_pWorkDirList);
7842 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7845 top_frame::Get()->RefreshAllCanvas();
7848 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7850 if (m_bVisitPlugins) m_returnChanges |= FORCE_RELOAD;
7853 UpdateTemplateTitleText();
7856 ::wxEndBusyCursor();
7859void options::OnXidOkClick(wxCommandEvent& event) {
7862 if (event.GetEventObject() == NULL)
return;
7864 ApplyChanges(event);
7867 m_callbacks.prepare_close(
this, m_returnChanges);
7870 if ((m_returnChanges & CONFIG_CHANGED) || (m_returnChanges & GL_CHANGED))
7871 top_frame::Get()->ScheduleReconfigAndSettingsReload(
false,
false);
7874 if ((m_returnChanges & FONT_CHANGED) &&
7875 !(m_returnChanges & FONT_CHANGED_SAFE))
7876 top_frame::Get()->ScheduleDeleteSettingsDialog();
7879 if (m_returnChanges & LOCALE_CHANGED)
7880 top_frame::Get()->ScheduleDeleteSettingsDialog();
7883 if (m_returnChanges & FORCE_RELOAD) top_frame::Get()->ScheduleReloadCharts();
7889void options::Finish() {
7891 m_pListbook->ChangeSelection(0);
7892 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7893 wxNotebookPage* pg = m_pListbook->GetPage(i);
7894 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7895 if (nb) nb->ChangeSelection(0);
7898 lastWindowPos = GetPosition();
7899 lastWindowSize = GetSize();
7901 pConfig->SetPath(
"/Settings");
7902 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7903 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7906ArrayOfCDI options::GetSelectedChartDirs() {
7908 for (
size_t i = 0; i < panelVector.size(); i++) {
7909 if (panelVector[i]->IsSelected()) {
7910 rv.Add(panelVector[i]->GetCDI());
7917ArrayOfCDI options::GetUnSelectedChartDirs() {
7919 for (
size_t i = 0; i < panelVector.size(); i++) {
7920 if (!panelVector[i]->IsSelected()) {
7921 rv.Add(panelVector[i]->GetCDI());
7928void options::SetDirActionButtons() {
7929 ArrayOfCDI selArray = GetSelectedChartDirs();
7930 if (selArray.GetCount())
7931 m_removeBtn->Enable();
7933 m_removeBtn->Disable();
7936void options::OnButtondeleteClick(wxCommandEvent& event) {
7937 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7938 ActiveChartArray.Clear();
7939 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7940 ActiveChartArray.Add(unselArray[i]);
7943 UpdateChartDirList();
7945 UpdateWorkArrayFromDisplayPanel();
7948 if (m_pWorkDirList) {
7949 pActiveChartsList->DeleteAllItems();
7950 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7951 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7954 li.SetAlign(wxLIST_FORMAT_LEFT);
7955 li.SetText(dirname);
7957 long idx = pActiveChartsList->InsertItem(li);
7962 k_charts |= CHANGE_CHARTS;
7964 pScanCheckBox->Disable();
7969void options::DoDBSUpdate(
bool force_full) {
7970 wxString longmsg = _(
"OpenCPN Chart Update");
7972 ".................................................................."
7975 m_pCBDSprog =
new wxGenericProgressDialog();
7978 m_pCBDSprog->SetFont(*qFont);
7981 m_pCBDSprog->Create(_(
"OpenCPN Chart Update"), longmsg, 100,
nullptr,
7984 DimeControl(m_pCBDSprog);
7985 m_pCBDSprog->Show();
7988 ChartData->UpdateChartDatabaseInplace(*m_pWorkDirList, force_full,
7992void options::OnButtonRebuildChartDb(wxCommandEvent& event) {
7996void options::OnButtonParseENC(wxCommandEvent& event) {
7997 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
false);
7999 extern void ParseAllENC(wxWindow * parent);
8001 ParseAllENC(g_pOptions);
8004 top_frame::Get()->ChartsRefresh();
8006 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
true);
8012static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
8015 lzma_action action = LZMA_RUN;
8019 uint8_t inbuf[BUFSIZ];
8020 uint8_t outbuf[BUFSIZ];
8033 strm->next_in = NULL;
8035 strm->next_out = outbuf;
8036 strm->avail_out =
sizeof(outbuf);
8042 if (strm->avail_in == 0 && !feof(infile)) {
8043 strm->next_in = inbuf;
8044 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
8046 if (ferror(infile)) {
8047 fprintf(stderr,
"Read error: %s\n", strerror(errno));
8055 if (feof(infile)) action = LZMA_FINISH;
8073 lzma_ret ret = lzma_code(strm, action);
8078 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
8083 size_t write_size =
sizeof(outbuf) - strm->avail_out;
8085 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
8086 fprintf(stderr,
"Write error: %s\n", strerror(errno));
8091 strm->next_out = outbuf;
8092 strm->avail_out =
sizeof(outbuf);
8097 if (ret != LZMA_OK) {
8104 if (ret == LZMA_STREAM_END)
return true;
8115 case LZMA_MEM_ERROR:
8116 msg =
"Memory allocation failed";
8119 case LZMA_DATA_ERROR:
8132 msg =
"File size limits exceeded";
8147 msg =
"Unknown error, possibly a bug";
8151 wxLogMessage(
"LZMA Encoder error: %s (error code %u)\n", msg, ret);
8158static bool CompressChart(wxString in, wxString out) {
8160 FILE* infile = fopen(in.mb_str(),
"rb");
8161 if (!infile)
return false;
8163 FILE* outfile = fopen(out.mb_str(),
"wb");
8169 lzma_stream strm = LZMA_STREAM_INIT;
8170 bool success =
false;
8171 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
8173 success = compress(&strm, infile, outfile);
8184void options::OnButtonmigrateClick(wxCommandEvent& event) {
8190 new MigrateAssistantDialog(wxTheApp->GetTopWindow(),
true);
8191 g_migrateDialog->SetSize(top_frame::Get()->GetSize());
8192 g_migrateDialog->Centre();
8193 g_migrateDialog->Raise();
8194 g_migrateDialog->ShowModal();
8198void options::OnButtonEcdisHelp(wxCommandEvent& event) {
8199 wxString testFile =
"/doc/iECDIS/index.html";
8201 if (!::wxFileExists(testFile)) {
8202 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
8205 _(
"Would you like to visit the iECDIS Manual website for more "
8208 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
8209 wxYES_NO | wxCENTER, 60)) {
8210 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
8221void options::OnButtoncompressClick(wxCommandEvent& event) {
8223 wxArrayInt pListBoxSelections;
8226 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
8227 wxLIST_STATE_SELECTED);
8228 if (item == -1)
break;
8233 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
8234This may make them incompatible with other programs or older versions of OpenCPN.\n\
8235Compressed charts may take slightly longer to load and display on some systems.\n\
8236They can be decompressed again using unxz or 7 zip programs."),
8237 _(
"OpenCPN Warning"),
8238 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
8242 wxArrayString filespecs;
8243 filespecs.Add(
"*.kap");
8244 filespecs.Add(
"*.KAP");
8245 filespecs.Add(
"*.000");
8248 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
8249 filespecs.Add(
"*.D");
8250 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
8251 filespecs.Add(
"*.Z");
8253 wxGenericProgressDialog prog1(
8254 _(
"OpenCPN Compress Charts"), wxEmptyString,
8255 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
8256 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8257 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8260 wxSize sz = prog1.GetSize();
8261 sz.x = top_frame::Get()->GetClientSize().x * 8 / 10;
8264 wxArrayString charts;
8265 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
8266 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
8267 if (dirname.IsEmpty())
continue;
8270 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
8271 (dirname.Last() == wxChar(_T(
'\r'))))
8272 dirname.RemoveLast();
8274 if (!wxDir::Exists(dirname))
continue;
8277 wxArrayString FileList;
8278 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
8279 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
8281 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
8285 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
8286 charts.Add(FileList[j]);
8290 if (charts.GetCount() == 0) {
8291 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
8296 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
8297 wxGenericProgressDialog prog(
8298 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
8299 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8300 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8304 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
8306 prog.Update(i, charts[i], &skip);
8309 wxString compchart = charts[i] +
".xz";
8310 if (CompressChart(charts[i], compchart)) {
8311 total_size += wxFileName::GetSize(charts[i]).ToULong();
8312 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
8313 wxRemoveFile(charts[i]);
8319 double total_size_mb = total_size / 1024.0 / 1024.0;
8320 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
8323 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
8325 count, total_size_mb, total_compressed_size_mb,
8326 total_size_mb - total_compressed_size_mb,
8327 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
8330 UpdateWorkArrayFromTextCtl();
8332 if (m_pWorkDirList) {
8333 pActiveChartsList->DeleteAllItems();
8334 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
8335 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
8338 li.SetAlign(wxLIST_FORMAT_LEFT);
8339 li.SetText(dirname);
8341 long idx = pActiveChartsList->InsertItem(li);
8345 k_charts |= CHANGE_CHARTS;
8347 pScanCheckBox->Disable();
8353void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
8355void options::OnCancelClick(wxCommandEvent& event) {
8356 m_pListbook->ChangeSelection(0);
8357 comm_dialog->CancelSettings();
8359 lastWindowPos = GetPosition();
8360 lastWindowSize = GetSize();
8364 pConfig->SetPath(
"/Settings");
8365 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8366 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8369 androidEnableBackButton(
true);
8370 androidEnableRotation();
8371 androidEnableOptionItems(
true);
8374 top_frame::Get()->ThawCharts();
8378void 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);
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();
8783 wxDefaultPosition, wxDefaultSize);
8784 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8785 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8786 wxEXPAND | wxGROW | wxALL, 4);
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);
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();
8828 response = g_Platform->DoFileSelectorDialog(
8829 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
8832 if (response == wxID_OK)
8833 return g_Platform->NormalizePath(sel_file);
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());
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++) {
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) {
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());
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;
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++) {
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();
9456 response = g_Platform->DoFileSelectorDialog(
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();
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() {
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.
ChartCanvas - Main chart display and interaction component.
Represents an individual component within a ChartGroup.
Represents a user-defined collection of logically related charts.
Represents a panel for displaying and editing a configuration.
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
void Notify() override
Notify all listeners, no data supplied.
wxColour GetFontColor(const wxString &TextElement) const
Gets the text color for a UI element.
bool SetFont(const wxString &TextElement, wxFont *pFont, wxColour color)
Sets the default font properties for a UI element.
wxArrayString GetDialogStrings(const wxString &locale=wxEmptyString) const
Gets the list of unique dialog strings.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Get a font object for a UI element.
Wrapper for global variable, supports notification events when value changes.
Process incoming AIS messages.
static double ui_to_config(int slider_pos)
Convert a slider scale 1-100 value to configuration value 1.02..3.0.
Custom combobox for selecting waypoint icons.
EventVar m_on_sp_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Define an action to be performed when a KeyProvider is notified.
void Init(const KeyProvider &kp, const std::function< void(ObservedEvt &ev)> &action)
Initiate an object yet not listening.
Custom event class for OpenCPN's notification system.
bool LoadAllPlugIns(bool enabled_plugins, bool keep_orphans=false)
Update catalog with imported metadata and load all plugin library files.
ViewPort - Core geographic projection and coordinate transformation engine.
wxRadioButton * pTimezoneUTC
Specify date/time should be formatted in UTC.
EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
wxRadioButton * pTimezoneLocalTime
Specify date/time should be formatted in timezone as configured in the operating system.
Class cm93chart and helpers – CM93 chart state.
Global variables reflecting command line options and arguments.
Communication drivers factory and support.
Config file user configuration interface.
wxString g_datetime_format
Date/time format to use when formatting date/time strings.
bool g_bsmoothpanzoom
Controls how the chart panning and zooming smoothing is done during user interactions.
int g_iTempFormat
User-selected temperature 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_COGAvgSec
COG average period for Course Up Mode (sec)
int g_iSpeedFormat
User-selected speed unit format for display and input.
int g_iHeightFormat
User-selected height (vertical, above reference datum) unit format for display and input.
std::vector< size_t > g_config_display_size_mm
Size of pysical screen in millimeters.
int g_iDistanceFormat
User-selected distance (horizontal) unit format for display and input.
bool g_bDisplayGrid
Should lat/lon grid be displayed ?
Global variables stored in configuration file.
Panel for editing a connection.
Options | Connections GUI tab managing connections
std::vector< OCPN_MonitorInfo > g_monitor_info
Information about the monitors connected to the system.
GLuint g_raster_format
Global instance.
OpenGL chart rendering canvas.
glTextureManager * g_glTextureManager
Global instance.
Misc GUI event vars, a singleton.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
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.
A common variable shared between producer and consumer which supports Listen() and Notify().
Global variables Listen()/Notify() wrapper.
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.
ArrayOfMmsiProperties g_MMSI_Props_Array
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.
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.