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