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