OpenCPN Partial API docs
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 //------------------------------------------------------------------------------
52 extern s52plib *ps52plib;
53 
54 // Helper utilities
55 
56 // Helper classes
57 
58 //------------------------------------------------------------------------------
59 // CanvasOptions
60 //------------------------------------------------------------------------------
61 
62 BEGIN_EVENT_TABLE(CanvasOptions, wxDialog)
63 EVT_CLOSE(CanvasOptions::OnClose)
64 // EVT_CHECKBOX(ID_QUILTCHECKBOX1, CanvasOptions::OnOptionChange)
65 END_EVENT_TABLE()
66 
67 CanvasOptions::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 
346 void CanvasOptions::OnEraseBackground(wxEraseEvent& event) {}
347 
348 void CanvasOptions::OnClose(wxCloseEvent& event) {
349  // SetReturnCode(wxID_CANCEL);
350  // EndModal( wxID_CANCEL );
351 }
352 
353 void CanvasOptions::OnOptionChange(wxCommandEvent& event) {
354  UpdateCanvasOptions();
355 }
356 
357 void CanvasOptions::RefreshControlValues(void) {
358  ChartCanvas* parentCanvas = wxDynamicCast(m_parent, ChartCanvas);
359  if (!parentCanvas) return;
360 
361  // Control options
362  // pCBToolbar->SetValue(parentCanvas->GetToolbarEnable());
363 
364  // Navigation Mode
365  int mode = parentCanvas->GetUpMode();
366  if (mode == NORTH_UP_MODE)
367  pCBNorthUp->SetValue(true);
368  else if (mode == COURSE_UP_MODE)
369  pCBCourseUp->SetValue(true);
370  else
371  pCBHeadUp->SetValue(true);
372 
373  pCBLookAhead->SetValue(parentCanvas->GetLookahead());
374 
375  // Display options
376  pCDOQuilting->SetValue(parentCanvas->GetQuiltMode());
377  pSDisplayGrid->SetValue(parentCanvas->GetShowGrid());
378  pCDOOutlines->SetValue(parentCanvas->GetShowOutlines());
379  pSDepthUnits->SetValue(parentCanvas->GetShowDepthUnits());
380 
381  // AIS Options
382  pCBShowAIS->SetValue(parentCanvas->GetShowAIS());
383  pCBAttenAIS->SetValue(parentCanvas->GetAttenAIS());
384 
385  // Tide/Current
386  pCDOTides->SetValue(parentCanvas->GetbShowTide());
387  pCDOCurrents->SetValue(parentCanvas->GetbShowCurrent());
388  ;
389 
390  // ENC Options
391  pCDOENCText->SetValue(parentCanvas->GetShowENCText());
392  pCBENCDepth->SetValue(parentCanvas->GetShowENCDepth());
393  pCBENCLightDesc->SetValue(parentCanvas->GetShowENCLightDesc());
394  pCBENCBuoyLabels->SetValue(parentCanvas->GetShowENCBuoyLabels());
395  pCBENCLights->SetValue(parentCanvas->GetShowENCLights());
396  pCBENCAnchorDetails->SetValue(parentCanvas->GetShowENCAnchor());
397  pCBENCVisibleSectors->SetValue(parentCanvas->GetShowVisibleSectors());
398  pCBENCDataQuality->SetValue(parentCanvas->GetShowENCDataQual());
399 
400  // pCBENCLightDesc->Enable(parentCanvas->GetShowENCLights());
401 
402  // Display category
403  int nset = 2; // default OTHER
404  switch (parentCanvas->GetENCDisplayCategory()) {
405  case (DISPLAYBASE):
406  nset = 0;
407  break;
408  case (STANDARD):
409  nset = 1;
410  break;
411  case (OTHER):
412  nset = 2;
413  break;
414  case (MARINERS_STANDARD):
415  nset = 3;
416  break;
417  default:
418  nset = 3;
419  break;
420  }
421  m_pDispCat->SetSelection(nset);
422 
423  // If no ENCs are available in the current canvas group, then disable the ENC
424  // related options.
425  pCDOENCText->Enable(m_ENCAvail);
426  pCBENCDepth->Enable(m_ENCAvail);
427  pCBENCLightDesc->Enable(m_ENCAvail && parentCanvas->GetShowENCLights());
428  pCBENCBuoyLabels->Enable(m_ENCAvail);
429  pCBENCLights->Enable(m_ENCAvail);
430  pCBENCVisibleSectors->Enable(m_ENCAvail);
431 
432  // Anchor conditions and dateQuality are only available if display category
433  // is "All" or "User Standard"
434  pCBENCDataQuality->Enable(m_ENCAvail && (nset > 1));
435  pCBENCAnchorDetails->Enable(m_ENCAvail && (nset > 1));
436 
437  // Many options are not valid if display category is "Base"
438  if (nset == 0) {
439  pCDOENCText->Disable();
440  pCBENCDepth->Disable();
441  pCBENCLightDesc->Disable();
442  pCBENCBuoyLabels->Disable();
443  pCBENCLights->Disable();
444  pCBENCVisibleSectors->Disable();
445  pCBENCDataQuality->Disable();
446  }
447 
448  m_pDispCat->Enable(m_ENCAvail);
449 
450  // All NAVAID text options are gated by global "Show Text"
451  pCBENCLightDesc->Enable(pCDOENCText->GetValue());
452  pCBENCBuoyLabels->Enable(pCDOENCText->GetValue());
453 
454 }
455 
456 void CanvasOptions::SetENCAvailable(bool avail) {
457  m_ENCAvail = avail;
458  RefreshControlValues();
459 }
460 
461 void CanvasOptions::UpdateCanvasOptions(void) {
462  ChartCanvas* parentCanvas = wxDynamicCast(m_parent, ChartCanvas);
463  if (!parentCanvas) return;
464 
465  bool b_needRefresh = false;
466  bool b_needReLoad = false;
467 
468  // if(pCBToolbar->GetValue() != parentCanvas->GetToolbarEnable()){
469  // parentCanvas->SetToolbarEnable( pCBToolbar->GetValue() );
470  // b_needRefresh = true;
471  // }
472 
473  if (pCDOQuilting->GetValue() != parentCanvas->GetQuiltMode()) {
474  parentCanvas->ToggleCanvasQuiltMode();
475  }
476 
477  if (pSDisplayGrid->GetValue() != parentCanvas->GetShowGrid()) {
478  parentCanvas->SetShowGrid(pSDisplayGrid->GetValue());
479  b_needRefresh = true;
480  }
481 
482  if (pCDOOutlines->GetValue() != parentCanvas->GetShowOutlines()) {
483  parentCanvas->SetShowOutlines(pCDOOutlines->GetValue());
484  b_needRefresh = true;
485  }
486  if (pSDepthUnits->GetValue() != parentCanvas->GetShowDepthUnits()) {
487  parentCanvas->SetShowDepthUnits(pSDepthUnits->GetValue());
488  b_needRefresh = true;
489  }
490 
491  if (pCBShowAIS->GetValue() != parentCanvas->GetShowAIS()) {
492  parentCanvas->SetShowAIS(pCBShowAIS->GetValue());
493  b_needRefresh = true;
494  }
495 
496  if (pCBAttenAIS->GetValue() != parentCanvas->GetAttenAIS()) {
497  parentCanvas->SetAttenAIS(pCBAttenAIS->GetValue());
498  b_needRefresh = true;
499  }
500 
501  if (pCDOTides->GetValue() != parentCanvas->GetbShowTide()) {
502  parentCanvas->ShowTides(pCDOTides->GetValue());
503  b_needRefresh = true;
504  }
505  if (pCDOCurrents->GetValue() != parentCanvas->GetbShowCurrent()) {
506  parentCanvas->ShowCurrents(pCDOCurrents->GetValue());
507  b_needRefresh = true;
508  }
509 
510  // ENC Options
511  if (pCDOENCText->GetValue() != parentCanvas->GetShowENCText()) {
512  parentCanvas->SetShowENCText(pCDOENCText->GetValue());
513  b_needReLoad = true;
514  }
515 
516  if (pCBENCDepth->GetValue() != parentCanvas->GetShowENCDepth()) {
517  parentCanvas->SetShowENCDepth(pCBENCDepth->GetValue());
518  b_needReLoad = true;
519  }
520 
521  if (pCBENCLightDesc->GetValue() != parentCanvas->GetShowENCLightDesc()) {
522  parentCanvas->SetShowENCLightDesc(pCBENCLightDesc->GetValue());
523  b_needReLoad = true;
524  }
525 
526  if (pCBENCBuoyLabels->GetValue() != parentCanvas->GetShowENCBuoyLabels()) {
527  parentCanvas->SetShowENCBuoyLabels(pCBENCBuoyLabels->GetValue());
528  b_needReLoad = true;
529  }
530 
531  if (pCBENCLights->GetValue() != parentCanvas->GetShowENCLights()) {
532  parentCanvas->SetShowENCLights(pCBENCLights->GetValue());
533  b_needReLoad = true;
534  }
535 
536  if (pCBENCAnchorDetails->GetValue() != parentCanvas->GetShowENCAnchor()) {
537  parentCanvas->SetShowENCAnchor(pCBENCAnchorDetails->GetValue());
538  b_needReLoad = true;
539  }
540 
541  if (pCBENCVisibleSectors->GetValue() !=
542  parentCanvas->GetShowVisibleSectors()) {
543  parentCanvas->SetShowVisibleSectors(pCBENCVisibleSectors->GetValue());
544  b_needReLoad = true;
545  }
546 
547  if (pCBENCDataQuality->GetValue() !=
548  parentCanvas->GetShowENCDataQual()) {
549  parentCanvas->SetShowENCDataQual(pCBENCDataQuality->GetValue());
550  b_needReLoad = true;
551  }
552 
553  // If pCBENCDataQuality is true, Force PLIB "Chart Information Objects" true.
554  if (pCBENCDataQuality->GetValue()){
555  if (ps52plib)
556  ps52plib->m_bShowMeta = true;
557  parentCanvas->UpdateCanvasS52PLIBConfig();
558  }
559 
560  int newMode = NORTH_UP_MODE;
561  if (pCBCourseUp->GetValue())
562  newMode = COURSE_UP_MODE;
563  else if (pCBHeadUp->GetValue())
564  newMode = HEAD_UP_MODE;
565 
566  if (newMode != parentCanvas->GetUpMode()) {
567  parentCanvas->SetUpMode(newMode);
568  b_needReLoad = true;
569  }
570 
571  if (pCBLookAhead->GetValue() != parentCanvas->GetLookahead()) {
572  parentCanvas->ToggleLookahead();
573  parentCanvas->UpdateFollowButtonState();
574  b_needReLoad = true;
575  }
576 
577  int nset = 2;
578  switch (parentCanvas->GetENCDisplayCategory()) {
579  case (DISPLAYBASE):
580  nset = 0;
581  break;
582  case (STANDARD):
583  nset = 1;
584  break;
585  case (OTHER):
586  nset = 2;
587  break;
588  case (MARINERS_STANDARD):
589  nset = 3;
590  break;
591  default:
592  nset = 2;
593  break;
594  }
595 
596  if (m_pDispCat->GetSelection() != nset) {
597  int valSet = STANDARD;
598  int newSet = m_pDispCat->GetSelection();
599  switch (newSet) {
600  case 0:
601  valSet = DISPLAYBASE;
602  break;
603  case 1:
604  valSet = STANDARD;
605  break;
606  case 2:
607  valSet = OTHER;
608  break;
609  case 3:
610  valSet = MARINERS_STANDARD;
611  break;
612  default:
613  valSet = STANDARD;
614  break;
615  }
616  parentCanvas->SetENCDisplayCategory(valSet);
617  b_needReLoad = true;
618 
619  // Anchor conditions are only available if display category is "All" or
620  // "User Standard"
621  pCBENCAnchorDetails->Enable(newSet > 1);
622  }
623 
624  if (b_needReLoad) {
625  parentCanvas->ReloadVP();
626  } else if (b_needRefresh) {
627  parentCanvas->Refresh(true);
628  parentCanvas->InvalidateGL();
629  }
630 
631  RefreshControlValues();
632 }
General purpose GUI support.