52#include <wx/clrpicker.h>
55#include <wx/display.h>
56#include <wx/fontdata.h>
57#include <wx/fontdlg.h>
58#include <wx/imaglist.h>
59#include <wx/listbox.h>
60#include <wx/mediactrl.h>
61#include <wx/odcombo.h>
62#include <wx/progdlg.h>
63#include <wx/radiobox.h>
65#include <wx/renderer.h>
66#include <wx/statline.h>
67#include <wx/stdpaths.h>
68#include <wx/textwrapper.h>
69#include <wx/tokenzr.h>
71#if defined(__WXGTK__) || defined(__WXQT__)
72#include <wx/colordlg.h>
83#include "o_sound/o_sound.h"
131static inline wxString ttDistance() {
133 "Horizontal measurements and distances. Examples: Distance between "
134 "geographic positions, visibility range, radar range.");
136static inline wxString ttSpeed() {
137 return _(
"Vessel and surface speed measurements");
139static inline wxString ttWindSpeed() {
140 return _(
"Wind speed measurements and forecasts");
142static inline wxString ttDepth() {
143 return _(
"Measurements below the water surface");
145static inline wxString ttHeight() {
147 "Vertical measurements above reference datum. Examples: Tide level, wave "
148 "height, air gap, mast clearance, elevation above reference datum.");
150static inline wxString ttTemp() {
151 return _(
"Temperature measurements (air, water, engine)");
153static inline wxString ttCoordFormat() {
154 return _(
"Coordinate display format for latitude and longitude");
162#include "androidUTIL.h"
166#include <QtWidgets/QScroller>
170#if wxCHECK_VERSION(3, 2, 0)
171#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
173#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS
176#define SLIDER_STYLE wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS
179#define ID_CHOICE_NMEA wxID_HIGHEST + 1
185extern wxLocale* plocale_def_lang;
193extern int g_Android_SDK_Version;
194extern MigrateAssistantDialog* g_migrateDialog;
197static wxString GetOCPNKnownLanguage(
const wxString lang_canonical,
199static wxString GetOCPNKnownLanguage(
const wxString lang_canonical);
202static int lang_list[] = {
203 wxLANGUAGE_DEFAULT, wxLANGUAGE_ABKHAZIAN, wxLANGUAGE_AFAR,
204 wxLANGUAGE_AFRIKAANS, wxLANGUAGE_ALBANIAN, wxLANGUAGE_AMHARIC,
205 wxLANGUAGE_ARABIC, wxLANGUAGE_ARABIC_ALGERIA, wxLANGUAGE_ARABIC_BAHRAIN,
206 wxLANGUAGE_ARABIC_EGYPT, wxLANGUAGE_ARABIC_IRAQ, wxLANGUAGE_ARABIC_JORDAN,
207 wxLANGUAGE_ARABIC_KUWAIT, wxLANGUAGE_ARABIC_LEBANON,
208 wxLANGUAGE_ARABIC_LIBYA, wxLANGUAGE_ARABIC_MOROCCO, wxLANGUAGE_ARABIC_OMAN,
209 wxLANGUAGE_ARABIC_QATAR, wxLANGUAGE_ARABIC_SAUDI_ARABIA,
210 wxLANGUAGE_ARABIC_SUDAN, wxLANGUAGE_ARABIC_SYRIA, wxLANGUAGE_ARABIC_TUNISIA,
212 wxLANGUAGE_ARABIC_YEMEN, wxLANGUAGE_ARMENIAN, wxLANGUAGE_ASSAMESE,
213 wxLANGUAGE_AYMARA, wxLANGUAGE_AZERI, wxLANGUAGE_AZERI_CYRILLIC,
214 wxLANGUAGE_AZERI_LATIN, wxLANGUAGE_BASHKIR, wxLANGUAGE_BASQUE,
215 wxLANGUAGE_BELARUSIAN, wxLANGUAGE_BENGALI, wxLANGUAGE_BHUTANI,
216 wxLANGUAGE_BIHARI, wxLANGUAGE_BISLAMA, wxLANGUAGE_BRETON,
217 wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, wxLANGUAGE_CAMBODIAN,
225 wxLANGUAGE_CHINESE_TAIWAN, wxLANGUAGE_CORSICAN, wxLANGUAGE_CROATIAN,
226 wxLANGUAGE_CZECH, wxLANGUAGE_DANISH, wxLANGUAGE_DUTCH,
227 wxLANGUAGE_DUTCH_BELGIAN, wxLANGUAGE_ENGLISH_UK, wxLANGUAGE_ENGLISH_US,
228 wxLANGUAGE_ENGLISH_AUSTRALIA, wxLANGUAGE_ENGLISH_BELIZE,
229 wxLANGUAGE_ENGLISH_BOTSWANA, wxLANGUAGE_ENGLISH_CANADA,
230 wxLANGUAGE_ENGLISH_CARIBBEAN, wxLANGUAGE_ENGLISH_DENMARK,
231 wxLANGUAGE_ENGLISH_EIRE, wxLANGUAGE_ENGLISH_JAMAICA,
232 wxLANGUAGE_ENGLISH_NEW_ZEALAND, wxLANGUAGE_ENGLISH_PHILIPPINES,
233 wxLANGUAGE_ENGLISH_SOUTH_AFRICA, wxLANGUAGE_ENGLISH_TRINIDAD,
234 wxLANGUAGE_ENGLISH_ZIMBABWE, wxLANGUAGE_ESPERANTO, wxLANGUAGE_ESTONIAN,
235 wxLANGUAGE_FAEROESE, wxLANGUAGE_FARSI, wxLANGUAGE_FIJI, wxLANGUAGE_FINNISH,
236 wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH_BELGIAN, wxLANGUAGE_FRENCH_CANADIAN,
237 wxLANGUAGE_FRENCH_LUXEMBOURG, wxLANGUAGE_FRENCH_MONACO,
238 wxLANGUAGE_FRENCH_SWISS, wxLANGUAGE_FRISIAN, wxLANGUAGE_GALICIAN,
239 wxLANGUAGE_GEORGIAN, wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN_AUSTRIAN,
240 wxLANGUAGE_GERMAN_BELGIUM, wxLANGUAGE_GERMAN_LIECHTENSTEIN,
241 wxLANGUAGE_GERMAN_LUXEMBOURG, wxLANGUAGE_GERMAN_SWISS, wxLANGUAGE_GREEK,
242 wxLANGUAGE_GREENLANDIC, wxLANGUAGE_GUARANI, wxLANGUAGE_GUJARATI,
243 wxLANGUAGE_HAUSA, wxLANGUAGE_HEBREW, wxLANGUAGE_HINDI, wxLANGUAGE_HUNGARIAN,
244 wxLANGUAGE_ICELANDIC, wxLANGUAGE_INDONESIAN, wxLANGUAGE_INTERLINGUA,
245 wxLANGUAGE_INTERLINGUE, wxLANGUAGE_INUKTITUT, wxLANGUAGE_INUPIAK,
246 wxLANGUAGE_IRISH, wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN_SWISS,
247 wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, wxLANGUAGE_KANNADA,
248 wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH,
249 wxLANGUAGE_KERNEWEK, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ,
252 wxLANGUAGE_KOREAN, wxLANGUAGE_KURDISH, wxLANGUAGE_LAOTHIAN,
253 wxLANGUAGE_LATIN, wxLANGUAGE_LATVIAN, wxLANGUAGE_LINGALA,
254 wxLANGUAGE_LITHUANIAN, wxLANGUAGE_MACEDONIAN, wxLANGUAGE_MALAGASY,
255 wxLANGUAGE_MALAY, wxLANGUAGE_MALAYALAM, wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
256 wxLANGUAGE_MALAY_MALAYSIA, wxLANGUAGE_MALTESE,
258 wxLANGUAGE_MAORI, wxLANGUAGE_MARATHI, wxLANGUAGE_MOLDAVIAN,
259 wxLANGUAGE_MONGOLIAN, wxLANGUAGE_NAURU, wxLANGUAGE_NEPALI,
260 wxLANGUAGE_NEPALI_INDIA, wxLANGUAGE_NORWEGIAN_BOKMAL,
261 wxLANGUAGE_NORWEGIAN_NYNORSK, wxLANGUAGE_OCCITAN, wxLANGUAGE_ORIYA,
262 wxLANGUAGE_OROMO, wxLANGUAGE_PASHTO, wxLANGUAGE_POLISH,
263 wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE_BRAZILIAN, wxLANGUAGE_PUNJABI,
264 wxLANGUAGE_QUECHUA, wxLANGUAGE_RHAETO_ROMANCE, wxLANGUAGE_ROMANIAN,
265 wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN_UKRAINE, wxLANGUAGE_SAMOAN,
266 wxLANGUAGE_SANGHO, wxLANGUAGE_SANSKRIT, wxLANGUAGE_SCOTS_GAELIC,
267 wxLANGUAGE_SERBIAN, wxLANGUAGE_SERBIAN_CYRILLIC, wxLANGUAGE_SERBIAN_LATIN,
268 wxLANGUAGE_SERBO_CROATIAN, wxLANGUAGE_SESOTHO, wxLANGUAGE_SETSWANA,
269 wxLANGUAGE_SHONA, wxLANGUAGE_SINDHI, wxLANGUAGE_SINHALESE,
270 wxLANGUAGE_SISWATI, wxLANGUAGE_SLOVAK, wxLANGUAGE_SLOVENIAN,
271 wxLANGUAGE_SOMALI, wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH_ARGENTINA,
272 wxLANGUAGE_SPANISH_BOLIVIA, wxLANGUAGE_SPANISH_CHILE,
273 wxLANGUAGE_SPANISH_COLOMBIA, wxLANGUAGE_SPANISH_COSTA_RICA,
274 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, wxLANGUAGE_SPANISH_ECUADOR,
275 wxLANGUAGE_SPANISH_EL_SALVADOR, wxLANGUAGE_SPANISH_GUATEMALA,
276 wxLANGUAGE_SPANISH_HONDURAS, wxLANGUAGE_SPANISH_MEXICAN,
278 wxLANGUAGE_SPANISH_NICARAGUA, wxLANGUAGE_SPANISH_PANAMA,
279 wxLANGUAGE_SPANISH_PARAGUAY, wxLANGUAGE_SPANISH_PERU,
280 wxLANGUAGE_SPANISH_PUERTO_RICO, wxLANGUAGE_SPANISH_URUGUAY,
281 wxLANGUAGE_SPANISH_US, wxLANGUAGE_SPANISH_VENEZUELA, wxLANGUAGE_SUNDANESE,
282 wxLANGUAGE_SWAHILI, wxLANGUAGE_SWEDISH, wxLANGUAGE_SWEDISH_FINLAND,
283 wxLANGUAGE_TAGALOG, wxLANGUAGE_TAJIK, wxLANGUAGE_TAMIL, wxLANGUAGE_TATAR,
284 wxLANGUAGE_TELUGU, wxLANGUAGE_THAI, wxLANGUAGE_TIBETAN, wxLANGUAGE_TIGRINYA,
285 wxLANGUAGE_TONGA, wxLANGUAGE_TSONGA, wxLANGUAGE_TURKISH, wxLANGUAGE_TURKMEN,
286 wxLANGUAGE_TWI, wxLANGUAGE_UIGHUR, wxLANGUAGE_UKRAINIAN, wxLANGUAGE_URDU,
287 wxLANGUAGE_URDU_INDIA, wxLANGUAGE_URDU_PAKISTAN, wxLANGUAGE_UZBEK,
288 wxLANGUAGE_UZBEK_CYRILLIC, wxLANGUAGE_UZBEK_LATIN, wxLANGUAGE_VIETNAMESE,
289 wxLANGUAGE_VOLAPUK, wxLANGUAGE_WELSH, wxLANGUAGE_WOLOF, wxLANGUAGE_XHOSA,
290 wxLANGUAGE_YIDDISH, wxLANGUAGE_YORUBA, wxLANGUAGE_ZHUANG, wxLANGUAGE_ZULU};
294void prepareSlider(wxSlider* slider) {
295 slider->GetHandle()->setStyleSheet(
296 prepareAndroidSliderStyleSheet(slider->GetSize().x));
297 slider->GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
298 slider->GetHandle()->grabGesture(Qt::PanGesture);
299 slider->GetHandle()->grabGesture(Qt::SwipeGesture);
305class ChartDirPanelHardBreakWrapper :
public wxTextWrapper {
307 ChartDirPanelHardBreakWrapper(wxWindow* win,
const wxString& text,
312 wxString textMod = text;
313 textMod.Replace(
" ",
"^");
316 wxString sep = wxFileName::GetPathSeparator();
317 textMod.Replace(sep,
" ");
319 Wrap(win, textMod, widthMax);
322 for (
size_t i = 0; i < m_array.GetCount(); i++) {
323 wxString a = m_array[i];
325 if (m_array.GetCount() > 1) {
326 if (i < m_array.GetCount() - 1) a += sep;
332 wxString
const& GetWrapped()
const {
return m_wrapped; }
333 int const GetLineCount()
const {
return m_lineCount; }
334 wxArrayString GetLineArray() {
return m_array; }
337 virtual void OnOutputLine(
const wxString& line) {
341 virtual void OnNewLine() {
349 wxArrayString m_array;
352class OCPNChartDirPanel :
public wxPanel {
354 OCPNChartDirPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
356 ~OCPNChartDirPanel();
358 void DoChartSelected();
359 void SetSelected(
bool selected);
360 void OnPaint(wxPaintEvent& event);
362 void OnSize(wxSizeEvent& event);
364 int GetUnselectedHeight() {
return m_unselectedHeight; }
365 int GetRefHeight() {
return m_refHeight; }
366 bool IsSelected() {
return m_bSelected; }
367 void OnClickDown(wxMouseEvent& event);
368 void OnClickUp(wxMouseEvent& event);
373 wxColour m_boxColour;
374 int m_unselectedHeight;
375 wxString m_pChartDir;
379 DECLARE_EVENT_TABLE()
383EVT_PAINT(OCPNChartDirPanel::OnPaint)
385EVT_SIZE(OCPNChartDirPanel::OnSize)
389 const wxPoint& pos, const wxSize& size,
391 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
392 m_pChartDir = cdi.fullpath;
395 if (cdi.fullpath.StartsWith(
396 "/storage/emulated/0/Android/data/org.opencpn.opencpn/files"))
397 m_pChartDir =
"..." + cdi.fullpath.Mid(58);
402 m_refHeight = GetCharHeight();
404 m_unselectedHeight = 2 * m_refHeight;
410 SetMinSize(wxSize(-1, m_unselectedHeight));
412 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(OCPNChartDirPanel::OnClickDown),
415 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(OCPNChartDirPanel::OnClickUp),
420OCPNChartDirPanel::~OCPNChartDirPanel() {}
422static wxStopWatch swclick;
424static int downx, downy;
427void OCPNChartDirPanel::OnClickDown(wxMouseEvent& event) {
430 event.GetPosition(&downx, &downy);
436void OCPNChartDirPanel::OnClickUp(wxMouseEvent& event) {
438 qDebug() << swclick.Time();
439 if (swclick.Time() < 200) {
441 event.GetPosition(&upx, &upy);
442 if ((fabs(upx - downx) < GetCharWidth()) &&
443 (fabs(upy - downy) < GetCharWidth())) {
451void OCPNChartDirPanel::DoChartSelected() {
461void OCPNChartDirPanel::SetSelected(
bool selected) {
462 m_bSelected = selected;
466 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
469 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
474 g_pOptions->SetDirActionButtons();
481void OCPNChartDirPanel::OnSize(wxSizeEvent& event) {
482 if (m_pChartDir.Length()) {
484 GetClientSize(&x, &y);
486 ChartDirPanelHardBreakWrapper wrapper(
this, m_pChartDir, x * 9 / 10);
487 wxArrayString nameWrapped = wrapper.GetLineArray();
489 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
495void OCPNChartDirPanel::OnPaint(wxPaintEvent& event) {
497 GetSize(&width, &height);
500 dc.SetPen(*wxTRANSPARENT_PEN);
501 dc.SetBrush(wxBrush(GetBackgroundColour()));
502 dc.DrawRectangle(GetVirtualSize());
504 wxString nameString = m_pChartDir;
505 ChartDirPanelHardBreakWrapper wrapper(
this, nameString, width * 9 / 10);
506 wxArrayString nameWrapped = wrapper.GetLineArray();
508 if (height < (
int)(nameWrapped.GetCount() + 1) * m_refHeight) {
509 SetMinSize(wxSize(-1, (nameWrapped.GetCount() + 1) * m_refHeight));
510 GetParent()->GetSizer()->Layout();
514 dc.SetBrush(wxBrush(m_boxColour));
516 dc.SetPen(wxPen(wxColor(0xCE, 0xD5, 0xD6), 3));
518 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
520 int offset = height / 10;
521 int text_x = offset * 2;
523 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
526 dc.SetTextForeground(
527 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
529 int yd = height * 20 / 100;
530 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
532 dc.DrawText(nameWrapped[i], text_x, yd);
534 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
535 yd += GetCharHeight();
539 dc.SetBrush(wxBrush(m_boxColour));
542 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWFRAME),
545 int offset = height / 10;
546 dc.DrawRoundedRectangle(offset, offset, width - (2 * offset),
547 height - (2 * offset), height / 10);
549 int text_x = offset * 2;
551 wxFont* dFont = GetOCPNScaledFont_PlugIn(_(
"Dialog"));
554 dc.SetTextForeground(
555 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOWTEXT));
557 int yd = height * 20 / 100;
558 for (
size_t i = 0; i < nameWrapped.GetCount(); i++) {
560 dc.DrawText(nameWrapped[i], text_x, yd);
562 dc.DrawText(nameWrapped[i], text_x + GetCharWidth(), yd);
563 yd += GetCharHeight();
571static bool LoadAllPlugIns(
bool load_enabled) {
572 g_Platform->ShowBusySpinner();
573 bool b = PluginLoader::GetInstance()->LoadAllPlugIns(load_enabled);
574 g_Platform->HideBusySpinner();
578class OCPNCheckedListCtrl :
public wxScrolledWindow {
580 OCPNCheckedListCtrl() {}
582 OCPNCheckedListCtrl(wxWindow* parent, wxWindowID
id = -1,
583 const wxPoint& pt = wxDefaultPosition,
584 const wxSize& sz = wxDefaultSize,
585 long style = wxHSCROLL | wxVSCROLL,
586 const wxString& name =
"scrolledWindow") {
587 Create(parent,
id, pt, sz, style, name);
590 bool Create(wxWindow* parent, wxWindowID
id = -1,
591 const wxPoint& pt = wxDefaultPosition,
592 const wxSize& sz = wxDefaultSize,
593 long style = wxHSCROLL | wxVSCROLL,
594 const wxString& name =
"scrolledWindow");
596 virtual ~OCPNCheckedListCtrl() {}
598 unsigned int Append(wxString& label,
bool benable =
true,
599 bool bsizerLayout =
true);
600 unsigned int GetCount() {
return m_list.size(); }
605 void Check(
int index,
bool val);
606 bool IsChecked(
int index);
611 std::vector<wxCheckBox*> m_list;
614bool OCPNCheckedListCtrl::Create(wxWindow* parent, wxWindowID
id,
615 const wxPoint& pt,
const wxSize& sz,
616 long style,
const wxString& name) {
617 if (!wxScrolledWindow::Create(parent,
id, pt, sz, style, name))
return FALSE;
620 GetHandle()->setObjectName(
"OCPNCheckedListCtrl");
621 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
625 m_sizer =
new wxBoxSizer(wxVERTICAL);
631unsigned int OCPNCheckedListCtrl::Append(wxString& label,
bool benable,
633 wxCheckBox* cb =
new wxCheckBox(
this, wxID_ANY, label);
635 cb->SetValue(!benable);
637 if (bsizerLayout) m_sizer->Layout();
639 m_list.push_back(cb);
641 return m_list.size() - 1;
644void OCPNCheckedListCtrl::Check(
int index,
bool val) {
645 wxCheckBox* cb = m_list[index];
646 if (cb) cb->SetValue(val);
649bool OCPNCheckedListCtrl::IsChecked(
int index) {
650 wxCheckBox* cb = m_list[index];
651 return cb ? cb->GetValue() :
false;
654void OCPNCheckedListCtrl::RunLayout() { m_sizer->Layout(); }
656void OCPNCheckedListCtrl::Clear() {
657 for (
auto cb : m_list)
delete cb;
663void appendOSDirSlash(wxString* pString);
672EVT_BUTTON(ID_CONFIGEDIT_CANCEL, ConfigCreateDialog::OnConfigEditCancelClick)
673EVT_BUTTON(ID_CONFIGEDIT_OK, ConfigCreateDialog::OnConfigEditOKClick)
677 const wxString& caption,
678 const wxPoint& pos, const wxSize& size,
680 : wxDialog(parent,
id, caption, pos, size,
681 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
683 GetSizer()->SetSizeHints(
this);
687ConfigCreateDialog::~ConfigCreateDialog() {}
689void ConfigCreateDialog::CreateControls() {
690 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
693 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Title")), 0,
694 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
696 m_TitleCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
697 wxSize(40 * GetCharHeight(), -1), 0);
698 mainSizer->Add(m_TitleCtl, 0,
699 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
701 mainSizer->AddSpacer(2 * GetCharHeight());
703 mainSizer->Add(
new wxStaticText(
this, wxID_STATIC, _(
"Description")), 0,
704 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
707 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
708 wxSize(-1, 6 * GetCharHeight()), wxTE_MULTILINE);
709 mainSizer->Add(m_DescriptionCtl, 0,
710 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
712 mainSizer->AddSpacer(2 * GetCharHeight());
717 _(
"Create a private configuration template based on current settings.\n\
718This template will be saved, and may be selected for further use at any time.\n\
720 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
722 mainSizer->AddSpacer(2 * GetCharHeight());
724 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
725 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
727 m_CancelButton =
new wxButton(
this, ID_CONFIGEDIT_CANCEL, _(
"Cancel"));
728 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
730 m_OKButton =
new wxButton(
this, ID_CONFIGEDIT_OK, _(
"OK"));
731 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
732 m_OKButton->SetDefault();
735void ConfigCreateDialog::OnConfigEditCancelClick(wxCommandEvent& event) {
736 EndModal(wxID_CANCEL);
739void ConfigCreateDialog::OnConfigEditOKClick(wxCommandEvent& event) {
740 const wxString& title = m_TitleCtl->GetValue();
741 const wxString& desc = m_DescriptionCtl->GetValue();
742 m_createdTemplateGUID = ConfigMgr::Get().CreateNamedConfig(title, desc,
"");
751EVT_BUTTON(ID_MMSIEDIT_CANCEL, MMSIEditDialog::OnMMSIEditCancelClick)
752EVT_BUTTON(ID_MMSIEDIT_OK, MMSIEditDialog::OnMMSIEditOKClick)
756 wxWindowID
id, const wxString& caption,
757 const wxPoint& pos, const wxSize& size,
759 : wxDialog(parent,
id, caption, pos, size,
760 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
763 GetSizer()->SetSizeHints(
this);
767MMSIEditDialog::~MMSIEditDialog() {
delete m_MMSICtl; }
769void MMSIEditDialog::CreateControls() {
770 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
773 wxStaticBox* mmsiBox =
774 new wxStaticBox(
this, wxID_ANY, _(
"MMSI Extended Properties"));
776 wxStaticBoxSizer* mmsiSizer =
new wxStaticBoxSizer(mmsiBox, wxVERTICAL);
777 mainSizer->Add(mmsiSizer, 0, wxEXPAND | wxALL, 5);
779 wxStaticText* mmsiLabel =
new wxStaticText(
this, wxID_STATIC, _(
"MMSI"));
780 mmsiLabel->SetToolTip(
781 _(
"Maritime Mobile Service Identity - A unique 9-digit number assigned "
782 "to a vessel or navigation aid. Used to identify vessels and devices "
783 "in AIS transmissions and DSC calls."));
784 mmsiSizer->Add(mmsiLabel, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
786 m_MMSICtl =
new wxTextCtrl(
this, ID_MMSI_CTL, wxEmptyString,
787 wxDefaultPosition, wxSize(180, -1), 0);
788 m_MMSICtl->SetToolTip(
789 _(
"Enter the 9-digit MMSI number for this vessel or station"));
790 mmsiSizer->Add(m_MMSICtl, 0,
791 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
792 m_MMSICtl->Bind(wxEVT_TEXT, &MMSIEditDialog::OnMMSIChanged,
this);
794 wxStaticText* userLabelText =
new wxStaticText(
this, wxID_STATIC, _(
"Name"));
795 userLabelText->SetToolTip(
796 _(
"Display name for this vessel or device - can override names received "
798 mmsiSizer->Add(userLabelText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
800 m_ShipNameCtl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
801 wxDefaultPosition, wxSize(180, -1), 0);
802 m_ShipNameCtl->SetToolTip(_(
803 "Set the name for this vessel or device. If specified, this name takes "
804 "precedence over names received via AIS messages. Note that standard AIS "
805 "only supports uppercase letters (A-Z), numbers, and limited "
806 "punctuation. Your manual entries are stored in the mmsitoname.csv file "
807 "and preserved across sessions."));
808 mmsiSizer->Add(m_ShipNameCtl, 0,
809 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
811 wxStaticBox* trackBox =
new wxStaticBox(
this, wxID_ANY, _(
"Tracking"));
812 trackBox->SetToolTip(_(
"Control how tracks are created for this MMSI"));
813 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackBox, wxVERTICAL);
815 wxGridSizer* gridSizer =
new wxGridSizer(0, 3, 0, 0);
817 m_rbTypeTrackDefault =
818 new wxRadioButton(
this, wxID_ANY, _(
"Default tracking"),
819 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
820 m_rbTypeTrackDefault->SetToolTip(
821 _(
"Use the global tracking settings for this vessel"));
822 m_rbTypeTrackDefault->SetValue(TRUE);
823 gridSizer->Add(m_rbTypeTrackDefault, 0, wxALL, 5);
825 m_rbTypeTrackAlways =
new wxRadioButton(
this, wxID_ANY, _(
"Always track"));
826 m_rbTypeTrackAlways->SetToolTip(_(
827 "Always create a track for this vessel, regardless of global settings"));
828 gridSizer->Add(m_rbTypeTrackAlways, 0, wxALL, 5);
830 m_rbTypeTrackNever =
new wxRadioButton(
this, wxID_ANY, _(
" Never track"));
831 m_rbTypeTrackNever->SetToolTip(
832 _(
"Never create a track for this vessel, regardless of global settings"));
833 gridSizer->Add(m_rbTypeTrackNever, 0, wxALL, 5);
835 m_cbTrackPersist =
new wxCheckBox(
this, wxID_ANY, _(
"Persistent"));
836 m_cbTrackPersist->SetToolTip(
837 _(
"Save this vessel's track between OpenCPN sessions. Useful for vessels "
838 "you want to monitor continuously over time."));
839 gridSizer->Add(m_cbTrackPersist, 0, wxALL, 5);
841 trackSizer->Add(gridSizer, 0, wxEXPAND, 0);
842 mmsiSizer->Add(trackSizer, 0, wxEXPAND, 0);
844 m_IgnoreButton =
new wxCheckBox(
this, wxID_ANY, _(
"Ignore this MMSI"));
845 m_IgnoreButton->SetToolTip(
846 _(
"When checked, AIS data for this MMSI will be ignored and the vessel "
847 "will not appear on the chart. Useful for suppressing shore stations, "
848 "permanently moored vessels, or duplicate AIS signals that you don't "
849 "need to monitor."));
850 mmsiSizer->Add(m_IgnoreButton, 0, wxEXPAND, 5);
852 m_MOBButton =
new wxCheckBox(
this, wxID_ANY,
853 _(
"Handle this MMSI as SART/PLB(AIS) MOB."));
854 m_MOBButton->SetToolTip(
855 _(
"When checked, OpenCPN will display a special icon for this device, "
856 "sound a distinctive alarm, and automatically create a temporary MOB "
857 "route from your vessel to this device in emergency. For crew safety "
858 "devices, you can assign the crew member's name using the Name "
859 "field above for quick identification."));
860 mmsiSizer->Add(m_MOBButton, 0, wxEXPAND, 5);
863 new wxCheckBox(
this, wxID_ANY, _(
"Convert AIVDM to AIVDO for this MMSI"));
864 m_VDMButton->SetToolTip(
865 _(
"When checked, converts AIS messages for this vessel from AIVDM (other "
866 "vessel) to AIVDO (own vessel) format."));
867 mmsiSizer->Add(m_VDMButton, 0, wxEXPAND, 5);
869 m_FollowerButton =
new wxCheckBox(
870 this, wxID_ANY, _(
"This MMSI is my Follower - No CPA Alert"));
871 m_FollowerButton->SetToolTip(
872 _(
"When checked, disables CPA (Closest Point of Approach) alerts for "
873 "this vessel as it's considered intentionally following your vessel. "
874 "Follower vessels are displayed with a special own-ship style icon."));
875 mmsiSizer->Add(m_FollowerButton, 0, wxEXPAND, 5);
877 wxBoxSizer* btnSizer =
new wxBoxSizer(wxHORIZONTAL);
878 mainSizer->Add(btnSizer, 0, wxALIGN_RIGHT | wxALL, 5);
880 m_CancelButton =
new wxButton(
this, ID_MMSIEDIT_CANCEL, _(
"Cancel"));
881 btnSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
883 m_OKButton =
new wxButton(
this, ID_MMSIEDIT_OK, _(
"OK"));
884 btnSizer->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
885 m_OKButton->SetDefault();
889 if (m_props->MMSI > 0)
890 sMMSI.Printf(
"%d", m_props->MMSI);
893 m_MMSICtl->AppendText(sMMSI);
896 if (!m_props->m_ShipName.IsEmpty()) {
897 m_ShipNameCtl->SetValue(m_props->m_ShipName);
900 switch (m_props->TrackType) {
901 case TRACKTYPE_ALWAYS:
902 m_rbTypeTrackAlways->SetValue(TRUE);
904 case TRACKTYPE_NEVER:
905 m_rbTypeTrackNever->SetValue(TRUE);
911 m_cbTrackPersist->SetValue(m_props->m_bPersistentTrack);
912 m_IgnoreButton->SetValue(m_props->m_bignore);
913 m_MOBButton->SetValue(m_props->m_bMOB);
914 m_VDMButton->SetValue(m_props->m_bVDM);
915 m_FollowerButton->SetValue(m_props->m_bFollower);
917 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
920void MMSIEditDialog::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
922void MMSIEditDialog::OnMMSIEditCancelClick(wxCommandEvent& event) {
923 EndModal(wxID_CANCEL);
926void MMSIEditDialog::Persist() {
928 if (m_rbTypeTrackDefault->GetValue())
929 m_props->TrackType = TRACKTYPE_DEFAULT;
930 else if (m_rbTypeTrackAlways->GetValue())
931 m_props->TrackType = TRACKTYPE_ALWAYS;
933 m_props->TrackType = TRACKTYPE_NEVER;
935 m_props->m_bignore = m_IgnoreButton->GetValue();
936 m_props->m_bMOB = m_MOBButton->GetValue();
937 m_props->m_bVDM = m_VDMButton->GetValue();
938 m_props->m_bFollower = m_FollowerButton->GetValue();
939 m_props->m_bPersistentTrack = m_cbTrackPersist->GetValue();
942 wxString shipName = m_ShipNameCtl->GetValue().Upper();
943 if (!shipName.IsEmpty()) {
944 m_props->m_ShipName = shipName;
947 wxString mmsi = m_MMSICtl->GetValue();
948 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
949 g_pAIS->UpdateMMSItoNameFile(mmsi, shipName);
954 else if (m_props->m_ShipName == wxEmptyString) {
955 auto proptarget =
g_pAIS->Get_Target_Data_From_MMSI(m_props->MMSI);
957 wxString s = proptarget->GetFullName();
958 m_props->m_ShipName = s;
960 wxString GetShipNameFromFile(
int);
961 m_props->m_ShipName = GetShipNameFromFile(m_props->MMSI);
967void MMSIEditDialog::OnMMSIEditOKClick(wxCommandEvent& event) {
971 m_MMSICtl->GetValue().ToLong(&nmmsi);
972 m_props->MMSI = nmmsi;
975 if (m_MMSICtl->GetValue().Length() != 9) {
976 OCPNMessageDialog* dlg =
new OCPNMessageDialog(
978 _(
"An MMSI Id is generally a number of nine digits.\nPlease check "
979 "your entries and cancel if necessary."),
980 _(
"OpenCPN Info"), wxOK | wxCANCEL);
982 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
983 if (retcode == wxID_OK) {
994void MMSIEditDialog::OnCtlUpdated(wxCommandEvent& event) {}
996void MMSIEditDialog::OnMMSIChanged(wxCommandEvent& event) {
997 wxString mmsi = m_MMSICtl->GetValue();
1000 if (!mmsi.IsEmpty() && mmsi.Length() == 9 && mmsi.IsNumber()) {
1002 wxString shipName =
g_pAIS->GetMMSItoNameEntry(mmsi);
1005 if (shipName.IsEmpty()) {
1006 auto target =
g_pAIS->Get_Target_Data_From_MMSI(wxAtoi(mmsi));
1008 shipName = target->GetFullName();
1013 if (!shipName.IsEmpty()) {
1014 m_ShipNameCtl->SetValue(shipName);
1022EVT_LIST_ITEM_SELECTED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemClick)
1023EVT_LIST_ITEM_ACTIVATED(ID_MMSI_PROPS_LIST, MMSIListCtrl::OnListItemActivated)
1024EVT_LIST_ITEM_RIGHT_CLICK(ID_MMSI_PROPS_LIST,
1025 MMSIListCtrl::OnListItemRightClick)
1026EVT_MENU(ID_DEF_MENU_MMSI_EDIT, MMSIListCtrl::PopupMenuHandler)
1027EVT_MENU(ID_DEF_MENU_MMSI_DELETE, MMSIListCtrl::PopupMenuHandler)
1031 const wxSize& size,
long style)
1032 : wxListCtrl(parent,
id, pos, size, style) {
1036MMSIListCtrl::~MMSIListCtrl() {}
1038wxString MMSIListCtrl::OnGetItemText(
long item,
long column)
const {
1042 if (!props)
return ret;
1045 if (props->MMSI > 0) ret = wxString::Format(
"%d", props->MMSI);
1048 switch (props->TrackType) {
1049 case TRACKTYPE_DEFAULT:
1052 case TRACKTYPE_ALWAYS:
1055 case TRACKTYPE_NEVER:
1061 if (props->m_bPersistentTrack) ret.Append(
", ").Append(_(
"Persistent"));
1064 if (props->m_bignore) ret =
"X";
1067 if (props->m_bMOB) ret =
"X";
1070 if (props->m_bVDM) ret =
"X";
1073 if (props->m_bFollower) ret =
"X";
1076 ret = props->m_ShipName;
1085void MMSIListCtrl::OnListItemClick(wxListEvent& event) {}
1087void MMSIListCtrl::OnListItemActivated(wxListEvent& event) {
1089 MmsiProperties* props_new =
new MmsiProperties(*props);
1091 MMSIEditDialog* pd =
1092 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1093 wxDefaultPosition, wxSize(200, 200));
1095 if (pd->ShowModal() == wxID_OK) {
1105void MMSIListCtrl::OnListItemRightClick(wxListEvent& event) {
1106 m_context_item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1107 if (m_context_item == wxNOT_FOUND)
return;
1108 wxMenu* menu =
new wxMenu(_(
"MMSI Properties"));
1110 wxMenuItem* item_edit =
1111 new wxMenuItem(menu, ID_DEF_MENU_MMSI_EDIT, _(
"Edit") +
"...");
1114 item_edit->SetFont(sFont);
1116 menu->Append(item_edit);
1118 wxMenuItem* item_delete =
1119 new wxMenuItem(menu, ID_DEF_MENU_MMSI_DELETE, _(
"Delete"));
1121 item_delete->SetFont(sFont);
1123 menu->Append(item_delete);
1127 item_edit->SetFont(*qFont);
1128 item_delete->SetFont(*qFont);
1131 wxPoint p = ScreenToClient(wxGetMousePosition());
1132 PopupMenu(menu, p.x, p.y);
1138void MMSIListCtrl::PopupMenuHandler(wxCommandEvent& event) {
1139 int context_item = m_context_item;
1144 switch (event.GetId()) {
1145 case ID_DEF_MENU_MMSI_EDIT: {
1146 MmsiProperties* props_new =
new MmsiProperties(*props);
1147 MMSIEditDialog* pd =
1148 new MMSIEditDialog(props_new, m_parent, -1, _(
"Edit MMSI Properties"),
1149 wxDefaultPosition, wxSize(200, 200));
1151 if (pd->ShowModal() == wxID_OK) {
1154 props_new->m_ShipName = GetShipNameFromFile(props_new->MMSI);
1164 case ID_DEF_MENU_MMSI_DELETE:
1173MMSI_Props_Panel::MMSI_Props_Panel(wxWindow* parent)
1174 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1181 wxBoxSizer* topSizer =
new wxBoxSizer(wxVERTICAL);
1184 wxString MMSI_props_column_spec =
"120;120;100;100;100;100;100;100";
1186 wxStringTokenizer tkz(MMSI_props_column_spec,
";");
1187 wxString s_width = tkz.GetNextToken();
1191 m_pListCtrlMMSI =
new MMSIListCtrl(
1192 this, ID_MMSI_PROPS_LIST, wxDefaultPosition, wxSize(-1, -1),
1193 wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES |
1202 int dx = GetCharWidth();
1204 GetTextExtent(
"W", &dx, NULL, NULL, NULL, qFont);
1207 m_pListCtrlMMSI->InsertColumn(mlMMSI, _(
"MMSI"), wxLIST_FORMAT_LEFT, dx * 10);
1208 m_pListCtrlMMSI->InsertColumn(mlTrackMode, _(
"Track Mode"),
1209 wxLIST_FORMAT_CENTER, dx * 20);
1210 m_pListCtrlMMSI->InsertColumn(mlIgnore, _(
"Ignore"), wxLIST_FORMAT_CENTER,
1212 m_pListCtrlMMSI->InsertColumn(mlMOB, _(
"MOB"), wxLIST_FORMAT_CENTER, dx * 5);
1213 m_pListCtrlMMSI->InsertColumn(mlVDM, _(
"VDM->VDO"), wxLIST_FORMAT_CENTER,
1215 m_pListCtrlMMSI->InsertColumn(mlShipName, _(
"Ship name"),
1216 wxLIST_FORMAT_CENTER, dx * 20);
1217 m_pListCtrlMMSI->InsertColumn(mlFollower, _(
"Follower"), wxLIST_FORMAT_CENTER,
1220 topSizer->Add(m_pListCtrlMMSI, 1, wxEXPAND | wxALL, 0);
1222 m_pButtonNew =
new wxButton(
this, wxID_ANY, _(
"New..."), wxDefaultPosition,
1224 m_pButtonNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
1225 wxCommandEventHandler(MMSI_Props_Panel::OnNewButton),
1227 topSizer->Add(m_pButtonNew, 0, wxALIGN_RIGHT | wxALL, 0);
1234 SetSize(GetSize().x, GetSize().y - 1);
1236 SetColorScheme(GLOBAL_COLOR_SCHEME_RGB);
1239MMSI_Props_Panel::~MMSI_Props_Panel() {}
1241void MMSI_Props_Panel::OnNewButton(wxCommandEvent& event) {
1242 MmsiProperties* props =
new MmsiProperties(-1);
1244 MMSIEditDialog* pd =
1245 new MMSIEditDialog(props, m_parent, -1, _(
"Add MMSI Properties"),
1246 wxDefaultPosition, wxSize(200, 200));
1249 if (pd->ShowModal() == wxID_OK) {
1257void MMSI_Props_Panel::UpdateMMSIList() {
1259 long selItemID = wxNOT_FOUND;
1260 m_pListCtrlMMSI->GetNextItem(selItemID, wxLIST_NEXT_ALL,
1261 wxLIST_STATE_SELECTED);
1263 int selMMSI = wxNOT_FOUND;
1266 m_pListCtrlMMSI->DeleteAllItems();
1271 m_pListCtrlMMSI->InsertItem(item);
1272 for (
int j = 0; j < mlFollower + 1; j++) {
1274 item.SetText(m_pListCtrlMMSI->OnGetItemText(i, j));
1275 m_pListCtrlMMSI->SetItem(item);
1280 long item_sel = wxNOT_FOUND;
1281 if (selItemID != wxNOT_FOUND && selMMSI != wxNOT_FOUND) {
1291 m_pListCtrlMMSI->SetItemState(item_sel,
1292 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
1293 wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
1296 m_pListCtrlMMSI->Refresh(FALSE);
1300void MMSI_Props_Panel::SetColorScheme(ColorScheme cs) { DimeControl(
this); }
1306class OCPNFatCombo :
public wxOwnerDrawnComboBox {
1310 OCPNFatCombo(wxWindow* parent, wxWindowID
id,
const wxString& value =
"",
1311 const wxPoint& pos = wxDefaultPosition,
1312 const wxSize& size = wxDefaultSize,
int n = 0,
1313 const wxString choices[] = NULL,
long style = 0,
1314 const wxValidator& validator = wxDefaultValidator,
1315 const wxString& name =
"OCPNFatCombo");
1319 void OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const;
1320 wxCoord OnMeasureItem(
size_t item)
const;
1321 wxCoord OnMeasureItemWidth(
size_t item)
const;
1322 bool SetFont(
const wxFont& font);
1324 int Append(
const wxString& item, wxBitmap bmp);
1327 const wxFont* dfont;
1331 ArrayOfBitmaps bmpArray;
1334OCPNFatCombo::OCPNFatCombo() : wxOwnerDrawnComboBox() {}
1336OCPNFatCombo::OCPNFatCombo(wxWindow* parent, wxWindowID
id,
1337 const wxString& value,
const wxPoint& pos,
1338 const wxSize& size,
int n,
const wxString choices[],
1339 long style,
const wxValidator& validator,
1340 const wxString& name)
1341 : wxOwnerDrawnComboBox(parent, id, value, pos, size, n, choices, style,
1344 GetFont().GetPointSize() /
g_Platform->getFontPointsperPixel();
1345 itemHeight = (int)wxRound(fontHeight);
1346 SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
1349OCPNFatCombo::~OCPNFatCombo() {}
1351bool OCPNFatCombo::SetFont(
const wxFont& font) {
1356void OCPNFatCombo::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
1363 wxColor bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
1364 wxBrush br = wxBrush(bg);
1365 wxBrush sv = dc.GetBrush();
1367 dc.DrawRectangle(0, 0, rect.width, rect.height);
1369 dc.SetTextForeground(wxColour(0, 0, 0));
1371 if (flags & wxODCB_PAINTING_CONTROL) {
1372 wxString text = GetValue();
1374 dc.DrawText(text, rect.x + margin_x + offset_x,
1375 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1377 dc.SetBackground(wxBrush(br));
1379 dc.DrawText(GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x,
1380 (rect.height - dc.GetCharHeight()) / 2 + rect.y);
1384wxCoord OCPNFatCombo::OnMeasureItem(
size_t item)
const {
1385 if (item < bmpArray.GetCount())
1386 return wxMax(itemHeight, bmpArray.Item(item).GetHeight());
1388 return itemHeight * 12 / 10;
1391wxCoord OCPNFatCombo::OnMeasureItemWidth(
size_t item)
const {
return -1; }
1393int OCPNFatCombo::Append(
const wxString& item, wxBitmap bmp) {
1395 int idx = wxOwnerDrawnComboBox::Append(item);
1400void OCPNFatCombo::Clear() {
1401 wxOwnerDrawnComboBox::Clear();
1405BEGIN_EVENT_TABLE(
options, wxDialog)
1406EVT_INIT_DIALOG(options::OnDialogInit)
1407EVT_CHECKBOX(ID_DEBUGCHECKBOX1, options::OnDebugcheckbox1Click)
1408EVT_BUTTON(ID_BUTTONADD, options::OnButtonaddClick)
1409EVT_BUTTON(ID_BUTTONDELETE, options::OnButtondeleteClick)
1410EVT_BUTTON(ID_PARSEENCBUTTON, options::OnButtonParseENC)
1411EVT_BUTTON(ID_REBUILDBUTTON, options::OnButtonRebuildChartDb)
1412EVT_BUTTON(ID_BUTTONCOMPRESS, options::OnButtoncompressClick)
1413EVT_BUTTON(ID_BUTTONMIGRATE, options::OnButtonmigrateClick)
1414EVT_BUTTON(ID_TCDATAADD, options::OnInsertTideDataLocation)
1415EVT_BUTTON(ID_TCDATADEL, options::OnRemoveTideDataLocation)
1416EVT_BUTTON(ID_APPLY, options::OnApplyClick)
1417EVT_BUTTON(xID_OK, options::OnXidOkClick)
1418EVT_BUTTON(wxID_CANCEL, options::OnCancelClick)
1419EVT_BUTTON(ID_BUTTONFONTCHOOSE, options::OnChooseFont)
1420EVT_BUTTON(ID_BUTTONFONT_RESET, options::OnResetFont)
1421EVT_BUTTON(ID_BUTTONECDISHELP, options::OnButtonEcdisHelp)
1423EVT_CHOICE(ID_CHOICE_FONTELEMENT, options::OnFontChoice)
1424EVT_CLOSE(options::OnClose)
1426#if defined(__WXGTK__) || defined(__WXQT__)
1427EVT_BUTTON(ID_BUTTONFONTCOLOR, options::OnChooseFontColor)
1430EVT_BUTTON(ID_OPENGLOPTIONS, options::OnOpenGLOptions)
1432EVT_CHOICE(ID_RADARDISTUNIT, options::OnDisplayCategoryRadioButton)
1433EVT_CHOICE(ID_DEPTHUNITSCHOICE, options::OnUnitsChoice)
1434EVT_CHOICE(ID_HEIGHTUNITSCHOICE, options::OnUnitsChoice)
1435EVT_BUTTON(ID_CLEARLIST, options::OnButtonClearClick)
1436EVT_BUTTON(ID_SELECTLIST, options::OnButtonSelectClick)
1437EVT_BUTTON(ID_SETSTDLIST, options::OnButtonSetStd)
1438EVT_CHOICE(ID_SHIPICONTYPE, options::OnShipTypeSelect)
1439EVT_CHOICE(ID_RADARRINGS, options::OnRadarringSelect)
1440EVT_CHOICE(ID_OPWAYPOINTRANGERINGS, options::OnWaypointRangeRingSelect)
1441EVT_CHAR_HOOK(options::OnCharHook)
1446 const wxString& caption, const wxPoint& pos,
1447 const wxSize& size,
long style)
1448 : pTrackRotateTime(0), m_callbacks(callbacks) {
1453 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1455 wxDialog::Create(parent,
id, caption, pos, size, style,
"Options");
1456 SetFont(*dialogFont);
1459 RecalculateSize(size.x, size.y);
1461 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
1463 compat_os_listener.Listen(compat_os,
this, EVT_COMPAT_OS_CHANGE);
1464 Bind(EVT_COMPAT_OS_CHANGE, [&](wxCommandEvent&) {
1465 PluginLoader::GetInstance()->LoadAllPlugIns(
false);
1466 m_pPlugInCtrl->ReloadPluginPanels();
1468 auto action = [&](wxCommandEvent& evt) {
1469 g_persist_active_route = m_persist_active_route_chkbox->IsChecked();
1471 m_persist_active_route_chkbox->Bind(wxEVT_CHECKBOX, action);
1472 m_persist_active_route_chkbox->SetValue(g_persist_active_route);
1475 m_OnChartDb_finalize_listener.Init(
1476 GuiEvents::GetInstance().on_finalize_chartdbs,
1477 [&](
ObservedEvt& ev) { OptionsFinalizeChartDBUpdate(); });
1478 Bind(wxEVT_SYS_COLOUR_CHANGED,
1479 [&](wxSysColourChangedEvent& ev) { OnColorChange(ev); });
1482options::~options() {
1484 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
1486 nb->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1487 wxListbookEventHandler(options::OnChartsPageChange), NULL,
1490 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
1492 delete m_pSerialArray;
1493 delete m_pGroupArray;
1494 delete m_topImgList;
1498 delete m_pPlugInCtrl;
1501 delete m_PluginCatalogMgrPanel;
1505#ifdef OCPN_OPTIONS_USE_LISTBOOK
1506void options::OnColorChange() {
1507 auto foreground = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT);
1508 auto background = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
1509 m_pListbook->GetListView()->SetBackgroundColour(background);
1510 m_pListbook->GetListView()->SetForegroundColour(foreground);
1513void options::OnColorChange() {}
1516void options::OnColorChange(wxSysColourChangedEvent& ev) {
1522bool options::SendIdleEvents(wxIdleEvent& event) {
1523 if (IsShown())
return wxDialog::SendIdleEvents(event);
1527void options::OptionsFinalizeChartDBUpdate() {
1532 g_GLOptions.m_bTextureCompressionCaching = m_bTextureCacheingSave;
1534 m_OKButton->Enable();
1535 m_CancelButton->Enable();
1536 m_ApplyButton->Enable();
1539void options::RecalculateSize(
int hint_x,
int hint_y) {
1540 if (!g_bresponsive) {
1541 m_nCharWidthMax = GetSize().x / GetCharWidth();
1545 if ((hint_x < 200) || (hint_y < 200)) {
1547 int display_width, display_height;
1551 if (display_height < 600) {
1554 vectorPanel->SetSizeHints(ps57Ctl);
1564 esize.x = GetCharWidth() * 110;
1565 esize.y = GetCharHeight() * 40;
1567 wxSize dsize = GetParent()->GetSize();
1568 esize.y = wxMin(esize.y, dsize.y - 0 );
1569 esize.x = wxMin(esize.x, dsize.x - 0 );
1572 wxSize fsize = GetSize();
1573 wxSize canvas_size = GetParent()->GetSize();
1574 wxPoint screen_pos = GetParent()->GetScreenPosition();
1575 int xp = (canvas_size.x - fsize.x) / 2;
1576 int yp = (canvas_size.y - fsize.y) / 2;
1577 Move(screen_pos.x + xp, screen_pos.y + yp);
1579 m_nCharWidthMax = GetSize().x / GetCharWidth();
1582void options::Init() {
1583 m_pWorkDirList = NULL;
1585 pShowStatusBar = NULL;
1586 pShowMenuBar = NULL;
1587 pShowCompassWin = NULL;
1590 m_scrollWinChartList = NULL;
1591 ps57CtlListBox = NULL;
1593 m_pSerialArray = NULL;
1594 pUpdateCheckBox = NULL;
1595 pParseENCButton = NULL;
1601 pSoundDeviceIndex = NULL;
1605 pCBLookAhead = NULL;
1606 pCDOQuilting = NULL;
1607 pPreserveScale = NULL;
1608 pSmoothPanZoom = NULL;
1609 pEnableZoomToCursor = NULL;
1610 m_Text_def_boat_speed = NULL;
1612 pSDisplayGrid = NULL;
1613 pCDOOutlines = NULL;
1614 pSDepthUnits = NULL;
1616 pSDefaultBoatSpeed = NULL;
1619 itemActiveChartStaticBox = NULL;
1621 pCheck_SOUNDG = NULL;
1623 pCheck_SHOWIMPTEXT = NULL;
1624 pCheck_SCAMIN = NULL;
1625 pCheck_ATONTEXT = NULL;
1626 pCheck_LDISTEXT = NULL;
1627 pCheck_XLSECTTEXT = NULL;
1629 m_bVisitLang = FALSE;
1630 m_bVisitPlugins = FALSE;
1631 m_itemFontElementListBox = NULL;
1632 m_textSample = NULL;
1633 m_topImgList = NULL;
1636 m_pGroupArray = NULL;
1637 m_groups_changed = 0;
1640 m_pageConnections = -1;
1645 m_pageConnections = -1;
1647 pEnableTenHertz =
nullptr;
1649 auto loader = PluginLoader::GetInstance();
1650 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
1651 b_oldhaveWMM = b_haveWMM;
1656 m_bForceNewToolbaronCancel =
false;
1658 m_cs = (ColorScheme)0;
1661 m_pPlugInCtrl = NULL;
1662 m_PluginCatalogMgrPanel = NULL;
1676 m_bVectorInit =
false;
1681 pCmdSoundString = NULL;
1683 m_sconfigSelect_single = NULL;
1684 m_sconfigSelect_twovertical = NULL;
1687 dc.SetFont(*dialogFont);
1689 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, dialogFont);
1691 m_colourPickerDefaultSize =
1704 auto sound_action = [](ObservedEvt ev) {
1705 auto sound =
static_cast<o_sound::Sound*
>(ev.GetClientData());
1719 {_(
"Nautical miles"), DISTANCE_NMI},
1720 {_(
"Statute miles"), DISTANCE_MI},
1721 {_(
"Kilometers"), DISTANCE_KM},
1722 {_(
"Meters"), DISTANCE_M}};
1724static const int kNumDistanceFormats =
1728static int GetDistanceFormatIndex(
int enumValue) {
1729 for (
int i = 0; i < kNumDistanceFormats; i++) {
1730 if (kDistanceFormats[i].enumValue == enumValue) {
1738static int GetDistanceFormatEnum(
int index) {
1739 if (index >= 0 && index < kNumDistanceFormats) {
1740 return kDistanceFormats[index].enumValue;
1742 return DISTANCE_NMI;
1745#if defined(__GNUC__) && __GNUC__ < 8
1748static const wxString BAD_ACCESS_MSG = _(
1749 "The device selected is not accessible; opencpn will likely not be able\n"
1750 "to use this device as-is. You might want to exit OpenCPN, reboot and\n"
1751 "retry after creating a file called /etc/udev/rules.d/70-opencpn.rules\n"
1752 "with the following contents:\n\n"
1753 " KERNEL==\"ttyUSB*\", MODE=\"0666\"\n"
1754 " KERNEL==\"ttyACM*\", MODE=\"0666\"\n"
1755 " KERNEL==\"ttyS*\", MODE=\"0666\"\n\n"
1756 "For more info, see the file LINUX_DEVICES.md in the distribution docs.\n");
1760static const wxString BAD_ACCESS_MSG = _(R
"(
1761The device selected is not accessible; opencpn will likely not be able
1762to use this device as-is. You might want to exit OpenCPN, reboot and
1763retry after creating a file called /etc/udev/rules.d/70-opencpn.rules
1764with the following contents:
1766 KERNEL=="ttyUSB*", MODE="0666"
1767 KERNEL=="ttyACM*", MODE="0666"
1768 KERNEL=="ttyS*", MODE="0666"
1770For more info, see the file LINUX_DEVICES.md in the distribution docs.
1775void options::OnDialogInit(wxInitDialogEvent& event) {}
1777void options::CheckDeviceAccess( wxString& path) {}
1779size_t options::CreatePanel(
const wxString& title) {
1780 size_t id = m_pListbook->GetPageCount();
1783 wxPanel* panel =
new wxPanel(m_pListbook, wxID_ANY, wxDefaultPosition,
1784 wxDefaultSize, wxTAB_TRAVERSAL, title);
1785 m_pListbook->AddPage(panel, title, FALSE,
id);
1789wxScrolledWindow* options::AddPage(
size_t parent,
const wxString& title) {
1790 if (parent > m_pListbook->GetPageCount() - 1) {
1792 wxString::Format(
"Warning: invalid parent in options::AddPage( %d, ",
1797 wxNotebookPage* page = m_pListbook->GetPage(parent);
1799 wxScrolledWindow* sw;
1801 int style = wxVSCROLL | wxTAB_TRAVERSAL;
1802 if ((nb =
dynamic_cast<wxNotebook*
>(page))) {
1804 for (
size_t i_page = 0; i_page < nb->GetPageCount(); i_page++) {
1805 wxString candidate_title = nb->GetPageText(i_page);
1806 if (candidate_title.IsSameAs(title))
1807 return static_cast<wxScrolledWindow*
>(nb->GetPage(i_page));
1810 sw =
new wxScrolledWindow(page, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1812 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1813 nb->AddPage(sw, title);
1814 }
else if ((sw =
dynamic_cast<wxScrolledWindow*
>(page))) {
1815 wxString toptitle = m_pListbook->GetPageText(parent);
1816 wxNotebook* nb =
new wxNotebook(m_pListbook, wxID_ANY, wxDefaultPosition,
1817 wxDefaultSize, wxNB_TOP);
1820 m_pListbook->InsertPage(parent, nb, toptitle, FALSE, parent);
1821 m_pListbook->SetSelection(0);
1822 m_pListbook->RemovePage(parent + 1);
1823 wxString previoustitle = page->GetName();
1825 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
1826 wxNotebookEventHandler(options::OnSubNBPageChange), NULL,
this);
1828 nb->AddPage(page, previoustitle);
1832 sw =
new wxScrolledWindow(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize,
1834 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1835 nb->AddPage(sw, title);
1836 nb->ChangeSelection(0);
1838 sw =
new wxScrolledWindow(m_pListbook, wxID_ANY, wxDefaultPosition,
1839 wxDefaultSize, style, title);
1840 sw->SetScrollRate(m_scrollRate, m_scrollRate);
1841 wxString toptitle = m_pListbook->GetPageText(parent);
1842 m_pListbook->InsertPage(parent, sw, toptitle, FALSE, parent);
1843 m_pListbook->SetSelection(0);
1844 m_pListbook->DeletePage(parent + 1);
1848 sw->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1854bool options::DeletePluginPage(wxScrolledWindow* page) {
1855 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
1856 wxNotebookPage* pg = m_pListbook->GetPage(i);
1857 auto nb =
dynamic_cast<wxNotebook*
>(pg);
1860 for (
size_t j = 0; j < nb->GetPageCount(); j++) {
1861 wxNotebookPage* spg = nb->GetPage(j);
1864 if (nb->GetPageCount() != 1)
return TRUE;
1866 spg = nb->GetPage(0);
1867 spg->Reparent(m_pListbook);
1869 wxString toptitle = m_pListbook->GetPageText(i);
1870 m_pListbook->DeletePage(i);
1871 m_pListbook->InsertPage(i, spg, toptitle, FALSE, i);
1875 }
else if (pg == page) {
1877 m_pListbook->DeletePage(i);
1878 wxPanel* panel =
new wxPanel(m_pListbook);
1879 wxString toptitle = m_pListbook->GetPageText(i);
1880 m_pListbook->InsertPage(i, panel, toptitle, FALSE, i);
1887void options::CreatePanel_NMEA(
size_t position,
int border_size,
1888 int group_item_spacing) {
1889 assert(position < m_pListbook->GetPageCount() &&
1890 "Illegal NMEA window position");
1891 auto panel =
new wxPanel(m_pListbook, wxID_ANY);
1892 wxString title = m_pListbook->GetPageText(position);
1893 m_pListbook->InsertPage(position, panel, title,
false, position);
1894 m_pListbook->SetSelection(0);
1895 m_pListbook->DeletePage(position + 1);
1896 m_pNMEAForm = panel;
1899 auto vbox =
new wxBoxSizer(wxVERTICAL);
1900 vbox->Add(comm_dialog, wxSizerFlags(1).Expand());
1901 m_pNMEAForm->SetSizer(vbox);
1902 m_pNMEAForm->Layout();
1904 comm_dialog->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
1908void options::CreatePanel_Ownship(
size_t parent,
int border_size,
1909 int group_item_spacing) {
1910 itemPanelShip = AddPage(parent, _(
"Own ship"));
1912 ownShip =
new wxBoxSizer(wxVERTICAL);
1913 itemPanelShip->SetSizer(ownShip);
1916 wxStaticBox* osdBox =
1917 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Display Options"));
1918 dispOptions =
new wxStaticBoxSizer(osdBox, wxVERTICAL);
1919 ownShip->Add(dispOptions, 0, wxTOP | wxALL | wxEXPAND, border_size);
1921 wxFlexGridSizer* dispOptionsGrid =
1922 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
1923 dispOptionsGrid->AddGrowableCol(1);
1924 dispOptions->Add(dispOptionsGrid, 0, wxALL | wxEXPAND, border_size);
1926 wxStaticText* pStatic_OSCOG_Predictor =
new wxStaticText(
1927 itemPanelShip, wxID_ANY, _(
"COG Predictor Length (min)"));
1928 dispOptionsGrid->Add(pStatic_OSCOG_Predictor, 0);
1930 m_pText_OSCOG_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1931 dispOptionsGrid->Add(m_pText_OSCOG_Predictor, 0, wxALIGN_RIGHT);
1933 wxStaticText* pStatic_OSHDT_Predictor =
new wxStaticText(
1934 itemPanelShip, wxID_ANY, _(
"Heading Predictor Length (NMi)"));
1935 dispOptionsGrid->Add(pStatic_OSHDT_Predictor, 0);
1937 m_pText_OSHDT_Predictor =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT");
1938 dispOptionsGrid->Add(m_pText_OSHDT_Predictor, 0, wxALIGN_RIGHT);
1940 wxStaticText* iconTypeTxt =
1941 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Ship Icon Type"));
1942 dispOptionsGrid->Add(iconTypeTxt, 0);
1944 wxString iconTypes[] = {_(
"Default"), _(
"Real Scale Bitmap"),
1945 _(
"Real Scale Vector")};
1947 m_pShipIconType =
new wxChoice(
1948 itemPanelShip, ID_SHIPICONTYPE, wxDefaultPosition,
1949 wxSize(GetCharWidth() * 20, GetCharHeight() * 2), 3, iconTypes);
1950 dispOptionsGrid->Add(m_pShipIconType, 0,
1951 wxALIGN_RIGHT | wxLEFT | wxRIGHT | wxTOP,
1952 group_item_spacing);
1954 realSizes =
new wxFlexGridSizer(5, 2, group_item_spacing, group_item_spacing);
1955 realSizes->AddGrowableCol(1);
1957 dispOptions->Add(realSizes, 0, wxEXPAND | wxLEFT, 30);
1960 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Length Over All (m)")), 1,
1962 m_pOSLength =
new wxTextCtrl(itemPanelShip, 1,
"TEXT ");
1963 realSizes->Add(m_pOSLength, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1966 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Width Over All (m)")), 1,
1968 m_pOSWidth =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1969 realSizes->Add(m_pOSWidth, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1972 new wxStaticText(itemPanelShip, wxID_ANY, _(
"GPS Offset from Bow (m)")),
1974 m_pOSGPSOffsetY =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1975 realSizes->Add(m_pOSGPSOffsetY, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1977 realSizes->Add(
new wxStaticText(itemPanelShip, wxID_ANY,
1978 _(
"GPS Offset from Midship (m)")),
1980 m_pOSGPSOffsetX =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1981 realSizes->Add(m_pOSGPSOffsetX, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1984 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Minimum Screen Size (mm)")),
1986 m_pOSMinSize =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"TEXT ");
1987 realSizes->Add(m_pOSMinSize, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
1990 wxFlexGridSizer* rrSelect =
1991 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
1992 rrSelect->AddGrowableCol(1);
1993 dispOptions->Add(rrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
1995 wxStaticText* rrTxt =
1996 new wxStaticText(itemPanelShip, wxID_ANY, _(
"Show range rings"));
1997 rrSelect->Add(rrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
1999 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
2000 "6",
"7",
"8",
"9",
"10"};
2001 pNavAidRadarRingsNumberVisible =
2002 new wxChoice(itemPanelShip, ID_RADARRINGS, wxDefaultPosition,
2003 m_pShipIconType->GetSize(), 11, rrAlt);
2004 rrSelect->Add(pNavAidRadarRingsNumberVisible, 0, wxALIGN_RIGHT | wxALL,
2005 group_item_spacing);
2007 radarGrid =
new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2008 radarGrid->AddGrowableCol(1);
2009 dispOptions->Add(radarGrid, 0, wxLEFT | wxEXPAND, 30);
2011 wxStaticText* distanceText =
2012 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance between rings"));
2013 radarGrid->Add(distanceText, 1, wxEXPAND | wxALL, group_item_spacing);
2015 pNavAidRadarRingsStep =
new wxTextCtrl(itemPanelShip, ID_OPTEXTCTRL,
"",
2016 wxDefaultPosition, wxSize(100, -1), 0);
2017 radarGrid->Add(pNavAidRadarRingsStep, 0, wxALIGN_RIGHT | wxALL,
2018 group_item_spacing);
2020 wxStaticText* unitText =
2021 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Distance Unit"));
2022 radarGrid->Add(unitText, 1, wxEXPAND | wxALL, group_item_spacing);
2024 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers"),
2025 _(
"Minutes (time)")};
2026 m_itemRadarRingsUnits =
2027 new wxChoice(itemPanelShip, ID_RADARDISTUNIT, wxDefaultPosition,
2028 m_pShipIconType->GetSize(), 3, pDistUnitsStrings);
2029 radarGrid->Add(m_itemRadarRingsUnits, 0, wxALIGN_RIGHT | wxALL, border_size);
2031 wxStaticText* colourText =
2032 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Range Ring Color"));
2033 radarGrid->Add(colourText, 1, wxEXPAND | wxALL, group_item_spacing);
2035 m_colourOwnshipRangeRingColour =
2036 new OCPNColourPickerCtrl(itemPanelShip, wxID_ANY, *wxRED,
2037 wxDefaultPosition, m_colourPickerDefaultSize, 0,
2038 wxDefaultValidator,
"ID_COLOUROSRANGECOLOUR");
2039 radarGrid->Add(m_colourOwnshipRangeRingColour, 0, wxALIGN_RIGHT, border_size);
2042 wxFlexGridSizer* shipToActiveGrid =
2043 new wxFlexGridSizer(1, 5, group_item_spacing, group_item_spacing);
2044 shipToActiveGrid->AddGrowableCol(1);
2045 dispOptions->Add(shipToActiveGrid, 0, wxALL | wxEXPAND, border_size);
2046 pShowshipToActive =
new wxCheckBox(itemPanelShip, wxID_ANY,
2047 _(
"Show direction to Active Waypoint"));
2048 shipToActiveGrid->Add(pShowshipToActive, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2051 wxStaticText* shipToActiveText1 =
2052 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Style"));
2053 shipToActiveGrid->Add(shipToActiveText1, 1,
2054 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2056 wxString LineStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
2057 _(
"Long dash"), _(
"Short dash")};
2058 int LineStyleNChoices =
sizeof(LineStyleChoices) /
sizeof(wxString);
2059 m_shipToActiveStyle =
2060 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2061 LineStyleNChoices, LineStyleChoices, 0);
2062 m_shipToActiveStyle->SetSelection(0);
2063 shipToActiveGrid->Add(m_shipToActiveStyle, 0, wxALL, 5);
2065 wxStaticText* shipToActiveText2 =
2066 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Color"));
2067 shipToActiveGrid->Add(shipToActiveText2, 1,
2068 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, border_size);
2070 wxString m_LineColorChoices[] = {
2071 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
2072 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
2073 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
2074 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
2076 int LineColorNChoices =
sizeof(m_LineColorChoices) /
sizeof(wxString);
2077 m_shipToActiveColor =
2078 new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2079 LineColorNChoices, m_LineColorChoices, 0);
2080 m_shipToActiveColor->SetSelection(0);
2081 shipToActiveGrid->Add(m_shipToActiveColor, 0, wxALL, 5);
2084 wxStaticBox* shipdata =
2085 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Ship's information"));
2086 wxStaticBoxSizer* datasizer =
new wxStaticBoxSizer(shipdata, wxVERTICAL);
2087 ownShip->Add(datasizer, 0, wxGROW | wxALL, border_size);
2089 wxFlexGridSizer* ownmmsisizer =
2090 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2091 ownmmsisizer->AddGrowableCol(1);
2092 datasizer->Add(ownmmsisizer, 0, wxALL | wxEXPAND, border_size);
2096 wxStaticText* pStatic_ownshipmmsi =
2097 new wxStaticText(itemPanelShip, wxID_ANY,
2098 _(
"Own ship's MMSI. (If available) Nine digits"));
2099 ownmmsisizer->Add(pStatic_ownshipmmsi, 0);
2102 const wxString AllowDigits[] = {
"0",
"1",
"2",
"3",
"4",
2103 "5",
"6",
"7",
"8",
"9"};
2104 wxArrayString ArrayAllowDigits(10, AllowDigits);
2105 wxTextValidator mmsiVal(wxFILTER_INCLUDE_CHAR_LIST);
2106 mmsiVal.SetIncludes(ArrayAllowDigits);
2107 m_pTxt_OwnMMSI =
new wxTextCtrl(itemPanelShip, wxID_ANY,
"",
2108 wxDefaultPosition, wxDefaultSize, 0, mmsiVal);
2109 ownmmsisizer->Add(m_pTxt_OwnMMSI, 0, wxALIGN_RIGHT);
2112 wxFlexGridSizer* ownshipsizer =
2113 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2114 ownshipsizer->AddGrowableCol(1);
2115 datasizer->Add(ownshipsizer, 0, wxALL | wxEXPAND, border_size);
2117 m_Text_def_boat_speed =
new wxStaticText(
2118 itemPanelShip, wxID_ANY,
2119 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
2121 ownshipsizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
2122 pSDefaultBoatSpeed =
2123 new wxTextCtrl(itemPanelShip, ID_DEFAULT_BOAT_SPEED,
"",
2124 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
2125 ownshipsizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_RIGHT, group_item_spacing);
2128 wxStaticBox* trackText =
2129 new wxStaticBox(itemPanelShip, wxID_ANY, _(
"Tracks"));
2130 wxStaticBoxSizer* trackSizer =
new wxStaticBoxSizer(trackText, wxVERTICAL);
2131 wxBoxSizer* trackSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2132 ownShip->Add(trackSizer, 0, wxGROW | wxALL, border_size);
2134 pTrackDaily =
new wxCheckBox(itemPanelShip, ID_DAILYCHECKBOX,
2135 _(
"Automatic Daily Tracks at midnight"));
2137 trackSizer1->Add(pTrackDaily, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2140 trackSizer1->Add(0, 0, 1, wxEXPAND, 0);
2142#if wxUSE_TIMEPICKCTRL
2143 pTrackDaily->SetLabel(_(
"Automatic Daily Tracks at"));
2146 new TimeCtrl(itemPanelShip, ID_TRACKROTATETIME,
2147 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2148 wxDefaultPosition, wxDefaultSize, 0);
2151 new wxTimePickerCtrl(itemPanelShip, ID_TRACKROTATETIME,
2152 wxDateTime((time_t)g_track_rotate_time).ToUTC(),
2153 wxDefaultPosition, wxDefaultSize, 0);
2155 trackSizer1->Add(pTrackRotateTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2159 pTrackRotateComputerTime =
2160 new wxRadioButton(itemPanelShip, ID_TRACKROTATECOMPUTER, _(
"Computer"),
2161 wxDefaultPosition, wxDefaultSize, 0);
2162 trackSizer1->Add(pTrackRotateComputerTime, 0,
2163 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
2166 new wxRadioButton(itemPanelShip, ID_TRACKROTATEUTC, _(
"UTC"),
2167 wxDefaultPosition, wxDefaultSize, 0);
2168 trackSizer1->Add(pTrackRotateUTC, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2172 new wxRadioButton(itemPanelShip, ID_TRACKROTATELMT, _(
"LMT"),
2173 wxDefaultPosition, wxDefaultSize, 0);
2174 trackSizer1->Add(pTrackRotateLMT, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,
2177 trackSizer->Add(trackSizer1, 1, wxEXPAND | wxALL, border_size);
2179 wxFlexGridSizer* hTrackGrid =
2180 new wxFlexGridSizer(1, 3, group_item_spacing, group_item_spacing);
2181 hTrackGrid->AddGrowableCol(1);
2182 trackSizer->Add(hTrackGrid, 0, wxALL | wxEXPAND, border_size);
2185 new wxCheckBox(itemPanelShip, ID_TRACKHILITE, _(
"Highlight Tracks"));
2186 hTrackGrid->Add(pTrackHighlite, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
2188 wxStaticText* trackColourText =
2189 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Highlight Color"));
2190 hTrackGrid->Add(trackColourText, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,
2192 m_colourTrackLineColour =
new OCPNColourPickerCtrl(
2193 itemPanelShip, wxID_STATIC, *wxRED, wxDefaultPosition,
2194 m_colourPickerDefaultSize, 0, wxDefaultValidator,
"ID_COLOURTRACKCOLOUR");
2195 hTrackGrid->Add(m_colourTrackLineColour, 1, wxALIGN_RIGHT, border_size);
2197 wxFlexGridSizer* pTrackGrid =
2198 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2199 pTrackGrid->AddGrowableCol(1);
2200 trackSizer->Add(pTrackGrid, 0, wxALL | wxEXPAND, border_size);
2202 wxStaticText* tpText =
2203 new wxStaticText(itemPanelShip, wxID_STATIC, _(
"Tracking Precision"));
2204 pTrackGrid->Add(tpText, 1, wxEXPAND | wxALL, group_item_spacing);
2206 wxString trackAlt[] = {_(
"Low"), _(
"Medium"), _(
"High")};
2207 pTrackPrecision =
new wxChoice(itemPanelShip, wxID_ANY, wxDefaultPosition,
2208 m_pShipIconType->GetSize(), 3, trackAlt);
2209 pTrackGrid->Add(pTrackPrecision, 0, wxALIGN_RIGHT | wxALL,
2210 group_item_spacing);
2213void options::CreatePanel_Routes(
size_t parent,
int border_size,
2214 int group_item_spacing) {
2215 itemPanelRoutes = AddPage(parent, _(
"Routes/Points"));
2217 Routes =
new wxBoxSizer(wxVERTICAL);
2218 itemPanelRoutes->SetSizer(Routes);
2220 wxString pDistUnitsStrings[] = {_(
"Nautical miles"), _(
"Kilometers")};
2222 wxString rrAlt[] = {_(
"None"),
"1",
"2",
"3",
"4",
"5",
2223 "6",
"7",
"8",
"9",
"10"};
2226 wxStaticBox* routeText =
2227 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Routes"));
2228 wxStaticBoxSizer* routeSizer =
new wxStaticBoxSizer(routeText, wxVERTICAL);
2229 Routes->Add(routeSizer, 0, wxGROW | wxALL, border_size);
2231 wxStaticBox* activeRouteText =
2232 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Active Route"));
2233 wxStaticBoxSizer* activeRouteSizer =
2234 new wxStaticBoxSizer(activeRouteText, wxVERTICAL);
2236 m_persist_active_route_chkbox =
new wxCheckBox(
2237 itemPanelRoutes, wxID_ANY,
2238 _(
"Persist active route, automatically activate on start up"));
2239 activeRouteSizer->Add(m_persist_active_route_chkbox, 0, wxALL, 5);
2240 Routes->Add(activeRouteSizer, 0, wxGROW | wxALL, border_size);
2242 routeSizer->AddSpacer(5);
2245 wxFlexGridSizer* routepointiconSelect =
2246 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2247 routepointiconSelect->AddGrowableCol(1);
2248 routeSizer->Add(routepointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2251 wxStaticText* routepointiconTxt =
2252 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Waypoint default icon"));
2253 routepointiconSelect->Add(routepointiconTxt, 1, wxEXPAND | wxALL,
2254 group_item_spacing);
2256 pRoutepointDefaultIconChoice =
new OCPNIconCombo(
2257 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2258 0, NULL, wxCB_READONLY);
2259 routepointiconSelect->Add(pRoutepointDefaultIconChoice, 0,
2260 wxALIGN_RIGHT | wxALL, group_item_spacing);
2262 pRoutepointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2265 int min_size = GetCharHeight() * 2;
2266 min_size = wxMax(min_size, (32 * g_MarkScaleFactorExp) + 4);
2267 pRoutepointDefaultIconChoice->SetMinSize(
2268 wxSize(GetCharHeight() * 15, min_size));
2270 routeSizer->AddSpacer(5);
2272 wxFlexGridSizer* pRouteGrid =
2273 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2274 pRouteGrid->AddGrowableCol(1);
2275 routeSizer->Add(pRouteGrid, 0, wxALL | wxEXPAND, border_size);
2277 wxStaticText* raText =
new wxStaticText(itemPanelRoutes, wxID_STATIC,
2278 _(
"Waypoint Arrival Distance (NMi)"));
2279 pRouteGrid->Add(raText, 1, wxEXPAND | wxALL, group_item_spacing);
2281 m_pText_ACRadius =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXT ");
2282 pRouteGrid->Add(m_pText_ACRadius, 0, wxALL | wxALIGN_RIGHT,
2283 group_item_spacing);
2285 pAdvanceRouteWaypointOnArrivalOnly =
2286 new wxCheckBox(itemPanelRoutes, ID_DAILYCHECKBOX,
2287 _(
"Advance route waypoint on arrival only"));
2288 routeSizer->Add(pAdvanceRouteWaypointOnArrivalOnly, 0, wxALL, 5);
2291 Routes->AddSpacer(8 * group_item_spacing);
2293 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2294 wxDefaultSize, wxLI_HORIZONTAL);
2295 Routes->Add(pln, 0, wxEXPAND);
2299 wxStaticBox* waypointText =
2300 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"New Marks"));
2301 wxStaticBoxSizer* waypointSizer =
2302 new wxStaticBoxSizer(waypointText, wxVERTICAL);
2303 Routes->Add(waypointSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2305 waypointSizer->AddSpacer(5);
2308 wxFlexGridSizer* waypointiconSelect =
2309 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2310 waypointiconSelect->AddGrowableCol(1);
2311 waypointSizer->Add(waypointiconSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2314 wxStaticText* waypointiconTxt =
2315 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark default icon"));
2316 waypointiconSelect->Add(waypointiconTxt, 1, wxEXPAND | wxALL,
2317 group_item_spacing);
2319 pWaypointDefaultIconChoice =
new OCPNIconCombo(
2320 itemPanelRoutes, wxID_ANY, _(
"Combo!"), wxDefaultPosition, wxDefaultSize,
2321 0, NULL, wxCB_READONLY);
2322 waypointiconSelect->Add(pWaypointDefaultIconChoice, 0, wxALIGN_RIGHT | wxALL,
2323 group_item_spacing);
2325 pWaypointDefaultIconChoice->SetPopupMaxHeight(::wxGetDisplaySize().y / 2);
2328 int rmin_size = GetCharHeight() * 2;
2329 min_size = wxMax(rmin_size, (32 * g_MarkScaleFactorExp) + 4);
2330 pWaypointDefaultIconChoice->SetMinSize(
2331 wxSize(GetCharHeight() * 15, rmin_size));
2333 waypointSizer->AddSpacer(5);
2335 wxFlexGridSizer* ScaMinSizer =
2336 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2337 ScaMinSizer->AddGrowableCol(1);
2338 waypointSizer->Add(ScaMinSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2340 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2341 _(
"Show marks only at a chartscale greater than 1 :"));
2342 ScaMinSizer->Add(pScaMinChckB, 0);
2343 m_pText_ScaMin =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2344 ScaMinSizer->Add(m_pText_ScaMin, 0, wxALL | wxALIGN_RIGHT,
2345 group_item_spacing);
2347 wxFlexGridSizer* ScaMaxSizer =
2348 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2349 ScaMaxSizer->AddGrowableCol(1);
2350 waypointSizer->Add(ScaMaxSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, border_size);
2351 wxStaticText* scaMaxLabel =
2352 new wxStaticText(itemPanelRoutes, wxID_ANY,
2353 _(
"Show marks only at a chartscale smaller than 1 :"));
2354 ScaMaxSizer->Add(scaMaxLabel, 0);
2355 m_pText_ScaMax =
new wxTextCtrl(itemPanelRoutes, -1,
"TEXTTEXTTEXT");
2356 ScaMaxSizer->Add(m_pText_ScaMax, 0, wxALL | wxALIGN_RIGHT,
2357 group_item_spacing);
2360 pScaMinOverruleChckB =
2361 new wxCheckBox(itemPanelRoutes, wxID_ANY,
2362 _(
"Override the settings for chartscale based visibility "
2363 "and show always"));
2364 waypointSizer->Add(pScaMinOverruleChckB, 0, wxALL, 5);
2366 waypointSizer->AddSpacer(5);
2368 wxFlexGridSizer* waypointrrSelect =
2369 new wxFlexGridSizer(1, 2, group_item_spacing, group_item_spacing);
2370 waypointrrSelect->AddGrowableCol(1);
2371 waypointSizer->Add(waypointrrSelect, 0, wxLEFT | wxRIGHT | wxEXPAND,
2374 wxStaticText* waypointrrTxt =
2375 new wxStaticText(itemPanelRoutes, wxID_ANY, _(
"Mark range rings"));
2376 waypointrrSelect->Add(waypointrrTxt, 1, wxEXPAND | wxALL, group_item_spacing);
2378 pWaypointRangeRingsNumber =
2379 new wxChoice(itemPanelRoutes, ID_OPWAYPOINTRANGERINGS, wxDefaultPosition,
2380 m_pShipIconType->GetSize(), 11, rrAlt);
2381 waypointrrSelect->Add(pWaypointRangeRingsNumber, 0, wxALIGN_RIGHT | wxALL,
2382 group_item_spacing);
2385 new wxFlexGridSizer(0, 2, group_item_spacing, group_item_spacing);
2386 waypointradarGrid->AddGrowableCol(1);
2387 waypointSizer->Add(waypointradarGrid, 0, wxLEFT | wxEXPAND, 30);
2389 wxStaticText* waypointdistanceText =
new wxStaticText(
2390 itemPanelRoutes, wxID_STATIC, _(
"Distance between rings"));
2391 waypointradarGrid->Add(waypointdistanceText, 1, wxEXPAND | wxALL,
2392 group_item_spacing);
2394 pWaypointRangeRingsStep =
2395 new wxTextCtrl(itemPanelRoutes, ID_OPTEXTCTRL,
"", wxDefaultPosition,
2396 wxSize(100, -1), 0);
2397 waypointradarGrid->Add(pWaypointRangeRingsStep, 0, wxALIGN_RIGHT | wxALL,
2398 group_item_spacing);
2400 wxStaticText* waypointunitText =
2401 new wxStaticText(itemPanelRoutes, wxID_STATIC, _(
"Distance Unit"));
2402 waypointradarGrid->Add(waypointunitText, 1, wxEXPAND | wxALL,
2403 group_item_spacing);
2405 m_itemWaypointRangeRingsUnits =
2406 new wxChoice(itemPanelRoutes, ID_RADARDISTUNIT, wxDefaultPosition,
2407 m_pShipIconType->GetSize(), 2, pDistUnitsStrings);
2408 waypointradarGrid->Add(m_itemWaypointRangeRingsUnits, 0,
2409 wxALIGN_RIGHT | wxALL, border_size);
2411 wxStaticText* waypointrangeringsColour =
new wxStaticText(
2412 itemPanelRoutes, wxID_STATIC, _(
"Waypoint Range Ring Colors"));
2413 waypointradarGrid->Add(waypointrangeringsColour, 1, wxEXPAND | wxALL, 1);
2415 m_colourWaypointRangeRingsColour =
new OCPNColourPickerCtrl(
2416 itemPanelRoutes, wxID_ANY, *wxRED, wxDefaultPosition,
2417 m_colourPickerDefaultSize, 0, wxDefaultValidator,
2418 "ID_COLOURWAYPOINTRANGERINGSCOLOUR");
2419 waypointradarGrid->Add(m_colourWaypointRangeRingsColour, 0,
2420 wxALIGN_RIGHT | wxALL, 1);
2425 Routes->AddSpacer(8 * group_item_spacing);
2426 wxStaticLine* pln1 =
2427 new wxStaticLine(itemPanelRoutes, wxID_ANY, wxDefaultPosition,
2428 wxDefaultSize, wxLI_HORIZONTAL);
2429 Routes->Add(pln1, 0, wxEXPAND);
2432 wxStaticBox* waypointControl =
2433 new wxStaticBox(itemPanelRoutes, wxID_ANY, _(
"Control Options"));
2434 wxStaticBoxSizer* ControlSizer =
2435 new wxStaticBoxSizer(waypointControl, wxVERTICAL);
2436 Routes->Add(ControlSizer, 0, wxTOP | wxALL | wxEXPAND, border_size);
2438 ControlSizer->AddSpacer(5);
2440 pWayPointPreventDragging =
new wxCheckBox(
2441 itemPanelRoutes, ID_DRAGGINGCHECKBOX,
2442 _(
"Lock marks and waypoints (Unless object property dialog visible)"));
2443 pWayPointPreventDragging->SetValue(FALSE);
2444 ControlSizer->Add(pWayPointPreventDragging, verticleInputFlags);
2446 pConfirmObjectDeletion =
2447 new wxCheckBox(itemPanelRoutes, ID_DELETECHECKBOX,
2448 _(
"Confirm deletion of tracks and routes"));
2449 pConfirmObjectDeletion->SetValue(FALSE);
2450 ControlSizer->Add(pConfirmObjectDeletion, verticleInputFlags);
2451 ControlSizer->AddSpacer(5);
2454 pWaypointDefaultIconChoice->Clear();
2456 bool fillCombo =
true;
2459 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2460 wxString* ps = pWayPointMan->GetIconDescription(i);
2461 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2463 pWaypointDefaultIconChoice->Append(*ps, bmp);
2468 int iconToSelect = -1;
2469 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2470 if (*pWayPointMan->GetIconKey(i) == g_default_wp_icon) {
2472 pWaypointDefaultIconChoice->Select(iconToSelect);
2478 pRoutepointDefaultIconChoice->Clear();
2483 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2484 wxString* ps = pWayPointMan->GetIconDescription(i);
2485 wxBitmap bmp = pWayPointMan->GetIconBitmapForList(i, 2 * GetCharHeight());
2487 pRoutepointDefaultIconChoice->Append(*ps, bmp);
2493 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
2494 if (*pWayPointMan->GetIconKey(i) == g_default_routepoint_icon) {
2496 pRoutepointDefaultIconChoice->Select(iconToSelect);
2504void options::CreatePanel_ChartsLoad(
size_t parent,
int border_size,
2505 int group_item_spacing) {
2506 chartPanelWin = AddPage(m_pageCharts, _(
"Chart Files"));
2508 chartPanel =
new wxBoxSizer(wxVERTICAL);
2509 chartPanelWin->SetSizer(chartPanel);
2511 loadedBox =
new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Directories"));
2512 activeSizer =
new wxStaticBoxSizer(loadedBox, wxHORIZONTAL);
2513 chartPanel->Add(activeSizer, 1, wxALL | wxEXPAND, border_size);
2515 m_scrollWinChartList =
new wxScrolledWindow(
2516 chartPanelWin, wxID_ANY, wxDefaultPosition,
2517 wxDLG_UNIT(
this, wxSize(-1, -1)), wxBORDER_RAISED | wxVSCROLL);
2519 activeSizer->Add(m_scrollWinChartList, 1, wxALL | wxEXPAND, 5);
2526 m_scrollWinChartList->SetScrollRate(m_scrollRate, m_scrollRate);
2528 boxSizerCharts =
new wxBoxSizer(wxVERTICAL);
2529 m_scrollWinChartList->SetSizer(boxSizerCharts);
2531 cmdButtonSizer =
new wxBoxSizer(wxVERTICAL);
2532 activeSizer->Add(cmdButtonSizer, 0, wxALL, border_size);
2534 wxString b1 = _(
"Add Directory...");
2535 wxString b2 = _(
"Remove Selected");
2536 wxString b3 = _(
"Compress Selected");
2544 wxButton* addBtn =
new wxButton(chartPanelWin, ID_BUTTONADD, b1);
2545 cmdButtonSizer->Add(addBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2547 cmdButtonSizer->AddSpacer(GetCharHeight());
2549 m_removeBtn =
new wxButton(chartPanelWin, ID_BUTTONDELETE, b2);
2550 cmdButtonSizer->Add(m_removeBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2551 m_removeBtn->Disable();
2553 cmdButtonSizer->AddSpacer(GetCharHeight());
2556 m_compressBtn =
new wxButton(chartPanelWin, ID_BUTTONCOMPRESS, b3);
2557 cmdButtonSizer->Add(m_compressBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2558 m_compressBtn->Disable();
2560 m_compressBtn = NULL;
2564 if (g_Android_SDK_Version >= 30) {
2566 new wxButton(chartPanelWin, ID_BUTTONMIGRATE, _(
"Migrate Charts.."));
2567 cmdButtonSizer->Add(m_migrateBtn, 1, wxALL | wxEXPAND, group_item_spacing);
2571 cmdButtonSizer->AddSpacer(GetCharHeight());
2573 wxStaticBox* itemStaticBoxUpdateStatic =
2574 new wxStaticBox(chartPanelWin, wxID_ANY, _(
"Update Control"));
2575 wxStaticBoxSizer* itemStaticBoxSizerUpdate =
2576 new wxStaticBoxSizer(itemStaticBoxUpdateStatic, wxVERTICAL);
2577 chartPanel->Add(itemStaticBoxSizerUpdate, 0, wxGROW | wxALL, 5);
2579 wxFlexGridSizer* itemFlexGridSizerUpdate =
new wxFlexGridSizer(1);
2580 itemFlexGridSizerUpdate->SetFlexibleDirection(wxHORIZONTAL);
2582 pScanCheckBox =
new wxCheckBox(chartPanelWin, ID_SCANCHECKBOX,
2583 _(
"Scan Charts and Update Database"));
2584 itemFlexGridSizerUpdate->Add(pScanCheckBox, 1, wxALL, 5);
2586 pUpdateCheckBox =
new wxCheckBox(chartPanelWin, ID_UPDCHECKBOX,
2587 _(
"Force Full Database Rebuild"));
2589 pUpdateCheckBox->Hide();
2591 pRebuildChartDatabase =
new wxButton(chartPanelWin, ID_REBUILDBUTTON,
2592 _(
"Rebuild Chart Database"));
2593 itemFlexGridSizerUpdate->Add(pRebuildChartDatabase, 1, wxALL, 5);
2595 pParseENCButton =
new wxButton(chartPanelWin, ID_PARSEENCBUTTON,
2596 _(
"Prepare all ENC Charts"));
2597 itemFlexGridSizerUpdate->Add(pParseENCButton, 1, wxALL, 5);
2599 itemStaticBoxSizerUpdate->Add(itemFlexGridSizerUpdate, 1, wxEXPAND, 5);
2602 ActiveChartArray.Clear();
2603 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
2604 ActiveChartArray.Add(m_CurrentDirList[i]);
2607 UpdateChartDirList();
2609 chartPanel->Layout();
2612void options::UpdateChartDirList() {
2614 m_scrollWinChartList->GetSizer()->Clear(
true);
2615 m_scrollWinChartList->ClearBackground();
2617 panelVector.clear();
2620 for (
size_t i = 0; i < ActiveChartArray.GetCount(); i++) {
2621 OCPNChartDirPanel* chartPanel =
2622 new OCPNChartDirPanel(m_scrollWinChartList, wxID_ANY, wxDefaultPosition,
2623 wxSize(-1, -1), ActiveChartArray[i]);
2624 chartPanel->SetSelected(
false);
2626 m_scrollWinChartList->GetSizer()->Add(chartPanel, 0, wxEXPAND | wxALL, 0);
2628 panelVector.push_back(chartPanel);
2631 m_scrollWinChartList->GetSizer()->Layout();
2633 chartPanelWin->ClearBackground();
2634 chartPanelWin->Layout();
2643 wxSize sza = GetSize();
2648 m_scrollWinChartList->GetParent()->Layout();
2651 m_scrollWinChartList->Scroll(0, 0);
2654void options::UpdateTemplateTitleText() {
2655 if (!m_templateTitleText)
return;
2657 wxString activeTitle;
2658 if (!g_lastAppliedTemplateGUID.IsEmpty()) {
2659 activeTitle = ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2661 bool configCompare =
2662 ConfigMgr::Get().CheckTemplateGUID(g_lastAppliedTemplateGUID);
2663 if (!configCompare) activeTitle += _(
" [Modified]");
2664 m_templateTitleText->SetLabel(activeTitle);
2666 m_templateTitleText->SetLabel(_(
"None"));
2669void options::CreatePanel_Configs(
size_t parent,
int border_size,
2670 int group_item_spacing) {
2671 m_DisplayConfigsPage = AddPage(parent, _(
"Templates"));
2677 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2678 m_DisplayConfigsPage->SetSizer(wrapperSizer);
2682 wxStaticBox* templateStatusBox =
2683 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Template Status"));
2684 m_templateStatusBoxSizer =
2685 new wxStaticBoxSizer(templateStatusBox, wxHORIZONTAL);
2686 wrapperSizer->Add(m_templateStatusBoxSizer, 1, wxALL | wxEXPAND,
2689 wxBoxSizer* statSizer =
new wxBoxSizer(wxVERTICAL);
2690 m_templateStatusBoxSizer->Add(statSizer, 0, wxALL | wxEXPAND, border_size);
2692 m_staticTextLastAppled =
new wxStaticText(
2693 m_DisplayConfigsPage, wxID_ANY, _(
"Last Applied Template Title:"));
2694 m_staticTextLastAppled->Hide();
2696 statSizer->Add(m_staticTextLastAppled);
2698 m_templateTitleText =
2699 new wxStaticText(m_DisplayConfigsPage, wxID_ANY, wxEmptyString);
2700 statSizer->Add(m_templateTitleText);
2701 m_templateTitleText->Hide();
2703 UpdateTemplateTitleText();
2705 wxStaticBox* configsBox =
2706 new wxStaticBox(m_DisplayConfigsPage, wxID_ANY, _(
"Saved Templates"));
2707 wxStaticBoxSizer* configSizer =
2708 new wxStaticBoxSizer(configsBox, wxHORIZONTAL);
2709 wrapperSizer->Add(configSizer, 4, wxALL | wxEXPAND, border_size);
2711 wxPanel* cPanel =
new wxPanel(m_DisplayConfigsPage, wxID_ANY);
2712 configSizer->Add(cPanel, 1, wxALL | wxEXPAND, border_size);
2714 wxBoxSizer* boxSizercPanel =
new wxBoxSizer(wxVERTICAL);
2715 cPanel->SetSizer(boxSizercPanel);
2717 m_scrollWinConfigList =
2718 new wxScrolledWindow(cPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
2719 wxBORDER_RAISED | wxVSCROLL);
2720 m_scrollWinConfigList->SetScrollRate(1, 1);
2721 boxSizercPanel->Add(m_scrollWinConfigList, 0, wxALL | wxEXPAND,
2723 m_scrollWinConfigList->SetMinSize(wxSize(-1, 15 * GetCharHeight()));
2725 m_boxSizerConfigs =
new wxBoxSizer(wxVERTICAL);
2726 m_scrollWinConfigList->SetSizer(m_boxSizerConfigs);
2728 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
2729 configSizer->Add(btnSizer);
2732 wxButton* createButton =
2733 new wxButton(m_DisplayConfigsPage, wxID_ANY, _(
"Create Config..."));
2734 btnSizer->Add(createButton, 1, wxALL | wxEXPAND, group_item_spacing);
2735 createButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2736 wxCommandEventHandler(options::OnCreateConfig), NULL,
2744 m_configDeleteButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2745 _(
"Delete Selected Config..."));
2746 btnSizer->Add(m_configDeleteButton, 1, wxALL | wxEXPAND,
2747 group_item_spacing);
2748 m_configDeleteButton->Connect(
2749 wxEVT_COMMAND_BUTTON_CLICKED,
2750 wxCommandEventHandler(options::OnDeleteConfig), NULL,
this);
2752 m_configApplyButton =
new wxButton(m_DisplayConfigsPage, wxID_ANY,
2753 _(
"Apply Selected Config"));
2754 btnSizer->Add(m_configApplyButton, 1, wxALL | wxEXPAND, group_item_spacing);
2755 m_configApplyButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
2756 wxCommandEventHandler(options::OnApplyConfig),
2763 SetConfigButtonState();
2767void options::ClearConfigList() {
2768 if (m_scrollWinConfigList) {
2769 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2770 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2771 wxWindowList::compatibility_iterator node = kids.Item(i);
2772 wxWindow* win = node->GetData();
2773 auto pcp =
dynamic_cast<wxPanel*
>(win);
2775 auto cPanel =
dynamic_cast<ConfigPanel*
>(pcp);
2782 SetConfigButtonState();
2785void options::BuildConfigList() {
2786 wxArrayString configGUIDs = ConfigMgr::Get().GetConfigGUIDArray();
2788 for (
size_t i = 0; i < configGUIDs.GetCount(); i++) {
2790 ConfigMgr::Get().GetConfigPanel(m_scrollWinConfigList, configGUIDs[i]);
2792 m_panelBackgroundUnselected = pp->GetBackgroundColour();
2793 m_boxSizerConfigs->Add(pp, 1, wxEXPAND);
2794 pp->Connect(wxEVT_LEFT_DOWN,
2795 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2799 wxWindowList kids = pp->GetChildren();
2800 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2801 wxWindowList::compatibility_iterator node = kids.Item(i);
2802 wxWindow* win = node->GetData();
2803 win->Connect(wxEVT_LEFT_DOWN,
2804 wxMouseEventHandler(options::OnConfigMouseSelected), NULL,
2810 m_boxSizerConfigs->Layout();
2812 m_selectedConfigPanelGUID =
"";
2813 SetConfigButtonState();
2816void options::SetConfigButtonState() {
2817 m_configDeleteButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2818 if (m_selectedConfigPanelGUID.StartsWith(
2820 m_configDeleteButton->Disable();
2821 m_configApplyButton->Enable(!m_selectedConfigPanelGUID.IsEmpty());
2824void options::OnCreateConfig(wxCommandEvent& event) {
2825 ConfigCreateDialog* pd =
new ConfigCreateDialog(
2826 this, -1, _(
"Create Config"), wxDefaultPosition, wxSize(200, 200));
2828 pd->ShowWindowModalThenDo([
this, pd](
int retcode) {
2829 if (retcode == wxID_OK) {
2830 g_lastAppliedTemplateGUID = pd->GetCreatedTemplateGUID();
2831 UpdateTemplateTitleText();
2835 m_DisplayConfigsPage->Layout();
2837 SetConfigButtonState();
2841void options::OnEditConfig(wxCommandEvent& event) {}
2843void options::OnDeleteConfig(wxCommandEvent& event) {
2844 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2846 ConfigMgr::Get().DeleteConfig(m_selectedConfigPanelGUID);
2847 m_selectedConfigPanelGUID =
"";
2852 m_DisplayConfigsPage->Layout();
2853 SetConfigButtonState();
2856void options::OnApplyConfig(wxCommandEvent& event) {
2857 if (m_selectedConfigPanelGUID.IsEmpty())
return;
2860 wxString currentLocale = g_locale;
2864 evt.SetId(ID_APPLY);
2868 bool bApplyStat = ConfigMgr::Get().ApplyConfigGUID(m_selectedConfigPanelGUID);
2872 g_lastAppliedTemplateGUID = m_selectedConfigPanelGUID;
2873 wxString activeTitle =
2874 ConfigMgr::Get().GetTemplateTitle(g_lastAppliedTemplateGUID);
2875 m_templateTitleText->SetLabel(activeTitle);
2876 m_templateTitleText->Show();
2877 m_staticTextLastAppled->Show();
2878 m_templateStatusBoxSizer->Layout();
2880 OCPNMessageBox(
this, _(
"Problem applying selected configuration."),
2881 _(
"OpenCPN Info"), wxOK);
2884 if (m_scrollWinConfigList) {
2885 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2886 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2887 wxWindowList::compatibility_iterator node = kids.Item(i);
2888 wxWindow* win = node->GetData();
2889 auto pcp =
dynamic_cast<wxPanel*
>(win);
2891 auto cPanel =
dynamic_cast<ConfigPanel*
>(pcp);
2893 cPanel->SetBackgroundColour(m_panelBackgroundUnselected);
2898 m_selectedConfigPanelGUID = wxEmptyString;
2900 m_returnChanges |= CONFIG_CHANGED;
2902 if (!currentLocale.IsSameAs(g_locale)) m_returnChanges |= LOCALE_CHANGED;
2907void options::OnConfigMouseSelected(wxMouseEvent& event) {
2908 wxPanel* selectedPanel = NULL;
2909 wxObject* obj =
event.GetEventObject();
2911 auto panel =
dynamic_cast<wxPanel*
>(obj);
2913 selectedPanel = panel;
2917 auto win =
dynamic_cast<wxWindow*
>(obj);
2919 auto parentpanel =
dynamic_cast<wxPanel*
>(win->GetParent());
2921 selectedPanel = parentpanel;
2926 if (m_scrollWinConfigList) {
2927 wxWindowList kids = m_scrollWinConfigList->GetChildren();
2928 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
2929 wxWindowList::compatibility_iterator node = kids.Item(i);
2930 wxWindow* win = node->GetData();
2931 auto panel =
dynamic_cast<wxPanel*
>(win);
2933 if (panel == selectedPanel) {
2934 panel->SetBackgroundColour(wxSystemSettings::GetColour(
2935 wxSystemColour::wxSYS_COLOUR_HIGHLIGHT));
2936 auto cPanel =
dynamic_cast<ConfigPanel*
>(panel);
2937 if (cPanel) m_selectedConfigPanelGUID = cPanel->GetConfigGUID();
2939 panel->SetBackgroundColour(m_panelBackgroundUnselected);
2941 panel->Refresh(
true);
2945 m_DisplayConfigsPage->Layout();
2946 SetConfigButtonState();
2950void options::CreatePanel_Advanced(
size_t parent,
int border_size,
2951 int group_item_spacing) {
2952 m_ChartDisplayPage = AddPage(parent, _(
"Advanced"));
2958 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
2959 m_ChartDisplayPage->SetSizer(wrapperSizer);
2961 wxBoxSizer* itemBoxSizerUI = wrapperSizer;
2964 itemBoxSizerUI->Add(0, border_size * 3);
2965 itemBoxSizerUI->Add(0, border_size * 3);
2968 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
2969 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
2971 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
2972 _(
"De-skew Raster Charts"));
2973 boxCharts->Add(pSkewComp, inputFlags);
2975 itemBoxSizerUI->Add(0, border_size * 3);
2976 itemBoxSizerUI->Add(0, border_size * 3);
2980 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxVERTICAL);
2981 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
2983 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
2984 _(
"Use Accelerated Graphics (OpenGL)"));
2985 OpenGLSizer->Add(pOpenGL, inputFlags);
2986 pOpenGL->Enable(!g_bdisable_opengl &&
g_Platform->IsGLCapable());
2988 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
2989 _(
"OpenGL Options") +
"...");
2990 OpenGLSizer->Add(bOpenGL, inputFlags);
2992 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
2993 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
2998 itemBoxSizerUI->Add(0, border_size * 3);
2999 itemBoxSizerUI->Add(0, border_size * 3);
3003 wxStaticText* crat =
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3004 _(
"Chart Rotation Averaging Time"));
3006 wrapperSizer->Add(crat, 0,
3007 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3008 group_item_spacing);
3010 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3011 wrapperSizer->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND, group_item_spacing);
3014 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3015 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3016 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALIGN_RIGHT | wxALL,
3017 group_item_spacing);
3019 pCOGUPFilterRow->Add(
3020 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3023 itemBoxSizerUI->Add(0, border_size * 3);
3024 itemBoxSizerUI->Add(0, border_size * 3);
3027 wxStaticText* zoomTextHead =
new wxStaticText(
3028 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3029 zoomTextHead->Wrap(-1);
3030 itemBoxSizerUI->Add(
3032 wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
3033 group_item_spacing);
3034 itemBoxSizerUI->Add(0, border_size * 1);
3036 itemBoxSizerUI->Add(
3037 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3040 m_pSlider_Zoom_Raster =
3041 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3042 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3045 prepareSlider(m_pSlider_Zoom_Raster);
3048 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3050 itemBoxSizerUI->Add(
3051 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3054 m_pSlider_Zoom_Vector =
3055 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3056 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3059 prepareSlider(m_pSlider_Zoom_Vector);
3062 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3064 itemBoxSizerUI->Add(
3065 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3067 m_pSlider_CM93_Zoom =
3068 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3069 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3070 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3073 prepareSlider(m_pSlider_CM93_Zoom);
3076 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3078 itemBoxSizerUI->Add(0, border_size * 3);
3079 itemBoxSizerUI->Add(0, border_size * 3);
3080 itemBoxSizerUI->Add(0, border_size * 3);
3084 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3085 _(
"Physical Screen Width")),
3087 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3088 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3090 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3091 pDPIRow->Add(pRBSizeAuto, inputFlags);
3092 pDPIRow->AddSpacer(10);
3093 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3094 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3095 pDPIRow->Add(pRBSizeManual, inputFlags);
3097 wxBoxSizer* pmmRow =
new wxBoxSizer(wxHORIZONTAL);
3098 itemBoxSizerUI->Add(pmmRow, 0, wxEXPAND);
3101 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3102 wxSize(sz.x / 5, -1), wxTE_RIGHT);
3103 pmmRow->Add(pScreenMM, 0, wxALIGN_RIGHT | wxALL, group_item_spacing);
3105 pmmRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3109 itemBoxSizerUI->Add(
3110 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3112 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3113 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3115 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3116 _(
"Show extended chart bar information."));
3117 ChartBarSizer->Add(pChartBarEX, inputFlags);
3120 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3121 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3123 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3124 wxCommandEventHandler(options::OnSizeManualButton),
3130 wxFlexGridSizer* itemBoxSizerUI =
new wxFlexGridSizer(2);
3131 itemBoxSizerUI->SetHGap(border_size);
3138 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
3139 m_ChartDisplayPage->SetSizer(wrapperSizer);
3140 wrapperSizer->Add(itemBoxSizerUI, 1, wxALL | wxALIGN_CENTER, border_size);
3143 itemBoxSizerUI->Add(0, border_size * 3);
3144 itemBoxSizerUI->Add(0, border_size * 3);
3147 itemBoxSizerUI->Add(
3148 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Display")),
3150 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
3151 itemBoxSizerUI->Add(boxCharts, groupInputFlags);
3153 pSkewComp =
new wxCheckBox(m_ChartDisplayPage, ID_SKEWCOMPBOX,
3154 _(
"Show Skewed Raster Charts as North-Up"));
3155 boxCharts->Add(pSkewComp, verticleInputFlags);
3173 itemBoxSizerUI->Add(0, border_size * 3);
3174 itemBoxSizerUI->Add(0, border_size * 3);
3177 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3178 _(
"Chart Rotation Averaging Time")),
3180 wxBoxSizer* pCOGUPFilterRow =
new wxBoxSizer(wxHORIZONTAL);
3181 itemBoxSizerUI->Add(pCOGUPFilterRow, 0, wxALL | wxEXPAND,
3182 group_item_spacing);
3185 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3186 wxSize(50, -1), wxTE_RIGHT);
3187 pCOGUPFilterRow->Add(pCOGUPUpdateSecs, 0, wxALL, group_item_spacing);
3189 pCOGUPFilterRow->Add(
3190 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"seconds")),
3194 itemBoxSizerUI->Add(0, border_size * 8);
3195 itemBoxSizerUI->Add(0, border_size * 8);
3198 wxStaticText* zoomTextHead =
new wxStaticText(
3199 m_ChartDisplayPage, wxID_ANY, _(
"Chart Zoom/Scale Weighting"));
3201 itemBoxSizerUI->Add(zoomTextHead, labelFlags);
3202 itemBoxSizerUI->Add(0, border_size * 1);
3203 itemBoxSizerUI->Add(0, border_size * 1);
3205 wxStaticText* zoomText =
new wxStaticText(
3206 m_ChartDisplayPage, wxID_ANY,
3207 _(
"With a lower value, the same zoom level shows a less detailed chart.\n\
3208With a higher value, the same zoom level shows a more detailed chart."));
3210 smallFont = *dialogFont;
3212 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
3214 zoomText->SetFont(smallFont);
3215 itemBoxSizerUI->Add(zoomText, 0, wxALL | wxEXPAND, group_item_spacing);
3223 itemBoxSizerUI->Add(
3224 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Raster")),
3226 m_pSlider_Zoom_Raster =
3227 new wxSlider(m_ChartDisplayPage, ID_RASTERZOOM, 0, -5, 5,
3228 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3231 prepareSlider(m_pSlider_Zoom_Raster);
3234 itemBoxSizerUI->Add(m_pSlider_Zoom_Raster, inputFlags);
3236 itemBoxSizerUI->Add(
3237 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Vector")),
3239 m_pSlider_Zoom_Vector =
3240 new wxSlider(m_ChartDisplayPage, ID_VECZOOM, 0, -5, 5,
3241 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3244 prepareSlider(m_pSlider_Zoom_Vector);
3247 itemBoxSizerUI->Add(m_pSlider_Zoom_Vector, inputFlags);
3250 itemBoxSizerUI->Add(0, border_size * 3);
3251 itemBoxSizerUI->Add(0, border_size * 3);
3253 itemBoxSizerUI->Add(
3254 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"CM93 Detail level")),
3256 m_pSlider_CM93_Zoom =
3257 new wxSlider(m_ChartDisplayPage, ID_CM93ZOOM, 0,
3258 -CM93_ZOOM_FACTOR_MAX_RANGE, CM93_ZOOM_FACTOR_MAX_RANGE,
3259 wxDefaultPosition, m_sliderSize, SLIDER_STYLE);
3262 prepareSlider(m_pSlider_CM93_Zoom);
3265 itemBoxSizerUI->Add(m_pSlider_CM93_Zoom, 0, wxALL, border_size);
3268 itemBoxSizerUI->Add(0, border_size * 3);
3269 itemBoxSizerUI->Add(0, border_size * 3);
3270 itemBoxSizerUI->Add(0, border_size * 3);
3271 itemBoxSizerUI->Add(0, border_size * 3);
3272 itemBoxSizerUI->Add(0, border_size * 3);
3273 itemBoxSizerUI->Add(0, border_size * 3);
3277 itemBoxSizerUI->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY,
3278 _(
"Physical Screen Width")),
3280 wxBoxSizer* pDPIRow =
new wxBoxSizer(wxHORIZONTAL);
3281 itemBoxSizerUI->Add(pDPIRow, 0, wxEXPAND);
3283 pRBSizeAuto =
new wxRadioButton(m_ChartDisplayPage, wxID_ANY, _(
"Auto"));
3284 pDPIRow->Add(pRBSizeAuto, inputFlags);
3285 pDPIRow->AddSpacer(10);
3286 pRBSizeManual =
new wxRadioButton(m_ChartDisplayPage,
3287 ID_SIZEMANUALRADIOBUTTON, _(
"Manual:"));
3288 pDPIRow->Add(pRBSizeManual, inputFlags);
3291 new wxTextCtrl(m_ChartDisplayPage, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3292 wxSize(3 * m_fontHeight, -1), wxTE_RIGHT);
3293 pDPIRow->Add(pScreenMM, 0, wxALL, group_item_spacing);
3295 pDPIRow->Add(
new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"mm")),
3298 pRBSizeAuto->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3299 wxCommandEventHandler(options::OnSizeAutoButton), NULL,
3301 pRBSizeManual->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
3302 wxCommandEventHandler(options::OnSizeManualButton),
3306 itemBoxSizerUI->Add(0, border_size * 3);
3307 itemBoxSizerUI->Add(0, border_size * 3);
3312 itemBoxSizerUI->Add(
3313 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Graphics")),
3315 wxBoxSizer* OpenGLSizer =
new wxBoxSizer(wxHORIZONTAL);
3316 itemBoxSizerUI->Add(OpenGLSizer, 0, 0, 0);
3318 pOpenGL =
new wxCheckBox(m_ChartDisplayPage, ID_OPENGLBOX,
3319 _(
"Use Accelerated Graphics (OpenGL)"));
3320 OpenGLSizer->Add(pOpenGL, inputFlags);
3321 pOpenGL->Enable(!g_bdisable_opengl &&
g_Platform->IsGLCapable());
3323 pOpenGL->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
3324 wxCommandEventHandler(options::OnGLClicked), NULL,
this);
3330 auto* bOpenGL =
new wxButton(m_ChartDisplayPage, ID_OPENGLOPTIONS,
3331 _(
"Options") +
"...");
3332 OpenGLSizer->Add(bOpenGL, inputFlags);
3335 itemBoxSizerUI->Add(0, border_size * 3);
3336 itemBoxSizerUI->Add(0, border_size * 3);
3341 itemBoxSizerUI->Add(
3342 new wxStaticText(m_ChartDisplayPage, wxID_ANY, _(
"Chart Bar")),
3344 wxBoxSizer* ChartBarSizer =
new wxBoxSizer(wxHORIZONTAL);
3345 itemBoxSizerUI->Add(ChartBarSizer, 0, 0, 0);
3347 pChartBarEX =
new wxCheckBox(m_ChartDisplayPage, -1,
3348 _(
"Show extended chart bar information."));
3349 ChartBarSizer->Add(pChartBarEX, inputFlags);
3361 m_ChartDisplayPage->Fit();
3365void options::CreatePanel_VectorCharts(
size_t parent,
int border_size,
3366 int group_item_spacing) {
3367 ps57Ctl = AddPage(parent, _(
"Vector Chart Display"));
3370 vectorPanel =
new wxBoxSizer(wxHORIZONTAL);
3371 ps57Ctl->SetSizer(vectorPanel);
3374 wxFlexGridSizer* optionsColumn =
new wxFlexGridSizer(2);
3375 optionsColumn->SetHGap(border_size);
3376 optionsColumn->AddGrowableCol(0, 2);
3377 optionsColumn->AddGrowableCol(1, 3);
3378 vectorPanel->Add(optionsColumn, 3, wxALL | wxEXPAND, border_size);
3381 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3382 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3387 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3389 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3390 _(
"Mariner's Standard")};
3391 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3392 wxDefaultSize, 4, pDispCatStrings);
3393 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3397 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3398 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3401 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""),
3404 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3405 optionsColumn->Add(miscSizer, groupInputFlags);
3409 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3410 pCheck_SOUNDG->SetValue(FALSE);
3411 miscSizer->Add(pCheck_SOUNDG, verticleInputFlags);
3414 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3415 _(
"Chart Information Objects"));
3416 pCheck_META->SetValue(FALSE);
3417 miscSizer->Add(pCheck_META, verticleInputFlags);
3420 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Buoys/Lights")),
3423 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3424 optionsColumn->Add(lightSizer, groupInputFlags);
3427 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3428 pCheck_ATONTEXT->SetValue(FALSE);
3429 lightSizer->Add(pCheck_ATONTEXT, verticleInputFlags);
3432 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3433 pCheck_LDISTEXT->SetValue(FALSE);
3434 lightSizer->Add(pCheck_LDISTEXT, verticleInputFlags);
3436 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3437 _(
"Extended Light Sectors"));
3438 pCheck_XLSECTTEXT->SetValue(FALSE);
3439 lightSizer->Add(pCheck_XLSECTTEXT, verticleInputFlags);
3442 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Texts")),
3445 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3446 optionsColumn->Add(textSizer, groupInputFlags);
3448 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3449 _(
"National text on chart"));
3450 pCheck_NATIONALTEXT->SetValue(FALSE);
3451 textSizer->Add(pCheck_NATIONALTEXT, verticleInputFlags);
3453 pCheck_SHOWIMPTEXT =
3454 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3455 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3456 textSizer->Add(pCheck_SHOWIMPTEXT, verticleInputFlags);
3459 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3460 pCheck_DECLTEXT->SetValue(FALSE);
3461 textSizer->Add(pCheck_DECLTEXT, verticleInputFlags);
3463 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Chart Detail")),
3465 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3466 _(
"Reduced Detail at Small Scale"));
3467 pCheck_SCAMIN->SetValue(FALSE);
3468 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3470 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3471 pCheck_SuperSCAMIN =
3472 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3473 _(
"Additional detail reduction at Small Scale"));
3474 pCheck_SuperSCAMIN->SetValue(FALSE);
3475 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3478 optionsColumn->Add(0, border_size * 4);
3479 optionsColumn->Add(0, border_size * 4);
3481 wxSize item_size = wxSize(-1, -1);
3483 item_size = wxSize(m_fontHeight * 3, m_fontHeight);
3487 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3489 wxString pPointStyleStrings[] = {
3493 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3494 item_size, 2, pPointStyleStrings);
3495 optionsColumn->Add(pPointStyle, inputFlags);
3497 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3499 wxString pBoundStyleStrings[] = {
3503 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3504 item_size, 2, pBoundStyleStrings);
3505 optionsColumn->Add(pBoundStyle, inputFlags);
3507 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3509 wxString pColorNumStrings[] = {
3513 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3514 item_size, 2, pColorNumStrings);
3515 optionsColumn->Add(p24Color, inputFlags);
3518 optionsColumn->Add(0, border_size * 4);
3519 optionsColumn->Add(0, border_size * 4);
3521 item_size = wxSize(60, -1);
3523 item_size = wxSize(m_fontHeight * 2, m_fontHeight);
3527 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3529 wxBoxSizer* depShalRow =
new wxBoxSizer(wxHORIZONTAL);
3530 optionsColumn->Add(depShalRow);
3531 m_ShallowCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3532 item_size, wxTE_RIGHT);
3533 depShalRow->Add(m_ShallowCtl, inputFlags);
3534 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3535 depShalRow->Add(m_depthUnitsShal, inputFlags);
3537 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3539 wxBoxSizer* depSafeRow =
new wxBoxSizer(wxHORIZONTAL);
3540 optionsColumn->Add(depSafeRow);
3541 m_SafetyCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3542 item_size, wxTE_RIGHT);
3543 depSafeRow->Add(m_SafetyCtl, inputFlags);
3544 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3545 depSafeRow->Add(m_depthUnitsSafe, inputFlags);
3547 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3549 wxBoxSizer* depDeepRow =
new wxBoxSizer(wxHORIZONTAL);
3550 optionsColumn->Add(depDeepRow);
3551 m_DeepCtl =
new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3552 item_size, wxTE_RIGHT);
3553 depDeepRow->Add(m_DeepCtl, inputFlags);
3554 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3555 depDeepRow->Add(m_depthUnitsDeep, inputFlags);
3558 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3559 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3561 wxStaticBox* marinersBox =
3562 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3563 wxStaticBoxSizer* marinersSizer =
3564 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3565 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3567 ps57CtlListBox =
new OCPNCheckedListCtrl(
3568 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3569 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3571 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3572 itemButtonSelectList =
3573 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3574 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3575 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3576 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3577 marinersSizer->Add(btnRow1);
3579 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3581 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3582 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3583 marinersSizer->Add(btnRow2);
3588 vectorPanel =
new wxBoxSizer(wxVERTICAL);
3589 ps57Ctl->SetSizer(vectorPanel);
3591 wxBoxSizer* optionsColumn = vectorPanel;
3594 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3599 new wxStaticText(ps57Ctl, wxID_ANY, _(
"Display Category")),
3601 wxString pDispCatStrings[] = {_(
"Base"), _(
"Standard"), _(
"All"),
3602 _(
"Mariner's Standard")};
3603 pDispCat =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3604 wxSize(350, -1), 4, pDispCatStrings);
3605 optionsColumn->Add(pDispCat, 0, wxALL, 2);
3608 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""));
3613 wxBoxSizer* miscSizer =
new wxBoxSizer(wxVERTICAL);
3614 optionsColumn->Add(miscSizer, groupInputFlags);
3617 new wxCheckBox(ps57Ctl, ID_SOUNDGCHECKBOX, _(
"Depth Soundings"));
3618 pCheck_SOUNDG->SetValue(FALSE);
3619 miscSizer->Add(pCheck_SOUNDG, inputFlags);
3621 pCheck_META =
new wxCheckBox(ps57Ctl, ID_METACHECKBOX,
3622 _(
"Chart Information Objects"));
3623 pCheck_META->SetValue(FALSE);
3624 miscSizer->Add(pCheck_META, inputFlags);
3626 wxBoxSizer* lightSizer =
new wxBoxSizer(wxVERTICAL);
3627 optionsColumn->Add(lightSizer, groupInputFlags);
3630 new wxCheckBox(ps57Ctl, ID_ATONTEXTCHECKBOX, _(
"Buoy/Light Labels"));
3631 pCheck_ATONTEXT->SetValue(FALSE);
3632 lightSizer->Add(pCheck_ATONTEXT, inputFlags);
3635 new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX, _(
"Light Descriptions"));
3636 pCheck_LDISTEXT->SetValue(FALSE);
3637 lightSizer->Add(pCheck_LDISTEXT, inputFlags);
3639 pCheck_XLSECTTEXT =
new wxCheckBox(ps57Ctl, ID_LDISTEXTCHECKBOX,
3640 _(
"Extended Light Sectors"));
3641 pCheck_XLSECTTEXT->SetValue(FALSE);
3642 lightSizer->Add(pCheck_XLSECTTEXT, inputFlags);
3644 wxBoxSizer* textSizer =
new wxBoxSizer(wxVERTICAL);
3645 optionsColumn->Add(textSizer, groupInputFlags);
3647 pCheck_NATIONALTEXT =
new wxCheckBox(ps57Ctl, ID_NATIONALTEXTCHECKBOX,
3648 _(
"National text on chart"));
3649 pCheck_NATIONALTEXT->SetValue(FALSE);
3650 textSizer->Add(pCheck_NATIONALTEXT, inputFlags);
3652 pCheck_SHOWIMPTEXT =
3653 new wxCheckBox(ps57Ctl, ID_IMPTEXTCHECKBOX, _(
"Important Text Only"));
3654 pCheck_SHOWIMPTEXT->SetValue(FALSE);
3655 textSizer->Add(pCheck_SHOWIMPTEXT, inputFlags);
3658 new wxCheckBox(ps57Ctl, ID_DECLTEXTCHECKBOX, _(
"De-Cluttered Text"));
3659 pCheck_DECLTEXT->SetValue(FALSE);
3660 textSizer->Add(pCheck_DECLTEXT, inputFlags);
3662 pCheck_SCAMIN =
new wxCheckBox(ps57Ctl, ID_SCAMINCHECKBOX,
3663 _(
"Reduced Detail at Small Scale"));
3664 pCheck_SCAMIN->SetValue(FALSE);
3665 optionsColumn->Add(pCheck_SCAMIN, inputFlags);
3667 optionsColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY,
""), labelFlags);
3668 pCheck_SuperSCAMIN =
3669 new wxCheckBox(ps57Ctl, ID_SUPERSCAMINCHECKBOX,
3670 _(
"Additional detail reduction at Small Scale"));
3671 pCheck_SuperSCAMIN->SetValue(FALSE);
3672 optionsColumn->Add(pCheck_SuperSCAMIN, inputFlags);
3675 optionsColumn->Add(0, border_size * 4);
3676 optionsColumn->Add(0, border_size * 4);
3680 wxFlexGridSizer* StyleColumn =
new wxFlexGridSizer(2);
3681 StyleColumn->SetHGap(border_size);
3682 StyleColumn->AddGrowableCol(0, 2);
3683 StyleColumn->AddGrowableCol(1, 3);
3684 optionsColumn->Add(StyleColumn);
3686 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Graphics Style")),
3688 wxString pPointStyleStrings[] = {
3692 pPointStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3693 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3694 pPointStyleStrings);
3696 setChoiceStyleSheet(pPointStyle, m_fontHeight * 8 / 10);
3699 StyleColumn->Add(pPointStyle, inputFlags);
3701 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Boundaries")),
3703 wxString pBoundStyleStrings[] = {
3707 pBoundStyle =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3708 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3709 pBoundStyleStrings);
3711 setChoiceStyleSheet(pBoundStyle, m_fontHeight * 8 / 10);
3714 StyleColumn->Add(pBoundStyle, inputFlags);
3716 StyleColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Colors")),
3719 wxString pColorNumStrings[] = {
3723 p24Color =
new wxChoice(ps57Ctl, ID_RADARDISTUNIT, wxDefaultPosition,
3724 wxSize(m_fontHeight * 3, m_fontHeight), 2,
3727 setChoiceStyleSheet(p24Color, m_fontHeight * 8 / 10);
3729 StyleColumn->Add(p24Color, inputFlags);
3732 optionsColumn->Add(0, border_size * 4);
3733 optionsColumn->Add(0, border_size * 4);
3735 wxFlexGridSizer* DepthColumn =
new wxFlexGridSizer(3);
3736 DepthColumn->SetHGap(border_size);
3737 DepthColumn->AddGrowableCol(0, 3);
3738 DepthColumn->AddGrowableCol(1, 2);
3739 DepthColumn->AddGrowableCol(2, 3);
3740 optionsColumn->Add(DepthColumn);
3743 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Shallow Depth")),
3746 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3747 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3748 DepthColumn->Add(m_ShallowCtl, inputFlags);
3749 m_depthUnitsShal =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3750 DepthColumn->Add(m_depthUnitsShal, inputFlags);
3752 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Safety Depth")),
3755 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3756 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_RIGHT);
3757 DepthColumn->Add(m_SafetyCtl, inputFlags);
3758 m_depthUnitsSafe =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3759 DepthColumn->Add(m_depthUnitsSafe, inputFlags);
3761 DepthColumn->Add(
new wxStaticText(ps57Ctl, wxID_ANY, _(
"Deep Depth")),
3764 new wxTextCtrl(ps57Ctl, ID_OPTEXTCTRL,
"", wxDefaultPosition,
3765 wxSize(m_fontHeight * 2, m_fontHeight), wxTE_CENTER);
3766 DepthColumn->Add(m_DeepCtl, inputFlags);
3767 m_depthUnitsDeep =
new wxStaticText(ps57Ctl, wxID_ANY, _(
"meters"));
3768 DepthColumn->Add(m_depthUnitsDeep, inputFlags);
3771 optionsColumn->Add(0, border_size * 4);
3772 optionsColumn->Add(0, border_size * 4);
3775 wxBoxSizer* dispSizer =
new wxBoxSizer(wxVERTICAL);
3776 vectorPanel->Add(dispSizer, 2, wxALL | wxEXPAND, border_size);
3778 wxStaticBox* marinersBox =
3779 new wxStaticBox(ps57Ctl, wxID_ANY, _(
"User Standard Objects"));
3780 wxStaticBoxSizer* marinersSizer =
3781 new wxStaticBoxSizer(marinersBox, wxVERTICAL);
3782 dispSizer->Add(marinersSizer, 1, wxALL | wxEXPAND, border_size);
3784 wxBoxSizer* btnRow1 =
new wxBoxSizer(wxHORIZONTAL);
3785 itemButtonSelectList =
3786 new wxButton(ps57Ctl, ID_SELECTLIST, _(
"Select All"));
3787 btnRow1->Add(itemButtonSelectList, 1, wxALL | wxEXPAND, group_item_spacing);
3788 itemButtonClearList =
new wxButton(ps57Ctl, ID_CLEARLIST, _(
"Clear All"));
3789 btnRow1->Add(itemButtonClearList, 1, wxALL | wxEXPAND, group_item_spacing);
3790 marinersSizer->Add(btnRow1);
3792 wxBoxSizer* btnRow2 =
new wxBoxSizer(wxHORIZONTAL);
3794 new wxButton(ps57Ctl, ID_SETSTDLIST, _(
"Reset to STANDARD"));
3795 btnRow2->Add(itemButtonSetStd, 1, wxALL | wxEXPAND, group_item_spacing);
3796 marinersSizer->Add(btnRow2);
3798 ps57CtlListBox =
new OCPNCheckedListCtrl(
3799 ps57Ctl, ID_CHECKLISTBOX, wxDefaultPosition, wxSize(250, 350));
3801 marinersSizer->Add(ps57CtlListBox, 1, wxALL | wxEXPAND, group_item_spacing);
3805void options::CreatePanel_TidesCurrents(
size_t parent,
int border_size,
3806 int group_item_spacing) {
3807 wxScrolledWindow* tcPanel = AddPage(parent, _(
"Tides && Currents"));
3809 wxBoxSizer* mainHBoxSizer =
new wxBoxSizer(wxVERTICAL);
3810 tcPanel->SetSizer(mainHBoxSizer);
3812 wxStaticBox* tcBox =
new wxStaticBox(tcPanel, wxID_ANY, _(
"Active Datasets"));
3813 wxStaticBoxSizer* tcSizer =
new wxStaticBoxSizer(tcBox, wxHORIZONTAL);
3814 mainHBoxSizer->Add(tcSizer, 1, wxALL | wxEXPAND, border_size);
3817 new wxListCtrl(tcPanel, ID_TIDESELECTED, wxDefaultPosition,
3818 wxSize(100, -1), wxLC_REPORT | wxLC_NO_HEADER);
3820 tcSizer->Add(tcDataSelected, 1, wxALL | wxEXPAND, border_size);
3824 tcDataSelected->DeleteAllItems();
3831 col0.SetAlign(wxLIST_FORMAT_LEFT);
3833 tcDataSelected->InsertColumn(0, col0);
3836 unsigned int id = 0;
3837 for (
auto ds : TideCurrentDataSet) {
3840 tcDataSelected->InsertItem(li);
3842 wxString setName = ds;
3843 tcDataSelected->SetItem(
id, 0, setName);
3844 GetTextExtent(setName, &w1, &h);
3845 w = w1 > w ? w1 : w;
3851 tcDataSelected->SetColumnWidth(0, 20 + w);
3855 wxButton* insertButton =
3856 new wxButton(tcPanel, ID_TCDATAADD, _(
"Add Dataset..."));
3857 wxButton* removeButton =
3858 new wxButton(tcPanel, ID_TCDATADEL, _(
"Remove Selected"));
3860 wxBoxSizer* btnSizer =
new wxBoxSizer(wxVERTICAL);
3861 tcSizer->Add(btnSizer);
3863 btnSizer->Add(insertButton, 1, wxALL | wxEXPAND, group_item_spacing);
3864 btnSizer->Add(removeButton, 1, wxALL | wxEXPAND, group_item_spacing);
3867void options::CreatePanel_ChartGroups(
size_t parent,
int border_size,
3868 int group_item_spacing) {
3873 wxNotebook* chartsPageNotebook = (wxNotebook*)m_pListbook->GetPage(parent);
3874 wxScrolledWindow* sw =
new ChartGroupsUI(chartsPageNotebook);
3875 sw->SetScrollRate(m_scrollRate, m_scrollRate);
3876 chartsPageNotebook->AddPage(sw, _(
"Chart Groups"));
3877 groupsPanel =
dynamic_cast<ChartGroupsUI*
>(sw);
3879 groupsPanel->CreatePanel(parent, border_size, group_item_spacing);
3882void ChartGroupsUI::CreatePanel(
size_t parent,
int border_size,
3883 int group_item_spacing) {
3885 m_border_size = border_size;
3886 m_group_item_spacing = group_item_spacing;
3888 m_UIcomplete = FALSE;
3893void ChartGroupsUI::CompletePanel() {
3895 m_topSizer =
new wxBoxSizer(wxVERTICAL);
3896 m_panel->SetSizer(m_topSizer);
3899 wxStaticText* allChartsLabel =
3900 new wxStaticText(m_panel, wxID_ANY, _(
"All Available Charts"));
3901 m_topSizer->Add(allChartsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3903 wxBoxSizer* sizerCharts =
new wxBoxSizer(wxHORIZONTAL);
3904 m_topSizer->Add(sizerCharts, 1, wxALL | wxEXPAND, 5);
3906 wxBoxSizer* activeListSizer =
new wxBoxSizer(wxVERTICAL);
3907 sizerCharts->Add(activeListSizer, 1, wxALL | wxEXPAND, 5);
3911 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3912 wxDefaultSize, wxVSCROLL);
3915 new wxGenericDirCtrl(m_panel, ID_GROUPAVAILABLE,
"", wxDefaultPosition,
3916 wxDefaultSize, wxVSCROLL);
3918 activeListSizer->Add(allAvailableCtl, 1, wxEXPAND);
3920 m_pAddButton =
new wxButton(m_panel, ID_GROUPINSERTDIR, _(
"Add"));
3921 m_pAddButton->Disable();
3922 m_pRemoveButton =
new wxButton(m_panel, ID_GROUPREMOVEDIR, _(
"Remove Chart"));
3923 m_pRemoveButton->Disable();
3925 m_pAddButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3926 wxCommandEventHandler(ChartGroupsUI::OnInsertChartItem),
3928 m_pRemoveButton->Connect(
3929 wxEVT_COMMAND_BUTTON_CLICKED,
3930 wxCommandEventHandler(ChartGroupsUI::OnRemoveChartItem), NULL,
this);
3932 wxBoxSizer* addRemove =
new wxBoxSizer(wxVERTICAL);
3933 sizerCharts->Add(addRemove, 0, wxALL | wxEXPAND, m_border_size);
3934 addRemove->Add(m_pAddButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
3936 sizerCharts->AddSpacer(20);
3939 wxStaticText* groupsLabel =
3940 new wxStaticText(m_panel, wxID_ANY, _(
"Chart Groups"));
3941 m_topSizer->Add(groupsLabel, 0, wxTOP | wxRIGHT | wxLEFT, m_border_size);
3943 wxBoxSizer* sizerGroups =
new wxBoxSizer(wxHORIZONTAL);
3944 m_topSizer->Add(sizerGroups, 1, wxALL | wxEXPAND, 5);
3946 wxBoxSizer* nbSizer =
new wxBoxSizer(wxVERTICAL);
3947 sizerGroups->Add(nbSizer, 1, wxALL | wxEXPAND, m_border_size);
3948 m_GroupNB =
new wxNotebook(m_panel, ID_GROUPNOTEBOOK, wxDefaultPosition,
3949 wxDefaultSize, wxNB_TOP);
3950 nbSizer->Add(m_GroupNB, 1, wxEXPAND);
3952 m_GroupNB->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
3953 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange),
3957 wxPanel* allActiveGroup =
3958 new wxPanel(m_GroupNB, -1, wxDefaultPosition, wxDefaultSize);
3959 m_GroupNB->AddPage(allActiveGroup, _(
"All Charts"));
3961 wxBoxSizer* page0BoxSizer =
new wxBoxSizer(wxHORIZONTAL);
3962 allActiveGroup->SetSizer(page0BoxSizer);
3964 defaultAllCtl =
new wxGenericDirCtrl(allActiveGroup, -1,
"",
3965 wxDefaultPosition, wxDefaultSize);
3968 iFont =
new wxFont(*dialogFont);
3969 iFont->SetStyle(wxFONTSTYLE_ITALIC);
3970 iFont->SetWeight(wxFONTWEIGHT_LIGHT);
3972 page0BoxSizer->Add(defaultAllCtl, 1, wxALIGN_TOP | wxALL | wxEXPAND);
3974 m_DirCtrlArray.Add(defaultAllCtl);
3978 new wxButton(m_panel, ID_GROUPNEWGROUP, _(
"New Group..."));
3979 m_pDeleteGroupButton =
3980 new wxButton(m_panel, ID_GROUPDELETEGROUP, _(
"Delete Group"));
3981 m_pDeleteGroupButton->Disable();
3983 m_pNewGroupButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
3984 wxCommandEventHandler(ChartGroupsUI::OnNewGroup),
3986 m_pDeleteGroupButton->Connect(
3987 wxEVT_COMMAND_BUTTON_CLICKED,
3988 wxCommandEventHandler(ChartGroupsUI::OnDeleteGroup), NULL,
this);
3990 wxBoxSizer* newDeleteGrp =
new wxBoxSizer(wxVERTICAL);
3991 sizerGroups->Add(newDeleteGrp, 0, wxALL, m_border_size);
3993 newDeleteGrp->AddSpacer(25);
3994 newDeleteGrp->Add(m_pNewGroupButton, 0, wxALL | wxEXPAND,
3995 m_group_item_spacing);
3996 newDeleteGrp->AddSpacer(15);
3997 newDeleteGrp->Add(m_pDeleteGroupButton, 0, wxALL | wxEXPAND,
3998 m_group_item_spacing);
3999 newDeleteGrp->AddSpacer(25);
4000 newDeleteGrp->Add(m_pRemoveButton, 0, wxALL | wxEXPAND, m_group_item_spacing);
4002 sizerGroups->AddSpacer(20);
4006 m_panel->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED,
4007 wxTreeEventHandler(ChartGroupsUI::OnAvailableSelection),
4010 m_UIcomplete = TRUE;
4013void options::CreatePanel_Display(
size_t parent,
int border_size,
4014 int group_item_spacing) {
4020 pDisplayPanel = AddPage(parent, _(
"General"));
4023 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4024 generalSizer->SetHGap(border_size);
4031 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4032 pDisplayPanel->SetSizer(wrapperSizer);
4033 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4036 generalSizer->Add(0, border_size * 4);
4037 generalSizer->Add(0, border_size * 4);
4042 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4044 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4045 generalSizer->Add(boxNavMode, groupInputFlags);
4047 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4048 boxNavMode->Add(rowOrientation);
4050 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4051 rowOrientation->Add(pCBNorthUp, inputFlags);
4053 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4054 rowOrientation->Add(pCBCourseUp,
4056 .Align(wxALIGN_CENTRE_VERTICAL)
4057 .Border(wxLEFT, group_item_spacing * 2));
4059 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4060 _(
"Look Ahead Mode"));
4061 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4064 generalSizer->Add(0, border_size * 4);
4065 generalSizer->Add(0, border_size * 4);
4069 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4071 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4072 generalSizer->Add(boxCharts, groupInputFlags);
4074 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4075 _(
"Enable Chart Quilting"));
4076 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4079 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4080 _(
"Preserve scale when switching charts"));
4081 boxCharts->Add(pPreserveScale, verticleInputFlags);
4084 generalSizer->Add(0, border_size * 4);
4085 generalSizer->Add(0, border_size * 4);
4089 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4091 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4092 generalSizer->Add(boxCtrls, groupInputFlags);
4094 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4095 _(
"Smooth Panning / Zooming"));
4096 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4098 pEnableZoomToCursor =
4099 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4100 pEnableZoomToCursor->SetValue(FALSE);
4101 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4103 pEnableTenHertz =
nullptr;
4105 pEnableTenHertz =
new wxCheckBox(pDisplayPanel, ID_TENHZCHECKBOX,
4106 _(
"Enable Ten Hz screen update"));
4107 pEnableTenHertz->SetValue(FALSE);
4108 boxCtrls->Add(pEnableTenHertz, verticleInputFlags);
4113 generalSizer->Add(0, border_size * 4);
4114 generalSizer->Add(0, border_size * 4);
4118 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4120 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4121 generalSizer->Add(boxDisp, groupInputFlags);
4124 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4125 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4127 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4128 _(
"Show Chart Outlines"));
4129 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4131 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4132 _(
"Show Depth Units"));
4133 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4139 wxStaticBox* itemStaticBoxScreenConfig =
4140 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4141 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4142 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4143 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4146 wxString iconDir =
g_Platform->GetSharedDataDir();
4147 appendOSDirSlash(&iconDir);
4148 iconDir.append(
"uidata");
4149 appendOSDirSlash(&iconDir);
4150 iconDir.append(
"MUI_flat");
4151 appendOSDirSlash(&iconDir);
4152 int bmpSize = GetCharHeight() * 3;
4154 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4155 m_sconfigSelect_single =
4156 new CanvasConfigSelect(pDisplayPanel,
this, ID_SCREENCONFIG1, bmp);
4157 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4160 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4162 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4163 m_sconfigSelect_twovertical =
4164 new CanvasConfigSelect(pDisplayPanel,
this, ID_SCREENCONFIG2, bmp);
4165 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4168 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4173 wxFlexGridSizer* generalSizer =
new wxFlexGridSizer(2);
4174 generalSizer->SetHGap(border_size);
4181 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4182 pDisplayPanel->SetSizer(wrapperSizer);
4183 wrapperSizer->Add(generalSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4186 generalSizer->Add(0, border_size * 4);
4187 generalSizer->Add(0, border_size * 4);
4192 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Navigation Mode")),
4194 wxBoxSizer* boxNavMode =
new wxBoxSizer(wxVERTICAL);
4195 generalSizer->Add(boxNavMode, groupInputFlags);
4197 wxBoxSizer* rowOrientation =
new wxBoxSizer(wxHORIZONTAL);
4198 boxNavMode->Add(rowOrientation);
4200 pCBNorthUp =
new wxRadioButton(pDisplayPanel, wxID_ANY, _(
"North Up"));
4201 rowOrientation->Add(pCBNorthUp, inputFlags);
4203 new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _(
"Course Up"));
4204 rowOrientation->Add(pCBCourseUp,
4206 .Align(wxALIGN_CENTRE_VERTICAL)
4207 .Border(wxLEFT, group_item_spacing * 2));
4209 pCBLookAhead =
new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD,
4210 _(
"Look Ahead Mode"));
4211 boxNavMode->Add(pCBLookAhead, verticleInputFlags);
4214 generalSizer->Add(0, border_size * 4);
4215 generalSizer->Add(0, border_size * 4);
4219 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Chart Display")),
4221 wxBoxSizer* boxCharts =
new wxBoxSizer(wxVERTICAL);
4222 generalSizer->Add(boxCharts, groupInputFlags);
4224 pCDOQuilting =
new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1,
4225 _(
"Enable Chart Quilting"));
4226 boxCharts->Add(pCDOQuilting, verticleInputFlags);
4229 new wxCheckBox(pDisplayPanel, ID_PRESERVECHECKBOX,
4230 _(
"Preserve scale when switching charts"));
4231 boxCharts->Add(pPreserveScale, verticleInputFlags);
4234 generalSizer->Add(0, border_size * 4);
4235 generalSizer->Add(0, border_size * 4);
4239 generalSizer->Add(
new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Controls")),
4241 wxBoxSizer* boxCtrls =
new wxBoxSizer(wxVERTICAL);
4242 generalSizer->Add(boxCtrls, groupInputFlags);
4244 pSmoothPanZoom =
new wxCheckBox(pDisplayPanel, ID_SMOOTHPANZOOMBOX,
4245 _(
"Smooth Panning / Zooming"));
4246 boxCtrls->Add(pSmoothPanZoom, verticleInputFlags);
4247 pEnableZoomToCursor =
4248 new wxCheckBox(pDisplayPanel, ID_ZTCCHECKBOX, _(
"Zoom to Cursor"));
4249 pEnableZoomToCursor->SetValue(FALSE);
4250 boxCtrls->Add(pEnableZoomToCursor, verticleInputFlags);
4253 pSmoothPanZoom->Hide();
4254 pEnableZoomToCursor->Hide();
4258 generalSizer->Add(0, border_size * 4);
4259 generalSizer->Add(0, border_size * 4);
4264 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Display Features")),
4266 wxBoxSizer* boxDisp =
new wxBoxSizer(wxVERTICAL);
4267 generalSizer->Add(boxDisp, groupInputFlags);
4270 new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _(
"Show Grid"));
4271 boxDisp->Add(pSDisplayGrid, verticleInputFlags);
4273 pCDOOutlines =
new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1,
4274 _(
"Show Chart Outlines"));
4275 boxDisp->Add(pCDOOutlines, verticleInputFlags);
4277 pSDepthUnits =
new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1,
4278 _(
"Show Depth Units"));
4279 boxDisp->Add(pSDepthUnits, verticleInputFlags);
4289 generalSizer->Add(0, border_size * 4);
4290 generalSizer->Add(0, border_size * 4);
4294 new wxStaticText(pDisplayPanel, wxID_ANY, _(
"Status Bar")),
4296 wxBoxSizer* boxDispStatusBar =
new wxBoxSizer(wxVERTICAL);
4297 generalSizer->Add(boxDispStatusBar, groupInputFlags);
4301 pSLiveETA =
new wxCheckBox(pDisplayPanel, ID_CHECK_LIVEETA,
4302 _(
"Live ETA at Cursor"));
4303 boxDispStatusBar->Add(pSLiveETA, verticleInputFlags);
4308 wxBoxSizer* defaultBoatSpeedSizer =
new wxBoxSizer(wxHORIZONTAL);
4309 boxDispStatusBar->Add(defaultBoatSpeedSizer, wxALL, group_item_spacing);
4310 m_Text_def_boat_speed =
new wxStaticText(
4311 pDisplayPanel, wxID_ANY,
4312 _(
"Default Boat Speed ") +
"(" + getUsrSpeedUnit() +
") ");
4313 defaultBoatSpeedSizer->Add(m_Text_def_boat_speed, groupLabelFlagsHoriz);
4314 pSDefaultBoatSpeed =
4315 new wxTextCtrl(pDisplayPanel, ID_DEFAULT_BOAT_SPEED,
"",
4316 wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT);
4317 defaultBoatSpeedSizer->Add(pSDefaultBoatSpeed, 0, wxALIGN_CENTER_VERTICAL,
4318 group_item_spacing);
4326 wxStaticBox* itemStaticBoxScreenConfig =
4327 new wxStaticBox(pDisplayPanel, wxID_ANY, _(
"Canvas Layout"));
4328 wxStaticBoxSizer* itemStaticBoxSizerScreenConfig =
4329 new wxStaticBoxSizer(itemStaticBoxScreenConfig, wxHORIZONTAL);
4330 wrapperSizer->Add(itemStaticBoxSizerScreenConfig, 1, wxALL | wxEXPAND, 5);
4333 wxString iconDir =
g_Platform->GetSharedDataDir();
4334 appendOSDirSlash(&iconDir);
4335 iconDir.append(
"uidata");
4336 appendOSDirSlash(&iconDir);
4337 iconDir.append(
"MUI_flat");
4338 appendOSDirSlash(&iconDir);
4339 int bmpSize = GetCharHeight() * 3;
4341 wxBitmap bmp =
LoadSVG(iconDir +
"MUI_Sconfig_1.svg", bmpSize, bmpSize);
4342 m_sconfigSelect_single =
4343 new CanvasConfigSelect(pDisplayPanel,
this, ID_SCREENCONFIG1, bmp);
4344 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_single, 0,
4347 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4349 bmp =
LoadSVG(iconDir +
"MUI_Sconfig_2.svg", bmpSize, bmpSize);
4350 m_sconfigSelect_twovertical =
4351 new CanvasConfigSelect(pDisplayPanel,
this, ID_SCREENCONFIG2, bmp);
4352 itemStaticBoxSizerScreenConfig->Add(m_sconfigSelect_twovertical, 0,
4355 itemStaticBoxSizerScreenConfig->AddSpacer(GetCharHeight());
4361void options::CreatePanel_Units(
size_t parent,
int border_size,
4362 int group_item_spacing) {
4363 wxScrolledWindow* panelUnits = AddPage(parent, _(
"Units"));
4366 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4367 unitsSizer->SetHGap(border_size);
4371 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4372 panelUnits->SetSizer(wrapperSizer);
4374 wrapperSizer->Add(1, border_size * 24);
4375 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4378 unitsSizer->Add(0, border_size * 4);
4379 unitsSizer->Add(0, border_size * 4);
4382 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4384 wxString pDistanceFormats[kNumDistanceFormats];
4385 for (
int i = 0; i < kNumDistanceFormats; i++) {
4386 pDistanceFormats[i] = kDistanceFormats[i].label;
4388 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4390 new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE, wxDefaultPosition,
4391 wxSize(m_fontHeight * 4, -1), m_DistanceFormatsNChoices,
4394 pDistanceFormat->SetToolTip(ttDistance());
4396 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4398 unitsSizer->Add(pDistanceFormat, inputFlags);
4401 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4403 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4404 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4405 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4406 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4407 m_SpeedFormatsNChoices, pSpeedFormats);
4408 pSpeedFormat->SetToolTip(ttSpeed());
4410 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4412 unitsSizer->Add(pSpeedFormat, inputFlags);
4415 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4417 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4418 int m_WindSpeedFormatsNChoices =
4419 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4421 new wxChoice(panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4422 wxSize(m_fontHeight * 4, -1), m_WindSpeedFormatsNChoices,
4424 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4426 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4428 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4431 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4433 wxString pDepthUnitStrings[] = {
4439 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4440 wxSize(m_fontHeight * 4, -1), 3, pDepthUnitStrings);
4442 pDepthUnitSelect->SetToolTip(ttDepth());
4444 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4446 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4449 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4451 wxString pHeightUnitStrings[] = {
4456 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4457 wxSize(m_fontHeight * 4, -1), 2, pHeightUnitStrings);
4460 pHeightUnitSelect->SetToolTip(ttHeight());
4462 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4464 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4467 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4469 wxString pTempUnitStrings[] = {
4475 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4476 wxSize(m_fontHeight * 4, -1), 3, pTempUnitStrings);
4477 pTempFormat->SetToolTip(ttTemp());
4479 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4481 unitsSizer->Add(pTempFormat, inputFlags);
4484 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4485 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4488 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4490 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4491 _(
"Decimal Degrees"),
4492 _(
"Degrees, Minutes, Seconds")};
4493 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4494 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4495 wxDefaultPosition, wxSize(m_fontHeight * 4, -1),
4496 m_SDMMFormatsNChoices, pSDMMFormats);
4497 pSDMMFormat->SetToolTip(ttCoordFormat());
4499 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4501 unitsSizer->Add(pSDMMFormat, inputFlags);
4504 unitsSizer->Add(0, border_size * 4);
4505 unitsSizer->Add(0, border_size * 4);
4509 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4512 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4513 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4514 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4515 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4518 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4519 wxDefaultPosition, wxDefaultSize, 0);
4521 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4522 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4523 wxDefaultPosition, wxDefaultSize, 0);
4525 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4528 unitsSizer->Add(0, border_size * 4);
4529 unitsSizer->Add(0, border_size * 4);
4532 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4537 new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX, _(
"Show true"));
4538 unitsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4539 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4542 new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX, _(
"Show magnetic"));
4543 unitsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4544 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4548 wxStaticBox* itemStaticBoxVar =
new wxStaticBox(panelUnits, wxID_ANY,
"");
4550 wxStaticBoxSizer* itemStaticBoxSizerVar =
4551 new wxStaticBoxSizer(itemStaticBoxVar, wxVERTICAL);
4552 wrapperSizer->Add(itemStaticBoxSizerVar, 0, wxALL | wxEXPAND, 5);
4554 itemStaticBoxSizerVar->Add(0, border_size * 4);
4556 itemStaticTextUserVar =
4557 new wxStaticText(panelUnits, wxID_ANY, _(
"Assumed magnetic variation"));
4558 itemStaticBoxSizerVar->Add(itemStaticTextUserVar, 1, wxEXPAND | wxALL,
4559 group_item_spacing);
4561 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4562 itemStaticBoxSizerVar->Add(magVarSizer, 1, wxEXPAND | wxALL,
4563 group_item_spacing);
4565 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4566 wxSize(150, -1), wxTE_RIGHT);
4567 magVarSizer->AddSpacer(100);
4569 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4571 itemStaticTextUserVar2 =
4572 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4574 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4575 group_item_spacing);
4577 itemStaticBoxSizerVar->Add(0, border_size * 40);
4580 wxFlexGridSizer* unitsSizer =
new wxFlexGridSizer(2);
4581 unitsSizer->SetHGap(border_size);
4583 int item_h_size = -1;
4585 item_h_size = m_fontHeight * 4;
4590 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4591 panelUnits->SetSizer(wrapperSizer);
4592 wrapperSizer->Add(unitsSizer, 1, wxALL | wxALIGN_CENTER, border_size);
4595 unitsSizer->Add(0, border_size * 4);
4596 unitsSizer->Add(0, border_size * 4);
4599 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Distance")),
4601 wxString pDistanceFormats[kNumDistanceFormats];
4602 for (
int i = 0; i < kNumDistanceFormats; i++) {
4603 pDistanceFormats[i] = kDistanceFormats[i].label;
4605 int m_DistanceFormatsNChoices = kNumDistanceFormats;
4606 pDistanceFormat =
new wxChoice(panelUnits, ID_DISTANCEUNITSCHOICE,
4607 wxDefaultPosition, wxSize(item_h_size, -1),
4608 m_DistanceFormatsNChoices, pDistanceFormats);
4609 pDistanceFormat->SetToolTip(ttDistance());
4611 setChoiceStyleSheet(pDistanceFormat, m_fontHeight * 8 / 10);
4613 unitsSizer->Add(pDistanceFormat, inputFlags);
4616 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Speed")),
4618 wxString pSpeedFormats[] = {_(
"Knots"), _(
"Mph"), _(
"km/h"), _(
"m/s")};
4619 int m_SpeedFormatsNChoices =
sizeof(pSpeedFormats) /
sizeof(wxString);
4620 pSpeedFormat =
new wxChoice(panelUnits, ID_SPEEDUNITSCHOICE,
4621 wxDefaultPosition, wxSize(item_h_size, -1),
4622 m_SpeedFormatsNChoices, pSpeedFormats);
4623 pSpeedFormat->SetToolTip(ttSpeed());
4625 setChoiceStyleSheet(pSpeedFormat, m_fontHeight * 8 / 10);
4627 unitsSizer->Add(pSpeedFormat, inputFlags);
4630 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Wind speed")),
4632 wxString pWindSpeedFormats[] = {_(
"Knots"), _(
"m/s"), _(
"Mph"), _(
"km/h")};
4633 int m_WindSpeedFormatsNChoices =
4634 sizeof(pWindSpeedFormats) /
sizeof(wxString);
4635 pWindSpeedFormat =
new wxChoice(
4636 panelUnits, ID_WINDSPEEDUNITCHOICE, wxDefaultPosition,
4637 wxSize(item_h_size, -1), m_WindSpeedFormatsNChoices, pWindSpeedFormats);
4638 pWindSpeedFormat->SetToolTip(ttWindSpeed());
4640 setChoiceStyleSheet(pWindSpeedFormat, m_fontHeight * 8 / 10);
4642 unitsSizer->Add(pWindSpeedFormat, inputFlags);
4645 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Depth")),
4647 wxString pDepthUnitStrings[] = {
4653 new wxChoice(panelUnits, ID_DEPTHUNITSCHOICE, wxDefaultPosition,
4654 wxSize(item_h_size, -1), 3, pDepthUnitStrings);
4655 pDepthUnitSelect->SetToolTip(ttDepth());
4657 setChoiceStyleSheet(pDepthUnitSelect, m_fontHeight * 8 / 10);
4659 unitsSizer->Add(pDepthUnitSelect, inputFlags);
4662 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Height")),
4664 wxString pHeightUnitStrings[] = {
4669 new wxChoice(panelUnits, ID_HEIGHTUNITSCHOICE, wxDefaultPosition,
4670 wxSize(item_h_size, -1), 2, pHeightUnitStrings);
4671 pHeightUnitSelect->SetToolTip(ttHeight());
4673 setChoiceStyleSheet(pHeightUnitSelect, m_fontHeight * 8 / 10);
4675 unitsSizer->Add(pHeightUnitSelect, inputFlags);
4678 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Temperature")),
4680 wxString pTempUnitStrings[] = {
4686 new wxChoice(panelUnits, ID_TEMPUNITSCHOICE, wxDefaultPosition,
4687 wxSize(item_h_size, -1), 3, pTempUnitStrings);
4688 pTempFormat->SetToolTip(ttTemp());
4690 setChoiceStyleSheet(pTempFormat, m_fontHeight * 8 / 10);
4692 unitsSizer->Add(pTempFormat, inputFlags);
4695 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4696 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY,
""));
4699 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Lat/Long")),
4701 wxString pSDMMFormats[] = {_(
"Degrees, Decimal Minutes"),
4702 _(
"Decimal Degrees"),
4703 _(
"Degrees, Minutes, Seconds")};
4704 int m_SDMMFormatsNChoices =
sizeof(pSDMMFormats) /
sizeof(wxString);
4705 pSDMMFormat =
new wxChoice(panelUnits, ID_SDMMFORMATCHOICE,
4706 wxDefaultPosition, wxSize(item_h_size, -1),
4707 m_SDMMFormatsNChoices, pSDMMFormats);
4708 pSDMMFormat->SetToolTip(ttCoordFormat());
4710 setChoiceStyleSheet(pSDMMFormat, m_fontHeight * 8 / 10);
4712 unitsSizer->Add(pSDMMFormat, inputFlags);
4715 unitsSizer->Add(0, border_size * 4);
4716 unitsSizer->Add(0, border_size * 4);
4720 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Date and Time")),
4723 wxBoxSizer* timezoneStyleBox =
new wxBoxSizer(wxHORIZONTAL);
4724 unitsSizer->Add(timezoneStyleBox, groupInputFlags);
4725 wxBoxSizer* itemTimezoneBoxSizer =
new wxBoxSizer(wxHORIZONTAL);
4726 timezoneStyleBox->Add(itemTimezoneBoxSizer, 1, wxEXPAND | wxALL,
4729 new wxRadioButton(panelUnits, ID_TIMEZONE_LOCAL_TIME, _(
"Local Time"),
4730 wxDefaultPosition, wxDefaultSize, 0);
4732 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4733 pTimezoneUTC =
new wxRadioButton(panelUnits, ID_TIMEZONE_UTC, _(
"UTC"),
4734 wxDefaultPosition, wxDefaultSize, 0);
4736 wxALIGN_CENTER_VERTICAL | wxRIGHT, border_size);
4739 unitsSizer->Add(0, border_size * 4);
4740 unitsSizer->Add(0, border_size * 4);
4743 unitsSizer->Add(
new wxStaticText(panelUnits, wxID_ANY, _(
"Bearings")),
4746 wxBoxSizer* bearingsSizer =
new wxBoxSizer(wxVERTICAL);
4747 unitsSizer->Add(bearingsSizer, 0, 0, 0);
4750 pCBTrueShow =
new wxCheckBox(panelUnits, ID_TRUESHOWCHECKBOX,
4751 _(
"Show true bearings and headings"));
4752 bearingsSizer->Add(pCBTrueShow, 0, wxALL, group_item_spacing);
4753 pCBMagShow =
new wxCheckBox(panelUnits, ID_MAGSHOWCHECKBOX,
4754 _(
"Show magnetic bearings and headings."));
4755 bearingsSizer->Add(pCBMagShow, 0, wxALL, group_item_spacing);
4757 bearingsSizer->AddSpacer(10);
4760 wxBoxSizer* magVarSizer =
new wxBoxSizer(wxHORIZONTAL);
4761 bearingsSizer->Add(magVarSizer, 0, wxALL, group_item_spacing);
4763 itemStaticTextUserVar =
4764 new wxStaticText(panelUnits, wxID_ANY, wxEmptyString);
4765 itemStaticTextUserVar->SetLabel(
4766 _(
"WMM Plugin calculated magnetic variation"));
4768 magVarSizer->Add(itemStaticTextUserVar, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4769 group_item_spacing);
4771 pMagVar =
new wxTextCtrl(panelUnits, ID_OPTEXTCTRL,
"", wxDefaultPosition,
4772 wxSize(50, -1), wxTE_RIGHT);
4773 magVarSizer->Add(pMagVar, 0, wxALIGN_CENTRE_VERTICAL, group_item_spacing);
4775 itemStaticTextUserVar2 =
4776 new wxStaticText(panelUnits, wxID_ANY, _(
"deg (-W, +E)"));
4777 magVarSizer->Add(itemStaticTextUserVar2, 0, wxALL | wxALIGN_CENTRE_VERTICAL,
4778 group_item_spacing);
4780 bearingsSizer->AddSpacer(10);
4782 wxStaticText* varText =
4783 new wxStaticText(panelUnits, wxID_ANY,
4784 _(
" To set the magnetic variation manually,\n you "
4785 "must disable the WMM plugin."));
4786 smallFont = *dialogFont;
4787 smallFont.SetPointSize((smallFont.GetPointSize() / 1.2) +
4789 varText->SetFont(smallFont);
4791 bearingsSizer->Add(varText);
4798class OCPNSoundPanel :
public wxPanel {
4800 OCPNSoundPanel(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
4801 const wxSize& size, wxString title, wxString checkLegend,
4802 wxString selectLegend, wxString* pSoundFile);
4804 ~OCPNSoundPanel() {
delete m_sound; }
4806 void OnButtonSelectSound(wxCommandEvent& event);
4807 void OnButtonSPTestSound(wxCommandEvent& event);
4808 wxString SelectSoundFile();
4809 void SetSoundFileLabel(wxString file);
4810 wxCheckBox* GetCheckBox() {
return m_pCheck_Sound; }
4811 wxString GetSoundFile() {
return m_sound_file; }
4813 wxCheckBox* m_pCheck_Sound;
4814 wxSize m_small_button_size;
4815 wxString m_sound_file;
4816 wxString* m_pSoundFile;
4817 wxStaticText* m_AudioFileNameText;
4820 wxButton* TestSound;
4821 o_sound::Sound* m_sound;
4827 bool m_soundPlaying;
4829 DECLARE_EVENT_TABLE()
4832#define ID_SELECTSOUND 9341
4833#define ID_TESTSOUND 9342
4836EVT_BUTTON(ID_SELECTSOUND, OCPNSoundPanel::OnButtonSelectSound)
4837EVT_BUTTON(ID_TESTSOUND, OCPNSoundPanel::OnButtonSPTestSound)
4842 const wxPoint& pos, const wxSize& size,
4843 wxString title, wxString checkLegend,
4844 wxString selectLegend, wxString* pSoundFile)
4845 : wxPanel(parent,
id, pos, size, wxBORDER_NONE), m_soundPlaying(false) {
4846 wxFont* pif = FontMgr::Get().GetFont(_(
"Dialog"));
4849 m_pSoundFile = pSoundFile;
4850 if (pSoundFile) m_sound_file = *pSoundFile;
4852 m_sound = o_sound::Factory();
4854 int border_size = 4;
4855 int group_item_spacing = 2;
4857 int font_size_y, font_descent, font_lead;
4858 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
4859 m_small_button_size = wxSize(-1, (
int)(1.6 * (font_size_y + font_descent)));
4861 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
4862 SetSizer(wrapperSizer);
4864 wxStaticBox* StaticBox1 =
new wxStaticBox(
this, wxID_ANY, title);
4865 wxStaticBoxSizer* StaticBoxSizer1 =
4866 new wxStaticBoxSizer(StaticBox1, wxVERTICAL);
4867 wrapperSizer->Add(StaticBoxSizer1, 0, wxALL | wxEXPAND, border_size);
4869 m_pCheck_Sound =
new wxCheckBox(
this, ID_ANCHORALERTAUDIO, checkLegend);
4870 StaticBoxSizer1->Add(m_pCheck_Sound, 1, wxALL, group_item_spacing);
4873 wxString LabelWrapped;
4879 g_pOptions->GetSize().x * 8 / 10);
4880 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4881 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4882 LabelWrapped +=
"\n";
4884 LabelWrapped +=
"\n";
4887 m_AudioFileNameText =
new wxStaticText(
this, wxID_ANY, LabelWrapped);
4888 m_AudioFileNameText->Wrap(-1);
4889 StaticBoxSizer1->Add(m_AudioFileNameText, 0, wxALL | wxEXPAND, border_size);
4891 SetSoundFileLabel(m_sound_file);
4894 wxFlexGridSizer* soundSizer1 =
new wxFlexGridSizer(3);
4895 soundSizer1->SetHGap(border_size * 2);
4896 StaticBoxSizer1->Add(soundSizer1, 1, wxALL | wxLEFT, border_size);
4898 SelSound =
new wxButton(
this, ID_SELECTSOUND, selectLegend, wxDefaultPosition,
4899 m_small_button_size, 0);
4900 soundSizer1->Add(SelSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4901 soundSizer1->AddSpacer(group_item_spacing * 4);
4902 TestSound =
new wxButton(
this, ID_TESTSOUND, _(
"Test"), wxDefaultPosition,
4903 m_small_button_size, 0);
4904 soundSizer1->Add(TestSound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
4905 auto sound_action = [
this](
ObservedEvt ev) { m_soundPlaying =
false; };
4906 m_sound_sp_done_listener.Init(m_on_sp_sound_done, sound_action);
4909void OCPNSoundPanel::SetSoundFileLabel(wxString file) {
4910 wxString soundLabel = wxString(
" " + _(
"Audio file name:") +
"\n " + file);
4912 ChartDirPanelHardBreakWrapper wrapper(
this, soundLabel,
4913 g_pOptions->GetSize().x * 8 / 10);
4914 wxArrayString LabelWrappedArray = wrapper.GetLineArray();
4915 wxString LabelWrapped;
4916 for (
unsigned int i = 0; i < LabelWrappedArray.GetCount(); i++) {
4918 LabelWrapped += LabelWrappedArray[i].BeforeFirst(
'/');
4920 LabelWrapped += LabelWrappedArray[i];
4921 LabelWrapped +=
"\n";
4924 m_AudioFileNameText->SetLabel(LabelWrapped);
4928wxString OCPNSoundPanel::SelectSoundFile() {
4929 wxString sound_dir =
g_Platform->GetSharedDataDir();
4930 sound_dir.Append(
"sounds");
4935 wxFileDialog* popenDialog =
new wxFileDialog(
4936 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
4937 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
4939 popenDialog =
g_Platform->AdjustFileDialogFont(
this, popenDialog);
4941 response = popenDialog->ShowModal();
4942 sel_file = popenDialog->GetPath();
4947 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
4951 if (response == wxID_OK)
4957void OCPNSoundPanel::OnButtonSelectSound(wxCommandEvent& event) {
4958 wxString sel_file = SelectSoundFile();
4960 if (!sel_file.IsEmpty()) {
4961 m_sound_file =
g_Platform->NormalizePath(sel_file);
4962 if (m_pSoundFile) *m_pSoundFile = m_sound_file;
4964 SetSoundFileLabel(m_sound_file);
4969void OCPNSoundPanel::OnButtonSPTestSound(wxCommandEvent& event) {
4970 if (!m_soundPlaying) {
4971 m_sound->SetFinishedCallback(
4973 if (m_sound->Load(m_sound_file, g_iSoundDeviceIndex)) {
4974 m_soundPlaying =
true;
4980void options::OnUXAudioEnableButtonClickAIS(wxCommandEvent& event) {
4981 if (event.IsChecked())
4982 m_pCheck_AlertAudio->SetValue(
true);
4984 if (!m_soundPanelSART->GetCheckBox()->GetValue() &&
4985 !m_soundPanelDSC->GetCheckBox()->GetValue())
4986 m_pCheck_AlertAudio->SetValue(
false);
4990void options::OnUXAudioEnableButtonClickSART(wxCommandEvent& event) {
4991 if (event.IsChecked())
4992 m_pCheck_AlertAudio->SetValue(
true);
4994 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
4995 !m_soundPanelDSC->GetCheckBox()->GetValue())
4996 m_pCheck_AlertAudio->SetValue(
false);
5000void options::OnUXAudioEnableButtonClickDSC(wxCommandEvent& event) {
5001 if (event.IsChecked())
5002 m_pCheck_AlertAudio->SetValue(
true);
5004 if (!m_soundPanelAIS->GetCheckBox()->GetValue() &&
5005 !m_soundPanelSART->GetCheckBox()->GetValue())
5006 m_pCheck_AlertAudio->SetValue(
false);
5010void options::CreatePanel_Sounds(
size_t parent,
int border_size,
5011 int group_item_spacing) {
5012 wxScrolledWindow* panelSounds = AddPage(parent, _(
"Sounds"));
5014 wxBoxSizer* wrapperSizer =
new wxBoxSizer(wxVERTICAL);
5015 panelSounds->SetSizer(wrapperSizer);
5018 m_soundPanelAnchor =
new OCPNSoundPanel(
5019 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize,
5020 _(
"Anchor Alarm"), _(
"Play Sound on Anchor Alarm."),
5021 _(
"Select Anchor Alarm Sound"), &g_anchorwatch_sound_file);
5022 wrapperSizer->Add(m_soundPanelAnchor, 1, wxALL | wxEXPAND, border_size);
5025 m_soundPanelAIS =
new OCPNSoundPanel(
5026 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"AIS Alert"),
5027 _(
"Play Sound on AIS Alert."), _(
"Select AIS Alert Sound"),
5029 wrapperSizer->Add(m_soundPanelAIS, 1, wxALL | wxEXPAND, border_size);
5031 m_soundPanelAIS->GetCheckBox()->Connect(
5032 wxEVT_COMMAND_CHECKBOX_CLICKED,
5033 wxCommandEventHandler(options::OnUXAudioEnableButtonClickAIS), NULL,
5037 m_soundPanelSART =
new OCPNSoundPanel(
5038 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"SART Alert"),
5039 _(
"Play Sound on AIS SART Alert."), _(
"Select AIS SART Alert Sound"),
5040 &g_SART_sound_file);
5041 wrapperSizer->Add(m_soundPanelSART, 1, wxALL | wxEXPAND, border_size);
5043 m_soundPanelSART->GetCheckBox()->Connect(
5044 wxEVT_COMMAND_CHECKBOX_CLICKED,
5045 wxCommandEventHandler(options::OnUXAudioEnableButtonClickSART), NULL,
5049 m_soundPanelDSC =
new OCPNSoundPanel(
5050 panelSounds, wxID_ANY, wxDefaultPosition, wxDefaultSize, _(
"DSC Alert"),
5051 _(
"Play Sound on DSC notification."), _(
"Select DSC notification Sound"),
5053 wrapperSizer->Add(m_soundPanelDSC, 1, wxALL | wxEXPAND, border_size);
5055 m_soundPanelDSC->GetCheckBox()->Connect(
5056 wxEVT_COMMAND_CHECKBOX_CLICKED,
5057 wxCommandEventHandler(options::OnUXAudioEnableButtonClickDSC), NULL,
5061 wxStaticBox* StatBoxSoundConfig =
5062 new wxStaticBox(panelSounds, wxID_ANY, _(
"Sound Device Configuration"));
5063 wxStaticBoxSizer* StatBoxSoundConfigSizer =
5064 new wxStaticBoxSizer(StatBoxSoundConfig, wxVERTICAL);
5065 wrapperSizer->Add(StatBoxSoundConfigSizer, 0, wxALL | wxEXPAND, border_size);
5067 auto sound = std::unique_ptr<o_sound::Sound>(o_sound::Factory());
5068 int deviceCount = sound->DeviceCount();
5069 wxLogMessage(
"options: got device count: %d", deviceCount);
5070 if (deviceCount >= 1) {
5071 wxArrayString labels;
5072 for (
int i = 0; i < deviceCount; i += 1) {
5073 wxString label(sound->GetDeviceInfo(i));
5075 std::ostringstream stm;
5077 label = _(
"Unknown device :") + stm.str();
5079 if (!sound->IsOutputDevice(i)) {
5080 std::ostringstream stm;
5082 label = _(
"Input device :") + stm.str();
5089 int iDefault = labels.Index(
"default");
5091 if (g_iSoundDeviceIndex == -1) {
5093 g_iSoundDeviceIndex = iDefault;
5095 g_iSoundDeviceIndex = 0;
5098 pSoundDeviceIndex =
new wxChoice();
5099 if (pSoundDeviceIndex) {
5100 pSoundDeviceIndex->Create(panelSounds, wxID_ANY, wxDefaultPosition,
5101 wxDefaultSize, labels);
5102 pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
5103 pSoundDeviceIndex->Show();
5104 wxFlexGridSizer* pSoundDeviceIndexGrid =
new wxFlexGridSizer(2);
5105 StatBoxSoundConfigSizer->Add(pSoundDeviceIndexGrid, 0, wxALL | wxEXPAND,
5106 group_item_spacing);
5108 stSoundDeviceIndex =
5109 new wxStaticText(panelSounds, wxID_STATIC, _(
"Sound Device"));
5110 pSoundDeviceIndexGrid->Add(stSoundDeviceIndex, 0, wxALL, 5);
5111 pSoundDeviceIndexGrid->Add(pSoundDeviceIndex, 0, wxALL, border_size);
5116 if ((
bool)
dynamic_cast<o_sound::SystemCmdSound*
>(o_sound::Factory())) {
5117 wxBoxSizer* pSoundSizer =
new wxBoxSizer(wxVERTICAL);
5118 StatBoxSoundConfigSizer->Add(pSoundSizer, 0, wxALL | wxEXPAND,
5119 group_item_spacing);
5121 new wxTextCtrl(panelSounds, wxID_ANY,
"", wxDefaultPosition,
5122 wxSize(450, -1), wxTE_LEFT);
5124 new wxStaticText(panelSounds, wxID_ANY, _(
"Audio Play command:")), 0,
5125 wxALIGN_LEFT | wxALL);
5126 pSoundSizer->Add(pCmdSoundString, 1, wxEXPAND | wxALIGN_LEFT, border_size);
5130 if (!deviceCount) StatBoxSoundConfig->Hide();
5133 stSoundDeviceIndex->Hide();
5134 pSoundDeviceIndex->Hide();
5138void options::CreatePanel_MMSI(
size_t parent,
int border_size,
5139 int group_item_spacing) {
5140 wxScrolledWindow* panelMMSI = AddPage(parent, _(
"MMSI Properties"));
5142 wxBoxSizer* MMSISizer =
new wxBoxSizer(wxVERTICAL);
5143 panelMMSI->SetSizer(MMSISizer);
5146 wxStaticBox* itemStaticBoxMMSI =
5147 new wxStaticBox(panelMMSI, wxID_ANY, _(
"MMSI Properties"));
5148 wxStaticBoxSizer* itemStaticBoxSizerMMSI =
5149 new wxStaticBoxSizer(itemStaticBoxMMSI, wxVERTICAL);
5150 MMSISizer->Add(itemStaticBoxSizerMMSI, 0, wxALL | wxEXPAND, border_size);
5152 pPropsPanel =
new MMSI_Props_Panel(panelMMSI);
5154 pPropsPanel->UpdateMMSIList();
5156 itemStaticBoxSizerMMSI->Add(pPropsPanel, 0, wxALL | wxEXPAND, border_size);
5158 panelMMSI->Layout();
5161void options::CreatePanel_AIS(
size_t parent,
int border_size,
5162 int group_item_spacing) {
5163 wxScrolledWindow* panelAIS = AddPage(parent, _(
"AIS Targets"));
5165 wxBoxSizer* aisSizer =
new wxBoxSizer(wxVERTICAL);
5166 panelAIS->SetSizer(aisSizer);
5169 wxStaticBox* itemStaticBoxCPA =
5170 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA Calculation"));
5171 wxStaticBoxSizer* itemStaticBoxSizerCPA =
5172 new wxStaticBoxSizer(itemStaticBoxCPA, wxVERTICAL);
5173 aisSizer->Add(itemStaticBoxSizerCPA, 0, wxALL | wxEXPAND, border_size);
5175 wxFlexGridSizer* pCPAGrid =
new wxFlexGridSizer(2);
5176 pCPAGrid->AddGrowableCol(1);
5177 itemStaticBoxSizerCPA->Add(pCPAGrid, 0, wxALL | wxEXPAND, border_size);
5179 m_pCheck_CPA_Max =
new wxCheckBox(
5181 _(
"No (T)CPA Alerts if target range is greater than (NMi)"));
5182 m_pCheck_CPA_Max->SetToolTip(
5183 _(
"Disable CPA (Closest Point of Approach) and TCPA (Time to CPA) alerts "
5184 "for targets beyond this distance from your vessel"));
5185 pCPAGrid->Add(m_pCheck_CPA_Max, 0, wxALL, group_item_spacing);
5187 m_pText_CPA_Max =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5188 m_pText_CPA_Max->SetToolTip(
5189 _(
"Maximum distance in nautical miles at which Closest Point of Approach "
5190 "alerts will be triggered"));
5191 pCPAGrid->Add(m_pText_CPA_Max, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5194 new wxCheckBox(panelAIS, -1, _(
"Warn if CPA less than (NMi)"));
5195 m_pCheck_CPA_Warn->SetToolTip(
5196 _(
"Enable warning alerts when targets have a Closest Point of Approach "
5197 "less than this distance"));
5198 pCPAGrid->Add(m_pCheck_CPA_Warn, 0, wxALL, group_item_spacing);
5201 new wxTextCtrl(panelAIS, -1,
"TEXT ", wxDefaultPosition, wxSize(-1, -1));
5202 m_pText_CPA_Warn->SetToolTip(
5203 _(
"Distance threshold in nautical miles for CPA warning alerts"));
5204 pCPAGrid->Add(m_pText_CPA_Warn, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5206 m_pCheck_CPA_Warn->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5207 wxCommandEventHandler(options::OnCPAWarnClick),
5210 m_pCheck_CPA_WarnT =
5211 new wxCheckBox(panelAIS, -1, _(
"...and TCPA is less than (min)"));
5212 m_pCheck_CPA_WarnT->SetToolTip(
5213 _(
"Additional time constraint - alerts only occur if the Time to Closest "
5214 "Point of Approach is less than this value"));
5215 pCPAGrid->Add(m_pCheck_CPA_WarnT, 0, wxALL, group_item_spacing);
5217 m_pText_CPA_WarnT =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5218 m_pText_CPA_WarnT->SetToolTip(
5219 _(
"Time threshold in minutes for TCPA constraints"));
5220 pCPAGrid->Add(m_pText_CPA_WarnT, 0, wxALL | wxALIGN_RIGHT,
5221 group_item_spacing);
5224 wxStaticBox* lostBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Lost Targets"));
5225 wxStaticBoxSizer* lostSizer =
new wxStaticBoxSizer(lostBox, wxVERTICAL);
5226 aisSizer->Add(lostSizer, 0, wxALL | wxEXPAND, 3);
5228 wxFlexGridSizer* pLostGrid =
new wxFlexGridSizer(2);
5229 pLostGrid->AddGrowableCol(1);
5230 lostSizer->Add(pLostGrid, 0, wxALL | wxEXPAND, border_size);
5232 m_pCheck_Mark_Lost =
5233 new wxCheckBox(panelAIS, -1, _(
"Mark targets as lost after (min)"));
5234 m_pCheck_Mark_Lost->SetToolTip(
5235 _(
"Targets will be considered lost when no update is received for this "
5237 pLostGrid->Add(m_pCheck_Mark_Lost, 1, wxALL, group_item_spacing);
5239 m_pText_Mark_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5240 m_pText_Mark_Lost->SetToolTip(
5241 _(
"Time in minutes after which targets with no updates are marked as "
5243 pLostGrid->Add(m_pText_Mark_Lost, 1, wxALL | wxALIGN_RIGHT,
5244 group_item_spacing);
5246 m_pCheck_Remove_Lost =
5247 new wxCheckBox(panelAIS, -1, _(
"Remove lost targets after (min)"));
5248 m_pCheck_Remove_Lost->SetToolTip(
5249 _(
"Lost targets will be completely removed from display after this "
5250 "additional time period"));
5251 pLostGrid->Add(m_pCheck_Remove_Lost, 1, wxALL, group_item_spacing);
5253 m_pText_Remove_Lost =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5254 m_pText_Remove_Lost->SetToolTip(_(
5255 "Time in minutes after which lost targets are removed from the display"));
5256 pLostGrid->Add(m_pText_Remove_Lost, 1, wxALL | wxALIGN_RIGHT,
5257 group_item_spacing);
5259 if (g_bInlandEcdis) lostSizer->Hide(pLostGrid,
true);
5262 wxStaticBox* displBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Display"));
5263 wxStaticBoxSizer* displSizer =
new wxStaticBoxSizer(displBox, wxHORIZONTAL);
5264 aisSizer->Add(displSizer, 0, wxALL | wxEXPAND, border_size);
5266 wxFlexGridSizer* pDisplayGrid =
new wxFlexGridSizer(2);
5267 pDisplayGrid->AddGrowableCol(1);
5268 displSizer->Add(pDisplayGrid, 1, wxALL | wxEXPAND, border_size);
5270 m_pCheck_Show_COG =
new wxCheckBox(
5271 panelAIS, -1, _(
"Show target COG predictor arrow, length (min)"));
5272 m_pCheck_Show_COG->SetToolTip(
5273 _(
"Display a predictor arrow for each AIS target, showing its projected "
5274 "course over ground for the specified number of minutes."));
5275 pDisplayGrid->Add(m_pCheck_Show_COG, 1, wxALL | wxEXPAND, group_item_spacing);
5277 m_pText_COG_Predictor =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5278 m_pText_COG_Predictor->SetToolTip(
5279 _(
"Set the length in minutes for the COG predictor arrow for AIS "
5281 pDisplayGrid->Add(m_pText_COG_Predictor, 1, wxALL | wxALIGN_RIGHT,
5282 group_item_spacing);
5284 m_pCheck_Sync_OCOG_ACOG =
new wxCheckBox(
5285 panelAIS, -1, _(
"Sync AIS arrow length with own ship's COG predictor"));
5286 pDisplayGrid->Add(m_pCheck_Sync_OCOG_ACOG, 1, wxALL, group_item_spacing);
5287 m_pCheck_Sync_OCOG_ACOG->Connect(
5288 wxEVT_COMMAND_CHECKBOX_CLICKED,
5289 wxCommandEventHandler(options::OnSyncCogPredClick), NULL,
this);
5291 wxStaticText* pStatic_Dummy4a =
new wxStaticText(panelAIS, -1,
"");
5292 pDisplayGrid->Add(pStatic_Dummy4a, 1, wxALL, group_item_spacing);
5294 m_pCheck_Show_Tracks =
5295 new wxCheckBox(panelAIS, -1, _(
"Show target tracks, length (min)"));
5296 m_pCheck_Show_Tracks->SetToolTip(
5297 _(
"Display the recent track (history) of each AIS target for the "
5298 "specified number of minutes."));
5299 pDisplayGrid->Add(m_pCheck_Show_Tracks, 1, wxALL, group_item_spacing);
5301 m_pText_Track_Length =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5302 pDisplayGrid->Add(m_pText_Track_Length, 1, wxALL | wxALIGN_RIGHT,
5303 group_item_spacing);
5305 m_pCheck_Hide_Moored =
new wxCheckBox(
5306 panelAIS, -1, _(
"Suppress anchored/moored targets, speed max (kn)"));
5307 m_pCheck_Hide_Moored->SetToolTip(
5308 _(
"Hide AIS targets that are moving slower than this speed, typically "
5309 "indicating they are anchored or moored."));
5310 pDisplayGrid->Add(m_pCheck_Hide_Moored, 1, wxALL, group_item_spacing);
5312 m_pText_Moored_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5313 pDisplayGrid->Add(m_pText_Moored_Speed, 1, wxALL | wxALIGN_RIGHT,
5314 group_item_spacing);
5316 m_pCheck_Draw_Realtime_Prediction =
new wxCheckBox(
5317 panelAIS, -1, _(
"Draw AIS realtime prediction, target speed min (kn)"));
5318 m_pCheck_Draw_Realtime_Prediction->SetToolTip(
5319 _(
"Show a real-time prediction vector for AIS targets moving faster than "
5321 pDisplayGrid->Add(m_pCheck_Draw_Realtime_Prediction, 1, wxALL,
5322 group_item_spacing);
5324 m_pText_RealtPred_Speed =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5325 pDisplayGrid->Add(m_pText_RealtPred_Speed, 1, wxALL | wxALIGN_RIGHT,
5326 group_item_spacing);
5328 m_pCheck_Scale_Priority =
new wxCheckBox(
5330 _(
"Allow attenuation of less critical targets if more than ... targets"));
5331 m_pCheck_Scale_Priority->SetToolTip(
5332 _(
"Reduce the display prominence of less critical AIS targets when the "
5333 "number of targets exceeds the specified value."));
5334 pDisplayGrid->Add(m_pCheck_Scale_Priority, 1, wxALL, group_item_spacing);
5336 m_pText_Scale_Priority =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5337 pDisplayGrid->Add(m_pText_Scale_Priority, 1, wxALL | wxALIGN_RIGHT,
5338 group_item_spacing);
5340 m_pCheck_Show_Area_Notices =
new wxCheckBox(
5341 panelAIS, -1, _(
"Show area notices (from AIS binary messages)"));
5342 m_pCheck_Show_Area_Notices->SetToolTip(
5343 _(
"Display area notices received via AIS binary messages on the chart."));
5344 pDisplayGrid->Add(m_pCheck_Show_Area_Notices, 1, wxALL, group_item_spacing);
5346 wxStaticText* pStatic_Dummy5 =
new wxStaticText(panelAIS, -1,
"");
5347 pDisplayGrid->Add(pStatic_Dummy5, 1, wxALL, group_item_spacing);
5349 m_pCheck_Draw_Target_Size =
5350 new wxCheckBox(panelAIS, -1, _(
"Show AIS targets real size"));
5351 m_pCheck_Draw_Target_Size->SetToolTip(
5352 _(
"Display AIS targets using their actual reported size and shape on the "
5354 pDisplayGrid->Add(m_pCheck_Draw_Target_Size, 1, wxALL, group_item_spacing);
5356 wxStaticText* pStatic_Dummy6 =
new wxStaticText(panelAIS, -1,
"");
5357 pDisplayGrid->Add(pStatic_Dummy6, 1, wxALL, group_item_spacing);
5359 m_pCheck_Show_Target_Name =
new wxCheckBox(
5360 panelAIS, -1, _(
"Show names with AIS targets at scale greater than 1:"));
5361 m_pCheck_Show_Target_Name->SetToolTip(
5362 _(
"Display the name of AIS targets when the chart scale is greater than "
5363 "the specified value."));
5364 pDisplayGrid->Add(m_pCheck_Show_Target_Name, 1, wxALL, group_item_spacing);
5366 m_pText_Show_Target_Name_Scale =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5367 pDisplayGrid->Add(m_pText_Show_Target_Name_Scale, 1, wxALL | wxALIGN_RIGHT,
5368 group_item_spacing);
5370 m_pCheck_use_Wpl =
new wxCheckBox(
5371 panelAIS, -1, _(
"Use WPL position messages. Action when received:"));
5372 m_pCheck_use_Wpl->SetToolTip(
5373 _(
"Enable processing of WPL (Waypoint Location) position messages from "
5374 "AIS and select the action to take when received."));
5375 pDisplayGrid->Add(m_pCheck_use_Wpl, 1, wxALL, group_item_spacing);
5377 wxString Wpl_Action[] = {_(
"APRS position report"), _(
"Create mark")};
5378 m_pWplAction =
new wxChoice(panelAIS, wxID_ANY, wxDefaultPosition,
5379 wxDefaultSize, 2, Wpl_Action);
5380 m_pWplAction->SetToolTip(
5381 _(
"Select the action to perform when a WPL message is received: create "
5382 "an Automatic Packet Reporting System (APRS) report or a mark on the "
5384 pDisplayGrid->Add(m_pWplAction, 1, wxALIGN_RIGHT | wxALL, group_item_spacing);
5387 wxStaticBox* rolloverBox =
new wxStaticBox(panelAIS, wxID_ANY, _(
"Rollover"));
5388 wxStaticBoxSizer* rolloverSizer =
5389 new wxStaticBoxSizer(rolloverBox, wxVERTICAL);
5390 aisSizer->Add(rolloverSizer, 0, wxALL | wxEXPAND, border_size);
5392 pRollover =
new wxCheckBox(panelAIS, ID_ROLLOVERBOX,
5393 _(
"Enable route/AIS info block"));
5394 pRollover->SetToolTip(
5395 _(
"Show a popup info block with details about routes and AIS targets "
5396 "when hovering over them."));
5397 rolloverSizer->Add(pRollover, 1, wxALL, 2 * group_item_spacing);
5399 pRollover->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
5400 wxCommandEventHandler(options::OnAISRolloverClick), NULL,
5404 new wxStaticText(panelAIS, -1, _(
"\"Ship Name\" MMSI (Call Sign)"));
5405 pStatic_CallSign->SetToolTip(
5406 _(
"Display the ship name and MMSI (call sign) in the rollover info "
5408 rolloverSizer->Add(pStatic_CallSign, 1, wxALL, 2 * group_item_spacing);
5410 m_pCheck_Rollover_Class =
5411 new wxCheckBox(panelAIS, -1, _(
"[Class] Type (Status)"));
5412 m_pCheck_Rollover_Class->SetToolTip(
5413 _(
"Show the AIS class, type, and status in the rollover info block."));
5414 rolloverSizer->Add(m_pCheck_Rollover_Class, 1, wxALL, 2 * group_item_spacing);
5416 m_pCheck_Rollover_COG =
new wxCheckBox(panelAIS, -1, _(
"SOG COG"));
5417 m_pCheck_Rollover_COG->SetToolTip(
5418 _(
"Show speed over ground (SOG) and course over ground (COG) in the "
5419 "rollover info block."));
5420 rolloverSizer->Add(m_pCheck_Rollover_COG, 1, wxALL, 2 * group_item_spacing);
5422 m_pCheck_Rollover_CPA =
new wxCheckBox(panelAIS, -1, _(
"CPA TCPA"));
5423 m_pCheck_Rollover_CPA->SetToolTip(
5424 _(
"Show Closest Point of Approach (CPA) and time to CPA (TCPA) in the "
5425 "rollover info block."));
5426 rolloverSizer->Add(m_pCheck_Rollover_CPA, 1, wxALL, 2 * group_item_spacing);
5429 wxStaticBox* alertBox =
5430 new wxStaticBox(panelAIS, wxID_ANY, _(
"CPA/TCPA Alerts"));
5431 wxStaticBoxSizer* alertSizer =
new wxStaticBoxSizer(alertBox, wxVERTICAL);
5432 aisSizer->Add(alertSizer, 0, wxALL | wxEXPAND, group_item_spacing);
5434 wxFlexGridSizer* pAlertGrid =
new wxFlexGridSizer(2);
5435 pAlertGrid->AddGrowableCol(1);
5436 alertSizer->Add(pAlertGrid, 0, wxALL | wxEXPAND, group_item_spacing);
5438 m_pCheck_AlertDialog =
new wxCheckBox(panelAIS, ID_AISALERTDIALOG,
5439 _(
"Show CPA/TCPA Alert Dialog"));
5440 pAlertGrid->Add(m_pCheck_AlertDialog, 0, wxALL, group_item_spacing);
5442 m_pCheck_AlertDialog->Connect(
5443 wxEVT_COMMAND_CHECKBOX_CLICKED,
5444 wxCommandEventHandler(options::OnAlertEnableButtonClick), NULL,
this);
5453 wxStaticText* pStatic_Dummy5a =
new wxStaticText(panelAIS, -1,
"");
5454 pAlertGrid->Add(pStatic_Dummy5a, 1, wxALL, group_item_spacing);
5456 m_pCheck_AlertAudio =
new wxCheckBox(
5457 panelAIS, ID_AISALERTAUDIO,
5458 _(
"Play Sound on CPA/TCPA Alerts and DSC/SART emergencies."));
5459 pAlertGrid->Add(m_pCheck_AlertAudio, 0, wxALL, group_item_spacing);
5461 m_pCheck_AlertAudio->Connect(
5462 wxEVT_COMMAND_CHECKBOX_CLICKED,
5463 wxCommandEventHandler(options::OnAlertAudioEnableButtonClick), NULL,
5466 wxButton* m_pPlay_Sound =
5467 new wxButton(panelAIS, -1, _(
"Test AIS Alert Sound"), wxDefaultPosition,
5468 m_small_button_size, 0);
5469 pAlertGrid->Add(m_pPlay_Sound, 0, wxALL | wxALIGN_RIGHT, group_item_spacing);
5471 m_pPlay_Sound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
5472 wxCommandEventHandler(options::OnButtonTestSound),
5478 m_pCheck_Alert_Moored =
new wxCheckBox(
5479 panelAIS, -1, _(
"Suppress Alerts for anchored/moored targets"));
5480 pAlertGrid->Add(m_pCheck_Alert_Moored, 1, wxALL, group_item_spacing);
5482 wxStaticText* pStatic_Dummy2 =
new wxStaticText(panelAIS, -1,
"");
5483 pAlertGrid->Add(pStatic_Dummy2, 1, wxALL, group_item_spacing);
5485 m_pCheck_Ack_Timout =
new wxCheckBox(
5486 panelAIS, -1, _(
"Enable Target Alert Acknowledge timeout (min)"));
5487 pAlertGrid->Add(m_pCheck_Ack_Timout, 1, wxALL, group_item_spacing);
5489 m_pText_ACK_Timeout =
new wxTextCtrl(panelAIS, -1,
"TEXT ");
5490 pAlertGrid->Add(m_pText_ACK_Timeout, 1, wxALL | wxALIGN_RIGHT,
5491 group_item_spacing);
5496class MouseZoomSlider :
public wxSlider {
5498 MouseZoomSlider(wxWindow* parent, wxSize size)
5499 : wxSlider(parent, wxID_ANY, 10, 1, 100, wxDefaultPosition, size,
5503 GetHandle()->setStyleSheet(getQtStyleSheet());
5508void options::CreatePanel_UI(
size_t parent,
int border_size,
5509 int group_item_spacing) {
5510 wxScrolledWindow* itemPanelFont = AddPage(parent, _(
"General Options"));
5512 m_itemBoxSizerFontPanel =
new wxBoxSizer(wxVERTICAL);
5513 itemPanelFont->SetSizer(m_itemBoxSizerFontPanel);
5515 wxBoxSizer* langStyleBox =
new wxBoxSizer(wxHORIZONTAL);
5516 m_itemBoxSizerFontPanel->Add(langStyleBox, 0, wxEXPAND | wxALL, border_size);
5518 wxStaticBox* itemLangStaticBox =
5519 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Language"));
5520 wxStaticBoxSizer* itemLangStaticBoxSizer =
5521 new wxStaticBoxSizer(itemLangStaticBox, wxVERTICAL);
5523 langStyleBox->Add(itemLangStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5525 wxSize langChoiceSize = wxSize(-1, -1);
5528 langChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5531 m_itemLangListBox =
new wxChoice(itemPanelFont, ID_CHOICE_LANG,
5532 wxDefaultPosition, langChoiceSize);
5534 itemLangStaticBoxSizer->Add(m_itemLangListBox, 0, wxEXPAND | wxALL,
5541 wxStaticBox* itemFontStaticBox =
5542 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Fonts"));
5544 wxSize fontChoiceSize = wxSize(-1, -1);
5546 int fLayout = wxHORIZONTAL;
5549 if (m_nCharWidthMax < 40) fLayout = wxVERTICAL;
5552 fontChoiceSize = wxSize(-1, m_fontHeight * 3 / 4);
5555 wxStaticBoxSizer* itemFontStaticBoxSizer =
5556 new wxStaticBoxSizer(itemFontStaticBox, fLayout);
5557 m_itemBoxSizerFontPanel->Add(itemFontStaticBoxSizer, 0, wxEXPAND | wxALL,
5560 m_itemFontElementListBox =
5561 new wxChoice(itemPanelFont, ID_CHOICE_FONTELEMENT, wxDefaultPosition,
5562 fontChoiceSize, 0, NULL, wxCB_SORT);
5564 wxArrayString uniqueStrings = FontMgr::Get().GetDialogStrings(g_locale);
5565 for (
size_t i = 0; i < uniqueStrings.GetCount(); i++) {
5566 m_itemFontElementListBox->Append(uniqueStrings[i]);
5569 if (uniqueStrings.GetCount()) m_itemFontElementListBox->SetSelection(0);
5571 itemFontStaticBoxSizer->Add(m_itemFontElementListBox, 0, wxALL, border_size);
5573 wxButton* itemFontChooseButton =
5574 new wxButton(itemPanelFont, ID_BUTTONFONTCHOOSE, _(
"Choose Font..."),
5575 wxDefaultPosition, wxDefaultSize, 0);
5576 itemFontStaticBoxSizer->Add(itemFontChooseButton, 0, wxALL, border_size);
5577#if defined(__WXGTK__) || defined(__WXQT__)
5578 wxButton* itemFontColorButton =
5579 new wxButton(itemPanelFont, ID_BUTTONFONTCOLOR, _(
"Choose Font Color..."),
5580 wxDefaultPosition, wxDefaultSize, 0);
5581 itemFontStaticBoxSizer->Add(itemFontColorButton, 0, wxALL, border_size);
5583 wxButton* itemFontResetButton =
5584 new wxButton(itemPanelFont, ID_BUTTONFONT_RESET, _(
"Reset to Default"),
5585 wxDefaultPosition, wxDefaultSize, 0);
5586 itemFontStaticBoxSizer->Add(itemFontResetButton, 0, wxALL, border_size);
5588 m_textSample =
new wxStaticText(itemPanelFont, wxID_ANY, _(
"Sample"),
5589 wxDefaultPosition, wxDefaultSize, 0);
5590 itemFontStaticBoxSizer->Add(m_textSample, 0, wxALL, border_size);
5595 wxStaticBox* itemStyleStaticBox =
5596 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Toolbar and Window Style"));
5597 wxStaticBoxSizer* itemStyleStaticBoxSizer =
5598 new wxStaticBoxSizer(itemStyleStaticBox, wxVERTICAL);
5599 langStyleBox->Add(itemStyleStaticBoxSizer, 1, wxEXPAND | wxALL, border_size);
5601 m_itemStyleListBox =
new wxChoice(itemPanelFont, ID_STYLESCOMBOBOX);
5604 for (
unsigned int i = 0; i < styles.Count(); i++) {
5605 ocpnStyle::Style* style = (ocpnStyle::Style*)(styles[i]);
5606 m_itemStyleListBox->Append(style->name);
5608 m_itemStyleListBox->SetStringSelection(
5610 itemStyleStaticBoxSizer->Add(m_itemStyleListBox, 1, wxEXPAND | wxALL,
5613 wxStaticBox* miscOptionsBox =
5614 new wxStaticBox(itemPanelFont, wxID_ANY, _(
"Interface Options"));
5615 wxStaticBoxSizer* miscOptions =
5616 new wxStaticBoxSizer(miscOptionsBox, wxVERTICAL);
5617 m_itemBoxSizerFontPanel->Add(miscOptions, 0, wxALL | wxEXPAND, border_size);
5620 new wxCheckBox(itemPanelFont, ID_DEBUGCHECKBOX1, _(
"Show Status Bar"));
5621 pShowStatusBar->SetValue(FALSE);
5622 miscOptions->Add(pShowStatusBar, 0, wxALL, border_size);
5625 pShowMenuBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Menu Bar"));
5626 pShowMenuBar->SetValue(FALSE);
5627 miscOptions->Add(pShowMenuBar, 0, wxALL, border_size);
5631 pShowMenuBar->Hide();
5634 pShowChartBar =
new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Show Chart Bar"));
5635 pShowChartBar->SetValue(g_bShowChartBar);
5636 miscOptions->Add(pShowChartBar, 0, wxALL, border_size);
5638 pShowCompassWin =
new wxCheckBox(itemPanelFont, wxID_ANY,
5639 _(
"Show Compass/GPS Status Window"));
5640 pShowCompassWin->SetValue(FALSE);
5641 miscOptions->Add(pShowCompassWin, 0, wxALL, border_size);
5643 wxBoxSizer* pToolbarAutoHide =
new wxBoxSizer(wxHORIZONTAL);
5644 miscOptions->Add(pToolbarAutoHide, 0, wxALL | wxEXPAND, group_item_spacing);
5646 pToolbarAutoHideCB =
5647 new wxCheckBox(itemPanelFont, wxID_ANY, _(
"Enable Toolbar auto-hide"));
5648 pToolbarAutoHide->Add(pToolbarAutoHideCB, 0, wxALL, group_item_spacing);
5650 new wxTextCtrl(itemPanelFont, ID_OPTEXTCTRL,
"", wxDefaultPosition,
5651 wxSize(50, -1), wxTE_RIGHT);
5652 pToolbarAutoHide->Add(pToolbarHideSecs, 0, wxALL, group_item_spacing);
5654 pToolbarAutoHide->Add(
new wxStaticText(itemPanelFont, wxID_ANY, _(
"seconds")),
5655 group_item_spacing);
5657 auto enable_debug_cb =
new wxCheckBox(itemPanelFont, wxID_ANY,
5658 _(
"Enable Debug in root context menu"));
5659 enable_debug_cb->Bind(wxEVT_CHECKBOX, [enable_debug_cb](wxCommandEvent&) {
5660 g_enable_root_menu_debug = enable_debug_cb->IsChecked();
5662 enable_debug_cb->SetValue(g_enable_root_menu_debug);
5663 miscOptions->Add(enable_debug_cb, 0, wxALL, border_size);
5667 new wxCheckBox(itemPanelFont, ID_BELLSCHECKBOX, _(
"Play Ships Bells"));
5668 miscOptions->Add(pPlayShipsBells, 0, wxALL | wxEXPAND, border_size);
5671 pMobile =
new wxCheckBox(itemPanelFont, ID_MOBILEBOX,
5672 _(
"Enable Touchscreen interface"));
5673 miscOptions->Add(pMobile, 0, wxALL, border_size);
5675 pResponsive =
new wxCheckBox(itemPanelFont, ID_REPONSIVEBOX,
5676 _(
"Enable Scaled Graphics interface"));
5677 miscOptions->Add(pResponsive, 0, wxALL, border_size);
5682 pResponsive->Hide();
5686 pResponsive->Hide();
5689 new wxCheckBox(itemPanelFont, ID_ZOOMBUTTONS, _(
"Show Zoom buttons"));
5690 miscOptions->Add(pZoomButtons, 0, wxALL, border_size);
5692 pZoomButtons->Hide();
5695 pHiconColors =
new wxCheckBox(itemPanelFont, ID_HICONCOLORS,
5696 _(
"Use High Contrast Chart Colors"));
5697 miscOptions->Add(pHiconColors, 0, wxALL, border_size);
5701 pSLiveETA =
new wxCheckBox(itemPanelFont, ID_CHECK_LIVEETA,
5702 _(
"Show Live ETA at Cursor on Status Bar"));
5703 miscOptions->Add(pSLiveETA, 0, wxALL, border_size);
5706 new wxCheckBox(itemPanelFont, ID_INLANDECDISBOX, _(
"Use Inland ECDIS"));
5707 miscOptions->Add(pInlandEcdis, 0, wxALL, border_size);
5709 wxButton* itemEcdisHelp =
5710 new wxButton(itemPanelFont, ID_BUTTONECDISHELP, _(
"Inland ECDIS Manual"),
5711 wxDefaultPosition, wxDefaultSize, 0);
5712 miscOptions->Add(itemEcdisHelp, 0, wxALL, border_size);
5715 pInlandEcdis->Hide();
5716 itemEcdisHelp->Hide();
5719 miscOptions->AddSpacer(10);
5721 wxFlexGridSizer* sliderSizer;
5722 sliderSizer =
new wxFlexGridSizer(0, 2, 0, 0);
5723 sliderSizer->AddGrowableCol(1);
5724 sliderSizer->SetFlexibleDirection(wxBOTH);
5725 sliderSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
5727 m_pSlider_GUI_Factor =
5728 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5729 m_sliderSize, SLIDER_STYLE);
5730 m_pSlider_GUI_Factor->Hide();
5731 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5732 _(
"User Interface scale factor")),
5734 sliderSizer->Add(m_pSlider_GUI_Factor, 0, wxALL, border_size);
5735 m_pSlider_GUI_Factor->Show();
5738 prepareSlider(m_pSlider_GUI_Factor);
5741 m_pSlider_Chart_Factor =
5742 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5743 m_sliderSize, SLIDER_STYLE);
5744 m_pSlider_Chart_Factor->Hide();
5746 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Chart Object scale factor")),
5748 sliderSizer->Add(m_pSlider_Chart_Factor, 0, wxALL, border_size);
5749 m_pSlider_Chart_Factor->Show();
5752 prepareSlider(m_pSlider_Chart_Factor);
5755 m_pSlider_Ship_Factor =
5756 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5757 m_sliderSize, SLIDER_STYLE);
5758 m_pSlider_Ship_Factor->Hide();
5760 new wxStaticText(itemPanelFont, wxID_ANY, _(
"Ship scale factor")),
5762 sliderSizer->Add(m_pSlider_Ship_Factor, 0, wxALL, border_size);
5763 m_pSlider_Ship_Factor->Show();
5766 m_pSlider_Ship_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5769 m_pSlider_Text_Factor =
5770 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5771 m_sliderSize, SLIDER_STYLE);
5772 m_pSlider_Text_Factor->Hide();
5774 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Sounding factor")),
5776 sliderSizer->Add(m_pSlider_Text_Factor, 0, wxALL, border_size);
5777 m_pSlider_Text_Factor->Show();
5780 m_pSlider_Text_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5783 m_pSlider_ENCText_Factor =
5784 new wxSlider(itemPanelFont, wxID_ANY, 0, -5, 5, wxDefaultPosition,
5785 m_sliderSize, SLIDER_STYLE);
5786 m_pSlider_ENCText_Factor->Hide();
5788 new wxStaticText(itemPanelFont, wxID_ANY, _(
"ENC Text Scale")),
5790 sliderSizer->Add(m_pSlider_ENCText_Factor, 0, wxALL, border_size);
5791 m_pSlider_ENCText_Factor->Show();
5794 m_pSlider_ENCText_Factor->GetHandle()->setStyleSheet(getQtStyleSheet());
5797 sliderSizer->Add(
new wxStaticText(itemPanelFont, wxID_ANY,
5798 _(
"Mouse wheel zoom sensitivity")),
5800 m_pMouse_Zoom_Slider =
new MouseZoomSlider(itemPanelFont, m_sliderSize);
5801 sliderSizer->Add(m_pMouse_Zoom_Slider, 0, wxALL, border_size);
5803 miscOptions->Add(sliderSizer, 0, wxEXPAND, 5);
5804 miscOptions->AddSpacer(20);
5807void options::OnResetFont(wxCommandEvent& event) {
5808 wxString itemElement;
5809 int i = m_itemFontElementListBox->GetSelection();
5811 itemElement = m_itemFontElementListBox->GetString(i);
5813 if (FontMgr::Get().ResetFontToDefault(itemElement)) {
5815 wxFont* pFont = FontMgr::Get().
GetFont(itemElement);
5816 wxColour colour = FontMgr::Get().
GetFontColor(itemElement);
5819 m_textSample->SetFont(*pFont);
5820 m_textSample->SetForegroundColour(colour);
5821 m_textSample->Refresh();
5824 top_frame::Get()->UpdateAllFonts();
5825 m_bfontChanged =
true;
5826 OnFontChoice(event);
5831void options::OnAlertEnableButtonClick(wxCommandEvent& event) {
5832 m_pCheck_AlertAudio->Enable(event.IsChecked());
5833 if (!event.IsChecked()) m_pCheck_AlertAudio->SetValue(
false);
5836void options::OnAlertAudioEnableButtonClick(wxCommandEvent& event) {
5837 if (event.IsChecked()) {
5838 m_soundPanelAIS->GetCheckBox()->SetValue(
true);
5839 m_soundPanelSART->GetCheckBox()->SetValue(
true);
5840 m_soundPanelDSC->GetCheckBox()->SetValue(
true);
5844void options::CreateListbookIcons() {
5847 if (!g_bresponsive) {
5850 m_topImgList =
new wxImageList(sx, sy, TRUE, 0);
5852#if wxCHECK_VERSION(2, 8, 12)
5853 m_topImgList->Add(style->GetIcon(
"Display", sx, sy));
5854 m_topImgList->Add(style->GetIcon(
"Charts", sx, sy));
5855 m_topImgList->Add(style->GetIcon(
"Connections", sx, sy));
5856 m_topImgList->Add(style->GetIcon(
"Ship", sx, sy));
5857 m_topImgList->Add(style->GetIcon(
"UI", sx, sy));
5858 m_topImgList->Add(style->GetIcon(
"Plugins", sx, sy));
5862 bmp = style->GetIcon(
"Display");
5863 img = bmp.ConvertToImage();
5864 img.ConvertAlphaToMask(128);
5865 bmp = wxBitmap(img);
5866 m_topImgList->Add(bmp);
5867 bmp = style->GetIcon(
"Charts");
5868 img = bmp.ConvertToImage();
5869 img.ConvertAlphaToMask(128);
5870 bmp = wxBitmap(img);
5871 m_topImgList->Add(bmp);
5872 bmp = style->GetIcon(
"Connections");
5873 img = bmp.ConvertToImage();
5874 img.ConvertAlphaToMask(128);
5875 bmp = wxBitmap(img);
5876 m_topImgList->Add(bmp);
5877 bmp = style->GetIcon(
"Ship");
5878 img = bmp.ConvertToImage();
5879 img.ConvertAlphaToMask(128);
5880 bmp = wxBitmap(img);
5881 m_topImgList->Add(bmp);
5882 bmp = style->GetIcon(
"UI");
5883 img = bmp.ConvertToImage();
5884 img.ConvertAlphaToMask(128);
5885 bmp = wxBitmap(img);
5886 m_topImgList->Add(bmp);
5887 bmp = style->GetIcon(
"Plugins");
5888 img = bmp.ConvertToImage();
5889 img.ConvertAlphaToMask(128);
5890 bmp = wxBitmap(img);
5891 m_topImgList->Add(bmp);
5895 bmps = style->GetIcon(
"Display");
5896 int base_size = bmps.GetWidth();
5897 double tool_size = base_size;
5899 double premult = 1.0;
5903 double target_size = 6.0;
5905 double basic_tool_size_mm = tool_size /
g_Platform->GetDisplayDPmm();
5906 premult = target_size / basic_tool_size_mm;
5909 double postmult = exp(g_GUIScaleFactor * (0.693 / 5.0));
5910 postmult = wxMin(postmult, 3.0);
5911 postmult = wxMax(postmult, 1.0);
5913 int sizeTab = base_size * postmult * premult;
5915 m_topImgList =
new wxImageList(sizeTab, sizeTab, TRUE, 1);
5919 bmp = style->GetIcon(
"Display");
5920 img = bmp.ConvertToImage();
5921 simg = img.Scale(sizeTab, sizeTab);
5922 bmp = wxBitmap(simg);
5923 m_topImgList->Add(bmp);
5924 bmp = style->GetIcon(
"Charts");
5925 img = bmp.ConvertToImage();
5926 simg = img.Scale(sizeTab, sizeTab);
5927 bmp = wxBitmap(simg);
5928 m_topImgList->Add(bmp);
5929 bmp = style->GetIcon(
"Connections");
5930 img = bmp.ConvertToImage();
5931 simg = img.Scale(sizeTab, sizeTab);
5932 bmp = wxBitmap(simg);
5933 m_topImgList->Add(bmp);
5934 bmp = style->GetIcon(
"Ship");
5935 img = bmp.ConvertToImage();
5936 simg = img.Scale(sizeTab, sizeTab);
5937 bmp = wxBitmap(simg);
5938 m_topImgList->Add(bmp);
5939 bmp = style->GetIcon(
"UI");
5940 img = bmp.ConvertToImage();
5941 simg = img.Scale(sizeTab, sizeTab);
5942 bmp = wxBitmap(simg);
5943 m_topImgList->Add(bmp);
5944 bmp = style->GetIcon(
"Plugins");
5945 img = bmp.ConvertToImage();
5946 simg = img.Scale(sizeTab, sizeTab);
5947 bmp = wxBitmap(simg);
5948 m_topImgList->Add(bmp);
5952void options::CreateControls() {
5953 int border_size = 4;
5955 int group_item_spacing = 2;
5957 int font_size_y, font_descent, font_lead;
5958 GetTextExtent(
"0", NULL, &font_size_y, &font_descent, &font_lead);
5959 m_fontHeight = font_size_y + font_descent + font_lead;
5964 m_fontHeight * 8 / 10);
5971 m_small_button_size =
5972 wxSize(-1, (
int)(1.2 * (font_size_y + font_descent )));
5974 m_nCharWidthMax = GetSize().x / GetCharWidth();
5977 pEnableZoomToCursor = NULL;
5978 pSmoothPanZoom = NULL;
5986 if (!g_bresponsive && height <= 800) {
5988 group_item_spacing = 1;
5992 wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, group_item_spacing);
5993 inputFlags = wxSizerFlags(0)
5994 .Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL)
5995 .Border(wxALL, group_item_spacing);
5996 verticleInputFlags =
5997 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
5998 groupLabelFlags = wxSizerFlags(0)
5999 .Align(wxALIGN_RIGHT | wxALIGN_TOP)
6000 .Border(wxALL, group_item_spacing);
6001 groupLabelFlagsHoriz =
6002 wxSizerFlags(0).Align(wxALIGN_TOP).Border(wxALL, group_item_spacing);
6003 groupInputFlags = wxSizerFlags(0)
6004 .Align(wxALIGN_LEFT | wxALIGN_TOP)
6005 .Border(wxBOTTOM, group_item_spacing * 2)
6009 groupLabelFlags.Border(wxTOP, group_item_spacing + 3);
6012 options* itemDialog1 =
this;
6014 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
6015 itemDialog1->SetSizer(itemBoxSizer2);
6019 wxFont* qFont = dialogFont;
6021 wxString wqs = getFontQtStylesheet(qFont);
6022 wxCharBuffer sbuf = wqs.ToUTF8();
6023 QString qsb = QString(sbuf.data());
6025 QString qsbq = getQtStyleSheet();
6027 itemDialog1->GetHandle()->setStyleSheet(qsb +
6034#ifdef OCPN_OPTIONS_USE_LISTBOOK
6036 m_pListbook =
new wxListbook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6037 wxSize(-1, -1), flags);
6038 m_pListbook->Connect(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
6039 wxListbookEventHandler(options::OnPageChange), NULL,
6043 m_pListbook =
new wxNotebook(itemDialog1, ID_NOTEBOOK, wxDefaultPosition,
6044 wxSize(-1, -1), flags);
6045 m_pListbook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6046 wxNotebookEventHandler(options::OnTopNBPageChange), NULL,
6053 m_pListbook->GetHandle()->setStyleSheet(getListBookStyleSheet());
6057 CreateListbookIcons();
6059 m_pListbook->SetImageList(m_topImgList);
6060 itemBoxSizer2->Add(m_pListbook, 1, wxALL | wxEXPAND, border_size);
6062 m_OK_Cancel_Apply_buttons =
new wxBoxSizer(wxHORIZONTAL);
6063 itemBoxSizer2->Add(m_OK_Cancel_Apply_buttons, 0, wxALIGN_RIGHT | wxALL,
6066 m_OKButton =
new wxButton(itemDialog1, xID_OK, _(
"Ok"));
6067 m_OKButton->SetDefault();
6068 m_OK_Cancel_Apply_buttons->Add(m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
6071 m_CancelButton =
new wxButton(itemDialog1, wxID_CANCEL, _(
"Cancel"));
6072 m_OK_Cancel_Apply_buttons->Add(m_CancelButton, 0,
6073 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6075 m_ApplyButton =
new wxButton(itemDialog1, ID_APPLY, _(
"Apply"));
6076 m_OK_Cancel_Apply_buttons->Add(m_ApplyButton, 0,
6077 wxALIGN_CENTER_VERTICAL | wxALL, border_size);
6079 m_pageDisplay = CreatePanel(_(
"Display"));
6080 CreatePanel_Display(m_pageDisplay, border_size, group_item_spacing);
6081 CreatePanel_Units(m_pageDisplay, border_size, group_item_spacing);
6082 CreatePanel_Advanced(m_pageDisplay, border_size, group_item_spacing);
6083 CreatePanel_Configs(m_pageDisplay, border_size, group_item_spacing);
6085 m_pageCharts = CreatePanel(_(
"Charts"));
6086 CreatePanel_ChartsLoad(m_pageCharts, border_size, group_item_spacing);
6087 CreatePanel_VectorCharts(m_pageCharts, border_size, group_item_spacing);
6090 CreatePanel_ChartGroups(m_pageCharts, border_size, group_item_spacing);
6091 CreatePanel_TidesCurrents(m_pageCharts, border_size, group_item_spacing);
6094 dynamic_cast<wxNotebook*
>(m_pListbook->GetPage(m_pageCharts));
6096#ifdef OCPN_OPTIONS_USE_LISTBOOK
6097 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6098 wxListbookEventHandler(options::OnChartsPageChange), NULL,
6101 nb->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
6102 wxNotebookEventHandler(options::OnChartsPageChange), NULL,
6108 wxString ConnTab = _(
"Connections");
6110 ConnTab = _(
"Connect");
6112 m_pageConnections = CreatePanel(ConnTab);
6113 CreatePanel_NMEA(m_pageConnections, border_size, group_item_spacing);
6117 m_pageShips = CreatePanel(_(
"Ships"));
6118 CreatePanel_Ownship(m_pageShips, border_size, group_item_spacing);
6119 CreatePanel_AIS(m_pageShips, border_size, group_item_spacing);
6120 CreatePanel_MMSI(m_pageShips, border_size, group_item_spacing);
6122 CreatePanel_Routes(m_pageShips, border_size, group_item_spacing);
6124 wxString UITab = _(
"User Interface");
6128 m_pageUI = CreatePanel(UITab);
6129 CreatePanel_UI(m_pageUI, border_size, group_item_spacing);
6130 CreatePanel_Sounds(m_pageUI, border_size, group_item_spacing);
6132 m_pagePlugins = CreatePanel(_(
"Plugins"));
6133 itemPanelPlugins = AddPage(m_pagePlugins, _(
"Plugins"));
6135 itemBoxSizerPanelPlugins =
new wxBoxSizer(wxVERTICAL);
6136 itemPanelPlugins->SetSizer(itemBoxSizerPanelPlugins);
6142 SetColorScheme(
static_cast<ColorScheme
>(0));
6153 SetSizeHints(-1, -1, width - marginx, height - marginy);
6162void options::SetInitialPage(
int page_sel,
int sub_page) {
6163 if (page_sel < (
int)m_pListbook->GetPageCount())
6164 m_pListbook->SetSelection(page_sel);
6166 m_pListbook->SetSelection(0);
6168 if (sub_page >= 0) {
6169 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
6170 wxNotebookPage* pg = m_pListbook->GetPage(i);
6171 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
6173 if (i == (
size_t)page_sel) {
6174 if (sub_page < (
int)nb->GetPageCount())
6175 nb->SetSelection(sub_page);
6177 nb->SetSelection(0);
6179 nb->ChangeSelection(0);
6185void options::SetColorScheme(ColorScheme cs) {
6188#ifdef OCPN_OPTIONS_USE_LISTBOOK
6189 wxListView* lv = m_pListbook->GetListView();
6190 lv->SetBackgroundColour(GetBackgroundColour());
6193 delete m_topImgList;
6194 CreateListbookIcons();
6195 m_pListbook->SetImageList(m_topImgList);
6203 comm_dialog->SetColorScheme(cs);
6206void options::OnAISRolloverClick(wxCommandEvent& event) {
6207 m_pCheck_Rollover_Class->Enable(event.IsChecked());
6208 m_pCheck_Rollover_COG->Enable(event.IsChecked());
6209 m_pCheck_Rollover_CPA->Enable(event.IsChecked());
6210 pStatic_CallSign->Enable(event.IsChecked());
6213void options::OnCanvasConfigSelectClick(
int ID,
bool selected) {
6215 case ID_SCREENCONFIG1:
6216 if (m_sconfigSelect_twovertical)
6217 m_sconfigSelect_twovertical->SetSelected(
false);
6221 case ID_SCREENCONFIG2:
6222 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6228void options::SetInitialSettings() {
6231 m_returnChanges = 0;
6232 m_bfontChanged =
false;
6233 m_font_element_array.Clear();
6235 b_oldhaveWMM = b_haveWMM;
6236 auto loader = PluginLoader::GetInstance();
6237 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
6240 switch (g_canvasConfig) {
6243 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
true);
6244 if (m_sconfigSelect_twovertical)
6245 m_sconfigSelect_twovertical->SetSelected(
false);
6248 if (m_sconfigSelect_single) m_sconfigSelect_single->SetSelected(
false);
6249 if (m_sconfigSelect_twovertical)
6250 m_sconfigSelect_twovertical->SetSelected(
true);
6253 m_screenConfig = g_canvasConfig;
6257 ActiveChartArray.Clear();
6258 for (
size_t i = 0; i < m_CurrentDirList.GetCount(); i++) {
6259 ActiveChartArray.Add(m_CurrentDirList[i]);
6263 if (m_pWorkDirList) {
6264 UpdateWorkArrayFromDisplayPanel();
6265 groupsPanel->SetDBDirs(*m_pWorkDirList);
6268 groupsPanel->EmptyChartGroupArray(m_pGroupArray);
6269 delete m_pGroupArray;
6270 m_pGroupArray = groupsPanel->CloneChartGroupArray(
g_pGroupArray);
6271 groupsPanel->SetGroupArray(m_pGroupArray);
6272 groupsPanel->SetInitialSettings();
6276 pShowStatusBar->SetValue(g_bShowStatusBar);
6278 pShowMenuBar->SetValue(g_bShowMenuBar);
6280 pShowCompassWin->SetValue(g_bShowCompassWin);
6284 pCOGUPUpdateSecs->SetValue(s);
6286 if (pCDOOutlines) pCDOOutlines->SetValue(g_bShowOutlines);
6287 if (pCDOQuilting) pCDOQuilting->SetValue(g_bQuiltEnable);
6289 if (pSDepthUnits) pSDepthUnits->SetValue(g_bShowDepthUnits);
6290 if (pSkewComp) pSkewComp->SetValue(g_bskew_comp);
6291 pMobile->SetValue(g_btouch);
6292 pResponsive->SetValue(g_bresponsive);
6299 pZoomButtons->SetValue(g_bShowMuiZoomButtons);
6303 pInlandEcdis->SetValue(g_bInlandEcdis);
6304 pHiconColors->SetValue(g_hicon_colors);
6307 pOpenGL->SetValue(g_bopengl);
6308 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6309 w->Enable(pOpenGL->IsChecked());
6312 pCBTrueShow->SetValue(g_bShowTrue);
6313 pCBMagShow->SetValue(g_bShowMag);
6315 int oldLength = itemStaticTextUserVar->GetLabel().Length();
6319 itemStaticTextUserVar->SetLabel(
6320 _(
"WMM Plugin calculated magnetic variation"));
6322 s.Printf(
"%4.1f",
gVar);
6323 pMagVar->SetValue(s);
6325 itemStaticTextUserVar->SetLabel(_(
"User set magnetic variation"));
6327 s.Printf(
"%4.1f", g_UserVar);
6328 pMagVar->SetValue(s);
6331 int newLength = itemStaticTextUserVar->GetLabel().Length();
6334 if ((newLength != oldLength) || (b_oldhaveWMM != b_haveWMM)) {
6335 wxSize sz = GetSize();
6336 SetSize(sz.x + 1, sz.y);
6340 itemStaticTextUserVar2->Enable(!b_haveWMM);
6341 pMagVar->Enable(!b_haveWMM);
6348 if (pSLiveETA) pSLiveETA->SetValue(g_bShowLiveETA);
6352 wxString stringDefaultBoatSpeed;
6353 if (!g_defaultBoatSpeed || !g_defaultBoatSpeedUserUnit) {
6354 g_defaultBoatSpeed = 6.0;
6355 g_defaultBoatSpeedUserUnit = toUsrSpeed(g_defaultBoatSpeed, -1);
6357 stringDefaultBoatSpeed.Printf(
"%d", (
int)g_defaultBoatSpeedUserUnit);
6358 if (pSDefaultBoatSpeed) pSDefaultBoatSpeed->SetValue(stringDefaultBoatSpeed);
6362 if (pCBCourseUp) pCBCourseUp->SetValue(g_bCourseUp);
6363 if (pCBNorthUp) pCBNorthUp->SetValue(!g_bCourseUp);
6364 if (pCBLookAhead) pCBLookAhead->SetValue(g_bLookAhead);
6366 if (fabs(wxRound(g_ownship_predictor_minutes) - g_ownship_predictor_minutes) >
6368 s.Printf(
"%6.2f", g_ownship_predictor_minutes);
6370 s.Printf(
"%4.0f", g_ownship_predictor_minutes);
6371 m_pText_OSCOG_Predictor->SetValue(s);
6373 if (fabs(wxRound(g_ownship_HDTpredictor_miles) -
6374 g_ownship_HDTpredictor_miles) > 1e-4)
6375 s.Printf(
"%6.2f", g_ownship_HDTpredictor_miles);
6377 s.Printf(
"%4.0f", g_ownship_HDTpredictor_miles);
6378 m_pText_OSHDT_Predictor->SetValue(s);
6382 m_pTxt_OwnMMSI->SetValue(s);
6384 m_pTxt_OwnMMSI->SetValue(
"");
6386 m_pShipIconType->SetSelection(g_OwnShipIconType);
6387 wxCommandEvent eDummy;
6388 OnShipTypeSelect(eDummy);
6389 m_pOSLength->SetValue(wxString::Format(
"%.1f", g_n_ownship_length_meters));
6390 m_pOSWidth->SetValue(wxString::Format(
"%.1f", g_n_ownship_beam_meters));
6391 m_pOSGPSOffsetX->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_x));
6392 m_pOSGPSOffsetY->SetValue(wxString::Format(
"%.1f", g_n_gps_antenna_offset_y));
6393 m_pOSMinSize->SetValue(wxString::Format(
"%d", g_n_ownship_min_mm));
6394 m_pText_ACRadius->SetValue(
6395 wxString::Format(
"%.3f", g_n_arrival_circle_radius));
6398 if (g_iNavAidRadarRingsNumberVisible > 10)
6399 g_iNavAidRadarRingsNumberVisible = 10;
6400 pNavAidRadarRingsNumberVisible->SetSelection(
6401 g_iNavAidRadarRingsNumberVisible);
6402 buf.Printf(
"%.3f", g_fNavAidRadarRingsStep);
6403 pNavAidRadarRingsStep->SetValue(buf);
6404 m_itemRadarRingsUnits->SetSelection(g_pNavAidRadarRingsStepUnits);
6405 m_colourOwnshipRangeRingColour->SetColour(g_colourOwnshipRangeRingsColour);
6407 pScaMinChckB->SetValue(g_bUseWptScaMin);
6408 m_pText_ScaMin->SetValue(wxString::Format(
"%i", g_iWpt_ScaMin));
6409 m_pText_ScaMax->SetValue(wxString::Format(
"%i", g_iWpt_ScaMax));
6410 pScaMinOverruleChckB->SetValue(g_bOverruleScaMin);
6412 OnRadarringSelect(eDummy);
6414 if (g_iWaypointRangeRingsNumber > 10) g_iWaypointRangeRingsNumber = 10;
6415 pWaypointRangeRingsNumber->SetSelection(g_iWaypointRangeRingsNumber);
6416 buf.Printf(
"%.3f", g_fWaypointRangeRingsStep);
6417 pWaypointRangeRingsStep->SetValue(buf);
6418 m_itemWaypointRangeRingsUnits->SetSelection(g_iWaypointRangeRingsStepUnits);
6420 OnWaypointRangeRingSelect(eDummy);
6421 pShowshipToActive->SetValue(g_bShowShipToActive);
6422 m_shipToActiveStyle->SetSelection(g_shipToActiveStyle);
6423 m_shipToActiveColor->SetSelection(g_shipToActiveColor);
6425 pWayPointPreventDragging->SetValue(g_bWayPointPreventDragging);
6426 pConfirmObjectDeletion->SetValue(g_bConfirmObjectDelete);
6428 if (pEnableZoomToCursor) pEnableZoomToCursor->SetValue(g_bEnableZoomToCursor);
6429 if (pEnableTenHertz) pEnableTenHertz->SetValue(g_btenhertz);
6431 if (pPreserveScale) pPreserveScale->SetValue(g_bPreserveScaleOnX);
6432 pPlayShipsBells->SetValue(g_bPlayShipsBells);
6434 if (pCmdSoundString) pCmdSoundString->SetValue(g_CmdSoundString);
6436 if (pSoundDeviceIndex) pSoundDeviceIndex->SetSelection(g_iSoundDeviceIndex);
6439 pSDMMFormat->Select(g_iSDMMFormat);
6443 pDistanceFormat->SetSelection(distance_ui_index);
6446 pWindSpeedFormat->Select(g_iWindSpeedFormat);
6448 if (pHeightUnitSelect) pHeightUnitSelect->SetSelection(
g_iHeightFormat);
6450 pAdvanceRouteWaypointOnArrivalOnly->SetValue(
6451 g_bAdvanceRouteWaypointOnArrivalOnly);
6462 pTrackDaily->SetValue(g_bTrackDaily);
6463 pTrackRotateLMT->SetValue(g_track_rotate_time_type == TIME_TYPE_LMT);
6464 pTrackRotateUTC->SetValue(g_track_rotate_time_type == TIME_TYPE_UTC);
6465 pTrackRotateComputerTime->SetValue(g_track_rotate_time_type ==
6466 TIME_TYPE_COMPUTER);
6467 pTrackHighlite->SetValue(g_bHighliteTracks);
6468 m_colourTrackLineColour->SetColour(g_colourTrackLineColour);
6469 pTrackPrecision->SetSelection(g_nTrackPrecision);
6471 m_soundPanelAnchor->GetCheckBox()->SetValue(g_bAnchor_Alert_Audio);
6475 m_pCheck_CPA_Max->SetValue(g_bCPAMax);
6477 s.Printf(
"%4.1f", g_CPAMax_NM);
6478 m_pText_CPA_Max->SetValue(s);
6480 m_pCheck_CPA_Warn->SetValue(g_bCPAWarn);
6482 s.Printf(
"%4.1f", g_CPAWarn_NM);
6483 m_pText_CPA_Warn->SetValue(s);
6485 if (m_pCheck_CPA_Warn->GetValue()) {
6486 m_pCheck_CPA_WarnT->Enable();
6487 m_pCheck_CPA_WarnT->SetValue(g_bTCPA_Max);
6489 m_pCheck_CPA_WarnT->Disable();
6491 s.Printf(
"%4.0f", g_TCPA_Max);
6492 m_pText_CPA_WarnT->SetValue(s);
6495 m_pCheck_Mark_Lost->SetValue(g_bMarkLost);
6497 s.Printf(
"%4.0f", g_MarkLost_Mins);
6498 m_pText_Mark_Lost->SetValue(s);
6500 m_pCheck_Remove_Lost->SetValue(g_bRemoveLost);
6502 s.Printf(
"%4.0f", g_RemoveLost_Mins);
6503 m_pText_Remove_Lost->SetValue(s);
6506 m_pCheck_Show_COG->SetValue(g_bShowCOG);
6508 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6509 m_pText_COG_Predictor->SetValue(s);
6511 m_pCheck_Sync_OCOG_ACOG->SetValue(g_bSyncCogPredictors);
6512 if (g_bSyncCogPredictors) m_pText_COG_Predictor->Disable();
6514 m_pCheck_Show_Tracks->SetValue(g_bAISShowTracks);
6516 s.Printf(
"%4.0f", g_AISShowTracks_Mins);
6517 m_pText_Track_Length->SetValue(s);
6519 m_pCheck_Hide_Moored->SetValue(g_bHideMoored);
6521 s.Printf(
"%4.1f", g_ShowMoored_Kts);
6522 m_pText_Moored_Speed->SetValue(s);
6524 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6526 s.Printf(
"%4.1f", g_AIS_RealtPred_Kts);
6527 m_pText_RealtPred_Speed->SetValue(s);
6529 m_pCheck_Scale_Priority->SetValue(g_bAllowShowScaled);
6531 s.Printf(
"%i", g_ShowScaled_Num);
6532 m_pText_Scale_Priority->SetValue(s);
6534 m_pCheck_Show_Area_Notices->SetValue(g_bShowAreaNotices);
6536 m_pCheck_Draw_Target_Size->SetValue(g_bDrawAISSize);
6537 m_pCheck_Draw_Realtime_Prediction->SetValue(g_bDrawAISRealtime);
6539 m_pCheck_Show_Target_Name->SetValue(g_bShowAISName);
6541 s.Printf(
"%d", g_Show_Target_Name_Scale);
6542 m_pText_Show_Target_Name_Scale->SetValue(s);
6544 m_pCheck_use_Wpl->SetValue(g_bWplUsePosition);
6545 m_pWplAction->SetSelection(g_WplAction);
6548 m_pCheck_AlertDialog->SetValue(g_bAIS_CPA_Alert);
6549 if (g_bAIS_CPA_Alert) {
6550 m_pCheck_AlertAudio->Enable();
6551 m_pCheck_AlertAudio->SetValue(g_bAIS_CPA_Alert_Audio);
6553 m_pCheck_AlertAudio->Disable();
6554 m_pCheck_AlertAudio->SetValue(
false);
6557 m_pCheck_Alert_Moored->SetValue(g_bAIS_CPA_Alert_Suppress_Moored);
6559 m_pCheck_Ack_Timout->SetValue(g_bAIS_ACK_Timeout);
6560 s.Printf(
"%4.0f", g_AckTimeout_Mins);
6561 m_pText_ACK_Timeout->SetValue(s);
6564 m_soundPanelAIS->GetCheckBox()->SetValue(g_bAIS_GCPA_Alert_Audio);
6565 m_soundPanelSART->GetCheckBox()->SetValue(g_bAIS_SART_Alert_Audio);
6566 m_soundPanelDSC->GetCheckBox()->SetValue(g_bAIS_DSC_Alert_Audio);
6569 m_pCheck_Rollover_Class->SetValue(g_bAISRolloverShowClass);
6570 m_pCheck_Rollover_COG->SetValue(g_bAISRolloverShowCOG);
6571 m_pCheck_Rollover_CPA->SetValue(g_bAISRolloverShowCPA);
6573 m_pSlider_Zoom_Raster->SetValue(g_chart_zoom_modifier_raster);
6574 m_pSlider_Zoom_Vector->SetValue(g_chart_zoom_modifier_vector);
6576 m_pSlider_GUI_Factor->SetValue(g_GUIScaleFactor);
6577 m_pSlider_Chart_Factor->SetValue(g_ChartScaleFactor);
6578 m_pSlider_Ship_Factor->SetValue(g_ShipScaleFactor);
6579 m_pSlider_Text_Factor->SetValue(g_ENCSoundingScaleFactor);
6580 m_pSlider_ENCText_Factor->SetValue(g_ENCTextScaleFactor);
6581 m_pMouse_Zoom_Slider->SetValue(g_mouse_zoom_sensitivity_ui);
6584 if (!g_config_display_size_manual) {
6585 pRBSizeAuto->SetValue(TRUE);
6587 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6589 screenmm.RemoveLast();
6590 pScreenMM->Disable();
6593 screenmm.Append(wxString::Format(
"%zu,", mm));
6595 screenmm.RemoveLast();
6596 pRBSizeManual->SetValue(TRUE);
6599 pScreenMM->SetValue(screenmm);
6603 UpdateOptionsUnits();
6605 SetInitialVectorSettings();
6607 pToolbarAutoHideCB->SetValue(g_bAutoHideToolbar);
6609 s.Printf(
"%d", g_nAutoHideToolbar);
6610 pToolbarHideSecs->SetValue(s);
6614 delete m_pSerialArray;
6615 m_pSerialArray = NULL;
6617 m_bForceNewToolbaronCancel =
false;
6620void options::resetMarStdList(
bool bsetConfig,
bool bsetStd) {
6621 if (ps57CtlListBox) {
6623 ps57CtlListBox->Clear();
6624 marinersStdXref.clear();
6626 ps57CtlListBox->Freeze();
6628 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
6630 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(iPtr));
6633 if (iPtr < ps52plib->OBJLDescriptions.size()) {
6634 item = ps52plib->OBJLDescriptions[iPtr];
6636 item = wxString(pOLE->OBJLName, wxConvUTF8);
6642 DisCat catp = ps52plib->findLUPDisCat(pOLE->OBJLName, SIMPLIFIED);
6643 DisCat cata = ps52plib->findLUPDisCat(pOLE->OBJLName, PLAIN_BOUNDARIES);
6644 DisCat catl = ps52plib->findLUPDisCat(pOLE->OBJLName, LINES);
6646 if ((catp == DISPLAYBASE) || (cata == DISPLAYBASE) ||
6647 (catl == DISPLAYBASE))
6649 else if ((catp == STANDARD) || (cata == STANDARD) || (catl == STANDARD))
6652 bool benable =
true;
6653 if (cat > 0) benable = cat != DISPLAYBASE;
6658 int newpos = ps57CtlListBox->Append(item, benable,
false);
6659 marinersStdXref.push_back(newpos);
6660 for (
size_t i = 0; i < iPtr; i++) {
6661 if (marinersStdXref[i] >= newpos) marinersStdXref[i]++;
6665 if (bsetConfig) bviz = !(pOLE->nViz == 0);
6667 if (cat == DISPLAYBASE) bviz =
true;
6670 if (cat == STANDARD) {
6675 ps57CtlListBox->Check(newpos, bviz);
6677 ps57CtlListBox->Thaw();
6680 ps57CtlListBox->RunLayout();
6683 wxSize s = ps57CtlListBox->GetSize();
6684 ps57CtlListBox->SetSize(s.x, s.y - 1);
6688void options::SetInitialVectorSettings() {
6689 m_pSlider_CM93_Zoom->SetValue(g_cm93_zoom_factor);
6693 m_bVectorInit =
true;
6694 resetMarStdList(
true,
false);
6697 ps57CtlListBox->GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
6701 switch (ps52plib->GetDisplayCategory()) {
6711 case (MARINERS_STANDARD):
6719 if (pDispCat) pDispCat->SetSelection(nset);
6723 bool benableMarStd =
false;
6725 for (
unsigned int i = 0; i <
g_canvasArray.GetCount(); i++) {
6728 if (cc->GetENCDisplayCategory() == MARINERS_STANDARD) {
6729 benableMarStd =
true;
6738 if (ps57CtlListBox) ps57CtlListBox->Enable(benableMarStd);
6739 itemButtonClearList->Enable(benableMarStd);
6740 itemButtonSelectList->Enable(benableMarStd);
6741 itemButtonSetStd->Enable(benableMarStd);
6744 if (pCheck_SOUNDG) pCheck_SOUNDG->SetValue(ps52plib->m_bShowSoundg);
6745 if (pCheck_ATONTEXT) pCheck_ATONTEXT->SetValue(ps52plib->m_bShowAtonText);
6746 if (pCheck_LDISTEXT) pCheck_LDISTEXT->SetValue(ps52plib->m_bShowLdisText);
6747 if (pCheck_XLSECTTEXT)
6748 pCheck_XLSECTTEXT->SetValue(ps52plib->m_bExtendLightSectors);
6750 pCheck_META->SetValue(ps52plib->m_bShowMeta);
6751 pCheck_SHOWIMPTEXT->SetValue(ps52plib->m_bShowS57ImportantTextOnly);
6752 pCheck_SCAMIN->SetValue(ps52plib->m_bUseSCAMIN);
6753 pCheck_SuperSCAMIN->SetValue(ps52plib->m_bUseSUPER_SCAMIN);
6755 pCheck_DECLTEXT->SetValue(ps52plib->m_bDeClutterText);
6756 pCheck_NATIONALTEXT->SetValue(ps52plib->m_bShowNationalTexts);
6759 if (ps52plib->m_nSymbolStyle == PAPER_CHART)
6760 pPointStyle->SetSelection(0);
6762 pPointStyle->SetSelection(1);
6764 if (ps52plib->m_nBoundaryStyle == PLAIN_BOUNDARIES)
6765 pBoundStyle->SetSelection(0);
6767 pBoundStyle->SetSelection(1);
6769 if (S52_getMarinerParam(S52_MAR_TWO_SHADES) == 1.0)
6770 p24Color->SetSelection(0);
6772 p24Color->SetSelection(1);
6774 UpdateOptionsUnits();
6778void options::UpdateOptionsUnits() {
6779 int depthUnit = pDepthUnitSelect->GetSelection();
6781 depthUnit = wxMax(depthUnit, 0);
6782 depthUnit = wxMin(depthUnit, 2);
6788 else if (depthUnit == 2)
6794 wxString depthUnitStrings[] = {_(
"feet"), _(
"meters"), _(
"fathoms")};
6795 wxString depthUnitString = depthUnitStrings[depthUnit];
6796 m_depthUnitsShal->SetLabel(depthUnitString);
6797 m_depthUnitsSafe->SetLabel(depthUnitString);
6798 m_depthUnitsDeep->SetLabel(depthUnitString);
6801 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR) / conv);
6803 m_ShallowCtl->SetValue(s);
6805 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR) / conv);
6807 m_SafetyCtl->SetValue(s);
6809 s.Printf(
"%6.2f", S52_getMarinerParam(S52_MAR_DEEP_CONTOUR) / conv);
6811 m_DeepCtl->SetValue(s);
6841void options::OnSizeAutoButton(wxCommandEvent& event) {
6844 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6846 screenmm.RemoveLast();
6847 pScreenMM->SetValue(screenmm);
6848 pScreenMM->Disable();
6849 g_config_display_size_manual = FALSE;
6852void options::OnSizeManualButton(wxCommandEvent& event) {
6856 screenmm.Append(wxString::Format(
"%zu,", mm));
6860 screenmm.Append(wxString::Format(
"%zu,", mm.width_mm));
6863 screenmm.RemoveLast();
6864 pScreenMM->SetValue(screenmm);
6865 pScreenMM->Enable();
6866 g_config_display_size_manual = TRUE;
6869void options::OnUnitsChoice(wxCommandEvent& event) { UpdateOptionsUnits(); }
6871void options::OnCPAWarnClick(wxCommandEvent& event) {
6872 if (m_pCheck_CPA_Warn->GetValue()) {
6873 m_pCheck_CPA_WarnT->Enable();
6875 m_pCheck_CPA_WarnT->SetValue(FALSE);
6876 m_pCheck_CPA_WarnT->Disable();
6880void options::OnSyncCogPredClick(wxCommandEvent& event) {
6881 if (m_pCheck_Sync_OCOG_ACOG->GetValue()) {
6882 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
6883 m_pText_COG_Predictor->Disable();
6886 s.Printf(
"%4.0f", g_ShowCOG_Mins);
6887 m_pText_COG_Predictor->SetValue(s);
6888 m_pText_COG_Predictor->Enable();
6892void options::OnShipTypeSelect(wxCommandEvent& event) {
6893 realSizes->ShowItems(m_pShipIconType->GetSelection() != 0);
6894 dispOptions->Layout();
6896 itemPanelShip->Layout();
6897 itemPanelShip->Refresh();
6901void options::OnRadarringSelect(wxCommandEvent& event) {
6902 radarGrid->ShowItems(pNavAidRadarRingsNumberVisible->GetSelection() != 0);
6903 dispOptions->Layout();
6905 itemPanelShip->Layout();
6906 itemPanelShip->Refresh();
6910void options::OnWaypointRangeRingSelect(wxCommandEvent& event) {
6911 waypointradarGrid->ShowItems(pWaypointRangeRingsNumber->GetSelection() != 0);
6912 dispOptions->Layout();
6914 itemPanelRoutes->Layout();
6915 itemPanelRoutes->Refresh();
6919void options::OnGLClicked(wxCommandEvent& event) {
6922 if (
auto* w = wxWindow::FindWindowById(ID_OPENGLOPTIONS))
6923 w->Enable(pOpenGL->IsChecked());
6926void options::OnOpenGLOptions(wxCommandEvent& event) {
6928 OpenGLOptionsDlg dlg(
this);
6930 if (dlg.ShowModal() == wxID_OK) {
6931 if (top_frame::Get()->GetWxGlCanvas()) {
6932 g_GLOptions.m_bUseAcceleratedPanning =
6933 g_bGLexpert ? dlg.GetAcceleratedPanning()
6935 ->GetAbstractPrimaryCanvas()
6936 ->CanAccelerateGlPanning();
6939 g_bSoftwareGL = dlg.GetSoftwareGL();
6941 g_GLOptions.m_GLPolygonSmoothing = dlg.GetPolygonSmoothing();
6942 g_GLOptions.m_GLLineSmoothing = dlg.GetLineSmoothing();
6946 g_GLOptions.m_bTextureCompressionCaching =
6947 dlg.GetTextureCompressionCaching();
6948 g_GLOptions.m_iTextureMemorySize = dlg.GetTextureMemorySize();
6951 g_GLOptions.m_bTextureCompressionCaching = dlg.GetTextureCompression();
6955 g_GLOptions.m_bTextureCompression != dlg.GetTextureCompression()) {
6957 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6959 if (top_frame::Get()->GetWxGlCanvas()) {
6960 ::wxBeginBusyCursor();
6961 top_frame::Get()->GetAbstractPrimaryCanvas()->SetupGlCompression();
6963 ::wxEndBusyCursor();
6966 g_GLOptions.m_bTextureCompression = dlg.GetTextureCompression();
6969 if (dlg.GetRebuildCache()) {
6970 m_returnChanges = REBUILD_RASTER_CACHE;
6976void options::OnChartDirListSelect(wxCommandEvent& event) {
6978 bool selected = (pActiveChartsList->GetSelectedItemCount() > 0);
6979 m_removeBtn->Enable(selected);
6980 if (m_compressBtn) m_compressBtn->Enable(selected);
6984void options::OnDisplayCategoryRadioButton(wxCommandEvent& event) {
6987 const bool select = pDispCat->GetSelection() == 3;
6988 ps57CtlListBox->Enable(select);
6989 itemButtonClearList->Enable(select);
6990 itemButtonSelectList->Enable(select);
6991 itemButtonSetStd->Enable(select);
6997void options::OnButtonClearClick(wxCommandEvent& event) {
6998 resetMarStdList(
false,
false);
7007void options::OnButtonSelectClick(wxCommandEvent& event) {
7008 int nOBJL = ps57CtlListBox->GetCount();
7009 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) ps57CtlListBox->Check(iPtr, TRUE);
7014void options::OnButtonSetStd(wxCommandEvent& event) {
7015 resetMarStdList(
false,
true);
7020bool options::ShowToolTips() {
return TRUE; }
7022void options::OnCharHook(wxKeyEvent& event) {
7023 if (event.GetKeyCode() == WXK_RETURN &&
7024 event.GetModifiers() == wxMOD_CONTROL) {
7025 wxCommandEvent okEvent;
7026 okEvent.SetId(xID_OK);
7027 okEvent.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
7028 GetEventHandler()->AddPendingEvent(okEvent);
7033void options::OnButtonaddClick(wxCommandEvent& event) {
7035 int dresult =
g_Platform->DoDirSelectorDialog(
7036 this, &selDir, _(
"Add a directory containing chart files"),
7037 *pInit_Chart_Dir,
false);
7039 if (dresult != wxID_CANCEL) AddChartDir(selDir);
7044void options::AddChartDir(
const wxString& dir) {
7045 wxFileName dirname = wxFileName(dir);
7046 pInit_Chart_Dir->Empty();
7052 dirAdd = f.GetFullPath();
7054 pInit_Chart_Dir->Append(dirname.GetPath());
7059 cdi.fullpath = dirAdd;
7060 ActiveChartArray.Add(cdi);
7062 UpdateChartDirList();
7064 k_charts |= CHANGE_CHARTS;
7066 pScanCheckBox->Disable();
7069void options::UpdateDisplayedChartDirList(ArrayOfCDI p) {
7072 ActiveChartArray.Clear();
7073 for (
size_t i = 0; i < p.GetCount(); i++) {
7074 ActiveChartArray.Add(p[i]);
7077 UpdateChartDirList();
7080void options::UpdateWorkArrayFromDisplayPanel() {
7082 int n = ActiveChartArray.GetCount();
7083 if (m_pWorkDirList) {
7084 m_pWorkDirList->Clear();
7085 for (
int i = 0; i < n; i++) {
7086 dirname = ActiveChartArray[i].fullpath;
7087 if (!dirname.IsEmpty()) {
7090 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
7091 (dirname.Last() == wxChar(_T(
'\r'))))
7092 dirname.RemoveLast();
7098 bool b_added = FALSE;
7101 int nDir = m_CurrentDirList.GetCount();
7103 for (
int i = 0; i < nDir; i++) {
7104 if (m_CurrentDirList[i].fullpath == dirname) {
7105 ChartDirInfo cdi = m_CurrentDirList[i];
7106 m_pWorkDirList->Add(cdi);
7114 cdin.fullpath = dirname;
7115 m_pWorkDirList->Add(cdin);
7122void options::OnApplyClick(wxCommandEvent& event) {
7123 ApplyChanges(event);
7128 if ((m_returnChanges & FONT_CHANGED) ||
7129 (m_returnChanges & NEED_NEW_OPTIONS)) {
7134 m_callbacks.prepare_close(
this, m_returnChanges);
7135 if (!(m_returnChanges & FONT_CHANGED_SAFE))
7136 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
true);
7140 if ((m_returnChanges & CONFIG_CHANGED)) {
7141 top_frame::Get()->ScheduleReconfigAndSettingsReload(
true,
false);
7146void options::ApplyChanges(wxCommandEvent& event) {
7152 if (m_pShipIconType->GetSelection() > 0) {
7153 double n_ownship_length_meters;
7154 double n_ownship_beam_meters;
7155 double n_gps_antenna_offset_y;
7156 double n_gps_antenna_offset_x;
7157 long n_ownship_min_mm;
7158 m_pOSLength->GetValue().ToDouble(&n_ownship_length_meters);
7159 m_pOSWidth->GetValue().ToDouble(&n_ownship_beam_meters);
7160 m_pOSGPSOffsetX->GetValue().ToDouble(&n_gps_antenna_offset_x);
7161 m_pOSGPSOffsetY->GetValue().ToDouble(&n_gps_antenna_offset_y);
7162 m_pOSMinSize->GetValue().ToLong(&n_ownship_min_mm);
7164 if (n_ownship_length_meters <= 0)
7165 msg += _(
"\n - your ship's length must be > 0");
7166 if (n_ownship_beam_meters <= 0)
7167 msg += _(
"\n - your ship's beam must be > 0");
7168 if (fabs(n_gps_antenna_offset_x) > n_ownship_beam_meters / 2.0)
7170 "\n - your GPS offset from midship must be within your ship's beam");
7171 if (n_gps_antenna_offset_y < 0 ||
7172 n_gps_antenna_offset_y > n_ownship_length_meters)
7174 _(
"\n - your GPS offset from bow must be within your ship's length");
7175 if (n_ownship_min_mm <= 0 || n_ownship_min_mm > 100)
7176 msg += _(
"\n - your minimum ship icon size must be between 1 and 100 mm");
7177 if (!msg.IsEmpty()) {
7178 msg.Prepend(_(
"The settings for own ship real size are not correct:"));
7179 OCPNMessageBox(
this, msg, _(
"OpenCPN info"), wxICON_ERROR | wxOK);
7180 ::wxEndBusyCursor();
7181 event.SetInt(wxID_STOP);
7184 g_n_ownship_length_meters = n_ownship_length_meters;
7185 g_n_ownship_beam_meters = n_ownship_beam_meters;
7186 g_n_gps_antenna_offset_y = n_gps_antenna_offset_y;
7187 g_n_gps_antenna_offset_x = n_gps_antenna_offset_x;
7188 g_n_ownship_min_mm =
static_cast<int>(n_ownship_min_mm);
7190 g_OwnShipIconType = m_pShipIconType->GetSelection();
7191 g_bShowShipToActive = pShowshipToActive->GetValue();
7192 g_shipToActiveStyle = m_shipToActiveStyle->GetSelection();
7193 g_shipToActiveColor = m_shipToActiveColor->GetSelection();
7195 m_pText_ACRadius->GetValue().ToDouble(&g_n_arrival_circle_radius);
7196 g_n_arrival_circle_radius =
7197 wxClip(g_n_arrival_circle_radius, 0.001, 0.6);
7199 wxString* icon_name =
7200 pWayPointMan->GetIconKey(pWaypointDefaultIconChoice->GetSelection());
7201 if (icon_name && icon_name->Length()) g_default_wp_icon = *icon_name;
7204 pWayPointMan->GetIconKey(pRoutepointDefaultIconChoice->GetSelection());
7205 if (icon_name && icon_name->Length()) g_default_routepoint_icon = *icon_name;
7207 g_bUseWptScaMin = pScaMinChckB->GetValue();
7208 g_iWpt_ScaMin = wxAtoi(m_pText_ScaMin->GetValue());
7209 g_iWpt_ScaMax = wxAtoi(m_pText_ScaMax->GetValue());
7210 g_bOverruleScaMin = pScaMinOverruleChckB->GetValue();
7213 if (m_bfontChanged) {
7215 if (top_frame::Get()->GetWxGlCanvas()) {
7216 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7219 if (top_frame::Get()->GetAbstractPrimaryCanvas()) {
7220 top_frame::Get()->GetAbstractPrimaryCanvas()->ResetGridFont();
7223 m_returnChanges |= FONT_CHANGED;
7227 if (m_font_element_array.Index(
"Dialog") == wxNOT_FOUND)
7228 m_returnChanges |= FONT_CHANGED_SAFE;
7232 UpdateWorkArrayFromDisplayPanel();
7234 groupsPanel->SetDBDirs(*m_pWorkDirList);
7235 groupsPanel->m_treespopulated = FALSE;
7237 int k_force = FORCE_UPDATE;
7238 if (pUpdateCheckBox) {
7239 if (!pUpdateCheckBox->GetValue()) k_force = 0;
7240 pUpdateCheckBox->Enable();
7241 pUpdateCheckBox->SetValue(FALSE);
7246 m_returnChanges |= k_force;
7248 int k_scan = SCAN_UPDATE;
7249 if (pScanCheckBox) {
7250 if (!pScanCheckBox->GetValue()) k_scan = 0;
7251 pScanCheckBox->Enable();
7252 pScanCheckBox->SetValue(FALSE);
7257 m_returnChanges |= k_scan;
7259 pConfig->UpdateChartDirs(*m_pWorkDirList);
7263 if (groupsPanel->modified) {
7266 g_pGroupArray = groupsPanel->CloneChartGroupArray(m_pGroupArray);
7267 m_returnChanges |= GROUPS_CHANGED;
7272 g_bShowStatusBar = pShowStatusBar->GetValue();
7275 bool bmenu_shown = g_bShowMenuBar;
7276 if (pShowMenuBar->GetValue() != bmenu_shown)
7277 m_returnChanges |= MENU_CHANGED;
7278 g_bShowMenuBar = pShowMenuBar->GetValue();
7281 g_bShowCompassWin = pShowCompassWin->GetValue();
7284 g_bShowChartBar = pShowChartBar->GetValue();
7286 wxString screenmm = pScreenMM->GetValue();
7287 wxStringTokenizer tkz(screenmm,
",");
7289 while (tkz.HasMoreTokens()) {
7290 wxString token = tkz.GetNextToken();
7292 if (token.ToLong(&mm) && mm > 0) {
7298 g_config_display_size_manual = pRBSizeManual->GetValue();
7302 comm_dialog->ApplySettings();
7304 if (pCDOOutlines) g_bShowOutlines = pCDOOutlines->GetValue();
7308 bool temp_bquilting = pCDOQuilting->GetValue();
7311 g_bQuiltEnable = temp_bquilting;
7315 if (pSDepthUnits) g_bShowDepthUnits = pSDepthUnits->GetValue();
7316 g_bskew_comp = pSkewComp->GetValue();
7317 g_btouch = pMobile->GetValue();
7318 g_bresponsive = pResponsive->GetValue();
7320 g_bShowMuiZoomButtons = pZoomButtons->GetValue();
7322 g_bAutoHideToolbar = pToolbarAutoHideCB->GetValue();
7325 pToolbarHideSecs->GetValue().ToLong(&hide_val);
7326 g_nAutoHideToolbar = wxMin(
static_cast<int>(hide_val), 100);
7327 g_nAutoHideToolbar = wxMax(g_nAutoHideToolbar, 2);
7341 long update_val = 1;
7342 pCOGUPUpdateSecs->GetValue().ToLong(&update_val);
7343 g_COGAvgSec = wxMin(
static_cast<int>(update_val), kMaxCogAverageSeconds);
7347 if (pCBLookAhead) g_bLookAhead = pCBLookAhead->GetValue();
7349 g_bShowTrue = pCBTrueShow->GetValue();
7350 g_bShowMag = pCBMagShow->GetValue();
7352 auto loader = PluginLoader::GetInstance();
7353 b_haveWMM = loader && loader->IsPlugInAvailable(
"WMM");
7354 if (!b_haveWMM && !b_oldhaveWMM) {
7355 pMagVar->GetValue().ToDouble(&g_UserVar);
7360 m_pText_OSCOG_Predictor->GetValue().ToDouble(&g_ownship_predictor_minutes);
7361 m_pText_OSHDT_Predictor->GetValue().ToDouble(&g_ownship_HDTpredictor_miles);
7364 g_iNavAidRadarRingsNumberVisible =
7365 pNavAidRadarRingsNumberVisible->GetSelection();
7366 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
7367 if (pNavAidRadarRingsStep->GetValue().ToDouble(&temp_dbl))
7368 g_fNavAidRadarRingsStep = temp_dbl;
7369 g_pNavAidRadarRingsStepUnits = m_itemRadarRingsUnits->GetSelection();
7370 g_iWaypointRangeRingsNumber = pWaypointRangeRingsNumber->GetSelection();
7371 if (pWaypointRangeRingsStep->GetValue().ToDouble(&temp_dbl))
7372 g_fWaypointRangeRingsStep = temp_dbl;
7373 g_iWaypointRangeRingsStepUnits =
7374 m_itemWaypointRangeRingsUnits->GetSelection();
7376 m_colourWaypointRangeRingsColour->GetColour();
7381 g_bWayPointPreventDragging = pWayPointPreventDragging->GetValue();
7383 g_bConfirmObjectDelete = pConfirmObjectDeletion->GetValue();
7385 if (pPreserveScale) g_bPreserveScaleOnX = pPreserveScale->GetValue();
7387 if (pCmdSoundString) {
7388 g_CmdSoundString = pCmdSoundString->GetValue();
7389 if (wxIsEmpty(g_CmdSoundString)) {
7390 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
7391 pCmdSoundString->SetValue(g_CmdSoundString);
7395 g_bPlayShipsBells = pPlayShipsBells->GetValue();
7396 if (pSoundDeviceIndex)
7397 g_iSoundDeviceIndex = pSoundDeviceIndex->GetSelection();
7399 g_iSDMMFormat = pSDMMFormat->GetSelection();
7402 int sel = pDistanceFormat->GetSelection();
7406 g_iWindSpeedFormat = pWindSpeedFormat->GetSelection();
7408 if (pHeightUnitSelect)
g_iHeightFormat = pHeightUnitSelect->GetSelection();
7411 if (pSLiveETA) g_bShowLiveETA = pSLiveETA->GetValue();
7412 if (pSDefaultBoatSpeed)
7413 pSDefaultBoatSpeed->GetValue().ToDouble(&g_defaultBoatSpeedUserUnit);
7414 g_defaultBoatSpeed = fromUsrSpeed(g_defaultBoatSpeedUserUnit);
7415 if (m_Text_def_boat_speed)
7416 m_Text_def_boat_speed->SetLabel(_(
"Default Boat Speed ") +
"(" +
7417 getUsrSpeedUnit() +
")");
7419 g_bAdvanceRouteWaypointOnArrivalOnly =
7420 pAdvanceRouteWaypointOnArrivalOnly->GetValue();
7422 g_colourTrackLineColour = m_colourTrackLineColour->GetColour();
7423 g_colourTrackLineColour =
7424 wxColour(g_colourTrackLineColour.Red(), g_colourTrackLineColour.Green(),
7425 g_colourTrackLineColour.Blue());
7426 g_nTrackPrecision = pTrackPrecision->GetSelection();
7428 g_bTrackDaily = pTrackDaily->GetValue();
7430 g_track_rotate_time = 0;
7431#if wxUSE_TIMEPICKCTRL
7433 if (pTrackRotateTime && pTrackRotateTime->GetTime(&h, &m, &s))
7434 g_track_rotate_time = h * 3600 + m * 60 + s;
7437 if (pTrackRotateUTC->GetValue())
7438 g_track_rotate_time_type = TIME_TYPE_UTC;
7439 else if (pTrackRotateLMT->GetValue())
7440 g_track_rotate_time_type = TIME_TYPE_LMT;
7442 g_track_rotate_time_type = TIME_TYPE_COMPUTER;
7444 g_bHighliteTracks = pTrackHighlite->GetValue();
7451 if (pEnableZoomToCursor)
7452 g_bEnableZoomToCursor = pEnableZoomToCursor->GetValue();
7454 if (pEnableTenHertz) g_btenhertz = pEnableTenHertz->GetValue();
7457 g_bEnableZoomToCursor =
false;
7460 g_colourOwnshipRangeRingsColour = m_colourOwnshipRangeRingColour->GetColour();
7461 g_colourOwnshipRangeRingsColour =
7462 wxColour(g_colourOwnshipRangeRingsColour.Red(),
7463 g_colourOwnshipRangeRingsColour.Green(),
7464 g_colourOwnshipRangeRingsColour.Blue());
7467 g_bAIS_GCPA_Alert_Audio = m_soundPanelAIS->GetCheckBox()->GetValue();
7468 g_bAIS_SART_Alert_Audio = m_soundPanelSART->GetCheckBox()->GetValue();
7469 g_bAIS_DSC_Alert_Audio = m_soundPanelDSC->GetCheckBox()->GetValue();
7470 g_bAnchor_Alert_Audio = m_soundPanelAnchor->GetCheckBox()->GetValue();
7474 g_bCPAMax = m_pCheck_CPA_Max->GetValue();
7475 m_pText_CPA_Max->GetValue().ToDouble(&g_CPAMax_NM);
7476 g_bCPAWarn = m_pCheck_CPA_Warn->GetValue();
7477 m_pText_CPA_Warn->GetValue().ToDouble(&g_CPAWarn_NM);
7478 g_bTCPA_Max = m_pCheck_CPA_WarnT->GetValue();
7479 m_pText_CPA_WarnT->GetValue().ToDouble(&g_TCPA_Max);
7482 g_bMarkLost = m_pCheck_Mark_Lost->GetValue();
7483 m_pText_Mark_Lost->GetValue().ToDouble(&g_MarkLost_Mins);
7484 g_bRemoveLost = m_pCheck_Remove_Lost->GetValue();
7485 m_pText_Remove_Lost->GetValue().ToDouble(&g_RemoveLost_Mins);
7488 g_bShowCOG = m_pCheck_Show_COG->GetValue();
7490 g_bSyncCogPredictors = m_pCheck_Sync_OCOG_ACOG->GetValue();
7491 if (g_bSyncCogPredictors) {
7492 m_pText_COG_Predictor->SetValue(m_pText_OSCOG_Predictor->GetValue());
7494 m_pText_COG_Predictor->GetValue().ToDouble(&g_ShowCOG_Mins);
7496 g_bAISShowTracks = m_pCheck_Show_Tracks->GetValue();
7497 m_pText_Track_Length->GetValue().ToDouble(&g_AISShowTracks_Mins);
7501 for (
const auto& it :
g_pAIS->GetTargetList()) {
7502 auto pAISTarget = it.second;
7503 if (NULL != pAISTarget) {
7504 pAISTarget->b_show_track = g_bAISShowTracks;
7509 if (TRACKTYPE_NEVER == props->TrackType) {
7510 pAISTarget->b_show_track =
false;
7512 }
else if (TRACKTYPE_ALWAYS == props->TrackType) {
7513 pAISTarget->b_show_track =
true;
7520 std::map<int, Track*>::iterator it;
7521 it =
g_pAIS->m_persistent_tracks.find(pAISTarget->MMSI);
7522 if (it !=
g_pAIS->m_persistent_tracks.end())
7523 pAISTarget->b_show_track =
true;
7524 pAISTarget->b_show_track_old = g_bAISShowTracks;
7529 g_bHideMoored = m_pCheck_Hide_Moored->GetValue();
7530 m_pText_Moored_Speed->GetValue().ToDouble(&g_ShowMoored_Kts);
7532 g_bDrawAISRealtime = m_pCheck_Draw_Realtime_Prediction->GetValue();
7533 m_pText_RealtPred_Speed->GetValue().ToDouble(&g_AIS_RealtPred_Kts);
7535 g_bAllowShowScaled = m_pCheck_Scale_Priority->GetValue();
7537 m_pText_Scale_Priority->GetValue().ToLong(&l);
7538 g_ShowScaled_Num = (int)l;
7540 g_bShowAreaNotices = m_pCheck_Show_Area_Notices->GetValue();
7541 g_bDrawAISSize = m_pCheck_Draw_Target_Size->GetValue();
7542 g_bShowAISName = m_pCheck_Show_Target_Name->GetValue();
7543 long ais_name_scale = 5000;
7544 m_pText_Show_Target_Name_Scale->GetValue().ToLong(&ais_name_scale);
7545 g_Show_Target_Name_Scale = (int)wxMax(5000, ais_name_scale);
7546 g_bWplUsePosition = m_pCheck_use_Wpl->GetValue();
7547 g_WplAction = m_pWplAction->GetSelection();
7550 g_bAIS_CPA_Alert = m_pCheck_AlertDialog->GetValue();
7551 g_bAIS_CPA_Alert_Audio = m_pCheck_AlertAudio->GetValue();
7552 g_bAIS_CPA_Alert_Suppress_Moored = m_pCheck_Alert_Moored->GetValue();
7554 g_bAIS_ACK_Timeout = m_pCheck_Ack_Timout->GetValue();
7555 m_pText_ACK_Timeout->GetValue().ToDouble(&g_AckTimeout_Mins);
7558 g_bAISRolloverShowClass = m_pCheck_Rollover_Class->GetValue();
7559 g_bAISRolloverShowCOG = m_pCheck_Rollover_COG->GetValue();
7560 g_bAISRolloverShowCPA = m_pCheck_Rollover_CPA->GetValue();
7562 g_chart_zoom_modifier_raster = m_pSlider_Zoom_Raster->GetValue();
7563 g_chart_zoom_modifier_vector = m_pSlider_Zoom_Vector->GetValue();
7564 g_cm93_zoom_factor = m_pSlider_CM93_Zoom->GetValue();
7565 g_GUIScaleFactor = m_pSlider_GUI_Factor->GetValue();
7567 bool bchange_scale =
false;
7568 if (g_ChartScaleFactor != m_pSlider_Chart_Factor->GetValue())
7569 bchange_scale =
true;
7570 g_ChartScaleFactor = m_pSlider_Chart_Factor->GetValue();
7573 g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
7574 g_MarkScaleFactorExp =
g_Platform->GetMarkScaleFactorExp(g_ChartScaleFactor);
7575 g_ShipScaleFactor = m_pSlider_Ship_Factor->GetValue();
7576 g_ShipScaleFactorExp =
g_Platform->GetChartScaleFactorExp(g_ShipScaleFactor);
7577 g_ENCSoundingScaleFactor = m_pSlider_Text_Factor->GetValue();
7578 g_ENCTextScaleFactor = m_pSlider_ENCText_Factor->GetValue();
7580 g_mouse_zoom_sensitivity_ui = m_pMouse_Zoom_Slider->GetValue();
7581 g_mouse_zoom_sensitivity =
7586 if (pWayPointMan) WayPointmanGui(*pWayPointMan).ReloadRoutepointIcons();
7594 if (g_bopengl != pOpenGL->GetValue()) m_returnChanges |= GL_CHANGED;
7595 g_bopengl = pOpenGL->GetValue();
7598 g_bChartBarEx = pChartBarEX->GetValue();
7601 int depthUnit = pDepthUnitSelect->GetSelection();
7605 bool bUserStdChange =
false;
7607 int nOBJL = ps57CtlListBox->GetCount();
7609 for (
int iPtr = 0; iPtr < nOBJL; iPtr++) {
7611 for (
size_t i = 0; i < marinersStdXref.size(); i++) {
7612 if (marinersStdXref[i] == iPtr) {
7617 assert(itemIndex >= 0);
7618 OBJLElement* pOLE = (OBJLElement*)(ps52plib->pOBJLArray->Item(itemIndex));
7619 if (pOLE->nViz != (
int)(ps57CtlListBox->IsChecked(iPtr)))
7620 bUserStdChange =
true;
7621 pOLE->nViz = ps57CtlListBox->IsChecked(iPtr);
7627 ps52plib->GenerateStateHash();
7628 long stateHash = ps52plib->GetStateHash();
7630 if (m_returnChanges & GL_CHANGED) {
7633 ps52plib->FlushSymbolCaches(ChartCtxFactory());
7635 ps52plib->ClearCNSYLUPArray();
7636 ps52plib->GenerateStateHash();
7640 enum _DisCat nset = OTHER;
7641 switch (pDispCat->GetSelection()) {
7652 nset = MARINERS_STANDARD;
7655 ps52plib->SetDisplayCategory(nset);
7658 if (pCheck_SOUNDG) ps52plib->m_bShowSoundg = pCheck_SOUNDG->GetValue();
7659 if (pCheck_ATONTEXT)
7660 ps52plib->m_bShowAtonText = pCheck_ATONTEXT->GetValue();
7661 if (pCheck_LDISTEXT)
7662 ps52plib->m_bShowLdisText = pCheck_LDISTEXT->GetValue();
7663 if (pCheck_XLSECTTEXT)
7664 ps52plib->m_bExtendLightSectors = pCheck_XLSECTTEXT->GetValue();
7666 ps52plib->m_bShowMeta = pCheck_META->GetValue();
7667 ps52plib->m_bDeClutterText = pCheck_DECLTEXT->GetValue();
7668 ps52plib->m_bShowNationalTexts = pCheck_NATIONALTEXT->GetValue();
7669 ps52plib->m_bShowS57ImportantTextOnly = pCheck_SHOWIMPTEXT->GetValue();
7670 ps52plib->m_bUseSCAMIN = pCheck_SCAMIN->GetValue();
7671 ps52plib->m_bUseSUPER_SCAMIN = pCheck_SuperSCAMIN->GetValue();
7673 ps52plib->m_nSymbolStyle =
7674 pPointStyle->GetSelection() == 0 ? PAPER_CHART : SIMPLIFIED;
7676 ps52plib->m_nBoundaryStyle = pBoundStyle->GetSelection() == 0
7678 : SYMBOLIZED_BOUNDARIES;
7679 ps52plib->m_nSoundingFactor = m_pSlider_Text_Factor->GetValue();
7680 ps52plib->m_nTextFactor = m_pSlider_ENCText_Factor->GetValue();
7682 S52_setMarinerParam(S52_MAR_TWO_SHADES,
7683 (p24Color->GetSelection() == 0) ? 1.0 : 0.0);
7691 else if (depthUnit == 2)
7694 if (m_SafetyCtl->GetValue().ToDouble(&dval)) {
7695 S52_setMarinerParam(S52_MAR_SAFETY_DEPTH,
7697 S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR,
7701 if (m_ShallowCtl->GetValue().ToDouble(&dval))
7702 S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, dval * conv);
7704 if (m_DeepCtl->GetValue().ToDouble(&dval))
7705 S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, dval * conv);
7707 ps52plib->UpdateMarinerParams();
7708 ps52plib->m_nDepthUnitDisplay = depthUnit;
7712 ps52plib->GenerateStateHash();
7715 if ((stateHash != ps52plib->GetStateHash()) || bUserStdChange)
7716 m_returnChanges |= S52_CHANGED;
7718 if (bchange_scale) m_returnChanges |= S52_CHANGED;
7722#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
7724 wxString new_canon =
"en_US";
7725 wxString lang_sel = m_itemLangListBox->GetStringSelection();
7727 int nLang =
sizeof(lang_list) /
sizeof(
int);
7728 for (
int it = 0; it < nLang; it++) {
7729 const wxLanguageInfo* pli = wxLocale::GetLanguageInfo(lang_list[it]);
7731 wxString lang_canonical = pli->CanonicalName;
7732 wxString test_string = GetOCPNKnownLanguage(lang_canonical);
7733 if (lang_sel == test_string) {
7734 new_canon = lang_canonical;
7740 wxString locale_old = g_locale;
7741 g_locale = new_canon;
7743 if (g_locale != locale_old) m_returnChanges |= LOCALE_CHANGED;
7749 m_returnChanges |= STYLE_CHANGED;
7751 wxSizeEvent nullEvent;
7752 top_frame::Get()->OnSize(nullEvent);
7755 if (g_bInlandEcdis != pInlandEcdis->GetValue()) {
7756 g_bInlandEcdis = pInlandEcdis->GetValue();
7757 SwitchInlandEcdisMode(g_bInlandEcdis);
7758 m_returnChanges |= TOOLBAR_CHANGED;
7761 if (pHiconColors) g_hicon_colors = pHiconColors->GetValue();
7765 if (PluginLoader::GetInstance()->UpdatePlugIns())
7766 m_returnChanges |= TOOLBAR_CHANGED;
7772 m_returnChanges |= GENERIC_CHANGED | k_vectorcharts | k_charts |
7773 m_groups_changed | k_plugins;
7778 wxString string_acc;
7779 for (wxString entry : TideCurrentDataSet) {
7780 string_acc += entry;
7783 wxString string_acc_control;
7784 for (
int i = 0; i < tcDataSelected->GetItemCount(); i++) {
7785 wxString setName = tcDataSelected->GetItemText(i);
7786 string_acc_control += setName;
7789 if (!string_acc.IsSameAs(string_acc_control)) {
7790 TideCurrentDataSet.clear();
7791 int nEntry = tcDataSelected->GetItemCount();
7792 for (
int i = 0; i < nEntry; i++) {
7793 wxString setName = tcDataSelected->GetItemText(i);
7794 TideCurrentDataSet.push_back(setName.ToStdString());
7796 m_returnChanges |= TIDES_CHANGED;
7799 if (g_canvasConfig != m_screenConfig) m_returnChanges |= CONFIG_CHANGED;
7800 g_canvasConfig = m_screenConfig;
7802 UpdateWorkArrayFromDisplayPanel();
7805 if ((m_returnChanges & VISIT_CHARTS) &&
7806 ((m_returnChanges & CHANGE_CHARTS) || (m_returnChanges & SCAN_UPDATE))) {
7807 DoDBSUpdate((m_returnChanges & FORCE_UPDATE) == FORCE_UPDATE);
7809 bool b_groupchange =
ChartData->ScrubGroupArray();
7811 if (b_groupchange ||
7812 ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)) {
7813 pConfig->DestroyConfigGroups();
7816 if ((m_returnChanges & GROUPS_CHANGED) == GROUPS_CHANGED)
7820 m_callbacks.process_dialog(m_returnChanges, m_pWorkDirList);
7824 m_returnChanges &= ~(CHANGE_CHARTS | FORCE_UPDATE | SCAN_UPDATE);
7827 top_frame::Get()->RefreshAllCanvas();
7830 if (m_bneedNew) m_returnChanges |= NEED_NEW_OPTIONS;
7832 if (m_bVisitPlugins) m_returnChanges |= FORCE_RELOAD;
7835 UpdateTemplateTitleText();
7838 ::wxEndBusyCursor();
7841void options::OnXidOkClick(wxCommandEvent& event) {
7844 if (event.GetEventObject() == NULL)
return;
7846 ApplyChanges(event);
7849 m_callbacks.prepare_close(
this, m_returnChanges);
7852 if ((m_returnChanges & CONFIG_CHANGED) || (m_returnChanges & GL_CHANGED))
7853 top_frame::Get()->ScheduleReconfigAndSettingsReload(
false,
false);
7856 if ((m_returnChanges & FONT_CHANGED) &&
7857 !(m_returnChanges & FONT_CHANGED_SAFE))
7858 top_frame::Get()->ScheduleDeleteSettingsDialog();
7861 if (m_returnChanges & LOCALE_CHANGED)
7862 top_frame::Get()->ScheduleDeleteSettingsDialog();
7864 if ((m_returnChanges & FONT_CHANGED) ||
7865 (m_returnChanges & NEED_NEW_OPTIONS)) {
7872 if (m_returnChanges & FORCE_RELOAD) top_frame::Get()->ScheduleReloadCharts();
7878void options::Finish() {
7880 m_pListbook->ChangeSelection(0);
7881 for (
size_t i = 0; i < m_pListbook->GetPageCount(); i++) {
7882 wxNotebookPage* pg = m_pListbook->GetPage(i);
7883 wxNotebook* nb =
dynamic_cast<wxNotebook*
>(pg);
7884 if (nb) nb->ChangeSelection(0);
7887 lastWindowPos = GetPosition();
7888 lastWindowSize = GetSize();
7890 pConfig->SetPath(
"/Settings");
7891 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
7892 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
7895ArrayOfCDI options::GetSelectedChartDirs() {
7897 for (
size_t i = 0; i < panelVector.size(); i++) {
7898 if (panelVector[i]->IsSelected()) {
7899 rv.Add(panelVector[i]->GetCDI());
7906ArrayOfCDI options::GetUnSelectedChartDirs() {
7908 for (
size_t i = 0; i < panelVector.size(); i++) {
7909 if (!panelVector[i]->IsSelected()) {
7910 rv.Add(panelVector[i]->GetCDI());
7917void options::SetDirActionButtons() {
7918 ArrayOfCDI selArray = GetSelectedChartDirs();
7919 if (selArray.GetCount())
7920 m_removeBtn->Enable();
7922 m_removeBtn->Disable();
7925void options::OnButtondeleteClick(wxCommandEvent& event) {
7926 ArrayOfCDI unselArray = GetUnSelectedChartDirs();
7927 ActiveChartArray.Clear();
7928 for (
size_t i = 0; i < unselArray.GetCount(); i++) {
7929 ActiveChartArray.Add(unselArray[i]);
7932 UpdateChartDirList();
7934 UpdateWorkArrayFromDisplayPanel();
7937 if (m_pWorkDirList) {
7938 pActiveChartsList->DeleteAllItems();
7939 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
7940 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
7943 li.SetAlign(wxLIST_FORMAT_LEFT);
7944 li.SetText(dirname);
7946 long idx = pActiveChartsList->InsertItem(li);
7951 k_charts |= CHANGE_CHARTS;
7953 pScanCheckBox->Disable();
7958void options::DoDBSUpdate(
bool force_full) {
7959 m_OKButton->Disable();
7960 m_CancelButton->Disable();
7961 m_ApplyButton->Disable();
7963 wxString longmsg = _(
"OpenCPN Chart Update");
7965 ".................................................................."
7968 m_pCBDSprog =
new wxGenericProgressDialog();
7971 m_pCBDSprog->SetFont(*qFont);
7974 m_pCBDSprog->Create(_(
"OpenCPN Chart Update"), longmsg, 100,
nullptr,
7977 DimeControl(m_pCBDSprog);
7978 m_pCBDSprog->Show();
7983 m_bTextureCacheingSave = g_GLOptions.m_bTextureCompressionCaching;
7984 g_GLOptions.m_bTextureCompressionCaching =
false;
7986 ChartData->UpdateChartDatabaseInplace(*m_pWorkDirList, force_full,
7990void options::OnButtonRebuildChartDb(wxCommandEvent& event) {
7994void options::OnButtonParseENC(wxCommandEvent& event) {
7995 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
false);
7997 extern void ParseAllENC(wxWindow * parent);
7999 ParseAllENC(g_pOptions);
8002 top_frame::Get()->ChartsRefresh();
8004 top_frame::Get()->GetAbstractPrimaryCanvas()->EnablePaint(
true);
8010static bool compress(lzma_stream* strm, FILE* infile, FILE* outfile) {
8013 lzma_action action = LZMA_RUN;
8017 uint8_t inbuf[BUFSIZ];
8018 uint8_t outbuf[BUFSIZ];
8031 strm->next_in = NULL;
8033 strm->next_out = outbuf;
8034 strm->avail_out =
sizeof(outbuf);
8040 if (strm->avail_in == 0 && !feof(infile)) {
8041 strm->next_in = inbuf;
8042 strm->avail_in = fread(inbuf, 1,
sizeof(inbuf), infile);
8044 if (ferror(infile)) {
8045 fprintf(stderr,
"Read error: %s\n", strerror(errno));
8053 if (feof(infile)) action = LZMA_FINISH;
8071 lzma_ret ret = lzma_code(strm, action);
8076 if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
8081 size_t write_size =
sizeof(outbuf) - strm->avail_out;
8083 if (fwrite(outbuf, 1, write_size, outfile) != write_size) {
8084 fprintf(stderr,
"Write error: %s\n", strerror(errno));
8089 strm->next_out = outbuf;
8090 strm->avail_out =
sizeof(outbuf);
8095 if (ret != LZMA_OK) {
8102 if (ret == LZMA_STREAM_END)
return true;
8113 case LZMA_MEM_ERROR:
8114 msg =
"Memory allocation failed";
8117 case LZMA_DATA_ERROR:
8130 msg =
"File size limits exceeded";
8145 msg =
"Unknown error, possibly a bug";
8149 wxLogMessage(
"LZMA Encoder error: %s (error code %u)\n", msg, ret);
8156static bool CompressChart(wxString in, wxString out) {
8158 FILE* infile = fopen(in.mb_str(),
"rb");
8159 if (!infile)
return false;
8161 FILE* outfile = fopen(out.mb_str(),
"wb");
8167 lzma_stream strm = LZMA_STREAM_INIT;
8168 bool success =
false;
8169 if (lzma_easy_encoder(&strm, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64) ==
8171 success = compress(&strm, infile, outfile);
8182void options::OnButtonmigrateClick(wxCommandEvent& event) {
8188 new MigrateAssistantDialog(wxTheApp->GetTopWindow(),
true);
8189 g_migrateDialog->SetSize(top_frame::Get()->GetSize());
8190 g_migrateDialog->Centre();
8191 g_migrateDialog->Raise();
8192 g_migrateDialog->ShowModal();
8196void options::OnButtonEcdisHelp(wxCommandEvent& event) {
8197 wxString testFile =
"/doc/iECDIS/index.html";
8199 if (!::wxFileExists(testFile)) {
8200 wxString msg = _(
"The Inland ECDIS Manual is not available locally.");
8203 _(
"Would you like to visit the iECDIS Manual website for more "
8206 if (wxID_YES == OCPNMessageBox(NULL, msg, _(
"Inland ECDIS Manual"),
8207 wxYES_NO | wxCENTER, 60)) {
8208 wxLaunchDefaultBrowser(
"https://opencpn-manuals.github.io/inland-ecdis");
8219void options::OnButtoncompressClick(wxCommandEvent& event) {
8221 wxArrayInt pListBoxSelections;
8224 item = pActiveChartsList->GetNextItem(item, wxLIST_NEXT_ALL,
8225 wxLIST_STATE_SELECTED);
8226 if (item == -1)
break;
8231 if (OCPNMessageBox(
this, _(
"Compression will alter chart files on disk.\n\
8232This may make them incompatible with other programs or older versions of OpenCPN.\n\
8233Compressed charts may take slightly longer to load and display on some systems.\n\
8234They can be decompressed again using unxz or 7 zip programs."),
8235 _(
"OpenCPN Warning"),
8236 wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxICON_WARNING) !=
8240 wxArrayString filespecs;
8241 filespecs.Add(
"*.kap");
8242 filespecs.Add(
"*.KAP");
8243 filespecs.Add(
"*.000");
8246 filespecs.Add(
"*.A"), filespecs.Add(
"*.B"), filespecs.Add(
"*.C"),
8247 filespecs.Add(
"*.D");
8248 filespecs.Add(
"*.E"), filespecs.Add(
"*.F"), filespecs.Add(
"*.G"),
8249 filespecs.Add(
"*.Z");
8251 wxGenericProgressDialog prog1(
8252 _(
"OpenCPN Compress Charts"), wxEmptyString,
8253 filespecs.GetCount() * pListBoxSelections.GetCount() + 1,
this,
8254 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8255 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8258 wxSize sz = prog1.GetSize();
8259 sz.x = top_frame::Get()->GetClientSize().x * 8 / 10;
8262 wxArrayString charts;
8263 for (
unsigned int i = 0; i < pListBoxSelections.GetCount(); i++) {
8264 wxString dirname = pActiveChartsList->GetItemText(pListBoxSelections[i]);
8265 if (dirname.IsEmpty())
continue;
8268 while ((dirname.Last() == wxChar(_T(
'\n'))) ||
8269 (dirname.Last() == wxChar(_T(
'\r'))))
8270 dirname.RemoveLast();
8272 if (!wxDir::Exists(dirname))
continue;
8275 wxArrayString FileList;
8276 for (
unsigned int j = 0; j < filespecs.GetCount(); j++) {
8277 dir.GetAllFiles(dirname, &FileList, filespecs[j]);
8279 prog1.Update(i * filespecs.GetCount() + j, dirname + filespecs[j], &skip);
8283 for (
unsigned int j = 0; j < FileList.GetCount(); j++)
8284 charts.Add(FileList[j]);
8288 if (charts.GetCount() == 0) {
8289 OCPNMessageBox(
this, _(
"No charts found to compress."), _(
"OpenCPN Info"));
8294 unsigned long total_size = 0, total_compressed_size = 0, count = 0;
8295 wxGenericProgressDialog prog(
8296 _(
"OpenCPN Compress Charts"), wxEmptyString, charts.GetCount() + 1,
this,
8297 wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
8298 wxPD_REMAINING_TIME | wxPD_CAN_SKIP);
8302 for (
unsigned int i = 0; i < charts.GetCount(); i++) {
8304 prog.Update(i, charts[i], &skip);
8307 wxString compchart = charts[i] +
".xz";
8308 if (CompressChart(charts[i], compchart)) {
8309 total_size += wxFileName::GetSize(charts[i]).ToULong();
8310 total_compressed_size += wxFileName::GetSize(compchart).ToULong();
8311 wxRemoveFile(charts[i]);
8317 double total_size_mb = total_size / 1024.0 / 1024.0;
8318 double total_compressed_size_mb = total_compressed_size / 1024.0 / 1024.0;
8321 wxString::Format(_(
"compressed %ld charts\nfrom %.1fMB to %.1fMB\nsaved "
8323 count, total_size_mb, total_compressed_size_mb,
8324 total_size_mb - total_compressed_size_mb,
8325 (1 - total_compressed_size_mb / total_size_mb) * 100.0),
8328 UpdateWorkArrayFromTextCtl();
8330 if (m_pWorkDirList) {
8331 pActiveChartsList->DeleteAllItems();
8332 for (
size_t id = 0;
id < m_pWorkDirList->GetCount();
id++) {
8333 wxString dirname = m_pWorkDirList->Item(
id).fullpath;
8336 li.SetAlign(wxLIST_FORMAT_LEFT);
8337 li.SetText(dirname);
8339 long idx = pActiveChartsList->InsertItem(li);
8343 k_charts |= CHANGE_CHARTS;
8345 pScanCheckBox->Disable();
8351void options::OnDebugcheckbox1Click(wxCommandEvent& event) {
event.Skip(); }
8353void options::OnCancelClick(wxCommandEvent& event) {
8354 m_pListbook->ChangeSelection(0);
8355 comm_dialog->CancelSettings();
8357 lastWindowPos = GetPosition();
8358 lastWindowSize = GetSize();
8360 pConfig->SetPath(
"/Settings");
8361 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8362 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8365 androidEnableBackButton(
true);
8366 androidEnableRotation();
8367 androidEnableOptionItems(
true);
8370 top_frame::Get()->ThawCharts();
8372 top_frame::Get()->EnableSettingsTool(
true);
8375void options::OnClose(wxCloseEvent& event) {
8376 m_pListbook->ChangeSelection(0);
8378 lastWindowPos = GetPosition();
8379 lastWindowSize = GetSize();
8381 pConfig->SetPath(
"/Settings");
8382 pConfig->Write(
"OptionsSizeX", lastWindowSize.x);
8383 pConfig->Write(
"OptionsSizeY", lastWindowSize.y);
8385 m_callbacks.prepare_close(
this, m_returnChanges);
8389void options::OnFontChoice(wxCommandEvent& event) {
8390 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8391 m_font_element_array.Add(sel_text_element);
8393 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8394 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8396 m_textSample->SetFont(*pif);
8397 m_textSample->SetForegroundColour(init_color);
8398 m_itemBoxSizerFontPanel->Layout();
8402void options::OnChooseFont(wxCommandEvent& event) {
8404 androidDisableRotation();
8407 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8408 m_font_element_array.Add(sel_text_element);
8409 wxFontData font_data;
8411 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8412 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8414 wxFontData init_font_data;
8415 if (pif) init_font_data.SetInitialFont(*pif);
8416 init_font_data.SetColour(init_color);
8420 ocpnGenericFontDialog dg(
this, init_font_data);
8421 wxFont* qFont = dialogFont;
8424 int retval = dg.ShowModal();
8425 if (wxID_CANCEL != retval) {
8426 font_data = dg.GetFontData();
8427 wxFont font = font_data.GetChosenFont();
8428 wxFont* psfont =
new wxFont(font);
8429 wxColor color = font_data.GetColour();
8430 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8431 top_frame::Get()->UpdateAllFonts();
8432 m_bfontChanged =
true;
8433 OnFontChoice(event);
8439 wxFontDialog dg(
this, init_font_data);
8441 wxFontDialog dg(pParent, init_font_data);
8444 wxFont* qFont = dialogFont;
8451 wxSize proposed_size = GetSize();
8453 float font_size = dialogFont->GetPointSize();
8455 if ((proposed_size.y / font_size) < n_lines) {
8456 float new_font_size = proposed_size.y / n_lines;
8457 wxFont* smallFont =
new wxFont(*dialogFont);
8458 smallFont->SetPointSize(new_font_size);
8459 dg.SetFont(*smallFont);
8463 if (g_bresponsive) {
8464 dg.SetSize(GetSize());
8468 int retval = dg.ShowModal();
8469 if (wxID_CANCEL != retval) {
8470 font_data = dg.GetFontData();
8471 wxFont font = font_data.GetChosenFont();
8472 wxFont* psfont =
new wxFont(font);
8473 wxColor color = font_data.GetColour();
8474 FontMgr::Get().
SetFont(sel_text_element, psfont, color);
8475 top_frame::Get()->UpdateAllFonts();
8476 m_bfontChanged =
true;
8477 OnFontChoice(event);
8482 androidEnableRotation();
8488#if defined(__WXGTK__) || defined(__WXQT__)
8489void options::OnChooseFontColor(wxCommandEvent& event) {
8490 wxString sel_text_element = m_itemFontElementListBox->GetStringSelection();
8491 m_font_element_array.Add(sel_text_element);
8493 wxColourData colour_data;
8495 wxFont* pif = FontMgr::Get().
GetFont(sel_text_element);
8496 wxColour init_color = FontMgr::Get().
GetFontColor(sel_text_element);
8499 androidDisableRotation();
8501 unsigned int cco = 0;
8504 cco |= init_color.Red();
8506 cco |= init_color.Green();
8508 cco |= init_color.Blue();
8509 unsigned int cc = androidColorPicker(cco);
8512 unsigned char blue = (
unsigned char)cc % 256;
8513 unsigned char green = (
unsigned char)(cc >> 8) % 256;
8515 unsigned char red = (
unsigned char)(cc >> 16) % 256;
8516 cn.Set(red, green, blue);
8518 FontMgr::Get().
SetFont(sel_text_element, pif, cn);
8520 top_frame::Get()->UpdateAllFonts();
8521 m_bfontChanged =
true;
8523 androidEnableRotation();
8525 wxScrolledWindow* sw =
8526 new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
8528 wxColourData init_colour_data;
8529 init_colour_data.SetColour(init_color);
8531 wxColourDialog dg(sw, &init_colour_data);
8533 int retval = dg.ShowModal();
8534 if (wxID_CANCEL != retval) {
8535 colour_data = dg.GetColourData();
8537 wxColor color = colour_data.GetColour();
8538 FontMgr::Get().
SetFont(sel_text_element, pif, color);
8540 top_frame::Get()->UpdateAllFonts();
8541 m_bfontChanged =
true;
8542 OnFontChoice(event);
8551void options::OnChartsPageChange(wxListbookEvent& event) {
8552 unsigned int i =
event.GetSelection();
8554 UpdateChartDirList();
8559 if (!groupsPanel->m_UIcomplete) groupsPanel->CompletePanel();
8563 UpdateWorkArrayFromDisplayPanel();
8564 groupsPanel->SetDBDirs(*m_pWorkDirList);
8565 groupsPanel->m_treespopulated = FALSE;
8567 if (!groupsPanel->m_settingscomplete) {
8568 ::wxBeginBusyCursor();
8569 groupsPanel->CompleteInitialSettings();
8570 ::wxEndBusyCursor();
8571 }
else if (!groupsPanel->m_treespopulated) {
8572 groupsPanel->PopulateTrees();
8573 groupsPanel->m_treespopulated = TRUE;
8575 }
else if (1 == i) {
8577 if (!m_bVectorInit) {
8578 SetInitialVectorSettings();
8579 UpdateOptionsUnits();
8586void options::OnPageChange(wxListbookEvent& event) {
8587 DoOnPageChange(event.GetSelection());
8590void options::OnSubNBPageChange(wxNotebookEvent& event) {
8593 if (event.GetEventObject()) {
8594 if (
dynamic_cast<wxWindow*
>(event.GetEventObject())) {
8595 wxWindow* win =
dynamic_cast<wxWindow*
>(
event.GetEventObject());
8596 wxWindow* parent =
dynamic_cast<wxWindow*
>(win->GetParent());
8597 if (
dynamic_cast<wxNotebook*
>(parent)) {
8598 lastSubPage =
event.GetSelection();
8601 if (
dynamic_cast<wxListbook*
>(parent)) {
8602 lastSubPage =
event.GetSelection();
8609void options::OnTopNBPageChange(wxNotebookEvent& event) {
8610 DoOnPageChange(event.GetSelection());
8613void options::DoOnPageChange(
size_t page) {
8614 unsigned int i = page;
8617 if (page > 10)
return;
8625 if (m_sconfigSelect_single) m_sconfigSelect_single->Refresh(
true);
8626 if (m_sconfigSelect_twovertical) m_sconfigSelect_twovertical->Refresh(
true);
8632 k_charts = VISIT_CHARTS;
8633 UpdateChartDirList();
8634 }
else if (m_pageUI == i) {
8635 if (!m_itemLangListBox)
return;
8638 if (!m_bVisitLang) {
8639 ::wxBeginBusyCursor();
8641 int current_language = plocale_def_lang->GetLanguage();
8642 wxString current_sel = wxLocale::GetLanguageName(current_language);
8644 current_sel = GetOCPNKnownLanguage(g_locale);
8646 int nLang =
sizeof(lang_list) /
sizeof(
int);
8649 m_itemLangListBox->Append(
"English (U.S.)");
8651 wxString lang_dir =
g_Platform->GetSharedDataDir() +
"share/locale/";
8652 for (
int it = 1; it < nLang; it++) {
8653 if (wxLocale::IsAvailable(lang_list[it])) {
8654 wxLocale ltest(lang_list[it], 0);
8655 ltest.AddCatalog(
"opencpn");
8656 if (!ltest.IsLoaded(
"opencpn"))
continue;
8659 wxString loc_lang_name = wxLocale::GetLanguageName(lang_list[it]);
8660 wxString widgets_lang_name = loc_lang_name;
8661 wxString lang_canonical =
8662 wxLocale::GetLanguageInfo(lang_list[it])->CanonicalName;
8665 wxString lang_suffix;
8666 loc_lang_name = GetOCPNKnownLanguage(lang_canonical, lang_suffix);
8669 wxString test_dir = lang_dir + lang_suffix;
8670 if (!wxDir::Exists(test_dir))
continue;
8672 m_itemLangListBox->Append(loc_lang_name);
8676 wxArrayString lang_array;
8679 lang_array.Add(
"en_US");
8680 for (
int it = 0; it < nLang; it++) {
8682 wxLog::EnableLogging(
8685 wxLocale ltest(lang_list[it], 0);
8686#if wxCHECK_VERSION(2, 9, 0)
8688 ltest.AddCatalogLookupPathPrefix(
8689 wxStandardPaths::Get().GetInstallPrefix() +
"/share/locale");
8692 ltest.AddCatalog(
"opencpn");
8694 wxLog::EnableLogging(TRUE);
8695 if (ltest.IsLoaded(
"opencpn")) {
8696 auto x = wxLocale::GetLanguageInfo(lang_list[it]);
8699 s0 = x->CanonicalName;
8702 wxString sl = wxLocale::GetLanguageName(lang_list[it]);
8703 if (wxNOT_FOUND == lang_array.Index(s0)) {
8710 for (
unsigned int i = 0; i < lang_array.GetCount(); i++) {
8712 wxString loc_lang_name = GetOCPNKnownLanguage(lang_array[i]);
8713 m_itemLangListBox->Append(loc_lang_name);
8729 delete plocale_def_lang;
8730 plocale_def_lang =
new wxLocale(current_language);
8732 setlocale(LC_NUMERIC,
"C");
8733 plocale_def_lang->AddCatalog(
"opencpn");
8735 m_itemLangListBox->SetStringSelection(current_sel);
8738 const wxLanguageInfo* pli = wxLocale::FindLanguageInfo(g_locale);
8740 wxString clang = pli->Description;
8744 m_bVisitLang = TRUE;
8746 ::wxEndBusyCursor();
8749 }
else if (m_pagePlugins == i) {
8750 m_bVisitPlugins = TRUE;
8751 top_frame::Get()->FreezeCharts();
8755 auto loader = PluginLoader::GetInstance();
8756 if (LoadAllPlugIns(
false)) {
8757 delete m_pPlugInCtrl;
8758 m_pPlugInCtrl = NULL;
8759 delete m_PluginCatalogMgrPanel;
8760 m_PluginCatalogMgrPanel = NULL;
8761 itemBoxSizerPanelPlugins->Clear();
8764 if (!m_pPlugInCtrl) {
8766 ::wxBeginBusyCursor();
8768 m_pPlugInCtrl =
new PluginListPanel(itemPanelPlugins, ID_PANELPIM,
8769 wxDefaultPosition, wxDefaultSize);
8770 m_pPlugInCtrl->SetScrollRate(m_scrollRate, m_scrollRate);
8771 itemBoxSizerPanelPlugins->Add(m_pPlugInCtrl, 01,
8772 wxEXPAND | wxGROW | wxALL, 4);
8775 m_PluginCatalogMgrPanel =
new CatalogMgrPanel(itemPanelPlugins);
8776 m_PluginCatalogMgrPanel->SetListPanelPtr(m_pPlugInCtrl);
8778 itemBoxSizerPanelPlugins->Add(m_PluginCatalogMgrPanel, 0,
8779 wxEXPAND | wxALL, 4);
8780 itemBoxSizerPanelPlugins->Layout();
8783 m_pPlugInCtrl->UpdateSelections();
8785 ::wxEndBusyCursor();
8787 wxDEFINE_EVENT(EVT_COMPAT_OS_CHANGE, wxCommandEvent);
8788 obs::GlobalVar<wxString> compat_os(&g_compatOS);
8790 k_plugins = TOOLBAR_CHANGED;
8792 k_plugins |= FORCE_RELOAD;
8796wxString options::SelectSoundFile() {
8797 wxString sound_dir =
g_Platform->GetSharedDataDir();
8798 sound_dir.Append(
"sounds");
8803 wxFileDialog* popenDialog =
new wxFileDialog(
8804 NULL, _(
"Select Sound File"), sound_dir, wxEmptyString,
8805 "WAV files (*.wav)|*.wav|All files (*.*)|*.*", wxFD_OPEN);
8807 popenDialog =
g_Platform->AdjustFileDialogFont(
this, popenDialog);
8809 response = popenDialog->ShowModal();
8810 sel_file = popenDialog->GetPath();
8815 this, &sel_file, _(
"Select Sound File"), sound_dir, wxEmptyString,
"*.*");
8818 if (response == wxID_OK)
8824void options::OnButtonSelectSound(wxCommandEvent& event) {
8825 wxString sel_file = SelectSoundFile();
8827 if (!sel_file.IsEmpty()) {
8828 g_sAIS_Alert_Sound_File =
g_Platform->NormalizePath(sel_file);
8832void options::OnButtonTestSound(wxCommandEvent& event) {
8833 auto sound = o_sound::Factory();
8834 auto cmd_sound =
dynamic_cast<o_sound::SystemCmdSound*
>(sound);
8835 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str());
8836 sound->SetFinishedCallback([&](
void* snd) {
m_on_sound_done.Notify(snd); });
8837 sound->Load(m_soundPanelAIS->GetSoundFile(), g_iSoundDeviceIndex);
8841wxString GetOCPNKnownLanguage(wxString lang_canonical, wxString& lang_dir) {
8842 wxString return_string;
8843 wxString dir_suffix;
8845#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
8847 if (lang_canonical ==
"en_US") {
8849 return_string = wxString(
"English (U.S.)", wxConvUTF8);
8851 }
else if ((lang_canonical ==
"cs_CZ") || (lang_canonical ==
"cs")) {
8853 return_string = wxString(
"Čeština", wxConvUTF8);
8855 }
else if ((lang_canonical ==
"da_DK") || (lang_canonical ==
"da")) {
8857 return_string = wxString(
"Dansk", wxConvUTF8);
8859 }
else if ((lang_canonical ==
"de_DE") || (lang_canonical ==
"de")) {
8861 return_string = wxString(
"Deutsch", wxConvUTF8);
8863 }
else if ((lang_canonical ==
"et_EE") || (lang_canonical ==
"et")) {
8865 return_string = wxString(
"Eesti", wxConvUTF8);
8867 }
else if ((lang_canonical ==
"es_ES") || (lang_canonical ==
"es")) {
8869 return_string = wxString(
"Español", wxConvUTF8);
8871 }
else if ((lang_canonical ==
"fr_FR") || (lang_canonical ==
"fr")) {
8873 return_string = wxString(
"Français", wxConvUTF8);
8875 }
else if ((lang_canonical ==
"it_IT") || (lang_canonical ==
"it")) {
8877 return_string = wxString(
"Italiano", wxConvUTF8);
8879 }
else if ((lang_canonical ==
"nl_NL") || (lang_canonical ==
"nl")) {
8881 return_string = wxString(
"Nederlands", wxConvUTF8);
8883 }
else if ((lang_canonical ==
"pl_PL") || (lang_canonical ==
"pl")) {
8885 return_string = wxString(
"Polski", wxConvUTF8);
8887 }
else if ((lang_canonical ==
"pt_PT") || (lang_canonical ==
"pt")) {
8888 dir_suffix =
"pt_PT";
8889 return_string = wxString(
"Português", wxConvUTF8);
8891 }
else if ((lang_canonical ==
"pt_BR") || (lang_canonical ==
"pt_BR")) {
8892 dir_suffix =
"pt_BR";
8893 return_string = wxString(
"Português Brasileiro", wxConvUTF8);
8895 }
else if ((lang_canonical ==
"ru_RU") || (lang_canonical ==
"ru")) {
8897 return_string = wxString(
"Русский", wxConvUTF8);
8899 }
else if ((lang_canonical ==
"sv_SE") || (lang_canonical ==
"sv")) {
8901 return_string = wxString(
"Svenska", wxConvUTF8);
8903 }
else if ((lang_canonical ==
"fi_FI") || (lang_canonical ==
"fi")) {
8904 dir_suffix =
"fi_FI";
8905 return_string = wxString(
"Suomi", wxConvUTF8);
8907 }
else if ((lang_canonical ==
"nb_NO") || (lang_canonical ==
"nb")) {
8908 dir_suffix =
"nb_NO";
8909 return_string = wxString(
"Norsk", wxConvUTF8);
8911 }
else if ((lang_canonical ==
"tr_TR") || (lang_canonical ==
"tr")) {
8912 dir_suffix =
"tr_TR";
8913 return_string = wxString(
"Türkçe", wxConvUTF8);
8915 }
else if ((lang_canonical ==
"el_GR") || (lang_canonical ==
"el")) {
8916 dir_suffix =
"el_GR";
8917 return_string = wxString(
"Ελληνικά", wxConvUTF8);
8919 }
else if ((lang_canonical ==
"hu_HU") || (lang_canonical ==
"hu")) {
8920 dir_suffix =
"hu_HU";
8921 return_string = wxString(
"Magyar", wxConvUTF8);
8923 }
else if ((lang_canonical ==
"zh_TW") || (lang_canonical ==
"zh_TW")) {
8924 dir_suffix =
"zh_TW";
8925 return_string = wxString(
"正體字", wxConvUTF8);
8927 }
else if ((lang_canonical ==
"zh_CN") || (lang_canonical ==
"zh_CN")) {
8928 dir_suffix =
"zh_CN";
8929 return_string = wxString(
"Simplified Chinese", wxConvUTF8);
8931 }
else if ((lang_canonical ==
"ca_ES") || (lang_canonical ==
"ca")) {
8932 dir_suffix =
"ca_ES";
8933 return_string = wxString(
"Catalan", wxConvUTF8);
8935 }
else if ((lang_canonical ==
"gl_ES") || (lang_canonical ==
"gl_ES")) {
8936 dir_suffix =
"gl_ES";
8937 return_string = wxString(
"Galician", wxConvUTF8);
8939 }
else if ((lang_canonical ==
"ja_JP") || (lang_canonical ==
"ja_JP")) {
8940 dir_suffix =
"ja_JP";
8941 return_string = wxString(
"Japanese", wxConvUTF8);
8943 }
else if ((lang_canonical ==
"vi_VN") || (lang_canonical ==
"vi_VN")) {
8944 dir_suffix =
"vi_VN";
8945 return_string = wxString(
"Vietnamese", wxConvUTF8);
8948 dir_suffix = lang_canonical;
8949 const wxLanguageInfo* info = wxLocale::FindLanguageInfo(lang_canonical);
8951 return_string = info->Description;
8953 return_string = lang_canonical;
8956 lang_dir = dir_suffix;
8958 return return_string;
8961wxString GetOCPNKnownLanguage(
const wxString lang_canonical) {
8963 return GetOCPNKnownLanguage(lang_canonical, lang_dir);
8966ChartGroupArray* ChartGroupsUI::CloneChartGroupArray(ChartGroupArray* s) {
8967 ChartGroupArray* d =
new ChartGroupArray;
8968 for (
unsigned int i = 0; i < s->GetCount(); i++) {
8969 ChartGroup* psg = s->Item(i);
8970 ChartGroup* pdg =
new ChartGroup;
8971 pdg->m_group_name = psg->m_group_name;
8972 pdg->m_element_array.reserve(psg->m_element_array.size());
8974 for (
auto& elem : psg->m_element_array)
8975 pdg->m_element_array.push_back(elem);
8982void ChartGroupsUI::EmptyChartGroupArray(ChartGroupArray* s) {
8992EVT_TREE_ITEM_EXPANDED(wxID_TREECTRL, ChartGroupsUI::OnNodeExpanded)
8993EVT_NOTEBOOK_PAGE_CHANGED(
8995 ChartGroupsUI::OnGroupPageChange)
8999 m_GroupSelectedPage = -1;
9000 m_pActiveChartsTree = 0;
9002 lastSelectedCtl = NULL;
9003 allAvailableCtl = NULL;
9004 defaultAllCtl = NULL;
9006 m_pAddButton = NULL;
9007 m_pRemoveButton = NULL;
9008 m_pDeleteGroupButton = NULL;
9009 m_pNewGroupButton = NULL;
9010 m_pGroupArray = NULL;
9013 m_UIcomplete =
false;
9014 m_treespopulated =
false;
9018ChartGroupsUI::~ChartGroupsUI() {
9019 m_DirCtrlArray.Clear();
9020 m_GroupNB->Disconnect(
9021 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
9022 wxNotebookEventHandler(ChartGroupsUI::OnGroupPageChange), NULL,
this);
9027void ChartGroupsUI::SetInitialSettings() {
9028 m_settingscomplete = FALSE;
9029 m_treespopulated = FALSE;
9032void ChartGroupsUI::PopulateTrees() {
9035 wxArrayString dir_array;
9036 int nDir = m_db_dirs.GetCount();
9037 for (
int i = 0; i < nDir; i++) {
9038 wxString dirname = m_db_dirs[i].fullpath;
9039 if (!dirname.IsEmpty()) dir_array.Add(dirname);
9042 PopulateTreeCtrl(allAvailableCtl->GetTreeCtrl(), dir_array,
9043 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
9045 m_pActiveChartsTree = allAvailableCtl->GetTreeCtrl();
9049 wxArrayString dir_array0;
9050 int nDir0 = m_db_dirs.GetCount();
9051 for (
int i = 0; i < nDir0; i++) {
9052 wxString dirname = m_db_dirs[i].fullpath;
9053 if (!dirname.IsEmpty()) dir_array0.Add(dirname);
9055 PopulateTreeCtrl(defaultAllCtl->GetTreeCtrl(), dir_array0,
9056 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), iFont);
9059void ChartGroupsUI::CompleteInitialSettings() {
9062 BuildNotebookPages(m_pGroupArray);
9064 m_panel->GetSizer()->Layout();
9066 m_settingscomplete = TRUE;
9067 m_treespopulated = TRUE;
9070void ChartGroupsUI::PopulateTreeCtrl(wxTreeCtrl* ptc,
9071 const wxArrayString& dir_array,
9072 const wxColour& col, wxFont* pFont) {
9073 ptc->DeleteAllItems();
9075 wxDirItemData* rootData =
new wxDirItemData(
"Dummy",
"Dummy", TRUE);
9078 wxTreeItemId m_rootId = ptc->AddRoot(rootName, 3, -1, rootData);
9079 ptc->SetItemHasChildren(m_rootId);
9082 int nDir = dir_array.GetCount();
9083 for (
int i = 0; i < nDir; i++) {
9084 wxString dirname = dir_array[i];
9085 if (!dirname.IsEmpty()) {
9086 wxDirItemData* dir_item =
new wxDirItemData(dirname, dirname, TRUE);
9087 wxTreeItemId
id = ptc->AppendItem(m_rootId, dirname, 0, -1, dir_item);
9090 ptc->SetItemText(
id, dirname);
9091 if (pFont) ptc->SetItemFont(
id, *pFont);
9095 ptc->SetItemTextColour(
id, col);
9097 ptc->SetItemHasChildren(
id);
9102void ChartGroupsUI::OnInsertChartItem(wxCommandEvent& event) {
9103 wxString insert_candidate = allAvailableCtl->GetPath();
9104 if (!insert_candidate.IsEmpty()) {
9105 if (m_DirCtrlArray.GetCount()) {
9106 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9107 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9109 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9111 if (ptree->IsEmpty()) {
9112 wxDirItemData* rootData =
9113 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9114 wxString rootName =
"Dummy";
9115 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9117 ptree->SetItemHasChildren(rootId);
9120 wxTreeItemId root_Id = ptree->GetRootItem();
9121 wxDirItemData* dir_item =
9122 new wxDirItemData(insert_candidate, insert_candidate, TRUE);
9124 ptree->AppendItem(root_Id, insert_candidate, 0, -1, dir_item);
9125 if (wxDir::Exists(insert_candidate)) ptree->SetItemHasChildren(
id);
9128 pGroup->m_element_array.push_back({insert_candidate});
9133 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9134 m_pAddButton->Disable();
9136 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9138 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9139 if (ptree) ptree->Refresh();
9143void ChartGroupsUI::OnRemoveChartItem(wxCommandEvent& event) {
9144 if (m_DirCtrlArray.GetCount()) {
9145 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9146 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9149 wxString sel_item = pDirCtrl->GetPath();
9151 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9152 if (ptree && ptree->GetCount()) {
9153 wxTreeItemId
id = ptree->GetSelection();
9154 lastDeletedItem = id;
9156 wxString branch_adder;
9157 int group_item_index =
9158 FindGroupBranch(pGroup, ptree,
id, &branch_adder);
9159 if (group_item_index >= 0) {
9160 ChartGroupElement& pelement =
9161 pGroup->m_element_array[group_item_index];
9162 bool b_duplicate = FALSE;
9163 for (
unsigned int k = 0; k < pelement.m_missing_name_array.size();
9165 if (pelement.m_missing_name_array[k] == sel_item) {
9171 pelement.m_missing_name_array.Add(sel_item);
9177 if (branch_adder ==
"") {
9179 pGroup->m_element_array.erase(pGroup->m_element_array.begin() +
9182 ptree->SetItemTextColour(
id, wxColour(128, 128, 128));
9188 lastSelectedCtl->Unselect();
9189 lastSelectedCtl = 0;
9190 m_pRemoveButton->Disable();
9192 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9194 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9195 if (ptree) ptree->Refresh();
9203void ChartGroupsUI::OnGroupPageChange(wxNotebookEvent& event) {
9204 m_GroupSelectedPage =
event.GetSelection();
9205 allAvailableCtl->GetTreeCtrl()->UnselectAll();
9206 if (lastSelectedCtl) {
9207 lastSelectedCtl->UnselectAll();
9208 lastSelectedCtl = 0;
9210 m_pRemoveButton->Disable();
9211 m_pAddButton->Disable();
9214 if (m_GroupSelectedPage == 0) {
9215 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Disable();
9217 if (m_pDeleteGroupButton) m_pDeleteGroupButton->Enable();
9221void ChartGroupsUI::OnAvailableSelection(wxTreeEvent& event) {
9222 wxObject* evtObj =
event.GetEventObject();
9223 if (allAvailableCtl && (evtObj == allAvailableCtl->GetTreeCtrl())) {
9224 wxTreeItemId item = allAvailableCtl->GetTreeCtrl()->GetSelection();
9225 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9226 m_pAddButton->Enable();
9228 m_pAddButton->Disable();
9231 lastSelectedCtl =
dynamic_cast<wxTreeCtrl*
>(evtObj);
9232 if (!lastSelectedCtl)
goto out;
9233 wxTreeItemId item = lastSelectedCtl->GetSelection();
9234 if (item && item.IsOk() && m_GroupSelectedPage > 0) {
9237 wxGenericDirCtrl* dirCtrl =
9238 dynamic_cast<wxGenericDirCtrl*
>(lastSelectedCtl->GetParent());
9239 if (!dirCtrl)
goto out;
9240 wxString itemPath = dirCtrl->GetPath();
9241 if (!itemPath.IsEmpty()) m_pRemoveButton->Enable();
9243 m_pRemoveButton->Disable();
9251void ChartGroupsUI::OnNewGroup(wxCommandEvent& event) {
9252 wxTextEntryDialog* pd =
new wxTextEntryDialog();
9254 pd->SetFont(*qFont);
9256 pd->Create(m_panel, _(
"Enter Group Name"), _(
"New Chart Group"));
9259 androidDisableRotation();
9262 if (pd->ShowModal() == wxID_OK) {
9263 if (pd->GetValue().Length()) {
9264 AddEmptyGroupPage(pd->GetValue());
9265 ChartGroup* pGroup =
new ChartGroup;
9266 pGroup->m_group_name = pd->GetValue();
9267 m_pGroupArray->Add(pGroup);
9269 m_GroupSelectedPage =
9270 m_GroupNB->GetPageCount() - 1;
9271 m_GroupNB->ChangeSelection(m_GroupSelectedPage);
9272 m_pDeleteGroupButton->Enable();
9279 androidEnableRotation();
9283void ChartGroupsUI::OnDeleteGroup(wxCommandEvent& event) {
9284 if (0 != m_GroupSelectedPage) {
9285 m_DirCtrlArray.RemoveAt(m_GroupSelectedPage);
9286 if (m_pGroupArray) m_pGroupArray->RemoveAt(m_GroupSelectedPage - 1);
9287 m_GroupNB->DeletePage(m_GroupSelectedPage);
9290 if (m_GroupSelectedPage <= 0) {
9291 m_pAddButton->Disable();
9292 m_pDeleteGroupButton->Disable();
9296int ChartGroupsUI::FindGroupBranch(
ChartGroup* pGroup, wxTreeCtrl* ptree,
9297 wxTreeItemId item, wxString* pbranch_adder) {
9298 wxString branch_name;
9299 wxString branch_adder;
9301 wxTreeItemId current_node = item;
9302 while (current_node.IsOk()) {
9303 wxTreeItemId parent_node = ptree->GetItemParent(current_node);
9304 if (!parent_node)
break;
9306 if (parent_node == ptree->GetRootItem()) {
9307 branch_name = ptree->GetItemText(current_node);
9311 branch_adder.Prepend(ptree->GetItemText(current_node));
9312 branch_adder.Prepend(wxString(wxFILE_SEP_PATH));
9314 current_node = ptree->GetItemParent(current_node);
9318 unsigned int target_item_index = -1;
9320 for (
unsigned int i = 0; i < pGroup->m_element_array.size(); i++) {
9321 const wxString& target = pGroup->m_element_array[i].m_element_name;
9322 if (branch_name == target) {
9323 target_item_index = i;
9328 if (pbranch_adder) *pbranch_adder = branch_adder;
9330 return target_item_index;
9333void ChartGroupsUI::OnNodeExpanded(wxTreeEvent& event) {
9334 wxTreeItemId node =
event.GetItem();
9336 if (m_GroupSelectedPage <= 0)
return;
9337 wxGenericDirCtrl* pDirCtrl = (m_DirCtrlArray[m_GroupSelectedPage]);
9338 ChartGroup* pGroup = m_pGroupArray->Item(m_GroupSelectedPage - 1);
9339 if (!pDirCtrl)
return;
9341 wxTreeCtrl* ptree = pDirCtrl->GetTreeCtrl();
9342 wxString branch_adder;
9343 int target_item_index = FindGroupBranch(pGroup, ptree, node, &branch_adder);
9344 if (target_item_index < 0)
return;
9345 const ChartGroupElement& target_element =
9346 pGroup->m_element_array[target_item_index];
9347 const wxString& branch_name = target_element.m_element_name;
9351 if (!target_element.m_missing_name_array.GetCount())
return;
9352 wxString full_root = branch_name;
9353 full_root += branch_adder;
9354 full_root += wxString(wxFILE_SEP_PATH);
9356 wxTreeItemIdValue cookie;
9357 wxTreeItemId child = ptree->GetFirstChild(node, cookie);
9358 while (child.IsOk()) {
9359 wxString target_string = full_root;
9360 target_string += ptree->GetItemText(child);
9362 for (
unsigned int k = 0; k < target_element.m_missing_name_array.GetCount();
9364 if (target_element.m_missing_name_array[k] == target_string) {
9365 ptree->SetItemTextColour(child, wxColour(128, 128, 128));
9369 child = ptree->GetNextChild(node, cookie);
9373void ChartGroupsUI::BuildNotebookPages(ChartGroupArray* pGroupArray) {
9376 for (
unsigned int i = 0; i < pGroupArray->GetCount(); i++) {
9377 ChartGroup* pGroup = pGroupArray->Item(i);
9378 wxTreeCtrl* ptc = AddEmptyGroupPage(pGroup->m_group_name);
9381 int nItems = pGroup->m_element_array.size();
9382 for (
int i = 0; i < nItems; i++) {
9383 const wxString& itemname = pGroup->m_element_array[i].m_element_name;
9384 if (!itemname.IsEmpty()) {
9385 wxDirItemData* dir_item =
new wxDirItemData(itemname, itemname, TRUE);
9387 ptc->AppendItem(ptc->GetRootItem(), itemname, 0, -1, dir_item);
9389 if (wxDir::Exists(itemname)) ptc->SetItemHasChildren(
id);
9395wxTreeCtrl* ChartGroupsUI::AddEmptyGroupPage(
const wxString& label) {
9396 wxGenericDirCtrl* GroupDirCtl =
9397 new wxGenericDirCtrl(m_GroupNB, wxID_ANY,
"TESTDIR");
9398 m_GroupNB->AddPage(GroupDirCtl, label);
9400 wxTreeCtrl* ptree = GroupDirCtl->GetTreeCtrl();
9401 ptree->DeleteAllItems();
9403 wxDirItemData* rootData =
9404 new wxDirItemData(wxEmptyString, wxEmptyString, TRUE);
9405 wxString rootName =
"Dummy";
9406 wxTreeItemId rootId = ptree->AddRoot(rootName, 3, -1, rootData);
9407 ptree->SetItemHasChildren(rootId);
9409 m_DirCtrlArray.Add(GroupDirCtl);
9414void ChartGroupsUI::ClearGroupPages() {
9415 if (m_GroupNB->GetPageCount() == 0)
return;
9417 for (
unsigned int i = m_GroupNB->GetPageCount() - 1; i > 0; i--) {
9418 m_DirCtrlArray.RemoveAt(i);
9419 m_GroupNB->DeletePage(i);
9423void options::OnInsertTideDataLocation(wxCommandEvent& event) {
9425 int response = wxID_CANCEL;
9428 wxFileDialog* popenDialog =
new wxFileDialog(
9429 NULL, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
9430 "Tide/Current Data files (*.IDX; *.TCD)|*.IDX;*.idx;*.TCD;*.tcd|All "
9434 popenDialog =
g_Platform->AdjustFileDialogFont(
this, popenDialog);
9436 response = popenDialog->ShowModal();
9437 sel_file = popenDialog->GetPath();
9443 this, &path, _(
"Select Tide/Current Data"), g_TCData_Dir,
"",
"*.*");
9447 if (response == wxID_OK) {
9449 int id = tcDataSelected->GetItemCount();
9451 long idx = tcDataSelected->InsertItem(li);
9452 tcDataSelected->SetItem(
id, 0,
g_Platform->NormalizePath(sel_file));
9455 wxFileName fn(sel_file);
9456 wxString data_dir = fn.GetPath();
9457 g_TCData_Dir =
g_Platform->NormalizePath(data_dir);
9461void options::OnRemoveTideDataLocation(wxCommandEvent& event) {
9464 item = tcDataSelected->GetNextItem(item, wxLIST_NEXT_ALL,
9465 wxLIST_STATE_SELECTED);
9466 if (item == -1)
break;
9467 tcDataSelected->DeleteItem(item);
9473enum { ID_BUTTON_REBUILD, ID_BUTTON_CLEAR };
9476BEGIN_EVENT_TABLE(OpenGLOptionsDlg, wxDialog)
9477EVT_BUTTON(ID_BUTTON_REBUILD, OpenGLOptionsDlg::OnButtonRebuild)
9478EVT_BUTTON(ID_BUTTON_CLEAR, OpenGLOptionsDlg::OnButtonClear)
9481OpenGLOptionsDlg::OpenGLOptionsDlg(wxWindow* parent)
9482 : wxDialog(parent, wxID_ANY,
"OpenGL Options", wxDefaultPosition,
9484 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
9489 m_brebuild_cache(FALSE) {
9492 SetFont(*dialogFont);
9494 wxBoxSizer* mainSizer =
new wxBoxSizer(wxVERTICAL);
9495 wxFlexGridSizer* flexSizer =
new wxFlexGridSizer(2);
9497 m_cbTextureCompression =
9498 new wxCheckBox(
this, wxID_ANY,
9499 g_bGLexpert ? _(
"Texture Compression")
9500 : _(
"Texture Compression with Caching"));
9501 m_cbTextureCompressionCaching =
9502 new wxCheckBox(
this, wxID_ANY, _(
"Texture Compression Caching"));
9504 new wxStaticText(
this, wxID_ANY, _(
"Texture Memory Size (MB)"));
9505 m_sTextureMemorySize =
new wxSpinCtrl(
this);
9506 m_sTextureMemorySize->SetRange(1, 16384);
9508 new wxStaticText(
this, wxID_ANY, _(
"Size: ") + GetTextureCacheSize());
9509 wxButton* btnRebuild =
9510 new wxButton(
this, ID_BUTTON_REBUILD, _(
"Rebuild Texture Cache"));
9511 wxButton* btnClear =
9512 new wxButton(
this, ID_BUTTON_CLEAR, _(
"Clear Texture Cache"));
9513 btnRebuild->Enable(g_GLOptions.m_bTextureCompressionCaching);
9515 btnClear->Enable(g_GLOptions.m_bTextureCompressionCaching);
9516 m_cbPolygonSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Polygon Smoothing"));
9517 m_cbLineSmoothing =
new wxCheckBox(
this, wxID_ANY, _(
"Line Smoothing"));
9519 new wxCheckBox(
this, wxID_ANY, _(
"Software OpenGL (restart OpenCPN)"));
9520 m_cbUseAcceleratedPanning =
9521 new wxCheckBox(
this, wxID_ANY, _(
"Use Accelerated Panning"));
9523 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Settings")), 0,
9524 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9525 flexSizer->Add(m_cbTextureCompression, 0, wxALL | wxEXPAND, 5);
9526 flexSizer->AddSpacer(0);
9527 flexSizer->Add(m_cbTextureCompressionCaching, 0, wxALL | wxEXPAND, 5);
9528 flexSizer->Add(m_memorySize, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9529 flexSizer->Add(m_sTextureMemorySize, 0, wxALL | wxEXPAND, 5);
9530 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Texture Cache")), 0,
9531 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9532 flexSizer->Add(m_cacheSize, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
9533 flexSizer->AddSpacer(0);
9534 flexSizer->Add(btnRebuild, 0, wxALL | wxEXPAND, 5);
9535 flexSizer->AddSpacer(0);
9536 flexSizer->Add(btnClear, 0, wxALL | wxEXPAND, 5);
9537 flexSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Miscellaneous")), 0,
9538 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
9539 flexSizer->Add(m_cbPolygonSmoothing, 0, wxALL | wxEXPAND, 5);
9540 flexSizer->AddSpacer(0);
9541 flexSizer->Add(m_cbLineSmoothing, 0, wxALL | wxEXPAND, 5);
9542 flexSizer->AddSpacer(0);
9543 flexSizer->AddSpacer(0);
9544 flexSizer->Add(m_cbSoftwareGL, 0, wxALL | wxEXPAND, 5);
9545 flexSizer->AddSpacer(0);
9546 flexSizer->Add(m_cbUseAcceleratedPanning, 0, wxALL | wxEXPAND, 5);
9547 flexSizer->AddGrowableCol(1);
9548 mainSizer->Add(flexSizer, 0, wxALL | wxEXPAND, 5);
9550 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
9551 btnSizer->AddButton(
new wxButton(
this, wxID_OK));
9552 btnSizer->AddButton(
new wxButton(
this, wxID_CANCEL, _(
"Cancel")));
9553 btnSizer->Realize();
9555 mainSizer->AddStretchSpacer();
9556 mainSizer->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
9560 SetSizer(mainSizer);
9561 mainSizer->SetSizeHints(
this);
9565bool OpenGLOptionsDlg::GetAcceleratedPanning()
const {
9566 return m_cbUseAcceleratedPanning->GetValue();
9569bool OpenGLOptionsDlg::GetTextureCompression()
const {
9570 return m_cbTextureCompression->GetValue();
9573bool OpenGLOptionsDlg::GetPolygonSmoothing()
const {
9574 return m_cbPolygonSmoothing->GetValue();
9577bool OpenGLOptionsDlg::GetLineSmoothing()
const {
9578 return m_cbLineSmoothing->GetValue();
9581bool OpenGLOptionsDlg::GetSoftwareGL()
const {
9582 return m_cbSoftwareGL->GetValue();
9585bool OpenGLOptionsDlg::GetTextureCompressionCaching()
const {
9586 return m_cbTextureCompressionCaching->GetValue();
9589bool OpenGLOptionsDlg::GetRebuildCache()
const {
return m_brebuild_cache; }
9591int OpenGLOptionsDlg::GetTextureMemorySize()
const {
9592 return m_sTextureMemorySize->GetValue();
9595void OpenGLOptionsDlg::Populate() {
9596 m_cbTextureCompression->SetValue(g_GLOptions.m_bTextureCompression);
9604 m_cbTextureCompressionCaching->Show(g_bGLexpert);
9605 m_memorySize->Show(g_bGLexpert);
9606 m_sTextureMemorySize->Show(g_bGLexpert);
9608 m_cbTextureCompressionCaching->SetValue(
9609 g_GLOptions.m_bTextureCompressionCaching);
9610 m_sTextureMemorySize->SetValue(g_GLOptions.m_iTextureMemorySize);
9612 m_cbPolygonSmoothing->SetValue(g_GLOptions.m_GLPolygonSmoothing);
9613 m_cbLineSmoothing->SetValue(g_GLOptions.m_GLLineSmoothing);
9615#if defined(__UNIX__) && !defined(__ANDROID__) && !defined(__WXOSX__)
9616 if (top_frame::Get()->GetWxGlCanvas()) {
9617 if (top_frame::Get()->GetGlVersionString().Upper().Find(
"MESA") !=
9619 m_cbSoftwareGL->SetValue(g_bSoftwareGL);
9622 m_cbSoftwareGL->Hide();
9626 SetFont(*dialogFont);
9629 if (top_frame::Get()->GetWxGlCanvas()) {
9630 if (top_frame::Get()
9631 ->GetAbstractPrimaryCanvas()
9632 ->CanAccelerateGlPanning()) {
9633 m_cbUseAcceleratedPanning->Enable();
9634 m_cbUseAcceleratedPanning->SetValue(
9635 g_GLOptions.m_bUseAcceleratedPanning);
9637 m_cbUseAcceleratedPanning->SetValue(FALSE);
9638 m_cbUseAcceleratedPanning->Disable();
9641 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9644 m_cbUseAcceleratedPanning->SetValue(g_GLOptions.m_bUseAcceleratedPanning);
9645 m_cbUseAcceleratedPanning->Disable();
9649void OpenGLOptionsDlg::OnButtonRebuild(wxCommandEvent& event) {
9650 if (g_GLOptions.m_bTextureCompressionCaching) {
9651 m_brebuild_cache = TRUE;
9652 EndModal(wxID_CANCEL);
9656void OpenGLOptionsDlg::OnButtonClear(wxCommandEvent& event) {
9658 ::wxBeginBusyCursor();
9661 wxString path = g_Platform->GetPrivateDataDir();
9662 appendOSDirSlash(&path);
9663 path.append(
"raster_texture_cache");
9665 if (::wxDirExists(path)) {
9666 wxArrayString files;
9667 size_t nfiles = wxDir::GetAllFiles(path, &files);
9668 for (
unsigned int i = 0; i < files.GetCount(); i++)
9669 ::wxRemoveFile(files[i]);
9672 m_cacheSize->SetLabel(_(
"Size: ") + GetTextureCacheSize());
9673 ::wxEndBusyCursor();
9677wxString OpenGLOptionsDlg::GetTextureCacheSize() {
9678 wxString path = g_Platform->GetPrivateDataDir();
9679 appendOSDirSlash(&path);
9680 path.append(
"raster_texture_cache");
9681 long long total = 0;
9683 if (::wxDirExists(path)) {
9684 wxArrayString files;
9685 size_t nfiles = wxDir::GetAllFiles(path, &files);
9686 for (
unsigned int i = 0; i < files.GetCount(); i++)
9687 total += wxFile(files[i]).Length();
9689 double mb = total / (1024.0 * 1024.0);
9690 if (mb < 10000.0)
return wxString::Format(
"%.1f MB", mb);
9692 return wxString::Format(
"%.1f GB", mb);
9700EVT_PAINT(CanvasConfigSelect::OnPaint)
9704 wxWindowID
id, wxBitmap& bmp,
9705 const wxPoint& pos, const wxSize& size)
9706 : wxPanel(parent,
id, pos, size, wxBORDER_NONE) {
9707 m_parentOptions = parentOptions;
9712 int refHeight = GetCharHeight();
9714 SetMinSize(wxSize(bmp.GetSize().x + m_borderWidth * 2,
9715 bmp.GetSize().y + m_borderWidth * 2));
9717 Connect(wxEVT_LEFT_DOWN,
9718 wxMouseEventHandler(CanvasConfigSelect::OnMouseSelected), NULL,
this);
9721CanvasConfigSelect::~CanvasConfigSelect() {}
9723void CanvasConfigSelect::OnMouseSelected(wxMouseEvent& event) {
9729 if (m_parentOptions)
9730 m_parentOptions->OnCanvasConfigSelectClick(GetId(), GetSelected());
9733void CanvasConfigSelect::SetSelected(
bool selected) {
9734 m_bSelected = selected;
9738 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT);
9741 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW);
9747void CanvasConfigSelect::OnPaint(wxPaintEvent& event) {
9749 GetSize(&width, &height);
9752 dc.SetBackground(*wxLIGHT_GREY);
9754 dc.SetPen(*wxTRANSPARENT_PEN);
9755 dc.SetBrush(wxBrush(GetBackgroundColour()));
9756 dc.DrawRectangle(GetVirtualSize());
9759 dc.SetBrush(wxBrush(m_boxColour));
9761 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9763 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9765 dc.SetBrush(wxBrush(m_boxColour));
9767 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_HIGHLIGHT),
9769 dc.DrawRoundedRectangle(0, 0, width - 1, height - 1, height / 10);
9772 dc.DrawBitmap(m_bmpNormal, m_borderWidth, m_borderWidth,
false);
ArrayOfMmsiProperties g_MMSI_Props_Array
Global instance.
unsigned g_OwnShipmmsi
Global instance.
AisDecoder * g_pAIS
Global instance.
Class AisDecoder and helpers.
Global state for AIS decoder.
Wrapper for creating a ChartCtx based on global vars.
ChartDB * ChartData
Global instance.
ChartGroupArray * g_pGroupArray
Global instance.
Basic chart info storage.
arrayofCanvasPtr g_canvasArray
Global instance.
Generic Chart canvas base.
Represents a user-defined collection of logically related charts.
ConfigCreateDialog(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
Class ConfigCreateDialog.
wxColour GetFontColor(const wxString &TextElement) const
Gets the text color for a UI element.
bool SetFont(const wxString &TextElement, wxFont *pFont, wxColour color)
Sets the default font properties for a UI element.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Get a font object for a UI element.
MMSIEditDialog(MmsiProperties *props, wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
Class MMSIEditDialog.
Process incoming AIS messages.
static double ui_to_config(int slider_pos)
Convert a slider scale 1-100 value to configuration value 1.02..3.0.
obs::EventVar m_on_sp_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
Custom event class for OpenCPN's notification system.
Generic event handling between for example MVC Model and Controller based on a shared EventVar variab...
Wrapper for global variable, supports notification events when value changes.
Define an action to be performed when a KeyProvider is notified.
obs::EventVar m_on_sound_done
Notified with a OCPN_Sound* pointer when sound has completed.
wxRadioButton * pTimezoneUTC
Specify date/time should be formatted in UTC.
wxRadioButton * pTimezoneLocalTime
Specify date/time should be formatted in timezone as configured in the operating system.
Class cm93chart and helpers – CM93 chart state.
Global variables reflecting command line options and arguments.
Communication drivers factory and support.
Config file user configuration interface.
int g_iTempFormat
User-selected temperature unit format for display and input.
bool g_bsmoothpanzoom
Controls how the chart panning and zooming smoothing is done during user interactions.
int g_iHeightFormat
User-selected height (vertical, above reference datum) unit format for display and input.
int g_nDepthUnitDisplay
User-selected depth (below surface) unit format for display and input.
bool g_bRollover
enable/disable mouse rollover GUI effects
int g_iSpeedFormat
User-selected speed unit format for display and input.
int g_COGAvgSec
COG average period for Course Up Mode (sec).
int g_iDistanceFormat
User-selected distance (horizontal) unit format for display and input.
wxString g_datetime_format
Date/time format to use when formatting date/time strings.
std::vector< size_t > g_config_display_size_mm
Size of pysical screen in millimeters.
bool g_bDisplayGrid
Should lat/lon grid be displayed ?
Global variables stored in configuration file.
std::vector< ConnectionParams * > & TheConnectionParams()
Return global list of connections.
Panel for editing a connection.
Options | Connections GUI tab managing connections
std::vector< OCPN_MonitorInfo > g_monitor_info
Information about the monitors connected to the system.
A common variable shared between producer and consumer which supports Listen() and Notify().
GLuint g_raster_format
Global instance.
OpenGL chart rendering canvas.
glTextureManager * g_glTextureManager
Global instance.
Global variables Listen()/Notify() wrapper.
Misc GUI event vars, a singleton.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
wxFont GetOCPNGUIScaledFont(wxString item)
Retrieves a font optimized for touch and high-resolution interfaces.
size_t g_current_monitor
Current monitor displaying main application frame.
Miscellaneous globals primarely used by gui layer, not persisted in configuration file.
GUI constant definitions.
Waypoint properties maintenance dialog.
Multiplexer class and helpers.
MyConfig * pConfig
Global instance.
Navigation Utility Functions without GUI dependencies.
Generic font dialog for OpenCPN.
wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
wxString * GetpSharedDataLocation()
Gets shared application data location.
double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
options * g_options
Global instance.
options * g_options
Global instance.
double gVar
Magnetic variation in degrees.
Position, course, speed, etc.
PlugInManager * g_pi_manager
Global instance.
wxColour g_colourWaypointRangeRingsColour
Global instance.
float g_ChartScaleFactorExp
Global instance.
Serial ports support, notably enumeration.
wxArrayString * EnumerateSerialPorts(void)
Enumerate all serial ports.
ocpnStyle::StyleManager * g_StyleManager
Global instance.
wxBitmap LoadSVG(const wxString filename, const unsigned int width, const unsigned int height, wxBitmap *default_bitmap, bool use_cache)
Load SVG file and return it's bitmap representation of requested size In case file can't be loaded an...
Abstract gFrame/MyFrame interface.
Access checks for comm devices and dongle.
Low-level USB device management.
WaypointMan drawing stuff.