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