52#include <wx/clrpicker.h>
55#include <wx/display.h>
56#include <wx/fontdata.h>
57#include <wx/fontdlg.h>
58#include <wx/imaglist.h>
59#include <wx/listbox.h>
60#include <wx/mediactrl.h>
61#include <wx/odcombo.h>
62#include <wx/progdlg.h>
63#include <wx/radiobox.h>
65#include <wx/renderer.h>
66#include <wx/statline.h>
67#include <wx/stdpaths.h>
68#include <wx/textwrapper.h>
69#include <wx/tokenzr.h>
71#if defined(__WXGTK__) || defined(__WXQT__)
72#include <wx/colordlg.h>
81#include "o_sound/o_sound.h"
131static inline wxString ttDistance() {
133 "Horizontal measurements and distances. Examples: Distance between "
134 "geographic positions, visibility range, radar range.");
136static inline wxString ttSpeed() {
137 return _(
"Vessel and surface speed measurements");
139static inline wxString ttWindSpeed() {
140 return _(
"Wind speed measurements and forecasts");
142static inline wxString ttDepth() {
143 return _(
"Measurements below the water surface");
145static inline wxString ttHeight() {
147 "Vertical measurements above reference datum. Examples: Tide level, wave "
148 "height, air gap, mast clearance, elevation above reference datum.");
150static inline wxString ttTemp() {
151 return _(
"Temperature measurements (air, water, engine)");
153static inline wxString ttCoordFormat() {
154 return _(
"Coordinate display format for latitude and longitude");
162#include "androidUTIL.h"
166#include <QtWidgets/QScroller>
170#if wxCHECK_VERSION(3, 2, 0)
171#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
173#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS
176#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
179#define ID_CHOICE_NMEA wxID_HIGHEST + 1
185extern wxLocale* plocale_def_lang;
193extern int g_Android_SDK_Version;
194extern MigrateAssistantDialog* g_migrateDialog;
197static wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
199static wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
202static int lang_list[] = {
203 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
204 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
205 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
206 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
207 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
208 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
209 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
210 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
212 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
213 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
214 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
215 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
216 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
217 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
225 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
226 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
227 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
228 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
229 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
230 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
231 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
232 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
233 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
234 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
235 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
236 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
237 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
238 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
239 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
240 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
241 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
242 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
243 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
244 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
245 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
246 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
247 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
248 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
249 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
252 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
253 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
254 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
255 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
256 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
258 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
259 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
260 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
261 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
262 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
263 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
264 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
265 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
266 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
267 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
268 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
269 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
270 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
271 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
272 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
273 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
274 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
275 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
276 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
278 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
279 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
280 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
281 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
282 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
283 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
284 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
285 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
286 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
287 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
288 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
289 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
290 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
294void prepareSlider(wxSlider* slider) {
295 slider->GetHandle()->setStyleSheet(
296 prepareAndroidSliderStyleSheet(slider->GetSize().x));
297 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
298 slider->GetHandle()->grabGesture(Qt::PanGesture);
299 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
312 wxString textMod = text;
313 textMod.Replace(
" ",
"^");
316 wxString sep = wxFileName::GetPathSeparator();
317 textMod.Replace(sep,
" ");
319 Wrap(win, textMod, widthMax);
322 for (
size_t i = 0; i < m_array.GetCount(); i++) {
323 wxString a = m_array[i];
325 if (m_array.GetCount() > 1) {
326 if (i < m_array.GetCount() - 1) a += sep;
332 wxString
const& GetWrapped()
const {
return m_wrapped; }
333 int const GetLineCount()
const {
return m_lineCount; }
334 wxArrayString GetLineArray() {
return m_array; }
337 virtual void OnOutputLine(
const wxString& line) {
341 virtual void OnNewLine() {
349 wxArrayString m_array;
358 void DoChartSelected();
359 void SetSelected(
bool selected);
360 void OnPaint(wxPaintEvent& event);
362 void OnSize(wxSizeEvent& event);
364 int GetUnselectedHeight() {
return m_unselectedHeight; }
365 int GetRefHeight() {
return m_refHeight; }
366 bool IsSelected() {
return m_bSelected; }
367 void OnClickDown(wxMouseEvent& event);
368 void OnClickUp(wxMouseEvent& event);
373 wxColour m_boxColour;
374 int m_unselectedHeight;
375 wxString m_pChartDir;
379 DECLARE_EVENT_TABLE()
383EVT_PAINT(OCPNChartDirPanel::OnPaint)
385EVT_SIZE(OCPNChartDirPanel::OnSize)
389 const wxPoint& pos, const wxSize& size,
391 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
392 m_pChartDir = cdi.fullpath;
395 if (cdi.fullpath.StartsWith(
396 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
397 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
402 m_refHeight = GetCharHeight();
404 m_unselectedHeight = 2 * m_refHeight;
410 SetMinSize(wxSize(-1, m_unselectedHeight));
412 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
415 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
420OCPNChartDirPanel::~OCPNChartDirPanel() {}
422static wxStopWatch swclick;
424static int downx, downy;
427void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
430 event.GetPosition(&downx, &downy);
436void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
438 qDebug() << swclick.Time();
439 if (swclick.Time() < 200) {
441 event.GetPosition(&upx, &upy);
442 if ((fabs(upx - downx) < GetCharWidth()) &&
443 (fabs(upy - downy) < GetCharWidth())) {
451void OCPNChartDirPanel::DoChartSelected() {
461void OCPNChartDirPanel::SetSelected(
bool selected) {
462 m_bSelected = selected;
466 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
469 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
474 g_pOptions->SetDirActionButtons();
481void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
482 if (m_pChartDir.Length()) {
484 GetClientSize(&x, &y);
487 wxArrayString nameWrapped = wrapper.GetLineArray();
489 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
495void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
497 GetSize(&width, &height);
500 dc.SetPen(*wxTRANSPARENT_PEN);
501 dc.SetBrush(wxBrush(GetBackgroundColour()));
502 dc.DrawRectangle(GetVirtualSize());
504 wxString nameString = m_pChartDir;
506 wxArrayString nameWrapped = wrapper.GetLineArray();
508 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
509 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
510 GetParent()->GetSizer()->Layout();
514 dc.SetBrush(wxBrush(m_boxColour));
516 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
518 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
520 int offset = height / 10;
521 int text_x = offset * 2;
523 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
526 dc.SetTextForeground(
527 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
529 int yd = height * 20 / 100;
530 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
532 dc.DrawText(nameWrapped[i], text_x, yd);
534 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
535 yd += GetCharHeight();
539 dc.SetBrush(wxBrush(m_boxColour));
542 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME),
545 int offset = height / 10;
546 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
547 height - (2 * offset), height / 10);
549 int text_x = offset * 2;
551 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
554 dc.SetTextForeground(
555 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
557 int yd = height * 20 / 100;
558 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
560 dc.DrawText(nameWrapped[i], text_x, yd);
562 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
563 yd += GetCharHeight();
571static bool LoadAllPlugIns(
bool load_enabled) {
572 g_Platform->ShowBusySpinner();
573 bool b = PluginLoader::GetInstance()->
LoadAllPlugIns(load_enabled);
574 g_Platform->HideBusySpinner();
583 const wxPoint& pt = wxDefaultPosition,
584 const wxSize& sz = wxDefaultSize,
585 long style = wxHSCROLL | wxVSCROLL,
586 const wxString& name =
"scrolledWindow") {
587 Create(parent,
id, pt, sz, style, name);
590 bool Create(wxWindow* parent, wxWindowID
id = -1,
591 const wxPoint& pt = wxDefaultPosition,
592 const wxSize& sz = wxDefaultSize,
593 long style = wxHSCROLL | wxVSCROLL,
594 const wxString& name =
"scrolledWindow");
598 unsigned int Append(wxString& label,
bool benable =
true,
599 bool bsizerLayout =
true);
600 unsigned int GetCount() {
return m_list.size(); }
605 void Check(
int index,
bool val);
606 bool IsChecked(
int index);
611 std::vector<wxCheckBox*> m_list;
614bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
615 const wxPoint& pt,
const wxSize& sz,
616 long style,
const wxString& name) {
617 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
620 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
621 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
625 m_sizer =
new wxBoxSizer(wxVERTICAL);
631unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable,
633 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
635 cb->SetValue(!benable);
637 if (bsizerLayout) m_sizer->Layout();
639 m_list.push_back(cb);
641 return m_list.size() - 1;
644void OCPNCheckedListCtrl::Check(
int index,
bool val) {
645 wxCheckBox* cb = m_list[index];
646 if (cb) cb->SetValue(val);
649bool OCPNCheckedListCtrl::IsChecked(
int index) {
650 wxCheckBox* cb = m_list[index];
651 return cb ? cb->GetValue() :
false;
654void OCPNCheckedListCtrl::RunLayout() { m_sizer->Layout(); }
656void OCPNCheckedListCtrl::Clear() {
657 for (
auto cb : m_list) delete cb;
663void appendOSDirSlash(wxString* pString);
672EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
673EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
677 const wxString& caption,
678 const wxPoint& pos, const wxSize& size,
680 : wxDialog(parent,
id, caption, pos, size,
681 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
683 GetSizer()->SetSizeHints(
this);
687ConfigCreateDialog::~ConfigCreateDialog() {}
689void ConfigCreateDialog::CreateControls() {
690 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
693 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
694 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
696 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
697 wxSize(40 * GetCharHeight(), -1), 0);
698 mainSizer->Add(m_TitleCtl, 0,
699 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
701 mainSizer->AddSpacer(2 * GetCharHeight());
703 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
704 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
707 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
708 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
709 mainSizer->Add(m_DescriptionCtl, 0,
710 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
712 mainSizer->AddSpacer(2 * GetCharHeight());
717 _(
"Create a private configuration template based on current settings.\n\
718This template will be saved, and may be selected for further use at any time.\n\
720 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
722 mainSizer->AddSpacer(2 * GetCharHeight());
724 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
725 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
727 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
728 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
730 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
731 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
732 m_OKButton->SetDefault();
735void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
736 EndModal(wxID_CANCEL);
739void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
740 const wxString& title = m_TitleCtl->GetValue();
741 const wxString& desc = m_DescriptionCtl->GetValue();
742 m_createdTemplateGUID = ConfigMgr::Get().CreateNamedConfig(title, desc,
"");
751EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
752EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
756 wxWindowID
id, const wxString& caption,
757 const wxPoint& pos, const wxSize& size,
759 : wxDialog(parent,
id, caption, pos, size,
760 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
763 GetSizer()->SetSizeHints(
this);
767MMSIEditDialog::~MMSIEditDialog() {
delete m_MMSICtl; }
769void MMSIEditDialog::CreateControls() {
770 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
773 wxStaticBox* mmsiBox =
774 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
776 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
777 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
779 wxStaticText* mmsiLabel =
new wxStaticText(
this, wxID_STATIC, _(
"MMSI"));
780 mmsiLabel->SetToolTip(
781 _(
"Maritime Mobile Service Identity - A unique 9-digit number assigned "
782 "to a vessel or navigation aid. Used to identify vessels and devices "
783 "in AIS transmissions and DSC calls."));
784 mmsiSizer->Add(mmsiLabel, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
786 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
787 wxDefaultPosition, wxSize(180, -1), 0);
788 m_MMSICtl->SetToolTip(
789 _(
"Enter the 9-digit MMSI number for this vessel or station"));
790 mmsiSizer->Add(m_MMSICtl, 0,
791 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
792 m_MMSICtl->Bind(wxEVT_TEXT, &MMSIEditDialog::OnMMSIChanged,
this);
794 wxStaticText* userLabelText =
new wxStaticText(
this, wxID_STATIC, _(
"Name"));
795 userLabelText->SetToolTip(
796 _(
"Display name for this vessel or device - can override names received "
798 mmsiSizer->Add(userLabelText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
800 m_ShipNameCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
801 wxDefaultPosition, wxSize(180, -1), 0);
802 m_ShipNameCtl->SetToolTip(_(
803 "Set the name for this vessel or device. If specified, this name takes "
804 "precedence over names received via AIS messages. Note that standard AIS "
805 "only supports uppercase letters (A-Z), numbers, and limited "
806 "punctuation. Your manual entries are stored in the mmsitoname.csv file "
807 "and preserved across sessions."));
808 mmsiSizer->Add(m_ShipNameCtl, 0,
809 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
811 wxStaticBox* trackBox =
new wxStaticBox(
this, wxID_ANY, _(
"Tracking"));
812 trackBox->SetToolTip(_(
"Control how tracks are created for this MMSI"));
813 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackBox, wxVERTICAL);
815 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
817 m_rbTypeTrackDefault =
818 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
819 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
820 m_rbTypeTrackDefault->SetToolTip(
821 _(
"Use the global tracking settings for this vessel"));
822 m_rbTypeTrackDefault->SetValue(TRUE);
823 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
825 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
826 m_rbTypeTrackAlways->SetToolTip(_(
827 "Always create a track for this vessel, regardless of global settings"));
828 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
830 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
831 m_rbTypeTrackNever->SetToolTip(
832 _(
"Never create a track for this vessel, regardless of global settings"));
833 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
835 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
836 m_cbTrackPersist->SetToolTip(
837 _(
"Save this vessel's track between OpenCPN sessions. Useful for vessels "
838 "you want to monitor continuously over time."));
839 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
841 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
842 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
844 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
845 m_IgnoreButton->SetToolTip(
846 _(
"When checked, AIS data for this MMSI will be ignored and the vessel "
847 "will not appear on the chart. Useful for suppressing shore stations, "
848 "permanently moored vessels, or duplicate AIS signals that you don't "
849 "need to monitor."));
850 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
852 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
853 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
854 m_MOBButton->SetToolTip(
855 _(
"When checked, OpenCPN will display a special icon for this device, "
856 "sound a distinctive alarm, and automatically create a temporary MOB "
857 "route from your vessel to this device in emergency. For crew safety "
858 "devices, you can assign the crew member's name using the Name "
859 "field above for quick identification."));
860 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
863 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
864 m_VDMButton->SetToolTip(
865 _(
"When checked, converts AIS messages for this vessel from AIVDM (other "
866 "vessel) to AIVDO (own vessel) format."));
867 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
869 m_FollowerButton =
new wxCheckBox(
870 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
871 m_FollowerButton->SetToolTip(
872 _(
"When checked, disables CPA (Closest Point of Approach) alerts for "
873 "this vessel as it's considered intentionally following your vessel. "
874 "Follower vessels are displayed with a special own-ship style icon."));
875 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
877 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
878 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
880 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
881 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
883 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
884 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
885 m_OKButton->SetDefault();
889 if (m_props->MMSI > 0)
890 sMMSI.Printf(
"%d", m_props->MMSI);
893 m_MMSICtl->AppendText(sMMSI);
896 if (!m_props->m_ShipName.IsEmpty()) {
897 m_ShipNameCtl->SetValue(m_props->m_ShipName);
900 switch (m_props->TrackType) {
901 case TRACKTYPE_ALWAYS:
902 m_rbTypeTrackAlways->SetValue(TRUE);
904 case TRACKTYPE_NEVER:
905 m_rbTypeTrackNever->SetValue(TRUE);
911 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
912 m_IgnoreButton->SetValue(m_props->m_bignore);
913 m_MOBButton->SetValue(m_props->m_bMOB);
914 m_VDMButton->SetValue(m_props->m_bVDM);
915 m_FollowerButton->SetValue(m_props->m_bFollower);
917 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
920void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
922void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
923 EndModal(wxID_CANCEL);
926void MMSIEditDialog::Persist() {
928 if (m_rbTypeTrackDefault->GetValue())
929 m_props->TrackType = TRACKTYPE_DEFAULT;
930 else if (m_rbTypeTrackAlways->GetValue())
931 m_props->TrackType = TRACKTYPE_ALWAYS;
933 m_props->TrackType = TRACKTYPE_NEVER;
935 m_props->m_bignore = m_IgnoreButton->GetValue();
936 m_props->m_bMOB = m_MOBButton->GetValue();
937 m_props->m_bVDM = m_VDMButton->GetValue();
938 m_props->m_bFollower = m_FollowerButton->GetValue();
939 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
942 wxString shipName = m_ShipNameCtl->GetValue().Upper();
943 if (!shipName.IsEmpty()) {
944 m_props->m_ShipName = shipName;
947 wxString mmsi = m_MMSICtl->GetValue();
948 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
949 g_pAIS->UpdateMMSItoNameFile(mmsi, shipName);
954 else if (m_props->m_ShipName == wxEmptyString) {
955 auto proptarget =
g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
957 wxString s = proptarget->GetFullName();
958 m_props->m_ShipName = s;
960 wxString GetShipNameFromFile(
int);
961 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
967void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
971 m_MMSICtl->GetValue().ToLong(&nmmsi);
972 m_props->MMSI = nmmsi;
975 if (m_MMSICtl->GetValue().Length() != 9) {
978 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
979 "your entries and cancel if necessary."),
980 _(
"OpenCPN Info"), wxOK | wxCANCEL);
982 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
983 if (retcode == wxID_OK) {
994void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
996void MMSIEditDialog::OnMMSIChanged(wxCommandEvent& event) {
997 wxString mmsi = m_MMSICtl->GetValue();
1000 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1002 wxString shipName =
g_pAIS->GetMMSItoNameEntry(mmsi);
1005 if (shipName.IsEmpty()) {
1006 auto target =
g_pAIS->Get_Target_Data_From_MMSI(wxAtoi(mmsi));
1008 shipName = target->GetFullName();
1013 if (!shipName.IsEmpty()) {
1014 m_ShipNameCtl->SetValue(shipName);
1022EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1023EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1024EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1025 MMSIListCtrl::OnListItemRightClick)
1026EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1027EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1031 const wxSize& size,
long style)
1032 : wxListCtrl(parent,
id, pos, size, style) {
1036MMSIListCtrl::~MMSIListCtrl() {}
1038wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1042 if (!props)
return ret;
1045 if (props->MMSI > 0) ret = wxString::Format(
"%d", props->MMSI);
1048 switch (props->TrackType) {
1049 case TRACKTYPE_DEFAULT:
1052 case TRACKTYPE_ALWAYS:
1055 case TRACKTYPE_NEVER:
1061 if (props->m_bPersistentTrack) ret.Append(
", ").Append(_(
"Persistent"));
1064 if (props->m_bignore) ret =
"X";
1067 if (props->m_bMOB) ret =
"X";
1070 if (props->m_bVDM) ret =
"X";
1073 if (props->m_bFollower) ret =
"X";
1076 ret = props->m_ShipName;
1085void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1087void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1092 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1093 wxDefaultPosition, wxSize(200, 200));
1095 if (pd->ShowModal() == wxID_OK) {
1105void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1106 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1107 if (m_context_item == wxNOT_FOUND)
return;
1108 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1109 wxMenuItem* item_edit =
1110 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") +
"...");
1111 menu->Append(item_edit);
1112 wxMenuItem* item_delete =
1113 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1114 menu->Append(item_delete);
1118 item_edit->SetFont(*qFont);
1119 item_delete->SetFont(*qFont);
1122 wxPoint p = ScreenToClient(wxGetMousePosition());
1123 PopupMenu(menu, p.x, p.y);
1129void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1130 int context_item = m_context_item;
1135 switch (event.GetId()) {
1136 case ID_DEF_MENU_MMSI_EDIT: {
1139 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1140 wxDefaultPosition, wxSize(200, 200));
1142 if (pd->ShowModal() == wxID_OK) {
1145 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1153 case ID_DEF_MENU_MMSI_DELETE:
1160MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1161 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1168 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1171 wxString MMSI_props_column_spec =
"120;120;100;100;100;100;100;100";
1173 wxStringTokenizer tkz(MMSI_props_column_spec,
";");
1174 wxString s_width = tkz.GetNextToken();
1179 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1180 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1181 wxBORDER_SUNKEN | wxLC_VIRTUAL);
1189 int dx = GetCharWidth();
1192 if (s_width.ToLong(&lwidth)) {
1193 width = wxMax(dx * 2, lwidth);
1194 width = wxMin(width, dx * 13);
1196 m_pListCtrlMMSI->InsertColumn(tlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, width);
1198 s_width = tkz.GetNextToken();
1200 if (s_width.ToLong(&lwidth)) {
1201 width = wxMax(dx * 2, lwidth);
1202 width = wxMin(width, dx * 25);
1204 m_pListCtrlMMSI->InsertColumn(tlCLASS, _(
"Track Mode"), wxLIST_FORMAT_CENTER,
1207 s_width = tkz.GetNextToken();
1209 if (s_width.ToLong(&lwidth)) {
1210 width = wxMax(dx * 2, lwidth);
1211 width = wxMin(width, dx * 10);
1213 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1216 s_width = tkz.GetNextToken();
1218 if (s_width.ToLong(&lwidth)) {
1219 width = wxMax(dx * 2, lwidth);
1220 width = wxMin(width, dx * 10);
1222 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"MOB"), wxLIST_FORMAT_CENTER, width);
1224 s_width = tkz.GetNextToken();
1226 if (s_width.ToLong(&lwidth)) {
1227 width = wxMax(dx * 2, lwidth);
1228 width = wxMin(width, dx * 15);
1230 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1233 s_width = tkz.GetNextToken();
1235 if (s_width.ToLong(&lwidth)) {
1236 width = wxMax(dx * 2, lwidth);
1237 width = wxMin(width, dx * 30);
1239 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Ship name"), wxLIST_FORMAT_CENTER,
1242 s_width = tkz.GetNextToken();
1244 if (s_width.ToLong(&lwidth)) {
1245 width = wxMax(dx * 2, lwidth);
1246 width = wxMin(width, dx * 10);
1248 m_pListCtrlMMSI->InsertColumn(tlTYPE, _(
"Follower"), wxLIST_FORMAT_CENTER,
1251 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1253 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1255 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1256 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1258 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1265 SetSize(GetSize().x, GetSize().y - 1);
1267 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1270MMSI_Props_Panel::~MMSI_Props_Panel() {}
1272void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1276 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1277 wxDefaultPosition, wxSize(200, 200));
1280 pd->ShowWindowModalThenDo([
this, pd, props](
int retcode) {
1281 if (retcode == wxID_OK) {
1290void MMSI_Props_Panel::UpdateMMSIList() {
1292 long selItemID = wxNOT_FOUND;
1293 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1294 wxLIST_STATE_SELECTED);
1296 int selMMSI = wxNOT_FOUND;
1302 long item_sel = wxNOT_FOUND;
1303 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1313 m_pListCtrlMMSI->SetItemState(item_sel,
1314 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1315 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1318 m_pListCtrlMMSI->Refresh(FALSE);
1322void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1332 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value =
"",
1333 const wxPoint& pos = wxDefaultPosition,
1334 const wxSize& size = wxDefaultSize,
int n = 0,
1335 const wxString choices[] = NULL,
long style = 0,
1336 const wxValidator& validator = wxDefaultValidator,
1337 const wxString& name =
"OCPNFatCombo");
1341 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1342 wxCoord OnMeasureItem(
size_t item)
const;
1343 wxCoord OnMeasureItemWidth(
size_t item)
const;
1344 bool SetFont(
const wxFont& font);
1346 int Append(
const wxString& item, wxBitmap bmp);
1349 const wxFont* dfont;
1353 ArrayOfBitmaps bmpArray;
1356OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1358OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1359 const wxString& value,
const wxPoint& pos,
1360 const wxSize& size,
int n,
const wxString choices[],
1361 long style,
const wxValidator& validator,
1362 const wxString& name)
1363 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1366 GetFont().GetPointSize() / g_Platform->getFontPointsperPixel();
1367 itemHeight = (int)wxRound(fontHeight);
1368 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1371OCPNFatCombo::~OCPNFatCombo() {}
1373bool OCPNFatCombo::SetFont(
const wxFont& font) {
1378void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1385 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1386 wxBrush br = wxBrush(bg);
1387 wxBrush sv = dc.GetBrush();
1389 dc.DrawRectangle(0, 0, rect.width, rect.height);
1391 dc.SetTextForeground(wxColour(0, 0, 0));
1393 if (flags & wxODCB_PAINTING_CONTROL) {
1394 wxString text = GetValue();
1396 dc.DrawText(text, rect.x + margin_x + offset_x,
1397 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1399 dc.SetBackground(wxBrush(br));
1401 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1402 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1406wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1407 if (item < bmpArray.GetCount())
1408 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1410 return itemHeight * 12 / 10;
1413wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1415int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1417 int idx = wxOwnerDrawnComboBox::Append(item);
1422void OCPNFatCombo::Clear() {
1423 wxOwnerDrawnComboBox::Clear();
1427BEGIN_EVENT_TABLE(
options, wxDialog)
1428EVT_INIT_DIALOG(options::OnDialogInit)
1429EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1430EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1431EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1432EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1433EVT_BUTTON(ID_REBUILDBUTTON, options::OnButtonRebuildChartDb)
1434EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1435EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1436EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1437EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1438EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1439EVT_BUTTON(xID_OK, options::OnXidOkClick)
1440EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1441EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1442EVT_BUTTON(ID_BUTTONFONT_RESET, options::OnResetFont)
1443EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1445EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1446EVT_CLOSE(options::OnClose)
1448#if defined(__WXGTK__) || defined(__WXQT__)
1449EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1452EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1454EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1455EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1456EVT_CHOICE(ID_HEIGHTUNITSCHOICE, options::OnUnitsChoice)
1457EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1458EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1459EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1460EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1461EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1462EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1463EVT_CHAR_HOOK(options::OnCharHook)
1468 const wxString& caption, const wxPoint& pos,
1469 const wxSize& size,
long style)
1470 : pTrackRotateTime(0), m_callbacks(callbacks) {
1475 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1477 wxDialog::Create(parent,
id, caption, pos, size, style,
"Options");
1478 SetFont(*dialogFont);
1481 RecalculateSize(size.x, size.y);
1483 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1485 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1486 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1488 m_pPlugInCtrl->ReloadPluginPanels();
1490 auto action = [&](wxCommandEvent& evt) {
1491 g_persist_active_route = m_persist_active_route_chkbox->IsChecked();
1493 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1494 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1496 m_OnChartDb_finalize_listener.Init(
1497 GuiEvents::GetInstance().on_finalize_chartdbs,
1498 [&](
ObservedEvt& ev) { OptionsFinalizeChartDBUpdate(); });
1501options::~options() {
1503 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1505 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1506 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1509 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1511 delete m_pSerialArray;
1512 delete m_pGroupArray;
1513 delete m_topImgList;
1517 delete m_pPlugInCtrl;
1520 delete m_PluginCatalogMgrPanel;
1525bool options::SendIdleEvents(wxIdleEvent& event) {
1526 if (IsShown())
return wxDialog::SendIdleEvents(event);
1530void options::OptionsFinalizeChartDBUpdate() {
1535 g_GLOptions.m_bTextureCompressionCaching = m_bTextureCacheingSave;
1538void options::RecalculateSize(
int hint_x,
int hint_y) {
1539 if (!g_bresponsive) {
1540 m_nCharWidthMax = GetSize().x / GetCharWidth();
1544 if ((hint_x < 200) || (hint_y < 200)) {
1546 int display_width, display_height;
1550 if (display_height < 600) {
1553 vectorPanel->SetSizeHints(ps57Ctl);
1563 esize.x = GetCharWidth() * 110;
1564 esize.y = GetCharHeight() * 40;
1566 wxSize dsize = GetParent()->GetSize();
1567 esize.y = wxMin(esize.y, dsize.y - 0 );
1568 esize.x = wxMin(esize.x, dsize.x - 0 );
1571 wxSize fsize = GetSize();
1572 wxSize canvas_size = GetParent()->GetSize();
1573 wxPoint screen_pos = GetParent()->GetScreenPosition();
1574 int xp = (canvas_size.x - fsize.x) / 2;
1575 int yp = (canvas_size.y - fsize.y) / 2;
1576 Move(screen_pos.x + xp, screen_pos.y + yp);
1578 m_nCharWidthMax = GetSize().x / GetCharWidth();
1581void options::Init() {
1582 m_pWorkDirList = NULL;
1584 pShowStatusBar = NULL;
1585 pShowMenuBar = NULL;
1586 pShowCompassWin = NULL;
1589 m_scrollWinChartList = NULL;
1590 ps57CtlListBox = NULL;
1592 m_pSerialArray = NULL;
1593 pUpdateCheckBox = NULL;
1594 pParseENCButton = NULL;
1600 pSoundDeviceIndex = NULL;
1604 pCBLookAhead = NULL;
1605 pCDOQuilting = NULL;
1606 pPreserveScale = NULL;
1607 pSmoothPanZoom = NULL;
1608 pEnableZoomToCursor = NULL;
1609 pSDisplayGrid = NULL;
1610 pCDOOutlines = NULL;
1611 pSDepthUnits = NULL;
1613 pSDefaultBoatSpeed = NULL;
1616 itemActiveChartStaticBox = NULL;
1618 pCheck_SOUNDG = NULL;
1620 pCheck_SHOWIMPTEXT = NULL;
1621 pCheck_SCAMIN = NULL;
1622 pCheck_ATONTEXT = NULL;
1623 pCheck_LDISTEXT = NULL;
1624 pCheck_XLSECTTEXT = NULL;
1626 m_bVisitLang = FALSE;
1627 m_bVisitPlugins = FALSE;
1628 m_itemFontElementListBox = NULL;
1629 m_textSample = NULL;
1630 m_topImgList = NULL;
1633 m_pGroupArray = NULL;
1634 m_groups_changed = 0;
1637 m_pageConnections = -1;
1642 m_pageConnections = -1;
1644 pEnableTenHertz =
nullptr;
1646 auto loader = PluginLoader::GetInstance();
1647 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
1648 b_oldhaveWMM = b_haveWMM;
1653 m_bForceNewToolbaronCancel =
false;
1655 m_cs = (ColorScheme)0;
1658 m_pPlugInCtrl = NULL;
1659 m_PluginCatalogMgrPanel = NULL;
1673 m_bVectorInit =
false;
1678 pCmdSoundString = NULL;
1680 m_sconfigSelect_single = NULL;
1681 m_sconfigSelect_twovertical = NULL;
1684 dc.SetFont(*dialogFont);
1686 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, dialogFont);
1688 m_colourPickerDefaultSize =
1702 auto sound =
static_cast<o_sound::Sound*
>(ev.GetClientData());
1716 {_(
"Nautical miles"), DISTANCE_NMI},
1717 {_(
"Statute miles"), DISTANCE_MI},
1718 {_(
"Kilometers"), DISTANCE_KM},
1719 {_(
"Meters"), DISTANCE_M}};
1721static const int kNumDistanceFormats =
1725static int GetDistanceFormatIndex(
int enumValue) {
1726 for (
int i = 0; i < kNumDistanceFormats; i++) {
1727 if (kDistanceFormats[i].enumValue == enumValue) {
1735static int GetDistanceFormatEnum(
int index) {
1736 if (index >= 0 && index < kNumDistanceFormats) {
1737 return kDistanceFormats[index].enumValue;
1739 return DISTANCE_NMI;
1742#if defined(__GNUC__) && __GNUC__ < 8
1745static const wxString BAD_ACCESS_MSG = _(
1746 "The device selected is not accessible; opencpn will likely not be able\n"
1747 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1748 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1749 "with the following contents:\n\n"
1750 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1751 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1752 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1753 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1757static const wxString BAD_ACCESS_MSG = _(R
"(
1758The device selected is not accessible; opencpn will likely not be able
1759to use this device as-is. You might want to exit OpenCPN, reboot and
1760retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1761with the following contents:
1763 KERNEL=="ttyUSB*", MODE="0666"
1764 KERNEL=="ttyACM*", MODE="0666"
1765 KERNEL=="ttyS*", MODE="0666"
1767For more info, see the file LINUX_DEVICES.md in the distribution docs.
1772void options::OnDialogInit(wxInitDialogEvent& event) {}
1774void options::CheckDeviceAccess( wxString& path) {}
1776size_t options::CreatePanel(
const wxString& title) {
1777 size_t id = m_pListbook->GetPageCount();
1780 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1781 wxDefaultSize, wxTAB_TRAVERSAL, title);
1782 m_pListbook->AddPage(panel, title, FALSE,
id);
1786wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1787 if (parent > m_pListbook->GetPageCount() - 1) {
1789 wxString::Format(
"Warning: invalid parent in options::AddPage( %d, ",
1794 wxNotebookPage* page = m_pListbook->GetPage(parent);
1796 wxScrolledWindow* sw;
1798 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1799 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1801 for (
size_t i_page = 0; i_page < nb->GetPageCount(); i_page++) {
1802 wxString candidate_title = nb->GetPageText(i_page);
1803 if (candidate_title.IsSameAs(title))
1804 return static_cast<wxScrolledWindow*
>(nb->GetPage(i_page));
1807 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1809 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1810 nb->AddPage(sw, title);
1811 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1812 wxString toptitle = m_pListbook->GetPageText(parent);
1813 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1814 wxDefaultSize, wxNB_TOP);
1817 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1818 m_pListbook->SetSelection(0);
1819 m_pListbook->RemovePage(parent + 1);
1820 wxString previoustitle = page->GetName();
1822 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1823 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1825 nb->AddPage(page, previoustitle);
1829 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1831 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1832 nb->AddPage(sw, title);
1833 nb->ChangeSelection(0);
1835 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1836 wxDefaultSize, style, title);
1837 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1838 wxString toptitle = m_pListbook->GetPageText(parent);
1839 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1840 m_pListbook->SetSelection(0);
1841 m_pListbook->DeletePage(parent + 1);
1845 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1851bool options::DeletePluginPage(wxScrolledWindow* page) {
1852 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1853 wxNotebookPage* pg = m_pListbook->GetPage(i);
1854 auto nb =
dynamic_cast<wxNotebook*
>(pg);
1857 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1858 wxNotebookPage* spg = nb->GetPage(j);
1861 if (nb->GetPageCount() != 1)
return TRUE;
1863 spg = nb->GetPage(0);
1864 spg->Reparent(m_pListbook);
1866 wxString toptitle = m_pListbook->GetPageText(i);
1867 m_pListbook->DeletePage(i);
1868 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1872 }
else if (pg == page) {
1874 m_pListbook->DeletePage(i);
1875 wxPanel* panel =
new wxPanel(m_pListbook);
1876 wxString toptitle = m_pListbook->GetPageText(i);
1877 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1884void options::CreatePanel_NMEA(
size_t parent,
int border_size,
1885 int group_item_spacing) {
1886 m_pNMEAForm = AddPage(parent, _(
"NMEA"));
1889 std::make_shared<ConnectionsDlg>(m_pNMEAForm, TheConnectionParams());
1892 Bind(wxEVT_SIZE, [&](wxSizeEvent& ev) {
1893 auto w = m_pListbook->GetCurrentPage();
1894 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
1898 comm_dialog->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1902void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1903 int group_item_spacing) {
1904 itemPanelShip = AddPage(parent, _(
"Own ship"));
1906 ownShip =
new wxBoxSizer(wxVERTICAL);
1907 itemPanelShip->SetSizer(ownShip);
1910 wxStaticBox* osdBox =
1911 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1912 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1913 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1915 wxFlexGridSizer* dispOptionsGrid =
1916 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1917 dispOptionsGrid->AddGrowableCol(1);
1918 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1920 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1921 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1922 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1924 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1925 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
1927 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
1928 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
1929 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
1931 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1932 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
1934 wxStaticText* iconTypeTxt =
1935 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
1936 dispOptionsGrid->Add(iconTypeTxt, 0);
1938 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
1939 _(
"Real Scale Vector")};
1941 m_pShipIconType =
new wxChoice(
1942 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
1943 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
1944 dispOptionsGrid->Add(m_pShipIconType, 0,
1945 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
1946 group_item_spacing);
1948 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
1949 realSizes->AddGrowableCol(1);
1951 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
1954 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
1956 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
1957 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1960 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
1962 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1963 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1966 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
1968 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1969 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1971 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
1972 _(
"GPS Offset from Midship (m)")),
1974 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1975 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1978 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
1980 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1981 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1984 wxFlexGridSizer* rrSelect =
1985 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
1986 rrSelect->AddGrowableCol(1);
1987 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
1989 wxStaticText* rrTxt =
1990 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
1991 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
1993 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
1994 "6",
"7",
"8",
"9",
"10"};
1995 pNavAidRadarRingsNumberVisible =
1996 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
1997 m_pShipIconType->GetSize(), 11, rrAlt);
1998 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
1999 group_item_spacing);
2001 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2002 radarGrid->AddGrowableCol(1);
2003 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
2005 wxStaticText* distanceText =
2006 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
2007 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
2009 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL,
"",
2010 wxDefaultPosition, wxSize(100, -1), 0);
2011 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
2012 group_item_spacing);
2014 wxStaticText* unitText =
2015 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
2016 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
2018 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"),
2019 _(
"Minutes (time)")};
2020 m_itemRadarRingsUnits =
2021 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
2022 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
2023 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2025 wxStaticText* colourText =
2026 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Color"));
2027 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2029 m_colourOwnshipRangeRingColour =
2031 wxDefaultPosition, m_colourPickerDefaultSize, 0,
2032 wxDefaultValidator,
"ID_COLOUROSRANGECOLOUR");
2033 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2036 wxFlexGridSizer* shipToActiveGrid =
2037 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2038 shipToActiveGrid->AddGrowableCol(1);
2039 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2040 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2041 _(
"Show direction to Active Waypoint"));
2042 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2045 wxStaticText* shipToActiveText1 =
2046 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2047 shipToActiveGrid->Add(shipToActiveText1, 1,
2048 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2050 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
2051 _(
"Long dash"), _(
"Short dash")};
2052 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2053 m_shipToActiveStyle =
2054 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2055 LineStyleNChoices, LineStyleChoices, 0);
2056 m_shipToActiveStyle->SetSelection(0);
2057 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2059 wxStaticText* shipToActiveText2 =
2060 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2061 shipToActiveGrid->Add(shipToActiveText2, 1,
2062 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2064 wxString m_LineColorChoices[] = {
2065 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2066 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2067 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2068 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2070 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2071 m_shipToActiveColor =
2072 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2073 LineColorNChoices, m_LineColorChoices, 0);
2074 m_shipToActiveColor->SetSelection(0);
2075 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2078 wxStaticBox* shipdata =
2079 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Ship's identifier"));
2080 wxStaticBoxSizer* datasizer =
new wxStaticBoxSizer(shipdata, wxVERTICAL);
2081 ownShip->Add(datasizer, 0, wxGROW | wxALL, border_size);
2083 wxFlexGridSizer* ownmmsisizer =
2084 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2085 ownmmsisizer->AddGrowableCol(1);
2086 datasizer->Add(ownmmsisizer, 0, wxALL | wxEXPAND, border_size);
2090 wxStaticText* pStatic_ownshipmmsi =
2091 new wxStaticText(itemPanelShip, wxID_ANY,
2092 _(
"Own ship's MMSI. (If available) Nine digits"));
2093 ownmmsisizer->Add(pStatic_ownshipmmsi, 0);
2096 const wxString AllowDigits[] = {
"0",
"1",
"2",
"3",
"4",
2097 "5",
"6",
"7",
"8",
"9"};
2098 wxArrayString ArrayAllowDigits(10, AllowDigits);
2099 wxTextValidator mmsiVal(wxFILTER_INCLUDE_CHAR_LIST);
2100 mmsiVal.SetIncludes(ArrayAllowDigits);
2101 m_pTxt_OwnMMSI =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"",
2102 wxDefaultPosition, wxDefaultSize, 0, mmsiVal);
2103 ownmmsisizer->Add(m_pTxt_OwnMMSI, 0, wxALIGN_RIGHT);
2106 wxStaticBox* trackText =
2107 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2108 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2109 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2110 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2112 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2113 _(
"Automatic Daily Tracks at midnight"));
2115 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2118 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2120#if wxUSE_TIMEPICKCTRL
2121 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2124 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2125 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2126 wxDefaultPosition, wxDefaultSize, 0);
2129 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2130 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2131 wxDefaultPosition, wxDefaultSize, 0);
2133 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2137 pTrackRotateComputerTime =
2138 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2139 wxDefaultPosition, wxDefaultSize, 0);
2140 trackSizer1->Add(pTrackRotateComputerTime, 0,
2141 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2144 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2145 wxDefaultPosition, wxDefaultSize, 0);
2146 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2150 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2151 wxDefaultPosition, wxDefaultSize, 0);
2152 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2155 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2157 wxFlexGridSizer* hTrackGrid =
2158 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2159 hTrackGrid->AddGrowableCol(1);
2160 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2163 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2164 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2166 wxStaticText* trackColourText =
2167 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Color"));
2168 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2171 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2172 m_colourPickerDefaultSize, 0, wxDefaultValidator,
"ID_COLOURTRACKCOLOUR");
2173 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2175 wxFlexGridSizer* pTrackGrid =
2176 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2177 pTrackGrid->AddGrowableCol(1);
2178 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2180 wxStaticText* tpText =
2181 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2182 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2184 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2185 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2186 m_pShipIconType->GetSize(), 3, trackAlt);
2187 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2188 group_item_spacing);
2191void options::CreatePanel_Routes(
size_t parent,
int border_size,
2192 int group_item_spacing) {
2193 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2195 Routes =
new wxBoxSizer(wxVERTICAL);
2196 itemPanelRoutes->SetSizer(Routes);
2198 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2200 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
2201 "6",
"7",
"8",
"9",
"10"};
2204 wxStaticBox* routeText =
2205 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2206 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2207 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2209 wxStaticBox* activeRouteText =
2210 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2211 wxStaticBoxSizer* activeRouteSizer =
2212 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2214 m_persist_active_route_chkbox =
new wxCheckBox(
2215 itemPanelRoutes, wxID_ANY,
2216 _(
"Persist active route, automatically activate on start up"));
2217 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2218 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2220 routeSizer->AddSpacer(5);
2223 wxFlexGridSizer* routepointiconSelect =
2224 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2225 routepointiconSelect->AddGrowableCol(1);
2226 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2229 wxStaticText* routepointiconTxt =
2230 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2231 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2232 group_item_spacing);
2235 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2236 0, NULL, wxCB_READONLY);
2237 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2238 wxALIGN_RIGHT | wxALL, group_item_spacing);
2240 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2243 int min_size = GetCharHeight() * 2;
2244 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2245 pRoutepointDefaultIconChoice->SetMinSize(
2246 wxSize(GetCharHeight() * 15, min_size));
2248 routeSizer->AddSpacer(5);
2250 wxFlexGridSizer* pRouteGrid =
2251 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2252 pRouteGrid->AddGrowableCol(1);
2253 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2255 wxStaticText* raText =
new wxStaticText(
2256 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Arrival Circle Radius (NMi)"));
2257 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2259 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2260 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2261 group_item_spacing);
2263 pAdvanceRouteWaypointOnArrivalOnly =
2264 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2265 _(
"Advance route waypoint on arrival only"));
2266 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2269 Routes->AddSpacer(8 * group_item_spacing);
2271 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2272 wxDefaultSize, wxLI_HORIZONTAL);
2273 Routes->Add(pln, 0, wxEXPAND);
2277 wxStaticBox* waypointText =
2278 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2279 wxStaticBoxSizer* waypointSizer =
2280 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2281 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2283 waypointSizer->AddSpacer(5);
2286 wxFlexGridSizer* waypointiconSelect =
2287 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2288 waypointiconSelect->AddGrowableCol(1);
2289 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2292 wxStaticText* waypointiconTxt =
2293 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2294 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2295 group_item_spacing);
2298 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2299 0, NULL, wxCB_READONLY);
2300 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2301 group_item_spacing);
2303 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2306 int rmin_size = GetCharHeight() * 2;
2307 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2308 pWaypointDefaultIconChoice->SetMinSize(
2309 wxSize(GetCharHeight() * 15, rmin_size));
2311 waypointSizer->AddSpacer(5);
2313 wxFlexGridSizer* ScaMinSizer =
2314 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2315 ScaMinSizer->AddGrowableCol(1);
2316 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2318 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2319 _(
"Show marks only at a chartscale greater than 1 :"));
2320 ScaMinSizer->Add(pScaMinChckB, 0);
2321 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2322 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2323 group_item_spacing);
2325 wxFlexGridSizer* ScaMaxSizer =
2326 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2327 ScaMaxSizer->AddGrowableCol(1);
2328 waypointSizer->Add(ScaMaxSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2329 wxStaticText* scaMaxLabel =
2330 new wxStaticText(itemPanelRoutes, wxID_ANY,
2331 _(
"Show marks only at a chartscale smaller than 1 :"));
2332 ScaMaxSizer->Add(scaMaxLabel, 0);
2333 m_pText_ScaMax =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2334 ScaMaxSizer->Add(m_pText_ScaMax, 0, wxALL | wxALIGN_RIGHT,
2335 group_item_spacing);
2338 pScaMinOverruleChckB =
2339 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2340 _(
"Override the settings for chartscale based visibility "
2341 "and show always"));
2342 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2344 waypointSizer->AddSpacer(5);
2346 wxFlexGridSizer* waypointrrSelect =
2347 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2348 waypointrrSelect->AddGrowableCol(1);
2349 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2352 wxStaticText* waypointrrTxt =
2353 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2354 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2356 pWaypointRangeRingsNumber =
2357 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2358 m_pShipIconType->GetSize(), 11, rrAlt);
2359 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2360 group_item_spacing);
2363 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2364 waypointradarGrid->AddGrowableCol(1);
2365 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2367 wxStaticText* waypointdistanceText =
new wxStaticText(
2368 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2369 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2370 group_item_spacing);
2372 pWaypointRangeRingsStep =
2373 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2374 wxSize(100, -1), 0);
2375 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2376 group_item_spacing);
2378 wxStaticText* waypointunitText =
2379 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2380 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2381 group_item_spacing);
2383 m_itemWaypointRangeRingsUnits =
2384 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2385 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2386 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2387 wxALIGN_RIGHT | wxALL, border_size);
2389 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2390 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colors"));
2391 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2394 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2395 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2396 "ID_COLOURWAYPOINTRANGERINGSCOLOUR");
2397 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2398 wxALIGN_RIGHT | wxALL, 1);
2403 Routes->AddSpacer(8 * group_item_spacing);
2404 wxStaticLine* pln1 =
2405 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2406 wxDefaultSize, wxLI_HORIZONTAL);
2407 Routes->Add(pln1, 0, wxEXPAND);
2410 wxStaticBox* waypointControl =
2411 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2412 wxStaticBoxSizer* ControlSizer =
2413 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2414 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2416 ControlSizer->AddSpacer(5);
2418 pWayPointPreventDragging =
new wxCheckBox(
2419 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2420 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2421 pWayPointPreventDragging->SetValue(FALSE);
2422 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2424 pConfirmObjectDeletion =
2425 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2426 _(
"Confirm deletion of tracks and routes"));
2427 pConfirmObjectDeletion->SetValue(FALSE);
2428 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2429 ControlSizer->AddSpacer(5);
2432 pWaypointDefaultIconChoice->Clear();
2434 bool fillCombo =
true;
2437 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2438 wxString* ps = pWayPointMan->GetIconDescription(i);
2439 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2441 pWaypointDefaultIconChoice->Append(*ps, bmp);
2446 int iconToSelect = -1;
2447 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2448 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2450 pWaypointDefaultIconChoice->Select(iconToSelect);
2456 pRoutepointDefaultIconChoice->Clear();
2461 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2462 wxString* ps = pWayPointMan->GetIconDescription(i);
2463 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2465 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2471 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2472 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2474 pRoutepointDefaultIconChoice->Select(iconToSelect);
2482void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2483 int group_item_spacing) {
2484 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2486 chartPanel =
new wxBoxSizer(wxVERTICAL);
2487 chartPanelWin->SetSizer(chartPanel);
2489 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2490 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2491 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2493 m_scrollWinChartList =
new wxScrolledWindow(
2494 chartPanelWin, wxID_ANY, wxDefaultPosition,
2495 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2497 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2504 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2506 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2507 m_scrollWinChartList->SetSizer(boxSizerCharts);
2509 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2510 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2512 wxString b1 = _(
"Add Directory...");
2513 wxString b2 = _(
"Remove Selected");
2514 wxString b3 = _(
"Compress Selected");
2522 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2523 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2525 cmdButtonSizer->AddSpacer(GetCharHeight());
2527 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2528 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2529 m_removeBtn->Disable();
2531 cmdButtonSizer->AddSpacer(GetCharHeight());
2534 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2535 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2536 m_compressBtn->Disable();
2538 m_compressBtn = NULL;
2542 if (g_Android_SDK_Version >= 30) {
2544 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2545 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2549 cmdButtonSizer->AddSpacer(GetCharHeight());
2551 wxStaticBox* itemStaticBoxUpdateStatic =
2552 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2553 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2554 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2555 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2557 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2558 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2560 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2561 _(
"Scan Charts and Update Database"));
2562 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2564 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2565 _(
"Force Full Database Rebuild"));
2567 pUpdateCheckBox->Hide();
2569 pRebuildChartDatabase =
new wxButton(chartPanelWin, ID_REBUILDBUTTON,
2570 _(
"Rebuild Chart Database"));
2571 itemFlexGridSizerUpdate->Add(pRebuildChartDatabase, 1, wxALL, 5);
2573 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2574 _(
"Prepare all ENC Charts"));
2575 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2577 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2580 ActiveChartArray.Clear();
2581 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2582 ActiveChartArray.Add(m_CurrentDirList[i]);
2585 UpdateChartDirList();
2587 chartPanel->Layout();
2590void options::UpdateChartDirList() {
2592 m_scrollWinChartList->GetSizer()->Clear(
true);
2593 m_scrollWinChartList->ClearBackground();
2595 panelVector.clear();
2598 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2601 wxSize(-1, -1), ActiveChartArray[i]);
2602 chartPanel->SetSelected(
false);
2604 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2606 panelVector.push_back(chartPanel);
2609 m_scrollWinChartList->GetSizer()->Layout();
2611 chartPanelWin->ClearBackground();
2612 chartPanelWin->Layout();
2621 wxSize sza = GetSize();
2626 m_scrollWinChartList->GetParent()->Layout();
2629 m_scrollWinChartList->Scroll(0, 0);
2632void options::UpdateTemplateTitleText() {
2633 if (!m_templateTitleText)
return;
2635 wxString activeTitle;
2636 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2637 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2639 bool configCompare =
2640 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2641 if (!configCompare) activeTitle += _(
" [Modified]");
2642 m_templateTitleText->SetLabel(activeTitle);
2644 m_templateTitleText->SetLabel(_(
"None"));
2647void options::CreatePanel_Configs(
size_t parent,
int border_size,
2648 int group_item_spacing) {
2649 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2655 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2656 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2660 wxStaticBox* templateStatusBox =
2661 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2662 m_templateStatusBoxSizer =
2663 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2664 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2667 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2668 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2670 m_staticTextLastAppled =
new wxStaticText(
2671 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2672 m_staticTextLastAppled->Hide();
2674 statSizer->Add(m_staticTextLastAppled);
2676 m_templateTitleText =
2677 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2678 statSizer->Add(m_templateTitleText);
2679 m_templateTitleText->Hide();
2681 UpdateTemplateTitleText();
2683 wxStaticBox* configsBox =
2684 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2685 wxStaticBoxSizer* configSizer =
2686 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2687 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2689 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2690 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2692 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2693 cPanel->SetSizer(boxSizercPanel);
2695 m_scrollWinConfigList =
2696 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2697 wxBORDER_RAISED | wxVSCROLL);
2698 m_scrollWinConfigList->SetScrollRate(1, 1);
2699 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2701 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2703 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2704 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2706 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2707 configSizer->Add(btnSizer);
2710 wxButton* createButton =
2711 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2712 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2713 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2714 wxCommandEventHandler(options::OnCreateConfig), NULL,
2722 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2723 _(
"Delete Selected Config..."));
2724 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2725 group_item_spacing);
2726 m_configDeleteButton->Connect(
2727 wxEVT_COMMAND_BUTTON_CLICKED,
2728 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2730 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2731 _(
"Apply Selected Config"));
2732 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2733 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2734 wxCommandEventHandler(options::OnApplyConfig),
2741 SetConfigButtonState();
2745void options::ClearConfigList() {
2746 if (m_scrollWinConfigList) {
2747 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2748 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2749 wxWindowListNode* node = kids.Item(i);
2750 wxWindow* win = node->GetData();
2751 auto pcp =
dynamic_cast<wxPanel*
>(win);
2760 SetConfigButtonState();
2763void options::BuildConfigList() {
2764 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2766 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2768 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2770 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2771 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2772 pp->Connect(wxEVT_LEFT_DOWN,
2773 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2777 wxWindowList kids = pp->GetChildren();
2778 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2779 wxWindowListNode* node = kids.Item(i);
2780 wxWindow* win = node->GetData();
2781 win->Connect(wxEVT_LEFT_DOWN,
2782 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2788 m_boxSizerConfigs->Layout();
2790 m_selectedConfigPanelGUID =
"";
2791 SetConfigButtonState();
2794void options::SetConfigButtonState() {
2795 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2796 if (m_selectedConfigPanelGUID.StartsWith(
2798 m_configDeleteButton->Disable();
2799 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2802void options::OnCreateConfig(wxCommandEvent& event) {
2804 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2806 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2807 if (retcode == wxID_OK) {
2808 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2809 UpdateTemplateTitleText();
2813 m_DisplayConfigsPage->Layout();
2815 SetConfigButtonState();
2819void options::OnEditConfig(wxCommandEvent& event) {}
2821void options::OnDeleteConfig(wxCommandEvent& event) {
2822 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2824 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2825 m_selectedConfigPanelGUID =
"";
2830 m_DisplayConfigsPage->Layout();
2831 SetConfigButtonState();
2834void options::OnApplyConfig(wxCommandEvent& event) {
2835 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2838 wxString currentLocale = g_locale;
2842 evt.SetId(ID_APPLY);
2846 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2850 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2851 wxString activeTitle =
2852 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2853 m_templateTitleText->SetLabel(activeTitle);
2854 m_templateTitleText->Show();
2855 m_staticTextLastAppled->Show();
2856 m_templateStatusBoxSizer->Layout();
2858 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2859 _(
"OpenCPN Info"), wxOK);
2862 if (m_scrollWinConfigList) {
2863 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2864 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2865 wxWindowListNode* node = kids.Item(i);
2866 wxWindow* win = node->GetData();
2867 auto pcp =
dynamic_cast<wxPanel*
>(win);
2871 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2876 m_selectedConfigPanelGUID = wxEmptyString;
2878 m_returnChanges |= CONFIG_CHANGED;
2880 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2885void options::OnConfigMouseSelected(wxMouseEvent& event) {
2886 wxPanel* selectedPanel = NULL;
2887 wxObject* obj =
event.GetEventObject();
2889 auto panel =
dynamic_cast<wxPanel*
>(obj);
2891 selectedPanel = panel;
2895 auto win =
dynamic_cast<wxWindow*
>(obj);
2897 auto parentpanel =
dynamic_cast<wxPanel*
>(win->GetParent());
2899 selectedPanel = parentpanel;
2904 if (m_scrollWinConfigList) {
2905 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2906 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2907 wxWindowListNode* node = kids.Item(i);
2908 wxWindow* win = node->GetData();
2909 auto panel =
dynamic_cast<wxPanel*
>(win);
2911 if (panel == selectedPanel) {
2912 panel->SetBackgroundColour(wxSystemSettings::GetColour(
2913 wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
2915 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
2917 panel->SetBackgroundColour(m_panelBackgroundUnselected);
2919 panel->Refresh(
true);
2923 m_DisplayConfigsPage->Layout();
2924 SetConfigButtonState();
2928void options::CreatePanel_Advanced(
size_t parent,
int border_size,
2929 int group_item_spacing) {
2930 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
2934 double dpmm = g_Platform->GetDisplayDPmm();
2936 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2937 m_ChartDisplayPage->SetSizer(wrapperSizer);
2939 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
2942 itemBoxSizerUI->Add(0, border_size * 3);
2943 itemBoxSizerUI->Add(0, border_size * 3);
2946 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
2947 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
2949 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
2950 _(
"De-skew Raster Charts"));
2951 boxCharts->Add(pSkewComp, inputFlags);
2953 itemBoxSizerUI->Add(0, border_size * 3);
2954 itemBoxSizerUI->Add(0, border_size * 3);
2958 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
2959 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
2961 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
2962 _(
"Use Accelerated Graphics (OpenGL)"));
2963 OpenGLSizer->Add(pOpenGL, inputFlags);
2964 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
2966 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
2967 _(
"OpenGL Options") +
"...");
2968 OpenGLSizer->Add(bOpenGL, inputFlags);
2970 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
2971 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
2976 itemBoxSizerUI->Add(0, border_size * 3);
2977 itemBoxSizerUI->Add(0, border_size * 3);
2981 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
2982 _(
"Chart Rotation Averaging Time"));
2984 wrapperSizer->Add(crat, 0,
2985 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
2986 group_item_spacing);
2988 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
2989 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
2992 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2993 wxSize(sz.x / 5, -1), wxTE_RIGHT);
2994 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
2995 group_item_spacing);
2997 pCOGUPFilterRow->Add(
2998 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3001 itemBoxSizerUI->Add(0, border_size * 3);
3002 itemBoxSizerUI->Add(0, border_size * 3);
3005 wxStaticText* zoomTextHead =
new wxStaticText(
3006 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3007 zoomTextHead->Wrap(-1);
3008 itemBoxSizerUI->Add(
3010 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3011 group_item_spacing);
3012 itemBoxSizerUI->Add(0, border_size * 1);
3014 itemBoxSizerUI->Add(
3015 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3018 m_pSlider_Zoom_Raster =
3019 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3020 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3023 prepareSlider(m_pSlider_Zoom_Raster);
3026 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3028 itemBoxSizerUI->Add(
3029 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3032 m_pSlider_Zoom_Vector =
3033 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3034 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3037 prepareSlider(m_pSlider_Zoom_Vector);
3040 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3042 itemBoxSizerUI->Add(
3043 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3045 m_pSlider_CM93_Zoom =
3046 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3047 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3048 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3051 prepareSlider(m_pSlider_CM93_Zoom);
3054 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3056 itemBoxSizerUI->Add(0, border_size * 3);
3057 itemBoxSizerUI->Add(0, border_size * 3);
3058 itemBoxSizerUI->Add(0, border_size * 3);
3061 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3062 _(
"Physical Screen Width")),
3064 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3065 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3067 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3068 pDPIRow->Add(pRBSizeAuto, inputFlags);
3069 pDPIRow->AddSpacer(10);
3070 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3071 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3072 pDPIRow->Add(pRBSizeManual, inputFlags);
3074 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3075 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3078 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3079 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3080 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3082 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3086 itemBoxSizerUI->Add(
3087 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3089 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3090 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3092 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3093 _(
"Show extended chart bar information."));
3094 ChartBarSizer->Add(pChartBarEX, inputFlags);
3096 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3097 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3099 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3100 wxCommandEventHandler(options::OnSizeManualButton),
3106 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3107 itemBoxSizerUI->SetHGap(border_size);
3114 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3115 m_ChartDisplayPage->SetSizer(wrapperSizer);
3116 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3119 itemBoxSizerUI->Add(0, border_size * 3);
3120 itemBoxSizerUI->Add(0, border_size * 3);
3123 itemBoxSizerUI->Add(
3124 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3126 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3127 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3129 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3130 _(
"Show Skewed Raster Charts as North-Up"));
3131 boxCharts->Add(pSkewComp, verticleInputFlags);
3149 itemBoxSizerUI->Add(0, border_size * 3);
3150 itemBoxSizerUI->Add(0, border_size * 3);
3153 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3154 _(
"Chart Rotation Averaging Time")),
3156 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3157 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3158 group_item_spacing);
3161 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3162 wxSize(50, -1), wxTE_RIGHT);
3163 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3165 pCOGUPFilterRow->Add(
3166 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3170 itemBoxSizerUI->Add(0, border_size * 8);
3171 itemBoxSizerUI->Add(0, border_size * 8);
3174 wxStaticText* zoomTextHead =
new wxStaticText(
3175 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3177 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3178 itemBoxSizerUI->Add(0, border_size * 1);
3179 itemBoxSizerUI->Add(0, border_size * 1);
3181 wxStaticText* zoomText =
new wxStaticText(
3182 m_ChartDisplayPage, wxID_ANY,
3183 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3184With a higher value, the same zoom level shows a more detailed chart."));
3186 smallFont = *dialogFont;
3188 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3190 zoomText->SetFont(smallFont);
3191 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3199 itemBoxSizerUI->Add(
3200 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3202 m_pSlider_Zoom_Raster =
3203 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3204 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3207 prepareSlider(m_pSlider_Zoom_Raster);
3210 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3212 itemBoxSizerUI->Add(
3213 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3215 m_pSlider_Zoom_Vector =
3216 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3217 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3220 prepareSlider(m_pSlider_Zoom_Vector);
3223 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3226 itemBoxSizerUI->Add(0, border_size * 3);
3227 itemBoxSizerUI->Add(0, border_size * 3);
3229 itemBoxSizerUI->Add(
3230 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3232 m_pSlider_CM93_Zoom =
3233 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3234 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3235 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3238 prepareSlider(m_pSlider_CM93_Zoom);
3241 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3244 itemBoxSizerUI->Add(0, border_size * 3);
3245 itemBoxSizerUI->Add(0, border_size * 3);
3246 itemBoxSizerUI->Add(0, border_size * 3);
3247 itemBoxSizerUI->Add(0, border_size * 3);
3248 itemBoxSizerUI->Add(0, border_size * 3);
3249 itemBoxSizerUI->Add(0, border_size * 3);
3252 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3253 _(
"Physical Screen Width")),
3255 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3256 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3258 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3259 pDPIRow->Add(pRBSizeAuto, inputFlags);
3260 pDPIRow->AddSpacer(10);
3261 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3262 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3263 pDPIRow->Add(pRBSizeManual, inputFlags);
3266 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3267 wxSize(3 * m_fontHeight, -1), wxTE_RIGHT);
3268 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3270 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3273 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3274 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3276 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3277 wxCommandEventHandler(options::OnSizeManualButton),
3281 itemBoxSizerUI->Add(0, border_size * 3);
3282 itemBoxSizerUI->Add(0, border_size * 3);
3287 itemBoxSizerUI->Add(
3288 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3290 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3291 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3293 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3294 _(
"Use Accelerated Graphics (OpenGL)"));
3295 OpenGLSizer->Add(pOpenGL, inputFlags);
3296 pOpenGL->Enable(!g_bdisable_opengl && g_Platform->IsGLCapable());
3298 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3299 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3305 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3306 _(
"Options") +
"...");
3307 OpenGLSizer->Add(bOpenGL, inputFlags);
3310 itemBoxSizerUI->Add(0, border_size * 3);
3311 itemBoxSizerUI->Add(0, border_size * 3);
3316 itemBoxSizerUI->Add(
3317 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3319 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3320 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3322 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3323 _(
"Show extended chart bar information."));
3324 ChartBarSizer->Add(pChartBarEX, inputFlags);
3336 m_ChartDisplayPage->Fit();
3340void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3341 int group_item_spacing) {
3342 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3345 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3346 ps57Ctl->SetSizer(vectorPanel);
3349 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3350 optionsColumn->SetHGap(border_size);
3351 optionsColumn->AddGrowableCol(0, 2);
3352 optionsColumn->AddGrowableCol(1, 3);
3353 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3356 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3357 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3362 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3364 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3365 _(
"Mariner's Standard")};
3366 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3367 wxDefaultSize, 4, pDispCatStrings);
3368 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3372 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3373 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3376 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3379 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3380 optionsColumn->Add(miscSizer, groupInputFlags);
3384 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3385 pCheck_SOUNDG->SetValue(FALSE);
3386 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3389 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3390 _(
"Chart Information Objects"));
3391 pCheck_META->SetValue(FALSE);
3392 miscSizer->Add(pCheck_META, verticleInputFlags);
3395 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3398 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3399 optionsColumn->Add(lightSizer, groupInputFlags);
3402 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3403 pCheck_ATONTEXT->SetValue(FALSE);
3404 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3407 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3408 pCheck_LDISTEXT->SetValue(FALSE);
3409 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3411 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3412 _(
"Extended Light Sectors"));
3413 pCheck_XLSECTTEXT->SetValue(FALSE);
3414 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3417 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3420 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3421 optionsColumn->Add(textSizer, groupInputFlags);
3423 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3424 _(
"National text on chart"));
3425 pCheck_NATIONALTEXT->SetValue(FALSE);
3426 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3428 pCheck_SHOWIMPTEXT =
3429 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3430 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3431 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3434 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3435 pCheck_DECLTEXT->SetValue(FALSE);
3436 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3438 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3440 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3441 _(
"Reduced Detail at Small Scale"));
3442 pCheck_SCAMIN->SetValue(FALSE);
3443 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3445 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3446 pCheck_SuperSCAMIN =
3447 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3448 _(
"Additional detail reduction at Small Scale"));
3449 pCheck_SuperSCAMIN->SetValue(FALSE);
3450 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3453 optionsColumn->Add(0, border_size * 4);
3454 optionsColumn->Add(0, border_size * 4);
3456 wxSize item_size = wxSize(-1, -1);
3458 item_size = wxSize(m_fontHeight * 3, m_fontHeight);
3462 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3464 wxString pPointStyleStrings[] = {
3468 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3469 item_size, 2, pPointStyleStrings);
3470 optionsColumn->Add(pPointStyle, inputFlags);
3472 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3474 wxString pBoundStyleStrings[] = {
3478 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3479 item_size, 2, pBoundStyleStrings);
3480 optionsColumn->Add(pBoundStyle, inputFlags);
3482 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3484 wxString pColorNumStrings[] = {
3488 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3489 item_size, 2, pColorNumStrings);
3490 optionsColumn->Add(p24Color, inputFlags);
3493 optionsColumn->Add(0, border_size * 4);
3494 optionsColumn->Add(0, border_size * 4);
3496 item_size = wxSize(60, -1);
3498 item_size = wxSize(m_fontHeight * 2, m_fontHeight);
3502 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3504 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3505 optionsColumn->Add(depShalRow);
3506 m_ShallowCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3507 item_size, wxTE_RIGHT);
3508 depShalRow->Add(m_ShallowCtl, inputFlags);
3509 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3510 depShalRow->Add(m_depthUnitsShal, inputFlags);
3512 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3514 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3515 optionsColumn->Add(depSafeRow);
3516 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3517 item_size, wxTE_RIGHT);
3518 depSafeRow->Add(m_SafetyCtl, inputFlags);
3519 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3520 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3522 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3524 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3525 optionsColumn->Add(depDeepRow);
3526 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3527 item_size, wxTE_RIGHT);
3528 depDeepRow->Add(m_DeepCtl, inputFlags);
3529 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3530 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3533 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3534 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3536 wxStaticBox* marinersBox =
3537 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3538 wxStaticBoxSizer* marinersSizer =
3539 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3540 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3543 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3544 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3546 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3547 itemButtonSelectList =
3548 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3549 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3550 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3551 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3552 marinersSizer->Add(btnRow1);
3554 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3556 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3557 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3558 marinersSizer->Add(btnRow2);
3563 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3564 ps57Ctl->SetSizer(vectorPanel);
3566 wxBoxSizer* optionsColumn = vectorPanel;
3569 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3574 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3576 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3577 _(
"Mariner's Standard")};
3578 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3579 wxSize(350, -1), 4, pDispCatStrings);
3580 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3583 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3588 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3589 optionsColumn->Add(miscSizer, groupInputFlags);
3592 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3593 pCheck_SOUNDG->SetValue(FALSE);
3594 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3596 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3597 _(
"Chart Information Objects"));
3598 pCheck_META->SetValue(FALSE);
3599 miscSizer->Add(pCheck_META, inputFlags);
3601 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3602 optionsColumn->Add(lightSizer, groupInputFlags);
3605 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3606 pCheck_ATONTEXT->SetValue(FALSE);
3607 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3610 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3611 pCheck_LDISTEXT->SetValue(FALSE);
3612 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3614 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3615 _(
"Extended Light Sectors"));
3616 pCheck_XLSECTTEXT->SetValue(FALSE);
3617 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3619 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3620 optionsColumn->Add(textSizer, groupInputFlags);
3622 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3623 _(
"National text on chart"));
3624 pCheck_NATIONALTEXT->SetValue(FALSE);
3625 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3627 pCheck_SHOWIMPTEXT =
3628 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3629 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3630 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3633 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3634 pCheck_DECLTEXT->SetValue(FALSE);
3635 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3637 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3638 _(
"Reduced Detail at Small Scale"));
3639 pCheck_SCAMIN->SetValue(FALSE);
3640 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3642 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3643 pCheck_SuperSCAMIN =
3644 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3645 _(
"Additional detail reduction at Small Scale"));
3646 pCheck_SuperSCAMIN->SetValue(FALSE);
3647 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3650 optionsColumn->Add(0, border_size * 4);
3651 optionsColumn->Add(0, border_size * 4);
3655 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3656 StyleColumn->SetHGap(border_size);
3657 StyleColumn->AddGrowableCol(0, 2);
3658 StyleColumn->AddGrowableCol(1, 3);
3659 optionsColumn->Add(StyleColumn);
3661 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3663 wxString pPointStyleStrings[] = {
3667 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3668 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3669 pPointStyleStrings);
3671 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3674 StyleColumn->Add(pPointStyle, inputFlags);
3676 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3678 wxString pBoundStyleStrings[] = {
3682 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3683 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3684 pBoundStyleStrings);
3686 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3689 StyleColumn->Add(pBoundStyle, inputFlags);
3691 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3694 wxString pColorNumStrings[] = {
3698 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3699 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3702 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3704 StyleColumn->Add(p24Color, inputFlags);
3707 optionsColumn->Add(0, border_size * 4);
3708 optionsColumn->Add(0, border_size * 4);
3710 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3711 DepthColumn->SetHGap(border_size);
3712 DepthColumn->AddGrowableCol(0, 3);
3713 DepthColumn->AddGrowableCol(1, 2);
3714 DepthColumn->AddGrowableCol(2, 3);
3715 optionsColumn->Add(DepthColumn);
3718 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3721 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3722 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3723 DepthColumn->Add(m_ShallowCtl, inputFlags);
3724 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3725 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3727 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3730 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3731 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3732 DepthColumn->Add(m_SafetyCtl, inputFlags);
3733 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3734 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3736 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3739 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3740 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3741 DepthColumn->Add(m_DeepCtl, inputFlags);
3742 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3743 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3746 optionsColumn->Add(0, border_size * 4);
3747 optionsColumn->Add(0, border_size * 4);
3750 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3751 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3753 wxStaticBox* marinersBox =
3754 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3755 wxStaticBoxSizer* marinersSizer =
3756 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3757 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3759 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3760 itemButtonSelectList =
3761 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3762 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3763 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3764 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3765 marinersSizer->Add(btnRow1);
3767 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3769 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3770 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3771 marinersSizer->Add(btnRow2);
3774 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3776 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3780void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3781 int group_item_spacing) {
3782 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3784 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3785 tcPanel->SetSizer(mainHBoxSizer);
3787 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3788 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3789 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3792 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3793 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3795 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3799 tcDataSelected->DeleteAllItems();
3806 col0.SetAlign(wxLIST_FORMAT_LEFT);
3808 tcDataSelected->InsertColumn(0, col0);
3811 unsigned int id = 0;
3812 for (
auto ds : TideCurrentDataSet) {
3815 tcDataSelected->InsertItem(li);
3817 wxString setName = ds;
3818 tcDataSelected->SetItem(
id, 0, setName);
3819 GetTextExtent(setName, &w1, &h);
3820 w = w1 > w ? w1 : w;
3823 tcDataSelected->SetColumnWidth(0, 20 + w);
3826 wxButton* insertButton =
3827 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3828 wxButton* removeButton =
3829 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3831 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3832 tcSizer->Add(btnSizer);
3834 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3835 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3838void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3839 int group_item_spacing) {
3844 wxNotebook* chartsPageNotebook = (wxNotebook*)m_pListbook->GetPage(parent);
3845 wxScrolledWindow* sw =
new ChartGroupsUI(chartsPageNotebook);
3846 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3847 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3850 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3853void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3854 int group_item_spacing) {
3856 m_border_size = border_size;
3857 m_group_item_spacing = group_item_spacing;
3859 m_UIcomplete = FALSE;
3864void ChartGroupsUI::CompletePanel() {
3866 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3867 m_panel->SetSizer(m_topSizer);
3870 wxStaticText* allChartsLabel =
3871 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3872 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3874 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3875 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3877 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3878 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3882 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3883 wxDefaultSize, wxVSCROLL);
3886 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3887 wxDefaultSize, wxVSCROLL);
3889 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3891 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3892 m_pAddButton->Disable();
3893 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3894 m_pRemoveButton->Disable();
3896 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3897 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3899 m_pRemoveButton->Connect(
3900 wxEVT_COMMAND_BUTTON_CLICKED,
3901 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3903 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3904 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3905 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3907 sizerCharts->AddSpacer(20);
3910 wxStaticText* groupsLabel =
3911 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3912 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3914 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
3915 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
3917 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
3918 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
3919 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
3920 wxDefaultSize, wxNB_TOP);
3921 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
3923 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
3924 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
3928 wxPanel* allActiveGroup =
3929 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
3930 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
3932 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
3933 allActiveGroup->SetSizer(page0BoxSizer);
3935 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1,
"",
3936 wxDefaultPosition, wxDefaultSize);
3939 iFont =
new wxFont(*dialogFont);
3940 iFont->SetStyle(wxFONTSTYLE_ITALIC);
3941 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
3943 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
3945 m_DirCtrlArray.Add(defaultAllCtl);
3949 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
3950 m_pDeleteGroupButton =
3951 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
3952 m_pDeleteGroupButton->Disable();
3954 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3955 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
3957 m_pDeleteGroupButton->Connect(
3958 wxEVT_COMMAND_BUTTON_CLICKED,
3959 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
3961 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
3962 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
3964 newDeleteGrp->AddSpacer(25);
3965 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
3966 m_group_item_spacing);
3967 newDeleteGrp->AddSpacer(15);
3968 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
3969 m_group_item_spacing);
3970 newDeleteGrp->AddSpacer(25);
3971 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3973 sizerGroups->AddSpacer(20);
3977 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
3978 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
3981 m_UIcomplete = TRUE;
3984void options::CreatePanel_Display(
size_t parent,
int border_size,
3985 int group_item_spacing) {
3986 pDisplayPanel = AddPage(parent, _(
"General"));
3989 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
3990 generalSizer->SetHGap(border_size);
3997 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3998 pDisplayPanel->SetSizer(wrapperSizer);
3999 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4002 generalSizer->Add(0, border_size * 4);
4003 generalSizer->Add(0, border_size * 4);
4008 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4010 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4011 generalSizer->Add(boxNavMode, groupInputFlags);
4013 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4014 boxNavMode->Add(rowOrientation);
4016 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4017 rowOrientation->Add(pCBNorthUp, inputFlags);
4019 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4020 rowOrientation->Add(pCBCourseUp,
4022 .Align(wxALIGN_CENTRE_VERTICAL)
4023 .Border(wxLEFT, group_item_spacing * 2));
4025 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4026 _(
"Look Ahead Mode"));
4027 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4030 generalSizer->Add(0, border_size * 4);
4031 generalSizer->Add(0, border_size * 4);
4035 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4037 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4038 generalSizer->Add(boxCharts, groupInputFlags);
4040 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4041 _(
"Enable Chart Quilting"));
4042 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4045 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4046 _(
"Preserve scale when switching charts"));
4047 boxCharts->Add(pPreserveScale, verticleInputFlags);
4050 generalSizer->Add(0, border_size * 4);
4051 generalSizer->Add(0, border_size * 4);
4055 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4057 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4058 generalSizer->Add(boxCtrls, groupInputFlags);
4060 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4061 _(
"Smooth Panning / Zooming"));
4062 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4064 pEnableZoomToCursor =
4065 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4066 pEnableZoomToCursor->SetValue(FALSE);
4067 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4069 pEnableTenHertz =
nullptr;
4071 pEnableTenHertz =
new wxCheckBox(pDisplayPanel, ID_TENHZCHECKBOX,
4072 _(
"Enable Ten Hz screen update"));
4073 pEnableTenHertz->SetValue(FALSE);
4074 boxCtrls->Add(pEnableTenHertz, verticleInputFlags);
4079 generalSizer->Add(0, border_size * 4);
4080 generalSizer->Add(0, border_size * 4);
4084 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4086 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4087 generalSizer->Add(boxDisp, groupInputFlags);
4090 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4091 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4093 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4094 _(
"Show Chart Outlines"));
4095 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4097 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4098 _(
"Show Depth Units"));
4099 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4109 generalSizer->Add(0, border_size * 4);
4110 generalSizer->Add(0, border_size * 4);
4114 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar Option")),
4116 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4117 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4120 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4121 _(
"Live ETA at Cursor"));
4122 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4126 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4127 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4129 m_Text_def_boat_speed =
new wxStaticText(
4130 pDisplayPanel, wxID_ANY,
4131 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4133 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4134 pSDefaultBoatSpeed =
4135 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4136 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4137 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4138 group_item_spacing);
4145 if (g_Platform->GetDisplayAreaCM2() > 100) {
4146 wxStaticBox* itemStaticBoxScreenConfig =
4147 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4148 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4149 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4150 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4153 wxString iconDir = g_Platform->GetSharedDataDir();
4154 appendOSDirSlash(&iconDir);
4155 iconDir.append(
"uidata");
4156 appendOSDirSlash(&iconDir);
4157 iconDir.append(
"MUI_flat");
4158 appendOSDirSlash(&iconDir);
4159 int bmpSize = GetCharHeight() * 3;
4161 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4162 m_sconfigSelect_single =
4164 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4167 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4169 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4170 m_sconfigSelect_twovertical =
4172 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4175 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4180 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4181 generalSizer->SetHGap(border_size);
4188 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4189 pDisplayPanel->SetSizer(wrapperSizer);
4190 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4193 generalSizer->Add(0, border_size * 4);
4194 generalSizer->Add(0, border_size * 4);
4199 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4201 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4202 generalSizer->Add(boxNavMode, groupInputFlags);
4204 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4205 boxNavMode->Add(rowOrientation);
4207 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4208 rowOrientation->Add(pCBNorthUp, inputFlags);
4210 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4211 rowOrientation->Add(pCBCourseUp,
4213 .Align(wxALIGN_CENTRE_VERTICAL)
4214 .Border(wxLEFT, group_item_spacing * 2));
4216 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4217 _(
"Look Ahead Mode"));
4218 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4221 generalSizer->Add(0, border_size * 4);
4222 generalSizer->Add(0, border_size * 4);
4226 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4228 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4229 generalSizer->Add(boxCharts, groupInputFlags);
4231 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4232 _(
"Enable Chart Quilting"));
4233 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4236 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4237 _(
"Preserve scale when switching charts"));
4238 boxCharts->Add(pPreserveScale, verticleInputFlags);
4241 generalSizer->Add(0, border_size * 4);
4242 generalSizer->Add(0, border_size * 4);
4246 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4248 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4249 generalSizer->Add(boxCtrls, groupInputFlags);
4251 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4252 _(
"Smooth Panning / Zooming"));
4253 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4254 pEnableZoomToCursor =
4255 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4256 pEnableZoomToCursor->SetValue(FALSE);
4257 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4260 pSmoothPanZoom->Hide();
4261 pEnableZoomToCursor->Hide();
4265 generalSizer->Add(0, border_size * 4);
4266 generalSizer->Add(0, border_size * 4);
4271 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4273 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4274 generalSizer->Add(boxDisp, groupInputFlags);
4277 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4278 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4280 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4281 _(
"Show Chart Outlines"));
4282 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4284 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4285 _(
"Show Depth Units"));
4286 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4296 generalSizer->Add(0, border_size * 4);
4297 generalSizer->Add(0, border_size * 4);
4301 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4303 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4304 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4307 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4308 _(
"Live ETA at Cursor"));
4309 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4313 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4314 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4315 m_Text_def_boat_speed =
new wxStaticText(
4316 pDisplayPanel, wxID_ANY,
4317 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4318 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4319 pSDefaultBoatSpeed =
4320 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4321 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4322 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4323 group_item_spacing);
4329 if (g_Platform->GetDisplayAreaCM2() > 100) {
4331 wxStaticBox* itemStaticBoxScreenConfig =
4332 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4333 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4334 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4335 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4338 wxString iconDir = g_Platform->GetSharedDataDir();
4339 appendOSDirSlash(&iconDir);
4340 iconDir.append(
"uidata");
4341 appendOSDirSlash(&iconDir);
4342 iconDir.append(
"MUI_flat");
4343 appendOSDirSlash(&iconDir);
4344 int bmpSize = GetCharHeight() * 3;
4346 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4347 m_sconfigSelect_single =
4349 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4352 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4354 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4355 m_sconfigSelect_twovertical =
4357 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4360 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4366void options::CreatePanel_Units(
size_t parent,
int border_size,
4367 int group_item_spacing) {
4368 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4371 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4372 unitsSizer->SetHGap(border_size);
4376 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4377 panelUnits->SetSizer(wrapperSizer);
4379 wrapperSizer->Add(1, border_size * 24);
4380 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4383 unitsSizer->Add(0, border_size * 4);
4384 unitsSizer->Add(0, border_size * 4);
4387 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4389 wxString pDistanceFormats[kNumDistanceFormats];
4390 for (
int i = 0; i < kNumDistanceFormats; i++) {
4391 pDistanceFormats[i] = kDistanceFormats[i].label;
4393 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4395 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4396 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4399 pDistanceFormat->SetToolTip(ttDistance());
4401 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4403 unitsSizer->Add(pDistanceFormat, inputFlags);
4406 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4408 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4409 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4410 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4411 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4412 m_SpeedFormatsNChoices, pSpeedFormats);
4413 pSpeedFormat->SetToolTip(ttSpeed());
4415 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4417 unitsSizer->Add(pSpeedFormat, inputFlags);
4420 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4422 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4423 int m_WindSpeedFormatsNChoices =
4424 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4426 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4427 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4429 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4431 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4433 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4436 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4438 wxString pDepthUnitStrings[] = {
4444 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4445 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4447 pDepthUnitSelect->SetToolTip(ttDepth());
4449 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4451 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4454 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4456 wxString pHeightUnitStrings[] = {
4461 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4462 wxSize(m_fontHeight * 4, -1), 2, pHeightUnitStrings);
4465 pHeightUnitSelect->SetToolTip(ttHeight());
4467 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4469 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4472 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4474 wxString pTempUnitStrings[] = {
4480 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4481 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4482 pTempFormat->SetToolTip(ttTemp());
4484 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4486 unitsSizer->Add(pTempFormat, inputFlags);
4489 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4490 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4493 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4495 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4496 _(
"Decimal Degrees"),
4497 _(
"Degrees, Minutes, Seconds")};
4498 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4499 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4500 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4501 m_SDMMFormatsNChoices, pSDMMFormats);
4502 pSDMMFormat->SetToolTip(ttCoordFormat());
4504 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4506 unitsSizer->Add(pSDMMFormat, inputFlags);
4509 unitsSizer->Add(0, border_size * 4);
4510 unitsSizer->Add(0, border_size * 4);
4514 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4517 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4518 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4519 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4520 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4523 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4524 wxDefaultPosition, wxDefaultSize, 0);
4526 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4527 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4528 wxDefaultPosition, wxDefaultSize, 0);
4530 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4533 unitsSizer->Add(0, border_size * 4);
4534 unitsSizer->Add(0, border_size * 4);
4537 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4542 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4543 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4544 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4547 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4548 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4549 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4553 wxStaticBox* itemStaticBoxVar =
new wxStaticBox(panelUnits, wxID_ANY,
"");
4555 wxStaticBoxSizer* itemStaticBoxSizerVar =
4556 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4557 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4559 itemStaticBoxSizerVar->Add(0, border_size * 4);
4561 itemStaticTextUserVar =
4562 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4563 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4564 group_item_spacing);
4566 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4567 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4568 group_item_spacing);
4570 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4571 wxSize(150, -1), wxTE_RIGHT);
4572 magVarSizer->AddSpacer(100);
4574 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4576 itemStaticTextUserVar2 =
4577 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4579 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4580 group_item_spacing);
4582 itemStaticBoxSizerVar->Add(0, border_size * 40);
4585 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4586 unitsSizer->SetHGap(border_size);
4588 int item_h_size = -1;
4590 item_h_size = m_fontHeight * 4;
4595 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4596 panelUnits->SetSizer(wrapperSizer);
4597 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4600 unitsSizer->Add(0, border_size * 4);
4601 unitsSizer->Add(0, border_size * 4);
4604 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4606 wxString pDistanceFormats[kNumDistanceFormats];
4607 for (
int i = 0; i < kNumDistanceFormats; i++) {
4608 pDistanceFormats[i] = kDistanceFormats[i].label;
4610 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4611 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4612 wxDefaultPosition, wxSize(item_h_size, -1),
4613 m_DistanceFormatsNChoices, pDistanceFormats);
4614 pDistanceFormat->SetToolTip(ttDistance());
4616 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4618 unitsSizer->Add(pDistanceFormat, inputFlags);
4621 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4623 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4624 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4625 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4626 wxDefaultPosition, wxSize(item_h_size, -1),
4627 m_SpeedFormatsNChoices, pSpeedFormats);
4628 pSpeedFormat->SetToolTip(ttSpeed());
4630 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4632 unitsSizer->Add(pSpeedFormat, inputFlags);
4635 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4637 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4638 int m_WindSpeedFormatsNChoices =
4639 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4640 pWindSpeedFormat =
new wxChoice(
4641 panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4642 wxSize(item_h_size, -1), m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4643 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4645 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4647 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4650 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4652 wxString pDepthUnitStrings[] = {
4658 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4659 wxSize(item_h_size, -1), 3, pDepthUnitStrings);
4660 pDepthUnitSelect->SetToolTip(ttDepth());
4662 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4664 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4667 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4669 wxString pHeightUnitStrings[] = {
4674 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4675 wxSize(item_h_size, -1), 2, pHeightUnitStrings);
4676 pHeightUnitSelect->SetToolTip(ttHeight());
4678 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4680 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4683 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4685 wxString pTempUnitStrings[] = {
4691 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4692 wxSize(item_h_size, -1), 3, pTempUnitStrings);
4693 pTempFormat->SetToolTip(ttTemp());
4695 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4697 unitsSizer->Add(pTempFormat, inputFlags);
4700 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4701 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4704 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4706 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4707 _(
"Decimal Degrees"),
4708 _(
"Degrees, Minutes, Seconds")};
4709 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4710 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4711 wxDefaultPosition, wxSize(item_h_size, -1),
4712 m_SDMMFormatsNChoices, pSDMMFormats);
4713 pSDMMFormat->SetToolTip(ttCoordFormat());
4715 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4717 unitsSizer->Add(pSDMMFormat, inputFlags);
4720 unitsSizer->Add(0, border_size * 4);
4721 unitsSizer->Add(0, border_size * 4);
4725 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4728 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4729 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4730 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4731 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4734 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4735 wxDefaultPosition, wxDefaultSize, 0);
4737 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4738 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4739 wxDefaultPosition, wxDefaultSize, 0);
4741 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4744 unitsSizer->Add(0, border_size * 4);
4745 unitsSizer->Add(0, border_size * 4);
4748 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4751 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4752 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4755 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4756 _(
"Show true bearings and headings"));
4757 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4758 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4759 _(
"Show magnetic bearings and headings."));
4760 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4762 bearingsSizer->AddSpacer(10);
4765 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4766 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4768 itemStaticTextUserVar =
4769 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4770 itemStaticTextUserVar->SetLabel(
4771 _(
"WMM Plugin calculated magnetic variation"));
4773 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4774 group_item_spacing);
4776 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4777 wxSize(50, -1), wxTE_RIGHT);
4778 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4780 itemStaticTextUserVar2 =
4781 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4782 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4783 group_item_spacing);
4785 bearingsSizer->AddSpacer(10);
4787 wxStaticText* varText =
4788 new wxStaticText(panelUnits, wxID_ANY,
4789 _(
" To set the magnetic variation manually,\n you "
4790 "must disable the WMM plugin."));
4791 smallFont = *dialogFont;
4792 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4794 varText->SetFont(smallFont);
4796 bearingsSizer->Add(varText);
4805 OCPNSoundPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
4806 const wxSize& size, wxString title, wxString checkLegend,
4807 wxString selectLegend, wxString* pSoundFile);
4811 void OnButtonSelectSound(wxCommandEvent& event);
4812 void OnButtonSPTestSound(wxCommandEvent& event);
4813 wxString SelectSoundFile();
4814 void SetSoundFileLabel(wxString file);
4815 wxCheckBox* GetCheckBox() {
return m_pCheck_Sound; }
4816 wxString GetSoundFile() {
return m_sound_file; }
4818 wxCheckBox* m_pCheck_Sound;
4819 wxSize m_small_button_size;
4820 wxString m_sound_file;
4821 wxString* m_pSoundFile;
4822 wxStaticText* m_AudioFileNameText;
4825 wxButton* TestSound;
4826 o_sound::Sound* m_sound;
4832 bool m_soundPlaying;
4834 DECLARE_EVENT_TABLE()
4837#define ID_SELECTSOUND 9341
4838#define ID_TESTSOUND 9342
4841EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4842EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4847 const wxPoint& pos, const wxSize& size,
4848 wxString title, wxString checkLegend,
4849 wxString selectLegend, wxString* pSoundFile)
4850 : wxPanel(parent,
id, pos, size, wxBORDER_NONE), m_soundPlaying(false) {
4851 wxFont* pif = FontMgr::Get().
GetFont(_(
"Dialog"));
4854 m_pSoundFile = pSoundFile;
4855 if (pSoundFile) m_sound_file = *pSoundFile;
4857 m_sound = o_sound::Factory();
4859 int border_size = 4;
4860 int group_item_spacing = 2;
4862 int font_size_y, font_descent, font_lead;
4863 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
4864 m_small_button_size = wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4866 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4867 SetSizer(wrapperSizer);
4869 wxStaticBox* StaticBox1 =
new wxStaticBox(
this, wxID_ANY, title);
4870 wxStaticBoxSizer* StaticBoxSizer1 =
4871 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4872 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4874 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO, checkLegend);
4875 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4878 wxString LabelWrapped;
4884 g_pOptions->GetSize().x * 8 / 10);
4885 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4886 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4887 LabelWrapped +=
"\n";
4889 LabelWrapped +=
"\n";
4892 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4893 m_AudioFileNameText->Wrap(-1);
4894 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4896 SetSoundFileLabel(m_sound_file);
4899 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4900 soundSizer1->SetHGap(border_size * 2);
4901 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4903 SelSound =
new wxButton(
this, ID_SELECTSOUND, selectLegend, wxDefaultPosition,
4904 m_small_button_size, 0);
4905 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4906 soundSizer1->AddSpacer(group_item_spacing * 4);
4907 TestSound =
new wxButton(
this, ID_TESTSOUND, _(
"Test"), wxDefaultPosition,
4908 m_small_button_size, 0);
4909 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4910 auto sound_action = [
this](
ObservedEvt ev) { m_soundPlaying =
false; };
4911 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4914void OCPNSoundPanel::SetSoundFileLabel(wxString file) {
4915 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " + file);
4918 g_pOptions->GetSize().x * 8 / 10);
4919 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4920 wxString LabelWrapped;
4921 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4923 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4925 LabelWrapped += LabelWrappedArray[i];
4926 LabelWrapped +=
"\n";
4929 m_AudioFileNameText->SetLabel(LabelWrapped);
4933wxString OCPNSoundPanel::SelectSoundFile() {
4934 wxString sound_dir = g_Platform->GetSharedDataDir();
4935 sound_dir.Append(
"sounds");
4940 wxFileDialog* popenDialog =
new wxFileDialog(
4941 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4942 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
4944 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
4946 response = popenDialog->ShowModal();
4947 sel_file = popenDialog->GetPath();
4951 response = g_Platform->DoFileSelectorDialog(
4952 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
4956 if (response == wxID_OK)
4957 return g_Platform->NormalizePath(sel_file);
4962void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4963 wxString sel_file = SelectSoundFile();
4965 if (!sel_file.IsEmpty()) {
4966 m_sound_file = g_Platform->NormalizePath(sel_file);
4967 if (m_pSoundFile) *m_pSoundFile = m_sound_file;
4969 SetSoundFileLabel(m_sound_file);
4974void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
4975 if (!m_soundPlaying) {
4976 m_sound->SetFinishedCallback(
4978 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
4979 m_soundPlaying =
true;
4985void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent& event) {
4986 if (event.IsChecked())
4987 m_pCheck_AlertAudio->SetValue(
true);
4989 if (!m_soundPanelSART->GetCheckBox()->GetValue() &&
4990 !m_soundPanelDSC->GetCheckBox()->GetValue())
4991 m_pCheck_AlertAudio->SetValue(
false);
4995void options::OnUXAudioEnableButtonClickSART(wxCommandEvent& event) {
4996 if (event.IsChecked())
4997 m_pCheck_AlertAudio->SetValue(
true);
4999 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5000 !m_soundPanelDSC->GetCheckBox()->GetValue())
5001 m_pCheck_AlertAudio->SetValue(
false);
5005void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent& event) {
5006 if (event.IsChecked())
5007 m_pCheck_AlertAudio->SetValue(
true);
5009 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5010 !m_soundPanelSART->GetCheckBox()->GetValue())
5011 m_pCheck_AlertAudio->SetValue(
false);
5015void options::CreatePanel_Sounds(
size_t parent,
int border_size,
5016 int group_item_spacing) {
5017 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
5019 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
5020 panelSounds->SetSizer(wrapperSizer);
5024 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize,
5025 _(
"Anchor Alarm"), _(
"Play Sound on Anchor Alarm."),
5026 _(
"Select Anchor Alarm Sound"), &g_anchorwatch_sound_file);
5027 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
5031 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"AIS Alert"),
5032 _(
"Play Sound on AIS Alert."), _(
"Select AIS Alert Sound"),
5034 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
5036 m_soundPanelAIS->GetCheckBox()->Connect(
5037 wxEVT_COMMAND_CHECKBOX_CLICKED,
5038 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
5043 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"SART Alert"),
5044 _(
"Play Sound on AIS SART Alert."), _(
"Select AIS SART Alert Sound"),
5045 &g_SART_sound_file);
5046 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
5048 m_soundPanelSART->GetCheckBox()->Connect(
5049 wxEVT_COMMAND_CHECKBOX_CLICKED,
5050 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
5055 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"DSC Alert"),
5056 _(
"Play Sound on DSC notification."), _(
"Select DSC notification Sound"),
5058 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
5060 m_soundPanelDSC->GetCheckBox()->Connect(
5061 wxEVT_COMMAND_CHECKBOX_CLICKED,
5062 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
5066 wxStaticBox* StatBoxSoundConfig =
5067 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
5068 wxStaticBoxSizer* StatBoxSoundConfigSizer =
5069 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
5070 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
5072 auto sound = std::unique_ptr<o_sound::Sound>(o_sound::Factory());
5073 int deviceCount = sound->DeviceCount();
5074 wxLogMessage(
"options: got device count: %d", deviceCount);
5075 if (deviceCount >= 1) {
5076 wxArrayString labels;
5077 for (
int i = 0; i < deviceCount; i += 1) {
5078 wxString label(sound->GetDeviceInfo(i));
5080 std::ostringstream stm;
5082 label = _(
"Unknown device :") + stm.str();
5084 if (!sound->IsOutputDevice(i)) {
5085 std::ostringstream stm;
5087 label = _(
"Input device :") + stm.str();
5094 int iDefault = labels.Index(
"default");
5096 if (g_iSoundDeviceIndex == -1) {
5098 g_iSoundDeviceIndex = iDefault;
5100 g_iSoundDeviceIndex = 0;
5103 pSoundDeviceIndex =
new wxChoice();
5104 if (pSoundDeviceIndex) {
5105 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
5106 wxDefaultSize, labels);
5107 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
5108 pSoundDeviceIndex->Show();
5109 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
5110 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
5111 group_item_spacing);
5113 stSoundDeviceIndex =
5114 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
5115 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
5116 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
5121 if ((
bool)
dynamic_cast<o_sound::SystemCmdSound*
>(o_sound::Factory())) {
5122 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
5123 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND,
5124 group_item_spacing);
5126 new wxTextCtrl(panelSounds, wxID_ANY,
"", wxDefaultPosition,
5127 wxSize(450, -1), wxTE_LEFT);
5129 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
5130 wxALIGN_LEFT | wxALL);
5131 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
5135 if (!deviceCount) StatBoxSoundConfig->Hide();
5138 stSoundDeviceIndex->Hide();
5139 pSoundDeviceIndex->Hide();
5143void options::CreatePanel_MMSI(
size_t parent,
int border_size,
5144 int group_item_spacing) {
5145 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
5147 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
5148 panelMMSI->SetSizer(MMSISizer);
5151 wxStaticBox* itemStaticBoxMMSI =
5152 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
5153 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
5154 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
5155 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
5159 pPropsPanel->UpdateMMSIList();
5161 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
5163 panelMMSI->Layout();
5166void options::CreatePanel_AIS(
size_t parent,
int border_size,
5167 int group_item_spacing) {
5168 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5170 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5171 panelAIS->SetSizer(aisSizer);
5174 wxStaticBox* itemStaticBoxCPA =
5175 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5176 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5177 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5178 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5180 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5181 pCPAGrid->AddGrowableCol(1);
5182 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5184 m_pCheck_CPA_Max =
new wxCheckBox(
5186 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5187 m_pCheck_CPA_Max->SetToolTip(
5188 _(
"Disable CPA (Closest Point of Approach) and TCPA (Time to CPA) alerts "
5189 "for targets beyond this distance from your vessel"));
5190 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5192 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5193 m_pText_CPA_Max->SetToolTip(
5194 _(
"Maximum distance in nautical miles at which Closest Point of Approach "
5195 "alerts will be triggered"));
5196 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5199 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5200 m_pCheck_CPA_Warn->SetToolTip(
5201 _(
"Enable warning alerts when targets have a Closest Point of Approach "
5202 "less than this distance"));
5203 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5206 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5207 m_pText_CPA_Warn->SetToolTip(
5208 _(
"Distance threshold in nautical miles for CPA warning alerts"));
5209 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5211 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5212 wxCommandEventHandler(options::OnCPAWarnClick),
5215 m_pCheck_CPA_WarnT =
5216 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5217 m_pCheck_CPA_WarnT->SetToolTip(
5218 _(
"Additional time constraint - alerts only occur if the Time to Closest "
5219 "Point of Approach is less than this value"));
5220 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5222 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5223 m_pText_CPA_WarnT->SetToolTip(
5224 _(
"Time threshold in minutes for TCPA constraints"));
5225 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5226 group_item_spacing);
5229 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5230 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5231 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5233 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5234 pLostGrid->AddGrowableCol(1);
5235 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5237 m_pCheck_Mark_Lost =
5238 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5239 m_pCheck_Mark_Lost->SetToolTip(
5240 _(
"Targets will be considered lost when no update is received for this "
5242 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5244 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5245 m_pText_Mark_Lost->SetToolTip(
5246 _(
"Time in minutes after which targets with no updates are marked as "
5248 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5249 group_item_spacing);
5251 m_pCheck_Remove_Lost =
5252 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5253 m_pCheck_Remove_Lost->SetToolTip(
5254 _(
"Lost targets will be completely removed from display after this "
5255 "additional time period"));
5256 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5258 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5259 m_pText_Remove_Lost->SetToolTip(_(
5260 "Time in minutes after which lost targets are removed from the display"));
5261 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5262 group_item_spacing);
5264 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5267 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5268 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5269 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5271 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5272 pDisplayGrid->AddGrowableCol(1);
5273 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5275 m_pCheck_Show_COG =
new wxCheckBox(
5276 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5277 m_pCheck_Show_COG->SetToolTip(
5278 _(
"Display a predictor arrow for each AIS target, showing its projected "
5279 "course over ground for the specified number of minutes."));
5280 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5282 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5283 m_pText_COG_Predictor->SetToolTip(
5284 _(
"Set the length in minutes for the COG predictor arrow for AIS "
5286 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5287 group_item_spacing);
5289 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5290 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5291 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5292 m_pCheck_Sync_OCOG_ACOG->Connect(
5293 wxEVT_COMMAND_CHECKBOX_CLICKED,
5294 wxCommandEventHandler(options::OnSyncCogPredClick), NULL,
this);
5296 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1,
"");
5297 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5299 m_pCheck_Show_Tracks =
5300 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5301 m_pCheck_Show_Tracks->SetToolTip(
5302 _(
"Display the recent track (history) of each AIS target for the "
5303 "specified number of minutes."));
5304 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5306 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5307 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5308 group_item_spacing);
5310 m_pCheck_Hide_Moored =
new wxCheckBox(
5311 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5312 m_pCheck_Hide_Moored->SetToolTip(
5313 _(
"Hide AIS targets that are moving slower than this speed, typically "
5314 "indicating they are anchored or moored."));
5315 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5317 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5318 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5319 group_item_spacing);
5321 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5322 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5323 m_pCheck_Draw_Realtime_Prediction->SetToolTip(
5324 _(
"Show a real-time prediction vector for AIS targets moving faster than "
5326 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5327 group_item_spacing);
5329 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5330 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5331 group_item_spacing);
5333 m_pCheck_Scale_Priority =
new wxCheckBox(
5335 _(
"Allow attenuation of less critical targets if more than ... targets"));
5336 m_pCheck_Scale_Priority->SetToolTip(
5337 _(
"Reduce the display prominence of less critical AIS targets when the "
5338 "number of targets exceeds the specified value."));
5339 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5341 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5342 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5343 group_item_spacing);
5345 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5346 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5347 m_pCheck_Show_Area_Notices->SetToolTip(
5348 _(
"Display area notices received via AIS binary messages on the chart."));
5349 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5351 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1,
"");
5352 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5354 m_pCheck_Draw_Target_Size =
5355 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5356 m_pCheck_Draw_Target_Size->SetToolTip(
5357 _(
"Display AIS targets using their actual reported size and shape on the "
5359 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5361 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1,
"");
5362 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5364 m_pCheck_Show_Target_Name =
new wxCheckBox(
5365 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5366 m_pCheck_Show_Target_Name->SetToolTip(
5367 _(
"Display the name of AIS targets when the chart scale is greater than "
5368 "the specified value."));
5369 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5371 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5372 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5373 group_item_spacing);
5375 m_pCheck_use_Wpl =
new wxCheckBox(
5376 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5377 m_pCheck_use_Wpl->SetToolTip(
5378 _(
"Enable processing of WPL (Waypoint Location) position messages from "
5379 "AIS and select the action to take when received."));
5380 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5382 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5383 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5384 wxDefaultSize, 2, Wpl_Action);
5385 m_pWplAction->SetToolTip(
5386 _(
"Select the action to perform when a WPL message is received: create "
5387 "an Automatic Packet Reporting System (APRS) report or a mark on the "
5389 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5392 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5393 wxStaticBoxSizer* rolloverSizer =
5394 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5395 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5397 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5398 _(
"Enable route/AIS info block"));
5399 pRollover->SetToolTip(
5400 _(
"Show a popup info block with details about routes and AIS targets "
5401 "when hovering over them."));
5402 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5404 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5405 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5409 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5410 pStatic_CallSign->SetToolTip(
5411 _(
"Display the ship name and MMSI (call sign) in the rollover info "
5413 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5415 m_pCheck_Rollover_Class =
5416 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5417 m_pCheck_Rollover_Class->SetToolTip(
5418 _(
"Show the AIS class, type, and status in the rollover info block."));
5419 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5421 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5422 m_pCheck_Rollover_COG->SetToolTip(
5423 _(
"Show speed over ground (SOG) and course over ground (COG) in the "
5424 "rollover info block."));
5425 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5427 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5428 m_pCheck_Rollover_CPA->SetToolTip(
5429 _(
"Show Closest Point of Approach (CPA) and time to CPA (TCPA) in the "
5430 "rollover info block."));
5431 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5434 wxStaticBox* alertBox =
5435 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5436 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5437 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5439 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5440 pAlertGrid->AddGrowableCol(1);
5441 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5443 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5444 _(
"Show CPA/TCPA Alert Dialog"));
5445 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5447 m_pCheck_AlertDialog->Connect(
5448 wxEVT_COMMAND_CHECKBOX_CLICKED,
5449 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5458 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1,
"");
5459 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5461 m_pCheck_AlertAudio =
new wxCheckBox(
5462 panelAIS, ID_AISALERTAUDIO,
5463 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5464 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5466 m_pCheck_AlertAudio->Connect(
5467 wxEVT_COMMAND_CHECKBOX_CLICKED,
5468 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5471 wxButton* m_pPlay_Sound =
5472 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"), wxDefaultPosition,
5473 m_small_button_size, 0);
5474 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5476 m_pPlay_Sound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
5477 wxCommandEventHandler(options::OnButtonTestSound),
5483 m_pCheck_Alert_Moored =
new wxCheckBox(
5484 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5485 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5487 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1,
"");
5488 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5490 m_pCheck_Ack_Timout =
new wxCheckBox(
5491 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5492 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5494 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5495 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5496 group_item_spacing);
5504 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5508 GetHandle()->setStyleSheet(getQtStyleSheet());
5513void options::CreatePanel_UI(
size_t parent,
int border_size,
5514 int group_item_spacing) {
5515 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5517 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5518 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5520 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5521 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5523 wxStaticBox* itemLangStaticBox =
5524 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5525 wxStaticBoxSizer* itemLangStaticBoxSizer =
5526 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5528 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5530 wxSize langChoiceSize = wxSize(-1, -1);
5533 langChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5536 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG,
5537 wxDefaultPosition, langChoiceSize);
5539 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5546 wxStaticBox* itemFontStaticBox =
5547 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5549 wxSize fontChoiceSize = wxSize(-1, -1);
5551 int fLayout = wxHORIZONTAL;
5554 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5557 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5560 wxStaticBoxSizer* itemFontStaticBoxSizer =
5561 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5562 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5565 m_itemFontElementListBox =
5566 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5567 fontChoiceSize, 0, NULL, wxCB_SORT);
5570 for (
size_t i = 0; i < uniqueStrings.GetCount(); i++) {
5571 m_itemFontElementListBox->Append(uniqueStrings[i]);
5574 if (uniqueStrings.GetCount()) m_itemFontElementListBox->SetSelection(0);
5576 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5578 wxButton* itemFontChooseButton =
5579 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5580 wxDefaultPosition, wxDefaultSize, 0);
5581 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5582#if defined(__WXGTK__) || defined(__WXQT__)
5583 wxButton* itemFontColorButton =
5584 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5585 wxDefaultPosition, wxDefaultSize, 0);
5586 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5588 wxButton* itemFontResetButton =
5589 new wxButton(itemPanelFont, ID_BUTTONFONT_RESET, _(
"Reset to Default"),
5590 wxDefaultPosition, wxDefaultSize, 0);
5591 itemFontStaticBoxSizer->Add(itemFontResetButton, 0, wxALL, border_size);
5593 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5594 wxDefaultPosition, wxDefaultSize, 0);
5595 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5600 wxStaticBox* itemStyleStaticBox =
5601 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5602 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5603 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5604 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5606 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5608 wxArrayPtrVoid styles = g_StyleManager->GetArrayOfStyles();
5609 for (
unsigned int i = 0; i < styles.Count(); i++) {
5611 m_itemStyleListBox->Append(style->name);
5613 m_itemStyleListBox->SetStringSelection(
5614 g_StyleManager->GetCurrentStyle()->name);
5615 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5618 wxStaticBox* miscOptionsBox =
5619 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5620 wxStaticBoxSizer* miscOptions =
5621 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5622 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5625 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5626 pShowStatusBar->SetValue(FALSE);
5627 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5630 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5631 pShowMenuBar->SetValue(FALSE);
5632 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5636 pShowMenuBar->Hide();
5639 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5640 pShowChartBar->SetValue(g_bShowChartBar);
5641 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5643 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5644 _(
"Show Compass/GPS Status Window"));
5645 pShowCompassWin->SetValue(FALSE);
5646 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5648 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5649 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5651 pToolbarAutoHideCB =
5652 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5653 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5655 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL,
"", wxDefaultPosition,
5656 wxSize(50, -1), wxTE_RIGHT);
5657 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5659 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5660 group_item_spacing);
5662 auto enable_debug_cb =
new wxCheckBox(itemPanelFont, wxID_ANY,
5663 _(
"Enable Debug in root context menu"));
5664 enable_debug_cb->Bind(wxEVT_CHECKBOX, [enable_debug_cb](wxCommandEvent&) {
5665 g_enable_root_menu_debug = enable_debug_cb->IsChecked();
5667 enable_debug_cb->SetValue(g_enable_root_menu_debug);
5668 miscOptions->Add(enable_debug_cb, 0, wxALL, border_size);
5672 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5673 miscOptions->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5676 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5677 _(
"Enable Touchscreen interface"));
5678 miscOptions->Add(pMobile, 0, wxALL, border_size);
5680 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5681 _(
"Enable Scaled Graphics interface"));
5682 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5687 pResponsive->Hide();
5691 pResponsive->Hide();
5694 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5695 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5697 pZoomButtons->Hide();
5701 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5702 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5704 wxButton* itemEcdisHelp =
5705 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5706 wxDefaultPosition, wxDefaultSize, 0);
5707 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5710 pInlandEcdis->Hide();
5711 itemEcdisHelp->Hide();
5714 miscOptions->AddSpacer(10);
5716 wxFlexGridSizer* sliderSizer;
5717 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5718 sliderSizer->AddGrowableCol(1);
5719 sliderSizer->SetFlexibleDirection(wxBOTH);
5720 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5722 m_pSlider_GUI_Factor =
5723 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5724 m_sliderSize, SLIDER_STYLE);
5725 m_pSlider_GUI_Factor->Hide();
5726 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5727 _(
"User Interface scale factor")),
5729 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5730 m_pSlider_GUI_Factor->Show();
5733 prepareSlider(m_pSlider_GUI_Factor);
5736 m_pSlider_Chart_Factor =
5737 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5738 m_sliderSize, SLIDER_STYLE);
5739 m_pSlider_Chart_Factor->Hide();
5741 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5743 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5744 m_pSlider_Chart_Factor->Show();
5747 prepareSlider(m_pSlider_Chart_Factor);
5750 m_pSlider_Ship_Factor =
5751 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5752 m_sliderSize, SLIDER_STYLE);
5753 m_pSlider_Ship_Factor->Hide();
5755 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5757 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5758 m_pSlider_Ship_Factor->Show();
5761 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5764 m_pSlider_Text_Factor =
5765 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5766 m_sliderSize, SLIDER_STYLE);
5767 m_pSlider_Text_Factor->Hide();
5769 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5771 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5772 m_pSlider_Text_Factor->Show();
5775 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5778 m_pSlider_ENCText_Factor =
5779 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5780 m_sliderSize, SLIDER_STYLE);
5781 m_pSlider_ENCText_Factor->Hide();
5783 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5785 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5786 m_pSlider_ENCText_Factor->Show();
5789 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5792 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5793 _(
"Mouse wheel zoom sensitivity")),
5795 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5796 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5798 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5799 miscOptions->AddSpacer(20);
5802void options::OnResetFont(wxCommandEvent& event) {
5803 wxString itemElement;
5804 int i = m_itemFontElementListBox->GetSelection();
5806 itemElement = m_itemFontElementListBox->GetString(i);
5808 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5810 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5811 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5814 m_textSample->SetFont(*pFont);
5815 m_textSample->SetForegroundColour(colour);
5816 m_textSample->Refresh();
5819 top_frame::Get()->UpdateAllFonts();
5820 m_bfontChanged =
true;
5821 OnFontChoice(event);
5826void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5827 m_pCheck_AlertAudio->Enable(event.IsChecked());
5828 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5831void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5832 if (event.IsChecked()) {
5833 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5834 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5835 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5839void options::CreateListbookIcons() {
5842 if (!g_bresponsive) {
5845 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5847#if wxCHECK_VERSION(2, 8, 12)
5848 m_topImgList->Add(style->GetIcon(
"Display", sx, sy));
5849 m_topImgList->Add(style->GetIcon(
"Charts", sx, sy));
5850 m_topImgList->Add(style->GetIcon(
"Connections", sx, sy));
5851 m_topImgList->Add(style->GetIcon(
"Ship", sx, sy));
5852 m_topImgList->Add(style->GetIcon(
"UI", sx, sy));
5853 m_topImgList->Add(style->GetIcon(
"Plugins", sx, sy));
5857 bmp = style->GetIcon(
"Display");
5858 img = bmp.ConvertToImage();
5859 img.ConvertAlphaToMask(128);
5860 bmp = wxBitmap(img);
5861 m_topImgList->Add(bmp);
5862 bmp = style->GetIcon(
"Charts");
5863 img = bmp.ConvertToImage();
5864 img.ConvertAlphaToMask(128);
5865 bmp = wxBitmap(img);
5866 m_topImgList->Add(bmp);
5867 bmp = style->GetIcon(
"Connections");
5868 img = bmp.ConvertToImage();
5869 img.ConvertAlphaToMask(128);
5870 bmp = wxBitmap(img);
5871 m_topImgList->Add(bmp);
5872 bmp = style->GetIcon(
"Ship");
5873 img = bmp.ConvertToImage();
5874 img.ConvertAlphaToMask(128);
5875 bmp = wxBitmap(img);
5876 m_topImgList->Add(bmp);
5877 bmp = style->GetIcon(
"UI");
5878 img = bmp.ConvertToImage();
5879 img.ConvertAlphaToMask(128);
5880 bmp = wxBitmap(img);
5881 m_topImgList->Add(bmp);
5882 bmp = style->GetIcon(
"Plugins");
5883 img = bmp.ConvertToImage();
5884 img.ConvertAlphaToMask(128);
5885 bmp = wxBitmap(img);
5886 m_topImgList->Add(bmp);
5890 bmps = style->GetIcon(
"Display");
5891 int base_size = bmps.GetWidth();
5892 double tool_size = base_size;
5894 double premult = 1.0;
5898 double target_size = 6.0;
5900 double basic_tool_size_mm = tool_size / g_Platform->GetDisplayDPmm();
5901 premult = target_size / basic_tool_size_mm;
5904 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5905 postmult = wxMin(postmult, 3.0);
5906 postmult = wxMax(postmult, 1.0);
5908 int sizeTab = base_size * postmult * premult;
5910 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5914 bmp = style->GetIcon(
"Display");
5915 img = bmp.ConvertToImage();
5916 simg = img.Scale(sizeTab, sizeTab);
5917 bmp = wxBitmap(simg);
5918 m_topImgList->Add(bmp);
5919 bmp = style->GetIcon(
"Charts");
5920 img = bmp.ConvertToImage();
5921 simg = img.Scale(sizeTab, sizeTab);
5922 bmp = wxBitmap(simg);
5923 m_topImgList->Add(bmp);
5924 bmp = style->GetIcon(
"Connections");
5925 img = bmp.ConvertToImage();
5926 simg = img.Scale(sizeTab, sizeTab);
5927 bmp = wxBitmap(simg);
5928 m_topImgList->Add(bmp);
5929 bmp = style->GetIcon(
"Ship");
5930 img = bmp.ConvertToImage();
5931 simg = img.Scale(sizeTab, sizeTab);
5932 bmp = wxBitmap(simg);
5933 m_topImgList->Add(bmp);
5934 bmp = style->GetIcon(
"UI");
5935 img = bmp.ConvertToImage();
5936 simg = img.Scale(sizeTab, sizeTab);
5937 bmp = wxBitmap(simg);
5938 m_topImgList->Add(bmp);
5939 bmp = style->GetIcon(
"Plugins");
5940 img = bmp.ConvertToImage();
5941 simg = img.Scale(sizeTab, sizeTab);
5942 bmp = wxBitmap(simg);
5943 m_topImgList->Add(bmp);
5947void options::CreateControls() {
5948 int border_size = 4;
5950 int group_item_spacing = 2;
5952 int font_size_y, font_descent, font_lead;
5953 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
5954 m_fontHeight = font_size_y + font_descent + font_lead;
5958 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5959 m_fontHeight * 8 / 10);
5962 wxSize(wxMin(m_fontHeight * 8, g_Platform->
getDisplaySize().x / 2),
5966 m_small_button_size =
5967 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5969 m_nCharWidthMax = GetSize().x / GetCharWidth();
5972 pEnableZoomToCursor = NULL;
5973 pSmoothPanZoom = NULL;
5981 if (!g_bresponsive && height <= 800) {
5983 group_item_spacing = 1;
5987 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
5988 inputFlags = wxSizerFlags(0)
5989 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
5990 .Border(wxALL, group_item_spacing);
5991 verticleInputFlags =
5992 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
5993 groupLabelFlags = wxSizerFlags(0)
5994 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
5995 .Border(wxALL, group_item_spacing);
5996 groupLabelFlagsHoriz =
5997 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
5998 groupInputFlags = wxSizerFlags(0)
5999 .Align(wxALIGN_LEFT | wxALIGN_TOP)
6000 .Border(wxBOTTOM, group_item_spacing * 2)
6004 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
6009 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
6010 itemDialog1->SetSizer(itemBoxSizer2);
6014 wxFont* qFont = dialogFont;
6016 wxString wqs = getFontQtStylesheet(qFont);
6017 wxCharBuffer sbuf = wqs.ToUTF8();
6018 QString qsb = QString(sbuf.data());
6020 QString qsbq = getQtStyleSheet();
6022 itemDialog1->GetHandle()->setStyleSheet(qsb +
6029#ifdef OCPN_OPTIONS_USE_LISTBOOK
6031 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6032 wxSize(-1, -1), flags);
6033 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
6034 wxListbookEventHandler(options::OnPageChange), NULL,
6038 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6039 wxSize(-1, -1), flags);
6040 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6041 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
6048 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
6052 CreateListbookIcons();
6054 m_pListbook->SetImageList(m_topImgList);
6055 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
6057 m_OK_Cancel_Apply_buttons =
new wxBoxSizer(wxHORIZONTAL);
6058 itemBoxSizer2->Add(m_OK_Cancel_Apply_buttons, 0, wxALIGN_RIGHT | wxALL,
6061 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
6062 m_OKButton->SetDefault();
6063 m_OK_Cancel_Apply_buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
6066 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
6067 m_OK_Cancel_Apply_buttons->Add(m_CancelButton, 0,
6068 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6070 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
6071 m_OK_Cancel_Apply_buttons->Add(m_ApplyButton, 0,
6072 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6074 m_pageDisplay = CreatePanel(_(
"Display"));
6075 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
6076 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
6077 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
6078 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
6080 m_pageCharts = CreatePanel(_(
"Charts"));
6081 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
6082 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
6085 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
6086 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
6089 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
6091#ifdef OCPN_OPTIONS_USE_LISTBOOK
6092 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6093 wxListbookEventHandler(options::OnChartsPageChange), NULL,
6096 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6097 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
6103 wxString ConnTab = _(
"Connections");
6105 ConnTab = _(
"Connect");
6107 m_pageConnections = CreatePanel(ConnTab);
6108 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6112 m_pageShips = CreatePanel(_(
"Ships"));
6113 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
6114 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
6115 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
6117 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
6119 wxString UITab = _(
"User Interface");
6123 m_pageUI = CreatePanel(UITab);
6124 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
6125 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
6127 m_pagePlugins = CreatePanel(_(
"Plugins"));
6128 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
6130 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
6131 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
6136 SetColorScheme(
static_cast<ColorScheme
>(0));
6147 SetSizeHints(-1, -1, width - marginx, height - marginy);
6156void options::SetInitialPage(
int page_sel,
int sub_page) {
6157 if (page_sel < (
int)m_pListbook->GetPageCount())
6158 m_pListbook->SetSelection(page_sel);
6160 m_pListbook->SetSelection(0);
6162 if (sub_page >= 0) {
6163 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
6164 wxNotebookPage* pg = m_pListbook->GetPage(i);
6165 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
6167 if (i == (
size_t)page_sel) {
6168 if (sub_page < (
int)nb->GetPageCount())
6169 nb->SetSelection(sub_page);
6171 nb->SetSelection(0);
6173 nb->ChangeSelection(0);
6179void options::SetColorScheme(ColorScheme cs) {
6182#ifdef OCPN_OPTIONS_USE_LISTBOOK
6183 wxListView* lv = m_pListbook->GetListView();
6184 lv->SetBackgroundColour(GetBackgroundColour());
6187 delete m_topImgList;
6188 CreateListbookIcons();
6189 m_pListbook->SetImageList(m_topImgList);
6197 comm_dialog->SetColorScheme(cs);
6200void options::OnAISRolloverClick(wxCommandEvent& event) {
6201 m_pCheck_Rollover_Class->Enable(event.IsChecked());
6202 m_pCheck_Rollover_COG->Enable(event.IsChecked());
6203 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
6204 pStatic_CallSign->Enable(event.IsChecked());
6207void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
6209 case ID_SCREENCONFIG1:
6210 if (m_sconfigSelect_twovertical)
6211 m_sconfigSelect_twovertical->SetSelected(
false);
6215 case ID_SCREENCONFIG2:
6216 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6222void options::SetInitialSettings() {
6225 m_returnChanges = 0;
6226 m_bfontChanged =
false;
6227 m_font_element_array.Clear();
6229 b_oldhaveWMM = b_haveWMM;
6230 auto loader = PluginLoader::GetInstance();
6231 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
6234 switch (g_canvasConfig) {
6237 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
6238 if (m_sconfigSelect_twovertical)
6239 m_sconfigSelect_twovertical->SetSelected(
false);
6242 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6243 if (m_sconfigSelect_twovertical)
6244 m_sconfigSelect_twovertical->SetSelected(
true);
6247 m_screenConfig = g_canvasConfig;
6251 ActiveChartArray.Clear();
6252 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6253 ActiveChartArray.Add(m_CurrentDirList[i]);
6257 if (m_pWorkDirList) {
6258 UpdateWorkArrayFromDisplayPanel();
6259 groupsPanel->SetDBDirs(*m_pWorkDirList);
6262 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6263 delete m_pGroupArray;
6264 m_pGroupArray = groupsPanel->CloneChartGroupArray(
g_pGroupArray);
6265 groupsPanel->SetGroupArray(m_pGroupArray);
6266 groupsPanel->SetInitialSettings();
6270 pShowStatusBar->SetValue(g_bShowStatusBar);
6272 pShowMenuBar->SetValue(g_bShowMenuBar);
6274 pShowCompassWin->SetValue(g_bShowCompassWin);
6278 pCOGUPUpdateSecs->SetValue(s);
6280 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6281 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6283 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6284 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6285 pMobile->SetValue(g_btouch);
6286 pResponsive->SetValue(g_bresponsive);
6293 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6297 pInlandEcdis->SetValue(g_bInlandEcdis);
6299 pOpenGL->SetValue(g_bopengl);
6300 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6301 w->Enable(pOpenGL->IsChecked());
6304 pCBTrueShow->SetValue(g_bShowTrue);
6305 pCBMagShow->SetValue(g_bShowMag);
6307 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6311 itemStaticTextUserVar->SetLabel(
6312 _(
"WMM Plugin calculated magnetic variation"));
6314 s.Printf(
"%4.1f",
gVar);
6315 pMagVar->SetValue(s);
6317 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6319 s.Printf(
"%4.1f", g_UserVar);
6320 pMagVar->SetValue(s);
6323 int newLength = itemStaticTextUserVar->GetLabel().Length();
6326 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6327 wxSize sz = GetSize();
6328 SetSize(sz.x + 1, sz.y);
6332 itemStaticTextUserVar2->Enable(!b_haveWMM);
6333 pMagVar->Enable(!b_haveWMM);
6340 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6344 wxString stringDefaultBoatSpeed;
6345 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6346 g_defaultBoatSpeed = 6.0;
6347 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6349 stringDefaultBoatSpeed.Printf(
"%d", (
int)g_defaultBoatSpeedUserUnit);
6350 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6354 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6355 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6356 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6358 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6360 s.Printf(
"%6.2f", g_ownship_predictor_minutes);
6362 s.Printf(
"%4.0f", g_ownship_predictor_minutes);
6363 m_pText_OSCOG_Predictor->SetValue(s);
6365 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6366 g_ownship_HDTpredictor_miles) > 1e-4)
6367 s.Printf(
"%6.2f", g_ownship_HDTpredictor_miles);
6369 s.Printf(
"%4.0f", g_ownship_HDTpredictor_miles);
6370 m_pText_OSHDT_Predictor->SetValue(s);
6374 m_pTxt_OwnMMSI->SetValue(s);
6376 m_pTxt_OwnMMSI->SetValue(
"");
6378 m_pShipIconType->SetSelection(g_OwnShipIconType);
6379 wxCommandEvent eDummy;
6380 OnShipTypeSelect(eDummy);
6381 m_pOSLength->SetValue(wxString::Format(
"%.1f", g_n_ownship_length_meters));
6382 m_pOSWidth->SetValue(wxString::Format(
"%.1f", g_n_ownship_beam_meters));
6383 m_pOSGPSOffsetX->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_x));
6384 m_pOSGPSOffsetY->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_y));
6385 m_pOSMinSize->SetValue(wxString::Format(
"%d", g_n_ownship_min_mm));
6386 m_pText_ACRadius->SetValue(
6387 wxString::Format(
"%.3f", g_n_arrival_circle_radius));
6390 if (g_iNavAidRadarRingsNumberVisible > 10)
6391 g_iNavAidRadarRingsNumberVisible = 10;
6392 pNavAidRadarRingsNumberVisible->SetSelection(
6393 g_iNavAidRadarRingsNumberVisible);
6394 buf.Printf(
"%.3f", g_fNavAidRadarRingsStep);
6395 pNavAidRadarRingsStep->SetValue(buf);
6396 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6397 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6399 pScaMinChckB->SetValue(g_bUseWptScaMin);
6400 m_pText_ScaMin->SetValue(wxString::Format(
"%i", g_iWpt_ScaMin));
6401 m_pText_ScaMax->SetValue(wxString::Format(
"%i", g_iWpt_ScaMax));
6402 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6404 OnRadarringSelect(eDummy);
6406 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6407 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6408 buf.Printf(
"%.3f", g_fWaypointRangeRingsStep);
6409 pWaypointRangeRingsStep->SetValue(buf);
6410 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6412 OnWaypointRangeRingSelect(eDummy);
6413 pShowshipToActive->SetValue(g_bShowShipToActive);
6414 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6415 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6417 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6418 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6420 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6421 if (pEnableTenHertz) pEnableTenHertz->SetValue(g_btenhertz);
6423 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6424 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6426 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6428 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6431 pSDMMFormat->Select(g_iSDMMFormat);
6435 pDistanceFormat->SetSelection(distance_ui_index);
6438 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6440 if (pHeightUnitSelect) pHeightUnitSelect->SetSelection(
g_iHeightFormat);
6442 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6443 g_bAdvanceRouteWaypointOnArrivalOnly);
6454 pTrackDaily->SetValue(g_bTrackDaily);
6455 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6456 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6457 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6458 TIME_TYPE_COMPUTER);
6459 pTrackHighlite->SetValue(g_bHighliteTracks);
6460 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6461 pTrackPrecision->SetSelection(g_nTrackPrecision);
6463 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6467 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6469 s.Printf(
"%4.1f", g_CPAMax_NM);
6470 m_pText_CPA_Max->SetValue(s);
6472 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6474 s.Printf(
"%4.1f", g_CPAWarn_NM);
6475 m_pText_CPA_Warn->SetValue(s);
6477 if (m_pCheck_CPA_Warn->GetValue()) {
6478 m_pCheck_CPA_WarnT->Enable();
6479 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6481 m_pCheck_CPA_WarnT->Disable();
6483 s.Printf(
"%4.0f", g_TCPA_Max);
6484 m_pText_CPA_WarnT->SetValue(s);
6487 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6489 s.Printf(
"%4.0f", g_MarkLost_Mins);
6490 m_pText_Mark_Lost->SetValue(s);
6492 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6494 s.Printf(
"%4.0f", g_RemoveLost_Mins);
6495 m_pText_Remove_Lost->SetValue(s);
6498 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6500 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6501 m_pText_COG_Predictor->SetValue(s);
6503 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6504 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6506 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6508 s.Printf(
"%4.0f", g_AISShowTracks_Mins);
6509 m_pText_Track_Length->SetValue(s);
6511 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6513 s.Printf(
"%4.1f", g_ShowMoored_Kts);
6514 m_pText_Moored_Speed->SetValue(s);
6516 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6518 s.Printf(
"%4.1f", g_AIS_RealtPred_Kts);
6519 m_pText_RealtPred_Speed->SetValue(s);
6521 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6523 s.Printf(
"%i", g_ShowScaled_Num);
6524 m_pText_Scale_Priority->SetValue(s);
6526 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6528 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6529 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6531 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6533 s.Printf(
"%d", g_Show_Target_Name_Scale);
6534 m_pText_Show_Target_Name_Scale->SetValue(s);
6536 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6537 m_pWplAction->SetSelection(g_WplAction);
6540 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6541 if (g_bAIS_CPA_Alert) {
6542 m_pCheck_AlertAudio->Enable();
6543 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6545 m_pCheck_AlertAudio->Disable();
6546 m_pCheck_AlertAudio->SetValue(
false);
6549 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6551 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6552 s.Printf(
"%4.0f", g_AckTimeout_Mins);
6553 m_pText_ACK_Timeout->SetValue(s);
6556 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6557 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6558 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6561 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6562 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6563 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6565 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6566 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6568 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6569 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6570 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6571 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6572 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6573 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6575 if (!g_config_display_size_manual) {
6576 pRBSizeAuto->SetValue(TRUE);
6578 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6580 screenmm.RemoveLast();
6581 pScreenMM->Disable();
6584 screenmm.Append(wxString::Format(
"%zu,", mm));
6586 screenmm.RemoveLast();
6587 pRBSizeManual->SetValue(TRUE);
6590 pScreenMM->SetValue(screenmm);
6593 UpdateOptionsUnits();
6595 SetInitialVectorSettings();
6597 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6599 s.Printf(
"%d", g_nAutoHideToolbar);
6600 pToolbarHideSecs->SetValue(s);
6604 delete m_pSerialArray;
6605 m_pSerialArray = NULL;
6607 m_bForceNewToolbaronCancel =
false;
6610void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6611 if (ps57CtlListBox) {
6613 ps57CtlListBox->Clear();
6614 marinersStdXref.clear();
6616 ps57CtlListBox->Freeze();
6618 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6620 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6623 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6624 item = ps52plib->OBJLDescriptions[iPtr];
6626 item = wxString(pOLE->OBJLName, wxConvUTF8);
6632 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6633 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6634 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6636 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6637 (catl == DISPLAYBASE))
6639 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6642 bool benable =
true;
6643 if (cat > 0) benable = cat != DISPLAYBASE;
6648 int newpos = ps57CtlListBox->Append(item, benable,
false);
6649 marinersStdXref.push_back(newpos);
6650 for (
size_t i = 0; i < iPtr; i++) {
6651 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6655 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6657 if (cat == DISPLAYBASE) bviz =
true;
6660 if (cat == STANDARD) {
6665 ps57CtlListBox->Check(newpos, bviz);
6667 ps57CtlListBox->Thaw();
6670 ps57CtlListBox->RunLayout();
6673 wxSize s = ps57CtlListBox->GetSize();
6674 ps57CtlListBox->SetSize(s.x, s.y - 1);
6678void options::SetInitialVectorSettings() {
6679 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6683 m_bVectorInit =
true;
6684 resetMarStdList(
true,
false);
6687 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6691 switch (ps52plib->GetDisplayCategory()) {
6701 case (MARINERS_STANDARD):
6709 if (pDispCat) pDispCat->SetSelection(nset);
6713 bool benableMarStd =
false;
6715 for (
unsigned int i = 0; i <
g_canvasArray.GetCount(); i++) {
6718 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6719 benableMarStd =
true;
6728 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6729 itemButtonClearList->Enable(benableMarStd);
6730 itemButtonSelectList->Enable(benableMarStd);
6731 itemButtonSetStd->Enable(benableMarStd);
6734 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6735 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6736 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6737 if (pCheck_XLSECTTEXT)
6738 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6740 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6741 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6742 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6743 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6745 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6746 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6749 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6750 pPointStyle->SetSelection(0);
6752 pPointStyle->SetSelection(1);
6754 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6755 pBoundStyle->SetSelection(0);
6757 pBoundStyle->SetSelection(1);
6759 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6760 p24Color->SetSelection(0);
6762 p24Color->SetSelection(1);
6764 UpdateOptionsUnits();
6768void options::UpdateOptionsUnits() {
6769 int depthUnit = pDepthUnitSelect->GetSelection();
6771 depthUnit = wxMax(depthUnit, 0);
6772 depthUnit = wxMin(depthUnit, 2);
6778 else if (depthUnit == 2)
6784 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6785 wxString depthUnitString = depthUnitStrings[depthUnit];
6786 m_depthUnitsShal->SetLabel(depthUnitString);
6787 m_depthUnitsSafe->SetLabel(depthUnitString);
6788 m_depthUnitsDeep->SetLabel(depthUnitString);
6791 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6793 m_ShallowCtl->SetValue(s);
6795 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6797 m_SafetyCtl->SetValue(s);
6799 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6801 m_DeepCtl->SetValue(s);
6831void options::OnSizeAutoButton(wxCommandEvent& event) {
6834 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6836 screenmm.RemoveLast();
6837 pScreenMM->SetValue(screenmm);
6838 pScreenMM->Disable();
6839 g_config_display_size_manual = FALSE;
6842void options::OnSizeManualButton(wxCommandEvent& event) {
6846 screenmm.Append(wxString::Format(
"%zu,", mm));
6850 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6853 screenmm.RemoveLast();
6854 pScreenMM->SetValue(screenmm);
6855 pScreenMM->Enable();
6856 g_config_display_size_manual = TRUE;
6859void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6861void options::OnCPAWarnClick(wxCommandEvent& event) {
6862 if (m_pCheck_CPA_Warn->GetValue()) {
6863 m_pCheck_CPA_WarnT->Enable();
6865 m_pCheck_CPA_WarnT->SetValue(FALSE);
6866 m_pCheck_CPA_WarnT->Disable();
6870void options::OnSyncCogPredClick(wxCommandEvent& event) {
6871 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6872 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6873 m_pText_COG_Predictor->Disable();
6876 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6877 m_pText_COG_Predictor->SetValue(s);
6878 m_pText_COG_Predictor->Enable();
6882void options::OnShipTypeSelect(wxCommandEvent& event) {
6883 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6884 dispOptions->Layout();
6886 itemPanelShip->Layout();
6887 itemPanelShip->Refresh();
6891void options::OnRadarringSelect(wxCommandEvent& event) {
6892 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6893 dispOptions->Layout();
6895 itemPanelShip->Layout();
6896 itemPanelShip->Refresh();
6900void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6901 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6902 dispOptions->Layout();
6904 itemPanelRoutes->Layout();
6905 itemPanelRoutes->Refresh();
6909void options::OnGLClicked(wxCommandEvent& event) {
6912 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6913 w->Enable(pOpenGL->IsChecked());
6916void options::OnOpenGLOptions(wxCommandEvent& event) {
6918 OpenGLOptionsDlg dlg(
this);
6920 if (dlg.ShowModal() == wxID_OK) {
6921 if (top_frame::Get()->GetWxGlCanvas()) {
6922 g_GLOptions.m_bUseAcceleratedPanning =
6923 g_bGLexpert ? dlg.GetAcceleratedPanning()
6925 ->GetAbstractPrimaryCanvas()
6926 ->CanAccelerateGlPanning();
6929 g_bSoftwareGL = dlg.GetSoftwareGL();
6931 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6932 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6936 g_GLOptions.m_bTextureCompressionCaching =
6937 dlg.GetTextureCompressionCaching();
6938 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6941 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6945 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6947 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6949 if (top_frame::Get()->GetWxGlCanvas()) {
6950 ::wxBeginBusyCursor();
6951 top_frame::Get()->GetAbstractPrimaryCanvas()->SetupGlCompression();
6953 ::wxEndBusyCursor();
6956 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6959 if (dlg.GetRebuildCache()) {
6960 m_returnChanges = REBUILD_RASTER_CACHE;
6966void options::OnChartDirListSelect(wxCommandEvent& event) {
6968 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6969 m_removeBtn->Enable(selected);
6970 if (m_compressBtn) m_compressBtn->Enable(selected);
6974void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6977 const bool select = pDispCat->GetSelection() == 3;
6978 ps57CtlListBox->Enable(select);
6979 itemButtonClearList->Enable(select);
6980 itemButtonSelectList->Enable(select);
6981 itemButtonSetStd->Enable(select);
6987void options::OnButtonClearClick(wxCommandEvent& event) {
6988 resetMarStdList(
false,
false);
6997void options::OnButtonSelectClick(wxCommandEvent& event) {
6998 int nOBJL = ps57CtlListBox->GetCount();
6999 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
7004void options::OnButtonSetStd(wxCommandEvent& event) {
7005 resetMarStdList(
false,
true);
7010bool options::ShowToolTips() {
return TRUE; }
7012void options::OnCharHook(wxKeyEvent& event) {
7013 if (event.GetKeyCode() == WXK_RETURN &&
7014 event.GetModifiers() == wxMOD_CONTROL) {
7015 wxCommandEvent okEvent;
7016 okEvent.SetId(xID_OK);
7017 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
7018 GetEventHandler()->AddPendingEvent(okEvent);
7023void options::OnButtonaddClick(wxCommandEvent& event) {
7025 int dresult = g_Platform->DoDirSelectorDialog(
7026 this, &selDir, _(
"Add a directory containing chart files"),
7027 *pInit_Chart_Dir,
false);
7029 if (dresult != wxID_CANCEL) AddChartDir(selDir);
7034void options::AddChartDir(
const wxString& dir) {
7035 wxFileName dirname = wxFileName(dir);
7036 pInit_Chart_Dir->Empty();
7041 f.MakeRelativeTo(g_Platform->GetHomeDir());
7042 dirAdd = f.GetFullPath();
7044 pInit_Chart_Dir->Append(dirname.GetPath());
7049 cdi.fullpath = dirAdd;
7050 ActiveChartArray.Add(cdi);
7052 UpdateChartDirList();
7054 k_charts |= CHANGE_CHARTS;
7056 pScanCheckBox->Disable();
7059void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
7062 ActiveChartArray.Clear();
7063 for (
size_t i = 0; i < p.GetCount(); i++) {
7064 ActiveChartArray.Add(p[i]);
7067 UpdateChartDirList();
7070void options::UpdateWorkArrayFromDisplayPanel() {
7072 int n = ActiveChartArray.GetCount();
7073 if (m_pWorkDirList) {
7074 m_pWorkDirList->Clear();
7075 for (
int i = 0; i < n; i++) {
7076 dirname = ActiveChartArray[i].fullpath;
7077 if (!dirname.IsEmpty()) {
7080 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7081 (dirname.Last() == wxChar(_T(
'\r'))))
7082 dirname.RemoveLast();
7088 bool b_added = FALSE;
7091 int nDir = m_CurrentDirList.GetCount();
7093 for (
int i = 0; i < nDir; i++) {
7094 if (m_CurrentDirList[i].fullpath == dirname) {
7096 m_pWorkDirList->Add(cdi);
7104 cdin.fullpath = dirname;
7105 m_pWorkDirList->Add(cdin);
7112void options::OnApplyClick(wxCommandEvent& event) {
7113 ApplyChanges(event);
7118 if ((m_returnChanges & FONT_CHANGED) ||
7119 (m_returnChanges & NEED_NEW_OPTIONS)) {
7124 m_callbacks.prepare_close(
this, m_returnChanges);
7125 if (!(m_returnChanges & FONT_CHANGED_SAFE))
7126 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
true);
7130 if ((m_returnChanges & CONFIG_CHANGED)) {
7131 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
false);
7136void options::ApplyChanges(wxCommandEvent& event) {
7142 if (m_pShipIconType->GetSelection() > 0) {
7143 double n_ownship_length_meters;
7144 double n_ownship_beam_meters;
7145 double n_gps_antenna_offset_y;
7146 double n_gps_antenna_offset_x;
7147 long n_ownship_min_mm;
7148 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
7149 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
7150 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
7151 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
7152 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
7154 if (n_ownship_length_meters <= 0)
7155 msg += _(
"\n - your ship's length must be > 0");
7156 if (n_ownship_beam_meters <= 0)
7157 msg += _(
"\n - your ship's beam must be > 0");
7158 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
7160 "\n - your GPS offset from midship must be within your ship's beam");
7161 if (n_gps_antenna_offset_y < 0 ||
7162 n_gps_antenna_offset_y > n_ownship_length_meters)
7164 _(
"\n - your GPS offset from bow must be within your ship's length");
7165 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
7166 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
7167 if (!msg.IsEmpty()) {
7168 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
7169 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
7170 ::wxEndBusyCursor();
7171 event.SetInt(wxID_STOP);
7174 g_n_ownship_length_meters = n_ownship_length_meters;
7175 g_n_ownship_beam_meters = n_ownship_beam_meters;
7176 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
7177 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
7178 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
7180 g_OwnShipIconType = m_pShipIconType->GetSelection();
7181 g_bShowShipToActive = pShowshipToActive->GetValue();
7182 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
7183 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
7185 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
7186 g_n_arrival_circle_radius =
7187 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
7189 wxString* icon_name =
7190 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
7191 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
7194 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
7195 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
7197 g_bUseWptScaMin = pScaMinChckB->GetValue();
7198 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
7199 g_iWpt_ScaMax = wxAtoi(m_pText_ScaMax->GetValue());
7200 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
7203 if (m_bfontChanged) {
7205 if (top_frame::Get()->GetWxGlCanvas()) {
7206 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7209 if (top_frame::Get()->GetAbstractPrimaryCanvas()) {
7210 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7213 m_returnChanges |= FONT_CHANGED;
7217 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
7218 m_returnChanges |= FONT_CHANGED_SAFE;
7222 UpdateWorkArrayFromDisplayPanel();
7224 groupsPanel->SetDBDirs(*m_pWorkDirList);
7225 groupsPanel->m_treespopulated = FALSE;
7227 int k_force = FORCE_UPDATE;
7228 if (pUpdateCheckBox) {
7229 if (!pUpdateCheckBox->GetValue()) k_force = 0;
7230 pUpdateCheckBox->Enable();
7231 pUpdateCheckBox->SetValue(FALSE);
7236 m_returnChanges |= k_force;
7238 int k_scan = SCAN_UPDATE;
7239 if (pScanCheckBox) {
7240 if (!pScanCheckBox->GetValue()) k_scan = 0;
7241 pScanCheckBox->Enable();
7242 pScanCheckBox->SetValue(FALSE);
7247 m_returnChanges |= k_scan;
7249 pConfig->UpdateChartDirs(*m_pWorkDirList);
7253 if (groupsPanel->modified) {
7256 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
7257 m_returnChanges |= GROUPS_CHANGED;
7262 g_bShowStatusBar = pShowStatusBar->GetValue();
7265 bool bmenu_shown = g_bShowMenuBar;
7266 if (pShowMenuBar->GetValue() != bmenu_shown)
7267 m_returnChanges |= MENU_CHANGED;
7268 g_bShowMenuBar = pShowMenuBar->GetValue();
7271 g_bShowCompassWin = pShowCompassWin->GetValue();
7274 g_bShowChartBar = pShowChartBar->GetValue();
7276 wxString screenmm = pScreenMM->GetValue();
7277 wxStringTokenizer tkz(screenmm,
",");
7279 while (tkz.HasMoreTokens()) {
7280 wxString token = tkz.GetNextToken();
7282 if (token.ToLong(&mm) && mm > 0) {
7288 g_config_display_size_manual = pRBSizeManual->GetValue();
7291 comm_dialog->ApplySettings();
7293 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7297 bool temp_bquilting = pCDOQuilting->GetValue();
7300 g_bQuiltEnable = temp_bquilting;
7304 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7305 g_bskew_comp = pSkewComp->GetValue();
7306 g_btouch = pMobile->GetValue();
7307 g_bresponsive = pResponsive->GetValue();
7309 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7311 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7314 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7315 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7316 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7330 long update_val = 1;
7331 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7332 g_COGAvgSec = wxMin(
static_cast<int>(update_val), kMaxCogAverageSeconds);
7336 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7338 g_bShowTrue = pCBTrueShow->GetValue();
7339 g_bShowMag = pCBMagShow->GetValue();
7341 auto loader = PluginLoader::GetInstance();
7342 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
7343 if (!b_haveWMM && !b_oldhaveWMM) {
7344 pMagVar->GetValue().ToDouble(&g_UserVar);
7349 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7350 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7353 g_iNavAidRadarRingsNumberVisible =
7354 pNavAidRadarRingsNumberVisible->GetSelection();
7355 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7356 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7357 g_fNavAidRadarRingsStep = temp_dbl;
7358 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7359 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7360 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7361 g_fWaypointRangeRingsStep = temp_dbl;
7362 g_iWaypointRangeRingsStepUnits =
7363 m_itemWaypointRangeRingsUnits->GetSelection();
7365 m_colourWaypointRangeRingsColour->GetColour();
7370 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7372 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7374 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7376 if (pCmdSoundString) {
7377 g_CmdSoundString = pCmdSoundString->GetValue();
7378 if (wxIsEmpty(g_CmdSoundString)) {
7379 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7380 pCmdSoundString->SetValue(g_CmdSoundString);
7384 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7385 if (pSoundDeviceIndex)
7386 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7388 g_iSDMMFormat = pSDMMFormat->GetSelection();
7391 int sel = pDistanceFormat->GetSelection();
7395 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7397 if (pHeightUnitSelect)
g_iHeightFormat = pHeightUnitSelect->GetSelection();
7400 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7401 if (pSDefaultBoatSpeed)
7402 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7403 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7404 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7405 getUsrSpeedUnit() +
")");
7407 g_bAdvanceRouteWaypointOnArrivalOnly =
7408 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7410 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7411 g_colourTrackLineColour =
7412 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7413 g_colourTrackLineColour.Blue());
7414 g_nTrackPrecision = pTrackPrecision->GetSelection();
7416 g_bTrackDaily = pTrackDaily->GetValue();
7418 g_track_rotate_time = 0;
7419#if wxUSE_TIMEPICKCTRL
7421 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7422 g_track_rotate_time = h * 3600 + m * 60 + s;
7425 if (pTrackRotateUTC->GetValue())
7426 g_track_rotate_time_type = TIME_TYPE_UTC;
7427 else if (pTrackRotateLMT->GetValue())
7428 g_track_rotate_time_type = TIME_TYPE_LMT;
7430 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7432 g_bHighliteTracks = pTrackHighlite->GetValue();
7439 if (pEnableZoomToCursor)
7440 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7442 if (pEnableTenHertz) g_btenhertz = pEnableTenHertz->GetValue();
7445 g_bEnableZoomToCursor =
false;
7448 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7449 g_colourOwnshipRangeRingsColour =
7450 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7451 g_colourOwnshipRangeRingsColour.Green(),
7452 g_colourOwnshipRangeRingsColour.Blue());
7455 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7456 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7457 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7458 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7462 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7463 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7464 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7465 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7466 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7467 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7470 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7471 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7472 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7473 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7476 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7478 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7479 if (g_bSyncCogPredictors) {
7480 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7482 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7484 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7485 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7489 for (
const auto& it :
g_pAIS->GetTargetList()) {
7490 auto pAISTarget = it.second;
7491 if (NULL != pAISTarget) {
7492 pAISTarget->b_show_track = g_bAISShowTracks;
7497 if (TRACKTYPE_NEVER == props->TrackType) {
7498 pAISTarget->b_show_track =
false;
7500 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7501 pAISTarget->b_show_track =
true;
7508 std::map<int, Track*>::iterator it;
7509 it =
g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7510 if (it !=
g_pAIS->m_persistent_tracks.end())
7511 pAISTarget->b_show_track =
true;
7512 pAISTarget->b_show_track_old = g_bAISShowTracks;
7517 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7518 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7520 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7521 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7523 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7525 m_pText_Scale_Priority->GetValue().ToLong(&l);
7526 g_ShowScaled_Num = (int)l;
7528 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7529 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7530 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7531 long ais_name_scale = 5000;
7532 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7533 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7534 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7535 g_WplAction = m_pWplAction->GetSelection();
7538 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7539 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7540 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7542 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7543 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7546 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7547 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7548 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7550 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7551 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7552 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7553 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7555 bool bchange_scale =
false;
7556 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7557 bchange_scale =
true;
7558 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7561 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7562 g_MarkScaleFactorExp = g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7563 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7564 g_ShipScaleFactorExp = g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7565 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7566 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7568 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7569 g_mouse_zoom_sensitivity =
7574 if (pWayPointMan)
WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7582 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7583 g_bopengl = pOpenGL->GetValue();
7586 g_bChartBarEx = pChartBarEX->GetValue();
7589 int depthUnit = pDepthUnitSelect->GetSelection();
7593 bool bUserStdChange =
false;
7595 int nOBJL = ps57CtlListBox->GetCount();
7597 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7599 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7600 if (marinersStdXref[i] == iPtr) {
7605 assert(itemIndex >= 0);
7606 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7607 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7608 bUserStdChange =
true;
7609 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7615 ps52plib->GenerateStateHash();
7616 long stateHash = ps52plib->GetStateHash();
7618 if (m_returnChanges & GL_CHANGED) {
7621 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7623 ps52plib->ClearCNSYLUPArray();
7624 ps52plib->GenerateStateHash();
7628 enum _DisCat nset = OTHER;
7629 switch (pDispCat->GetSelection()) {
7640 nset = MARINERS_STANDARD;
7643 ps52plib->SetDisplayCategory(nset);
7646 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7647 if (pCheck_ATONTEXT)
7648 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7649 if (pCheck_LDISTEXT)
7650 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7651 if (pCheck_XLSECTTEXT)
7652 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7654 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7655 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7656 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7657 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7658 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7659 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7661 ps52plib->m_nSymbolStyle =
7662 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7664 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7666 : SYMBOLIZED_BOUNDARIES;
7667 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7668 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7670 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7671 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7679 else if (depthUnit == 2)
7682 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7683 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7685 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7689 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7690 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7692 if (m_DeepCtl->GetValue().ToDouble(&dval))
7693 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7695 ps52plib->UpdateMarinerParams();
7696 ps52plib->m_nDepthUnitDisplay = depthUnit;
7700 ps52plib->GenerateStateHash();
7703 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7704 m_returnChanges |= S52_CHANGED;
7706 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7710#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7712 wxString new_canon =
"en_US";
7713 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7715 int nLang =
sizeof(lang_list) /
sizeof(
int);
7716 for (
int it = 0; it < nLang; it++) {
7717 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7719 wxString lang_canonical = pli->CanonicalName;
7720 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7721 if (lang_sel == test_string) {
7722 new_canon = lang_canonical;
7728 wxString locale_old = g_locale;
7729 g_locale = new_canon;
7731 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7733 wxString oldStyle = g_StyleManager->GetCurrentStyle()->name;
7736 if (g_StyleManager->GetStyleNextInvocation() != oldStyle) {
7737 m_returnChanges |= STYLE_CHANGED;
7739 wxSizeEvent nullEvent;
7740 top_frame::Get()->OnSize(nullEvent);
7743 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7744 g_bInlandEcdis = pInlandEcdis->GetValue();
7745 SwitchInlandEcdisMode(g_bInlandEcdis);
7746 m_returnChanges |= TOOLBAR_CHANGED;
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 wxString longmsg = _(
"OpenCPN Chart Update");
7947 ".................................................................."
7950 m_pCBDSprog =
new wxGenericProgressDialog();
7953 m_pCBDSprog->SetFont(*qFont);
7956 m_pCBDSprog->Create(_(
"OpenCPN Chart Update"), longmsg, 100,
nullptr,
7959 DimeControl(m_pCBDSprog);
7960 m_pCBDSprog->Show();
7965 m_bTextureCacheingSave = g_GLOptions.m_bTextureCompressionCaching;
7966 g_GLOptions.m_bTextureCompressionCaching =
false;
7968 ChartData->UpdateChartDatabaseInplace(*m_pWorkDirList, force_full,
7972void options::OnButtonRebuildChartDb(wxCommandEvent& event) {
7976void options::OnButtonParseENC(wxCommandEvent& event) {
7977 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
false);
7979 extern void ParseAllENC(wxWindow * parent);
7981 ParseAllENC(g_pOptions);
7984 top_frame::Get()->ChartsRefresh();
7986 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
true);
7992static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
7995 lzma_action action = LZMA_RUN;
7999 uint8_t inbuf[BUFSIZ];
8000 uint8_t outbuf[BUFSIZ];
8013 strm->next_in = NULL;
8015 strm->next_out = outbuf;
8016 strm->avail_out =
sizeof(outbuf);
8022 if (strm->avail_in == 0 && !feof(infile)) {
8023 strm->next_in = inbuf;
8024 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
8026 if (ferror(infile)) {
8027 fprintf(stderr,
"Read error: %s\n", strerror(errno));
8035 if (feof(infile)) action = LZMA_FINISH;
8053 lzma_ret ret = lzma_code(strm, action);
8058 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
8063 size_t write_size =
sizeof(outbuf) - strm->avail_out;
8065 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
8066 fprintf(stderr,
"Write error: %s\n", strerror(errno));
8071 strm->next_out = outbuf;
8072 strm->avail_out =
sizeof(outbuf);
8077 if (ret != LZMA_OK) {
8084 if (ret == LZMA_STREAM_END)
return true;
8095 case LZMA_MEM_ERROR:
8096 msg =
"Memory allocation failed";
8099 case LZMA_DATA_ERROR:
8112 msg =
"File size limits exceeded";
8127 msg =
"Unknown error, possibly a bug";
8131 wxLogMessage(
"LZMA Encoder error: %s (error code %u)\n", msg, ret);
8138static bool CompressChart(wxString in, wxString out) {
8140 FILE* infile = fopen(in.mb_str(),
"rb");
8141 if (!infile)
return false;
8143 FILE* outfile = fopen(out.mb_str(),
"wb");
8149 lzma_stream strm = LZMA_STREAM_INIT;
8150 bool success =
false;
8151 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
8153 success = compress(&strm, infile, outfile);
8164void options::OnButtonmigrateClick(wxCommandEvent& event) {
8170 new MigrateAssistantDialog(wxTheApp->GetTopWindow(),
true);
8171 g_migrateDialog->SetSize(top_frame::Get()->GetSize());
8172 g_migrateDialog->Centre();
8173 g_migrateDialog->Raise();
8174 g_migrateDialog->ShowModal();
8178void options::OnButtonEcdisHelp(wxCommandEvent& event) {
8179 wxString testFile =
"/doc/iECDIS/index.html";
8181 if (!::wxFileExists(testFile)) {
8182 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
8185 _(
"Would you like to visit the iECDIS Manual website for more "
8188 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
8189 wxYES_NO | wxCENTER, 60)) {
8190 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
8201void options::OnButtoncompressClick(wxCommandEvent& event) {
8203 wxArrayInt pListBoxSelections;
8206 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
8207 wxLIST_STATE_SELECTED);
8208 if (item == -1)
break;
8213 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
8214This may make them incompatible with other programs or older versions of OpenCPN.\n\
8215Compressed charts may take slightly longer to load and display on some systems.\n\
8216They can be decompressed again using unxz or 7 zip programs."),
8217 _(
"OpenCPN Warning"),
8218 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
8222 wxArrayString filespecs;
8223 filespecs.Add(
"*.kap");
8224 filespecs.Add(
"*.KAP");
8225 filespecs.Add(
"*.000");
8228 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
8229 filespecs.Add(
"*.D");
8230 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
8231 filespecs.Add(
"*.Z");
8233 wxGenericProgressDialog prog1(
8234 _(
"OpenCPN Compress Charts"), wxEmptyString,
8235 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
8236 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8237 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8240 wxSize sz = prog1.GetSize();
8241 sz.x = top_frame::Get()->GetClientSize().x * 8 / 10;
8244 wxArrayString charts;
8245 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
8246 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
8247 if (dirname.IsEmpty())
continue;
8250 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
8251 (dirname.Last() == wxChar(_T(
'\r'))))
8252 dirname.RemoveLast();
8254 if (!wxDir::Exists(dirname))
continue;
8257 wxArrayString FileList;
8258 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
8259 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
8261 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
8265 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
8266 charts.Add(FileList[j]);
8270 if (charts.GetCount() == 0) {
8271 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
8276 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
8277 wxGenericProgressDialog prog(
8278 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
8279 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8280 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8284 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
8286 prog.Update(i, charts[i], &skip);
8289 wxString compchart = charts[i] +
".xz";
8290 if (CompressChart(charts[i], compchart)) {
8291 total_size += wxFileName::GetSize(charts[i]).ToULong();
8292 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
8293 wxRemoveFile(charts[i]);
8299 double total_size_mb = total_size / 1024.0 / 1024.0;
8300 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
8303 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
8305 count, total_size_mb, total_compressed_size_mb,
8306 total_size_mb - total_compressed_size_mb,
8307 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
8310 UpdateWorkArrayFromTextCtl();
8312 if (m_pWorkDirList) {
8313 pActiveChartsList->DeleteAllItems();
8314 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
8315 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
8318 li.SetAlign(wxLIST_FORMAT_LEFT);
8319 li.SetText(dirname);
8321 long idx = pActiveChartsList->InsertItem(li);
8325 k_charts |= CHANGE_CHARTS;
8327 pScanCheckBox->Disable();
8333void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
8335void options::OnCancelClick(wxCommandEvent& event) {
8336 m_pListbook->ChangeSelection(0);
8337 comm_dialog->CancelSettings();
8339 lastWindowPos = GetPosition();
8340 lastWindowSize = GetSize();
8342 pConfig->SetPath(
"/Settings");
8343 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8344 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8347 androidEnableBackButton(
true);
8348 androidEnableRotation();
8349 androidEnableOptionItems(
true);
8352 top_frame::Get()->ThawCharts();
8354 top_frame::Get()->EnableSettingsTool(
true);
8357void options::OnClose(wxCloseEvent& event) {
8358 m_pListbook->ChangeSelection(0);
8360 lastWindowPos = GetPosition();
8361 lastWindowSize = GetSize();
8363 pConfig->SetPath(
"/Settings");
8364 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8365 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8367 m_callbacks.prepare_close(
this, m_returnChanges);
8371void options::OnFontChoice(wxCommandEvent& event) {
8372 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8373 m_font_element_array.Add(sel_text_element);
8375 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8376 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8378 m_textSample->SetFont(*pif);
8379 m_textSample->SetForegroundColour(init_color);
8380 m_itemBoxSizerFontPanel->Layout();
8384void options::OnChooseFont(wxCommandEvent& event) {
8386 androidDisableRotation();
8389 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8390 m_font_element_array.Add(sel_text_element);
8391 wxFontData font_data;
8393 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8394 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8396 wxFontData init_font_data;
8397 if (pif) init_font_data.SetInitialFont(*pif);
8398 init_font_data.SetColour(init_color);
8403 wxFont* qFont = dialogFont;
8406 int retval = dg.ShowModal();
8407 if (wxID_CANCEL != retval) {
8408 font_data = dg.GetFontData();
8409 wxFont font = font_data.GetChosenFont();
8410 wxFont* psfont =
new wxFont(font);
8411 wxColor color = font_data.GetColour();
8412 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8413 top_frame::Get()->UpdateAllFonts();
8414 m_bfontChanged =
true;
8415 OnFontChoice(event);
8421 wxFontDialog dg(
this, init_font_data);
8423 wxFontDialog dg(pParent, init_font_data);
8426 wxFont* qFont = dialogFont;
8433 wxSize proposed_size = GetSize();
8435 float font_size = dialogFont->GetPointSize();
8437 if ((proposed_size.y / font_size) < n_lines) {
8438 float new_font_size = proposed_size.y / n_lines;
8439 wxFont* smallFont =
new wxFont(*dialogFont);
8440 smallFont->SetPointSize(new_font_size);
8441 dg.SetFont(*smallFont);
8445 if (g_bresponsive) {
8446 dg.SetSize(GetSize());
8450 int retval = dg.ShowModal();
8451 if (wxID_CANCEL != retval) {
8452 font_data = dg.GetFontData();
8453 wxFont font = font_data.GetChosenFont();
8454 wxFont* psfont =
new wxFont(font);
8455 wxColor color = font_data.GetColour();
8456 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8457 top_frame::Get()->UpdateAllFonts();
8458 m_bfontChanged =
true;
8459 OnFontChoice(event);
8464 androidEnableRotation();
8470#if defined(__WXGTK__) || defined(__WXQT__)
8471void options::OnChooseFontColor(wxCommandEvent& event) {
8472 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8473 m_font_element_array.Add(sel_text_element);
8475 wxColourData colour_data;
8477 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8478 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8481 androidDisableRotation();
8483 unsigned int cco = 0;
8486 cco |= init_color.Red();
8488 cco |= init_color.Green();
8490 cco |= init_color.Blue();
8491 unsigned int cc = androidColorPicker(cco);
8494 unsigned char blue = (
unsigned char)cc % 256;
8495 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8497 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8498 cn.Set(red, green, blue);
8500 FontMgr::Get().
SetFont(sel_text_element, pif, cn);
8502 top_frame::Get()->UpdateAllFonts();
8503 m_bfontChanged =
true;
8505 androidEnableRotation();
8507 wxScrolledWindow* sw =
8508 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8510 wxColourData init_colour_data;
8511 init_colour_data.SetColour(init_color);
8513 wxColourDialog dg(sw, &init_colour_data);
8515 int retval = dg.ShowModal();
8516 if (wxID_CANCEL != retval) {
8517 colour_data = dg.GetColourData();
8519 wxColor color = colour_data.GetColour();
8520 FontMgr::Get().
SetFont(sel_text_element, pif, color);
8522 top_frame::Get()->UpdateAllFonts();
8523 m_bfontChanged =
true;
8524 OnFontChoice(event);
8533void options::OnChartsPageChange(wxListbookEvent& event) {
8534 unsigned int i =
event.GetSelection();
8536 UpdateChartDirList();
8541 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8545 UpdateWorkArrayFromDisplayPanel();
8546 groupsPanel->SetDBDirs(*m_pWorkDirList);
8547 groupsPanel->m_treespopulated = FALSE;
8549 if (!groupsPanel->m_settingscomplete) {
8550 ::wxBeginBusyCursor();
8551 groupsPanel->CompleteInitialSettings();
8552 ::wxEndBusyCursor();
8553 }
else if (!groupsPanel->m_treespopulated) {
8554 groupsPanel->PopulateTrees();
8555 groupsPanel->m_treespopulated = TRUE;
8557 }
else if (1 == i) {
8559 if (!m_bVectorInit) {
8560 SetInitialVectorSettings();
8561 UpdateOptionsUnits();
8568void options::OnPageChange(wxListbookEvent& event) {
8569 DoOnPageChange(event.GetSelection());
8572void options::OnSubNBPageChange(wxNotebookEvent& event) {
8575 if (event.GetEventObject()) {
8576 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8577 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8578 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8579 if (
dynamic_cast<wxNotebook*
>(parent)) {
8580 lastSubPage =
event.GetSelection();
8583 if (
dynamic_cast<wxListbook*
>(parent)) {
8584 lastSubPage =
event.GetSelection();
8591void options::OnTopNBPageChange(wxNotebookEvent& event) {
8592 DoOnPageChange(event.GetSelection());
8595void options::DoOnPageChange(
size_t page) {
8596 unsigned int i = page;
8599 if (page > 10)
return;
8607 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8608 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8614 k_charts = VISIT_CHARTS;
8615 UpdateChartDirList();
8618 else if (m_pageConnections == i) {
8620 wxWindow* w = m_pListbook->GetCurrentPage();
8621 comm_dialog->OnResize(w ? w->GetClientSize() : wxSize());
8624 else if (m_pageUI == i) {
8625 if (!m_itemLangListBox)
return;
8626#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8628 if (!m_bVisitLang) {
8629 ::wxBeginBusyCursor();
8631 int current_language = plocale_def_lang->GetLanguage();
8632 wxString current_sel = wxLocale::GetLanguageName(current_language);
8634 current_sel = GetOCPNKnownLanguage(g_locale);
8636 int nLang =
sizeof(lang_list) /
sizeof(
int);
8639 m_itemLangListBox->Append(
"English (U.S.)");
8641 wxString lang_dir = g_Platform->GetSharedDataDir() +
"share/locale/";
8642 for (
int it = 1; it < nLang; it++) {
8643 if (wxLocale::IsAvailable(lang_list[it])) {
8644 wxLocale ltest(lang_list[it], 0);
8645 ltest.AddCatalog(
"opencpn");
8646 if (!ltest.IsLoaded(
"opencpn"))
continue;
8649 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8650 wxString widgets_lang_name = loc_lang_name;
8651 wxString lang_canonical =
8652 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8655 wxString lang_suffix;
8656 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8659 wxString test_dir = lang_dir + lang_suffix;
8660 if (!wxDir::Exists(test_dir))
continue;
8662 m_itemLangListBox->Append(loc_lang_name);
8666 wxArrayString lang_array;
8669 lang_array.Add(
"en_US");
8670 for (
int it = 0; it < nLang; it++) {
8672 wxLog::EnableLogging(
8675 wxLocale ltest(lang_list[it], 0);
8676#if wxCHECK_VERSION(2, 9, 0)
8678 ltest.AddCatalogLookupPathPrefix(
8679 wxStandardPaths::Get().GetInstallPrefix() +
"/share/locale");
8682 ltest.AddCatalog(
"opencpn");
8684 wxLog::EnableLogging(TRUE);
8685 if (ltest.IsLoaded(
"opencpn")) {
8686 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8689 s0 = x->CanonicalName;
8692 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8693 if (wxNOT_FOUND == lang_array.Index(s0)) {
8700 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8702 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8703 m_itemLangListBox->Append(loc_lang_name);
8719 delete plocale_def_lang;
8720 plocale_def_lang =
new wxLocale(current_language);
8722 setlocale(LC_NUMERIC,
"C");
8723 plocale_def_lang->AddCatalog(
"opencpn");
8725 m_itemLangListBox->SetStringSelection(current_sel);
8728 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8730 wxString clang = pli->Description;
8734 m_bVisitLang = TRUE;
8736 ::wxEndBusyCursor();
8739 }
else if (m_pagePlugins == i) {
8740 m_bVisitPlugins = TRUE;
8741 top_frame::Get()->FreezeCharts();
8745 auto loader = PluginLoader::GetInstance();
8746 if (LoadAllPlugIns(
false)) {
8747 delete m_pPlugInCtrl;
8748 m_pPlugInCtrl = NULL;
8749 delete m_PluginCatalogMgrPanel;
8750 m_PluginCatalogMgrPanel = NULL;
8751 itemBoxSizerPanelPlugins->Clear();
8754 if (!m_pPlugInCtrl) {
8756 ::wxBeginBusyCursor();
8759 wxDefaultPosition, wxDefaultSize);
8760 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8761 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8762 wxEXPAND | wxGROW | wxALL, 4);
8766 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8768 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8769 wxEXPAND | wxALL, 4);
8770 itemBoxSizerPanelPlugins->Layout();
8773 m_pPlugInCtrl->UpdateSelections();
8775 ::wxEndBusyCursor();
8777 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8780 k_plugins = TOOLBAR_CHANGED;
8782 k_plugins |= FORCE_RELOAD;
8786wxString options::SelectSoundFile() {
8787 wxString sound_dir = g_Platform->GetSharedDataDir();
8788 sound_dir.Append(
"sounds");
8793 wxFileDialog* popenDialog =
new wxFileDialog(
8794 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8795 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
8797 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
8799 response = popenDialog->ShowModal();
8800 sel_file = popenDialog->GetPath();
8804 response = g_Platform->DoFileSelectorDialog(
8805 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
8808 if (response == wxID_OK)
8809 return g_Platform->NormalizePath(sel_file);
8814void options::OnButtonSelectSound(wxCommandEvent& event) {
8815 wxString sel_file = SelectSoundFile();
8817 if (!sel_file.IsEmpty()) {
8818 g_sAIS_Alert_Sound_File = g_Platform->NormalizePath(sel_file);
8822void options::OnButtonTestSound(wxCommandEvent& event) {
8823 auto sound = o_sound::Factory();
8824 auto cmd_sound =
dynamic_cast<o_sound::SystemCmdSound*
>(sound);
8825 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8827 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8831wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8832 wxString return_string;
8833 wxString dir_suffix;
8835#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8837 if (lang_canonical ==
"en_US") {
8839 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8841 }
else if ((lang_canonical ==
"cs_CZ") || (lang_canonical ==
"cs")) {
8843 return_string = wxString(
"Čeština", wxConvUTF8);
8845 }
else if ((lang_canonical ==
"da_DK") || (lang_canonical ==
"da")) {
8847 return_string = wxString(
"Dansk", wxConvUTF8);
8849 }
else if ((lang_canonical ==
"de_DE") || (lang_canonical ==
"de")) {
8851 return_string = wxString(
"Deutsch", wxConvUTF8);
8853 }
else if ((lang_canonical ==
"et_EE") || (lang_canonical ==
"et")) {
8855 return_string = wxString(
"Eesti", wxConvUTF8);
8857 }
else if ((lang_canonical ==
"es_ES") || (lang_canonical ==
"es")) {
8859 return_string = wxString(
"Español", wxConvUTF8);
8861 }
else if ((lang_canonical ==
"fr_FR") || (lang_canonical ==
"fr")) {
8863 return_string = wxString(
"Français", wxConvUTF8);
8865 }
else if ((lang_canonical ==
"it_IT") || (lang_canonical ==
"it")) {
8867 return_string = wxString(
"Italiano", wxConvUTF8);
8869 }
else if ((lang_canonical ==
"nl_NL") || (lang_canonical ==
"nl")) {
8871 return_string = wxString(
"Nederlands", wxConvUTF8);
8873 }
else if ((lang_canonical ==
"pl_PL") || (lang_canonical ==
"pl")) {
8875 return_string = wxString(
"Polski", wxConvUTF8);
8877 }
else if ((lang_canonical ==
"pt_PT") || (lang_canonical ==
"pt")) {
8878 dir_suffix =
"pt_PT";
8879 return_string = wxString(
"Português", wxConvUTF8);
8881 }
else if ((lang_canonical ==
"pt_BR") || (lang_canonical ==
"pt_BR")) {
8882 dir_suffix =
"pt_BR";
8883 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8885 }
else if ((lang_canonical ==
"ru_RU") || (lang_canonical ==
"ru")) {
8887 return_string = wxString(
"Русский", wxConvUTF8);
8889 }
else if ((lang_canonical ==
"sv_SE") || (lang_canonical ==
"sv")) {
8891 return_string = wxString(
"Svenska", wxConvUTF8);
8893 }
else if ((lang_canonical ==
"fi_FI") || (lang_canonical ==
"fi")) {
8894 dir_suffix =
"fi_FI";
8895 return_string = wxString(
"Suomi", wxConvUTF8);
8897 }
else if ((lang_canonical ==
"nb_NO") || (lang_canonical ==
"nb")) {
8898 dir_suffix =
"nb_NO";
8899 return_string = wxString(
"Norsk", wxConvUTF8);
8901 }
else if ((lang_canonical ==
"tr_TR") || (lang_canonical ==
"tr")) {
8902 dir_suffix =
"tr_TR";
8903 return_string = wxString(
"Türkçe", wxConvUTF8);
8905 }
else if ((lang_canonical ==
"el_GR") || (lang_canonical ==
"el")) {
8906 dir_suffix =
"el_GR";
8907 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8909 }
else if ((lang_canonical ==
"hu_HU") || (lang_canonical ==
"hu")) {
8910 dir_suffix =
"hu_HU";
8911 return_string = wxString(
"Magyar", wxConvUTF8);
8913 }
else if ((lang_canonical ==
"zh_TW") || (lang_canonical ==
"zh_TW")) {
8914 dir_suffix =
"zh_TW";
8915 return_string = wxString(
"正體字", wxConvUTF8);
8917 }
else if ((lang_canonical ==
"zh_CN") || (lang_canonical ==
"zh_CN")) {
8918 dir_suffix =
"zh_CN";
8919 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8921 }
else if ((lang_canonical ==
"ca_ES") || (lang_canonical ==
"ca")) {
8922 dir_suffix =
"ca_ES";
8923 return_string = wxString(
"Catalan", wxConvUTF8);
8925 }
else if ((lang_canonical ==
"gl_ES") || (lang_canonical ==
"gl_ES")) {
8926 dir_suffix =
"gl_ES";
8927 return_string = wxString(
"Galician", wxConvUTF8);
8929 }
else if ((lang_canonical ==
"ja_JP") || (lang_canonical ==
"ja_JP")) {
8930 dir_suffix =
"ja_JP";
8931 return_string = wxString(
"Japanese", wxConvUTF8);
8933 }
else if ((lang_canonical ==
"vi_VN") || (lang_canonical ==
"vi_VN")) {
8934 dir_suffix =
"vi_VN";
8935 return_string = wxString(
"Vietnamese", wxConvUTF8);
8938 dir_suffix = lang_canonical;
8939 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8941 return_string = info->Description;
8943 return_string = lang_canonical;
8946 lang_dir = dir_suffix;
8948 return return_string;
8951wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8953 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8956ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8957 ChartGroupArray* d =
new ChartGroupArray;
8958 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8961 pdg->m_group_name = psg->m_group_name;
8962 pdg->m_element_array.reserve(psg->m_element_array.size());
8964 for (
auto& elem : psg->m_element_array)
8965 pdg->m_element_array.push_back(elem);
8972void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8982EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8983EVT_NOTEBOOK_PAGE_CHANGED(
8985 ChartGroupsUI::OnGroupPageChange)
8989 m_GroupSelectedPage = -1;
8990 m_pActiveChartsTree = 0;
8992 lastSelectedCtl = NULL;
8993 allAvailableCtl = NULL;
8994 defaultAllCtl = NULL;
8996 m_pAddButton = NULL;
8997 m_pRemoveButton = NULL;
8998 m_pDeleteGroupButton = NULL;
8999 m_pNewGroupButton = NULL;
9000 m_pGroupArray = NULL;
9003 m_UIcomplete =
false;
9004 m_treespopulated =
false;
9008ChartGroupsUI::~ChartGroupsUI() {
9009 m_DirCtrlArray.Clear();
9010 m_GroupNB->Disconnect(
9011 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
9012 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
9017void ChartGroupsUI::SetInitialSettings() {
9018 m_settingscomplete = FALSE;
9019 m_treespopulated = FALSE;
9022void ChartGroupsUI::PopulateTrees() {
9025 wxArrayString dir_array;
9026 int nDir = m_db_dirs.GetCount();
9027 for (
int i = 0; i < nDir; i++) {
9028 wxString dirname = m_db_dirs[i].fullpath;
9029 if (!dirname.IsEmpty()) dir_array.Add(dirname);
9032 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array,
9033 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
9035 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
9039 wxArrayString dir_array0;
9040 int nDir0 = m_db_dirs.GetCount();
9041 for (
int i = 0; i < nDir0; i++) {
9042 wxString dirname = m_db_dirs[i].fullpath;
9043 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
9045 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
9046 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
9049void ChartGroupsUI::CompleteInitialSettings() {
9052 BuildNotebookPages(m_pGroupArray);
9054 m_panel->GetSizer()->Layout();
9056 m_settingscomplete = TRUE;
9057 m_treespopulated = TRUE;
9060void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
9061 const wxArrayString& dir_array,
9062 const wxColour& col, wxFont* pFont) {
9063 ptc->DeleteAllItems();
9065 wxDirItemData* rootData =
new wxDirItemData(
"Dummy",
"Dummy", TRUE);
9068 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
9069 ptc->SetItemHasChildren(m_rootId);
9072 int nDir = dir_array.GetCount();
9073 for (
int i = 0; i < nDir; i++) {
9074 wxString dirname = dir_array[i];
9075 if (!dirname.IsEmpty()) {
9076 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
9077 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
9080 ptc->SetItemText(
id, dirname);
9081 if (pFont) ptc->SetItemFont(
id, *pFont);
9085 ptc->SetItemTextColour(
id, col);
9087 ptc->SetItemHasChildren(
id);
9092void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
9093 wxString insert_candidate = allAvailableCtl->GetPath();
9094 if (!insert_candidate.IsEmpty()) {
9095 if (m_DirCtrlArray.GetCount()) {
9096 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9097 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9099 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9101 if (ptree->IsEmpty()) {
9102 wxDirItemData* rootData =
9103 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9104 wxString rootName =
"Dummy";
9105 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9107 ptree->SetItemHasChildren(rootId);
9110 wxTreeItemId root_Id = ptree->GetRootItem();
9111 wxDirItemData* dir_item =
9112 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
9114 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
9115 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
9118 pGroup->m_element_array.push_back({insert_candidate});
9123 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9124 m_pAddButton->Disable();
9126 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9128 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9129 if (ptree) ptree->Refresh();
9133void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
9134 if (m_DirCtrlArray.GetCount()) {
9135 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9136 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9139 wxString sel_item = pDirCtrl->GetPath();
9141 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9142 if (ptree && ptree->GetCount()) {
9143 wxTreeItemId
id = ptree->GetSelection();
9144 lastDeletedItem = id;
9146 wxString branch_adder;
9147 int group_item_index =
9148 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
9149 if (group_item_index >= 0) {
9151 pGroup->m_element_array[group_item_index];
9152 bool b_duplicate = FALSE;
9153 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
9155 if (pelement.m_missing_name_array[k] == sel_item) {
9161 pelement.m_missing_name_array.Add(sel_item);
9167 if (branch_adder ==
"") {
9169 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
9172 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
9178 lastSelectedCtl->Unselect();
9179 lastSelectedCtl = 0;
9180 m_pRemoveButton->Disable();
9182 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9184 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9185 if (ptree) ptree->Refresh();
9193void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
9194 m_GroupSelectedPage =
event.GetSelection();
9195 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9196 if (lastSelectedCtl) {
9197 lastSelectedCtl->UnselectAll();
9198 lastSelectedCtl = 0;
9200 m_pRemoveButton->Disable();
9201 m_pAddButton->Disable();
9204 if (m_GroupSelectedPage == 0) {
9205 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
9207 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
9211void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
9212 wxObject* evtObj =
event.GetEventObject();
9213 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
9214 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
9215 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9216 m_pAddButton->Enable();
9218 m_pAddButton->Disable();
9221 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
9222 if (!lastSelectedCtl)
goto out;
9223 wxTreeItemId item = lastSelectedCtl->GetSelection();
9224 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9227 wxGenericDirCtrl* dirCtrl =
9228 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
9229 if (!dirCtrl)
goto out;
9230 wxString itemPath = dirCtrl->GetPath();
9231 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
9233 m_pRemoveButton->Disable();
9241void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
9242 wxTextEntryDialog* pd =
new wxTextEntryDialog();
9244 pd->SetFont(*qFont);
9246 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
9249 androidDisableRotation();
9252 if (pd->ShowModal() == wxID_OK) {
9253 if (pd->GetValue().Length()) {
9254 AddEmptyGroupPage(pd->GetValue());
9256 pGroup->m_group_name = pd->GetValue();
9257 m_pGroupArray->Add(pGroup);
9259 m_GroupSelectedPage =
9260 m_GroupNB->GetPageCount() - 1;
9261 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
9262 m_pDeleteGroupButton->Enable();
9269 androidEnableRotation();
9273void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
9274 if (0 != m_GroupSelectedPage) {
9275 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
9276 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
9277 m_GroupNB->DeletePage(m_GroupSelectedPage);
9280 if (m_GroupSelectedPage <= 0) {
9281 m_pAddButton->Disable();
9282 m_pDeleteGroupButton->Disable();
9286int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
9287 wxTreeItemId item, wxString* pbranch_adder) {
9288 wxString branch_name;
9289 wxString branch_adder;
9291 wxTreeItemId current_node = item;
9292 while (current_node.IsOk()) {
9293 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
9294 if (!parent_node)
break;
9296 if (parent_node == ptree->GetRootItem()) {
9297 branch_name = ptree->GetItemText(current_node);
9301 branch_adder.Prepend(ptree->GetItemText(current_node));
9302 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
9304 current_node = ptree->GetItemParent(current_node);
9308 unsigned int target_item_index = -1;
9310 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
9311 const wxString& target = pGroup->m_element_array[i].m_element_name;
9312 if (branch_name == target) {
9313 target_item_index = i;
9318 if (pbranch_adder) *pbranch_adder = branch_adder;
9320 return target_item_index;
9323void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
9324 wxTreeItemId node =
event.GetItem();
9326 if (m_GroupSelectedPage <= 0)
return;
9327 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9328 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9329 if (!pDirCtrl)
return;
9331 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9332 wxString branch_adder;
9333 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
9334 if (target_item_index < 0)
return;
9336 pGroup->m_element_array[target_item_index];
9337 const wxString& branch_name = target_element.m_element_name;
9341 if (!target_element.m_missing_name_array.GetCount())
return;
9342 wxString full_root = branch_name;
9343 full_root += branch_adder;
9344 full_root += wxString(wxFILE_SEP_PATH);
9346 wxTreeItemIdValue cookie;
9347 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
9348 while (child.IsOk()) {
9349 wxString target_string = full_root;
9350 target_string += ptree->GetItemText(child);
9352 for (
unsigned int k = 0; k < target_element.m_missing_name_array.GetCount();
9354 if (target_element.m_missing_name_array[k] == target_string) {
9355 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
9359 child = ptree->GetNextChild(node, cookie);
9363void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
9366 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
9368 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
9371 int nItems = pGroup->m_element_array.size();
9372 for (
int i = 0; i < nItems; i++) {
9373 const wxString& itemname = pGroup->m_element_array[i].m_element_name;
9374 if (!itemname.IsEmpty()) {
9375 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
9377 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
9379 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
9385wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
9386 wxGenericDirCtrl* GroupDirCtl =
9387 new wxGenericDirCtrl(m_GroupNB, wxID_ANY,
"TESTDIR");
9388 m_GroupNB->AddPage(GroupDirCtl, label);
9390 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
9391 ptree->DeleteAllItems();
9393 wxDirItemData* rootData =
9394 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9395 wxString rootName =
"Dummy";
9396 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9397 ptree->SetItemHasChildren(rootId);
9399 m_DirCtrlArray.Add(GroupDirCtl);
9404void ChartGroupsUI::ClearGroupPages() {
9405 if (m_GroupNB->GetPageCount() == 0)
return;
9407 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
9408 m_DirCtrlArray.RemoveAt(i);
9409 m_GroupNB->DeletePage(i);
9413void options::OnInsertTideDataLocation(wxCommandEvent& event) {
9415 int response = wxID_CANCEL;
9418 wxFileDialog* popenDialog =
new wxFileDialog(
9419 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
9420 "Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All "
9424 popenDialog = g_Platform->AdjustFileDialogFont(
this, popenDialog);
9426 response = popenDialog->ShowModal();
9427 sel_file = popenDialog->GetPath();
9432 response = g_Platform->DoFileSelectorDialog(
9433 this, &path, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
"*.*");
9437 if (response == wxID_OK) {
9439 int id = tcDataSelected->GetItemCount();
9441 long idx = tcDataSelected->InsertItem(li);
9442 tcDataSelected->SetItem(
id, 0, g_Platform->NormalizePath(sel_file));
9445 wxFileName fn(sel_file);
9446 wxString data_dir = fn.GetPath();
9447 g_TCData_Dir = g_Platform->NormalizePath(data_dir);
9451void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9454 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9455 wxLIST_STATE_SELECTED);
9456 if (item == -1)
break;
9457 tcDataSelected->DeleteItem(item);
9463enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9466BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9467EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9468EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9471OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9472 : wxDialog(parent, wxID_ANY, "OpenGL Options", wxDefaultPosition,
9474 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9479 m_brebuild_cache(FALSE) {
9482 SetFont(*dialogFont);
9484 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9485 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9487 m_cbTextureCompression =
9488 new wxCheckBox(
this, wxID_ANY,
9489 g_bGLexpert ? _(
"Texture Compression")
9490 : _(
"Texture Compression with Caching"));
9491 m_cbTextureCompressionCaching =
9492 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9494 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9495 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9496 m_sTextureMemorySize->SetRange(1, 16384);
9498 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9499 wxButton* btnRebuild =
9500 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9501 wxButton* btnClear =
9502 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9503 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9505 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9506 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9507 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9509 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9510 m_cbUseAcceleratedPanning =
9511 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9513 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9514 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9515 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9516 flexSizer->AddSpacer(0);
9517 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9518 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9519 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9520 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9521 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9522 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9523 flexSizer->AddSpacer(0);
9524 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9525 flexSizer->AddSpacer(0);
9526 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9527 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9528 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9529 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9530 flexSizer->AddSpacer(0);
9531 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9532 flexSizer->AddSpacer(0);
9533 flexSizer->AddSpacer(0);
9534 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9535 flexSizer->AddSpacer(0);
9536 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9537 flexSizer->AddGrowableCol(1);
9538 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9540 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9541 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9542 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9543 btnSizer->Realize();
9545 mainSizer->AddStretchSpacer();
9546 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9550 SetSizer(mainSizer);
9551 mainSizer->SetSizeHints(
this);
9555bool OpenGLOptionsDlg::GetAcceleratedPanning()
const {
9556 return m_cbUseAcceleratedPanning->GetValue();
9559bool OpenGLOptionsDlg::GetTextureCompression()
const {
9560 return m_cbTextureCompression->GetValue();
9563bool OpenGLOptionsDlg::GetPolygonSmoothing()
const {
9564 return m_cbPolygonSmoothing->GetValue();
9567bool OpenGLOptionsDlg::GetLineSmoothing()
const {
9568 return m_cbLineSmoothing->GetValue();
9571bool OpenGLOptionsDlg::GetSoftwareGL()
const {
9572 return m_cbSoftwareGL->GetValue();
9575bool OpenGLOptionsDlg::GetTextureCompressionCaching()
const {
9576 return m_cbTextureCompressionCaching->GetValue();
9579bool OpenGLOptionsDlg::GetRebuildCache()
const {
return m_brebuild_cache; }
9581int OpenGLOptionsDlg::GetTextureMemorySize()
const {
9582 return m_sTextureMemorySize->GetValue();
9585void OpenGLOptionsDlg::Populate() {
9586 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9594 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9595 m_memorySize->Show(g_bGLexpert);
9596 m_sTextureMemorySize->Show(g_bGLexpert);
9598 m_cbTextureCompressionCaching->SetValue(
9599 g_GLOptions.m_bTextureCompressionCaching);
9600 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9602 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9603 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9605#if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9606 if (top_frame::Get()->GetWxGlCanvas()) {
9607 if (top_frame::Get()->GetGlVersionString().Upper().Find(
"MESA") !=
9609 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9612 m_cbSoftwareGL->Hide();
9616 SetFont(*dialogFont);
9619 if (top_frame::Get()->GetWxGlCanvas()) {
9620 if (top_frame::Get()
9621 ->GetAbstractPrimaryCanvas()
9622 ->CanAccelerateGlPanning()) {
9623 m_cbUseAcceleratedPanning->Enable();
9624 m_cbUseAcceleratedPanning->SetValue(
9625 g_GLOptions.m_bUseAcceleratedPanning);
9627 m_cbUseAcceleratedPanning->SetValue(FALSE);
9628 m_cbUseAcceleratedPanning->Disable();
9631 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9634 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9635 m_cbUseAcceleratedPanning->Disable();
9639void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9640 if (g_GLOptions.m_bTextureCompressionCaching) {
9641 m_brebuild_cache = TRUE;
9642 EndModal(wxID_CANCEL);
9646void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9648 ::wxBeginBusyCursor();
9652 appendOSDirSlash(&path);
9653 path.append(
"raster_texture_cache");
9655 if (::wxDirExists(path)) {
9656 wxArrayString files;
9657 size_t nfiles = wxDir::GetAllFiles(path, &files);
9658 for (
unsigned int i = 0; i < files.GetCount(); i++)
9659 ::wxRemoveFile(files[i]);
9662 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9663 ::wxEndBusyCursor();
9667wxString OpenGLOptionsDlg::GetTextureCacheSize() {
9669 appendOSDirSlash(&path);
9670 path.append(
"raster_texture_cache");
9671 long long total = 0;
9673 if (::wxDirExists(path)) {
9674 wxArrayString files;
9675 size_t nfiles = wxDir::GetAllFiles(path, &files);
9676 for (
unsigned int i = 0; i < files.GetCount(); i++)
9677 total += wxFile(files[i]).Length();
9679 double mb = total / (1024.0 * 1024.0);
9680 if (mb < 10000.0)
return wxString::Format(
"%.1f MB", mb);
9682 return wxString::Format(
"%.1f GB", mb);
9690EVT_PAINT(CanvasConfigSelect::OnPaint)
9694 wxWindowID
id, wxBitmap& bmp,
9695 const wxPoint& pos, const wxSize& size)
9696 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9697 m_parentOptions = parentOptions;
9702 int refHeight = GetCharHeight();
9704 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9705 bmp.GetSize().y + m_borderWidth * 2));
9707 Connect(wxEVT_LEFT_DOWN,
9708 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9711CanvasConfigSelect::~CanvasConfigSelect() {}
9713void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9719 if (m_parentOptions)
9720 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9723void CanvasConfigSelect::SetSelected(
bool selected) {
9724 m_bSelected = selected;
9728 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9731 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9737void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9739 GetSize(&width, &height);
9742 dc.SetBackground(*wxLIGHT_GREY);
9744 dc.SetPen(*wxTRANSPARENT_PEN);
9745 dc.SetBrush(wxBrush(GetBackgroundColour()));
9746 dc.DrawRectangle(GetVirtualSize());
9749 dc.SetBrush(wxBrush(m_boxColour));
9751 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9753 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9755 dc.SetBrush(wxBrush(m_boxColour));
9757 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9759 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9762 dc.DrawBitmap(m_bmpNormal, m_borderWidth, m_borderWidth,
false);
ArrayOfMmsiProperties g_MMSI_Props_Array
Global instance.
unsigned g_OwnShipmmsi
Global instance.
AisDecoder * g_pAIS
Global instance.
Class AisDecoder and helpers.
Global state for AIS decoder.
Wrapper for creating a ChartCtx based on global vars.
ChartDB * ChartData
Global instance.
ChartGroupArray * g_pGroupArray
Global instance.
Basic chart info storage.
arrayofCanvasPtr g_canvasArray
Global instance.
Generic Chart canvas base.
ChartCanvas - Main chart display and interaction component.
Represents an individual component within a ChartGroup.
Represents a user-defined collection of logically related charts.
Represents a panel for displaying and editing a configuration.
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
void Notify() override
Notify all listeners, no data supplied.
wxColour GetFontColor(const wxString &TextElement) const
Gets the text color for a UI element.
bool SetFont(const wxString &TextElement, wxFont *pFont, wxColour color)
Sets the default font properties for a UI element.
wxArrayString GetDialogStrings(const wxString &locale=wxEmptyString) const
Gets the list of unique dialog strings.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Get a font object for a UI element.
Wrapper for global variable, supports notification events when value changes.
Process incoming AIS messages.
static double ui_to_config(int slider_pos)
Convert a slider scale 1-100 value to configuration value 1.02..3.0.
Custom combobox for selecting waypoint icons.
EventVar m_on_sp_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Define an action to be performed when a KeyProvider is notified.
void Init(const KeyProvider &kp, const std::function< void(ObservedEvt &ev)> &action)
Initiate an object yet not listening.
Custom event class for OpenCPN's notification system.
bool LoadAllPlugIns(bool enabled_plugins, bool keep_orphans=false)
Update catalog with imported metadata and load all plugin library files.
ViewPort - Core geographic projection and coordinate transformation engine.
wxRadioButton * pTimezoneUTC
Specify date/time should be formatted in UTC.
EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
wxRadioButton * pTimezoneLocalTime
Specify date/time should be formatted in timezone as configured in the operating system.
Class cm93chart and helpers – CM93 chart state.
Global variables reflecting command line options and arguments.
Communication drivers factory and support.
Config file user configuration interface.
wxString g_datetime_format
Date/time format to use when formatting date/time strings.
bool g_bsmoothpanzoom
Controls how the chart panning and zooming smoothing is done during user interactions.
int g_iTempFormat
User-selected temperature unit format for display and input.
int g_nDepthUnitDisplay
User-selected depth (below surface) unit format for display and input.
bool g_bRollover
enable/disable mouse rollover GUI effects
int g_COGAvgSec
COG average period for Course Up Mode (sec)
int g_iSpeedFormat
User-selected speed unit format for display and input.
int g_iHeightFormat
User-selected height (vertical, above reference datum) unit format for display and input.
std::vector< size_t > g_config_display_size_mm
Size of pysical screen in millimeters.
int g_iDistanceFormat
User-selected distance (horizontal) unit format for display and input.
bool g_bDisplayGrid
Should lat/lon grid be displayed ?
Global variables stored in configuration file.
Panel for editing a connection.
Options | Connections GUI tab managing connections
std::vector< OCPN_MonitorInfo > g_monitor_info
Information about the monitors connected to the system.
GLuint g_raster_format
Global instance.
OpenGL chart rendering canvas.
glTextureManager * g_glTextureManager
Global instance.
Misc GUI event vars, a singleton.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
size_t g_current_monitor
Current monitor displaying main application frame.
Miscellaneous globals primarely used by gui layer, not persisted in configuration file.
GUI constant definitions.
Waypoint properties maintenance dialog.
Multiplexer class and helpers.
MyConfig * pConfig
Global instance.
Navigation Utility Functions without GUI dependencies.
A common variable shared between producer and consumer which supports Listen() and Notify().
Global variables Listen()/Notify() wrapper.
Generic font dialog for OpenCPN.
wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
wxString * GetpSharedDataLocation()
Gets shared application data location.
double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
ArrayOfMmsiProperties g_MMSI_Props_Array
Global instance.
options * g_options
Global instance.
double gVar
Magnetic variation in degrees.
Position, course, speed, etc.
PlugInManager * g_pi_manager
Global instance.
wxColour g_colourWaypointRangeRingsColour
Global instance.
float g_ChartScaleFactorExp
Global instance.
Serial ports support, notably enumeration.
wxArrayString * EnumerateSerialPorts(void)
Enumerate all serial ports.
wxBitmap LoadSVG(const wxString filename, const unsigned int width, const unsigned int height, wxBitmap *default_bitmap, bool use_cache)
Load SVG file and return it's bitmap representation of requested size In case file can't be loaded an...
Abstract gFrame/MyFrame interface.
Access checks for comm devices and dongle.
Low-level USB device management.
WaypointMan drawing stuff.