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
185extern wxLocale* plocale_def_lang;
193extern int g_Android_SDK_Version;
194extern MigrateAssistantDialog* g_migrateDialog;
197static wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
199static wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
202static int lang_list[] = {
203 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
204 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
205 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
206 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
207 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
208 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
209 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
210 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
212 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
213 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
214 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
215 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
216 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
217 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
225 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
226 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
227 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
228 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
229 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
230 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
231 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
232 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
233 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
234 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
235 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
236 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
237 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
238 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
239 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
240 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
241 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
242 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
243 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
244 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
245 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
246 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
247 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
248 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
249 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
252 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
253 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
254 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
255 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
256 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
258 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
259 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
260 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
261 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
262 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
263 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
264 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
265 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
266 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
267 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
268 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
269 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
270 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
271 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
272 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
273 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
274 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
275 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
276 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
278 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
279 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
280 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
281 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
282 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
283 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
284 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
285 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
286 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
287 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
288 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
289 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
290 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
294void prepareSlider(wxSlider* slider) {
295 slider->GetHandle()->setStyleSheet(
296 prepareAndroidSliderStyleSheet(slider->GetSize().x));
297 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
298 slider->GetHandle()->grabGesture(Qt::PanGesture);
299 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
312 wxString textMod = text;
313 textMod.Replace(
" ",
"^");
316 wxString sep = wxFileName::GetPathSeparator();
317 textMod.Replace(sep,
" ");
319 Wrap(win, textMod, widthMax);
322 for (
size_t i = 0; i < m_array.GetCount(); i++) {
323 wxString a = m_array[i];
325 if (m_array.GetCount() > 1) {
326 if (i < m_array.GetCount() - 1) a += sep;
332 wxString
const& GetWrapped()
const {
return m_wrapped; }
333 int const GetLineCount()
const {
return m_lineCount; }
334 wxArrayString GetLineArray() {
return m_array; }
337 virtual void OnOutputLine(
const wxString& line) {
341 virtual void OnNewLine() {
349 wxArrayString m_array;
358 void DoChartSelected();
359 void SetSelected(
bool selected);
360 void OnPaint(wxPaintEvent& event);
362 void OnSize(wxSizeEvent& event);
364 int GetUnselectedHeight() {
return m_unselectedHeight; }
365 int GetRefHeight() {
return m_refHeight; }
366 bool IsSelected() {
return m_bSelected; }
367 void OnClickDown(wxMouseEvent& event);
368 void OnClickUp(wxMouseEvent& event);
373 wxColour m_boxColour;
374 int m_unselectedHeight;
375 wxString m_pChartDir;
379 DECLARE_EVENT_TABLE()
383EVT_PAINT(OCPNChartDirPanel::OnPaint)
385EVT_SIZE(OCPNChartDirPanel::OnSize)
389 const wxPoint& pos, const wxSize& size,
391 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
392 m_pChartDir = cdi.fullpath;
395 if (cdi.fullpath.StartsWith(
396 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
397 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
402 m_refHeight = GetCharHeight();
404 m_unselectedHeight = 2 * m_refHeight;
410 SetMinSize(wxSize(-1, m_unselectedHeight));
412 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
415 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
420OCPNChartDirPanel::~OCPNChartDirPanel() {}
422static wxStopWatch swclick;
424static int downx, downy;
427void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
430 event.GetPosition(&downx, &downy);
436void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
438 qDebug() << swclick.Time();
439 if (swclick.Time() < 200) {
441 event.GetPosition(&upx, &upy);
442 if ((fabs(upx - downx) < GetCharWidth()) &&
443 (fabs(upy - downy) < GetCharWidth())) {
451void OCPNChartDirPanel::DoChartSelected() {
461void OCPNChartDirPanel::SetSelected(
bool selected) {
462 m_bSelected = selected;
466 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
469 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
474 g_pOptions->SetDirActionButtons();
481void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
482 if (m_pChartDir.Length()) {
484 GetClientSize(&x, &y);
487 wxArrayString nameWrapped = wrapper.GetLineArray();
489 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
495void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
497 GetSize(&width, &height);
500 dc.SetPen(*wxTRANSPARENT_PEN);
501 dc.SetBrush(wxBrush(GetBackgroundColour()));
502 dc.DrawRectangle(GetVirtualSize());
504 wxString nameString = m_pChartDir;
506 wxArrayString nameWrapped = wrapper.GetLineArray();
508 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
509 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
510 GetParent()->GetSizer()->Layout();
514 dc.SetBrush(wxBrush(m_boxColour));
516 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
518 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
520 int offset = height / 10;
521 int text_x = offset * 2;
523 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
526 dc.SetTextForeground(
527 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
529 int yd = height * 20 / 100;
530 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
532 dc.DrawText(nameWrapped[i], text_x, yd);
534 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
535 yd += GetCharHeight();
539 dc.SetBrush(wxBrush(m_boxColour));
542 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME),
545 int offset = height / 10;
546 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
547 height - (2 * offset), height / 10);
549 int text_x = offset * 2;
551 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
554 dc.SetTextForeground(
555 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
557 int yd = height * 20 / 100;
558 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
560 dc.DrawText(nameWrapped[i], text_x, yd);
562 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
563 yd += GetCharHeight();
571static bool LoadAllPlugIns(
bool load_enabled) {
572 g_Platform->ShowBusySpinner();
573 bool b = PluginLoader::GetInstance()->
LoadAllPlugIns(load_enabled);
574 g_Platform->HideBusySpinner();
583 const wxPoint& pt = wxDefaultPosition,
584 const wxSize& sz = wxDefaultSize,
585 long style = wxHSCROLL | wxVSCROLL,
586 const wxString& name =
"scrolledWindow") {
587 Create(parent,
id, pt, sz, style, name);
590 bool Create(wxWindow* parent, wxWindowID
id = -1,
591 const wxPoint& pt = wxDefaultPosition,
592 const wxSize& sz = wxDefaultSize,
593 long style = wxHSCROLL | wxVSCROLL,
594 const wxString& name =
"scrolledWindow");
598 unsigned int Append(wxString& label,
bool benable =
true,
599 bool bsizerLayout =
true);
600 unsigned int GetCount() {
return m_list.size(); }
605 void Check(
int index,
bool val);
606 bool IsChecked(
int index);
611 std::vector<wxCheckBox*> m_list;
614bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
615 const wxPoint& pt,
const wxSize& sz,
616 long style,
const wxString& name) {
617 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
620 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
621 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
625 m_sizer =
new wxBoxSizer(wxVERTICAL);
631unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable,
633 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
635 cb->SetValue(!benable);
637 if (bsizerLayout) m_sizer->Layout();
639 m_list.push_back(cb);
641 return m_list.size() - 1;
644void OCPNCheckedListCtrl::Check(
int index,
bool val) {
645 wxCheckBox* cb = m_list[index];
646 if (cb) cb->SetValue(val);
649bool OCPNCheckedListCtrl::IsChecked(
int index) {
650 wxCheckBox* cb = m_list[index];
651 return cb ? cb->GetValue() :
false;
654void OCPNCheckedListCtrl::RunLayout() { m_sizer->Layout(); }
656void OCPNCheckedListCtrl::Clear() {
657 for (
auto cb : m_list) delete cb;
663void appendOSDirSlash(wxString* pString);
672EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
673EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
677 const wxString& caption,
678 const wxPoint& pos, const wxSize& size,
680 : wxDialog(parent,
id, caption, pos, size,
681 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
683 GetSizer()->SetSizeHints(
this);
687ConfigCreateDialog::~ConfigCreateDialog() {}
689void ConfigCreateDialog::CreateControls() {
690 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
693 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
694 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
696 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
697 wxSize(40 * GetCharHeight(), -1), 0);
698 mainSizer->Add(m_TitleCtl, 0,
699 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
701 mainSizer->AddSpacer(2 * GetCharHeight());
703 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
704 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
707 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
708 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
709 mainSizer->Add(m_DescriptionCtl, 0,
710 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
712 mainSizer->AddSpacer(2 * GetCharHeight());
717 _(
"Create a private configuration template based on current settings.\n\
718This template will be saved, and may be selected for further use at any time.\n\
720 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
722 mainSizer->AddSpacer(2 * GetCharHeight());
724 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
725 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
727 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
728 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
730 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
731 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
732 m_OKButton->SetDefault();
735void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
736 EndModal(wxID_CANCEL);
739void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
740 const wxString& title = m_TitleCtl->GetValue();
741 const wxString& desc = m_DescriptionCtl->GetValue();
742 m_createdTemplateGUID = ConfigMgr::Get().CreateNamedConfig(title, desc,
"");
751EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
752EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
756 wxWindowID
id, const wxString& caption,
757 const wxPoint& pos, const wxSize& size,
759 : wxDialog(parent,
id, caption, pos, size,
760 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
763 GetSizer()->SetSizeHints(
this);
767MMSIEditDialog::~MMSIEditDialog() {
delete m_MMSICtl; }
769void MMSIEditDialog::CreateControls() {
770 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
773 wxStaticBox* mmsiBox =
774 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
776 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
777 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
779 wxStaticText* mmsiLabel =
new wxStaticText(
this, wxID_STATIC, _(
"MMSI"));
780 mmsiLabel->SetToolTip(
781 _(
"Maritime Mobile Service Identity - A unique 9-digit number assigned "
782 "to a vessel or navigation aid. Used to identify vessels and devices "
783 "in AIS transmissions and DSC calls."));
784 mmsiSizer->Add(mmsiLabel, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
786 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
787 wxDefaultPosition, wxSize(180, -1), 0);
788 m_MMSICtl->SetToolTip(
789 _(
"Enter the 9-digit MMSI number for this vessel or station"));
790 mmsiSizer->Add(m_MMSICtl, 0,
791 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
792 m_MMSICtl->Bind(wxEVT_TEXT, &MMSIEditDialog::OnMMSIChanged,
this);
794 wxStaticText* userLabelText =
new wxStaticText(
this, wxID_STATIC, _(
"Name"));
795 userLabelText->SetToolTip(
796 _(
"Display name for this vessel or device - can override names received "
798 mmsiSizer->Add(userLabelText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
800 m_ShipNameCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
801 wxDefaultPosition, wxSize(180, -1), 0);
802 m_ShipNameCtl->SetToolTip(_(
803 "Set the name for this vessel or device. If specified, this name takes "
804 "precedence over names received via AIS messages. Note that standard AIS "
805 "only supports uppercase letters (A-Z), numbers, and limited "
806 "punctuation. Your manual entries are stored in the mmsitoname.csv file "
807 "and preserved across sessions."));
808 mmsiSizer->Add(m_ShipNameCtl, 0,
809 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
811 wxStaticBox* trackBox =
new wxStaticBox(
this, wxID_ANY, _(
"Tracking"));
812 trackBox->SetToolTip(_(
"Control how tracks are created for this MMSI"));
813 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackBox, wxVERTICAL);
815 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
817 m_rbTypeTrackDefault =
818 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
819 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
820 m_rbTypeTrackDefault->SetToolTip(
821 _(
"Use the global tracking settings for this vessel"));
822 m_rbTypeTrackDefault->SetValue(TRUE);
823 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
825 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
826 m_rbTypeTrackAlways->SetToolTip(_(
827 "Always create a track for this vessel, regardless of global settings"));
828 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
830 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
831 m_rbTypeTrackNever->SetToolTip(
832 _(
"Never create a track for this vessel, regardless of global settings"));
833 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
835 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
836 m_cbTrackPersist->SetToolTip(
837 _(
"Save this vessel's track between OpenCPN sessions. Useful for vessels "
838 "you want to monitor continuously over time."));
839 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
841 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
842 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
844 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
845 m_IgnoreButton->SetToolTip(
846 _(
"When checked, AIS data for this MMSI will be ignored and the vessel "
847 "will not appear on the chart. Useful for suppressing shore stations, "
848 "permanently moored vessels, or duplicate AIS signals that you don't "
849 "need to monitor."));
850 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
852 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
853 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
854 m_MOBButton->SetToolTip(
855 _(
"When checked, OpenCPN will display a special icon for this device, "
856 "sound a distinctive alarm, and automatically create a temporary MOB "
857 "route from your vessel to this device in emergency. For crew safety "
858 "devices, you can assign the crew member's name using the Name "
859 "field above for quick identification."));
860 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
863 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
864 m_VDMButton->SetToolTip(
865 _(
"When checked, converts AIS messages for this vessel from AIVDM (other "
866 "vessel) to AIVDO (own vessel) format."));
867 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
869 m_FollowerButton =
new wxCheckBox(
870 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
871 m_FollowerButton->SetToolTip(
872 _(
"When checked, disables CPA (Closest Point of Approach) alerts for "
873 "this vessel as it's considered intentionally following your vessel. "
874 "Follower vessels are displayed with a special own-ship style icon."));
875 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
877 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
878 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
880 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
881 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
883 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
884 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
885 m_OKButton->SetDefault();
889 if (m_props->MMSI > 0)
890 sMMSI.Printf(
"%d", m_props->MMSI);
893 m_MMSICtl->AppendText(sMMSI);
896 if (!m_props->m_ShipName.IsEmpty()) {
897 m_ShipNameCtl->SetValue(m_props->m_ShipName);
900 switch (m_props->TrackType) {
901 case TRACKTYPE_ALWAYS:
902 m_rbTypeTrackAlways->SetValue(TRUE);
904 case TRACKTYPE_NEVER:
905 m_rbTypeTrackNever->SetValue(TRUE);
911 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
912 m_IgnoreButton->SetValue(m_props->m_bignore);
913 m_MOBButton->SetValue(m_props->m_bMOB);
914 m_VDMButton->SetValue(m_props->m_bVDM);
915 m_FollowerButton->SetValue(m_props->m_bFollower);
917 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
920void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
922void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
923 EndModal(wxID_CANCEL);
926void MMSIEditDialog::Persist() {
928 if (m_rbTypeTrackDefault->GetValue())
929 m_props->TrackType = TRACKTYPE_DEFAULT;
930 else if (m_rbTypeTrackAlways->GetValue())
931 m_props->TrackType = TRACKTYPE_ALWAYS;
933 m_props->TrackType = TRACKTYPE_NEVER;
935 m_props->m_bignore = m_IgnoreButton->GetValue();
936 m_props->m_bMOB = m_MOBButton->GetValue();
937 m_props->m_bVDM = m_VDMButton->GetValue();
938 m_props->m_bFollower = m_FollowerButton->GetValue();
939 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
942 wxString shipName = m_ShipNameCtl->GetValue().Upper();
943 if (!shipName.IsEmpty()) {
944 m_props->m_ShipName = shipName;
947 wxString mmsi = m_MMSICtl->GetValue();
948 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
949 g_pAIS->UpdateMMSItoNameFile(mmsi, shipName);
954 else if (m_props->m_ShipName == wxEmptyString) {
955 auto proptarget =
g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
957 wxString s = proptarget->GetFullName();
958 m_props->m_ShipName = s;
960 wxString GetShipNameFromFile(
int);
961 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
967void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
971 m_MMSICtl->GetValue().ToLong(&nmmsi);
972 m_props->MMSI = nmmsi;
975 if (m_MMSICtl->GetValue().Length() != 9) {
978 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
979 "your entries and cancel if necessary."),
980 _(
"OpenCPN Info"), wxOK | wxCANCEL);
982 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
983 if (retcode == wxID_OK) {
994void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
996void MMSIEditDialog::OnMMSIChanged(wxCommandEvent& event) {
997 wxString mmsi = m_MMSICtl->GetValue();
1000 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1002 wxString shipName =
g_pAIS->GetMMSItoNameEntry(mmsi);
1005 if (shipName.IsEmpty()) {
1006 auto target =
g_pAIS->Get_Target_Data_From_MMSI(wxAtoi(mmsi));
1008 shipName = target->GetFullName();
1013 if (!shipName.IsEmpty()) {
1014 m_ShipNameCtl->SetValue(shipName);
1022EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1023EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1024EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1025 MMSIListCtrl::OnListItemRightClick)
1026EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1027EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1031 const wxSize& size,
long style)
1032 : wxListCtrl(parent,
id, pos, size, style) {
1036MMSIListCtrl::~MMSIListCtrl() {}
1038wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1042 if (!props)
return ret;
1045 if (props->MMSI > 0) ret = wxString::Format(
"%d", props->MMSI);
1048 switch (props->TrackType) {
1049 case TRACKTYPE_DEFAULT:
1052 case TRACKTYPE_ALWAYS:
1055 case TRACKTYPE_NEVER:
1061 if (props->m_bPersistentTrack) ret.Append(
", ").Append(_(
"Persistent"));
1064 if (props->m_bignore) ret =
"X";
1067 if (props->m_bMOB) ret =
"X";
1070 if (props->m_bVDM) ret =
"X";
1073 if (props->m_bFollower) ret =
"X";
1076 ret = props->m_ShipName;
1085void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1087void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1092 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1093 wxDefaultPosition, wxSize(200, 200));
1095 if (pd->ShowModal() == wxID_OK) {
1105void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1106 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1107 if (m_context_item == wxNOT_FOUND)
return;
1108 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1110 wxMenuItem* item_edit =
1111 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") +
"...");
1114 item_edit->SetFont(sFont);
1116 menu->Append(item_edit);
1118 wxMenuItem* item_delete =
1119 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1121 item_delete->SetFont(sFont);
1123 menu->Append(item_delete);
1127 item_edit->SetFont(*qFont);
1128 item_delete->SetFont(*qFont);
1131 wxPoint p = ScreenToClient(wxGetMousePosition());
1132 PopupMenu(menu, p.x, p.y);
1138void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1139 int context_item = m_context_item;
1144 switch (event.GetId()) {
1145 case ID_DEF_MENU_MMSI_EDIT: {
1148 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1149 wxDefaultPosition, wxSize(200, 200));
1151 if (pd->ShowModal() == wxID_OK) {
1154 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1164 case ID_DEF_MENU_MMSI_DELETE:
1173MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1174 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1181 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1184 wxString MMSI_props_column_spec =
"120;120;100;100;100;100;100;100";
1186 wxStringTokenizer tkz(MMSI_props_column_spec,
";");
1187 wxString s_width = tkz.GetNextToken();
1192 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1193 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1202 int dx = GetCharWidth();
1204 GetTextExtent(
"W", &dx, NULL, NULL, NULL, qFont);
1207 m_pListCtrlMMSI->InsertColumn(mlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, dx * 10);
1208 m_pListCtrlMMSI->InsertColumn(mlTrackMode, _(
"Track Mode"),
1209 wxLIST_FORMAT_CENTER, dx * 20);
1210 m_pListCtrlMMSI->InsertColumn(mlIgnore, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1212 m_pListCtrlMMSI->InsertColumn(mlMOB, _(
"MOB"), wxLIST_FORMAT_CENTER, dx * 5);
1213 m_pListCtrlMMSI->InsertColumn(mlVDM, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1215 m_pListCtrlMMSI->InsertColumn(mlShipName, _(
"Ship name"),
1216 wxLIST_FORMAT_CENTER, dx * 20);
1217 m_pListCtrlMMSI->InsertColumn(mlFollower, _(
"Follower"), wxLIST_FORMAT_CENTER,
1220 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1222 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1224 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1225 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1227 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1234 SetSize(GetSize().x, GetSize().y - 1);
1236 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1239MMSI_Props_Panel::~MMSI_Props_Panel() {}
1241void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1245 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1246 wxDefaultPosition, wxSize(200, 200));
1249 if (pd->ShowModal() == wxID_OK) {
1257void MMSI_Props_Panel::UpdateMMSIList() {
1259 long selItemID = wxNOT_FOUND;
1260 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1261 wxLIST_STATE_SELECTED);
1263 int selMMSI = wxNOT_FOUND;
1266 m_pListCtrlMMSI->DeleteAllItems();
1271 m_pListCtrlMMSI->InsertItem(item);
1272 for (
int j = 0; j < mlFollower + 1; j++) {
1274 item.SetText(m_pListCtrlMMSI->OnGetItemText(i, j));
1275 m_pListCtrlMMSI->SetItem(item);
1280 long item_sel = wxNOT_FOUND;
1281 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1291 m_pListCtrlMMSI->SetItemState(item_sel,
1292 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1293 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1296 m_pListCtrlMMSI->Refresh(FALSE);
1300void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1310 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value =
"",
1311 const wxPoint& pos = wxDefaultPosition,
1312 const wxSize& size = wxDefaultSize,
int n = 0,
1313 const wxString choices[] = NULL,
long style = 0,
1314 const wxValidator& validator = wxDefaultValidator,
1315 const wxString& name =
"OCPNFatCombo");
1319 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1320 wxCoord OnMeasureItem(
size_t item)
const;
1321 wxCoord OnMeasureItemWidth(
size_t item)
const;
1322 bool SetFont(
const wxFont& font);
1324 int Append(
const wxString& item, wxBitmap bmp);
1327 const wxFont* dfont;
1331 ArrayOfBitmaps bmpArray;
1334OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1336OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1337 const wxString& value,
const wxPoint& pos,
1338 const wxSize& size,
int n,
const wxString choices[],
1339 long style,
const wxValidator& validator,
1340 const wxString& name)
1341 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1344 GetFont().GetPointSize() / g_Platform->getFontPointsperPixel();
1345 itemHeight = (int)wxRound(fontHeight);
1346 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1349OCPNFatCombo::~OCPNFatCombo() {}
1351bool OCPNFatCombo::SetFont(
const wxFont& font) {
1356void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1363 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1364 wxBrush br = wxBrush(bg);
1365 wxBrush sv = dc.GetBrush();
1367 dc.DrawRectangle(0, 0, rect.width, rect.height);
1369 dc.SetTextForeground(wxColour(0, 0, 0));
1371 if (flags & wxODCB_PAINTING_CONTROL) {
1372 wxString text = GetValue();
1374 dc.DrawText(text, rect.x + margin_x + offset_x,
1375 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1377 dc.SetBackground(wxBrush(br));
1379 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1380 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1384wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1385 if (item < bmpArray.GetCount())
1386 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1388 return itemHeight * 12 / 10;
1391wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1393int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1395 int idx = wxOwnerDrawnComboBox::Append(item);
1400void OCPNFatCombo::Clear() {
1401 wxOwnerDrawnComboBox::Clear();
1405BEGIN_EVENT_TABLE(
options, wxDialog)
1406EVT_INIT_DIALOG(options::OnDialogInit)
1407EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1408EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1409EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1410EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1411EVT_BUTTON(ID_REBUILDBUTTON, options::OnButtonRebuildChartDb)
1412EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1413EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1414EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1415EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1416EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1417EVT_BUTTON(xID_OK, options::OnXidOkClick)
1418EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1419EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1420EVT_BUTTON(ID_BUTTONFONT_RESET, options::OnResetFont)
1421EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1423EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1424EVT_CLOSE(options::OnClose)
1426#if defined(__WXGTK__) || defined(__WXQT__)
1427EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1430EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1432EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1433EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1434EVT_CHOICE(ID_HEIGHTUNITSCHOICE, options::OnUnitsChoice)
1435EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1436EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1437EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1438EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1439EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1440EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1441EVT_CHAR_HOOK(options::OnCharHook)
1446 const wxString& caption, const wxPoint& pos,
1447 const wxSize& size,
long style)
1448 : pTrackRotateTime(0), m_callbacks(callbacks) {
1453 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1455 wxDialog::Create(parent,
id, caption, pos, size, style,
"Options");
1456 SetFont(*dialogFont);
1459 RecalculateSize(size.x, size.y);
1461 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1463 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1464 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1466 m_pPlugInCtrl->ReloadPluginPanels();
1468 auto action = [&](wxCommandEvent& evt) {
1469 g_persist_active_route = m_persist_active_route_chkbox->IsChecked();
1471 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1472 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1474 m_OnChartDb_finalize_listener.Init(
1475 GuiEvents::GetInstance().on_finalize_chartdbs,
1476 [&](
ObservedEvt& ev) { OptionsFinalizeChartDBUpdate(); });
1479options::~options() {
1481 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1483 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1484 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1487 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1489 delete m_pSerialArray;
1490 delete m_pGroupArray;
1491 delete m_topImgList;
1495 delete m_pPlugInCtrl;
1498 delete m_PluginCatalogMgrPanel;
1503bool options::SendIdleEvents(wxIdleEvent& event) {
1504 if (IsShown())
return wxDialog::SendIdleEvents(event);
1508void options::OptionsFinalizeChartDBUpdate() {
1513 g_GLOptions.m_bTextureCompressionCaching = m_bTextureCacheingSave;
1515 m_OKButton->Enable();
1516 m_CancelButton->Enable();
1517 m_ApplyButton->Enable();
1520void options::RecalculateSize(
int hint_x,
int hint_y) {
1521 if (!g_bresponsive) {
1522 m_nCharWidthMax = GetSize().x / GetCharWidth();
1526 if ((hint_x < 200) || (hint_y < 200)) {
1528 int display_width, display_height;
1532 if (display_height < 600) {
1535 vectorPanel->SetSizeHints(ps57Ctl);
1545 esize.x = GetCharWidth() * 110;
1546 esize.y = GetCharHeight() * 40;
1548 wxSize dsize = GetParent()->GetSize();
1549 esize.y = wxMin(esize.y, dsize.y - 0 );
1550 esize.x = wxMin(esize.x, dsize.x - 0 );
1553 wxSize fsize = GetSize();
1554 wxSize canvas_size = GetParent()->GetSize();
1555 wxPoint screen_pos = GetParent()->GetScreenPosition();
1556 int xp = (canvas_size.x - fsize.x) / 2;
1557 int yp = (canvas_size.y - fsize.y) / 2;
1558 Move(screen_pos.x + xp, screen_pos.y + yp);
1560 m_nCharWidthMax = GetSize().x / GetCharWidth();
1563void options::Init() {
1564 m_pWorkDirList = NULL;
1566 pShowStatusBar = NULL;
1567 pShowMenuBar = NULL;
1568 pShowCompassWin = NULL;
1571 m_scrollWinChartList = NULL;
1572 ps57CtlListBox = NULL;
1574 m_pSerialArray = NULL;
1575 pUpdateCheckBox = NULL;
1576 pParseENCButton = NULL;
1582 pSoundDeviceIndex = NULL;
1586 pCBLookAhead = NULL;
1587 pCDOQuilting = NULL;
1588 pPreserveScale = NULL;
1589 pSmoothPanZoom = NULL;
1590 pEnableZoomToCursor = NULL;
1591 pSDisplayGrid = NULL;
1592 pCDOOutlines = NULL;
1593 pSDepthUnits = NULL;
1595 pSDefaultBoatSpeed = NULL;
1598 itemActiveChartStaticBox = NULL;
1600 pCheck_SOUNDG = NULL;
1602 pCheck_SHOWIMPTEXT = NULL;
1603 pCheck_SCAMIN = NULL;
1604 pCheck_ATONTEXT = NULL;
1605 pCheck_LDISTEXT = NULL;
1606 pCheck_XLSECTTEXT = NULL;
1608 m_bVisitLang = FALSE;
1609 m_bVisitPlugins = FALSE;
1610 m_itemFontElementListBox = NULL;
1611 m_textSample = NULL;
1612 m_topImgList = NULL;
1615 m_pGroupArray = NULL;
1616 m_groups_changed = 0;
1619 m_pageConnections = -1;
1624 m_pageConnections = -1;
1626 pEnableTenHertz =
nullptr;
1628 auto loader = PluginLoader::GetInstance();
1629 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
1630 b_oldhaveWMM = b_haveWMM;
1635 m_bForceNewToolbaronCancel =
false;
1637 m_cs = (ColorScheme)0;
1640 m_pPlugInCtrl = NULL;
1641 m_PluginCatalogMgrPanel = NULL;
1655 m_bVectorInit =
false;
1660 pCmdSoundString = NULL;
1662 m_sconfigSelect_single = NULL;
1663 m_sconfigSelect_twovertical = NULL;
1666 dc.SetFont(*dialogFont);
1668 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, dialogFont);
1670 m_colourPickerDefaultSize =
1684 auto sound =
static_cast<o_sound::Sound*
>(ev.GetClientData());
1698 {_(
"Nautical miles"), DISTANCE_NMI},
1699 {_(
"Statute miles"), DISTANCE_MI},
1700 {_(
"Kilometers"), DISTANCE_KM},
1701 {_(
"Meters"), DISTANCE_M}};
1703static const int kNumDistanceFormats =
1707static int GetDistanceFormatIndex(
int enumValue) {
1708 for (
int i = 0; i < kNumDistanceFormats; i++) {
1709 if (kDistanceFormats[i].enumValue == enumValue) {
1717static int GetDistanceFormatEnum(
int index) {
1718 if (index >= 0 && index < kNumDistanceFormats) {
1719 return kDistanceFormats[index].enumValue;
1721 return DISTANCE_NMI;
1724#if defined(__GNUC__) && __GNUC__ < 8
1727static const wxString BAD_ACCESS_MSG = _(
1728 "The device selected is not accessible; opencpn will likely not be able\n"
1729 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1730 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1731 "with the following contents:\n\n"
1732 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1733 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1734 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1735 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1739static const wxString BAD_ACCESS_MSG = _(R
"(
1740The device selected is not accessible; opencpn will likely not be able
1741to use this device as-is. You might want to exit OpenCPN, reboot and
1742retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1743with the following contents:
1745 KERNEL=="ttyUSB*", MODE="0666"
1746 KERNEL=="ttyACM*", MODE="0666"
1747 KERNEL=="ttyS*", MODE="0666"
1749For more info, see the file LINUX_DEVICES.md in the distribution docs.
1754void options::OnDialogInit(wxInitDialogEvent& event) {}
1756void options::CheckDeviceAccess( wxString& path) {}
1758size_t options::CreatePanel(
const wxString& title) {
1759 size_t id = m_pListbook->GetPageCount();
1762 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1763 wxDefaultSize, wxTAB_TRAVERSAL, title);
1764 m_pListbook->AddPage(panel, title, FALSE,
id);
1768wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1769 if (parent > m_pListbook->GetPageCount() - 1) {
1771 wxString::Format(
"Warning: invalid parent in options::AddPage( %d, ",
1776 wxNotebookPage* page = m_pListbook->GetPage(parent);
1778 wxScrolledWindow* sw;
1780 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1781 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1783 for (
size_t i_page = 0; i_page < nb->GetPageCount(); i_page++) {
1784 wxString candidate_title = nb->GetPageText(i_page);
1785 if (candidate_title.IsSameAs(title))
1786 return static_cast<wxScrolledWindow*
>(nb->GetPage(i_page));
1789 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1791 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1792 nb->AddPage(sw, title);
1793 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1794 wxString toptitle = m_pListbook->GetPageText(parent);
1795 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1796 wxDefaultSize, wxNB_TOP);
1799 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1800 m_pListbook->SetSelection(0);
1801 m_pListbook->RemovePage(parent + 1);
1802 wxString previoustitle = page->GetName();
1804 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1805 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1807 nb->AddPage(page, previoustitle);
1811 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1813 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1814 nb->AddPage(sw, title);
1815 nb->ChangeSelection(0);
1817 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1818 wxDefaultSize, style, title);
1819 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1820 wxString toptitle = m_pListbook->GetPageText(parent);
1821 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1822 m_pListbook->SetSelection(0);
1823 m_pListbook->DeletePage(parent + 1);
1827 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1833bool options::DeletePluginPage(wxScrolledWindow* page) {
1834 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1835 wxNotebookPage* pg = m_pListbook->GetPage(i);
1836 auto nb =
dynamic_cast<wxNotebook*
>(pg);
1839 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1840 wxNotebookPage* spg = nb->GetPage(j);
1843 if (nb->GetPageCount() != 1)
return TRUE;
1845 spg = nb->GetPage(0);
1846 spg->Reparent(m_pListbook);
1848 wxString toptitle = m_pListbook->GetPageText(i);
1849 m_pListbook->DeletePage(i);
1850 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1854 }
else if (pg == page) {
1856 m_pListbook->DeletePage(i);
1857 wxPanel* panel =
new wxPanel(m_pListbook);
1858 wxString toptitle = m_pListbook->GetPageText(i);
1859 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1866void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1867 int group_item_spacing) {
1868 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1871 std::make_shared<ConnectionsDlg>(m_pNMEAForm, TheConnectionParams());
1874 Bind(wxEVT_SIZE, [&](wxSizeEvent& ev) {
1875 auto w = m_pListbook->GetCurrentPage();
1876 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
1880 comm_dialog->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1884void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1885 int group_item_spacing) {
1886 itemPanelShip = AddPage(parent, _(
"Own ship"));
1888 ownShip =
new wxBoxSizer(wxVERTICAL);
1889 itemPanelShip->SetSizer(ownShip);
1892 wxStaticBox* osdBox =
1893 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1894 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1895 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1897 wxFlexGridSizer* dispOptionsGrid =
1898 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1899 dispOptionsGrid->AddGrowableCol(1);
1900 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1902 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1903 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1904 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1906 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1907 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
1909 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
1910 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
1911 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
1913 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1914 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
1916 wxStaticText* iconTypeTxt =
1917 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
1918 dispOptionsGrid->Add(iconTypeTxt, 0);
1920 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
1921 _(
"Real Scale Vector")};
1923 m_pShipIconType =
new wxChoice(
1924 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
1925 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
1926 dispOptionsGrid->Add(m_pShipIconType, 0,
1927 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
1928 group_item_spacing);
1930 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
1931 realSizes->AddGrowableCol(1);
1933 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
1936 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
1938 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
1939 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1942 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
1944 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1945 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1948 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
1950 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1951 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1953 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
1954 _(
"GPS Offset from Midship (m)")),
1956 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1957 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1960 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
1962 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1963 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1966 wxFlexGridSizer* rrSelect =
1967 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
1968 rrSelect->AddGrowableCol(1);
1969 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
1971 wxStaticText* rrTxt =
1972 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
1973 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
1975 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
1976 "6",
"7",
"8",
"9",
"10"};
1977 pNavAidRadarRingsNumberVisible =
1978 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
1979 m_pShipIconType->GetSize(), 11, rrAlt);
1980 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
1981 group_item_spacing);
1983 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1984 radarGrid->AddGrowableCol(1);
1985 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
1987 wxStaticText* distanceText =
1988 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
1989 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
1991 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL,
"",
1992 wxDefaultPosition, wxSize(100, -1), 0);
1993 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
1994 group_item_spacing);
1996 wxStaticText* unitText =
1997 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
1998 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
2000 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"),
2001 _(
"Minutes (time)")};
2002 m_itemRadarRingsUnits =
2003 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
2004 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
2005 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2007 wxStaticText* colourText =
2008 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Color"));
2009 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2011 m_colourOwnshipRangeRingColour =
2013 wxDefaultPosition, m_colourPickerDefaultSize, 0,
2014 wxDefaultValidator,
"ID_COLOUROSRANGECOLOUR");
2015 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2018 wxFlexGridSizer* shipToActiveGrid =
2019 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2020 shipToActiveGrid->AddGrowableCol(1);
2021 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2022 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2023 _(
"Show direction to Active Waypoint"));
2024 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2027 wxStaticText* shipToActiveText1 =
2028 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2029 shipToActiveGrid->Add(shipToActiveText1, 1,
2030 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2032 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
2033 _(
"Long dash"), _(
"Short dash")};
2034 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2035 m_shipToActiveStyle =
2036 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2037 LineStyleNChoices, LineStyleChoices, 0);
2038 m_shipToActiveStyle->SetSelection(0);
2039 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2041 wxStaticText* shipToActiveText2 =
2042 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2043 shipToActiveGrid->Add(shipToActiveText2, 1,
2044 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2046 wxString m_LineColorChoices[] = {
2047 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2048 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2049 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2050 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2052 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2053 m_shipToActiveColor =
2054 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2055 LineColorNChoices, m_LineColorChoices, 0);
2056 m_shipToActiveColor->SetSelection(0);
2057 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2060 wxStaticBox* shipdata =
2061 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Ship's identifier"));
2062 wxStaticBoxSizer* datasizer =
new wxStaticBoxSizer(shipdata, wxVERTICAL);
2063 ownShip->Add(datasizer, 0, wxGROW | wxALL, border_size);
2065 wxFlexGridSizer* ownmmsisizer =
2066 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2067 ownmmsisizer->AddGrowableCol(1);
2068 datasizer->Add(ownmmsisizer, 0, wxALL | wxEXPAND, border_size);
2072 wxStaticText* pStatic_ownshipmmsi =
2073 new wxStaticText(itemPanelShip, wxID_ANY,
2074 _(
"Own ship's MMSI. (If available) Nine digits"));
2075 ownmmsisizer->Add(pStatic_ownshipmmsi, 0);
2078 const wxString AllowDigits[] = {
"0",
"1",
"2",
"3",
"4",
2079 "5",
"6",
"7",
"8",
"9"};
2080 wxArrayString ArrayAllowDigits(10, AllowDigits);
2081 wxTextValidator mmsiVal(wxFILTER_INCLUDE_CHAR_LIST);
2082 mmsiVal.SetIncludes(ArrayAllowDigits);
2083 m_pTxt_OwnMMSI =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"",
2084 wxDefaultPosition, wxDefaultSize, 0, mmsiVal);
2085 ownmmsisizer->Add(m_pTxt_OwnMMSI, 0, wxALIGN_RIGHT);
2088 wxStaticBox* trackText =
2089 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2090 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2091 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2092 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2094 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2095 _(
"Automatic Daily Tracks at midnight"));
2097 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2100 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2102#if wxUSE_TIMEPICKCTRL
2103 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2106 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2107 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2108 wxDefaultPosition, wxDefaultSize, 0);
2111 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2112 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2113 wxDefaultPosition, wxDefaultSize, 0);
2115 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2119 pTrackRotateComputerTime =
2120 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2121 wxDefaultPosition, wxDefaultSize, 0);
2122 trackSizer1->Add(pTrackRotateComputerTime, 0,
2123 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2126 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2127 wxDefaultPosition, wxDefaultSize, 0);
2128 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2132 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2133 wxDefaultPosition, wxDefaultSize, 0);
2134 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2137 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2139 wxFlexGridSizer* hTrackGrid =
2140 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2141 hTrackGrid->AddGrowableCol(1);
2142 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2145 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2146 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2148 wxStaticText* trackColourText =
2149 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Color"));
2150 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2153 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2154 m_colourPickerDefaultSize, 0, wxDefaultValidator,
"ID_COLOURTRACKCOLOUR");
2155 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2157 wxFlexGridSizer* pTrackGrid =
2158 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2159 pTrackGrid->AddGrowableCol(1);
2160 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2162 wxStaticText* tpText =
2163 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2164 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2166 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2167 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2168 m_pShipIconType->GetSize(), 3, trackAlt);
2169 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2170 group_item_spacing);
2173void options::CreatePanel_Routes(
size_t parent,
int border_size,
2174 int group_item_spacing) {
2175 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2177 Routes =
new wxBoxSizer(wxVERTICAL);
2178 itemPanelRoutes->SetSizer(Routes);
2180 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2182 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
2183 "6",
"7",
"8",
"9",
"10"};
2186 wxStaticBox* routeText =
2187 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2188 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2189 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2191 wxStaticBox* activeRouteText =
2192 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2193 wxStaticBoxSizer* activeRouteSizer =
2194 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2196 m_persist_active_route_chkbox =
new wxCheckBox(
2197 itemPanelRoutes, wxID_ANY,
2198 _(
"Persist active route, automatically activate on start up"));
2199 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2200 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2202 routeSizer->AddSpacer(5);
2205 wxFlexGridSizer* routepointiconSelect =
2206 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2207 routepointiconSelect->AddGrowableCol(1);
2208 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2211 wxStaticText* routepointiconTxt =
2212 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2213 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2214 group_item_spacing);
2217 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2218 0, NULL, wxCB_READONLY);
2219 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2220 wxALIGN_RIGHT | wxALL, group_item_spacing);
2222 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2225 int min_size = GetCharHeight() * 2;
2226 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2227 pRoutepointDefaultIconChoice->SetMinSize(
2228 wxSize(GetCharHeight() * 15, min_size));
2230 routeSizer->AddSpacer(5);
2232 wxFlexGridSizer* pRouteGrid =
2233 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2234 pRouteGrid->AddGrowableCol(1);
2235 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2237 wxStaticText* raText =
new wxStaticText(itemPanelRoutes, wxID_STATIC,
2238 _(
"Waypoint Arrival Distance (NMi)"));
2239 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2241 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2242 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2243 group_item_spacing);
2245 pAdvanceRouteWaypointOnArrivalOnly =
2246 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2247 _(
"Advance route waypoint on arrival only"));
2248 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2251 Routes->AddSpacer(8 * group_item_spacing);
2253 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2254 wxDefaultSize, wxLI_HORIZONTAL);
2255 Routes->Add(pln, 0, wxEXPAND);
2259 wxStaticBox* waypointText =
2260 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2261 wxStaticBoxSizer* waypointSizer =
2262 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2263 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2265 waypointSizer->AddSpacer(5);
2268 wxFlexGridSizer* waypointiconSelect =
2269 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2270 waypointiconSelect->AddGrowableCol(1);
2271 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2274 wxStaticText* waypointiconTxt =
2275 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2276 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2277 group_item_spacing);
2280 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2281 0, NULL, wxCB_READONLY);
2282 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2283 group_item_spacing);
2285 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2288 int rmin_size = GetCharHeight() * 2;
2289 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2290 pWaypointDefaultIconChoice->SetMinSize(
2291 wxSize(GetCharHeight() * 15, rmin_size));
2293 waypointSizer->AddSpacer(5);
2295 wxFlexGridSizer* ScaMinSizer =
2296 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2297 ScaMinSizer->AddGrowableCol(1);
2298 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2300 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2301 _(
"Show marks only at a chartscale greater than 1 :"));
2302 ScaMinSizer->Add(pScaMinChckB, 0);
2303 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2304 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2305 group_item_spacing);
2307 wxFlexGridSizer* ScaMaxSizer =
2308 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2309 ScaMaxSizer->AddGrowableCol(1);
2310 waypointSizer->Add(ScaMaxSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2311 wxStaticText* scaMaxLabel =
2312 new wxStaticText(itemPanelRoutes, wxID_ANY,
2313 _(
"Show marks only at a chartscale smaller than 1 :"));
2314 ScaMaxSizer->Add(scaMaxLabel, 0);
2315 m_pText_ScaMax =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2316 ScaMaxSizer->Add(m_pText_ScaMax, 0, wxALL | wxALIGN_RIGHT,
2317 group_item_spacing);
2320 pScaMinOverruleChckB =
2321 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2322 _(
"Override the settings for chartscale based visibility "
2323 "and show always"));
2324 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2326 waypointSizer->AddSpacer(5);
2328 wxFlexGridSizer* waypointrrSelect =
2329 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2330 waypointrrSelect->AddGrowableCol(1);
2331 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2334 wxStaticText* waypointrrTxt =
2335 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2336 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2338 pWaypointRangeRingsNumber =
2339 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2340 m_pShipIconType->GetSize(), 11, rrAlt);
2341 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2342 group_item_spacing);
2345 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2346 waypointradarGrid->AddGrowableCol(1);
2347 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2349 wxStaticText* waypointdistanceText =
new wxStaticText(
2350 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2351 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2352 group_item_spacing);
2354 pWaypointRangeRingsStep =
2355 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2356 wxSize(100, -1), 0);
2357 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2358 group_item_spacing);
2360 wxStaticText* waypointunitText =
2361 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2362 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2363 group_item_spacing);
2365 m_itemWaypointRangeRingsUnits =
2366 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2367 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2368 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2369 wxALIGN_RIGHT | wxALL, border_size);
2371 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2372 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colors"));
2373 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2376 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2377 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2378 "ID_COLOURWAYPOINTRANGERINGSCOLOUR");
2379 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2380 wxALIGN_RIGHT | wxALL, 1);
2385 Routes->AddSpacer(8 * group_item_spacing);
2386 wxStaticLine* pln1 =
2387 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2388 wxDefaultSize, wxLI_HORIZONTAL);
2389 Routes->Add(pln1, 0, wxEXPAND);
2392 wxStaticBox* waypointControl =
2393 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2394 wxStaticBoxSizer* ControlSizer =
2395 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2396 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2398 ControlSizer->AddSpacer(5);
2400 pWayPointPreventDragging =
new wxCheckBox(
2401 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2402 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2403 pWayPointPreventDragging->SetValue(FALSE);
2404 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2406 pConfirmObjectDeletion =
2407 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2408 _(
"Confirm deletion of tracks and routes"));
2409 pConfirmObjectDeletion->SetValue(FALSE);
2410 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2411 ControlSizer->AddSpacer(5);
2414 pWaypointDefaultIconChoice->Clear();
2416 bool fillCombo =
true;
2419 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2420 wxString* ps = pWayPointMan->GetIconDescription(i);
2421 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2423 pWaypointDefaultIconChoice->Append(*ps, bmp);
2428 int iconToSelect = -1;
2429 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2430 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2432 pWaypointDefaultIconChoice->Select(iconToSelect);
2438 pRoutepointDefaultIconChoice->Clear();
2443 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2444 wxString* ps = pWayPointMan->GetIconDescription(i);
2445 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2447 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2453 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2454 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2456 pRoutepointDefaultIconChoice->Select(iconToSelect);
2464void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2465 int group_item_spacing) {
2466 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2468 chartPanel =
new wxBoxSizer(wxVERTICAL);
2469 chartPanelWin->SetSizer(chartPanel);
2471 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2472 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2473 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2475 m_scrollWinChartList =
new wxScrolledWindow(
2476 chartPanelWin, wxID_ANY, wxDefaultPosition,
2477 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2479 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2486 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2488 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2489 m_scrollWinChartList->SetSizer(boxSizerCharts);
2491 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2492 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2494 wxString b1 = _(
"Add Directory...");
2495 wxString b2 = _(
"Remove Selected");
2496 wxString b3 = _(
"Compress Selected");
2504 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2505 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2507 cmdButtonSizer->AddSpacer(GetCharHeight());
2509 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2510 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2511 m_removeBtn->Disable();
2513 cmdButtonSizer->AddSpacer(GetCharHeight());
2516 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2517 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2518 m_compressBtn->Disable();
2520 m_compressBtn = NULL;
2524 if (g_Android_SDK_Version >= 30) {
2526 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2527 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2531 cmdButtonSizer->AddSpacer(GetCharHeight());
2533 wxStaticBox* itemStaticBoxUpdateStatic =
2534 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2535 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2536 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2537 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2539 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2540 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2542 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2543 _(
"Scan Charts and Update Database"));
2544 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2546 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2547 _(
"Force Full Database Rebuild"));
2549 pUpdateCheckBox->Hide();
2551 pRebuildChartDatabase =
new wxButton(chartPanelWin, ID_REBUILDBUTTON,
2552 _(
"Rebuild Chart Database"));
2553 itemFlexGridSizerUpdate->Add(pRebuildChartDatabase, 1, wxALL, 5);
2555 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2556 _(
"Prepare all ENC Charts"));
2557 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2559 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2562 ActiveChartArray.Clear();
2563 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2564 ActiveChartArray.Add(m_CurrentDirList[i]);
2567 UpdateChartDirList();
2569 chartPanel->Layout();
2572void options::UpdateChartDirList() {
2574 m_scrollWinChartList->GetSizer()->Clear(
true);
2575 m_scrollWinChartList->ClearBackground();
2577 panelVector.clear();
2580 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2583 wxSize(-1, -1), ActiveChartArray[i]);
2584 chartPanel->SetSelected(
false);
2586 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2588 panelVector.push_back(chartPanel);
2591 m_scrollWinChartList->GetSizer()->Layout();
2593 chartPanelWin->ClearBackground();
2594 chartPanelWin->Layout();
2603 wxSize sza = GetSize();
2608 m_scrollWinChartList->GetParent()->Layout();
2611 m_scrollWinChartList->Scroll(0, 0);
2614void options::UpdateTemplateTitleText() {
2615 if (!m_templateTitleText)
return;
2617 wxString activeTitle;
2618 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2619 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2621 bool configCompare =
2622 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2623 if (!configCompare) activeTitle += _(
" [Modified]");
2624 m_templateTitleText->SetLabel(activeTitle);
2626 m_templateTitleText->SetLabel(_(
"None"));
2629void options::CreatePanel_Configs(
size_t parent,
int border_size,
2630 int group_item_spacing) {
2631 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2637 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2638 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2642 wxStaticBox* templateStatusBox =
2643 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2644 m_templateStatusBoxSizer =
2645 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2646 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2649 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2650 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2652 m_staticTextLastAppled =
new wxStaticText(
2653 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2654 m_staticTextLastAppled->Hide();
2656 statSizer->Add(m_staticTextLastAppled);
2658 m_templateTitleText =
2659 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2660 statSizer->Add(m_templateTitleText);
2661 m_templateTitleText->Hide();
2663 UpdateTemplateTitleText();
2665 wxStaticBox* configsBox =
2666 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2667 wxStaticBoxSizer* configSizer =
2668 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2669 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2671 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2672 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2674 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2675 cPanel->SetSizer(boxSizercPanel);
2677 m_scrollWinConfigList =
2678 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2679 wxBORDER_RAISED | wxVSCROLL);
2680 m_scrollWinConfigList->SetScrollRate(1, 1);
2681 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2683 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2685 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2686 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2688 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2689 configSizer->Add(btnSizer);
2692 wxButton* createButton =
2693 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2694 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2695 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2696 wxCommandEventHandler(options::OnCreateConfig), NULL,
2704 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2705 _(
"Delete Selected Config..."));
2706 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2707 group_item_spacing);
2708 m_configDeleteButton->Connect(
2709 wxEVT_COMMAND_BUTTON_CLICKED,
2710 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2712 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2713 _(
"Apply Selected Config"));
2714 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2715 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2716 wxCommandEventHandler(options::OnApplyConfig),
2723 SetConfigButtonState();
2727void options::ClearConfigList() {
2728 if (m_scrollWinConfigList) {
2729 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2730 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2731 wxWindowListNode* node = kids.Item(i);
2732 wxWindow* win = node->GetData();
2733 auto pcp =
dynamic_cast<wxPanel*
>(win);
2742 SetConfigButtonState();
2745void options::BuildConfigList() {
2746 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2748 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2750 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2752 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2753 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2754 pp->Connect(wxEVT_LEFT_DOWN,
2755 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2759 wxWindowList kids = pp->GetChildren();
2760 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2761 wxWindowListNode* node = kids.Item(i);
2762 wxWindow* win = node->GetData();
2763 win->Connect(wxEVT_LEFT_DOWN,
2764 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2770 m_boxSizerConfigs->Layout();
2772 m_selectedConfigPanelGUID =
"";
2773 SetConfigButtonState();
2776void options::SetConfigButtonState() {
2777 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2778 if (m_selectedConfigPanelGUID.StartsWith(
2780 m_configDeleteButton->Disable();
2781 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2784void options::OnCreateConfig(wxCommandEvent& event) {
2786 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2788 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2789 if (retcode == wxID_OK) {
2790 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2791 UpdateTemplateTitleText();
2795 m_DisplayConfigsPage->Layout();
2797 SetConfigButtonState();
2801void options::OnEditConfig(wxCommandEvent& event) {}
2803void options::OnDeleteConfig(wxCommandEvent& event) {
2804 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2806 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2807 m_selectedConfigPanelGUID =
"";
2812 m_DisplayConfigsPage->Layout();
2813 SetConfigButtonState();
2816void options::OnApplyConfig(wxCommandEvent& event) {
2817 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2820 wxString currentLocale = g_locale;
2824 evt.SetId(ID_APPLY);
2828 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2832 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2833 wxString activeTitle =
2834 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2835 m_templateTitleText->SetLabel(activeTitle);
2836 m_templateTitleText->Show();
2837 m_staticTextLastAppled->Show();
2838 m_templateStatusBoxSizer->Layout();
2840 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2841 _(
"OpenCPN Info"), wxOK);
2844 if (m_scrollWinConfigList) {
2845 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2846 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2847 wxWindowListNode* node = kids.Item(i);
2848 wxWindow* win = node->GetData();
2849 auto pcp =
dynamic_cast<wxPanel*
>(win);
2853 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2858 m_selectedConfigPanelGUID = wxEmptyString;
2860 m_returnChanges |= CONFIG_CHANGED;
2862 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2867void options::OnConfigMouseSelected(wxMouseEvent& event) {
2868 wxPanel* selectedPanel = NULL;
2869 wxObject* obj =
event.GetEventObject();
2871 auto panel =
dynamic_cast<wxPanel*
>(obj);
2873 selectedPanel = panel;
2877 auto win =
dynamic_cast<wxWindow*
>(obj);
2879 auto parentpanel =
dynamic_cast<wxPanel*
>(win->GetParent());
2881 selectedPanel = parentpanel;
2886 if (m_scrollWinConfigList) {
2887 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2888 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2889 wxWindowListNode* node = kids.Item(i);
2890 wxWindow* win = node->GetData();
2891 auto panel =
dynamic_cast<wxPanel*
>(win);
2893 if (panel == selectedPanel) {
2894 panel->SetBackgroundColour(wxSystemSettings::GetColour(
2895 wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
2897 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
2899 panel->SetBackgroundColour(m_panelBackgroundUnselected);
2901 panel->Refresh(
true);
2905 m_DisplayConfigsPage->Layout();
2906 SetConfigButtonState();
2910void options::CreatePanel_Advanced(
size_t parent,
int border_size,
2911 int group_item_spacing) {
2912 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
2916 double dpmm = g_Platform->GetDisplayDPmm();
2918 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2919 m_ChartDisplayPage->SetSizer(wrapperSizer);
2921 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
2924 itemBoxSizerUI->Add(0, border_size * 3);
2925 itemBoxSizerUI->Add(0, border_size * 3);
2928 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
2929 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
2931 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
2932 _(
"De-skew Raster Charts"));
2933 boxCharts->Add(pSkewComp, inputFlags);
2935 itemBoxSizerUI->Add(0, border_size * 3);
2936 itemBoxSizerUI->Add(0, border_size * 3);
2940 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
2941 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
2943 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
2944 _(
"Use Accelerated Graphics (OpenGL)"));
2945 OpenGLSizer->Add(pOpenGL, inputFlags);
2946 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
2948 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
2949 _(
"OpenGL Options") +
"...");
2950 OpenGLSizer->Add(bOpenGL, inputFlags);
2952 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
2953 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
2958 itemBoxSizerUI->Add(0, border_size * 3);
2959 itemBoxSizerUI->Add(0, border_size * 3);
2963 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
2964 _(
"Chart Rotation Averaging Time"));
2966 wrapperSizer->Add(crat, 0,
2967 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
2968 group_item_spacing);
2970 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
2971 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
2974 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2975 wxSize(sz.x / 5, -1), wxTE_RIGHT);
2976 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
2977 group_item_spacing);
2979 pCOGUPFilterRow->Add(
2980 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
2983 itemBoxSizerUI->Add(0, border_size * 3);
2984 itemBoxSizerUI->Add(0, border_size * 3);
2987 wxStaticText* zoomTextHead =
new wxStaticText(
2988 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
2989 zoomTextHead->Wrap(-1);
2990 itemBoxSizerUI->Add(
2992 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
2993 group_item_spacing);
2994 itemBoxSizerUI->Add(0, border_size * 1);
2996 itemBoxSizerUI->Add(
2997 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3000 m_pSlider_Zoom_Raster =
3001 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3002 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3005 prepareSlider(m_pSlider_Zoom_Raster);
3008 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3010 itemBoxSizerUI->Add(
3011 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3014 m_pSlider_Zoom_Vector =
3015 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3016 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3019 prepareSlider(m_pSlider_Zoom_Vector);
3022 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3024 itemBoxSizerUI->Add(
3025 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3027 m_pSlider_CM93_Zoom =
3028 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3029 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3030 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3033 prepareSlider(m_pSlider_CM93_Zoom);
3036 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3038 itemBoxSizerUI->Add(0, border_size * 3);
3039 itemBoxSizerUI->Add(0, border_size * 3);
3040 itemBoxSizerUI->Add(0, border_size * 3);
3044 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3045 _(
"Physical Screen Width")),
3047 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3048 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3050 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3051 pDPIRow->Add(pRBSizeAuto, inputFlags);
3052 pDPIRow->AddSpacer(10);
3053 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3054 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3055 pDPIRow->Add(pRBSizeManual, inputFlags);
3057 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3058 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3061 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3062 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3063 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3065 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3069 itemBoxSizerUI->Add(
3070 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3072 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3073 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3075 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3076 _(
"Show extended chart bar information."));
3077 ChartBarSizer->Add(pChartBarEX, inputFlags);
3080 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3081 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3083 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3084 wxCommandEventHandler(options::OnSizeManualButton),
3090 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3091 itemBoxSizerUI->SetHGap(border_size);
3098 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3099 m_ChartDisplayPage->SetSizer(wrapperSizer);
3100 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3103 itemBoxSizerUI->Add(0, border_size * 3);
3104 itemBoxSizerUI->Add(0, border_size * 3);
3107 itemBoxSizerUI->Add(
3108 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3110 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3111 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3113 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3114 _(
"Show Skewed Raster Charts as North-Up"));
3115 boxCharts->Add(pSkewComp, verticleInputFlags);
3133 itemBoxSizerUI->Add(0, border_size * 3);
3134 itemBoxSizerUI->Add(0, border_size * 3);
3137 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3138 _(
"Chart Rotation Averaging Time")),
3140 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3141 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3142 group_item_spacing);
3145 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3146 wxSize(50, -1), wxTE_RIGHT);
3147 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3149 pCOGUPFilterRow->Add(
3150 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3154 itemBoxSizerUI->Add(0, border_size * 8);
3155 itemBoxSizerUI->Add(0, border_size * 8);
3158 wxStaticText* zoomTextHead =
new wxStaticText(
3159 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3161 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3162 itemBoxSizerUI->Add(0, border_size * 1);
3163 itemBoxSizerUI->Add(0, border_size * 1);
3165 wxStaticText* zoomText =
new wxStaticText(
3166 m_ChartDisplayPage, wxID_ANY,
3167 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3168With a higher value, the same zoom level shows a more detailed chart."));
3170 smallFont = *dialogFont;
3172 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3174 zoomText->SetFont(smallFont);
3175 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3183 itemBoxSizerUI->Add(
3184 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3186 m_pSlider_Zoom_Raster =
3187 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3188 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3191 prepareSlider(m_pSlider_Zoom_Raster);
3194 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3196 itemBoxSizerUI->Add(
3197 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3199 m_pSlider_Zoom_Vector =
3200 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3201 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3204 prepareSlider(m_pSlider_Zoom_Vector);
3207 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3210 itemBoxSizerUI->Add(0, border_size * 3);
3211 itemBoxSizerUI->Add(0, border_size * 3);
3213 itemBoxSizerUI->Add(
3214 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3216 m_pSlider_CM93_Zoom =
3217 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3218 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3219 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3222 prepareSlider(m_pSlider_CM93_Zoom);
3225 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3228 itemBoxSizerUI->Add(0, border_size * 3);
3229 itemBoxSizerUI->Add(0, border_size * 3);
3230 itemBoxSizerUI->Add(0, border_size * 3);
3231 itemBoxSizerUI->Add(0, border_size * 3);
3232 itemBoxSizerUI->Add(0, border_size * 3);
3233 itemBoxSizerUI->Add(0, border_size * 3);
3237 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3238 _(
"Physical Screen Width")),
3240 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3241 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3243 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3244 pDPIRow->Add(pRBSizeAuto, inputFlags);
3245 pDPIRow->AddSpacer(10);
3246 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3247 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3248 pDPIRow->Add(pRBSizeManual, inputFlags);
3251 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3252 wxSize(3 * m_fontHeight, -1), wxTE_RIGHT);
3253 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3255 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3258 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3259 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3261 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3262 wxCommandEventHandler(options::OnSizeManualButton),
3266 itemBoxSizerUI->Add(0, border_size * 3);
3267 itemBoxSizerUI->Add(0, border_size * 3);
3272 itemBoxSizerUI->Add(
3273 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3275 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3276 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3278 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3279 _(
"Use Accelerated Graphics (OpenGL)"));
3280 OpenGLSizer->Add(pOpenGL, inputFlags);
3281 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3283 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3284 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3290 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3291 _(
"Options") +
"...");
3292 OpenGLSizer->Add(bOpenGL, inputFlags);
3295 itemBoxSizerUI->Add(0, border_size * 3);
3296 itemBoxSizerUI->Add(0, border_size * 3);
3301 itemBoxSizerUI->Add(
3302 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3304 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3305 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3307 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3308 _(
"Show extended chart bar information."));
3309 ChartBarSizer->Add(pChartBarEX, inputFlags);
3321 m_ChartDisplayPage->Fit();
3325void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3326 int group_item_spacing) {
3327 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3330 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3331 ps57Ctl->SetSizer(vectorPanel);
3334 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3335 optionsColumn->SetHGap(border_size);
3336 optionsColumn->AddGrowableCol(0, 2);
3337 optionsColumn->AddGrowableCol(1, 3);
3338 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3341 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3342 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3347 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3349 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3350 _(
"Mariner's Standard")};
3351 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3352 wxDefaultSize, 4, pDispCatStrings);
3353 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3357 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3358 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3361 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3364 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3365 optionsColumn->Add(miscSizer, groupInputFlags);
3369 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3370 pCheck_SOUNDG->SetValue(FALSE);
3371 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3374 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3375 _(
"Chart Information Objects"));
3376 pCheck_META->SetValue(FALSE);
3377 miscSizer->Add(pCheck_META, verticleInputFlags);
3380 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3383 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3384 optionsColumn->Add(lightSizer, groupInputFlags);
3387 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3388 pCheck_ATONTEXT->SetValue(FALSE);
3389 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3392 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3393 pCheck_LDISTEXT->SetValue(FALSE);
3394 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3396 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3397 _(
"Extended Light Sectors"));
3398 pCheck_XLSECTTEXT->SetValue(FALSE);
3399 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3402 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3405 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3406 optionsColumn->Add(textSizer, groupInputFlags);
3408 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3409 _(
"National text on chart"));
3410 pCheck_NATIONALTEXT->SetValue(FALSE);
3411 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3413 pCheck_SHOWIMPTEXT =
3414 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3415 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3416 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3419 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3420 pCheck_DECLTEXT->SetValue(FALSE);
3421 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3423 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3425 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3426 _(
"Reduced Detail at Small Scale"));
3427 pCheck_SCAMIN->SetValue(FALSE);
3428 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3430 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3431 pCheck_SuperSCAMIN =
3432 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3433 _(
"Additional detail reduction at Small Scale"));
3434 pCheck_SuperSCAMIN->SetValue(FALSE);
3435 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3438 optionsColumn->Add(0, border_size * 4);
3439 optionsColumn->Add(0, border_size * 4);
3441 wxSize item_size = wxSize(-1, -1);
3443 item_size = wxSize(m_fontHeight * 3, m_fontHeight);
3447 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3449 wxString pPointStyleStrings[] = {
3453 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3454 item_size, 2, pPointStyleStrings);
3455 optionsColumn->Add(pPointStyle, inputFlags);
3457 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3459 wxString pBoundStyleStrings[] = {
3463 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3464 item_size, 2, pBoundStyleStrings);
3465 optionsColumn->Add(pBoundStyle, inputFlags);
3467 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3469 wxString pColorNumStrings[] = {
3473 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3474 item_size, 2, pColorNumStrings);
3475 optionsColumn->Add(p24Color, inputFlags);
3478 optionsColumn->Add(0, border_size * 4);
3479 optionsColumn->Add(0, border_size * 4);
3481 item_size = wxSize(60, -1);
3483 item_size = wxSize(m_fontHeight * 2, m_fontHeight);
3487 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3489 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3490 optionsColumn->Add(depShalRow);
3491 m_ShallowCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3492 item_size, wxTE_RIGHT);
3493 depShalRow->Add(m_ShallowCtl, inputFlags);
3494 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3495 depShalRow->Add(m_depthUnitsShal, inputFlags);
3497 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3499 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3500 optionsColumn->Add(depSafeRow);
3501 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3502 item_size, wxTE_RIGHT);
3503 depSafeRow->Add(m_SafetyCtl, inputFlags);
3504 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3505 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3507 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3509 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3510 optionsColumn->Add(depDeepRow);
3511 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3512 item_size, wxTE_RIGHT);
3513 depDeepRow->Add(m_DeepCtl, inputFlags);
3514 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3515 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3518 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3519 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3521 wxStaticBox* marinersBox =
3522 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3523 wxStaticBoxSizer* marinersSizer =
3524 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3525 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3528 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3529 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3531 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3532 itemButtonSelectList =
3533 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3534 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3535 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3536 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3537 marinersSizer->Add(btnRow1);
3539 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3541 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3542 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3543 marinersSizer->Add(btnRow2);
3548 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3549 ps57Ctl->SetSizer(vectorPanel);
3551 wxBoxSizer* optionsColumn = vectorPanel;
3554 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3559 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3561 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3562 _(
"Mariner's Standard")};
3563 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3564 wxSize(350, -1), 4, pDispCatStrings);
3565 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3568 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3573 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3574 optionsColumn->Add(miscSizer, groupInputFlags);
3577 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3578 pCheck_SOUNDG->SetValue(FALSE);
3579 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3581 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3582 _(
"Chart Information Objects"));
3583 pCheck_META->SetValue(FALSE);
3584 miscSizer->Add(pCheck_META, inputFlags);
3586 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3587 optionsColumn->Add(lightSizer, groupInputFlags);
3590 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3591 pCheck_ATONTEXT->SetValue(FALSE);
3592 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3595 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3596 pCheck_LDISTEXT->SetValue(FALSE);
3597 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3599 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3600 _(
"Extended Light Sectors"));
3601 pCheck_XLSECTTEXT->SetValue(FALSE);
3602 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3604 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3605 optionsColumn->Add(textSizer, groupInputFlags);
3607 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3608 _(
"National text on chart"));
3609 pCheck_NATIONALTEXT->SetValue(FALSE);
3610 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3612 pCheck_SHOWIMPTEXT =
3613 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3614 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3615 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3618 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3619 pCheck_DECLTEXT->SetValue(FALSE);
3620 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3622 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3623 _(
"Reduced Detail at Small Scale"));
3624 pCheck_SCAMIN->SetValue(FALSE);
3625 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3627 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3628 pCheck_SuperSCAMIN =
3629 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3630 _(
"Additional detail reduction at Small Scale"));
3631 pCheck_SuperSCAMIN->SetValue(FALSE);
3632 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3635 optionsColumn->Add(0, border_size * 4);
3636 optionsColumn->Add(0, border_size * 4);
3640 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3641 StyleColumn->SetHGap(border_size);
3642 StyleColumn->AddGrowableCol(0, 2);
3643 StyleColumn->AddGrowableCol(1, 3);
3644 optionsColumn->Add(StyleColumn);
3646 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3648 wxString pPointStyleStrings[] = {
3652 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3653 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3654 pPointStyleStrings);
3656 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3659 StyleColumn->Add(pPointStyle, inputFlags);
3661 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3663 wxString pBoundStyleStrings[] = {
3667 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3668 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3669 pBoundStyleStrings);
3671 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3674 StyleColumn->Add(pBoundStyle, inputFlags);
3676 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3679 wxString pColorNumStrings[] = {
3683 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3684 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3687 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3689 StyleColumn->Add(p24Color, inputFlags);
3692 optionsColumn->Add(0, border_size * 4);
3693 optionsColumn->Add(0, border_size * 4);
3695 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3696 DepthColumn->SetHGap(border_size);
3697 DepthColumn->AddGrowableCol(0, 3);
3698 DepthColumn->AddGrowableCol(1, 2);
3699 DepthColumn->AddGrowableCol(2, 3);
3700 optionsColumn->Add(DepthColumn);
3703 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3706 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3707 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3708 DepthColumn->Add(m_ShallowCtl, inputFlags);
3709 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3710 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3712 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3715 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3716 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3717 DepthColumn->Add(m_SafetyCtl, inputFlags);
3718 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3719 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3721 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3724 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3725 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3726 DepthColumn->Add(m_DeepCtl, inputFlags);
3727 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3728 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3731 optionsColumn->Add(0, border_size * 4);
3732 optionsColumn->Add(0, border_size * 4);
3735 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3736 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3738 wxStaticBox* marinersBox =
3739 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3740 wxStaticBoxSizer* marinersSizer =
3741 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3742 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3744 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3745 itemButtonSelectList =
3746 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3747 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3748 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3749 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3750 marinersSizer->Add(btnRow1);
3752 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3754 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3755 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3756 marinersSizer->Add(btnRow2);
3759 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3761 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3765void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3766 int group_item_spacing) {
3767 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3769 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3770 tcPanel->SetSizer(mainHBoxSizer);
3772 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3773 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3774 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3777 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3778 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3780 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3784 tcDataSelected->DeleteAllItems();
3791 col0.SetAlign(wxLIST_FORMAT_LEFT);
3793 tcDataSelected->InsertColumn(0, col0);
3796 unsigned int id = 0;
3797 for (
auto ds : TideCurrentDataSet) {
3800 tcDataSelected->InsertItem(li);
3802 wxString setName = ds;
3803 tcDataSelected->SetItem(
id, 0, setName);
3804 GetTextExtent(setName, &w1, &h);
3805 w = w1 > w ? w1 : w;
3811 tcDataSelected->SetColumnWidth(0, 20 + w);
3815 wxButton* insertButton =
3816 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3817 wxButton* removeButton =
3818 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3820 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3821 tcSizer->Add(btnSizer);
3823 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3824 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3827void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3828 int group_item_spacing) {
3833 wxNotebook* chartsPageNotebook = (wxNotebook*)m_pListbook->GetPage(parent);
3834 wxScrolledWindow* sw =
new ChartGroupsUI(chartsPageNotebook);
3835 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3836 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3839 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3842void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3843 int group_item_spacing) {
3845 m_border_size = border_size;
3846 m_group_item_spacing = group_item_spacing;
3848 m_UIcomplete = FALSE;
3853void ChartGroupsUI::CompletePanel() {
3855 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3856 m_panel->SetSizer(m_topSizer);
3859 wxStaticText* allChartsLabel =
3860 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3861 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3863 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3864 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3866 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3867 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3871 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3872 wxDefaultSize, wxVSCROLL);
3875 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3876 wxDefaultSize, wxVSCROLL);
3878 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3880 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3881 m_pAddButton->Disable();
3882 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3883 m_pRemoveButton->Disable();
3885 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3886 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3888 m_pRemoveButton->Connect(
3889 wxEVT_COMMAND_BUTTON_CLICKED,
3890 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3892 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3893 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3894 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3896 sizerCharts->AddSpacer(20);
3899 wxStaticText* groupsLabel =
3900 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3901 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3903 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
3904 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
3906 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
3907 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
3908 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
3909 wxDefaultSize, wxNB_TOP);
3910 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
3912 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
3913 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
3917 wxPanel* allActiveGroup =
3918 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
3919 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
3921 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
3922 allActiveGroup->SetSizer(page0BoxSizer);
3924 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1,
"",
3925 wxDefaultPosition, wxDefaultSize);
3928 iFont =
new wxFont(*dialogFont);
3929 iFont->SetStyle(wxFONTSTYLE_ITALIC);
3930 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
3932 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
3934 m_DirCtrlArray.Add(defaultAllCtl);
3938 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
3939 m_pDeleteGroupButton =
3940 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
3941 m_pDeleteGroupButton->Disable();
3943 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3944 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
3946 m_pDeleteGroupButton->Connect(
3947 wxEVT_COMMAND_BUTTON_CLICKED,
3948 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
3950 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
3951 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
3953 newDeleteGrp->AddSpacer(25);
3954 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
3955 m_group_item_spacing);
3956 newDeleteGrp->AddSpacer(15);
3957 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
3958 m_group_item_spacing);
3959 newDeleteGrp->AddSpacer(25);
3960 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3962 sizerGroups->AddSpacer(20);
3966 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
3967 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
3970 m_UIcomplete = TRUE;
3973void options::CreatePanel_Display(
size_t parent,
int border_size,
3974 int group_item_spacing) {
3975 pDisplayPanel = AddPage(parent, _(
"General"));
3978 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
3979 generalSizer->SetHGap(border_size);
3986 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3987 pDisplayPanel->SetSizer(wrapperSizer);
3988 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
3991 generalSizer->Add(0, border_size * 4);
3992 generalSizer->Add(0, border_size * 4);
3997 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
3999 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4000 generalSizer->Add(boxNavMode, groupInputFlags);
4002 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4003 boxNavMode->Add(rowOrientation);
4005 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4006 rowOrientation->Add(pCBNorthUp, inputFlags);
4008 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4009 rowOrientation->Add(pCBCourseUp,
4011 .Align(wxALIGN_CENTRE_VERTICAL)
4012 .Border(wxLEFT, group_item_spacing * 2));
4014 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4015 _(
"Look Ahead Mode"));
4016 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4019 generalSizer->Add(0, border_size * 4);
4020 generalSizer->Add(0, border_size * 4);
4024 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4026 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4027 generalSizer->Add(boxCharts, groupInputFlags);
4029 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4030 _(
"Enable Chart Quilting"));
4031 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4034 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4035 _(
"Preserve scale when switching charts"));
4036 boxCharts->Add(pPreserveScale, verticleInputFlags);
4039 generalSizer->Add(0, border_size * 4);
4040 generalSizer->Add(0, border_size * 4);
4044 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4046 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4047 generalSizer->Add(boxCtrls, groupInputFlags);
4049 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4050 _(
"Smooth Panning / Zooming"));
4051 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4053 pEnableZoomToCursor =
4054 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4055 pEnableZoomToCursor->SetValue(FALSE);
4056 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4058 pEnableTenHertz =
nullptr;
4060 pEnableTenHertz =
new wxCheckBox(pDisplayPanel, ID_TENHZCHECKBOX,
4061 _(
"Enable Ten Hz screen update"));
4062 pEnableTenHertz->SetValue(FALSE);
4063 boxCtrls->Add(pEnableTenHertz, verticleInputFlags);
4068 generalSizer->Add(0, border_size * 4);
4069 generalSizer->Add(0, border_size * 4);
4073 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4075 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4076 generalSizer->Add(boxDisp, groupInputFlags);
4079 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4080 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4082 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4083 _(
"Show Chart Outlines"));
4084 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4086 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4087 _(
"Show Depth Units"));
4088 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4098 generalSizer->Add(0, border_size * 4);
4099 generalSizer->Add(0, border_size * 4);
4103 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4105 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4106 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4109 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4110 _(
"Live ETA at Cursor"));
4111 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4115 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4116 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4118 m_Text_def_boat_speed =
new wxStaticText(
4119 pDisplayPanel, wxID_ANY,
4120 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4122 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4123 pSDefaultBoatSpeed =
4124 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4125 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4126 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4127 group_item_spacing);
4134 if (g_Platform->GetDisplayAreaCM2() > 100) {
4135 wxStaticBox* itemStaticBoxScreenConfig =
4136 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4137 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4138 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4139 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4142 wxString iconDir = g_Platform->GetSharedDataDir();
4143 appendOSDirSlash(&iconDir);
4144 iconDir.append(
"uidata");
4145 appendOSDirSlash(&iconDir);
4146 iconDir.append(
"MUI_flat");
4147 appendOSDirSlash(&iconDir);
4148 int bmpSize = GetCharHeight() * 3;
4150 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4151 m_sconfigSelect_single =
4153 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4156 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4158 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4159 m_sconfigSelect_twovertical =
4161 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4164 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4169 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4170 generalSizer->SetHGap(border_size);
4177 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4178 pDisplayPanel->SetSizer(wrapperSizer);
4179 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4182 generalSizer->Add(0, border_size * 4);
4183 generalSizer->Add(0, border_size * 4);
4188 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4190 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4191 generalSizer->Add(boxNavMode, groupInputFlags);
4193 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4194 boxNavMode->Add(rowOrientation);
4196 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4197 rowOrientation->Add(pCBNorthUp, inputFlags);
4199 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4200 rowOrientation->Add(pCBCourseUp,
4202 .Align(wxALIGN_CENTRE_VERTICAL)
4203 .Border(wxLEFT, group_item_spacing * 2));
4205 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4206 _(
"Look Ahead Mode"));
4207 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4210 generalSizer->Add(0, border_size * 4);
4211 generalSizer->Add(0, border_size * 4);
4215 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4217 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4218 generalSizer->Add(boxCharts, groupInputFlags);
4220 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4221 _(
"Enable Chart Quilting"));
4222 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4225 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4226 _(
"Preserve scale when switching charts"));
4227 boxCharts->Add(pPreserveScale, verticleInputFlags);
4230 generalSizer->Add(0, border_size * 4);
4231 generalSizer->Add(0, border_size * 4);
4235 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4237 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4238 generalSizer->Add(boxCtrls, groupInputFlags);
4240 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4241 _(
"Smooth Panning / Zooming"));
4242 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4243 pEnableZoomToCursor =
4244 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4245 pEnableZoomToCursor->SetValue(FALSE);
4246 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4249 pSmoothPanZoom->Hide();
4250 pEnableZoomToCursor->Hide();
4254 generalSizer->Add(0, border_size * 4);
4255 generalSizer->Add(0, border_size * 4);
4260 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4262 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4263 generalSizer->Add(boxDisp, groupInputFlags);
4266 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4267 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4269 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4270 _(
"Show Chart Outlines"));
4271 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4273 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4274 _(
"Show Depth Units"));
4275 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4285 generalSizer->Add(0, border_size * 4);
4286 generalSizer->Add(0, border_size * 4);
4290 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4292 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4293 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4296 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4297 _(
"Live ETA at Cursor"));
4298 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4302 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4303 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4304 m_Text_def_boat_speed =
new wxStaticText(
4305 pDisplayPanel, wxID_ANY,
4306 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4307 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4308 pSDefaultBoatSpeed =
4309 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4310 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4311 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4312 group_item_spacing);
4318 if (g_Platform->GetDisplayAreaCM2() > 100) {
4320 wxStaticBox* itemStaticBoxScreenConfig =
4321 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4322 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4323 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4324 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4327 wxString iconDir = g_Platform->GetSharedDataDir();
4328 appendOSDirSlash(&iconDir);
4329 iconDir.append(
"uidata");
4330 appendOSDirSlash(&iconDir);
4331 iconDir.append(
"MUI_flat");
4332 appendOSDirSlash(&iconDir);
4333 int bmpSize = GetCharHeight() * 3;
4335 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4336 m_sconfigSelect_single =
4338 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4341 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4343 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4344 m_sconfigSelect_twovertical =
4346 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4349 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4355void options::CreatePanel_Units(
size_t parent,
int border_size,
4356 int group_item_spacing) {
4357 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4360 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4361 unitsSizer->SetHGap(border_size);
4365 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4366 panelUnits->SetSizer(wrapperSizer);
4368 wrapperSizer->Add(1, border_size * 24);
4369 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4372 unitsSizer->Add(0, border_size * 4);
4373 unitsSizer->Add(0, border_size * 4);
4376 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4378 wxString pDistanceFormats[kNumDistanceFormats];
4379 for (
int i = 0; i < kNumDistanceFormats; i++) {
4380 pDistanceFormats[i] = kDistanceFormats[i].label;
4382 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4384 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4385 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4388 pDistanceFormat->SetToolTip(ttDistance());
4390 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4392 unitsSizer->Add(pDistanceFormat, inputFlags);
4395 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4397 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4398 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4399 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4400 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4401 m_SpeedFormatsNChoices, pSpeedFormats);
4402 pSpeedFormat->SetToolTip(ttSpeed());
4404 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4406 unitsSizer->Add(pSpeedFormat, inputFlags);
4409 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4411 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4412 int m_WindSpeedFormatsNChoices =
4413 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4415 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4416 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4418 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4420 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4422 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4425 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4427 wxString pDepthUnitStrings[] = {
4433 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4434 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4436 pDepthUnitSelect->SetToolTip(ttDepth());
4438 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4440 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4443 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4445 wxString pHeightUnitStrings[] = {
4450 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4451 wxSize(m_fontHeight * 4, -1), 2, pHeightUnitStrings);
4454 pHeightUnitSelect->SetToolTip(ttHeight());
4456 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4458 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4461 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4463 wxString pTempUnitStrings[] = {
4469 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4470 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4471 pTempFormat->SetToolTip(ttTemp());
4473 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4475 unitsSizer->Add(pTempFormat, inputFlags);
4478 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4479 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4482 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4484 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4485 _(
"Decimal Degrees"),
4486 _(
"Degrees, Minutes, Seconds")};
4487 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4488 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4489 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4490 m_SDMMFormatsNChoices, pSDMMFormats);
4491 pSDMMFormat->SetToolTip(ttCoordFormat());
4493 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4495 unitsSizer->Add(pSDMMFormat, inputFlags);
4498 unitsSizer->Add(0, border_size * 4);
4499 unitsSizer->Add(0, border_size * 4);
4503 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4506 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4507 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4508 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4509 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4512 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4513 wxDefaultPosition, wxDefaultSize, 0);
4515 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4516 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4517 wxDefaultPosition, wxDefaultSize, 0);
4519 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4522 unitsSizer->Add(0, border_size * 4);
4523 unitsSizer->Add(0, border_size * 4);
4526 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4531 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4532 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4533 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4536 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4537 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4538 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4542 wxStaticBox* itemStaticBoxVar =
new wxStaticBox(panelUnits, wxID_ANY,
"");
4544 wxStaticBoxSizer* itemStaticBoxSizerVar =
4545 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4546 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4548 itemStaticBoxSizerVar->Add(0, border_size * 4);
4550 itemStaticTextUserVar =
4551 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4552 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4553 group_item_spacing);
4555 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4556 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4557 group_item_spacing);
4559 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4560 wxSize(150, -1), wxTE_RIGHT);
4561 magVarSizer->AddSpacer(100);
4563 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4565 itemStaticTextUserVar2 =
4566 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4568 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4569 group_item_spacing);
4571 itemStaticBoxSizerVar->Add(0, border_size * 40);
4574 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4575 unitsSizer->SetHGap(border_size);
4577 int item_h_size = -1;
4579 item_h_size = m_fontHeight * 4;
4584 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4585 panelUnits->SetSizer(wrapperSizer);
4586 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4589 unitsSizer->Add(0, border_size * 4);
4590 unitsSizer->Add(0, border_size * 4);
4593 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4595 wxString pDistanceFormats[kNumDistanceFormats];
4596 for (
int i = 0; i < kNumDistanceFormats; i++) {
4597 pDistanceFormats[i] = kDistanceFormats[i].label;
4599 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4600 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4601 wxDefaultPosition, wxSize(item_h_size, -1),
4602 m_DistanceFormatsNChoices, pDistanceFormats);
4603 pDistanceFormat->SetToolTip(ttDistance());
4605 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4607 unitsSizer->Add(pDistanceFormat, inputFlags);
4610 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4612 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4613 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4614 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4615 wxDefaultPosition, wxSize(item_h_size, -1),
4616 m_SpeedFormatsNChoices, pSpeedFormats);
4617 pSpeedFormat->SetToolTip(ttSpeed());
4619 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4621 unitsSizer->Add(pSpeedFormat, inputFlags);
4624 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4626 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4627 int m_WindSpeedFormatsNChoices =
4628 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4629 pWindSpeedFormat =
new wxChoice(
4630 panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4631 wxSize(item_h_size, -1), m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4632 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4634 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4636 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4639 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4641 wxString pDepthUnitStrings[] = {
4647 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4648 wxSize(item_h_size, -1), 3, pDepthUnitStrings);
4649 pDepthUnitSelect->SetToolTip(ttDepth());
4651 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4653 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4656 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4658 wxString pHeightUnitStrings[] = {
4663 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4664 wxSize(item_h_size, -1), 2, pHeightUnitStrings);
4665 pHeightUnitSelect->SetToolTip(ttHeight());
4667 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4669 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4672 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4674 wxString pTempUnitStrings[] = {
4680 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4681 wxSize(item_h_size, -1), 3, pTempUnitStrings);
4682 pTempFormat->SetToolTip(ttTemp());
4684 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4686 unitsSizer->Add(pTempFormat, inputFlags);
4689 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4690 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4693 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4695 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4696 _(
"Decimal Degrees"),
4697 _(
"Degrees, Minutes, Seconds")};
4698 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4699 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4700 wxDefaultPosition, wxSize(item_h_size, -1),
4701 m_SDMMFormatsNChoices, pSDMMFormats);
4702 pSDMMFormat->SetToolTip(ttCoordFormat());
4704 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4706 unitsSizer->Add(pSDMMFormat, inputFlags);
4709 unitsSizer->Add(0, border_size * 4);
4710 unitsSizer->Add(0, border_size * 4);
4714 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4717 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4718 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4719 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4720 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4723 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4724 wxDefaultPosition, wxDefaultSize, 0);
4726 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4727 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4728 wxDefaultPosition, wxDefaultSize, 0);
4730 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4733 unitsSizer->Add(0, border_size * 4);
4734 unitsSizer->Add(0, border_size * 4);
4737 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4740 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4741 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4744 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4745 _(
"Show true bearings and headings"));
4746 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4747 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4748 _(
"Show magnetic bearings and headings."));
4749 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4751 bearingsSizer->AddSpacer(10);
4754 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4755 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4757 itemStaticTextUserVar =
4758 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4759 itemStaticTextUserVar->SetLabel(
4760 _(
"WMM Plugin calculated magnetic variation"));
4762 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4763 group_item_spacing);
4765 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4766 wxSize(50, -1), wxTE_RIGHT);
4767 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4769 itemStaticTextUserVar2 =
4770 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4771 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4772 group_item_spacing);
4774 bearingsSizer->AddSpacer(10);
4776 wxStaticText* varText =
4777 new wxStaticText(panelUnits, wxID_ANY,
4778 _(
" To set the magnetic variation manually,\n you "
4779 "must disable the WMM plugin."));
4780 smallFont = *dialogFont;
4781 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4783 varText->SetFont(smallFont);
4785 bearingsSizer->Add(varText);
4794 OCPNSoundPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
4795 const wxSize& size, wxString title, wxString checkLegend,
4796 wxString selectLegend, wxString* pSoundFile);
4800 void OnButtonSelectSound(wxCommandEvent& event);
4801 void OnButtonSPTestSound(wxCommandEvent& event);
4802 wxString SelectSoundFile();
4803 void SetSoundFileLabel(wxString file);
4804 wxCheckBox* GetCheckBox() {
return m_pCheck_Sound; }
4805 wxString GetSoundFile() {
return m_sound_file; }
4807 wxCheckBox* m_pCheck_Sound;
4808 wxSize m_small_button_size;
4809 wxString m_sound_file;
4810 wxString* m_pSoundFile;
4811 wxStaticText* m_AudioFileNameText;
4814 wxButton* TestSound;
4815 o_sound::Sound* m_sound;
4821 bool m_soundPlaying;
4823 DECLARE_EVENT_TABLE()
4826#define ID_SELECTSOUND 9341
4827#define ID_TESTSOUND 9342
4830EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4831EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4836 const wxPoint& pos, const wxSize& size,
4837 wxString title, wxString checkLegend,
4838 wxString selectLegend, wxString* pSoundFile)
4839 : wxPanel(parent,
id, pos, size, wxBORDER_NONE), m_soundPlaying(false) {
4840 wxFont* pif = FontMgr::Get().
GetFont(_(
"Dialog"));
4843 m_pSoundFile = pSoundFile;
4844 if (pSoundFile) m_sound_file = *pSoundFile;
4846 m_sound = o_sound::Factory();
4848 int border_size = 4;
4849 int group_item_spacing = 2;
4851 int font_size_y, font_descent, font_lead;
4852 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
4853 m_small_button_size = wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4855 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4856 SetSizer(wrapperSizer);
4858 wxStaticBox* StaticBox1 =
new wxStaticBox(
this, wxID_ANY, title);
4859 wxStaticBoxSizer* StaticBoxSizer1 =
4860 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4861 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4863 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO, checkLegend);
4864 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4867 wxString LabelWrapped;
4873 g_pOptions->GetSize().x * 8 / 10);
4874 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4875 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4876 LabelWrapped +=
"\n";
4878 LabelWrapped +=
"\n";
4881 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4882 m_AudioFileNameText->Wrap(-1);
4883 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4885 SetSoundFileLabel(m_sound_file);
4888 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4889 soundSizer1->SetHGap(border_size * 2);
4890 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4892 SelSound =
new wxButton(
this, ID_SELECTSOUND, selectLegend, wxDefaultPosition,
4893 m_small_button_size, 0);
4894 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4895 soundSizer1->AddSpacer(group_item_spacing * 4);
4896 TestSound =
new wxButton(
this, ID_TESTSOUND, _(
"Test"), wxDefaultPosition,
4897 m_small_button_size, 0);
4898 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4899 auto sound_action = [
this](
ObservedEvt ev) { m_soundPlaying =
false; };
4900 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4903void OCPNSoundPanel::SetSoundFileLabel(wxString file) {
4904 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " + file);
4907 g_pOptions->GetSize().x * 8 / 10);
4908 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4909 wxString LabelWrapped;
4910 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4912 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4914 LabelWrapped += LabelWrappedArray[i];
4915 LabelWrapped +=
"\n";
4918 m_AudioFileNameText->SetLabel(LabelWrapped);
4922wxString OCPNSoundPanel::SelectSoundFile() {
4923 wxString sound_dir = g_Platform->GetSharedDataDir();
4924 sound_dir.Append(
"sounds");
4929 wxFileDialog* popenDialog =
new wxFileDialog(
4930 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4931 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
4933 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
4935 response = popenDialog->ShowModal();
4936 sel_file = popenDialog->GetPath();
4940 response = g_Platform->DoFileSelectorDialog(
4941 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
4945 if (response == wxID_OK)
4946 return g_Platform->NormalizePath(sel_file);
4951void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4952 wxString sel_file = SelectSoundFile();
4954 if (!sel_file.IsEmpty()) {
4955 m_sound_file = g_Platform->NormalizePath(sel_file);
4956 if (m_pSoundFile) *m_pSoundFile = m_sound_file;
4958 SetSoundFileLabel(m_sound_file);
4963void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
4964 if (!m_soundPlaying) {
4965 m_sound->SetFinishedCallback(
4967 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
4968 m_soundPlaying =
true;
4974void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent& event) {
4975 if (event.IsChecked())
4976 m_pCheck_AlertAudio->SetValue(
true);
4978 if (!m_soundPanelSART->GetCheckBox()->GetValue() &&
4979 !m_soundPanelDSC->GetCheckBox()->GetValue())
4980 m_pCheck_AlertAudio->SetValue(
false);
4984void options::OnUXAudioEnableButtonClickSART(wxCommandEvent& event) {
4985 if (event.IsChecked())
4986 m_pCheck_AlertAudio->SetValue(
true);
4988 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
4989 !m_soundPanelDSC->GetCheckBox()->GetValue())
4990 m_pCheck_AlertAudio->SetValue(
false);
4994void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent& event) {
4995 if (event.IsChecked())
4996 m_pCheck_AlertAudio->SetValue(
true);
4998 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
4999 !m_soundPanelSART->GetCheckBox()->GetValue())
5000 m_pCheck_AlertAudio->SetValue(
false);
5004void options::CreatePanel_Sounds(
size_t parent,
int border_size,
5005 int group_item_spacing) {
5006 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
5008 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
5009 panelSounds->SetSizer(wrapperSizer);
5013 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize,
5014 _(
"Anchor Alarm"), _(
"Play Sound on Anchor Alarm."),
5015 _(
"Select Anchor Alarm Sound"), &g_anchorwatch_sound_file);
5016 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
5020 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"AIS Alert"),
5021 _(
"Play Sound on AIS Alert."), _(
"Select AIS Alert Sound"),
5023 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
5025 m_soundPanelAIS->GetCheckBox()->Connect(
5026 wxEVT_COMMAND_CHECKBOX_CLICKED,
5027 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
5032 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"SART Alert"),
5033 _(
"Play Sound on AIS SART Alert."), _(
"Select AIS SART Alert Sound"),
5034 &g_SART_sound_file);
5035 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
5037 m_soundPanelSART->GetCheckBox()->Connect(
5038 wxEVT_COMMAND_CHECKBOX_CLICKED,
5039 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
5044 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"DSC Alert"),
5045 _(
"Play Sound on DSC notification."), _(
"Select DSC notification Sound"),
5047 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
5049 m_soundPanelDSC->GetCheckBox()->Connect(
5050 wxEVT_COMMAND_CHECKBOX_CLICKED,
5051 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
5055 wxStaticBox* StatBoxSoundConfig =
5056 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
5057 wxStaticBoxSizer* StatBoxSoundConfigSizer =
5058 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
5059 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
5061 auto sound = std::unique_ptr<o_sound::Sound>(o_sound::Factory());
5062 int deviceCount = sound->DeviceCount();
5063 wxLogMessage(
"options: got device count: %d", deviceCount);
5064 if (deviceCount >= 1) {
5065 wxArrayString labels;
5066 for (
int i = 0; i < deviceCount; i += 1) {
5067 wxString label(sound->GetDeviceInfo(i));
5069 std::ostringstream stm;
5071 label = _(
"Unknown device :") + stm.str();
5073 if (!sound->IsOutputDevice(i)) {
5074 std::ostringstream stm;
5076 label = _(
"Input device :") + stm.str();
5083 int iDefault = labels.Index(
"default");
5085 if (g_iSoundDeviceIndex == -1) {
5087 g_iSoundDeviceIndex = iDefault;
5089 g_iSoundDeviceIndex = 0;
5092 pSoundDeviceIndex =
new wxChoice();
5093 if (pSoundDeviceIndex) {
5094 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
5095 wxDefaultSize, labels);
5096 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
5097 pSoundDeviceIndex->Show();
5098 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
5099 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
5100 group_item_spacing);
5102 stSoundDeviceIndex =
5103 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
5104 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
5105 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
5110 if ((
bool)
dynamic_cast<o_sound::SystemCmdSound*
>(o_sound::Factory())) {
5111 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
5112 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND,
5113 group_item_spacing);
5115 new wxTextCtrl(panelSounds, wxID_ANY,
"", wxDefaultPosition,
5116 wxSize(450, -1), wxTE_LEFT);
5118 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
5119 wxALIGN_LEFT | wxALL);
5120 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
5124 if (!deviceCount) StatBoxSoundConfig->Hide();
5127 stSoundDeviceIndex->Hide();
5128 pSoundDeviceIndex->Hide();
5132void options::CreatePanel_MMSI(
size_t parent,
int border_size,
5133 int group_item_spacing) {
5134 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
5136 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
5137 panelMMSI->SetSizer(MMSISizer);
5140 wxStaticBox* itemStaticBoxMMSI =
5141 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
5142 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
5143 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
5144 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
5148 pPropsPanel->UpdateMMSIList();
5150 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
5152 panelMMSI->Layout();
5155void options::CreatePanel_AIS(
size_t parent,
int border_size,
5156 int group_item_spacing) {
5157 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5159 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5160 panelAIS->SetSizer(aisSizer);
5163 wxStaticBox* itemStaticBoxCPA =
5164 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5165 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5166 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5167 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5169 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5170 pCPAGrid->AddGrowableCol(1);
5171 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5173 m_pCheck_CPA_Max =
new wxCheckBox(
5175 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5176 m_pCheck_CPA_Max->SetToolTip(
5177 _(
"Disable CPA (Closest Point of Approach) and TCPA (Time to CPA) alerts "
5178 "for targets beyond this distance from your vessel"));
5179 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5181 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5182 m_pText_CPA_Max->SetToolTip(
5183 _(
"Maximum distance in nautical miles at which Closest Point of Approach "
5184 "alerts will be triggered"));
5185 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5188 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5189 m_pCheck_CPA_Warn->SetToolTip(
5190 _(
"Enable warning alerts when targets have a Closest Point of Approach "
5191 "less than this distance"));
5192 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5195 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5196 m_pText_CPA_Warn->SetToolTip(
5197 _(
"Distance threshold in nautical miles for CPA warning alerts"));
5198 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5200 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5201 wxCommandEventHandler(options::OnCPAWarnClick),
5204 m_pCheck_CPA_WarnT =
5205 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5206 m_pCheck_CPA_WarnT->SetToolTip(
5207 _(
"Additional time constraint - alerts only occur if the Time to Closest "
5208 "Point of Approach is less than this value"));
5209 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5211 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5212 m_pText_CPA_WarnT->SetToolTip(
5213 _(
"Time threshold in minutes for TCPA constraints"));
5214 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5215 group_item_spacing);
5218 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5219 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5220 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5222 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5223 pLostGrid->AddGrowableCol(1);
5224 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5226 m_pCheck_Mark_Lost =
5227 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5228 m_pCheck_Mark_Lost->SetToolTip(
5229 _(
"Targets will be considered lost when no update is received for this "
5231 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5233 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5234 m_pText_Mark_Lost->SetToolTip(
5235 _(
"Time in minutes after which targets with no updates are marked as "
5237 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5238 group_item_spacing);
5240 m_pCheck_Remove_Lost =
5241 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5242 m_pCheck_Remove_Lost->SetToolTip(
5243 _(
"Lost targets will be completely removed from display after this "
5244 "additional time period"));
5245 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5247 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5248 m_pText_Remove_Lost->SetToolTip(_(
5249 "Time in minutes after which lost targets are removed from the display"));
5250 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5251 group_item_spacing);
5253 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5256 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5257 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5258 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5260 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5261 pDisplayGrid->AddGrowableCol(1);
5262 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5264 m_pCheck_Show_COG =
new wxCheckBox(
5265 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5266 m_pCheck_Show_COG->SetToolTip(
5267 _(
"Display a predictor arrow for each AIS target, showing its projected "
5268 "course over ground for the specified number of minutes."));
5269 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5271 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5272 m_pText_COG_Predictor->SetToolTip(
5273 _(
"Set the length in minutes for the COG predictor arrow for AIS "
5275 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5276 group_item_spacing);
5278 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5279 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5280 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5281 m_pCheck_Sync_OCOG_ACOG->Connect(
5282 wxEVT_COMMAND_CHECKBOX_CLICKED,
5283 wxCommandEventHandler(options::OnSyncCogPredClick), NULL,
this);
5285 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1,
"");
5286 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5288 m_pCheck_Show_Tracks =
5289 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5290 m_pCheck_Show_Tracks->SetToolTip(
5291 _(
"Display the recent track (history) of each AIS target for the "
5292 "specified number of minutes."));
5293 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5295 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5296 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5297 group_item_spacing);
5299 m_pCheck_Hide_Moored =
new wxCheckBox(
5300 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5301 m_pCheck_Hide_Moored->SetToolTip(
5302 _(
"Hide AIS targets that are moving slower than this speed, typically "
5303 "indicating they are anchored or moored."));
5304 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5306 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5307 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5308 group_item_spacing);
5310 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5311 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5312 m_pCheck_Draw_Realtime_Prediction->SetToolTip(
5313 _(
"Show a real-time prediction vector for AIS targets moving faster than "
5315 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5316 group_item_spacing);
5318 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5319 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5320 group_item_spacing);
5322 m_pCheck_Scale_Priority =
new wxCheckBox(
5324 _(
"Allow attenuation of less critical targets if more than ... targets"));
5325 m_pCheck_Scale_Priority->SetToolTip(
5326 _(
"Reduce the display prominence of less critical AIS targets when the "
5327 "number of targets exceeds the specified value."));
5328 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5330 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5331 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5332 group_item_spacing);
5334 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5335 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5336 m_pCheck_Show_Area_Notices->SetToolTip(
5337 _(
"Display area notices received via AIS binary messages on the chart."));
5338 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5340 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1,
"");
5341 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5343 m_pCheck_Draw_Target_Size =
5344 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5345 m_pCheck_Draw_Target_Size->SetToolTip(
5346 _(
"Display AIS targets using their actual reported size and shape on the "
5348 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5350 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1,
"");
5351 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5353 m_pCheck_Show_Target_Name =
new wxCheckBox(
5354 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5355 m_pCheck_Show_Target_Name->SetToolTip(
5356 _(
"Display the name of AIS targets when the chart scale is greater than "
5357 "the specified value."));
5358 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5360 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5361 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5362 group_item_spacing);
5364 m_pCheck_use_Wpl =
new wxCheckBox(
5365 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5366 m_pCheck_use_Wpl->SetToolTip(
5367 _(
"Enable processing of WPL (Waypoint Location) position messages from "
5368 "AIS and select the action to take when received."));
5369 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5371 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5372 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5373 wxDefaultSize, 2, Wpl_Action);
5374 m_pWplAction->SetToolTip(
5375 _(
"Select the action to perform when a WPL message is received: create "
5376 "an Automatic Packet Reporting System (APRS) report or a mark on the "
5378 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5381 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5382 wxStaticBoxSizer* rolloverSizer =
5383 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5384 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5386 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5387 _(
"Enable route/AIS info block"));
5388 pRollover->SetToolTip(
5389 _(
"Show a popup info block with details about routes and AIS targets "
5390 "when hovering over them."));
5391 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5393 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5394 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5398 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5399 pStatic_CallSign->SetToolTip(
5400 _(
"Display the ship name and MMSI (call sign) in the rollover info "
5402 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5404 m_pCheck_Rollover_Class =
5405 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5406 m_pCheck_Rollover_Class->SetToolTip(
5407 _(
"Show the AIS class, type, and status in the rollover info block."));
5408 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5410 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5411 m_pCheck_Rollover_COG->SetToolTip(
5412 _(
"Show speed over ground (SOG) and course over ground (COG) in the "
5413 "rollover info block."));
5414 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5416 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5417 m_pCheck_Rollover_CPA->SetToolTip(
5418 _(
"Show Closest Point of Approach (CPA) and time to CPA (TCPA) in the "
5419 "rollover info block."));
5420 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5423 wxStaticBox* alertBox =
5424 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5425 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5426 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5428 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5429 pAlertGrid->AddGrowableCol(1);
5430 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5432 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5433 _(
"Show CPA/TCPA Alert Dialog"));
5434 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5436 m_pCheck_AlertDialog->Connect(
5437 wxEVT_COMMAND_CHECKBOX_CLICKED,
5438 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5447 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1,
"");
5448 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5450 m_pCheck_AlertAudio =
new wxCheckBox(
5451 panelAIS, ID_AISALERTAUDIO,
5452 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5453 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5455 m_pCheck_AlertAudio->Connect(
5456 wxEVT_COMMAND_CHECKBOX_CLICKED,
5457 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5460 wxButton* m_pPlay_Sound =
5461 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"), wxDefaultPosition,
5462 m_small_button_size, 0);
5463 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5465 m_pPlay_Sound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
5466 wxCommandEventHandler(options::OnButtonTestSound),
5472 m_pCheck_Alert_Moored =
new wxCheckBox(
5473 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5474 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5476 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1,
"");
5477 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5479 m_pCheck_Ack_Timout =
new wxCheckBox(
5480 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5481 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5483 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5484 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5485 group_item_spacing);
5493 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5497 GetHandle()->setStyleSheet(getQtStyleSheet());
5502void options::CreatePanel_UI(
size_t parent,
int border_size,
5503 int group_item_spacing) {
5504 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5506 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5507 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5509 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5510 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5512 wxStaticBox* itemLangStaticBox =
5513 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5514 wxStaticBoxSizer* itemLangStaticBoxSizer =
5515 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5517 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5519 wxSize langChoiceSize = wxSize(-1, -1);
5522 langChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5525 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG,
5526 wxDefaultPosition, langChoiceSize);
5528 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5535 wxStaticBox* itemFontStaticBox =
5536 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5538 wxSize fontChoiceSize = wxSize(-1, -1);
5540 int fLayout = wxHORIZONTAL;
5543 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5546 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5549 wxStaticBoxSizer* itemFontStaticBoxSizer =
5550 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5551 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5554 m_itemFontElementListBox =
5555 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5556 fontChoiceSize, 0, NULL, wxCB_SORT);
5559 for (
size_t i = 0; i < uniqueStrings.GetCount(); i++) {
5560 m_itemFontElementListBox->Append(uniqueStrings[i]);
5563 if (uniqueStrings.GetCount()) m_itemFontElementListBox->SetSelection(0);
5565 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5567 wxButton* itemFontChooseButton =
5568 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5569 wxDefaultPosition, wxDefaultSize, 0);
5570 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5571#if defined(__WXGTK__) || defined(__WXQT__)
5572 wxButton* itemFontColorButton =
5573 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5574 wxDefaultPosition, wxDefaultSize, 0);
5575 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5577 wxButton* itemFontResetButton =
5578 new wxButton(itemPanelFont, ID_BUTTONFONT_RESET, _(
"Reset to Default"),
5579 wxDefaultPosition, wxDefaultSize, 0);
5580 itemFontStaticBoxSizer->Add(itemFontResetButton, 0, wxALL, border_size);
5582 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5583 wxDefaultPosition, wxDefaultSize, 0);
5584 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5589 wxStaticBox* itemStyleStaticBox =
5590 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5591 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5592 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5593 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5595 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5597 wxArrayPtrVoid styles = g_StyleManager->GetArrayOfStyles();
5598 for (
unsigned int i = 0; i < styles.Count(); i++) {
5600 m_itemStyleListBox->Append(style->name);
5602 m_itemStyleListBox->SetStringSelection(
5603 g_StyleManager->GetCurrentStyle()->name);
5604 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5607 wxStaticBox* miscOptionsBox =
5608 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5609 wxStaticBoxSizer* miscOptions =
5610 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5611 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5614 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5615 pShowStatusBar->SetValue(FALSE);
5616 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5619 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5620 pShowMenuBar->SetValue(FALSE);
5621 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5625 pShowMenuBar->Hide();
5628 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5629 pShowChartBar->SetValue(g_bShowChartBar);
5630 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5632 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5633 _(
"Show Compass/GPS Status Window"));
5634 pShowCompassWin->SetValue(FALSE);
5635 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5637 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5638 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5640 pToolbarAutoHideCB =
5641 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5642 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5644 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL,
"", wxDefaultPosition,
5645 wxSize(50, -1), wxTE_RIGHT);
5646 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5648 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5649 group_item_spacing);
5651 auto enable_debug_cb =
new wxCheckBox(itemPanelFont, wxID_ANY,
5652 _(
"Enable Debug in root context menu"));
5653 enable_debug_cb->Bind(wxEVT_CHECKBOX, [enable_debug_cb](wxCommandEvent&) {
5654 g_enable_root_menu_debug = enable_debug_cb->IsChecked();
5656 enable_debug_cb->SetValue(g_enable_root_menu_debug);
5657 miscOptions->Add(enable_debug_cb, 0, wxALL, border_size);
5661 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5662 miscOptions->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5665 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5666 _(
"Enable Touchscreen interface"));
5667 miscOptions->Add(pMobile, 0, wxALL, border_size);
5669 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5670 _(
"Enable Scaled Graphics interface"));
5671 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5676 pResponsive->Hide();
5680 pResponsive->Hide();
5683 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5684 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5686 pZoomButtons->Hide();
5690 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5691 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5693 wxButton* itemEcdisHelp =
5694 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5695 wxDefaultPosition, wxDefaultSize, 0);
5696 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5699 pInlandEcdis->Hide();
5700 itemEcdisHelp->Hide();
5703 miscOptions->AddSpacer(10);
5705 wxFlexGridSizer* sliderSizer;
5706 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5707 sliderSizer->AddGrowableCol(1);
5708 sliderSizer->SetFlexibleDirection(wxBOTH);
5709 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5711 m_pSlider_GUI_Factor =
5712 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5713 m_sliderSize, SLIDER_STYLE);
5714 m_pSlider_GUI_Factor->Hide();
5715 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5716 _(
"User Interface scale factor")),
5718 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5719 m_pSlider_GUI_Factor->Show();
5722 prepareSlider(m_pSlider_GUI_Factor);
5725 m_pSlider_Chart_Factor =
5726 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5727 m_sliderSize, SLIDER_STYLE);
5728 m_pSlider_Chart_Factor->Hide();
5730 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5732 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5733 m_pSlider_Chart_Factor->Show();
5736 prepareSlider(m_pSlider_Chart_Factor);
5739 m_pSlider_Ship_Factor =
5740 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5741 m_sliderSize, SLIDER_STYLE);
5742 m_pSlider_Ship_Factor->Hide();
5744 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5746 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5747 m_pSlider_Ship_Factor->Show();
5750 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5753 m_pSlider_Text_Factor =
5754 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5755 m_sliderSize, SLIDER_STYLE);
5756 m_pSlider_Text_Factor->Hide();
5758 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5760 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5761 m_pSlider_Text_Factor->Show();
5764 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5767 m_pSlider_ENCText_Factor =
5768 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5769 m_sliderSize, SLIDER_STYLE);
5770 m_pSlider_ENCText_Factor->Hide();
5772 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5774 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5775 m_pSlider_ENCText_Factor->Show();
5778 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5781 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5782 _(
"Mouse wheel zoom sensitivity")),
5784 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5785 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5787 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5788 miscOptions->AddSpacer(20);
5791void options::OnResetFont(wxCommandEvent& event) {
5792 wxString itemElement;
5793 int i = m_itemFontElementListBox->GetSelection();
5795 itemElement = m_itemFontElementListBox->GetString(i);
5797 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5799 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5800 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5803 m_textSample->SetFont(*pFont);
5804 m_textSample->SetForegroundColour(colour);
5805 m_textSample->Refresh();
5808 top_frame::Get()->UpdateAllFonts();
5809 m_bfontChanged =
true;
5810 OnFontChoice(event);
5815void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5816 m_pCheck_AlertAudio->Enable(event.IsChecked());
5817 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5820void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5821 if (event.IsChecked()) {
5822 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5823 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5824 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5828void options::CreateListbookIcons() {
5831 if (!g_bresponsive) {
5834 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5836#if wxCHECK_VERSION(2, 8, 12)
5837 m_topImgList->Add(style->GetIcon(
"Display", sx, sy));
5838 m_topImgList->Add(style->GetIcon(
"Charts", sx, sy));
5839 m_topImgList->Add(style->GetIcon(
"Connections", sx, sy));
5840 m_topImgList->Add(style->GetIcon(
"Ship", sx, sy));
5841 m_topImgList->Add(style->GetIcon(
"UI", sx, sy));
5842 m_topImgList->Add(style->GetIcon(
"Plugins", sx, sy));
5846 bmp = style->GetIcon(
"Display");
5847 img = bmp.ConvertToImage();
5848 img.ConvertAlphaToMask(128);
5849 bmp = wxBitmap(img);
5850 m_topImgList->Add(bmp);
5851 bmp = style->GetIcon(
"Charts");
5852 img = bmp.ConvertToImage();
5853 img.ConvertAlphaToMask(128);
5854 bmp = wxBitmap(img);
5855 m_topImgList->Add(bmp);
5856 bmp = style->GetIcon(
"Connections");
5857 img = bmp.ConvertToImage();
5858 img.ConvertAlphaToMask(128);
5859 bmp = wxBitmap(img);
5860 m_topImgList->Add(bmp);
5861 bmp = style->GetIcon(
"Ship");
5862 img = bmp.ConvertToImage();
5863 img.ConvertAlphaToMask(128);
5864 bmp = wxBitmap(img);
5865 m_topImgList->Add(bmp);
5866 bmp = style->GetIcon(
"UI");
5867 img = bmp.ConvertToImage();
5868 img.ConvertAlphaToMask(128);
5869 bmp = wxBitmap(img);
5870 m_topImgList->Add(bmp);
5871 bmp = style->GetIcon(
"Plugins");
5872 img = bmp.ConvertToImage();
5873 img.ConvertAlphaToMask(128);
5874 bmp = wxBitmap(img);
5875 m_topImgList->Add(bmp);
5879 bmps = style->GetIcon(
"Display");
5880 int base_size = bmps.GetWidth();
5881 double tool_size = base_size;
5883 double premult = 1.0;
5887 double target_size = 6.0;
5889 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5890 premult = target_size / basic_tool_size_mm;
5893 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5894 postmult = wxMin(postmult, 3.0);
5895 postmult = wxMax(postmult, 1.0);
5897 int sizeTab = base_size * postmult * premult;
5899 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5903 bmp = style->GetIcon(
"Display");
5904 img = bmp.ConvertToImage();
5905 simg = img.Scale(sizeTab, sizeTab);
5906 bmp = wxBitmap(simg);
5907 m_topImgList->Add(bmp);
5908 bmp = style->GetIcon(
"Charts");
5909 img = bmp.ConvertToImage();
5910 simg = img.Scale(sizeTab, sizeTab);
5911 bmp = wxBitmap(simg);
5912 m_topImgList->Add(bmp);
5913 bmp = style->GetIcon(
"Connections");
5914 img = bmp.ConvertToImage();
5915 simg = img.Scale(sizeTab, sizeTab);
5916 bmp = wxBitmap(simg);
5917 m_topImgList->Add(bmp);
5918 bmp = style->GetIcon(
"Ship");
5919 img = bmp.ConvertToImage();
5920 simg = img.Scale(sizeTab, sizeTab);
5921 bmp = wxBitmap(simg);
5922 m_topImgList->Add(bmp);
5923 bmp = style->GetIcon(
"UI");
5924 img = bmp.ConvertToImage();
5925 simg = img.Scale(sizeTab, sizeTab);
5926 bmp = wxBitmap(simg);
5927 m_topImgList->Add(bmp);
5928 bmp = style->GetIcon(
"Plugins");
5929 img = bmp.ConvertToImage();
5930 simg = img.Scale(sizeTab, sizeTab);
5931 bmp = wxBitmap(simg);
5932 m_topImgList->Add(bmp);
5936void options::CreateControls() {
5937 int border_size = 4;
5939 int group_item_spacing = 2;
5941 int font_size_y, font_descent, font_lead;
5942 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
5943 m_fontHeight = font_size_y + font_descent + font_lead;
5947 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5948 m_fontHeight * 8 / 10);
5951 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5955 m_small_button_size =
5956 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5958 m_nCharWidthMax = GetSize().x / GetCharWidth();
5961 pEnableZoomToCursor = NULL;
5962 pSmoothPanZoom = NULL;
5970 if (!g_bresponsive && height <= 800) {
5972 group_item_spacing = 1;
5976 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
5977 inputFlags = wxSizerFlags(0)
5978 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
5979 .Border(wxALL, group_item_spacing);
5980 verticleInputFlags =
5981 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
5982 groupLabelFlags = wxSizerFlags(0)
5983 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
5984 .Border(wxALL, group_item_spacing);
5985 groupLabelFlagsHoriz =
5986 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
5987 groupInputFlags = wxSizerFlags(0)
5988 .Align(wxALIGN_LEFT | wxALIGN_TOP)
5989 .Border(wxBOTTOM, group_item_spacing * 2)
5993 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
5998 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
5999 itemDialog1->SetSizer(itemBoxSizer2);
6003 wxFont* qFont = dialogFont;
6005 wxString wqs = getFontQtStylesheet(qFont);
6006 wxCharBuffer sbuf = wqs.ToUTF8();
6007 QString qsb = QString(sbuf.data());
6009 QString qsbq = getQtStyleSheet();
6011 itemDialog1->GetHandle()->setStyleSheet(qsb +
6018#ifdef OCPN_OPTIONS_USE_LISTBOOK
6020 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6021 wxSize(-1, -1), flags);
6022 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
6023 wxListbookEventHandler(options::OnPageChange), NULL,
6027 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6028 wxSize(-1, -1), flags);
6029 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6030 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
6037 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
6041 CreateListbookIcons();
6043 m_pListbook->SetImageList(m_topImgList);
6044 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
6046 m_OK_Cancel_Apply_buttons =
new wxBoxSizer(wxHORIZONTAL);
6047 itemBoxSizer2->Add(m_OK_Cancel_Apply_buttons, 0, wxALIGN_RIGHT | wxALL,
6050 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
6051 m_OKButton->SetDefault();
6052 m_OK_Cancel_Apply_buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
6055 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
6056 m_OK_Cancel_Apply_buttons->Add(m_CancelButton, 0,
6057 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6059 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
6060 m_OK_Cancel_Apply_buttons->Add(m_ApplyButton, 0,
6061 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6063 m_pageDisplay = CreatePanel(_(
"Display"));
6064 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
6065 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
6066 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
6067 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
6069 m_pageCharts = CreatePanel(_(
"Charts"));
6070 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
6071 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
6074 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
6075 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
6078 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
6080#ifdef OCPN_OPTIONS_USE_LISTBOOK
6081 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6082 wxListbookEventHandler(options::OnChartsPageChange), NULL,
6085 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6086 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
6092 wxString ConnTab = _(
"Connections");
6094 ConnTab = _(
"Connect");
6096 m_pageConnections = CreatePanel(ConnTab);
6097 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6101 m_pageShips = CreatePanel(_(
"Ships"));
6102 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
6103 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
6104 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
6106 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
6108 wxString UITab = _(
"User Interface");
6112 m_pageUI = CreatePanel(UITab);
6113 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
6114 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
6116 m_pagePlugins = CreatePanel(_(
"Plugins"));
6117 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
6119 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
6120 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
6125 SetColorScheme(
static_cast<ColorScheme
>(0));
6136 SetSizeHints(-1, -1, width - marginx, height - marginy);
6145void options::SetInitialPage(
int page_sel,
int sub_page) {
6146 if (page_sel < (
int)m_pListbook->GetPageCount())
6147 m_pListbook->SetSelection(page_sel);
6149 m_pListbook->SetSelection(0);
6151 if (sub_page >= 0) {
6152 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
6153 wxNotebookPage* pg = m_pListbook->GetPage(i);
6154 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
6156 if (i == (
size_t)page_sel) {
6157 if (sub_page < (
int)nb->GetPageCount())
6158 nb->SetSelection(sub_page);
6160 nb->SetSelection(0);
6162 nb->ChangeSelection(0);
6168void options::SetColorScheme(ColorScheme cs) {
6171#ifdef OCPN_OPTIONS_USE_LISTBOOK
6172 wxListView* lv = m_pListbook->GetListView();
6173 lv->SetBackgroundColour(GetBackgroundColour());
6176 delete m_topImgList;
6177 CreateListbookIcons();
6178 m_pListbook->SetImageList(m_topImgList);
6186 comm_dialog->SetColorScheme(cs);
6189void options::OnAISRolloverClick(wxCommandEvent& event) {
6190 m_pCheck_Rollover_Class->Enable(event.IsChecked());
6191 m_pCheck_Rollover_COG->Enable(event.IsChecked());
6192 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
6193 pStatic_CallSign->Enable(event.IsChecked());
6196void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
6198 case ID_SCREENCONFIG1:
6199 if (m_sconfigSelect_twovertical)
6200 m_sconfigSelect_twovertical->SetSelected(
false);
6204 case ID_SCREENCONFIG2:
6205 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6211void options::SetInitialSettings() {
6214 m_returnChanges = 0;
6215 m_bfontChanged =
false;
6216 m_font_element_array.Clear();
6218 b_oldhaveWMM = b_haveWMM;
6219 auto loader = PluginLoader::GetInstance();
6220 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
6223 switch (g_canvasConfig) {
6226 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
6227 if (m_sconfigSelect_twovertical)
6228 m_sconfigSelect_twovertical->SetSelected(
false);
6231 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6232 if (m_sconfigSelect_twovertical)
6233 m_sconfigSelect_twovertical->SetSelected(
true);
6236 m_screenConfig = g_canvasConfig;
6240 ActiveChartArray.Clear();
6241 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6242 ActiveChartArray.Add(m_CurrentDirList[i]);
6246 if (m_pWorkDirList) {
6247 UpdateWorkArrayFromDisplayPanel();
6248 groupsPanel->SetDBDirs(*m_pWorkDirList);
6251 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6252 delete m_pGroupArray;
6253 m_pGroupArray = groupsPanel->CloneChartGroupArray(
g_pGroupArray);
6254 groupsPanel->SetGroupArray(m_pGroupArray);
6255 groupsPanel->SetInitialSettings();
6259 pShowStatusBar->SetValue(g_bShowStatusBar);
6261 pShowMenuBar->SetValue(g_bShowMenuBar);
6263 pShowCompassWin->SetValue(g_bShowCompassWin);
6267 pCOGUPUpdateSecs->SetValue(s);
6269 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6270 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6272 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6273 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6274 pMobile->SetValue(g_btouch);
6275 pResponsive->SetValue(g_bresponsive);
6282 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6286 pInlandEcdis->SetValue(g_bInlandEcdis);
6288 pOpenGL->SetValue(g_bopengl);
6289 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6290 w->Enable(pOpenGL->IsChecked());
6293 pCBTrueShow->SetValue(g_bShowTrue);
6294 pCBMagShow->SetValue(g_bShowMag);
6296 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6300 itemStaticTextUserVar->SetLabel(
6301 _(
"WMM Plugin calculated magnetic variation"));
6303 s.Printf(
"%4.1f",
gVar);
6304 pMagVar->SetValue(s);
6306 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6308 s.Printf(
"%4.1f", g_UserVar);
6309 pMagVar->SetValue(s);
6312 int newLength = itemStaticTextUserVar->GetLabel().Length();
6315 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6316 wxSize sz = GetSize();
6317 SetSize(sz.x + 1, sz.y);
6321 itemStaticTextUserVar2->Enable(!b_haveWMM);
6322 pMagVar->Enable(!b_haveWMM);
6329 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6333 wxString stringDefaultBoatSpeed;
6334 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6335 g_defaultBoatSpeed = 6.0;
6336 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6338 stringDefaultBoatSpeed.Printf(
"%d", (
int)g_defaultBoatSpeedUserUnit);
6339 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6343 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6344 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6345 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6347 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6349 s.Printf(
"%6.2f", g_ownship_predictor_minutes);
6351 s.Printf(
"%4.0f", g_ownship_predictor_minutes);
6352 m_pText_OSCOG_Predictor->SetValue(s);
6354 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6355 g_ownship_HDTpredictor_miles) > 1e-4)
6356 s.Printf(
"%6.2f", g_ownship_HDTpredictor_miles);
6358 s.Printf(
"%4.0f", g_ownship_HDTpredictor_miles);
6359 m_pText_OSHDT_Predictor->SetValue(s);
6363 m_pTxt_OwnMMSI->SetValue(s);
6365 m_pTxt_OwnMMSI->SetValue(
"");
6367 m_pShipIconType->SetSelection(g_OwnShipIconType);
6368 wxCommandEvent eDummy;
6369 OnShipTypeSelect(eDummy);
6370 m_pOSLength->SetValue(wxString::Format(
"%.1f", g_n_ownship_length_meters));
6371 m_pOSWidth->SetValue(wxString::Format(
"%.1f", g_n_ownship_beam_meters));
6372 m_pOSGPSOffsetX->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_x));
6373 m_pOSGPSOffsetY->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_y));
6374 m_pOSMinSize->SetValue(wxString::Format(
"%d", g_n_ownship_min_mm));
6375 m_pText_ACRadius->SetValue(
6376 wxString::Format(
"%.3f", g_n_arrival_circle_radius));
6379 if (g_iNavAidRadarRingsNumberVisible > 10)
6380 g_iNavAidRadarRingsNumberVisible = 10;
6381 pNavAidRadarRingsNumberVisible->SetSelection(
6382 g_iNavAidRadarRingsNumberVisible);
6383 buf.Printf(
"%.3f", g_fNavAidRadarRingsStep);
6384 pNavAidRadarRingsStep->SetValue(buf);
6385 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6386 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6388 pScaMinChckB->SetValue(g_bUseWptScaMin);
6389 m_pText_ScaMin->SetValue(wxString::Format(
"%i", g_iWpt_ScaMin));
6390 m_pText_ScaMax->SetValue(wxString::Format(
"%i", g_iWpt_ScaMax));
6391 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6393 OnRadarringSelect(eDummy);
6395 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6396 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6397 buf.Printf(
"%.3f", g_fWaypointRangeRingsStep);
6398 pWaypointRangeRingsStep->SetValue(buf);
6399 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6401 OnWaypointRangeRingSelect(eDummy);
6402 pShowshipToActive->SetValue(g_bShowShipToActive);
6403 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6404 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6406 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6407 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6409 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6410 if (pEnableTenHertz) pEnableTenHertz->SetValue(g_btenhertz);
6412 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6413 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6415 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6417 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6420 pSDMMFormat->Select(g_iSDMMFormat);
6424 pDistanceFormat->SetSelection(distance_ui_index);
6427 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6429 if (pHeightUnitSelect) pHeightUnitSelect->SetSelection(
g_iHeightFormat);
6431 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6432 g_bAdvanceRouteWaypointOnArrivalOnly);
6443 pTrackDaily->SetValue(g_bTrackDaily);
6444 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6445 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6446 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6447 TIME_TYPE_COMPUTER);
6448 pTrackHighlite->SetValue(g_bHighliteTracks);
6449 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6450 pTrackPrecision->SetSelection(g_nTrackPrecision);
6452 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6456 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6458 s.Printf(
"%4.1f", g_CPAMax_NM);
6459 m_pText_CPA_Max->SetValue(s);
6461 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6463 s.Printf(
"%4.1f", g_CPAWarn_NM);
6464 m_pText_CPA_Warn->SetValue(s);
6466 if (m_pCheck_CPA_Warn->GetValue()) {
6467 m_pCheck_CPA_WarnT->Enable();
6468 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6470 m_pCheck_CPA_WarnT->Disable();
6472 s.Printf(
"%4.0f", g_TCPA_Max);
6473 m_pText_CPA_WarnT->SetValue(s);
6476 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6478 s.Printf(
"%4.0f", g_MarkLost_Mins);
6479 m_pText_Mark_Lost->SetValue(s);
6481 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6483 s.Printf(
"%4.0f", g_RemoveLost_Mins);
6484 m_pText_Remove_Lost->SetValue(s);
6487 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6489 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6490 m_pText_COG_Predictor->SetValue(s);
6492 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6493 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6495 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6497 s.Printf(
"%4.0f", g_AISShowTracks_Mins);
6498 m_pText_Track_Length->SetValue(s);
6500 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6502 s.Printf(
"%4.1f", g_ShowMoored_Kts);
6503 m_pText_Moored_Speed->SetValue(s);
6505 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6507 s.Printf(
"%4.1f", g_AIS_RealtPred_Kts);
6508 m_pText_RealtPred_Speed->SetValue(s);
6510 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6512 s.Printf(
"%i", g_ShowScaled_Num);
6513 m_pText_Scale_Priority->SetValue(s);
6515 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6517 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6518 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6520 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6522 s.Printf(
"%d", g_Show_Target_Name_Scale);
6523 m_pText_Show_Target_Name_Scale->SetValue(s);
6525 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6526 m_pWplAction->SetSelection(g_WplAction);
6529 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6530 if (g_bAIS_CPA_Alert) {
6531 m_pCheck_AlertAudio->Enable();
6532 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6534 m_pCheck_AlertAudio->Disable();
6535 m_pCheck_AlertAudio->SetValue(
false);
6538 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6540 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6541 s.Printf(
"%4.0f", g_AckTimeout_Mins);
6542 m_pText_ACK_Timeout->SetValue(s);
6545 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6546 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6547 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6550 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6551 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6552 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6554 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6555 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6557 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6558 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6559 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6560 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6561 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6562 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6565 if (!g_config_display_size_manual) {
6566 pRBSizeAuto->SetValue(TRUE);
6568 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6570 screenmm.RemoveLast();
6571 pScreenMM->Disable();
6574 screenmm.Append(wxString::Format(
"%zu,", mm));
6576 screenmm.RemoveLast();
6577 pRBSizeManual->SetValue(TRUE);
6580 pScreenMM->SetValue(screenmm);
6584 UpdateOptionsUnits();
6586 SetInitialVectorSettings();
6588 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6590 s.Printf(
"%d", g_nAutoHideToolbar);
6591 pToolbarHideSecs->SetValue(s);
6595 delete m_pSerialArray;
6596 m_pSerialArray = NULL;
6598 m_bForceNewToolbaronCancel =
false;
6601void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6602 if (ps57CtlListBox) {
6604 ps57CtlListBox->Clear();
6605 marinersStdXref.clear();
6607 ps57CtlListBox->Freeze();
6609 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6611 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6614 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6615 item = ps52plib->OBJLDescriptions[iPtr];
6617 item = wxString(pOLE->OBJLName, wxConvUTF8);
6623 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6624 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6625 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6627 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6628 (catl == DISPLAYBASE))
6630 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6633 bool benable =
true;
6634 if (cat > 0) benable = cat != DISPLAYBASE;
6639 int newpos = ps57CtlListBox->Append(item, benable,
false);
6640 marinersStdXref.push_back(newpos);
6641 for (
size_t i = 0; i < iPtr; i++) {
6642 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6646 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6648 if (cat == DISPLAYBASE) bviz =
true;
6651 if (cat == STANDARD) {
6656 ps57CtlListBox->Check(newpos, bviz);
6658 ps57CtlListBox->Thaw();
6661 ps57CtlListBox->RunLayout();
6664 wxSize s = ps57CtlListBox->GetSize();
6665 ps57CtlListBox->SetSize(s.x, s.y - 1);
6669void options::SetInitialVectorSettings() {
6670 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6674 m_bVectorInit =
true;
6675 resetMarStdList(
true,
false);
6678 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6682 switch (ps52plib->GetDisplayCategory()) {
6692 case (MARINERS_STANDARD):
6700 if (pDispCat) pDispCat->SetSelection(nset);
6704 bool benableMarStd =
false;
6706 for (
unsigned int i = 0; i <
g_canvasArray.GetCount(); i++) {
6709 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6710 benableMarStd =
true;
6719 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6720 itemButtonClearList->Enable(benableMarStd);
6721 itemButtonSelectList->Enable(benableMarStd);
6722 itemButtonSetStd->Enable(benableMarStd);
6725 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6726 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6727 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6728 if (pCheck_XLSECTTEXT)
6729 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6731 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6732 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6733 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6734 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6736 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6737 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6740 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6741 pPointStyle->SetSelection(0);
6743 pPointStyle->SetSelection(1);
6745 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6746 pBoundStyle->SetSelection(0);
6748 pBoundStyle->SetSelection(1);
6750 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6751 p24Color->SetSelection(0);
6753 p24Color->SetSelection(1);
6755 UpdateOptionsUnits();
6759void options::UpdateOptionsUnits() {
6760 int depthUnit = pDepthUnitSelect->GetSelection();
6762 depthUnit = wxMax(depthUnit, 0);
6763 depthUnit = wxMin(depthUnit, 2);
6769 else if (depthUnit == 2)
6775 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6776 wxString depthUnitString = depthUnitStrings[depthUnit];
6777 m_depthUnitsShal->SetLabel(depthUnitString);
6778 m_depthUnitsSafe->SetLabel(depthUnitString);
6779 m_depthUnitsDeep->SetLabel(depthUnitString);
6782 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6784 m_ShallowCtl->SetValue(s);
6786 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6788 m_SafetyCtl->SetValue(s);
6790 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6792 m_DeepCtl->SetValue(s);
6822void options::OnSizeAutoButton(wxCommandEvent& event) {
6825 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6827 screenmm.RemoveLast();
6828 pScreenMM->SetValue(screenmm);
6829 pScreenMM->Disable();
6830 g_config_display_size_manual = FALSE;
6833void options::OnSizeManualButton(wxCommandEvent& event) {
6837 screenmm.Append(wxString::Format(
"%zu,", mm));
6841 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6844 screenmm.RemoveLast();
6845 pScreenMM->SetValue(screenmm);
6846 pScreenMM->Enable();
6847 g_config_display_size_manual = TRUE;
6850void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6852void options::OnCPAWarnClick(wxCommandEvent& event) {
6853 if (m_pCheck_CPA_Warn->GetValue()) {
6854 m_pCheck_CPA_WarnT->Enable();
6856 m_pCheck_CPA_WarnT->SetValue(FALSE);
6857 m_pCheck_CPA_WarnT->Disable();
6861void options::OnSyncCogPredClick(wxCommandEvent& event) {
6862 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6863 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6864 m_pText_COG_Predictor->Disable();
6867 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6868 m_pText_COG_Predictor->SetValue(s);
6869 m_pText_COG_Predictor->Enable();
6873void options::OnShipTypeSelect(wxCommandEvent& event) {
6874 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6875 dispOptions->Layout();
6877 itemPanelShip->Layout();
6878 itemPanelShip->Refresh();
6882void options::OnRadarringSelect(wxCommandEvent& event) {
6883 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6884 dispOptions->Layout();
6886 itemPanelShip->Layout();
6887 itemPanelShip->Refresh();
6891void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6892 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6893 dispOptions->Layout();
6895 itemPanelRoutes->Layout();
6896 itemPanelRoutes->Refresh();
6900void options::OnGLClicked(wxCommandEvent& event) {
6903 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6904 w->Enable(pOpenGL->IsChecked());
6907void options::OnOpenGLOptions(wxCommandEvent& event) {
6909 OpenGLOptionsDlg dlg(
this);
6911 if (dlg.ShowModal() == wxID_OK) {
6912 if (top_frame::Get()->GetWxGlCanvas()) {
6913 g_GLOptions.m_bUseAcceleratedPanning =
6914 g_bGLexpert ? dlg.GetAcceleratedPanning()
6916 ->GetAbstractPrimaryCanvas()
6917 ->CanAccelerateGlPanning();
6920 g_bSoftwareGL = dlg.GetSoftwareGL();
6922 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6923 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6927 g_GLOptions.m_bTextureCompressionCaching =
6928 dlg.GetTextureCompressionCaching();
6929 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6932 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6936 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6938 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6940 if (top_frame::Get()->GetWxGlCanvas()) {
6941 ::wxBeginBusyCursor();
6942 top_frame::Get()->GetAbstractPrimaryCanvas()->SetupGlCompression();
6944 ::wxEndBusyCursor();
6947 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6950 if (dlg.GetRebuildCache()) {
6951 m_returnChanges = REBUILD_RASTER_CACHE;
6957void options::OnChartDirListSelect(wxCommandEvent& event) {
6959 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6960 m_removeBtn->Enable(selected);
6961 if (m_compressBtn) m_compressBtn->Enable(selected);
6965void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6968 const bool select = pDispCat->GetSelection() == 3;
6969 ps57CtlListBox->Enable(select);
6970 itemButtonClearList->Enable(select);
6971 itemButtonSelectList->Enable(select);
6972 itemButtonSetStd->Enable(select);
6978void options::OnButtonClearClick(wxCommandEvent& event) {
6979 resetMarStdList(
false,
false);
6988void options::OnButtonSelectClick(wxCommandEvent& event) {
6989 int nOBJL = ps57CtlListBox->GetCount();
6990 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
6995void options::OnButtonSetStd(wxCommandEvent& event) {
6996 resetMarStdList(
false,
true);
7001bool options::ShowToolTips() {
return TRUE; }
7003void options::OnCharHook(wxKeyEvent& event) {
7004 if (event.GetKeyCode() == WXK_RETURN &&
7005 event.GetModifiers() == wxMOD_CONTROL) {
7006 wxCommandEvent okEvent;
7007 okEvent.SetId(xID_OK);
7008 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
7009 GetEventHandler()->AddPendingEvent(okEvent);
7014void options::OnButtonaddClick(wxCommandEvent& event) {
7016 int dresult = g_Platform->DoDirSelectorDialog(
7017 this, &selDir, _(
"Add a directory containing chart files"),
7018 *pInit_Chart_Dir,
false);
7020 if (dresult != wxID_CANCEL) AddChartDir(selDir);
7025void options::AddChartDir(
const wxString& dir) {
7026 wxFileName dirname = wxFileName(dir);
7027 pInit_Chart_Dir->Empty();
7032 f.MakeRelativeTo(g_Platform->GetHomeDir());
7033 dirAdd = f.GetFullPath();
7035 pInit_Chart_Dir->Append(dirname.GetPath());
7040 cdi.fullpath = dirAdd;
7041 ActiveChartArray.Add(cdi);
7043 UpdateChartDirList();
7045 k_charts |= CHANGE_CHARTS;
7047 pScanCheckBox->Disable();
7050void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
7053 ActiveChartArray.Clear();
7054 for (
size_t i = 0; i < p.GetCount(); i++) {
7055 ActiveChartArray.Add(p[i]);
7058 UpdateChartDirList();
7061void options::UpdateWorkArrayFromDisplayPanel() {
7063 int n = ActiveChartArray.GetCount();
7064 if (m_pWorkDirList) {
7065 m_pWorkDirList->Clear();
7066 for (
int i = 0; i < n; i++) {
7067 dirname = ActiveChartArray[i].fullpath;
7068 if (!dirname.IsEmpty()) {
7071 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7072 (dirname.Last() == wxChar(_T(
'\r'))))
7073 dirname.RemoveLast();
7079 bool b_added = FALSE;
7082 int nDir = m_CurrentDirList.GetCount();
7084 for (
int i = 0; i < nDir; i++) {
7085 if (m_CurrentDirList[i].fullpath == dirname) {
7087 m_pWorkDirList->Add(cdi);
7095 cdin.fullpath = dirname;
7096 m_pWorkDirList->Add(cdin);
7103void options::OnApplyClick(wxCommandEvent& event) {
7104 ApplyChanges(event);
7109 if ((m_returnChanges & FONT_CHANGED) ||
7110 (m_returnChanges & NEED_NEW_OPTIONS)) {
7115 m_callbacks.prepare_close(
this, m_returnChanges);
7116 if (!(m_returnChanges & FONT_CHANGED_SAFE))
7117 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
true);
7121 if ((m_returnChanges & CONFIG_CHANGED)) {
7122 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
false);
7127void options::ApplyChanges(wxCommandEvent& event) {
7133 if (m_pShipIconType->GetSelection() > 0) {
7134 double n_ownship_length_meters;
7135 double n_ownship_beam_meters;
7136 double n_gps_antenna_offset_y;
7137 double n_gps_antenna_offset_x;
7138 long n_ownship_min_mm;
7139 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
7140 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
7141 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
7142 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
7143 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
7145 if (n_ownship_length_meters <= 0)
7146 msg += _(
"\n - your ship's length must be > 0");
7147 if (n_ownship_beam_meters <= 0)
7148 msg += _(
"\n - your ship's beam must be > 0");
7149 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
7151 "\n - your GPS offset from midship must be within your ship's beam");
7152 if (n_gps_antenna_offset_y < 0 ||
7153 n_gps_antenna_offset_y > n_ownship_length_meters)
7155 _(
"\n - your GPS offset from bow must be within your ship's length");
7156 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
7157 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
7158 if (!msg.IsEmpty()) {
7159 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
7160 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
7161 ::wxEndBusyCursor();
7162 event.SetInt(wxID_STOP);
7165 g_n_ownship_length_meters = n_ownship_length_meters;
7166 g_n_ownship_beam_meters = n_ownship_beam_meters;
7167 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
7168 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
7169 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
7171 g_OwnShipIconType = m_pShipIconType->GetSelection();
7172 g_bShowShipToActive = pShowshipToActive->GetValue();
7173 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
7174 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
7176 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
7177 g_n_arrival_circle_radius =
7178 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
7180 wxString* icon_name =
7181 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
7182 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
7185 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
7186 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
7188 g_bUseWptScaMin = pScaMinChckB->GetValue();
7189 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
7190 g_iWpt_ScaMax = wxAtoi(m_pText_ScaMax->GetValue());
7191 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
7194 if (m_bfontChanged) {
7196 if (top_frame::Get()->GetWxGlCanvas()) {
7197 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7200 if (top_frame::Get()->GetAbstractPrimaryCanvas()) {
7201 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7204 m_returnChanges |= FONT_CHANGED;
7208 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
7209 m_returnChanges |= FONT_CHANGED_SAFE;
7213 UpdateWorkArrayFromDisplayPanel();
7215 groupsPanel->SetDBDirs(*m_pWorkDirList);
7216 groupsPanel->m_treespopulated = FALSE;
7218 int k_force = FORCE_UPDATE;
7219 if (pUpdateCheckBox) {
7220 if (!pUpdateCheckBox->GetValue()) k_force = 0;
7221 pUpdateCheckBox->Enable();
7222 pUpdateCheckBox->SetValue(FALSE);
7227 m_returnChanges |= k_force;
7229 int k_scan = SCAN_UPDATE;
7230 if (pScanCheckBox) {
7231 if (!pScanCheckBox->GetValue()) k_scan = 0;
7232 pScanCheckBox->Enable();
7233 pScanCheckBox->SetValue(FALSE);
7238 m_returnChanges |= k_scan;
7240 pConfig->UpdateChartDirs(*m_pWorkDirList);
7244 if (groupsPanel->modified) {
7247 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
7248 m_returnChanges |= GROUPS_CHANGED;
7253 g_bShowStatusBar = pShowStatusBar->GetValue();
7256 bool bmenu_shown = g_bShowMenuBar;
7257 if (pShowMenuBar->GetValue() != bmenu_shown)
7258 m_returnChanges |= MENU_CHANGED;
7259 g_bShowMenuBar = pShowMenuBar->GetValue();
7262 g_bShowCompassWin = pShowCompassWin->GetValue();
7265 g_bShowChartBar = pShowChartBar->GetValue();
7267 wxString screenmm = pScreenMM->GetValue();
7268 wxStringTokenizer tkz(screenmm,
",");
7270 while (tkz.HasMoreTokens()) {
7271 wxString token = tkz.GetNextToken();
7273 if (token.ToLong(&mm) && mm > 0) {
7279 g_config_display_size_manual = pRBSizeManual->GetValue();
7283 comm_dialog->ApplySettings();
7285 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7289 bool temp_bquilting = pCDOQuilting->GetValue();
7292 g_bQuiltEnable = temp_bquilting;
7296 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7297 g_bskew_comp = pSkewComp->GetValue();
7298 g_btouch = pMobile->GetValue();
7299 g_bresponsive = pResponsive->GetValue();
7301 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7303 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7306 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7307 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7308 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7322 long update_val = 1;
7323 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7324 g_COGAvgSec = wxMin(
static_cast<int>(update_val), kMaxCogAverageSeconds);
7328 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7330 g_bShowTrue = pCBTrueShow->GetValue();
7331 g_bShowMag = pCBMagShow->GetValue();
7333 auto loader = PluginLoader::GetInstance();
7334 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
7335 if (!b_haveWMM && !b_oldhaveWMM) {
7336 pMagVar->GetValue().ToDouble(&g_UserVar);
7341 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7342 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7345 g_iNavAidRadarRingsNumberVisible =
7346 pNavAidRadarRingsNumberVisible->GetSelection();
7347 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7348 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7349 g_fNavAidRadarRingsStep = temp_dbl;
7350 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7351 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7352 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7353 g_fWaypointRangeRingsStep = temp_dbl;
7354 g_iWaypointRangeRingsStepUnits =
7355 m_itemWaypointRangeRingsUnits->GetSelection();
7357 m_colourWaypointRangeRingsColour->GetColour();
7362 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7364 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7366 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7368 if (pCmdSoundString) {
7369 g_CmdSoundString = pCmdSoundString->GetValue();
7370 if (wxIsEmpty(g_CmdSoundString)) {
7371 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7372 pCmdSoundString->SetValue(g_CmdSoundString);
7376 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7377 if (pSoundDeviceIndex)
7378 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7380 g_iSDMMFormat = pSDMMFormat->GetSelection();
7383 int sel = pDistanceFormat->GetSelection();
7387 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7389 if (pHeightUnitSelect)
g_iHeightFormat = pHeightUnitSelect->GetSelection();
7392 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7393 if (pSDefaultBoatSpeed)
7394 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7395 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7396 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7397 getUsrSpeedUnit() +
")");
7399 g_bAdvanceRouteWaypointOnArrivalOnly =
7400 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7402 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7403 g_colourTrackLineColour =
7404 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7405 g_colourTrackLineColour.Blue());
7406 g_nTrackPrecision = pTrackPrecision->GetSelection();
7408 g_bTrackDaily = pTrackDaily->GetValue();
7410 g_track_rotate_time = 0;
7411#if wxUSE_TIMEPICKCTRL
7413 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7414 g_track_rotate_time = h * 3600 + m * 60 + s;
7417 if (pTrackRotateUTC->GetValue())
7418 g_track_rotate_time_type = TIME_TYPE_UTC;
7419 else if (pTrackRotateLMT->GetValue())
7420 g_track_rotate_time_type = TIME_TYPE_LMT;
7422 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7424 g_bHighliteTracks = pTrackHighlite->GetValue();
7431 if (pEnableZoomToCursor)
7432 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7434 if (pEnableTenHertz) g_btenhertz = pEnableTenHertz->GetValue();
7437 g_bEnableZoomToCursor =
false;
7440 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7441 g_colourOwnshipRangeRingsColour =
7442 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7443 g_colourOwnshipRangeRingsColour.Green(),
7444 g_colourOwnshipRangeRingsColour.Blue());
7447 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7448 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7449 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7450 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7454 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7455 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7456 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7457 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7458 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7459 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7462 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7463 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7464 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7465 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7468 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7470 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7471 if (g_bSyncCogPredictors) {
7472 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7474 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7476 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7477 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7481 for (
const auto& it :
g_pAIS->GetTargetList()) {
7482 auto pAISTarget = it.second;
7483 if (NULL != pAISTarget) {
7484 pAISTarget->b_show_track = g_bAISShowTracks;
7489 if (TRACKTYPE_NEVER == props->TrackType) {
7490 pAISTarget->b_show_track =
false;
7492 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7493 pAISTarget->b_show_track =
true;
7500 std::map<int, Track*>::iterator it;
7501 it =
g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7502 if (it !=
g_pAIS->m_persistent_tracks.end())
7503 pAISTarget->b_show_track =
true;
7504 pAISTarget->b_show_track_old = g_bAISShowTracks;
7509 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7510 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7512 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7513 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7515 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7517 m_pText_Scale_Priority->GetValue().ToLong(&l);
7518 g_ShowScaled_Num = (int)l;
7520 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7521 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7522 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7523 long ais_name_scale = 5000;
7524 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7525 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7526 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7527 g_WplAction = m_pWplAction->GetSelection();
7530 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7531 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7532 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7534 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7535 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7538 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7539 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7540 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7542 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7543 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7544 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7545 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7547 bool bchange_scale =
false;
7548 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7549 bchange_scale =
true;
7550 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7553 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7554 g_MarkScaleFactorExp = g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7555 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7556 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7557 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7558 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7560 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7561 g_mouse_zoom_sensitivity =
7566 if (pWayPointMan)
WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7574 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7575 g_bopengl = pOpenGL->GetValue();
7578 g_bChartBarEx = pChartBarEX->GetValue();
7581 int depthUnit = pDepthUnitSelect->GetSelection();
7585 bool bUserStdChange =
false;
7587 int nOBJL = ps57CtlListBox->GetCount();
7589 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7591 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7592 if (marinersStdXref[i] == iPtr) {
7597 assert(itemIndex >= 0);
7598 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7599 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7600 bUserStdChange =
true;
7601 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7607 ps52plib->GenerateStateHash();
7608 long stateHash = ps52plib->GetStateHash();
7610 if (m_returnChanges & GL_CHANGED) {
7613 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7615 ps52plib->ClearCNSYLUPArray();
7616 ps52plib->GenerateStateHash();
7620 enum _DisCat nset = OTHER;
7621 switch (pDispCat->GetSelection()) {
7632 nset = MARINERS_STANDARD;
7635 ps52plib->SetDisplayCategory(nset);
7638 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7639 if (pCheck_ATONTEXT)
7640 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7641 if (pCheck_LDISTEXT)
7642 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7643 if (pCheck_XLSECTTEXT)
7644 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7646 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7647 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7648 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7649 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7650 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7651 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7653 ps52plib->m_nSymbolStyle =
7654 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7656 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7658 : SYMBOLIZED_BOUNDARIES;
7659 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7660 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7662 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7663 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7671 else if (depthUnit == 2)
7674 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7675 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7677 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7681 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7682 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7684 if (m_DeepCtl->GetValue().ToDouble(&dval))
7685 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7687 ps52plib->UpdateMarinerParams();
7688 ps52plib->m_nDepthUnitDisplay = depthUnit;
7692 ps52plib->GenerateStateHash();
7695 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7696 m_returnChanges |= S52_CHANGED;
7698 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7702#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7704 wxString new_canon =
"en_US";
7705 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7707 int nLang =
sizeof(lang_list) /
sizeof(
int);
7708 for (
int it = 0; it < nLang; it++) {
7709 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7711 wxString lang_canonical = pli->CanonicalName;
7712 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7713 if (lang_sel == test_string) {
7714 new_canon = lang_canonical;
7720 wxString locale_old = g_locale;
7721 g_locale = new_canon;
7723 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7725 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7728 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7729 m_returnChanges |= STYLE_CHANGED;
7731 wxSizeEvent nullEvent;
7732 top_frame::Get()->OnSize(nullEvent);
7735 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7736 g_bInlandEcdis = pInlandEcdis->GetValue();
7737 SwitchInlandEcdisMode(g_bInlandEcdis);
7738 m_returnChanges |= TOOLBAR_CHANGED;
7743 if (PluginLoader::GetInstance()->UpdatePlugIns())
7744 m_returnChanges |= TOOLBAR_CHANGED;
7750 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7751 m_groups_changed | k_plugins;
7756 wxString string_acc;
7757 for (wxString entry : TideCurrentDataSet) {
7758 string_acc += entry;
7761 wxString string_acc_control;
7762 for (
int i = 0; i < tcDataSelected->GetItemCount(); i++) {
7763 wxString setName = tcDataSelected->GetItemText(i);
7764 string_acc_control += setName;
7767 if (!string_acc.IsSameAs(string_acc_control)) {
7768 TideCurrentDataSet.clear();
7769 int nEntry = tcDataSelected->GetItemCount();
7770 for (
int i = 0; i < nEntry; i++) {
7771 wxString setName = tcDataSelected->GetItemText(i);
7772 TideCurrentDataSet.push_back(setName.ToStdString());
7774 m_returnChanges |= TIDES_CHANGED;
7777 if (g_canvasConfig != m_screenConfig) m_returnChanges |= CONFIG_CHANGED;
7778 g_canvasConfig = m_screenConfig;
7780 UpdateWorkArrayFromDisplayPanel();
7783 if ((m_returnChanges & VISIT_CHARTS) &&
7784 ((m_returnChanges & CHANGE_CHARTS) || (m_returnChanges & SCAN_UPDATE))) {
7785 DoDBSUpdate((m_returnChanges & FORCE_UPDATE) == FORCE_UPDATE);
7787 bool b_groupchange =
ChartData->ScrubGroupArray();
7789 if (b_groupchange ||
7790 ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)) {
7791 pConfig->DestroyConfigGroups();
7794 if ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)
7798 m_callbacks.process_dialog(m_returnChanges, m_pWorkDirList);
7802 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7805 top_frame::Get()->RefreshAllCanvas();
7808 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7810 if (m_bVisitPlugins) m_returnChanges |= FORCE_RELOAD;
7813 UpdateTemplateTitleText();
7816 ::wxEndBusyCursor();
7819void options::OnXidOkClick(wxCommandEvent& event) {
7822 if (event.GetEventObject() == NULL)
return;
7824 ApplyChanges(event);
7827 m_callbacks.prepare_close(
this, m_returnChanges);
7830 if ((m_returnChanges & CONFIG_CHANGED) || (m_returnChanges & GL_CHANGED))
7831 top_frame::Get()->ScheduleReconfigAndSettingsReload(
false,
false);
7834 if ((m_returnChanges & FONT_CHANGED) &&
7835 !(m_returnChanges & FONT_CHANGED_SAFE))
7836 top_frame::Get()->ScheduleDeleteSettingsDialog();
7839 if (m_returnChanges & LOCALE_CHANGED)
7840 top_frame::Get()->ScheduleDeleteSettingsDialog();
7842 if ((m_returnChanges & FONT_CHANGED) ||
7843 (m_returnChanges & NEED_NEW_OPTIONS)) {
7850 if (m_returnChanges & FORCE_RELOAD) top_frame::Get()->ScheduleReloadCharts();
7856void options::Finish() {
7858 m_pListbook->ChangeSelection(0);
7859 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7860 wxNotebookPage* pg = m_pListbook->GetPage(i);
7861 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7862 if (nb) nb->ChangeSelection(0);
7865 lastWindowPos = GetPosition();
7866 lastWindowSize = GetSize();
7868 pConfig->SetPath(
"/Settings");
7869 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7870 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7873ArrayOfCDI options::GetSelectedChartDirs() {
7875 for (
size_t i = 0; i < panelVector.size(); i++) {
7876 if (panelVector[i]->IsSelected()) {
7877 rv.Add(panelVector[i]->GetCDI());
7884ArrayOfCDI options::GetUnSelectedChartDirs() {
7886 for (
size_t i = 0; i < panelVector.size(); i++) {
7887 if (!panelVector[i]->IsSelected()) {
7888 rv.Add(panelVector[i]->GetCDI());
7895void options::SetDirActionButtons() {
7896 ArrayOfCDI selArray = GetSelectedChartDirs();
7897 if (selArray.GetCount())
7898 m_removeBtn->Enable();
7900 m_removeBtn->Disable();
7903void options::OnButtondeleteClick(wxCommandEvent& event) {
7904 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7905 ActiveChartArray.Clear();
7906 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7907 ActiveChartArray.Add(unselArray[i]);
7910 UpdateChartDirList();
7912 UpdateWorkArrayFromDisplayPanel();
7915 if (m_pWorkDirList) {
7916 pActiveChartsList->DeleteAllItems();
7917 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7918 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7921 li.SetAlign(wxLIST_FORMAT_LEFT);
7922 li.SetText(dirname);
7924 long idx = pActiveChartsList->InsertItem(li);
7929 k_charts |= CHANGE_CHARTS;
7931 pScanCheckBox->Disable();
7936void options::DoDBSUpdate(
bool force_full) {
7937 m_OKButton->Disable();
7938 m_CancelButton->Disable();
7939 m_ApplyButton->Disable();
7941 wxString longmsg = _(
"OpenCPN Chart Update");
7943 ".................................................................."
7946 m_pCBDSprog =
new wxGenericProgressDialog();
7949 m_pCBDSprog->SetFont(*qFont);
7952 m_pCBDSprog->Create(_(
"OpenCPN Chart Update"), longmsg, 100,
nullptr,
7955 DimeControl(m_pCBDSprog);
7956 m_pCBDSprog->Show();
7961 m_bTextureCacheingSave = g_GLOptions.m_bTextureCompressionCaching;
7962 g_GLOptions.m_bTextureCompressionCaching =
false;
7964 ChartData->UpdateChartDatabaseInplace(*m_pWorkDirList, force_full,
7968void options::OnButtonRebuildChartDb(wxCommandEvent& event) {
7972void options::OnButtonParseENC(wxCommandEvent& event) {
7973 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
false);
7975 extern void ParseAllENC(wxWindow * parent);
7977 ParseAllENC(g_pOptions);
7980 top_frame::Get()->ChartsRefresh();
7982 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
true);
7988static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
7991 lzma_action action = LZMA_RUN;
7995 uint8_t inbuf[BUFSIZ];
7996 uint8_t outbuf[BUFSIZ];
8009 strm->next_in = NULL;
8011 strm->next_out = outbuf;
8012 strm->avail_out =
sizeof(outbuf);
8018 if (strm->avail_in == 0 && !feof(infile)) {
8019 strm->next_in = inbuf;
8020 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
8022 if (ferror(infile)) {
8023 fprintf(stderr,
"Read error: %s\n", strerror(errno));
8031 if (feof(infile)) action = LZMA_FINISH;
8049 lzma_ret ret = lzma_code(strm, action);
8054 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
8059 size_t write_size =
sizeof(outbuf) - strm->avail_out;
8061 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
8062 fprintf(stderr,
"Write error: %s\n", strerror(errno));
8067 strm->next_out = outbuf;
8068 strm->avail_out =
sizeof(outbuf);
8073 if (ret != LZMA_OK) {
8080 if (ret == LZMA_STREAM_END)
return true;
8091 case LZMA_MEM_ERROR:
8092 msg =
"Memory allocation failed";
8095 case LZMA_DATA_ERROR:
8108 msg =
"File size limits exceeded";
8123 msg =
"Unknown error, possibly a bug";
8127 wxLogMessage(
"LZMA Encoder error: %s (error code %u)\n", msg, ret);
8134static bool CompressChart(wxString in, wxString out) {
8136 FILE* infile = fopen(in.mb_str(),
"rb");
8137 if (!infile)
return false;
8139 FILE* outfile = fopen(out.mb_str(),
"wb");
8145 lzma_stream strm = LZMA_STREAM_INIT;
8146 bool success =
false;
8147 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
8149 success = compress(&strm, infile, outfile);
8160void options::OnButtonmigrateClick(wxCommandEvent& event) {
8166 new MigrateAssistantDialog(wxTheApp->GetTopWindow(),
true);
8167 g_migrateDialog->SetSize(top_frame::Get()->GetSize());
8168 g_migrateDialog->Centre();
8169 g_migrateDialog->Raise();
8170 g_migrateDialog->ShowModal();
8174void options::OnButtonEcdisHelp(wxCommandEvent& event) {
8175 wxString testFile =
"/doc/iECDIS/index.html";
8177 if (!::wxFileExists(testFile)) {
8178 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
8181 _(
"Would you like to visit the iECDIS Manual website for more "
8184 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
8185 wxYES_NO | wxCENTER, 60)) {
8186 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
8197void options::OnButtoncompressClick(wxCommandEvent& event) {
8199 wxArrayInt pListBoxSelections;
8202 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
8203 wxLIST_STATE_SELECTED);
8204 if (item == -1)
break;
8209 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
8210This may make them incompatible with other programs or older versions of OpenCPN.\n\
8211Compressed charts may take slightly longer to load and display on some systems.\n\
8212They can be decompressed again using unxz or 7 zip programs."),
8213 _(
"OpenCPN Warning"),
8214 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
8218 wxArrayString filespecs;
8219 filespecs.Add(
"*.kap");
8220 filespecs.Add(
"*.KAP");
8221 filespecs.Add(
"*.000");
8224 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
8225 filespecs.Add(
"*.D");
8226 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
8227 filespecs.Add(
"*.Z");
8229 wxGenericProgressDialog prog1(
8230 _(
"OpenCPN Compress Charts"), wxEmptyString,
8231 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
8232 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8233 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8236 wxSize sz = prog1.GetSize();
8237 sz.x = top_frame::Get()->GetClientSize().x * 8 / 10;
8240 wxArrayString charts;
8241 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
8242 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
8243 if (dirname.IsEmpty())
continue;
8246 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
8247 (dirname.Last() == wxChar(_T(
'\r'))))
8248 dirname.RemoveLast();
8250 if (!wxDir::Exists(dirname))
continue;
8253 wxArrayString FileList;
8254 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
8255 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
8257 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
8261 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
8262 charts.Add(FileList[j]);
8266 if (charts.GetCount() == 0) {
8267 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
8272 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
8273 wxGenericProgressDialog prog(
8274 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
8275 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8276 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8280 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
8282 prog.Update(i, charts[i], &skip);
8285 wxString compchart = charts[i] +
".xz";
8286 if (CompressChart(charts[i], compchart)) {
8287 total_size += wxFileName::GetSize(charts[i]).ToULong();
8288 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
8289 wxRemoveFile(charts[i]);
8295 double total_size_mb = total_size / 1024.0 / 1024.0;
8296 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
8299 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
8301 count, total_size_mb, total_compressed_size_mb,
8302 total_size_mb - total_compressed_size_mb,
8303 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
8306 UpdateWorkArrayFromTextCtl();
8308 if (m_pWorkDirList) {
8309 pActiveChartsList->DeleteAllItems();
8310 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
8311 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
8314 li.SetAlign(wxLIST_FORMAT_LEFT);
8315 li.SetText(dirname);
8317 long idx = pActiveChartsList->InsertItem(li);
8321 k_charts |= CHANGE_CHARTS;
8323 pScanCheckBox->Disable();
8329void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
8331void options::OnCancelClick(wxCommandEvent& event) {
8332 m_pListbook->ChangeSelection(0);
8333 comm_dialog->CancelSettings();
8335 lastWindowPos = GetPosition();
8336 lastWindowSize = GetSize();
8338 pConfig->SetPath(
"/Settings");
8339 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8340 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8343 androidEnableBackButton(
true);
8344 androidEnableRotation();
8345 androidEnableOptionItems(
true);
8348 top_frame::Get()->ThawCharts();
8350 top_frame::Get()->EnableSettingsTool(
true);
8353void options::OnClose(wxCloseEvent& event) {
8354 m_pListbook->ChangeSelection(0);
8356 lastWindowPos = GetPosition();
8357 lastWindowSize = GetSize();
8359 pConfig->SetPath(
"/Settings");
8360 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8361 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8363 m_callbacks.prepare_close(
this, m_returnChanges);
8367void options::OnFontChoice(wxCommandEvent& event) {
8368 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8369 m_font_element_array.Add(sel_text_element);
8371 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8372 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8374 m_textSample->SetFont(*pif);
8375 m_textSample->SetForegroundColour(init_color);
8376 m_itemBoxSizerFontPanel->Layout();
8380void options::OnChooseFont(wxCommandEvent& event) {
8382 androidDisableRotation();
8385 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8386 m_font_element_array.Add(sel_text_element);
8387 wxFontData font_data;
8389 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8390 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8392 wxFontData init_font_data;
8393 if (pif) init_font_data.SetInitialFont(*pif);
8394 init_font_data.SetColour(init_color);
8399 wxFont* qFont = dialogFont;
8402 int retval = dg.ShowModal();
8403 if (wxID_CANCEL != retval) {
8404 font_data = dg.GetFontData();
8405 wxFont font = font_data.GetChosenFont();
8406 wxFont* psfont =
new wxFont(font);
8407 wxColor color = font_data.GetColour();
8408 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8409 top_frame::Get()->UpdateAllFonts();
8410 m_bfontChanged =
true;
8411 OnFontChoice(event);
8417 wxFontDialog dg(
this, init_font_data);
8419 wxFontDialog dg(pParent, init_font_data);
8422 wxFont* qFont = dialogFont;
8429 wxSize proposed_size = GetSize();
8431 float font_size = dialogFont->GetPointSize();
8433 if ((proposed_size.y / font_size) < n_lines) {
8434 float new_font_size = proposed_size.y / n_lines;
8435 wxFont* smallFont =
new wxFont(*dialogFont);
8436 smallFont->SetPointSize(new_font_size);
8437 dg.SetFont(*smallFont);
8441 if (g_bresponsive) {
8442 dg.SetSize(GetSize());
8446 int retval = dg.ShowModal();
8447 if (wxID_CANCEL != retval) {
8448 font_data = dg.GetFontData();
8449 wxFont font = font_data.GetChosenFont();
8450 wxFont* psfont =
new wxFont(font);
8451 wxColor color = font_data.GetColour();
8452 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8453 top_frame::Get()->UpdateAllFonts();
8454 m_bfontChanged =
true;
8455 OnFontChoice(event);
8460 androidEnableRotation();
8466#if defined(__WXGTK__) || defined(__WXQT__)
8467void options::OnChooseFontColor(wxCommandEvent& event) {
8468 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8469 m_font_element_array.Add(sel_text_element);
8471 wxColourData colour_data;
8473 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8474 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8477 androidDisableRotation();
8479 unsigned int cco = 0;
8482 cco |= init_color.Red();
8484 cco |= init_color.Green();
8486 cco |= init_color.Blue();
8487 unsigned int cc = androidColorPicker(cco);
8490 unsigned char blue = (
unsigned char)cc % 256;
8491 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8493 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8494 cn.Set(red, green, blue);
8496 FontMgr::Get().
SetFont(sel_text_element, pif, cn);
8498 top_frame::Get()->UpdateAllFonts();
8499 m_bfontChanged =
true;
8501 androidEnableRotation();
8503 wxScrolledWindow* sw =
8504 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8506 wxColourData init_colour_data;
8507 init_colour_data.SetColour(init_color);
8509 wxColourDialog dg(sw, &init_colour_data);
8511 int retval = dg.ShowModal();
8512 if (wxID_CANCEL != retval) {
8513 colour_data = dg.GetColourData();
8515 wxColor color = colour_data.GetColour();
8516 FontMgr::Get().
SetFont(sel_text_element, pif, color);
8518 top_frame::Get()->UpdateAllFonts();
8519 m_bfontChanged =
true;
8520 OnFontChoice(event);
8529void options::OnChartsPageChange(wxListbookEvent& event) {
8530 unsigned int i =
event.GetSelection();
8532 UpdateChartDirList();
8537 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8541 UpdateWorkArrayFromDisplayPanel();
8542 groupsPanel->SetDBDirs(*m_pWorkDirList);
8543 groupsPanel->m_treespopulated = FALSE;
8545 if (!groupsPanel->m_settingscomplete) {
8546 ::wxBeginBusyCursor();
8547 groupsPanel->CompleteInitialSettings();
8548 ::wxEndBusyCursor();
8549 }
else if (!groupsPanel->m_treespopulated) {
8550 groupsPanel->PopulateTrees();
8551 groupsPanel->m_treespopulated = TRUE;
8553 }
else if (1 == i) {
8555 if (!m_bVectorInit) {
8556 SetInitialVectorSettings();
8557 UpdateOptionsUnits();
8564void options::OnPageChange(wxListbookEvent& event) {
8565 DoOnPageChange(event.GetSelection());
8568void options::OnSubNBPageChange(wxNotebookEvent& event) {
8571 if (event.GetEventObject()) {
8572 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8573 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8574 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8575 if (
dynamic_cast<wxNotebook*
>(parent)) {
8576 lastSubPage =
event.GetSelection();
8579 if (
dynamic_cast<wxListbook*
>(parent)) {
8580 lastSubPage =
event.GetSelection();
8587void options::OnTopNBPageChange(wxNotebookEvent& event) {
8588 DoOnPageChange(event.GetSelection());
8591void options::DoOnPageChange(
size_t page) {
8592 unsigned int i = page;
8595 if (page > 10)
return;
8603 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8604 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8610 k_charts = VISIT_CHARTS;
8611 UpdateChartDirList();
8614 else if (m_pageConnections == i) {
8616 wxWindow* w = m_pListbook->GetCurrentPage();
8617 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
8620 else if (m_pageUI == i) {
8621 if (!m_itemLangListBox)
return;
8622#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8624 if (!m_bVisitLang) {
8625 ::wxBeginBusyCursor();
8627 int current_language = plocale_def_lang->GetLanguage();
8628 wxString current_sel = wxLocale::GetLanguageName(current_language);
8630 current_sel = GetOCPNKnownLanguage(g_locale);
8632 int nLang =
sizeof(lang_list) /
sizeof(
int);
8635 m_itemLangListBox->Append(
"English (U.S.)");
8637 wxString lang_dir = g_Platform->GetSharedDataDir() +
"share/locale/";
8638 for (
int it = 1; it < nLang; it++) {
8639 if (wxLocale::IsAvailable(lang_list[it])) {
8640 wxLocale ltest(lang_list[it], 0);
8641 ltest.AddCatalog(
"opencpn");
8642 if (!ltest.IsLoaded(
"opencpn"))
continue;
8645 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8646 wxString widgets_lang_name = loc_lang_name;
8647 wxString lang_canonical =
8648 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8651 wxString lang_suffix;
8652 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8655 wxString test_dir = lang_dir + lang_suffix;
8656 if (!wxDir::Exists(test_dir))
continue;
8658 m_itemLangListBox->Append(loc_lang_name);
8662 wxArrayString lang_array;
8665 lang_array.Add(
"en_US");
8666 for (
int it = 0; it < nLang; it++) {
8668 wxLog::EnableLogging(
8671 wxLocale ltest(lang_list[it], 0);
8672#if wxCHECK_VERSION(2, 9, 0)
8674 ltest.AddCatalogLookupPathPrefix(
8675 wxStandardPaths::Get().GetInstallPrefix() +
"/share/locale");
8678 ltest.AddCatalog(
"opencpn");
8680 wxLog::EnableLogging(TRUE);
8681 if (ltest.IsLoaded(
"opencpn")) {
8682 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8685 s0 = x->CanonicalName;
8688 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8689 if (wxNOT_FOUND == lang_array.Index(s0)) {
8696 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8698 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8699 m_itemLangListBox->Append(loc_lang_name);
8715 delete plocale_def_lang;
8716 plocale_def_lang =
new wxLocale(current_language);
8718 setlocale(LC_NUMERIC,
"C");
8719 plocale_def_lang->AddCatalog(
"opencpn");
8721 m_itemLangListBox->SetStringSelection(current_sel);
8724 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8726 wxString clang = pli->Description;
8730 m_bVisitLang = TRUE;
8732 ::wxEndBusyCursor();
8735 }
else if (m_pagePlugins == i) {
8736 m_bVisitPlugins = TRUE;
8737 top_frame::Get()->FreezeCharts();
8741 auto loader = PluginLoader::GetInstance();
8742 if (LoadAllPlugIns(
false)) {
8743 delete m_pPlugInCtrl;
8744 m_pPlugInCtrl = NULL;
8745 delete m_PluginCatalogMgrPanel;
8746 m_PluginCatalogMgrPanel = NULL;
8747 itemBoxSizerPanelPlugins->Clear();
8750 if (!m_pPlugInCtrl) {
8752 ::wxBeginBusyCursor();
8755 wxDefaultPosition, wxDefaultSize);
8756 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8757 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8758 wxEXPAND | wxGROW | wxALL, 4);
8762 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8764 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8765 wxEXPAND | wxALL, 4);
8766 itemBoxSizerPanelPlugins->Layout();
8769 m_pPlugInCtrl->UpdateSelections();
8771 ::wxEndBusyCursor();
8773 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8776 k_plugins = TOOLBAR_CHANGED;
8778 k_plugins |= FORCE_RELOAD;
8782wxString options::SelectSoundFile() {
8783 wxString sound_dir = g_Platform->GetSharedDataDir();
8784 sound_dir.Append(
"sounds");
8789 wxFileDialog* popenDialog =
new wxFileDialog(
8790 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8791 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
8793 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8795 response = popenDialog->ShowModal();
8796 sel_file = popenDialog->GetPath();
8800 response = g_Platform->DoFileSelectorDialog(
8801 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
8804 if (response == wxID_OK)
8805 return g_Platform->NormalizePath(sel_file);
8810void options::OnButtonSelectSound(wxCommandEvent& event) {
8811 wxString sel_file = SelectSoundFile();
8813 if (!sel_file.IsEmpty()) {
8814 g_sAIS_Alert_Sound_File = g_Platform->NormalizePath(sel_file);
8818void options::OnButtonTestSound(wxCommandEvent& event) {
8819 auto sound = o_sound::Factory();
8820 auto cmd_sound =
dynamic_cast<o_sound::SystemCmdSound*
>(sound);
8821 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8823 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8827wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8828 wxString return_string;
8829 wxString dir_suffix;
8831#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8833 if (lang_canonical ==
"en_US") {
8835 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8837 }
else if ((lang_canonical ==
"cs_CZ") || (lang_canonical ==
"cs")) {
8839 return_string = wxString(
"Čeština", wxConvUTF8);
8841 }
else if ((lang_canonical ==
"da_DK") || (lang_canonical ==
"da")) {
8843 return_string = wxString(
"Dansk", wxConvUTF8);
8845 }
else if ((lang_canonical ==
"de_DE") || (lang_canonical ==
"de")) {
8847 return_string = wxString(
"Deutsch", wxConvUTF8);
8849 }
else if ((lang_canonical ==
"et_EE") || (lang_canonical ==
"et")) {
8851 return_string = wxString(
"Eesti", wxConvUTF8);
8853 }
else if ((lang_canonical ==
"es_ES") || (lang_canonical ==
"es")) {
8855 return_string = wxString(
"Español", wxConvUTF8);
8857 }
else if ((lang_canonical ==
"fr_FR") || (lang_canonical ==
"fr")) {
8859 return_string = wxString(
"Français", wxConvUTF8);
8861 }
else if ((lang_canonical ==
"it_IT") || (lang_canonical ==
"it")) {
8863 return_string = wxString(
"Italiano", wxConvUTF8);
8865 }
else if ((lang_canonical ==
"nl_NL") || (lang_canonical ==
"nl")) {
8867 return_string = wxString(
"Nederlands", wxConvUTF8);
8869 }
else if ((lang_canonical ==
"pl_PL") || (lang_canonical ==
"pl")) {
8871 return_string = wxString(
"Polski", wxConvUTF8);
8873 }
else if ((lang_canonical ==
"pt_PT") || (lang_canonical ==
"pt")) {
8874 dir_suffix =
"pt_PT";
8875 return_string = wxString(
"Português", wxConvUTF8);
8877 }
else if ((lang_canonical ==
"pt_BR") || (lang_canonical ==
"pt_BR")) {
8878 dir_suffix =
"pt_BR";
8879 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8881 }
else if ((lang_canonical ==
"ru_RU") || (lang_canonical ==
"ru")) {
8883 return_string = wxString(
"Русский", wxConvUTF8);
8885 }
else if ((lang_canonical ==
"sv_SE") || (lang_canonical ==
"sv")) {
8887 return_string = wxString(
"Svenska", wxConvUTF8);
8889 }
else if ((lang_canonical ==
"fi_FI") || (lang_canonical ==
"fi")) {
8890 dir_suffix =
"fi_FI";
8891 return_string = wxString(
"Suomi", wxConvUTF8);
8893 }
else if ((lang_canonical ==
"nb_NO") || (lang_canonical ==
"nb")) {
8894 dir_suffix =
"nb_NO";
8895 return_string = wxString(
"Norsk", wxConvUTF8);
8897 }
else if ((lang_canonical ==
"tr_TR") || (lang_canonical ==
"tr")) {
8898 dir_suffix =
"tr_TR";
8899 return_string = wxString(
"Türkçe", wxConvUTF8);
8901 }
else if ((lang_canonical ==
"el_GR") || (lang_canonical ==
"el")) {
8902 dir_suffix =
"el_GR";
8903 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8905 }
else if ((lang_canonical ==
"hu_HU") || (lang_canonical ==
"hu")) {
8906 dir_suffix =
"hu_HU";
8907 return_string = wxString(
"Magyar", wxConvUTF8);
8909 }
else if ((lang_canonical ==
"zh_TW") || (lang_canonical ==
"zh_TW")) {
8910 dir_suffix =
"zh_TW";
8911 return_string = wxString(
"正體字", wxConvUTF8);
8913 }
else if ((lang_canonical ==
"zh_CN") || (lang_canonical ==
"zh_CN")) {
8914 dir_suffix =
"zh_CN";
8915 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8917 }
else if ((lang_canonical ==
"ca_ES") || (lang_canonical ==
"ca")) {
8918 dir_suffix =
"ca_ES";
8919 return_string = wxString(
"Catalan", wxConvUTF8);
8921 }
else if ((lang_canonical ==
"gl_ES") || (lang_canonical ==
"gl_ES")) {
8922 dir_suffix =
"gl_ES";
8923 return_string = wxString(
"Galician", wxConvUTF8);
8925 }
else if ((lang_canonical ==
"ja_JP") || (lang_canonical ==
"ja_JP")) {
8926 dir_suffix =
"ja_JP";
8927 return_string = wxString(
"Japanese", wxConvUTF8);
8929 }
else if ((lang_canonical ==
"vi_VN") || (lang_canonical ==
"vi_VN")) {
8930 dir_suffix =
"vi_VN";
8931 return_string = wxString(
"Vietnamese", wxConvUTF8);
8934 dir_suffix = lang_canonical;
8935 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8937 return_string = info->Description;
8939 return_string = lang_canonical;
8942 lang_dir = dir_suffix;
8944 return return_string;
8947wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8949 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8952ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8953 ChartGroupArray* d =
new ChartGroupArray;
8954 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8957 pdg->m_group_name = psg->m_group_name;
8958 pdg->m_element_array.reserve(psg->m_element_array.size());
8960 for (
auto& elem : psg->m_element_array)
8961 pdg->m_element_array.push_back(elem);
8968void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8978EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8979EVT_NOTEBOOK_PAGE_CHANGED(
8981 ChartGroupsUI::OnGroupPageChange)
8985 m_GroupSelectedPage = -1;
8986 m_pActiveChartsTree = 0;
8988 lastSelectedCtl = NULL;
8989 allAvailableCtl = NULL;
8990 defaultAllCtl = NULL;
8992 m_pAddButton = NULL;
8993 m_pRemoveButton = NULL;
8994 m_pDeleteGroupButton = NULL;
8995 m_pNewGroupButton = NULL;
8996 m_pGroupArray = NULL;
8999 m_UIcomplete =
false;
9000 m_treespopulated =
false;
9004ChartGroupsUI::~ChartGroupsUI() {
9005 m_DirCtrlArray.Clear();
9006 m_GroupNB->Disconnect(
9007 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
9008 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
9013void ChartGroupsUI::SetInitialSettings() {
9014 m_settingscomplete = FALSE;
9015 m_treespopulated = FALSE;
9018void ChartGroupsUI::PopulateTrees() {
9021 wxArrayString dir_array;
9022 int nDir = m_db_dirs.GetCount();
9023 for (
int i = 0; i < nDir; i++) {
9024 wxString dirname = m_db_dirs[i].fullpath;
9025 if (!dirname.IsEmpty()) dir_array.Add(dirname);
9028 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array,
9029 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
9031 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
9035 wxArrayString dir_array0;
9036 int nDir0 = m_db_dirs.GetCount();
9037 for (
int i = 0; i < nDir0; i++) {
9038 wxString dirname = m_db_dirs[i].fullpath;
9039 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
9041 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
9042 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
9045void ChartGroupsUI::CompleteInitialSettings() {
9048 BuildNotebookPages(m_pGroupArray);
9050 m_panel->GetSizer()->Layout();
9052 m_settingscomplete = TRUE;
9053 m_treespopulated = TRUE;
9056void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
9057 const wxArrayString& dir_array,
9058 const wxColour& col, wxFont* pFont) {
9059 ptc->DeleteAllItems();
9061 wxDirItemData* rootData =
new wxDirItemData(
"Dummy",
"Dummy", TRUE);
9064 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
9065 ptc->SetItemHasChildren(m_rootId);
9068 int nDir = dir_array.GetCount();
9069 for (
int i = 0; i < nDir; i++) {
9070 wxString dirname = dir_array[i];
9071 if (!dirname.IsEmpty()) {
9072 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
9073 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
9076 ptc->SetItemText(
id, dirname);
9077 if (pFont) ptc->SetItemFont(
id, *pFont);
9081 ptc->SetItemTextColour(
id, col);
9083 ptc->SetItemHasChildren(
id);
9088void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
9089 wxString insert_candidate = allAvailableCtl->GetPath();
9090 if (!insert_candidate.IsEmpty()) {
9091 if (m_DirCtrlArray.GetCount()) {
9092 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9093 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9095 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9097 if (ptree->IsEmpty()) {
9098 wxDirItemData* rootData =
9099 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9100 wxString rootName =
"Dummy";
9101 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9103 ptree->SetItemHasChildren(rootId);
9106 wxTreeItemId root_Id = ptree->GetRootItem();
9107 wxDirItemData* dir_item =
9108 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
9110 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
9111 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
9114 pGroup->m_element_array.push_back({insert_candidate});
9119 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9120 m_pAddButton->Disable();
9122 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9124 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9125 if (ptree) ptree->Refresh();
9129void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
9130 if (m_DirCtrlArray.GetCount()) {
9131 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9132 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9135 wxString sel_item = pDirCtrl->GetPath();
9137 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9138 if (ptree && ptree->GetCount()) {
9139 wxTreeItemId
id = ptree->GetSelection();
9140 lastDeletedItem = id;
9142 wxString branch_adder;
9143 int group_item_index =
9144 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
9145 if (group_item_index >= 0) {
9147 pGroup->m_element_array[group_item_index];
9148 bool b_duplicate = FALSE;
9149 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
9151 if (pelement.m_missing_name_array[k] == sel_item) {
9157 pelement.m_missing_name_array.Add(sel_item);
9163 if (branch_adder ==
"") {
9165 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
9168 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
9174 lastSelectedCtl->Unselect();
9175 lastSelectedCtl = 0;
9176 m_pRemoveButton->Disable();
9178 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9180 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9181 if (ptree) ptree->Refresh();
9189void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
9190 m_GroupSelectedPage =
event.GetSelection();
9191 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9192 if (lastSelectedCtl) {
9193 lastSelectedCtl->UnselectAll();
9194 lastSelectedCtl = 0;
9196 m_pRemoveButton->Disable();
9197 m_pAddButton->Disable();
9200 if (m_GroupSelectedPage == 0) {
9201 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
9203 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
9207void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
9208 wxObject* evtObj =
event.GetEventObject();
9209 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
9210 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
9211 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9212 m_pAddButton->Enable();
9214 m_pAddButton->Disable();
9217 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
9218 if (!lastSelectedCtl)
goto out;
9219 wxTreeItemId item = lastSelectedCtl->GetSelection();
9220 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9223 wxGenericDirCtrl* dirCtrl =
9224 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
9225 if (!dirCtrl)
goto out;
9226 wxString itemPath = dirCtrl->GetPath();
9227 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
9229 m_pRemoveButton->Disable();
9237void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
9238 wxTextEntryDialog* pd =
new wxTextEntryDialog();
9240 pd->SetFont(*qFont);
9242 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
9245 androidDisableRotation();
9248 if (pd->ShowModal() == wxID_OK) {
9249 if (pd->GetValue().Length()) {
9250 AddEmptyGroupPage(pd->GetValue());
9252 pGroup->m_group_name = pd->GetValue();
9253 m_pGroupArray->Add(pGroup);
9255 m_GroupSelectedPage =
9256 m_GroupNB->GetPageCount() - 1;
9257 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
9258 m_pDeleteGroupButton->Enable();
9265 androidEnableRotation();
9269void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
9270 if (0 != m_GroupSelectedPage) {
9271 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
9272 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
9273 m_GroupNB->DeletePage(m_GroupSelectedPage);
9276 if (m_GroupSelectedPage <= 0) {
9277 m_pAddButton->Disable();
9278 m_pDeleteGroupButton->Disable();
9282int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
9283 wxTreeItemId item, wxString* pbranch_adder) {
9284 wxString branch_name;
9285 wxString branch_adder;
9287 wxTreeItemId current_node = item;
9288 while (current_node.IsOk()) {
9289 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
9290 if (!parent_node)
break;
9292 if (parent_node == ptree->GetRootItem()) {
9293 branch_name = ptree->GetItemText(current_node);
9297 branch_adder.Prepend(ptree->GetItemText(current_node));
9298 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
9300 current_node = ptree->GetItemParent(current_node);
9304 unsigned int target_item_index = -1;
9306 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
9307 const wxString& target = pGroup->m_element_array[i].m_element_name;
9308 if (branch_name == target) {
9309 target_item_index = i;
9314 if (pbranch_adder) *pbranch_adder = branch_adder;
9316 return target_item_index;
9319void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
9320 wxTreeItemId node =
event.GetItem();
9322 if (m_GroupSelectedPage <= 0)
return;
9323 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9324 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9325 if (!pDirCtrl)
return;
9327 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9328 wxString branch_adder;
9329 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
9330 if (target_item_index < 0)
return;
9332 pGroup->m_element_array[target_item_index];
9333 const wxString& branch_name = target_element.m_element_name;
9337 if (!target_element.m_missing_name_array.GetCount())
return;
9338 wxString full_root = branch_name;
9339 full_root += branch_adder;
9340 full_root += wxString(wxFILE_SEP_PATH);
9342 wxTreeItemIdValue cookie;
9343 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
9344 while (child.IsOk()) {
9345 wxString target_string = full_root;
9346 target_string += ptree->GetItemText(child);
9348 for (
unsigned int k = 0; k < target_element.m_missing_name_array.GetCount();
9350 if (target_element.m_missing_name_array[k] == target_string) {
9351 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
9355 child = ptree->GetNextChild(node, cookie);
9359void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
9362 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
9364 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
9367 int nItems = pGroup->m_element_array.size();
9368 for (
int i = 0; i < nItems; i++) {
9369 const wxString& itemname = pGroup->m_element_array[i].m_element_name;
9370 if (!itemname.IsEmpty()) {
9371 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
9373 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
9375 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
9381wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
9382 wxGenericDirCtrl* GroupDirCtl =
9383 new wxGenericDirCtrl(m_GroupNB, wxID_ANY,
"TESTDIR");
9384 m_GroupNB->AddPage(GroupDirCtl, label);
9386 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
9387 ptree->DeleteAllItems();
9389 wxDirItemData* rootData =
9390 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9391 wxString rootName =
"Dummy";
9392 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9393 ptree->SetItemHasChildren(rootId);
9395 m_DirCtrlArray.Add(GroupDirCtl);
9400void ChartGroupsUI::ClearGroupPages() {
9401 if (m_GroupNB->GetPageCount() == 0)
return;
9403 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
9404 m_DirCtrlArray.RemoveAt(i);
9405 m_GroupNB->DeletePage(i);
9409void options::OnInsertTideDataLocation(wxCommandEvent& event) {
9411 int response = wxID_CANCEL;
9414 wxFileDialog* popenDialog =
new wxFileDialog(
9415 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
9416 "Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All "
9420 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
9422 response = popenDialog->ShowModal();
9423 sel_file = popenDialog->GetPath();
9428 response = g_Platform->DoFileSelectorDialog(
9429 this, &path, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
"*.*");
9433 if (response == wxID_OK) {
9435 int id = tcDataSelected->GetItemCount();
9437 long idx = tcDataSelected->InsertItem(li);
9438 tcDataSelected->SetItem(
id, 0, g_Platform->NormalizePath(sel_file));
9441 wxFileName fn(sel_file);
9442 wxString data_dir = fn.GetPath();
9443 g_TCData_Dir = g_Platform->NormalizePath(data_dir);
9447void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9450 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9451 wxLIST_STATE_SELECTED);
9452 if (item == -1)
break;
9453 tcDataSelected->DeleteItem(item);
9459enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9462BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9463EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9464EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9467OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9468 : wxDialog(parent, wxID_ANY, "OpenGL Options", wxDefaultPosition,
9470 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9475 m_brebuild_cache(FALSE) {
9478 SetFont(*dialogFont);
9480 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9481 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9483 m_cbTextureCompression =
9484 new wxCheckBox(
this, wxID_ANY,
9485 g_bGLexpert ? _(
"Texture Compression")
9486 : _(
"Texture Compression with Caching"));
9487 m_cbTextureCompressionCaching =
9488 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9490 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9491 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9492 m_sTextureMemorySize->SetRange(1, 16384);
9494 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9495 wxButton* btnRebuild =
9496 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9497 wxButton* btnClear =
9498 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9499 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9501 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9502 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9503 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9505 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9506 m_cbUseAcceleratedPanning =
9507 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9509 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9510 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9511 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9512 flexSizer->AddSpacer(0);
9513 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9514 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9515 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9516 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9517 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9518 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9519 flexSizer->AddSpacer(0);
9520 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9521 flexSizer->AddSpacer(0);
9522 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9523 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9524 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9525 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9526 flexSizer->AddSpacer(0);
9527 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9528 flexSizer->AddSpacer(0);
9529 flexSizer->AddSpacer(0);
9530 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9531 flexSizer->AddSpacer(0);
9532 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9533 flexSizer->AddGrowableCol(1);
9534 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9536 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9537 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9538 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9539 btnSizer->Realize();
9541 mainSizer->AddStretchSpacer();
9542 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9546 SetSizer(mainSizer);
9547 mainSizer->SetSizeHints(
this);
9551bool OpenGLOptionsDlg::GetAcceleratedPanning()
const {
9552 return m_cbUseAcceleratedPanning->GetValue();
9555bool OpenGLOptionsDlg::GetTextureCompression()
const {
9556 return m_cbTextureCompression->GetValue();
9559bool OpenGLOptionsDlg::GetPolygonSmoothing()
const {
9560 return m_cbPolygonSmoothing->GetValue();
9563bool OpenGLOptionsDlg::GetLineSmoothing()
const {
9564 return m_cbLineSmoothing->GetValue();
9567bool OpenGLOptionsDlg::GetSoftwareGL()
const {
9568 return m_cbSoftwareGL->GetValue();
9571bool OpenGLOptionsDlg::GetTextureCompressionCaching()
const {
9572 return m_cbTextureCompressionCaching->GetValue();
9575bool OpenGLOptionsDlg::GetRebuildCache()
const {
return m_brebuild_cache; }
9577int OpenGLOptionsDlg::GetTextureMemorySize()
const {
9578 return m_sTextureMemorySize->GetValue();
9581void OpenGLOptionsDlg::Populate() {
9582 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9590 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9591 m_memorySize->Show(g_bGLexpert);
9592 m_sTextureMemorySize->Show(g_bGLexpert);
9594 m_cbTextureCompressionCaching->SetValue(
9595 g_GLOptions.m_bTextureCompressionCaching);
9596 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9598 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9599 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9601#if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9602 if (top_frame::Get()->GetWxGlCanvas()) {
9603 if (top_frame::Get()->GetGlVersionString().Upper().Find(
"MESA") !=
9605 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9608 m_cbSoftwareGL->Hide();
9612 SetFont(*dialogFont);
9615 if (top_frame::Get()->GetWxGlCanvas()) {
9616 if (top_frame::Get()
9617 ->GetAbstractPrimaryCanvas()
9618 ->CanAccelerateGlPanning()) {
9619 m_cbUseAcceleratedPanning->Enable();
9620 m_cbUseAcceleratedPanning->SetValue(
9621 g_GLOptions.m_bUseAcceleratedPanning);
9623 m_cbUseAcceleratedPanning->SetValue(FALSE);
9624 m_cbUseAcceleratedPanning->Disable();
9627 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9630 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9631 m_cbUseAcceleratedPanning->Disable();
9635void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9636 if (g_GLOptions.m_bTextureCompressionCaching) {
9637 m_brebuild_cache = TRUE;
9638 EndModal(wxID_CANCEL);
9642void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9644 ::wxBeginBusyCursor();
9648 appendOSDirSlash(&path);
9649 path.append(
"raster_texture_cache");
9651 if (::wxDirExists(path)) {
9652 wxArrayString files;
9653 size_t nfiles = wxDir::GetAllFiles(path, &files);
9654 for (
unsigned int i = 0; i < files.GetCount(); i++)
9655 ::wxRemoveFile(files[i]);
9658 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9659 ::wxEndBusyCursor();
9663wxString OpenGLOptionsDlg::GetTextureCacheSize() {
9665 appendOSDirSlash(&path);
9666 path.append(
"raster_texture_cache");
9667 long long total = 0;
9669 if (::wxDirExists(path)) {
9670 wxArrayString files;
9671 size_t nfiles = wxDir::GetAllFiles(path, &files);
9672 for (
unsigned int i = 0; i < files.GetCount(); i++)
9673 total += wxFile(files[i]).Length();
9675 double mb = total / (1024.0 * 1024.0);
9676 if (mb < 10000.0)
return wxString::Format(
"%.1f MB", mb);
9678 return wxString::Format(
"%.1f GB", mb);
9686EVT_PAINT(CanvasConfigSelect::OnPaint)
9690 wxWindowID
id, wxBitmap& bmp,
9691 const wxPoint& pos, const wxSize& size)
9692 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9693 m_parentOptions = parentOptions;
9698 int refHeight = GetCharHeight();
9700 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9701 bmp.GetSize().y + m_borderWidth * 2));
9703 Connect(wxEVT_LEFT_DOWN,
9704 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9707CanvasConfigSelect::~CanvasConfigSelect() {}
9709void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9715 if (m_parentOptions)
9716 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9719void CanvasConfigSelect::SetSelected(
bool selected) {
9720 m_bSelected = selected;
9724 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9727 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9733void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9735 GetSize(&width, &height);
9738 dc.SetBackground(*wxLIGHT_GREY);
9740 dc.SetPen(*wxTRANSPARENT_PEN);
9741 dc.SetBrush(wxBrush(GetBackgroundColour()));
9742 dc.DrawRectangle(GetVirtualSize());
9745 dc.SetBrush(wxBrush(m_boxColour));
9747 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9749 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9751 dc.SetBrush(wxBrush(m_boxColour));
9753 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9755 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9758 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.
wxFont GetOCPNGUIScaledFont(wxString item)
Retrieves a font optimized for touch and high-resolution interfaces.
size_t g_current_monitor
Current monitor displaying main application frame.
Miscellaneous globals primarely used by gui layer, not persisted in configuration file.
GUI constant definitions.
Waypoint properties maintenance dialog.
Multiplexer class and helpers.
MyConfig * pConfig
Global instance.
Navigation Utility Functions without GUI dependencies.
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.
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.