52#include <wx/clrpicker.h>
55#include <wx/display.h>
56#include <wx/fontdata.h>
57#include <wx/fontdlg.h>
58#include <wx/imaglist.h>
59#include <wx/listbox.h>
60#include <wx/mediactrl.h>
61#include <wx/odcombo.h>
62#include <wx/progdlg.h>
63#include <wx/radiobox.h>
65#include <wx/renderer.h>
66#include <wx/statline.h>
67#include <wx/stdpaths.h>
68#include <wx/textwrapper.h>
69#include <wx/tokenzr.h>
71#if defined(__WXGTK__) || defined(__WXQT__)
72#include <wx/colordlg.h>
83#include "o_sound/o_sound.h"
131static inline wxString ttDistance() {
133 "Horizontal measurements and distances. Examples: Distance between "
134 "geographic positions, visibility range, radar range.");
136static inline wxString ttSpeed() {
137 return _(
"Vessel and surface speed measurements");
139static inline wxString ttWindSpeed() {
140 return _(
"Wind speed measurements and forecasts");
142static inline wxString ttDepth() {
143 return _(
"Measurements below the water surface");
145static inline wxString ttHeight() {
147 "Vertical measurements above reference datum. Examples: Tide level, wave "
148 "height, air gap, mast clearance, elevation above reference datum.");
150static inline wxString ttTemp() {
151 return _(
"Temperature measurements (air, water, engine)");
153static inline wxString ttCoordFormat() {
154 return _(
"Coordinate display format for latitude and longitude");
162#include "androidUTIL.h"
166#include <QtWidgets/QScroller>
170#if wxCHECK_VERSION(3, 2, 0)
171#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
173#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS
176#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
179#define ID_CHOICE_NMEA wxID_HIGHEST + 1
185extern wxLocale* plocale_def_lang;
193extern int g_Android_SDK_Version;
194extern MigrateAssistantDialog* g_migrateDialog;
197static wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
199static wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
202static int lang_list[] = {
203 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
204 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
205 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
206 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
207 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
208 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
209 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
210 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
212 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
213 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
214 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
215 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
216 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
217 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
225 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
226 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
227 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
228 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
229 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
230 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
231 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
232 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
233 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
234 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
235 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
236 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
237 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
238 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
239 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
240 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
241 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
242 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
243 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
244 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
245 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
246 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
247 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
248 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
249 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
252 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
253 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
254 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
255 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
256 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
258 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
259 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
260 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
261 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
262 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
263 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
264 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
265 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
266 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
267 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
268 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
269 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
270 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
271 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
272 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
273 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
274 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
275 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
276 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
278 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
279 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
280 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
281 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
282 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
283 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
284 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
285 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
286 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
287 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
288 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
289 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
290 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
294void prepareSlider(wxSlider* slider) {
295 slider->GetHandle()->setStyleSheet(
296 prepareAndroidSliderStyleSheet(slider->GetSize().x));
297 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
298 slider->GetHandle()->grabGesture(Qt::PanGesture);
299 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
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"));
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;
4820 obs::Listener m_sound_sp_done_listener;
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();
5689 pHiconColors =
new wxCheckBox(itemPanelFont, ID_HICONCOLORS,
5690 _(
"Use High Contrast Chart Colors"));
5691 miscOptions->Add(pHiconColors, 0, wxALL, border_size);
5694 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5695 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5697 wxButton* itemEcdisHelp =
5698 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5699 wxDefaultPosition, wxDefaultSize, 0);
5700 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5703 pInlandEcdis->Hide();
5704 itemEcdisHelp->Hide();
5707 miscOptions->AddSpacer(10);
5709 wxFlexGridSizer* sliderSizer;
5710 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5711 sliderSizer->AddGrowableCol(1);
5712 sliderSizer->SetFlexibleDirection(wxBOTH);
5713 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5715 m_pSlider_GUI_Factor =
5716 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5717 m_sliderSize, SLIDER_STYLE);
5718 m_pSlider_GUI_Factor->Hide();
5719 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5720 _(
"User Interface scale factor")),
5722 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5723 m_pSlider_GUI_Factor->Show();
5726 prepareSlider(m_pSlider_GUI_Factor);
5729 m_pSlider_Chart_Factor =
5730 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5731 m_sliderSize, SLIDER_STYLE);
5732 m_pSlider_Chart_Factor->Hide();
5734 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5736 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5737 m_pSlider_Chart_Factor->Show();
5740 prepareSlider(m_pSlider_Chart_Factor);
5743 m_pSlider_Ship_Factor =
5744 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5745 m_sliderSize, SLIDER_STYLE);
5746 m_pSlider_Ship_Factor->Hide();
5748 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5750 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5751 m_pSlider_Ship_Factor->Show();
5754 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5757 m_pSlider_Text_Factor =
5758 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5759 m_sliderSize, SLIDER_STYLE);
5760 m_pSlider_Text_Factor->Hide();
5762 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5764 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5765 m_pSlider_Text_Factor->Show();
5768 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5771 m_pSlider_ENCText_Factor =
5772 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5773 m_sliderSize, SLIDER_STYLE);
5774 m_pSlider_ENCText_Factor->Hide();
5776 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5778 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5779 m_pSlider_ENCText_Factor->Show();
5782 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5785 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5786 _(
"Mouse wheel zoom sensitivity")),
5788 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5789 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5791 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5792 miscOptions->AddSpacer(20);
5795void options::OnResetFont(wxCommandEvent& event) {
5796 wxString itemElement;
5797 int i = m_itemFontElementListBox->GetSelection();
5799 itemElement = m_itemFontElementListBox->GetString(i);
5801 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5803 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5804 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5807 m_textSample->SetFont(*pFont);
5808 m_textSample->SetForegroundColour(colour);
5809 m_textSample->Refresh();
5812 top_frame::Get()->UpdateAllFonts();
5813 m_bfontChanged =
true;
5814 OnFontChoice(event);
5819void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5820 m_pCheck_AlertAudio->Enable(event.IsChecked());
5821 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5824void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5825 if (event.IsChecked()) {
5826 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5827 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5828 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5832void options::CreateListbookIcons() {
5835 if (!g_bresponsive) {
5838 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5840#if wxCHECK_VERSION(2, 8, 12)
5841 m_topImgList->Add(style->GetIcon(
"Display", sx, sy));
5842 m_topImgList->Add(style->GetIcon(
"Charts", sx, sy));
5843 m_topImgList->Add(style->GetIcon(
"Connections", sx, sy));
5844 m_topImgList->Add(style->GetIcon(
"Ship", sx, sy));
5845 m_topImgList->Add(style->GetIcon(
"UI", sx, sy));
5846 m_topImgList->Add(style->GetIcon(
"Plugins", sx, sy));
5850 bmp = style->GetIcon(
"Display");
5851 img = bmp.ConvertToImage();
5852 img.ConvertAlphaToMask(128);
5853 bmp = wxBitmap(img);
5854 m_topImgList->Add(bmp);
5855 bmp = style->GetIcon(
"Charts");
5856 img = bmp.ConvertToImage();
5857 img.ConvertAlphaToMask(128);
5858 bmp = wxBitmap(img);
5859 m_topImgList->Add(bmp);
5860 bmp = style->GetIcon(
"Connections");
5861 img = bmp.ConvertToImage();
5862 img.ConvertAlphaToMask(128);
5863 bmp = wxBitmap(img);
5864 m_topImgList->Add(bmp);
5865 bmp = style->GetIcon(
"Ship");
5866 img = bmp.ConvertToImage();
5867 img.ConvertAlphaToMask(128);
5868 bmp = wxBitmap(img);
5869 m_topImgList->Add(bmp);
5870 bmp = style->GetIcon(
"UI");
5871 img = bmp.ConvertToImage();
5872 img.ConvertAlphaToMask(128);
5873 bmp = wxBitmap(img);
5874 m_topImgList->Add(bmp);
5875 bmp = style->GetIcon(
"Plugins");
5876 img = bmp.ConvertToImage();
5877 img.ConvertAlphaToMask(128);
5878 bmp = wxBitmap(img);
5879 m_topImgList->Add(bmp);
5883 bmps = style->GetIcon(
"Display");
5884 int base_size = bmps.GetWidth();
5885 double tool_size = base_size;
5887 double premult = 1.0;
5891 double target_size = 6.0;
5893 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5894 premult = target_size / basic_tool_size_mm;
5897 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5898 postmult = wxMin(postmult, 3.0);
5899 postmult = wxMax(postmult, 1.0);
5901 int sizeTab = base_size * postmult * premult;
5903 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5907 bmp = style->GetIcon(
"Display");
5908 img = bmp.ConvertToImage();
5909 simg = img.Scale(sizeTab, sizeTab);
5910 bmp = wxBitmap(simg);
5911 m_topImgList->Add(bmp);
5912 bmp = style->GetIcon(
"Charts");
5913 img = bmp.ConvertToImage();
5914 simg = img.Scale(sizeTab, sizeTab);
5915 bmp = wxBitmap(simg);
5916 m_topImgList->Add(bmp);
5917 bmp = style->GetIcon(
"Connections");
5918 img = bmp.ConvertToImage();
5919 simg = img.Scale(sizeTab, sizeTab);
5920 bmp = wxBitmap(simg);
5921 m_topImgList->Add(bmp);
5922 bmp = style->GetIcon(
"Ship");
5923 img = bmp.ConvertToImage();
5924 simg = img.Scale(sizeTab, sizeTab);
5925 bmp = wxBitmap(simg);
5926 m_topImgList->Add(bmp);
5927 bmp = style->GetIcon(
"UI");
5928 img = bmp.ConvertToImage();
5929 simg = img.Scale(sizeTab, sizeTab);
5930 bmp = wxBitmap(simg);
5931 m_topImgList->Add(bmp);
5932 bmp = style->GetIcon(
"Plugins");
5933 img = bmp.ConvertToImage();
5934 simg = img.Scale(sizeTab, sizeTab);
5935 bmp = wxBitmap(simg);
5936 m_topImgList->Add(bmp);
5940void options::CreateControls() {
5941 int border_size = 4;
5943 int group_item_spacing = 2;
5945 int font_size_y, font_descent, font_lead;
5946 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
5947 m_fontHeight = font_size_y + font_descent + font_lead;
5951 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5952 m_fontHeight * 8 / 10);
5955 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5959 m_small_button_size =
5960 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5962 m_nCharWidthMax = GetSize().x / GetCharWidth();
5965 pEnableZoomToCursor = NULL;
5966 pSmoothPanZoom = NULL;
5974 if (!g_bresponsive && height <= 800) {
5976 group_item_spacing = 1;
5980 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
5981 inputFlags = wxSizerFlags(0)
5982 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
5983 .Border(wxALL, group_item_spacing);
5984 verticleInputFlags =
5985 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
5986 groupLabelFlags = wxSizerFlags(0)
5987 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
5988 .Border(wxALL, group_item_spacing);
5989 groupLabelFlagsHoriz =
5990 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
5991 groupInputFlags = wxSizerFlags(0)
5992 .Align(wxALIGN_LEFT | wxALIGN_TOP)
5993 .Border(wxBOTTOM, group_item_spacing * 2)
5997 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
6002 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
6003 itemDialog1->SetSizer(itemBoxSizer2);
6007 wxFont* qFont = dialogFont;
6009 wxString wqs = getFontQtStylesheet(qFont);
6010 wxCharBuffer sbuf = wqs.ToUTF8();
6011 QString qsb = QString(sbuf.data());
6013 QString qsbq = getQtStyleSheet();
6015 itemDialog1->GetHandle()->setStyleSheet(qsb +
6022#ifdef OCPN_OPTIONS_USE_LISTBOOK
6024 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6025 wxSize(-1, -1), flags);
6026 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
6027 wxListbookEventHandler(options::OnPageChange), NULL,
6031 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6032 wxSize(-1, -1), flags);
6033 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6034 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
6041 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
6045 CreateListbookIcons();
6047 m_pListbook->SetImageList(m_topImgList);
6048 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
6050 m_OK_Cancel_Apply_buttons =
new wxBoxSizer(wxHORIZONTAL);
6051 itemBoxSizer2->Add(m_OK_Cancel_Apply_buttons, 0, wxALIGN_RIGHT | wxALL,
6054 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
6055 m_OKButton->SetDefault();
6056 m_OK_Cancel_Apply_buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
6059 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
6060 m_OK_Cancel_Apply_buttons->Add(m_CancelButton, 0,
6061 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6063 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
6064 m_OK_Cancel_Apply_buttons->Add(m_ApplyButton, 0,
6065 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6067 m_pageDisplay = CreatePanel(_(
"Display"));
6068 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
6069 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
6070 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
6071 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
6073 m_pageCharts = CreatePanel(_(
"Charts"));
6074 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
6075 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
6078 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
6079 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
6082 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
6084#ifdef OCPN_OPTIONS_USE_LISTBOOK
6085 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6086 wxListbookEventHandler(options::OnChartsPageChange), NULL,
6089 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6090 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
6096 wxString ConnTab = _(
"Connections");
6098 ConnTab = _(
"Connect");
6100 m_pageConnections = CreatePanel(ConnTab);
6101 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6105 m_pageShips = CreatePanel(_(
"Ships"));
6106 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
6107 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
6108 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
6110 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
6112 wxString UITab = _(
"User Interface");
6116 m_pageUI = CreatePanel(UITab);
6117 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
6118 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
6120 m_pagePlugins = CreatePanel(_(
"Plugins"));
6121 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
6123 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
6124 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
6129 SetColorScheme(
static_cast<ColorScheme
>(0));
6140 SetSizeHints(-1, -1, width - marginx, height - marginy);
6149void options::SetInitialPage(
int page_sel,
int sub_page) {
6150 if (page_sel < (
int)m_pListbook->GetPageCount())
6151 m_pListbook->SetSelection(page_sel);
6153 m_pListbook->SetSelection(0);
6155 if (sub_page >= 0) {
6156 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
6157 wxNotebookPage* pg = m_pListbook->GetPage(i);
6158 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
6160 if (i == (
size_t)page_sel) {
6161 if (sub_page < (
int)nb->GetPageCount())
6162 nb->SetSelection(sub_page);
6164 nb->SetSelection(0);
6166 nb->ChangeSelection(0);
6172void options::SetColorScheme(ColorScheme cs) {
6175#ifdef OCPN_OPTIONS_USE_LISTBOOK
6176 wxListView* lv = m_pListbook->GetListView();
6177 lv->SetBackgroundColour(GetBackgroundColour());
6180 delete m_topImgList;
6181 CreateListbookIcons();
6182 m_pListbook->SetImageList(m_topImgList);
6190 comm_dialog->SetColorScheme(cs);
6193void options::OnAISRolloverClick(wxCommandEvent& event) {
6194 m_pCheck_Rollover_Class->Enable(event.IsChecked());
6195 m_pCheck_Rollover_COG->Enable(event.IsChecked());
6196 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
6197 pStatic_CallSign->Enable(event.IsChecked());
6200void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
6202 case ID_SCREENCONFIG1:
6203 if (m_sconfigSelect_twovertical)
6204 m_sconfigSelect_twovertical->SetSelected(
false);
6208 case ID_SCREENCONFIG2:
6209 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6215void options::SetInitialSettings() {
6218 m_returnChanges = 0;
6219 m_bfontChanged =
false;
6220 m_font_element_array.Clear();
6222 b_oldhaveWMM = b_haveWMM;
6223 auto loader = PluginLoader::GetInstance();
6224 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
6227 switch (g_canvasConfig) {
6230 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
6231 if (m_sconfigSelect_twovertical)
6232 m_sconfigSelect_twovertical->SetSelected(
false);
6235 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6236 if (m_sconfigSelect_twovertical)
6237 m_sconfigSelect_twovertical->SetSelected(
true);
6240 m_screenConfig = g_canvasConfig;
6244 ActiveChartArray.Clear();
6245 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6246 ActiveChartArray.Add(m_CurrentDirList[i]);
6250 if (m_pWorkDirList) {
6251 UpdateWorkArrayFromDisplayPanel();
6252 groupsPanel->SetDBDirs(*m_pWorkDirList);
6255 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6256 delete m_pGroupArray;
6257 m_pGroupArray = groupsPanel->CloneChartGroupArray(
g_pGroupArray);
6258 groupsPanel->SetGroupArray(m_pGroupArray);
6259 groupsPanel->SetInitialSettings();
6263 pShowStatusBar->SetValue(g_bShowStatusBar);
6265 pShowMenuBar->SetValue(g_bShowMenuBar);
6267 pShowCompassWin->SetValue(g_bShowCompassWin);
6271 pCOGUPUpdateSecs->SetValue(s);
6273 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6274 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6276 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6277 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6278 pMobile->SetValue(g_btouch);
6279 pResponsive->SetValue(g_bresponsive);
6286 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6290 pInlandEcdis->SetValue(g_bInlandEcdis);
6291 pHiconColors->SetValue(g_hicon_colors);
6294 pOpenGL->SetValue(g_bopengl);
6295 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6296 w->Enable(pOpenGL->IsChecked());
6299 pCBTrueShow->SetValue(g_bShowTrue);
6300 pCBMagShow->SetValue(g_bShowMag);
6302 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6306 itemStaticTextUserVar->SetLabel(
6307 _(
"WMM Plugin calculated magnetic variation"));
6309 s.Printf(
"%4.1f",
gVar);
6310 pMagVar->SetValue(s);
6312 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6314 s.Printf(
"%4.1f", g_UserVar);
6315 pMagVar->SetValue(s);
6318 int newLength = itemStaticTextUserVar->GetLabel().Length();
6321 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6322 wxSize sz = GetSize();
6323 SetSize(sz.x + 1, sz.y);
6327 itemStaticTextUserVar2->Enable(!b_haveWMM);
6328 pMagVar->Enable(!b_haveWMM);
6335 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6339 wxString stringDefaultBoatSpeed;
6340 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6341 g_defaultBoatSpeed = 6.0;
6342 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6344 stringDefaultBoatSpeed.Printf(
"%d", (
int)g_defaultBoatSpeedUserUnit);
6345 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6349 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6350 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6351 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6353 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6355 s.Printf(
"%6.2f", g_ownship_predictor_minutes);
6357 s.Printf(
"%4.0f", g_ownship_predictor_minutes);
6358 m_pText_OSCOG_Predictor->SetValue(s);
6360 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6361 g_ownship_HDTpredictor_miles) > 1e-4)
6362 s.Printf(
"%6.2f", g_ownship_HDTpredictor_miles);
6364 s.Printf(
"%4.0f", g_ownship_HDTpredictor_miles);
6365 m_pText_OSHDT_Predictor->SetValue(s);
6369 m_pTxt_OwnMMSI->SetValue(s);
6371 m_pTxt_OwnMMSI->SetValue(
"");
6373 m_pShipIconType->SetSelection(g_OwnShipIconType);
6374 wxCommandEvent eDummy;
6375 OnShipTypeSelect(eDummy);
6376 m_pOSLength->SetValue(wxString::Format(
"%.1f", g_n_ownship_length_meters));
6377 m_pOSWidth->SetValue(wxString::Format(
"%.1f", g_n_ownship_beam_meters));
6378 m_pOSGPSOffsetX->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_x));
6379 m_pOSGPSOffsetY->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_y));
6380 m_pOSMinSize->SetValue(wxString::Format(
"%d", g_n_ownship_min_mm));
6381 m_pText_ACRadius->SetValue(
6382 wxString::Format(
"%.3f", g_n_arrival_circle_radius));
6385 if (g_iNavAidRadarRingsNumberVisible > 10)
6386 g_iNavAidRadarRingsNumberVisible = 10;
6387 pNavAidRadarRingsNumberVisible->SetSelection(
6388 g_iNavAidRadarRingsNumberVisible);
6389 buf.Printf(
"%.3f", g_fNavAidRadarRingsStep);
6390 pNavAidRadarRingsStep->SetValue(buf);
6391 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6392 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6394 pScaMinChckB->SetValue(g_bUseWptScaMin);
6395 m_pText_ScaMin->SetValue(wxString::Format(
"%i", g_iWpt_ScaMin));
6396 m_pText_ScaMax->SetValue(wxString::Format(
"%i", g_iWpt_ScaMax));
6397 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6399 OnRadarringSelect(eDummy);
6401 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6402 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6403 buf.Printf(
"%.3f", g_fWaypointRangeRingsStep);
6404 pWaypointRangeRingsStep->SetValue(buf);
6405 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6407 OnWaypointRangeRingSelect(eDummy);
6408 pShowshipToActive->SetValue(g_bShowShipToActive);
6409 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6410 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6412 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6413 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6415 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6416 if (pEnableTenHertz) pEnableTenHertz->SetValue(g_btenhertz);
6418 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6419 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6421 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6423 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6426 pSDMMFormat->Select(g_iSDMMFormat);
6430 pDistanceFormat->SetSelection(distance_ui_index);
6433 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6435 if (pHeightUnitSelect) pHeightUnitSelect->SetSelection(
g_iHeightFormat);
6437 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6438 g_bAdvanceRouteWaypointOnArrivalOnly);
6449 pTrackDaily->SetValue(g_bTrackDaily);
6450 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6451 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6452 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6453 TIME_TYPE_COMPUTER);
6454 pTrackHighlite->SetValue(g_bHighliteTracks);
6455 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6456 pTrackPrecision->SetSelection(g_nTrackPrecision);
6458 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6462 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6464 s.Printf(
"%4.1f", g_CPAMax_NM);
6465 m_pText_CPA_Max->SetValue(s);
6467 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6469 s.Printf(
"%4.1f", g_CPAWarn_NM);
6470 m_pText_CPA_Warn->SetValue(s);
6472 if (m_pCheck_CPA_Warn->GetValue()) {
6473 m_pCheck_CPA_WarnT->Enable();
6474 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6476 m_pCheck_CPA_WarnT->Disable();
6478 s.Printf(
"%4.0f", g_TCPA_Max);
6479 m_pText_CPA_WarnT->SetValue(s);
6482 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6484 s.Printf(
"%4.0f", g_MarkLost_Mins);
6485 m_pText_Mark_Lost->SetValue(s);
6487 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6489 s.Printf(
"%4.0f", g_RemoveLost_Mins);
6490 m_pText_Remove_Lost->SetValue(s);
6493 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6495 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6496 m_pText_COG_Predictor->SetValue(s);
6498 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6499 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6501 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6503 s.Printf(
"%4.0f", g_AISShowTracks_Mins);
6504 m_pText_Track_Length->SetValue(s);
6506 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6508 s.Printf(
"%4.1f", g_ShowMoored_Kts);
6509 m_pText_Moored_Speed->SetValue(s);
6511 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6513 s.Printf(
"%4.1f", g_AIS_RealtPred_Kts);
6514 m_pText_RealtPred_Speed->SetValue(s);
6516 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6518 s.Printf(
"%i", g_ShowScaled_Num);
6519 m_pText_Scale_Priority->SetValue(s);
6521 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6523 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6524 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6526 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6528 s.Printf(
"%d", g_Show_Target_Name_Scale);
6529 m_pText_Show_Target_Name_Scale->SetValue(s);
6531 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6532 m_pWplAction->SetSelection(g_WplAction);
6535 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6536 if (g_bAIS_CPA_Alert) {
6537 m_pCheck_AlertAudio->Enable();
6538 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6540 m_pCheck_AlertAudio->Disable();
6541 m_pCheck_AlertAudio->SetValue(
false);
6544 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6546 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6547 s.Printf(
"%4.0f", g_AckTimeout_Mins);
6548 m_pText_ACK_Timeout->SetValue(s);
6551 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6552 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6553 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6556 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6557 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6558 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6560 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6561 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6563 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6564 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6565 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6566 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6567 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6568 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6571 if (!g_config_display_size_manual) {
6572 pRBSizeAuto->SetValue(TRUE);
6574 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6576 screenmm.RemoveLast();
6577 pScreenMM->Disable();
6580 screenmm.Append(wxString::Format(
"%zu,", mm));
6582 screenmm.RemoveLast();
6583 pRBSizeManual->SetValue(TRUE);
6586 pScreenMM->SetValue(screenmm);
6590 UpdateOptionsUnits();
6592 SetInitialVectorSettings();
6594 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6596 s.Printf(
"%d", g_nAutoHideToolbar);
6597 pToolbarHideSecs->SetValue(s);
6601 delete m_pSerialArray;
6602 m_pSerialArray = NULL;
6604 m_bForceNewToolbaronCancel =
false;
6607void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6608 if (ps57CtlListBox) {
6610 ps57CtlListBox->Clear();
6611 marinersStdXref.clear();
6613 ps57CtlListBox->Freeze();
6615 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6617 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6620 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6621 item = ps52plib->OBJLDescriptions[iPtr];
6623 item = wxString(pOLE->OBJLName, wxConvUTF8);
6629 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6630 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6631 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6633 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6634 (catl == DISPLAYBASE))
6636 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6639 bool benable =
true;
6640 if (cat > 0) benable = cat != DISPLAYBASE;
6645 int newpos = ps57CtlListBox->Append(item, benable,
false);
6646 marinersStdXref.push_back(newpos);
6647 for (
size_t i = 0; i < iPtr; i++) {
6648 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6652 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6654 if (cat == DISPLAYBASE) bviz =
true;
6657 if (cat == STANDARD) {
6662 ps57CtlListBox->Check(newpos, bviz);
6664 ps57CtlListBox->Thaw();
6667 ps57CtlListBox->RunLayout();
6670 wxSize s = ps57CtlListBox->GetSize();
6671 ps57CtlListBox->SetSize(s.x, s.y - 1);
6675void options::SetInitialVectorSettings() {
6676 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6680 m_bVectorInit =
true;
6681 resetMarStdList(
true,
false);
6684 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6688 switch (ps52plib->GetDisplayCategory()) {
6698 case (MARINERS_STANDARD):
6706 if (pDispCat) pDispCat->SetSelection(nset);
6710 bool benableMarStd =
false;
6712 for (
unsigned int i = 0; i <
g_canvasArray.GetCount(); i++) {
6715 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6716 benableMarStd =
true;
6725 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6726 itemButtonClearList->Enable(benableMarStd);
6727 itemButtonSelectList->Enable(benableMarStd);
6728 itemButtonSetStd->Enable(benableMarStd);
6731 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6732 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6733 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6734 if (pCheck_XLSECTTEXT)
6735 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6737 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6738 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6739 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6740 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6742 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6743 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6746 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6747 pPointStyle->SetSelection(0);
6749 pPointStyle->SetSelection(1);
6751 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6752 pBoundStyle->SetSelection(0);
6754 pBoundStyle->SetSelection(1);
6756 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6757 p24Color->SetSelection(0);
6759 p24Color->SetSelection(1);
6761 UpdateOptionsUnits();
6765void options::UpdateOptionsUnits() {
6766 int depthUnit = pDepthUnitSelect->GetSelection();
6768 depthUnit = wxMax(depthUnit, 0);
6769 depthUnit = wxMin(depthUnit, 2);
6775 else if (depthUnit == 2)
6781 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6782 wxString depthUnitString = depthUnitStrings[depthUnit];
6783 m_depthUnitsShal->SetLabel(depthUnitString);
6784 m_depthUnitsSafe->SetLabel(depthUnitString);
6785 m_depthUnitsDeep->SetLabel(depthUnitString);
6788 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6790 m_ShallowCtl->SetValue(s);
6792 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6794 m_SafetyCtl->SetValue(s);
6796 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6798 m_DeepCtl->SetValue(s);
6828void options::OnSizeAutoButton(wxCommandEvent& event) {
6831 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6833 screenmm.RemoveLast();
6834 pScreenMM->SetValue(screenmm);
6835 pScreenMM->Disable();
6836 g_config_display_size_manual = FALSE;
6839void options::OnSizeManualButton(wxCommandEvent& event) {
6843 screenmm.Append(wxString::Format(
"%zu,", mm));
6847 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6850 screenmm.RemoveLast();
6851 pScreenMM->SetValue(screenmm);
6852 pScreenMM->Enable();
6853 g_config_display_size_manual = TRUE;
6856void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6858void options::OnCPAWarnClick(wxCommandEvent& event) {
6859 if (m_pCheck_CPA_Warn->GetValue()) {
6860 m_pCheck_CPA_WarnT->Enable();
6862 m_pCheck_CPA_WarnT->SetValue(FALSE);
6863 m_pCheck_CPA_WarnT->Disable();
6867void options::OnSyncCogPredClick(wxCommandEvent& event) {
6868 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6869 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6870 m_pText_COG_Predictor->Disable();
6873 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6874 m_pText_COG_Predictor->SetValue(s);
6875 m_pText_COG_Predictor->Enable();
6879void options::OnShipTypeSelect(wxCommandEvent& event) {
6880 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6881 dispOptions->Layout();
6883 itemPanelShip->Layout();
6884 itemPanelShip->Refresh();
6888void options::OnRadarringSelect(wxCommandEvent& event) {
6889 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6890 dispOptions->Layout();
6892 itemPanelShip->Layout();
6893 itemPanelShip->Refresh();
6897void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6898 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6899 dispOptions->Layout();
6901 itemPanelRoutes->Layout();
6902 itemPanelRoutes->Refresh();
6906void options::OnGLClicked(wxCommandEvent& event) {
6909 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6910 w->Enable(pOpenGL->IsChecked());
6913void options::OnOpenGLOptions(wxCommandEvent& event) {
6915 OpenGLOptionsDlg dlg(
this);
6917 if (dlg.ShowModal() == wxID_OK) {
6918 if (top_frame::Get()->GetWxGlCanvas()) {
6919 g_GLOptions.m_bUseAcceleratedPanning =
6920 g_bGLexpert ? dlg.GetAcceleratedPanning()
6922 ->GetAbstractPrimaryCanvas()
6923 ->CanAccelerateGlPanning();
6926 g_bSoftwareGL = dlg.GetSoftwareGL();
6928 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6929 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6933 g_GLOptions.m_bTextureCompressionCaching =
6934 dlg.GetTextureCompressionCaching();
6935 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6938 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6942 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6944 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6946 if (top_frame::Get()->GetWxGlCanvas()) {
6947 ::wxBeginBusyCursor();
6948 top_frame::Get()->GetAbstractPrimaryCanvas()->SetupGlCompression();
6950 ::wxEndBusyCursor();
6953 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6956 if (dlg.GetRebuildCache()) {
6957 m_returnChanges = REBUILD_RASTER_CACHE;
6963void options::OnChartDirListSelect(wxCommandEvent& event) {
6965 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6966 m_removeBtn->Enable(selected);
6967 if (m_compressBtn) m_compressBtn->Enable(selected);
6971void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6974 const bool select = pDispCat->GetSelection() == 3;
6975 ps57CtlListBox->Enable(select);
6976 itemButtonClearList->Enable(select);
6977 itemButtonSelectList->Enable(select);
6978 itemButtonSetStd->Enable(select);
6984void options::OnButtonClearClick(wxCommandEvent& event) {
6985 resetMarStdList(
false,
false);
6994void options::OnButtonSelectClick(wxCommandEvent& event) {
6995 int nOBJL = ps57CtlListBox->GetCount();
6996 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
7001void options::OnButtonSetStd(wxCommandEvent& event) {
7002 resetMarStdList(
false,
true);
7007bool options::ShowToolTips() {
return TRUE; }
7009void options::OnCharHook(wxKeyEvent& event) {
7010 if (event.GetKeyCode() == WXK_RETURN &&
7011 event.GetModifiers() == wxMOD_CONTROL) {
7012 wxCommandEvent okEvent;
7013 okEvent.SetId(xID_OK);
7014 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
7015 GetEventHandler()->AddPendingEvent(okEvent);
7020void options::OnButtonaddClick(wxCommandEvent& event) {
7022 int dresult = g_Platform->DoDirSelectorDialog(
7023 this, &selDir, _(
"Add a directory containing chart files"),
7024 *pInit_Chart_Dir,
false);
7026 if (dresult != wxID_CANCEL) AddChartDir(selDir);
7031void options::AddChartDir(
const wxString& dir) {
7032 wxFileName dirname = wxFileName(dir);
7033 pInit_Chart_Dir->Empty();
7038 f.MakeRelativeTo(g_Platform->GetHomeDir());
7039 dirAdd = f.GetFullPath();
7041 pInit_Chart_Dir->Append(dirname.GetPath());
7046 cdi.fullpath = dirAdd;
7047 ActiveChartArray.Add(cdi);
7049 UpdateChartDirList();
7051 k_charts |= CHANGE_CHARTS;
7053 pScanCheckBox->Disable();
7056void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
7059 ActiveChartArray.Clear();
7060 for (
size_t i = 0; i < p.GetCount(); i++) {
7061 ActiveChartArray.Add(p[i]);
7064 UpdateChartDirList();
7067void options::UpdateWorkArrayFromDisplayPanel() {
7069 int n = ActiveChartArray.GetCount();
7070 if (m_pWorkDirList) {
7071 m_pWorkDirList->Clear();
7072 for (
int i = 0; i < n; i++) {
7073 dirname = ActiveChartArray[i].fullpath;
7074 if (!dirname.IsEmpty()) {
7077 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7078 (dirname.Last() == wxChar(_T(
'\r'))))
7079 dirname.RemoveLast();
7085 bool b_added = FALSE;
7088 int nDir = m_CurrentDirList.GetCount();
7090 for (
int i = 0; i < nDir; i++) {
7091 if (m_CurrentDirList[i].fullpath == dirname) {
7093 m_pWorkDirList->Add(cdi);
7101 cdin.fullpath = dirname;
7102 m_pWorkDirList->Add(cdin);
7109void options::OnApplyClick(wxCommandEvent& event) {
7110 ApplyChanges(event);
7115 if ((m_returnChanges & FONT_CHANGED) ||
7116 (m_returnChanges & NEED_NEW_OPTIONS)) {
7121 m_callbacks.prepare_close(
this, m_returnChanges);
7122 if (!(m_returnChanges & FONT_CHANGED_SAFE))
7123 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
true);
7127 if ((m_returnChanges & CONFIG_CHANGED)) {
7128 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
false);
7133void options::ApplyChanges(wxCommandEvent& event) {
7139 if (m_pShipIconType->GetSelection() > 0) {
7140 double n_ownship_length_meters;
7141 double n_ownship_beam_meters;
7142 double n_gps_antenna_offset_y;
7143 double n_gps_antenna_offset_x;
7144 long n_ownship_min_mm;
7145 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
7146 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
7147 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
7148 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
7149 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
7151 if (n_ownship_length_meters <= 0)
7152 msg += _(
"\n - your ship's length must be > 0");
7153 if (n_ownship_beam_meters <= 0)
7154 msg += _(
"\n - your ship's beam must be > 0");
7155 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
7157 "\n - your GPS offset from midship must be within your ship's beam");
7158 if (n_gps_antenna_offset_y < 0 ||
7159 n_gps_antenna_offset_y > n_ownship_length_meters)
7161 _(
"\n - your GPS offset from bow must be within your ship's length");
7162 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
7163 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
7164 if (!msg.IsEmpty()) {
7165 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
7166 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
7167 ::wxEndBusyCursor();
7168 event.SetInt(wxID_STOP);
7171 g_n_ownship_length_meters = n_ownship_length_meters;
7172 g_n_ownship_beam_meters = n_ownship_beam_meters;
7173 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
7174 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
7175 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
7177 g_OwnShipIconType = m_pShipIconType->GetSelection();
7178 g_bShowShipToActive = pShowshipToActive->GetValue();
7179 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
7180 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
7182 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
7183 g_n_arrival_circle_radius =
7184 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
7186 wxString* icon_name =
7187 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
7188 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
7191 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
7192 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
7194 g_bUseWptScaMin = pScaMinChckB->GetValue();
7195 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
7196 g_iWpt_ScaMax = wxAtoi(m_pText_ScaMax->GetValue());
7197 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
7200 if (m_bfontChanged) {
7202 if (top_frame::Get()->GetWxGlCanvas()) {
7203 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7206 if (top_frame::Get()->GetAbstractPrimaryCanvas()) {
7207 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7210 m_returnChanges |= FONT_CHANGED;
7214 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
7215 m_returnChanges |= FONT_CHANGED_SAFE;
7219 UpdateWorkArrayFromDisplayPanel();
7221 groupsPanel->SetDBDirs(*m_pWorkDirList);
7222 groupsPanel->m_treespopulated = FALSE;
7224 int k_force = FORCE_UPDATE;
7225 if (pUpdateCheckBox) {
7226 if (!pUpdateCheckBox->GetValue()) k_force = 0;
7227 pUpdateCheckBox->Enable();
7228 pUpdateCheckBox->SetValue(FALSE);
7233 m_returnChanges |= k_force;
7235 int k_scan = SCAN_UPDATE;
7236 if (pScanCheckBox) {
7237 if (!pScanCheckBox->GetValue()) k_scan = 0;
7238 pScanCheckBox->Enable();
7239 pScanCheckBox->SetValue(FALSE);
7244 m_returnChanges |= k_scan;
7246 pConfig->UpdateChartDirs(*m_pWorkDirList);
7250 if (groupsPanel->modified) {
7253 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
7254 m_returnChanges |= GROUPS_CHANGED;
7259 g_bShowStatusBar = pShowStatusBar->GetValue();
7262 bool bmenu_shown = g_bShowMenuBar;
7263 if (pShowMenuBar->GetValue() != bmenu_shown)
7264 m_returnChanges |= MENU_CHANGED;
7265 g_bShowMenuBar = pShowMenuBar->GetValue();
7268 g_bShowCompassWin = pShowCompassWin->GetValue();
7271 g_bShowChartBar = pShowChartBar->GetValue();
7273 wxString screenmm = pScreenMM->GetValue();
7274 wxStringTokenizer tkz(screenmm,
",");
7276 while (tkz.HasMoreTokens()) {
7277 wxString token = tkz.GetNextToken();
7279 if (token.ToLong(&mm) && mm > 0) {
7285 g_config_display_size_manual = pRBSizeManual->GetValue();
7289 comm_dialog->ApplySettings();
7291 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7295 bool temp_bquilting = pCDOQuilting->GetValue();
7298 g_bQuiltEnable = temp_bquilting;
7302 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7303 g_bskew_comp = pSkewComp->GetValue();
7304 g_btouch = pMobile->GetValue();
7305 g_bresponsive = pResponsive->GetValue();
7307 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7309 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7312 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7313 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7314 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7328 long update_val = 1;
7329 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7330 g_COGAvgSec = wxMin(
static_cast<int>(update_val), kMaxCogAverageSeconds);
7334 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7336 g_bShowTrue = pCBTrueShow->GetValue();
7337 g_bShowMag = pCBMagShow->GetValue();
7339 auto loader = PluginLoader::GetInstance();
7340 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
7341 if (!b_haveWMM && !b_oldhaveWMM) {
7342 pMagVar->GetValue().ToDouble(&g_UserVar);
7347 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7348 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7351 g_iNavAidRadarRingsNumberVisible =
7352 pNavAidRadarRingsNumberVisible->GetSelection();
7353 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7354 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7355 g_fNavAidRadarRingsStep = temp_dbl;
7356 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7357 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7358 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7359 g_fWaypointRangeRingsStep = temp_dbl;
7360 g_iWaypointRangeRingsStepUnits =
7361 m_itemWaypointRangeRingsUnits->GetSelection();
7363 m_colourWaypointRangeRingsColour->GetColour();
7368 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7370 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7372 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7374 if (pCmdSoundString) {
7375 g_CmdSoundString = pCmdSoundString->GetValue();
7376 if (wxIsEmpty(g_CmdSoundString)) {
7377 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7378 pCmdSoundString->SetValue(g_CmdSoundString);
7382 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7383 if (pSoundDeviceIndex)
7384 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7386 g_iSDMMFormat = pSDMMFormat->GetSelection();
7389 int sel = pDistanceFormat->GetSelection();
7393 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7395 if (pHeightUnitSelect)
g_iHeightFormat = pHeightUnitSelect->GetSelection();
7398 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7399 if (pSDefaultBoatSpeed)
7400 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7401 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7402 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7403 getUsrSpeedUnit() +
")");
7405 g_bAdvanceRouteWaypointOnArrivalOnly =
7406 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7408 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7409 g_colourTrackLineColour =
7410 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7411 g_colourTrackLineColour.Blue());
7412 g_nTrackPrecision = pTrackPrecision->GetSelection();
7414 g_bTrackDaily = pTrackDaily->GetValue();
7416 g_track_rotate_time = 0;
7417#if wxUSE_TIMEPICKCTRL
7419 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7420 g_track_rotate_time = h * 3600 + m * 60 + s;
7423 if (pTrackRotateUTC->GetValue())
7424 g_track_rotate_time_type = TIME_TYPE_UTC;
7425 else if (pTrackRotateLMT->GetValue())
7426 g_track_rotate_time_type = TIME_TYPE_LMT;
7428 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7430 g_bHighliteTracks = pTrackHighlite->GetValue();
7437 if (pEnableZoomToCursor)
7438 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7440 if (pEnableTenHertz) g_btenhertz = pEnableTenHertz->GetValue();
7443 g_bEnableZoomToCursor =
false;
7446 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7447 g_colourOwnshipRangeRingsColour =
7448 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7449 g_colourOwnshipRangeRingsColour.Green(),
7450 g_colourOwnshipRangeRingsColour.Blue());
7453 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7454 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7455 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7456 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7460 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7461 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7462 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7463 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7464 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7465 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7468 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7469 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7470 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7471 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7474 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7476 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7477 if (g_bSyncCogPredictors) {
7478 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7480 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7482 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7483 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7487 for (
const auto& it :
g_pAIS->GetTargetList()) {
7488 auto pAISTarget = it.second;
7489 if (NULL != pAISTarget) {
7490 pAISTarget->b_show_track = g_bAISShowTracks;
7495 if (TRACKTYPE_NEVER == props->TrackType) {
7496 pAISTarget->b_show_track =
false;
7498 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7499 pAISTarget->b_show_track =
true;
7506 std::map<int, Track*>::iterator it;
7507 it =
g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7508 if (it !=
g_pAIS->m_persistent_tracks.end())
7509 pAISTarget->b_show_track =
true;
7510 pAISTarget->b_show_track_old = g_bAISShowTracks;
7515 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7516 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7518 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7519 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7521 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7523 m_pText_Scale_Priority->GetValue().ToLong(&l);
7524 g_ShowScaled_Num = (int)l;
7526 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7527 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7528 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7529 long ais_name_scale = 5000;
7530 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7531 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7532 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7533 g_WplAction = m_pWplAction->GetSelection();
7536 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7537 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7538 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7540 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7541 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7544 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7545 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7546 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7548 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7549 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7550 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7551 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7553 bool bchange_scale =
false;
7554 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7555 bchange_scale =
true;
7556 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7559 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7560 g_MarkScaleFactorExp = g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7561 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7562 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7563 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7564 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7566 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7567 g_mouse_zoom_sensitivity =
7572 if (pWayPointMan)
WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7580 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7581 g_bopengl = pOpenGL->GetValue();
7584 g_bChartBarEx = pChartBarEX->GetValue();
7587 int depthUnit = pDepthUnitSelect->GetSelection();
7591 bool bUserStdChange =
false;
7593 int nOBJL = ps57CtlListBox->GetCount();
7595 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7597 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7598 if (marinersStdXref[i] == iPtr) {
7603 assert(itemIndex >= 0);
7604 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7605 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7606 bUserStdChange =
true;
7607 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7613 ps52plib->GenerateStateHash();
7614 long stateHash = ps52plib->GetStateHash();
7616 if (m_returnChanges & GL_CHANGED) {
7619 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7621 ps52plib->ClearCNSYLUPArray();
7622 ps52plib->GenerateStateHash();
7626 enum _DisCat nset = OTHER;
7627 switch (pDispCat->GetSelection()) {
7638 nset = MARINERS_STANDARD;
7641 ps52plib->SetDisplayCategory(nset);
7644 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7645 if (pCheck_ATONTEXT)
7646 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7647 if (pCheck_LDISTEXT)
7648 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7649 if (pCheck_XLSECTTEXT)
7650 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7652 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7653 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7654 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7655 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7656 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7657 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7659 ps52plib->m_nSymbolStyle =
7660 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7662 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7664 : SYMBOLIZED_BOUNDARIES;
7665 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7666 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7668 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7669 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7677 else if (depthUnit == 2)
7680 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7681 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7683 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7687 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7688 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7690 if (m_DeepCtl->GetValue().ToDouble(&dval))
7691 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7693 ps52plib->UpdateMarinerParams();
7694 ps52plib->m_nDepthUnitDisplay = depthUnit;
7698 ps52plib->GenerateStateHash();
7701 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7702 m_returnChanges |= S52_CHANGED;
7704 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7708#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7710 wxString new_canon =
"en_US";
7711 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7713 int nLang =
sizeof(lang_list) /
sizeof(
int);
7714 for (
int it = 0; it < nLang; it++) {
7715 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7717 wxString lang_canonical = pli->CanonicalName;
7718 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7719 if (lang_sel == test_string) {
7720 new_canon = lang_canonical;
7726 wxString locale_old = g_locale;
7727 g_locale = new_canon;
7729 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7731 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7734 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7735 m_returnChanges |= STYLE_CHANGED;
7737 wxSizeEvent nullEvent;
7738 top_frame::Get()->OnSize(nullEvent);
7741 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7742 g_bInlandEcdis = pInlandEcdis->GetValue();
7743 SwitchInlandEcdisMode(g_bInlandEcdis);
7744 m_returnChanges |= TOOLBAR_CHANGED;
7747 if (pHiconColors) g_hicon_colors = pHiconColors->GetValue();
7751 if (PluginLoader::GetInstance()->UpdatePlugIns())
7752 m_returnChanges |= TOOLBAR_CHANGED;
7758 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7759 m_groups_changed | k_plugins;
7764 wxString string_acc;
7765 for (wxString entry : TideCurrentDataSet) {
7766 string_acc += entry;
7769 wxString string_acc_control;
7770 for (
int i = 0; i < tcDataSelected->GetItemCount(); i++) {
7771 wxString setName = tcDataSelected->GetItemText(i);
7772 string_acc_control += setName;
7775 if (!string_acc.IsSameAs(string_acc_control)) {
7776 TideCurrentDataSet.clear();
7777 int nEntry = tcDataSelected->GetItemCount();
7778 for (
int i = 0; i < nEntry; i++) {
7779 wxString setName = tcDataSelected->GetItemText(i);
7780 TideCurrentDataSet.push_back(setName.ToStdString());
7782 m_returnChanges |= TIDES_CHANGED;
7785 if (g_canvasConfig != m_screenConfig) m_returnChanges |= CONFIG_CHANGED;
7786 g_canvasConfig = m_screenConfig;
7788 UpdateWorkArrayFromDisplayPanel();
7791 if ((m_returnChanges & VISIT_CHARTS) &&
7792 ((m_returnChanges & CHANGE_CHARTS) || (m_returnChanges & SCAN_UPDATE))) {
7793 DoDBSUpdate((m_returnChanges & FORCE_UPDATE) == FORCE_UPDATE);
7795 bool b_groupchange =
ChartData->ScrubGroupArray();
7797 if (b_groupchange ||
7798 ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)) {
7799 pConfig->DestroyConfigGroups();
7802 if ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)
7806 m_callbacks.process_dialog(m_returnChanges, m_pWorkDirList);
7810 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7813 top_frame::Get()->RefreshAllCanvas();
7816 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7818 if (m_bVisitPlugins) m_returnChanges |= FORCE_RELOAD;
7821 UpdateTemplateTitleText();
7824 ::wxEndBusyCursor();
7827void options::OnXidOkClick(wxCommandEvent& event) {
7830 if (event.GetEventObject() == NULL)
return;
7832 ApplyChanges(event);
7835 m_callbacks.prepare_close(
this, m_returnChanges);
7838 if ((m_returnChanges & CONFIG_CHANGED) || (m_returnChanges & GL_CHANGED))
7839 top_frame::Get()->ScheduleReconfigAndSettingsReload(
false,
false);
7842 if ((m_returnChanges & FONT_CHANGED) &&
7843 !(m_returnChanges & FONT_CHANGED_SAFE))
7844 top_frame::Get()->ScheduleDeleteSettingsDialog();
7847 if (m_returnChanges & LOCALE_CHANGED)
7848 top_frame::Get()->ScheduleDeleteSettingsDialog();
7850 if ((m_returnChanges & FONT_CHANGED) ||
7851 (m_returnChanges & NEED_NEW_OPTIONS)) {
7858 if (m_returnChanges & FORCE_RELOAD) top_frame::Get()->ScheduleReloadCharts();
7864void options::Finish() {
7866 m_pListbook->ChangeSelection(0);
7867 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7868 wxNotebookPage* pg = m_pListbook->GetPage(i);
7869 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7870 if (nb) nb->ChangeSelection(0);
7873 lastWindowPos = GetPosition();
7874 lastWindowSize = GetSize();
7876 pConfig->SetPath(
"/Settings");
7877 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7878 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7881ArrayOfCDI options::GetSelectedChartDirs() {
7883 for (
size_t i = 0; i < panelVector.size(); i++) {
7884 if (panelVector[i]->IsSelected()) {
7885 rv.Add(panelVector[i]->GetCDI());
7892ArrayOfCDI options::GetUnSelectedChartDirs() {
7894 for (
size_t i = 0; i < panelVector.size(); i++) {
7895 if (!panelVector[i]->IsSelected()) {
7896 rv.Add(panelVector[i]->GetCDI());
7903void options::SetDirActionButtons() {
7904 ArrayOfCDI selArray = GetSelectedChartDirs();
7905 if (selArray.GetCount())
7906 m_removeBtn->Enable();
7908 m_removeBtn->Disable();
7911void options::OnButtondeleteClick(wxCommandEvent& event) {
7912 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7913 ActiveChartArray.Clear();
7914 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7915 ActiveChartArray.Add(unselArray[i]);
7918 UpdateChartDirList();
7920 UpdateWorkArrayFromDisplayPanel();
7923 if (m_pWorkDirList) {
7924 pActiveChartsList->DeleteAllItems();
7925 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7926 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7929 li.SetAlign(wxLIST_FORMAT_LEFT);
7930 li.SetText(dirname);
7932 long idx = pActiveChartsList->InsertItem(li);
7937 k_charts |= CHANGE_CHARTS;
7939 pScanCheckBox->Disable();
7944void options::DoDBSUpdate(
bool force_full) {
7945 m_OKButton->Disable();
7946 m_CancelButton->Disable();
7947 m_ApplyButton->Disable();
7949 wxString longmsg = _(
"OpenCPN Chart Update");
7951 ".................................................................."
7954 m_pCBDSprog =
new wxGenericProgressDialog();
7957 m_pCBDSprog->SetFont(*qFont);
7960 m_pCBDSprog->Create(_(
"OpenCPN Chart Update"), longmsg, 100,
nullptr,
7963 DimeControl(m_pCBDSprog);
7964 m_pCBDSprog->Show();
7969 m_bTextureCacheingSave = g_GLOptions.m_bTextureCompressionCaching;
7970 g_GLOptions.m_bTextureCompressionCaching =
false;
7972 ChartData->UpdateChartDatabaseInplace(*m_pWorkDirList, force_full,
7976void options::OnButtonRebuildChartDb(wxCommandEvent& event) {
7980void options::OnButtonParseENC(wxCommandEvent& event) {
7981 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
false);
7983 extern void ParseAllENC(wxWindow * parent);
7985 ParseAllENC(g_pOptions);
7988 top_frame::Get()->ChartsRefresh();
7990 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
true);
7996static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
7999 lzma_action action = LZMA_RUN;
8003 uint8_t inbuf[BUFSIZ];
8004 uint8_t outbuf[BUFSIZ];
8017 strm->next_in = NULL;
8019 strm->next_out = outbuf;
8020 strm->avail_out =
sizeof(outbuf);
8026 if (strm->avail_in == 0 && !feof(infile)) {
8027 strm->next_in = inbuf;
8028 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
8030 if (ferror(infile)) {
8031 fprintf(stderr,
"Read error: %s\n", strerror(errno));
8039 if (feof(infile)) action = LZMA_FINISH;
8057 lzma_ret ret = lzma_code(strm, action);
8062 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
8067 size_t write_size =
sizeof(outbuf) - strm->avail_out;
8069 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
8070 fprintf(stderr,
"Write error: %s\n", strerror(errno));
8075 strm->next_out = outbuf;
8076 strm->avail_out =
sizeof(outbuf);
8081 if (ret != LZMA_OK) {
8088 if (ret == LZMA_STREAM_END)
return true;
8099 case LZMA_MEM_ERROR:
8100 msg =
"Memory allocation failed";
8103 case LZMA_DATA_ERROR:
8116 msg =
"File size limits exceeded";
8131 msg =
"Unknown error, possibly a bug";
8135 wxLogMessage(
"LZMA Encoder error: %s (error code %u)\n", msg, ret);
8142static bool CompressChart(wxString in, wxString out) {
8144 FILE* infile = fopen(in.mb_str(),
"rb");
8145 if (!infile)
return false;
8147 FILE* outfile = fopen(out.mb_str(),
"wb");
8153 lzma_stream strm = LZMA_STREAM_INIT;
8154 bool success =
false;
8155 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
8157 success = compress(&strm, infile, outfile);
8168void options::OnButtonmigrateClick(wxCommandEvent& event) {
8174 new MigrateAssistantDialog(wxTheApp->GetTopWindow(),
true);
8175 g_migrateDialog->SetSize(top_frame::Get()->GetSize());
8176 g_migrateDialog->Centre();
8177 g_migrateDialog->Raise();
8178 g_migrateDialog->ShowModal();
8182void options::OnButtonEcdisHelp(wxCommandEvent& event) {
8183 wxString testFile =
"/doc/iECDIS/index.html";
8185 if (!::wxFileExists(testFile)) {
8186 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
8189 _(
"Would you like to visit the iECDIS Manual website for more "
8192 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
8193 wxYES_NO | wxCENTER, 60)) {
8194 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
8205void options::OnButtoncompressClick(wxCommandEvent& event) {
8207 wxArrayInt pListBoxSelections;
8210 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
8211 wxLIST_STATE_SELECTED);
8212 if (item == -1)
break;
8217 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
8218This may make them incompatible with other programs or older versions of OpenCPN.\n\
8219Compressed charts may take slightly longer to load and display on some systems.\n\
8220They can be decompressed again using unxz or 7 zip programs."),
8221 _(
"OpenCPN Warning"),
8222 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
8226 wxArrayString filespecs;
8227 filespecs.Add(
"*.kap");
8228 filespecs.Add(
"*.KAP");
8229 filespecs.Add(
"*.000");
8232 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
8233 filespecs.Add(
"*.D");
8234 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
8235 filespecs.Add(
"*.Z");
8237 wxGenericProgressDialog prog1(
8238 _(
"OpenCPN Compress Charts"), wxEmptyString,
8239 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
8240 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8241 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8244 wxSize sz = prog1.GetSize();
8245 sz.x = top_frame::Get()->GetClientSize().x * 8 / 10;
8248 wxArrayString charts;
8249 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
8250 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
8251 if (dirname.IsEmpty())
continue;
8254 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
8255 (dirname.Last() == wxChar(_T(
'\r'))))
8256 dirname.RemoveLast();
8258 if (!wxDir::Exists(dirname))
continue;
8261 wxArrayString FileList;
8262 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
8263 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
8265 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
8269 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
8270 charts.Add(FileList[j]);
8274 if (charts.GetCount() == 0) {
8275 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
8280 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
8281 wxGenericProgressDialog prog(
8282 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
8283 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8284 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8288 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
8290 prog.Update(i, charts[i], &skip);
8293 wxString compchart = charts[i] +
".xz";
8294 if (CompressChart(charts[i], compchart)) {
8295 total_size += wxFileName::GetSize(charts[i]).ToULong();
8296 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
8297 wxRemoveFile(charts[i]);
8303 double total_size_mb = total_size / 1024.0 / 1024.0;
8304 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
8307 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
8309 count, total_size_mb, total_compressed_size_mb,
8310 total_size_mb - total_compressed_size_mb,
8311 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
8314 UpdateWorkArrayFromTextCtl();
8316 if (m_pWorkDirList) {
8317 pActiveChartsList->DeleteAllItems();
8318 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
8319 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
8322 li.SetAlign(wxLIST_FORMAT_LEFT);
8323 li.SetText(dirname);
8325 long idx = pActiveChartsList->InsertItem(li);
8329 k_charts |= CHANGE_CHARTS;
8331 pScanCheckBox->Disable();
8337void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
8339void options::OnCancelClick(wxCommandEvent& event) {
8340 m_pListbook->ChangeSelection(0);
8341 comm_dialog->CancelSettings();
8343 lastWindowPos = GetPosition();
8344 lastWindowSize = GetSize();
8346 pConfig->SetPath(
"/Settings");
8347 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8348 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8351 androidEnableBackButton(
true);
8352 androidEnableRotation();
8353 androidEnableOptionItems(
true);
8356 top_frame::Get()->ThawCharts();
8358 top_frame::Get()->EnableSettingsTool(
true);
8361void options::OnClose(wxCloseEvent& event) {
8362 m_pListbook->ChangeSelection(0);
8364 lastWindowPos = GetPosition();
8365 lastWindowSize = GetSize();
8367 pConfig->SetPath(
"/Settings");
8368 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8369 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8371 m_callbacks.prepare_close(
this, m_returnChanges);
8375void options::OnFontChoice(wxCommandEvent& event) {
8376 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8377 m_font_element_array.Add(sel_text_element);
8379 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8380 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8382 m_textSample->SetFont(*pif);
8383 m_textSample->SetForegroundColour(init_color);
8384 m_itemBoxSizerFontPanel->Layout();
8388void options::OnChooseFont(wxCommandEvent& event) {
8390 androidDisableRotation();
8393 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8394 m_font_element_array.Add(sel_text_element);
8395 wxFontData font_data;
8397 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8398 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8400 wxFontData init_font_data;
8401 if (pif) init_font_data.SetInitialFont(*pif);
8402 init_font_data.SetColour(init_color);
8407 wxFont* qFont = dialogFont;
8410 int retval = dg.ShowModal();
8411 if (wxID_CANCEL != retval) {
8412 font_data = dg.GetFontData();
8413 wxFont font = font_data.GetChosenFont();
8414 wxFont* psfont =
new wxFont(font);
8415 wxColor color = font_data.GetColour();
8416 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8417 top_frame::Get()->UpdateAllFonts();
8418 m_bfontChanged =
true;
8419 OnFontChoice(event);
8425 wxFontDialog dg(
this, init_font_data);
8427 wxFontDialog dg(pParent, init_font_data);
8430 wxFont* qFont = dialogFont;
8437 wxSize proposed_size = GetSize();
8439 float font_size = dialogFont->GetPointSize();
8441 if ((proposed_size.y / font_size) < n_lines) {
8442 float new_font_size = proposed_size.y / n_lines;
8443 wxFont* smallFont =
new wxFont(*dialogFont);
8444 smallFont->SetPointSize(new_font_size);
8445 dg.SetFont(*smallFont);
8449 if (g_bresponsive) {
8450 dg.SetSize(GetSize());
8454 int retval = dg.ShowModal();
8455 if (wxID_CANCEL != retval) {
8456 font_data = dg.GetFontData();
8457 wxFont font = font_data.GetChosenFont();
8458 wxFont* psfont =
new wxFont(font);
8459 wxColor color = font_data.GetColour();
8460 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8461 top_frame::Get()->UpdateAllFonts();
8462 m_bfontChanged =
true;
8463 OnFontChoice(event);
8468 androidEnableRotation();
8474#if defined(__WXGTK__) || defined(__WXQT__)
8475void options::OnChooseFontColor(wxCommandEvent& event) {
8476 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8477 m_font_element_array.Add(sel_text_element);
8479 wxColourData colour_data;
8481 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8482 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8485 androidDisableRotation();
8487 unsigned int cco = 0;
8490 cco |= init_color.Red();
8492 cco |= init_color.Green();
8494 cco |= init_color.Blue();
8495 unsigned int cc = androidColorPicker(cco);
8498 unsigned char blue = (
unsigned char)cc % 256;
8499 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8501 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8502 cn.Set(red, green, blue);
8504 FontMgr::Get().
SetFont(sel_text_element, pif, cn);
8506 top_frame::Get()->UpdateAllFonts();
8507 m_bfontChanged =
true;
8509 androidEnableRotation();
8511 wxScrolledWindow* sw =
8512 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8514 wxColourData init_colour_data;
8515 init_colour_data.SetColour(init_color);
8517 wxColourDialog dg(sw, &init_colour_data);
8519 int retval = dg.ShowModal();
8520 if (wxID_CANCEL != retval) {
8521 colour_data = dg.GetColourData();
8523 wxColor color = colour_data.GetColour();
8524 FontMgr::Get().
SetFont(sel_text_element, pif, color);
8526 top_frame::Get()->UpdateAllFonts();
8527 m_bfontChanged =
true;
8528 OnFontChoice(event);
8537void options::OnChartsPageChange(wxListbookEvent& event) {
8538 unsigned int i =
event.GetSelection();
8540 UpdateChartDirList();
8545 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8549 UpdateWorkArrayFromDisplayPanel();
8550 groupsPanel->SetDBDirs(*m_pWorkDirList);
8551 groupsPanel->m_treespopulated = FALSE;
8553 if (!groupsPanel->m_settingscomplete) {
8554 ::wxBeginBusyCursor();
8555 groupsPanel->CompleteInitialSettings();
8556 ::wxEndBusyCursor();
8557 }
else if (!groupsPanel->m_treespopulated) {
8558 groupsPanel->PopulateTrees();
8559 groupsPanel->m_treespopulated = TRUE;
8561 }
else if (1 == i) {
8563 if (!m_bVectorInit) {
8564 SetInitialVectorSettings();
8565 UpdateOptionsUnits();
8572void options::OnPageChange(wxListbookEvent& event) {
8573 DoOnPageChange(event.GetSelection());
8576void options::OnSubNBPageChange(wxNotebookEvent& event) {
8579 if (event.GetEventObject()) {
8580 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8581 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8582 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8583 if (
dynamic_cast<wxNotebook*
>(parent)) {
8584 lastSubPage =
event.GetSelection();
8587 if (
dynamic_cast<wxListbook*
>(parent)) {
8588 lastSubPage =
event.GetSelection();
8595void options::OnTopNBPageChange(wxNotebookEvent& event) {
8596 DoOnPageChange(event.GetSelection());
8599void options::DoOnPageChange(
size_t page) {
8600 unsigned int i = page;
8603 if (page > 10)
return;
8611 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8612 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8618 k_charts = VISIT_CHARTS;
8619 UpdateChartDirList();
8622 else if (m_pageConnections == i) {
8624 wxWindow* w = m_pListbook->GetCurrentPage();
8625 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
8628 else if (m_pageUI == i) {
8629 if (!m_itemLangListBox)
return;
8630#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8632 if (!m_bVisitLang) {
8633 ::wxBeginBusyCursor();
8635 int current_language = plocale_def_lang->GetLanguage();
8636 wxString current_sel = wxLocale::GetLanguageName(current_language);
8638 current_sel = GetOCPNKnownLanguage(g_locale);
8640 int nLang =
sizeof(lang_list) /
sizeof(
int);
8643 m_itemLangListBox->Append(
"English (U.S.)");
8645 wxString lang_dir = g_Platform->GetSharedDataDir() +
"share/locale/";
8646 for (
int it = 1; it < nLang; it++) {
8647 if (wxLocale::IsAvailable(lang_list[it])) {
8648 wxLocale ltest(lang_list[it], 0);
8649 ltest.AddCatalog(
"opencpn");
8650 if (!ltest.IsLoaded(
"opencpn"))
continue;
8653 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8654 wxString widgets_lang_name = loc_lang_name;
8655 wxString lang_canonical =
8656 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8659 wxString lang_suffix;
8660 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8663 wxString test_dir = lang_dir + lang_suffix;
8664 if (!wxDir::Exists(test_dir))
continue;
8666 m_itemLangListBox->Append(loc_lang_name);
8670 wxArrayString lang_array;
8673 lang_array.Add(
"en_US");
8674 for (
int it = 0; it < nLang; it++) {
8676 wxLog::EnableLogging(
8679 wxLocale ltest(lang_list[it], 0);
8680#if wxCHECK_VERSION(2, 9, 0)
8682 ltest.AddCatalogLookupPathPrefix(
8683 wxStandardPaths::Get().GetInstallPrefix() +
"/share/locale");
8686 ltest.AddCatalog(
"opencpn");
8688 wxLog::EnableLogging(TRUE);
8689 if (ltest.IsLoaded(
"opencpn")) {
8690 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8693 s0 = x->CanonicalName;
8696 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8697 if (wxNOT_FOUND == lang_array.Index(s0)) {
8704 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8706 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8707 m_itemLangListBox->Append(loc_lang_name);
8723 delete plocale_def_lang;
8724 plocale_def_lang =
new wxLocale(current_language);
8726 setlocale(LC_NUMERIC,
"C");
8727 plocale_def_lang->AddCatalog(
"opencpn");
8729 m_itemLangListBox->SetStringSelection(current_sel);
8732 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8734 wxString clang = pli->Description;
8738 m_bVisitLang = TRUE;
8740 ::wxEndBusyCursor();
8743 }
else if (m_pagePlugins == i) {
8744 m_bVisitPlugins = TRUE;
8745 top_frame::Get()->FreezeCharts();
8749 auto loader = PluginLoader::GetInstance();
8750 if (LoadAllPlugIns(
false)) {
8751 delete m_pPlugInCtrl;
8752 m_pPlugInCtrl = NULL;
8753 delete m_PluginCatalogMgrPanel;
8754 m_PluginCatalogMgrPanel = NULL;
8755 itemBoxSizerPanelPlugins->Clear();
8758 if (!m_pPlugInCtrl) {
8760 ::wxBeginBusyCursor();
8763 wxDefaultPosition, wxDefaultSize);
8764 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8765 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8766 wxEXPAND | wxGROW | wxALL, 4);
8770 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8772 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8773 wxEXPAND | wxALL, 4);
8774 itemBoxSizerPanelPlugins->Layout();
8777 m_pPlugInCtrl->UpdateSelections();
8779 ::wxEndBusyCursor();
8781 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8784 k_plugins = TOOLBAR_CHANGED;
8786 k_plugins |= FORCE_RELOAD;
8790wxString options::SelectSoundFile() {
8791 wxString sound_dir = g_Platform->GetSharedDataDir();
8792 sound_dir.Append(
"sounds");
8797 wxFileDialog* popenDialog =
new wxFileDialog(
8798 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8799 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
8801 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8803 response = popenDialog->ShowModal();
8804 sel_file = popenDialog->GetPath();
8808 response = g_Platform->DoFileSelectorDialog(
8809 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
8812 if (response == wxID_OK)
8813 return g_Platform->NormalizePath(sel_file);
8818void options::OnButtonSelectSound(wxCommandEvent& event) {
8819 wxString sel_file = SelectSoundFile();
8821 if (!sel_file.IsEmpty()) {
8822 g_sAIS_Alert_Sound_File = g_Platform->NormalizePath(sel_file);
8826void options::OnButtonTestSound(wxCommandEvent& event) {
8827 auto sound = o_sound::Factory();
8828 auto cmd_sound =
dynamic_cast<o_sound::SystemCmdSound*
>(sound);
8829 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8831 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8835wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8836 wxString return_string;
8837 wxString dir_suffix;
8839#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8841 if (lang_canonical ==
"en_US") {
8843 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8845 }
else if ((lang_canonical ==
"cs_CZ") || (lang_canonical ==
"cs")) {
8847 return_string = wxString(
"Čeština", wxConvUTF8);
8849 }
else if ((lang_canonical ==
"da_DK") || (lang_canonical ==
"da")) {
8851 return_string = wxString(
"Dansk", wxConvUTF8);
8853 }
else if ((lang_canonical ==
"de_DE") || (lang_canonical ==
"de")) {
8855 return_string = wxString(
"Deutsch", wxConvUTF8);
8857 }
else if ((lang_canonical ==
"et_EE") || (lang_canonical ==
"et")) {
8859 return_string = wxString(
"Eesti", wxConvUTF8);
8861 }
else if ((lang_canonical ==
"es_ES") || (lang_canonical ==
"es")) {
8863 return_string = wxString(
"Español", wxConvUTF8);
8865 }
else if ((lang_canonical ==
"fr_FR") || (lang_canonical ==
"fr")) {
8867 return_string = wxString(
"Français", wxConvUTF8);
8869 }
else if ((lang_canonical ==
"it_IT") || (lang_canonical ==
"it")) {
8871 return_string = wxString(
"Italiano", wxConvUTF8);
8873 }
else if ((lang_canonical ==
"nl_NL") || (lang_canonical ==
"nl")) {
8875 return_string = wxString(
"Nederlands", wxConvUTF8);
8877 }
else if ((lang_canonical ==
"pl_PL") || (lang_canonical ==
"pl")) {
8879 return_string = wxString(
"Polski", wxConvUTF8);
8881 }
else if ((lang_canonical ==
"pt_PT") || (lang_canonical ==
"pt")) {
8882 dir_suffix =
"pt_PT";
8883 return_string = wxString(
"Português", wxConvUTF8);
8885 }
else if ((lang_canonical ==
"pt_BR") || (lang_canonical ==
"pt_BR")) {
8886 dir_suffix =
"pt_BR";
8887 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8889 }
else if ((lang_canonical ==
"ru_RU") || (lang_canonical ==
"ru")) {
8891 return_string = wxString(
"Русский", wxConvUTF8);
8893 }
else if ((lang_canonical ==
"sv_SE") || (lang_canonical ==
"sv")) {
8895 return_string = wxString(
"Svenska", wxConvUTF8);
8897 }
else if ((lang_canonical ==
"fi_FI") || (lang_canonical ==
"fi")) {
8898 dir_suffix =
"fi_FI";
8899 return_string = wxString(
"Suomi", wxConvUTF8);
8901 }
else if ((lang_canonical ==
"nb_NO") || (lang_canonical ==
"nb")) {
8902 dir_suffix =
"nb_NO";
8903 return_string = wxString(
"Norsk", wxConvUTF8);
8905 }
else if ((lang_canonical ==
"tr_TR") || (lang_canonical ==
"tr")) {
8906 dir_suffix =
"tr_TR";
8907 return_string = wxString(
"Türkçe", wxConvUTF8);
8909 }
else if ((lang_canonical ==
"el_GR") || (lang_canonical ==
"el")) {
8910 dir_suffix =
"el_GR";
8911 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8913 }
else if ((lang_canonical ==
"hu_HU") || (lang_canonical ==
"hu")) {
8914 dir_suffix =
"hu_HU";
8915 return_string = wxString(
"Magyar", wxConvUTF8);
8917 }
else if ((lang_canonical ==
"zh_TW") || (lang_canonical ==
"zh_TW")) {
8918 dir_suffix =
"zh_TW";
8919 return_string = wxString(
"正體字", wxConvUTF8);
8921 }
else if ((lang_canonical ==
"zh_CN") || (lang_canonical ==
"zh_CN")) {
8922 dir_suffix =
"zh_CN";
8923 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8925 }
else if ((lang_canonical ==
"ca_ES") || (lang_canonical ==
"ca")) {
8926 dir_suffix =
"ca_ES";
8927 return_string = wxString(
"Catalan", wxConvUTF8);
8929 }
else if ((lang_canonical ==
"gl_ES") || (lang_canonical ==
"gl_ES")) {
8930 dir_suffix =
"gl_ES";
8931 return_string = wxString(
"Galician", wxConvUTF8);
8933 }
else if ((lang_canonical ==
"ja_JP") || (lang_canonical ==
"ja_JP")) {
8934 dir_suffix =
"ja_JP";
8935 return_string = wxString(
"Japanese", wxConvUTF8);
8937 }
else if ((lang_canonical ==
"vi_VN") || (lang_canonical ==
"vi_VN")) {
8938 dir_suffix =
"vi_VN";
8939 return_string = wxString(
"Vietnamese", wxConvUTF8);
8942 dir_suffix = lang_canonical;
8943 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8945 return_string = info->Description;
8947 return_string = lang_canonical;
8950 lang_dir = dir_suffix;
8952 return return_string;
8955wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8957 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8960ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8961 ChartGroupArray* d =
new ChartGroupArray;
8962 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8965 pdg->m_group_name = psg->m_group_name;
8966 pdg->m_element_array.reserve(psg->m_element_array.size());
8968 for (
auto& elem : psg->m_element_array)
8969 pdg->m_element_array.push_back(elem);
8976void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8986EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8987EVT_NOTEBOOK_PAGE_CHANGED(
8989 ChartGroupsUI::OnGroupPageChange)
8993 m_GroupSelectedPage = -1;
8994 m_pActiveChartsTree = 0;
8996 lastSelectedCtl = NULL;
8997 allAvailableCtl = NULL;
8998 defaultAllCtl = NULL;
9000 m_pAddButton = NULL;
9001 m_pRemoveButton = NULL;
9002 m_pDeleteGroupButton = NULL;
9003 m_pNewGroupButton = NULL;
9004 m_pGroupArray = NULL;
9007 m_UIcomplete =
false;
9008 m_treespopulated =
false;
9012ChartGroupsUI::~ChartGroupsUI() {
9013 m_DirCtrlArray.Clear();
9014 m_GroupNB->Disconnect(
9015 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
9016 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
9021void ChartGroupsUI::SetInitialSettings() {
9022 m_settingscomplete = FALSE;
9023 m_treespopulated = FALSE;
9026void ChartGroupsUI::PopulateTrees() {
9029 wxArrayString dir_array;
9030 int nDir = m_db_dirs.GetCount();
9031 for (
int i = 0; i < nDir; i++) {
9032 wxString dirname = m_db_dirs[i].fullpath;
9033 if (!dirname.IsEmpty()) dir_array.Add(dirname);
9036 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array,
9037 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
9039 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
9043 wxArrayString dir_array0;
9044 int nDir0 = m_db_dirs.GetCount();
9045 for (
int i = 0; i < nDir0; i++) {
9046 wxString dirname = m_db_dirs[i].fullpath;
9047 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
9049 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
9050 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
9053void ChartGroupsUI::CompleteInitialSettings() {
9056 BuildNotebookPages(m_pGroupArray);
9058 m_panel->GetSizer()->Layout();
9060 m_settingscomplete = TRUE;
9061 m_treespopulated = TRUE;
9064void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
9065 const wxArrayString& dir_array,
9066 const wxColour& col, wxFont* pFont) {
9067 ptc->DeleteAllItems();
9069 wxDirItemData* rootData =
new wxDirItemData(
"Dummy",
"Dummy", TRUE);
9072 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
9073 ptc->SetItemHasChildren(m_rootId);
9076 int nDir = dir_array.GetCount();
9077 for (
int i = 0; i < nDir; i++) {
9078 wxString dirname = dir_array[i];
9079 if (!dirname.IsEmpty()) {
9080 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
9081 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
9084 ptc->SetItemText(
id, dirname);
9085 if (pFont) ptc->SetItemFont(
id, *pFont);
9089 ptc->SetItemTextColour(
id, col);
9091 ptc->SetItemHasChildren(
id);
9096void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
9097 wxString insert_candidate = allAvailableCtl->GetPath();
9098 if (!insert_candidate.IsEmpty()) {
9099 if (m_DirCtrlArray.GetCount()) {
9100 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9101 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9103 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9105 if (ptree->IsEmpty()) {
9106 wxDirItemData* rootData =
9107 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9108 wxString rootName =
"Dummy";
9109 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9111 ptree->SetItemHasChildren(rootId);
9114 wxTreeItemId root_Id = ptree->GetRootItem();
9115 wxDirItemData* dir_item =
9116 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
9118 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
9119 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
9122 pGroup->m_element_array.push_back({insert_candidate});
9127 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9128 m_pAddButton->Disable();
9130 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9132 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9133 if (ptree) ptree->Refresh();
9137void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
9138 if (m_DirCtrlArray.GetCount()) {
9139 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9140 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9143 wxString sel_item = pDirCtrl->GetPath();
9145 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9146 if (ptree && ptree->GetCount()) {
9147 wxTreeItemId
id = ptree->GetSelection();
9148 lastDeletedItem = id;
9150 wxString branch_adder;
9151 int group_item_index =
9152 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
9153 if (group_item_index >= 0) {
9155 pGroup->m_element_array[group_item_index];
9156 bool b_duplicate = FALSE;
9157 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
9159 if (pelement.m_missing_name_array[k] == sel_item) {
9165 pelement.m_missing_name_array.Add(sel_item);
9171 if (branch_adder ==
"") {
9173 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
9176 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
9182 lastSelectedCtl->Unselect();
9183 lastSelectedCtl = 0;
9184 m_pRemoveButton->Disable();
9186 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9188 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9189 if (ptree) ptree->Refresh();
9197void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
9198 m_GroupSelectedPage =
event.GetSelection();
9199 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9200 if (lastSelectedCtl) {
9201 lastSelectedCtl->UnselectAll();
9202 lastSelectedCtl = 0;
9204 m_pRemoveButton->Disable();
9205 m_pAddButton->Disable();
9208 if (m_GroupSelectedPage == 0) {
9209 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
9211 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
9215void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
9216 wxObject* evtObj =
event.GetEventObject();
9217 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
9218 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
9219 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9220 m_pAddButton->Enable();
9222 m_pAddButton->Disable();
9225 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
9226 if (!lastSelectedCtl)
goto out;
9227 wxTreeItemId item = lastSelectedCtl->GetSelection();
9228 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9231 wxGenericDirCtrl* dirCtrl =
9232 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
9233 if (!dirCtrl)
goto out;
9234 wxString itemPath = dirCtrl->GetPath();
9235 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
9237 m_pRemoveButton->Disable();
9245void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
9246 wxTextEntryDialog* pd =
new wxTextEntryDialog();
9248 pd->SetFont(*qFont);
9250 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
9253 androidDisableRotation();
9256 if (pd->ShowModal() == wxID_OK) {
9257 if (pd->GetValue().Length()) {
9258 AddEmptyGroupPage(pd->GetValue());
9260 pGroup->m_group_name = pd->GetValue();
9261 m_pGroupArray->Add(pGroup);
9263 m_GroupSelectedPage =
9264 m_GroupNB->GetPageCount() - 1;
9265 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
9266 m_pDeleteGroupButton->Enable();
9273 androidEnableRotation();
9277void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
9278 if (0 != m_GroupSelectedPage) {
9279 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
9280 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
9281 m_GroupNB->DeletePage(m_GroupSelectedPage);
9284 if (m_GroupSelectedPage <= 0) {
9285 m_pAddButton->Disable();
9286 m_pDeleteGroupButton->Disable();
9290int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
9291 wxTreeItemId item, wxString* pbranch_adder) {
9292 wxString branch_name;
9293 wxString branch_adder;
9295 wxTreeItemId current_node = item;
9296 while (current_node.IsOk()) {
9297 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
9298 if (!parent_node)
break;
9300 if (parent_node == ptree->GetRootItem()) {
9301 branch_name = ptree->GetItemText(current_node);
9305 branch_adder.Prepend(ptree->GetItemText(current_node));
9306 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
9308 current_node = ptree->GetItemParent(current_node);
9312 unsigned int target_item_index = -1;
9314 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
9315 const wxString& target = pGroup->m_element_array[i].m_element_name;
9316 if (branch_name == target) {
9317 target_item_index = i;
9322 if (pbranch_adder) *pbranch_adder = branch_adder;
9324 return target_item_index;
9327void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
9328 wxTreeItemId node =
event.GetItem();
9330 if (m_GroupSelectedPage <= 0)
return;
9331 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9332 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9333 if (!pDirCtrl)
return;
9335 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9336 wxString branch_adder;
9337 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
9338 if (target_item_index < 0)
return;
9340 pGroup->m_element_array[target_item_index];
9341 const wxString& branch_name = target_element.m_element_name;
9345 if (!target_element.m_missing_name_array.GetCount())
return;
9346 wxString full_root = branch_name;
9347 full_root += branch_adder;
9348 full_root += wxString(wxFILE_SEP_PATH);
9350 wxTreeItemIdValue cookie;
9351 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
9352 while (child.IsOk()) {
9353 wxString target_string = full_root;
9354 target_string += ptree->GetItemText(child);
9356 for (
unsigned int k = 0; k < target_element.m_missing_name_array.GetCount();
9358 if (target_element.m_missing_name_array[k] == target_string) {
9359 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
9363 child = ptree->GetNextChild(node, cookie);
9367void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
9370 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
9372 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
9375 int nItems = pGroup->m_element_array.size();
9376 for (
int i = 0; i < nItems; i++) {
9377 const wxString& itemname = pGroup->m_element_array[i].m_element_name;
9378 if (!itemname.IsEmpty()) {
9379 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
9381 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
9383 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
9389wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
9390 wxGenericDirCtrl* GroupDirCtl =
9391 new wxGenericDirCtrl(m_GroupNB, wxID_ANY,
"TESTDIR");
9392 m_GroupNB->AddPage(GroupDirCtl, label);
9394 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
9395 ptree->DeleteAllItems();
9397 wxDirItemData* rootData =
9398 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9399 wxString rootName =
"Dummy";
9400 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9401 ptree->SetItemHasChildren(rootId);
9403 m_DirCtrlArray.Add(GroupDirCtl);
9408void ChartGroupsUI::ClearGroupPages() {
9409 if (m_GroupNB->GetPageCount() == 0)
return;
9411 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
9412 m_DirCtrlArray.RemoveAt(i);
9413 m_GroupNB->DeletePage(i);
9417void options::OnInsertTideDataLocation(wxCommandEvent& event) {
9419 int response = wxID_CANCEL;
9422 wxFileDialog* popenDialog =
new wxFileDialog(
9423 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
9424 "Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All "
9428 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
9430 response = popenDialog->ShowModal();
9431 sel_file = popenDialog->GetPath();
9436 response = g_Platform->DoFileSelectorDialog(
9437 this, &path, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
"*.*");
9441 if (response == wxID_OK) {
9443 int id = tcDataSelected->GetItemCount();
9445 long idx = tcDataSelected->InsertItem(li);
9446 tcDataSelected->SetItem(
id, 0, g_Platform->NormalizePath(sel_file));
9449 wxFileName fn(sel_file);
9450 wxString data_dir = fn.GetPath();
9451 g_TCData_Dir = g_Platform->NormalizePath(data_dir);
9455void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9458 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9459 wxLIST_STATE_SELECTED);
9460 if (item == -1)
break;
9461 tcDataSelected->DeleteItem(item);
9467enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9470BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9471EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9472EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9475OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9476 : wxDialog(parent, wxID_ANY, "OpenGL Options", wxDefaultPosition,
9478 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9483 m_brebuild_cache(FALSE) {
9486 SetFont(*dialogFont);
9488 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9489 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9491 m_cbTextureCompression =
9492 new wxCheckBox(
this, wxID_ANY,
9493 g_bGLexpert ? _(
"Texture Compression")
9494 : _(
"Texture Compression with Caching"));
9495 m_cbTextureCompressionCaching =
9496 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9498 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9499 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9500 m_sTextureMemorySize->SetRange(1, 16384);
9502 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9503 wxButton* btnRebuild =
9504 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9505 wxButton* btnClear =
9506 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9507 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9509 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9510 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9511 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9513 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9514 m_cbUseAcceleratedPanning =
9515 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9517 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9518 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9519 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9520 flexSizer->AddSpacer(0);
9521 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9522 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9523 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9524 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9525 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9526 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9527 flexSizer->AddSpacer(0);
9528 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9529 flexSizer->AddSpacer(0);
9530 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9531 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9532 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9533 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9534 flexSizer->AddSpacer(0);
9535 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9536 flexSizer->AddSpacer(0);
9537 flexSizer->AddSpacer(0);
9538 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9539 flexSizer->AddSpacer(0);
9540 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9541 flexSizer->AddGrowableCol(1);
9542 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9544 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9545 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9546 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9547 btnSizer->Realize();
9549 mainSizer->AddStretchSpacer();
9550 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9554 SetSizer(mainSizer);
9555 mainSizer->SetSizeHints(
this);
9559bool OpenGLOptionsDlg::GetAcceleratedPanning()
const {
9560 return m_cbUseAcceleratedPanning->GetValue();
9563bool OpenGLOptionsDlg::GetTextureCompression()
const {
9564 return m_cbTextureCompression->GetValue();
9567bool OpenGLOptionsDlg::GetPolygonSmoothing()
const {
9568 return m_cbPolygonSmoothing->GetValue();
9571bool OpenGLOptionsDlg::GetLineSmoothing()
const {
9572 return m_cbLineSmoothing->GetValue();
9575bool OpenGLOptionsDlg::GetSoftwareGL()
const {
9576 return m_cbSoftwareGL->GetValue();
9579bool OpenGLOptionsDlg::GetTextureCompressionCaching()
const {
9580 return m_cbTextureCompressionCaching->GetValue();
9583bool OpenGLOptionsDlg::GetRebuildCache()
const {
return m_brebuild_cache; }
9585int OpenGLOptionsDlg::GetTextureMemorySize()
const {
9586 return m_sTextureMemorySize->GetValue();
9589void OpenGLOptionsDlg::Populate() {
9590 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9598 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9599 m_memorySize->Show(g_bGLexpert);
9600 m_sTextureMemorySize->Show(g_bGLexpert);
9602 m_cbTextureCompressionCaching->SetValue(
9603 g_GLOptions.m_bTextureCompressionCaching);
9604 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9606 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9607 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9609#if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9610 if (top_frame::Get()->GetWxGlCanvas()) {
9611 if (top_frame::Get()->GetGlVersionString().Upper().Find(
"MESA") !=
9613 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9616 m_cbSoftwareGL->Hide();
9620 SetFont(*dialogFont);
9623 if (top_frame::Get()->GetWxGlCanvas()) {
9624 if (top_frame::Get()
9625 ->GetAbstractPrimaryCanvas()
9626 ->CanAccelerateGlPanning()) {
9627 m_cbUseAcceleratedPanning->Enable();
9628 m_cbUseAcceleratedPanning->SetValue(
9629 g_GLOptions.m_bUseAcceleratedPanning);
9631 m_cbUseAcceleratedPanning->SetValue(FALSE);
9632 m_cbUseAcceleratedPanning->Disable();
9635 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9638 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9639 m_cbUseAcceleratedPanning->Disable();
9643void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9644 if (g_GLOptions.m_bTextureCompressionCaching) {
9645 m_brebuild_cache = TRUE;
9646 EndModal(wxID_CANCEL);
9650void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9652 ::wxBeginBusyCursor();
9656 appendOSDirSlash(&path);
9657 path.append(
"raster_texture_cache");
9659 if (::wxDirExists(path)) {
9660 wxArrayString files;
9661 size_t nfiles = wxDir::GetAllFiles(path, &files);
9662 for (
unsigned int i = 0; i < files.GetCount(); i++)
9663 ::wxRemoveFile(files[i]);
9666 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9667 ::wxEndBusyCursor();
9671wxString OpenGLOptionsDlg::GetTextureCacheSize() {
9673 appendOSDirSlash(&path);
9674 path.append(
"raster_texture_cache");
9675 long long total = 0;
9677 if (::wxDirExists(path)) {
9678 wxArrayString files;
9679 size_t nfiles = wxDir::GetAllFiles(path, &files);
9680 for (
unsigned int i = 0; i < files.GetCount(); i++)
9681 total += wxFile(files[i]).Length();
9683 double mb = total / (1024.0 * 1024.0);
9684 if (mb < 10000.0)
return wxString::Format(
"%.1f MB", mb);
9686 return wxString::Format(
"%.1f GB", mb);
9694EVT_PAINT(CanvasConfigSelect::OnPaint)
9698 wxWindowID
id, wxBitmap& bmp,
9699 const wxPoint& pos, const wxSize& size)
9700 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9701 m_parentOptions = parentOptions;
9706 int refHeight = GetCharHeight();
9708 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9709 bmp.GetSize().y + m_borderWidth * 2));
9711 Connect(wxEVT_LEFT_DOWN,
9712 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9715CanvasConfigSelect::~CanvasConfigSelect() {}
9717void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9723 if (m_parentOptions)
9724 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9727void CanvasConfigSelect::SetSelected(
bool selected) {
9728 m_bSelected = selected;
9732 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9735 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9741void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9743 GetSize(&width, &height);
9746 dc.SetBackground(*wxLIGHT_GREY);
9748 dc.SetPen(*wxTRANSPARENT_PEN);
9749 dc.SetBrush(wxBrush(GetBackgroundColour()));
9750 dc.DrawRectangle(GetVirtualSize());
9753 dc.SetBrush(wxBrush(m_boxColour));
9755 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9757 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9759 dc.SetBrush(wxBrush(m_boxColour));
9761 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9763 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9766 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.
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.
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.
obs::EventVar m_on_sp_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Custom event class for OpenCPN's notification system.
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.
Generic event handling between for example MVC Model and Controller based on a shared EventVar variab...
void Notify() override
Notify all listeners, no data supplied.
Wrapper for global variable, supports notification events when value changes.
obs::EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
wxRadioButton * pTimezoneUTC
Specify date/time should be formatted in UTC.
wxRadioButton * pTimezoneLocalTime
Specify date/time should be formatted in timezone as configured in the operating system.
Class cm93chart and helpers – CM93 chart state.
Global variables reflecting command line options and arguments.
Communication drivers factory and support.
Config file user configuration interface.
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.
std::vector< ConnectionParams * > & TheConnectionParams()
Return global list of connections.
Panel for editing a connection.
Options | Connections GUI tab managing connections
std::vector< OCPN_MonitorInfo > g_monitor_info
Information about the monitors connected to the system.
A common variable shared between producer and consumer which supports Listen() and Notify().
GLuint g_raster_format
Global instance.
OpenGL chart rendering canvas.
glTextureManager * g_glTextureManager
Global instance.
Global variables Listen()/Notify() wrapper.
Misc GUI event vars, a singleton.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
wxFont GetOCPNGUIScaledFont(wxString item)
Retrieves a font optimized for touch and high-resolution interfaces.
size_t g_current_monitor
Current monitor displaying main application frame.
Miscellaneous globals primarely used by gui layer, not persisted in configuration file.
GUI constant definitions.
Waypoint properties maintenance dialog.
Multiplexer class and helpers.
MyConfig * pConfig
Global instance.
Navigation Utility Functions without GUI dependencies.
Generic font dialog for OpenCPN.
wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
wxString * GetpSharedDataLocation()
Gets shared application data location.
double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
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.