OpenCPN Partial API docs
Loading...
Searching...
No Matches
canvas_options.cpp
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2018 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
24#include <wx/wxprec.h>
25
26#ifndef WX_PRECOMP
27#include <wx/wx.h>
28#endif
29
30#include <wx/artprov.h>
31#include <wx/statline.h>
32
33#include "dychart.h"
34
35#include "chcanv.h"
36#include "canvas_options.h"
37#include "gui_lib.h"
38#include "s52plib.h"
39
40#ifdef __ANDROID__
41#include "androidUTIL.h"
42#endif
43
44//------------------------------------------------------------------------------
45// External Static Storage
46//------------------------------------------------------------------------------
47extern s52plib* ps52plib;
48
49// Helper utilities
50
51// Helper classes
52
53//------------------------------------------------------------------------------
54// CanvasOptions
55//------------------------------------------------------------------------------
56
57BEGIN_EVENT_TABLE(CanvasOptions, wxDialog)
58EVT_CLOSE(CanvasOptions::OnClose)
59// EVT_CHECKBOX(ID_QUILTCHECKBOX1, CanvasOptions::OnOptionChange)
60END_EVENT_TABLE()
61
62CanvasOptions::CanvasOptions(wxWindow* parent)
63 : wxDialog()
64
65{
66 m_ENCAvail = true;
67
68 wxFont* qFont = GetOCPNScaledFont(_("Dialog"));
69 SetFont(*qFont);
70
71 long mstyle = wxNO_BORDER | wxFRAME_NO_TASKBAR;
72#ifdef __WXOSX__
73 mstyle |= wxSTAY_ON_TOP;
74#endif
75
76 wxDialog::Create(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize,
77 mstyle);
78
79 wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
80 SetSizer(topsizer);
81
82 m_sWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition,
83 wxDefaultSize, wxVSCROLL | wxSUNKEN_BORDER);
84 topsizer->Add(m_sWindow, 1, wxEXPAND);
85
86 m_sWindow->SetScrollRate(0, 5);
87
88 int border_size = 4;
89 int group_item_spacing = 0;
90 int interGroupSpace = border_size * 2;
91
92 wxSizerFlags verticalInputFlags = wxSizerFlags(0)
93 .Align(wxALIGN_LEFT)
94 .Expand()
95 .Border(wxALL, group_item_spacing);
96 wxSizerFlags inputFlags =
97 wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing);
98
99 wxScrolledWindow* pDisplayPanel = m_sWindow;
100
101 wxBoxSizer* generalSizer = new wxBoxSizer(wxVERTICAL);
102 pDisplayPanel->SetSizer(generalSizer);
103
104 // Options Label
105 wxStaticText* optionsLabelBox =
106 new wxStaticText(pDisplayPanel, wxID_ANY, _("Chart Panel Options"));
107 generalSizer->Add(optionsLabelBox, 0, wxALL | wxEXPAND, border_size);
108 wxStaticLine* m_staticLine121 =
109 new wxStaticLine(pDisplayPanel, wxID_ANY, wxDefaultPosition,
110 wxDefaultSize, wxLI_HORIZONTAL);
111 generalSizer->Add(m_staticLine121, 0, wxALL | wxEXPAND, border_size);
112
113 // spacer
114 generalSizer->Add(0, interGroupSpace);
115
116 // Control Options
117 // wxStaticBoxSizer* boxCont = new wxStaticBoxSizer(new
118 // wxStaticBox(pDisplayPanel, wxID_ANY, _("Control Options")), wxVERTICAL);
119 // generalSizer->Add(boxCont, 0, wxALL | wxEXPAND, border_size);
120
121 // pCBToolbar = new wxCheckBox(pDisplayPanel, ID_TOOLBARCHECKBOX, _("Show
122 // Toolbar")); boxCont->Add(pCBToolbar, verticalInputFlags);
123 // pCBToolbar->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED,
124 // wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this );
125 //
126 // // spacer
127 // generalSizer->Add(0, interGroupSpace);
128
129 // Nav Mode
130 wxStaticBoxSizer* boxNavMode = new wxStaticBoxSizer(
131 new wxStaticBox(pDisplayPanel, wxID_ANY, _("Navigation Mode")),
132 wxVERTICAL);
133 generalSizer->Add(boxNavMode, 0, wxALL | wxEXPAND, border_size);
134
135 wxBoxSizer* rowOrientation = new wxBoxSizer(wxVERTICAL);
136 boxNavMode->Add(rowOrientation);
137
138 pCBNorthUp = new wxRadioButton(pDisplayPanel, wxID_ANY, _("North Up"),
139 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
140 rowOrientation->Add(pCBNorthUp, inputFlags);
141 pCBNorthUp->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
142 wxCommandEventHandler(CanvasOptions::OnOptionChange),
143 NULL, this);
144
145 pCBCourseUp =
146 new wxRadioButton(pDisplayPanel, IDCO_COURSEUPCHECKBOX, _("Course Up"));
147 rowOrientation->Add(pCBCourseUp, wxSizerFlags(0)
148 .Align(wxALIGN_LEFT)
149 .Border(wxLEFT, group_item_spacing * 2));
150 pCBCourseUp->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
151 wxCommandEventHandler(CanvasOptions::OnOptionChange),
152 NULL, this);
153
154 pCBHeadUp =
155 new wxRadioButton(pDisplayPanel, IDCO_HEADUPCHECKBOX, _("Heading Up"));
156 rowOrientation->Add(pCBHeadUp, wxSizerFlags(0)
157 .Align(wxALIGN_LEFT)
158 .Border(wxLEFT, group_item_spacing * 2));
159 pCBHeadUp->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
160 wxCommandEventHandler(CanvasOptions::OnOptionChange), NULL,
161 this);
162
163 pCBLookAhead =
164 new wxCheckBox(pDisplayPanel, IDCO_CHECK_LOOKAHEAD, _("Look Ahead Mode"));
165 boxNavMode->Add(pCBLookAhead, verticalInputFlags);
166 pCBLookAhead->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
167 wxCommandEventHandler(CanvasOptions::OnOptionChange),
168 NULL, this);
169
170 // spacer
171 generalSizer->Add(0, interGroupSpace);
172
173 // Display Options
174 wxStaticBoxSizer* boxDisp = new wxStaticBoxSizer(
175 new wxStaticBox(pDisplayPanel, wxID_ANY, _("Display Options")),
176 wxVERTICAL);
177 generalSizer->Add(boxDisp, 0, wxALL | wxEXPAND, border_size);
178
179 pCDOQuilting = new wxCheckBox(pDisplayPanel, IDCO_QUILTCHECKBOX1,
180 _("Enable Chart Quilting"));
181 boxDisp->Add(pCDOQuilting, verticalInputFlags);
182 pCDOQuilting->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
183 wxCommandEventHandler(CanvasOptions::OnOptionChange),
184 NULL, this);
185
186 pSDisplayGrid =
187 new wxCheckBox(pDisplayPanel, IDCO_CHECK_DISPLAYGRID, _("Show Grid"));
188 boxDisp->Add(pSDisplayGrid, verticalInputFlags);
189 pSDisplayGrid->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
190 wxCommandEventHandler(CanvasOptions::OnOptionChange),
191 NULL, this);
192
193 pCDOOutlines = new wxCheckBox(pDisplayPanel, IDCO_OUTLINECHECKBOX1,
194 _("Show Chart Outlines"));
195 boxDisp->Add(pCDOOutlines, verticalInputFlags);
196 pCDOOutlines->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
197 wxCommandEventHandler(CanvasOptions::OnOptionChange),
198 NULL, this);
199
200 pSDepthUnits = new wxCheckBox(pDisplayPanel, IDCO_SHOWDEPTHUNITSBOX1,
201 _("Show Depth Units"));
202 boxDisp->Add(pSDepthUnits, verticalInputFlags);
203 pSDepthUnits->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
204 wxCommandEventHandler(CanvasOptions::OnOptionChange),
205 NULL, this);
206
207 // AIS Options
208 wxStaticBoxSizer* boxAIS = new wxStaticBoxSizer(
209 new wxStaticBox(pDisplayPanel, wxID_ANY, _("AIS")), wxVERTICAL);
210 generalSizer->Add(boxAIS, 0, wxALL | wxEXPAND, border_size);
211
212 pCBShowAIS = new wxCheckBox(pDisplayPanel, IDCO_SHOW_AIS_CHECKBOX,
213 _("Show AIS targets"));
214 boxAIS->Add(pCBShowAIS, verticalInputFlags);
215 pCBShowAIS->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
216 wxCommandEventHandler(CanvasOptions::OnOptionChange),
217 NULL, this);
218
219 pCBAttenAIS = new wxCheckBox(pDisplayPanel, IDCO_ATTEN_AIS_CHECKBOX,
220 _("Minimize less critical targets"));
221 boxAIS->Add(pCBAttenAIS, verticalInputFlags);
222 pCBAttenAIS->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
223 wxCommandEventHandler(CanvasOptions::OnOptionChange),
224 NULL, this);
225
226 // spacer
227 generalSizer->Add(0, interGroupSpace);
228
229 // Tide/Current Options
230 wxStaticBoxSizer* boxTC = new wxStaticBoxSizer(
231 new wxStaticBox(pDisplayPanel, wxID_ANY, _("Tides and Currents")),
232 wxVERTICAL);
233 generalSizer->Add(boxTC, 0, wxALL | wxEXPAND, border_size);
234
235 pCDOTides = new wxCheckBox(pDisplayPanel, IDCO_TIDES_CHECKBOX,
236 _("Show Tide stations"));
237 boxTC->Add(pCDOTides, verticalInputFlags);
238 pCDOTides->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
239 wxCommandEventHandler(CanvasOptions::OnOptionChange), NULL,
240 this);
241
242 pCDOCurrents =
243 new wxCheckBox(pDisplayPanel, IDCO_CURRENTS_CHECKBOX, _("Show Currents"));
244 boxTC->Add(pCDOCurrents, verticalInputFlags);
245 pCDOCurrents->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
246 wxCommandEventHandler(CanvasOptions::OnOptionChange),
247 NULL, this);
248
249 // spacer
250 generalSizer->Add(0, interGroupSpace);
251
252 // ENC Options
253 wxStaticBoxSizer* boxENC = new wxStaticBoxSizer(
254 new wxStaticBox(pDisplayPanel, wxID_ANY, _("Vector Charts")), wxVERTICAL);
255 generalSizer->Add(boxENC, 0, wxALL | wxEXPAND, border_size);
256
257 pCDOENCText =
258 new wxCheckBox(pDisplayPanel, IDCO_ENCTEXT_CHECKBOX1, _("Show text"));
259 boxENC->Add(pCDOENCText, verticalInputFlags);
260 pCDOENCText->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
261 wxCommandEventHandler(CanvasOptions::OnOptionChange),
262 NULL, this);
263
264 pCBENCDepth =
265 new wxCheckBox(pDisplayPanel, IDCO_ENCDEPTH_CHECKBOX1, _("Show depths"));
266 boxENC->Add(pCBENCDepth, verticalInputFlags);
267 pCBENCDepth->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
268 wxCommandEventHandler(CanvasOptions::OnOptionChange),
269 NULL, this);
270
271 pCBENCBuoyLabels = new wxCheckBox(pDisplayPanel, IDCO_ENCBUOYLABEL_CHECKBOX1,
272 _("Buoy/Light Labels"));
273 boxENC->Add(pCBENCBuoyLabels, verticalInputFlags);
274 pCBENCBuoyLabels->Connect(
275 wxEVT_COMMAND_CHECKBOX_CLICKED,
276 wxCommandEventHandler(CanvasOptions::OnOptionChange), NULL, this);
277
278 pCBENCLights =
279 new wxCheckBox(pDisplayPanel, IDCO_ENCBUOYLABEL_CHECKBOX1, _("Lights"));
280 boxENC->Add(pCBENCLights, verticalInputFlags);
281 pCBENCLights->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
282 wxCommandEventHandler(CanvasOptions::OnOptionChange),
283 NULL, this);
284
285 pCBENCLightDesc = new wxCheckBox(pDisplayPanel, IDCO_ENCBUOY_CHECKBOX1,
286 _("Light Descriptions"));
287 boxENC->Add(pCBENCLightDesc, verticalInputFlags);
288 pCBENCLightDesc->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
289 wxCommandEventHandler(CanvasOptions::OnOptionChange),
290 NULL, this);
291
292 pCBENCAnchorDetails = new wxCheckBox(pDisplayPanel, IDCO_ENCANCHOR_CHECKBOX1,
293 _("Anchoring Info"));
294 boxENC->Add(pCBENCAnchorDetails, verticalInputFlags);
295 pCBENCAnchorDetails->Connect(
296 wxEVT_COMMAND_CHECKBOX_CLICKED,
297 wxCommandEventHandler(CanvasOptions::OnOptionChange), NULL, this);
298
299 pCBENCVisibleSectors =
300 new wxCheckBox(pDisplayPanel, IDCO_ENCVISIBLESECTORS_CHECKBOX1,
301 _("Show visible sector lights"));
302 boxENC->Add(pCBENCVisibleSectors, verticalInputFlags);
303 pCBENCVisibleSectors->Connect(
304 wxEVT_COMMAND_CHECKBOX_CLICKED,
305 wxCommandEventHandler(CanvasOptions::OnOptionChange), NULL, this);
306
307 pCBENCDataQuality =
308 new wxCheckBox(pDisplayPanel, IDCO_ENCDATAQUALITY_CHECKBOX,
309 _("Show chart data quality"));
310 boxENC->Add(pCBENCDataQuality, verticalInputFlags);
311 pCBENCDataQuality->Connect(
312 wxEVT_COMMAND_CHECKBOX_CLICKED,
313 wxCommandEventHandler(CanvasOptions::OnOptionChange), NULL, this);
314
315 // spacer
316 boxENC->Add(0, interGroupSpace);
317
318 // display category
319 boxENC->Add(new wxStaticText(pDisplayPanel, wxID_ANY, _("Display Category")),
320 verticalInputFlags);
321 wxString pDispCatStrings[] = {_("Base"), _("Standard"), _("All"),
322 _("User Standard")};
323 m_pDispCat = new wxChoice(pDisplayPanel, ID_CODISPCAT, wxDefaultPosition,
324 wxDefaultSize, 4, pDispCatStrings);
325 boxENC->Add(m_pDispCat, 0, wxALIGN_CENTER_HORIZONTAL, 0);
326 m_pDispCat->Connect(wxEVT_COMMAND_CHOICE_SELECTED,
327 wxCommandEventHandler(CanvasOptions::OnOptionChange),
328 NULL, this);
329
330#ifdef __ANDROID__
331 GetHandle()->setStyleSheet(getAdjustedDialogStyleSheet());
332#endif
333
334 RefreshControlValues();
335
336 SetAutoLayout(true);
337
338 topsizer->Fit(this);
339}
340
341void CanvasOptions::OnEraseBackground(wxEraseEvent& event) {}
342
343void CanvasOptions::OnClose(wxCloseEvent& event) {
344 // SetReturnCode(wxID_CANCEL);
345 // EndModal( wxID_CANCEL );
346}
347
348void CanvasOptions::OnOptionChange(wxCommandEvent& event) {
349 UpdateCanvasOptions();
350}
351
352void CanvasOptions::RefreshControlValues(void) {
353 auto parentCanvas = dynamic_cast<ChartCanvas*>(m_parent);
354 ;
355 if (!parentCanvas) return;
356
357 m_bmode_change_while_hidden = !wxWindow::IsShown();
358
359 // Control options
360 // pCBToolbar->SetValue(parentCanvas->GetToolbarEnable());
361
362 // Navigation Mode
363 int mode = parentCanvas->GetUpMode();
364 if (mode == NORTH_UP_MODE)
365 pCBNorthUp->SetValue(true);
366 else if (mode == COURSE_UP_MODE)
367 pCBCourseUp->SetValue(true);
368 else
369 pCBHeadUp->SetValue(true);
370
371 pCBLookAhead->SetValue(parentCanvas->GetLookahead());
372
373 // Display options
374 pCDOQuilting->SetValue(parentCanvas->GetQuiltMode());
375 pSDisplayGrid->SetValue(parentCanvas->GetShowGrid());
376 pCDOOutlines->SetValue(parentCanvas->GetShowOutlines());
377 pSDepthUnits->SetValue(parentCanvas->GetShowDepthUnits());
378
379 // AIS Options
380 pCBShowAIS->SetValue(parentCanvas->GetShowAIS());
381 pCBAttenAIS->SetValue(parentCanvas->GetAttenAIS());
382
383 // Tide/Current
384 pCDOTides->SetValue(parentCanvas->GetbShowTide());
385 pCDOCurrents->SetValue(parentCanvas->GetbShowCurrent());
386 ;
387
388 // ENC Options
389 pCDOENCText->SetValue(parentCanvas->GetShowENCText());
390 pCBENCDepth->SetValue(parentCanvas->GetShowENCDepth());
391 pCBENCLightDesc->SetValue(parentCanvas->GetShowENCLightDesc());
392 pCBENCBuoyLabels->SetValue(parentCanvas->GetShowENCBuoyLabels());
393 pCBENCLights->SetValue(parentCanvas->GetShowENCLights());
394 pCBENCAnchorDetails->SetValue(parentCanvas->GetShowENCAnchor());
395 pCBENCVisibleSectors->SetValue(parentCanvas->GetShowVisibleSectors());
396 pCBENCDataQuality->SetValue(parentCanvas->GetShowENCDataQual());
397
398 // pCBENCLightDesc->Enable(parentCanvas->GetShowENCLights());
399
400 // Display category
401 int nset = 2; // default OTHER
402 switch (parentCanvas->GetENCDisplayCategory()) {
403 case (DISPLAYBASE):
404 nset = 0;
405 break;
406 case (STANDARD):
407 nset = 1;
408 break;
409 case (OTHER):
410 nset = 2;
411 break;
412 case (MARINERS_STANDARD):
413 nset = 3;
414 break;
415 default:
416 nset = 3;
417 break;
418 }
419 m_pDispCat->SetSelection(nset);
420
421 // If no ENCs are available in the current canvas group, then disable the ENC
422 // related options.
423 pCDOENCText->Enable(m_ENCAvail);
424 pCBENCDepth->Enable(m_ENCAvail);
425 pCBENCLightDesc->Enable(m_ENCAvail && parentCanvas->GetShowENCLights());
426 pCBENCBuoyLabels->Enable(m_ENCAvail);
427 pCBENCLights->Enable(m_ENCAvail);
428 pCBENCVisibleSectors->Enable(m_ENCAvail);
429
430 // Anchor conditions and dateQuality are only available if display category
431 // is "All" or "User Standard"
432 pCBENCDataQuality->Enable(m_ENCAvail && (nset > 1));
433 pCBENCAnchorDetails->Enable(m_ENCAvail && (nset > 1));
434
435 // Many options are not valid if display category is "Base"
436 if (nset == 0) {
437 pCDOENCText->Disable();
438 pCBENCDepth->Disable();
439 pCBENCLightDesc->Disable();
440 pCBENCBuoyLabels->Disable();
441 pCBENCLights->Disable();
442 pCBENCVisibleSectors->Disable();
443 pCBENCDataQuality->Disable();
444 }
445
446 m_pDispCat->Enable(m_ENCAvail);
447
448 // All NAVAID text options are gated by global "Show Text"
449 pCBENCLightDesc->Enable(pCDOENCText->GetValue());
450 pCBENCBuoyLabels->Enable(pCDOENCText->GetValue());
451}
452
453void CanvasOptions::SetENCAvailable(bool avail) {
454 m_ENCAvail = avail;
455 RefreshControlValues();
456}
457
458void CanvasOptions::UpdateCanvasOptions(void) {
459 auto parentCanvas = dynamic_cast<ChartCanvas*>(m_parent);
460 if (!parentCanvas) return;
461
462 bool b_needRefresh = false;
463 bool b_needReLoad = false;
464
465 // if(pCBToolbar->GetValue() != parentCanvas->GetToolbarEnable()){
466 // parentCanvas->SetToolbarEnable( pCBToolbar->GetValue() );
467 // b_needRefresh = true;
468 // }
469
470 if (pCDOQuilting->GetValue() != parentCanvas->GetQuiltMode()) {
471 parentCanvas->ToggleCanvasQuiltMode();
472 }
473
474 if (pSDisplayGrid->GetValue() != parentCanvas->GetShowGrid()) {
475 parentCanvas->SetShowGrid(pSDisplayGrid->GetValue());
476 b_needRefresh = true;
477 }
478
479 if (pCDOOutlines->GetValue() != parentCanvas->GetShowOutlines()) {
480 parentCanvas->SetShowOutlines(pCDOOutlines->GetValue());
481 b_needRefresh = true;
482 }
483 if (pSDepthUnits->GetValue() != parentCanvas->GetShowDepthUnits()) {
484 parentCanvas->SetShowDepthUnits(pSDepthUnits->GetValue());
485 b_needRefresh = true;
486 }
487
488 if (pCBShowAIS->GetValue() != parentCanvas->GetShowAIS()) {
489 parentCanvas->SetShowAIS(pCBShowAIS->GetValue());
490 b_needRefresh = true;
491 }
492
493 if (pCBAttenAIS->GetValue() != parentCanvas->GetAttenAIS()) {
494 parentCanvas->SetAttenAIS(pCBAttenAIS->GetValue());
495 b_needRefresh = true;
496 }
497
498 if (pCDOTides->GetValue() != parentCanvas->GetbShowTide()) {
499 parentCanvas->ShowTides(pCDOTides->GetValue());
500 b_needRefresh = true;
501 }
502 if (pCDOCurrents->GetValue() != parentCanvas->GetbShowCurrent()) {
503 parentCanvas->ShowCurrents(pCDOCurrents->GetValue());
504 b_needRefresh = true;
505 }
506
507 // ENC Options
508 if (pCDOENCText->GetValue() != parentCanvas->GetShowENCText()) {
509 parentCanvas->SetShowENCText(pCDOENCText->GetValue());
510 b_needReLoad = true;
511 }
512
513 if (pCBENCDepth->GetValue() != parentCanvas->GetShowENCDepth()) {
514 parentCanvas->SetShowENCDepth(pCBENCDepth->GetValue());
515 b_needReLoad = true;
516 }
517
518 if (pCBENCLightDesc->GetValue() != parentCanvas->GetShowENCLightDesc()) {
519 parentCanvas->SetShowENCLightDesc(pCBENCLightDesc->GetValue());
520 b_needReLoad = true;
521 }
522
523 if (pCBENCBuoyLabels->GetValue() != parentCanvas->GetShowENCBuoyLabels()) {
524 parentCanvas->SetShowENCBuoyLabels(pCBENCBuoyLabels->GetValue());
525 b_needReLoad = true;
526 }
527
528 if (pCBENCLights->GetValue() != parentCanvas->GetShowENCLights()) {
529 parentCanvas->SetShowENCLights(pCBENCLights->GetValue());
530 b_needReLoad = true;
531 }
532
533 if (pCBENCAnchorDetails->GetValue() != parentCanvas->GetShowENCAnchor()) {
534 parentCanvas->SetShowENCAnchor(pCBENCAnchorDetails->GetValue());
535 b_needReLoad = true;
536 }
537
538 if (pCBENCVisibleSectors->GetValue() !=
539 parentCanvas->GetShowVisibleSectors()) {
540 parentCanvas->SetShowVisibleSectors(pCBENCVisibleSectors->GetValue());
541 b_needReLoad = true;
542 }
543
544 if (pCBENCDataQuality->GetValue() != parentCanvas->GetShowENCDataQual()) {
545 parentCanvas->SetShowENCDataQual(pCBENCDataQuality->GetValue());
546 b_needReLoad = true;
547 }
548
549 // If pCBENCDataQuality is true, Force PLIB "Chart Information Objects" true.
550 if (pCBENCDataQuality->GetValue()) {
551 if (ps52plib) ps52plib->m_bShowMeta = true;
552 parentCanvas->UpdateCanvasS52PLIBConfig();
553 }
554
555 if (!m_bmode_change_while_hidden) {
556 int newMode = NORTH_UP_MODE;
557 if (pCBCourseUp->GetValue())
558 newMode = COURSE_UP_MODE;
559 else if (pCBHeadUp->GetValue())
560 newMode = HEAD_UP_MODE;
561
562 if (newMode != parentCanvas->GetUpMode()) {
563 parentCanvas->SetUpMode(newMode);
564 b_needReLoad = true;
565 }
566 }
567
568 if (pCBLookAhead->GetValue() != parentCanvas->GetLookahead()) {
569 parentCanvas->ToggleLookahead();
570 parentCanvas->UpdateFollowButtonState();
571 b_needReLoad = true;
572 }
573
574 int nset = 2;
575 switch (parentCanvas->GetENCDisplayCategory()) {
576 case (DISPLAYBASE):
577 nset = 0;
578 break;
579 case (STANDARD):
580 nset = 1;
581 break;
582 case (OTHER):
583 nset = 2;
584 break;
585 case (MARINERS_STANDARD):
586 nset = 3;
587 break;
588 default:
589 nset = 2;
590 break;
591 }
592
593 if (m_pDispCat->GetSelection() != nset) {
594 int valSet = STANDARD;
595 int newSet = m_pDispCat->GetSelection();
596 switch (newSet) {
597 case 0:
598 valSet = DISPLAYBASE;
599 break;
600 case 1:
601 valSet = STANDARD;
602 break;
603 case 2:
604 valSet = OTHER;
605 break;
606 case 3:
607 valSet = MARINERS_STANDARD;
608 break;
609 default:
610 valSet = STANDARD;
611 break;
612 }
613 parentCanvas->SetENCDisplayCategory(valSet);
614 b_needReLoad = true;
615
616 // Anchor conditions are only available if display category is "All" or
617 // "User Standard"
618 pCBENCAnchorDetails->Enable(newSet > 1);
619 }
620
621 if (b_needReLoad) {
622 parentCanvas->ReloadVP();
623 } else if (b_needRefresh) {
624 parentCanvas->Refresh(true);
625 parentCanvas->InvalidateGL();
626 }
627
628 RefreshControlValues();
629}
Class CanvasOptions and helpers – Canvas options Window/Dialog.
@ IDCO_QUILTCHECKBOX1
ID for checkbox to enable chart quilting.
@ IDCO_ENCTEXT_CHECKBOX1
ID for checkbox to show ENC (Electronic Navigational Chart) text.
@ IDCO_CURRENTS_CHECKBOX
ID for checkbox to show currents.
@ IDCO_ENCVISIBLESECTORS_CHECKBOX1
ID for checkbox to show ENC visible light sectors.
@ IDCO_SHOW_AIS_CHECKBOX
ID for checkbox to show AIS (Automatic Identification System) targets.
@ ID_CODISPCAT
ID for control to set ENC display category.
@ IDCO_ENCDEPTH_CHECKBOX1
ID for checkbox to show ENC depths.
@ IDCO_TIDES_CHECKBOX
ID for checkbox to show tides.
@ IDCO_OUTLINECHECKBOX1
ID for checkbox to show chart outlines.
@ IDCO_ATTEN_AIS_CHECKBOX
ID for checkbox to attenuate AIS targets.
@ IDCO_ENCDATAQUALITY_CHECKBOX
ID for checkbox to show ENC data quality indicators.
@ IDCO_ENCBUOYLABEL_CHECKBOX1
ID for checkbox to show ENC buoy labels.
@ IDCO_HEADUPCHECKBOX
ID for checkbox to set head-up orientation.
@ IDCO_ENCBUOY_CHECKBOX1
ID for checkbox to show ENC buoys.
@ IDCO_ENCANCHOR_CHECKBOX1
ID for checkbox to show ENC anchor details.
@ IDCO_CHECK_LOOKAHEAD
ID for checkbox to enable look-ahead mode.
@ IDCO_COURSEUPCHECKBOX
ID for checkbox to set course-up orientation.
@ IDCO_CHECK_DISPLAYGRID
ID for checkbox to display grid.
@ IDCO_SHOWDEPTHUNITSBOX1
ID for checkbox to show depth units.
Generic Chart canvas base.
Represents the Canvas Options dialog.
ChartCanvas - Main chart display and interaction component.
Definition chcanv.h:151
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
Definition gui_lib.cpp:56
General purpose GUI support.