OpenCPN Partial API docs
Loading...
Searching...
No Matches
config_mgr.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#ifdef __MINGW32__
25#undef IPV6STRICT // mingw FTBS fix: missing struct ip_mreq
26#include <windows.h>
27#endif
28
29#include <algorithm>
30#include <list>
31#include <locale>
32#include <stdlib.h>
33
34#include <time.h>
35
36#include <wx/colour.h>
37#include <wx/fileconf.h>
38#include <wx/filename.h>
39#include <wx/log.h>
40#include <wx/statline.h>
41#include <wx/string.h>
42
43#include "model/ais_decoder.h"
45#include "model/config_vars.h"
46#include "model/gui_vars.h"
47#include "model/georef.h"
48#include "model/multiplexer.h"
49#include "model/route_point.h"
50
51#include "ais.h"
52#include "chartdb.h"
53#include "chcanv.h"
54#include "config_mgr.h"
55#include "FontMgr.h"
56#include "Layer.h"
57#include "navutil.h"
58#include "ocpn_frame.h"
59#include "ocpn_gl_options.h"
60#include "OCPNPlatform.h"
61#include "ocpn_plugin.h"
62#include "RoutePropDlgImpl.h"
63#include "s52plib.h"
64#include "s52utils.h"
65
66extern s52plib *ps52plib; // In a library...
67
68#if !defined(NAN)
69static const long long lNaN = 0xfff8000000000000;
70#define NAN (*(double *)&lNaN)
71#endif
72
73ConfigMgr *ConfigMgr::instance = NULL;
74
75//--------------------------------------------------------------------------
76//
77// Utility functions
78//
79//--------------------------------------------------------------------------
80int GetRandomNumber(int range_min, int range_max) {
81 long u = (long)wxRound(
82 ((double)rand() / ((double)(RAND_MAX) + 1) * (range_max - range_min)) +
83 range_min);
84 return (int)u;
85}
86
87// Helper conditional file name dir slash
88void appendOSDirSlash(wxString *pString);
89
91public:
94
95 OCPNConfigObject(int canvas_config);
96
97 void Init();
98 wxPanel *GetSettingsPanel();
99
100 int m_canvasConfig;
101 wxString m_GUID;
102 wxString templateFileName;
103 wxString m_title;
104 wxString m_description;
105};
106
107OCPNConfigObject::OCPNConfigObject() { Init(); }
108
109OCPNConfigObject::OCPNConfigObject(int canvas_config) {
110 Init();
111 m_canvasConfig = canvas_config;
112}
113
114OCPNConfigObject::~OCPNConfigObject() {}
115
116void OCPNConfigObject::Init() { m_canvasConfig = 0; }
117
118//--------------------------------------------------------------------
119// Private ( XML encoded ) catalog of available configurations
120//--------------------------------------------------------------------
121
123public:
126
127 bool AddConfig(OCPNConfigObject *config, unsigned int flags);
128 bool RemoveConfig(wxString GUID);
129
130 void SetRootConfigNode(void);
131 bool IsOpenCPN();
132 bool SaveFile(const wxString filename);
133 bool LoadFile(const wxString filename);
134
135 pugi::xml_node m_config_root;
136};
137
138OCPNConfigCatalog::OCPNConfigCatalog() : pugi::xml_document() {}
139
140OCPNConfigCatalog::~OCPNConfigCatalog() {}
141
142void OCPNConfigCatalog::SetRootConfigNode(void) {
143 if (!strlen(m_config_root.name())) {
144 m_config_root = append_child("configs");
145 m_config_root.append_attribute("version") = "1.0";
146 m_config_root.append_attribute("creator") = "OpenCPN";
147 m_config_root.append_attribute("xmlns:xsi") =
148 "http://www.w3.org/2001/XMLSchema-instance";
149 m_config_root.append_attribute("xmlns") =
150 "http://www.topografix.com/GPX/1/1";
151 m_config_root.append_attribute("xmlns:gpxx") =
152 "http://www.garmin.com/xmlschemas/GpxExtensions/v3";
153 m_config_root.append_attribute("xsi:schemaLocation") =
154 "http://www.topografix.com/GPX/1/1 "
155 "http://www.topografix.com/GPX/1/1/gpx.xsd";
156 m_config_root.append_attribute("xmlns:opencpn") = "http://www.opencpn.org";
157 }
158}
159
160bool OCPNConfigCatalog::IsOpenCPN() {
161 for (pugi::xml_attribute attr = root().first_child().first_attribute(); attr;
162 attr = attr.next_attribute())
163 if (!strcmp(attr.name(), "creator") && !strcmp(attr.value(), "OpenCPN"))
164 return true;
165 return false;
166}
167
168bool OCPNConfigCatalog::SaveFile(const wxString filename) {
169 save_file(filename.fn_str(), " ");
170 return true;
171}
172
173bool OCPNConfigCatalog::LoadFile(const wxString filename) {
174 load_file(filename.fn_str());
175 m_config_root = this->child("configs");
176 return true;
177}
178
179bool OCPNConfigCatalog::AddConfig(OCPNConfigObject *config,
180 unsigned int flags) {
181 pugi::xml_node node = m_config_root.append_child("config");
182
183 node.append_attribute("GUID") = config->m_GUID.mb_str();
184
185 // Handle non-ASCII characters as UTF8
186 wxCharBuffer abuf = config->m_title.ToUTF8();
187 if (abuf.data())
188 node.append_attribute("title") = abuf.data();
189 else
190 node.append_attribute("title") = "Substitute Title";
191
192 abuf = config->m_description.ToUTF8();
193 if (abuf.data())
194 node.append_attribute("description") = abuf.data();
195 else
196 node.append_attribute("description") = "Substitute Description";
197
198 node.append_attribute("templateFile") = config->templateFileName.mb_str();
199
200 return true;
201}
202
203bool OCPNConfigCatalog::RemoveConfig(wxString GUID) {
204 for (pugi::xml_node child = m_config_root.first_child(); child;) {
205 pugi::xml_node next = child.next_sibling();
206 const char *guid = child.attribute("GUID").value();
207
208 if (!strcmp(guid, GUID.mb_str())) {
209 child.parent().remove_child(child);
210 return true;
211 }
212
213 child = next;
214 }
215
216 return false;
217}
218
219//--------------------------------------------------------------------
220// ConfigPanel implementation
221//--------------------------------------------------------------------
222
223ConfigPanel::ConfigPanel(OCPNConfigObject *config, wxWindow *parent,
224 wxWindowID id, const wxPoint &pos, const wxSize &size)
225 : wxPanel(parent, id, pos, size, wxSIMPLE_BORDER)
226
227{
228 m_config = config;
229 wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
230 SetSizer(mainSizer);
231
232 mainSizer->Add(new wxStaticText(this, wxID_ANY, _("Title")));
233 mainSizer->Add(new wxStaticText(this, wxID_ANY, config->m_title));
234
235 mainSizer->Add(new wxStaticLine(this, wxID_ANY), 0, wxEXPAND | wxALL, 1);
236
237 mainSizer->Add(new wxStaticText(this, wxID_ANY, _("Description")));
238 mainSizer->Add(new wxStaticText(this, wxID_ANY, config->m_description));
239
240 SetMinSize(wxSize(-1, 6 * GetCharHeight()));
241
242 SetBackgroundColour(
243 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW));
244 // Connect(wxEVT_LEFT_DOWN,
245 // wxMouseEventHandler(ConfigPanel::OnConfigPanelMouseSelected), NULL, this);
246}
247
248ConfigPanel::~ConfigPanel() {}
249
250void ConfigPanel::OnConfigPanelMouseSelected(wxMouseEvent &event) {
251 // SetBackgroundColour(*wxRED);
252 // event.Skip();
253}
254
255wxString ConfigPanel::GetConfigGUID() { return m_config->m_GUID; }
256
257//--------------------------------------------------------------------
258// ConfigMgr implementation
259// Singleton Pattern
260//--------------------------------------------------------------------
261
262ConfigMgr &ConfigMgr::Get() {
263 if (!instance) instance = new ConfigMgr;
264 return *instance;
265}
266
267void ConfigMgr::Shutdown() {
268 if (instance) {
269 delete instance;
270 instance = NULL;
271 }
272}
273
274ConfigMgr::ConfigMgr() {
275 Init();
276
277 // Load any existing configs from the catalog
278 LoadCatalog();
279}
280
281ConfigMgr::~ConfigMgr() {
282 configList->clear();
283 delete configList;
284}
285
286void ConfigMgr::Init() {
287 m_configDir = g_Platform->GetPrivateDataDir();
288 appendOSDirSlash(&m_configDir);
289 m_configDir.append("Configs");
290 appendOSDirSlash(&m_configDir);
291 if (!wxFileName::DirExists(m_configDir)) {
292 wxFileName::Mkdir(m_configDir);
293 }
294
295 m_configCatalogName = g_Platform->GetPrivateDataDir();
296 appendOSDirSlash(&m_configCatalogName);
297 m_configCatalogName.append("Configs");
298 appendOSDirSlash(&m_configCatalogName);
299 m_configCatalogName.append("configs.xml");
300
301 // Create the catalog, if necessary
302 if (!wxFileExists(m_configCatalogName)) {
303 wxLogMessage("Creating new Configs catalog: " + m_configCatalogName);
304
306 cat->SetRootConfigNode();
307 cat->SaveFile(m_configCatalogName);
308 delete cat;
309 }
310
311 m_configCatalog = new OCPNConfigCatalog();
312
313 configList = new ConfigObjectList;
314
315 // Add the default "Recovery" template
316 wxString t_title = _("Recovery Template");
317 wxString t_desc =
318 _("Apply this template to return to a known safe configuration");
319 CreateNamedConfig(t_title, t_desc, "11111111-1111-1111-1111-111111111111");
320}
321
322bool ConfigMgr::LoadCatalog() {
323 wxLogMessage("Loading Configs catalog: " + m_configCatalogName);
324 m_configCatalog->LoadFile(m_configCatalogName);
325
326 // Parse the config catalog
327 pugi::xml_node objects = m_configCatalog->child("configs");
328
329 // pugi::xml_node node = m_config_root.append_child("config");
330
331 // node.append_attribute("GUID") = config->m_GUID.mb_str();
332 // node.append_attribute("title") = config->m_title.mb_str();
333 // node.append_attribute("description") = config->m_description.mb_str();
334 // node.append_attribute("templateFile") = config->templateFileName.mb_str();
335
336 for (pugi::xml_node object = objects.first_child(); object;
337 object = object.next_sibling()) {
338 if (!strcmp(object.name(), "config")) {
339 // Check the GUID for duplicates
340 wxString testGUID =
341 wxString::FromUTF8(object.attribute("GUID").as_string());
342
343 bool bFound = false;
344 for (auto it = configList->begin(); it != configList->end(); ++it) {
345 OCPNConfigObject *look = *it;
346 if (look->m_GUID == testGUID) {
347 bFound = true;
348 break;
349 }
350 }
351
352 if (!bFound) {
353 OCPNConfigObject *newConfig = new OCPNConfigObject;
354
355 newConfig->m_GUID =
356 wxString::FromUTF8(object.attribute("GUID").as_string());
357 newConfig->m_title =
358 wxString::FromUTF8(object.attribute("title").as_string());
359 newConfig->m_description =
360 wxString::FromUTF8(object.attribute("description").as_string());
361 newConfig->templateFileName =
362 wxString::FromUTF8(object.attribute("templateFile").as_string());
363
364 // Add to the class list of configs
365 configList->push_back(newConfig);
366 }
367 }
368 }
369
370 return true;
371}
372
373bool ConfigMgr::SaveCatalog() {
374 m_configCatalog->SaveFile(m_configCatalogName);
375
376 return true;
377}
378
379wxString ConfigMgr::CreateNamedConfig(const wxString &title,
380 const wxString &description,
381 wxString UUID) {
382 wxString GUID;
383
384 // Must have title
385 if (title.IsEmpty()) return GUID;
386
387 OCPNConfigObject *pConfig = new OCPNConfigObject;
388
389 // If no UUID is passed, then create a new GUID for this config
390 if (UUID.IsEmpty())
391 GUID = GetUUID();
392 else
393 GUID = UUID;
394
395 pConfig->m_GUID = GUID;
396 pConfig->m_title = title;
397 pConfig->m_description = description;
398
399 if (UUID.IsEmpty()) {
400 // create template file name
401 pConfig->templateFileName = "OCPNTemplate-" + GUID + ".conf";
402
403 // Save the template contents
404 wxString templateFullFileName = GetConfigDir() + pConfig->templateFileName;
405 if (!SaveTemplate(templateFullFileName)) {
406 wxLogMessage("Unable to save template titled: " + title +
407 " as file: " + templateFullFileName);
408 delete pConfig;
409 return "";
410 }
411 }
412
413 // Add this config to the catalog
414 if (!m_configCatalog->AddConfig(pConfig, 0)) {
415 wxLogMessage("Unable to add config to catalog...Title: " + title);
416 delete pConfig;
417 return "";
418 }
419
420 // Add to the class list of configs
421 configList->push_back(pConfig);
422
423 if (UUID.IsEmpty()) SaveCatalog();
424
425 return GUID;
426}
427
428bool ConfigMgr::DeleteConfig(wxString GUID) {
429 OCPNConfigObject *cfg = GetConfig(GUID);
430 if (!cfg) return false;
431
432 // Find and delete the template file
433 wxString templateFullFileName = GetConfigDir() + cfg->templateFileName;
434 if (wxFileExists(templateFullFileName)) wxRemoveFile(templateFullFileName);
435
436 // Remove the config from the catalog
437 bool rv = m_configCatalog->RemoveConfig(GUID);
438
439 if (rv) SaveCatalog();
440
441 // Remove the config from the member list without deleting it
442 auto found = std::find(configList->begin(), configList->end(), cfg);
443 if (found != configList->end()) configList->erase(found);
444
445 return rv;
446}
447
448wxPanel *ConfigMgr::GetConfigPanel(wxWindow *parent, wxString GUID) {
449 wxPanel *retPanel = NULL;
450
451 // Find the GUID-matching config in the member list
452 OCPNConfigObject *config = GetConfig(GUID);
453
454 // Found it?
455 if (config) {
456 retPanel = new ConfigPanel(config, parent);
457 }
458
459 return retPanel;
460}
461
462OCPNConfigObject *ConfigMgr::GetConfig(wxString GUID) {
463 // Find the GUID-matching config in the member list
464 for (auto it = configList->begin(); it != configList->end(); ++it) {
465 OCPNConfigObject *look = *it;
466 if (look->m_GUID == GUID) {
467 return look;
468 break;
469 }
470 }
471 return NULL;
472}
473
474wxString ConfigMgr::GetTemplateTitle(wxString GUID) {
475 for (auto it = configList->begin(); it != configList->end(); ++it) {
476 OCPNConfigObject *look = *it;
477 if (look->m_GUID == GUID) {
478 return look->m_title;
479 break;
480 }
481 }
482 return wxEmptyString;
483}
484
485wxArrayString ConfigMgr::GetConfigGUIDArray() {
486 wxArrayString ret_val;
487
488 for (auto it = configList->begin(); it != configList->end(); ++it) {
489 OCPNConfigObject *look = *it;
490 ret_val.Add(look->m_GUID);
491 }
492 return ret_val;
493}
494
495bool ConfigMgr::ApplyConfigGUID(wxString GUID) {
496 // Find the GUID-matching config in the member list
497 OCPNConfigObject *config = GetConfig(GUID);
498
499 // Found it?
500 if (config) {
501 wxString thisConfig = GetConfigDir() + config->templateFileName;
502
503 // Special case for Recovery template
504 if (GUID.StartsWith("11111111")) {
505 thisConfig =
506 *GetpSharedDataLocation() + "configs/OCPNTemplate-Recovery.conf";
507 }
508
509 MyConfig fconf(thisConfig);
510
511 // Load the template contents, without resetting defaults
512 fconf.LoadMyConfigRaw(true);
513
514 // Load Canvas configs, applying only the "templateable" items
515 fconf.LoadCanvasConfigs(true);
516
517 if (ps52plib && ps52plib->m_bOK) fconf.LoadS57Config();
518
519 return true;
520 }
521
522 return false;
523}
524
525// RFC4122 version 4 compliant random UUIDs generator.
526wxString ConfigMgr::GetUUID(void) {
527 wxString str;
528 struct {
529 int time_low;
530 int time_mid;
531 int time_hi_and_version;
532 int clock_seq_hi_and_rsv;
533 int clock_seq_low;
534 int node_hi;
535 int node_low;
536 } uuid;
537
538 uuid.time_low = GetRandomNumber(
539 0, 2147483647); // FIXME: the max should be set to something like
540 // MAXINT32, but it doesn't compile un gcc...
541 uuid.time_mid = GetRandomNumber(0, 65535);
542 uuid.time_hi_and_version = GetRandomNumber(0, 65535);
543 uuid.clock_seq_hi_and_rsv = GetRandomNumber(0, 255);
544 uuid.clock_seq_low = GetRandomNumber(0, 255);
545 uuid.node_hi = GetRandomNumber(0, 65535);
546 uuid.node_low = GetRandomNumber(0, 2147483647);
547
548 /* Set the two most significant bits (bits 6 and 7) of the
549 * clock_seq_hi_and_rsv to zero and one, respectively. */
550 uuid.clock_seq_hi_and_rsv = (uuid.clock_seq_hi_and_rsv & 0x3F) | 0x80;
551
552 /* Set the four most significant bits (bits 12 through 15) of the
553 * time_hi_and_version field to 4 */
554 uuid.time_hi_and_version = (uuid.time_hi_and_version & 0x0fff) | 0x4000;
555
556 str.Printf("%08x-%04x-%04x-%02x%02x-%04x%08x", uuid.time_low, uuid.time_mid,
557 uuid.time_hi_and_version, uuid.clock_seq_hi_and_rsv,
558 uuid.clock_seq_low, uuid.node_hi, uuid.node_low);
559
560 return str;
561}
562
563bool ConfigMgr::SaveTemplate(wxString fileName) {
564 // Assuming the file exists, and is empty....
565
566 // Create a private wxFileConfig object
567 MyConfig *conf = new MyConfig(fileName);
568
569// Write out all the elements of a config template....
570
571// Temporarily suppress logging of trivial non-fatal wxLogSysError() messages
572// provoked by Android security...
573#ifdef __ANDROID__
574 wxLogNull logNo;
575#endif
576
577 // Global options and settings
578 conf->SetPath(_T ( "/Settings" ));
579
580 conf->Write(_T ( "InlandEcdis" ), g_bInlandEcdis);
581 conf->Write(_T ( "UIexpert" ), g_bUIexpert);
582 conf->Write(_T ( "SpaceDropMark" ), g_bSpaceDropMark);
583
584 conf->Write(_T ( "ShowStatusBar" ), g_bShowStatusBar);
585#ifndef __WXOSX__
586 conf->Write(_T ( "ShowMenuBar" ), g_bShowMenuBar);
587#endif
588 conf->Write(_T ( "DefaultFontSize" ), g_default_font_size);
589
590 conf->Write(_T ( "Fullscreen" ), g_bFullscreen);
591 conf->Write(_T ( "ShowCompassWindow" ), g_bShowCompassWin);
592 conf->Write(_T ( "SetSystemTime" ), s_bSetSystemTime);
593 conf->Write(_T ( "ShowGrid" ), g_bDisplayGrid);
594 conf->Write(_T ( "PlayShipsBells" ), g_bPlayShipsBells);
595 conf->Write(_T ( "SoundDeviceIndex" ), g_iSoundDeviceIndex);
596 conf->Write(_T ( "FullscreenToolbar" ), g_bFullscreenToolbar);
597 // conf->Write( _T ( "TransparentToolbar" ), g_bTransparentToolbar );
598 conf->Write(_T ( "PermanentMOBIcon" ), g_bPermanentMOBIcon);
599 conf->Write(_T ( "ShowLayers" ), g_bShowLayers);
600 conf->Write(_T ( "AutoAnchorDrop" ), g_bAutoAnchorMark);
601 conf->Write(_T ( "ShowChartOutlines" ), g_bShowOutlines);
602 conf->Write(_T ( "ShowActiveRouteTotal" ), g_bShowRouteTotal);
603 conf->Write(_T ( "ShowActiveRouteHighway" ), g_bShowActiveRouteHighway);
604 conf->Write(_T ( "SDMMFormat" ), g_iSDMMFormat);
605 conf->Write(_T ( "ShowChartBar" ), g_bShowChartBar);
606
607 conf->Write(_T ( "GUIScaleFactor" ), g_GUIScaleFactor);
608 conf->Write(_T ( "ChartObjectScaleFactor" ), g_ChartScaleFactor);
609 conf->Write(_T ( "ShipScaleFactor" ), g_ShipScaleFactor);
610
611 conf->Write(_T ( "ShowTrue" ), g_bShowTrue);
612 conf->Write(_T ( "ShowMag" ), g_bShowMag);
613 conf->Write(_T ( "UserMagVariation" ), wxString::Format("%.2f", g_UserVar));
614
615 conf->Write(_T ( "CM93DetailFactor" ), g_cm93_zoom_factor);
616 conf->Write(_T ( "CM93DetailZoomPosX" ), g_detailslider_dialog_x);
617 conf->Write(_T ( "CM93DetailZoomPosY" ), g_detailslider_dialog_y);
618 conf->Write(_T ( "ShowCM93DetailSlider" ), g_bShowDetailSlider);
619
620 conf->Write(_T ( "SkewToNorthUp" ), g_bskew_comp);
621
622 conf->Write(_T ( "ZoomDetailFactor" ), g_chart_zoom_modifier_raster);
623 conf->Write(_T ( "ZoomDetailFactorVector" ), g_chart_zoom_modifier_vector);
624
625 conf->Write(_T ( "SmoothPanZoom" ), g_bsmoothpanzoom);
626
627 conf->Write(_T ( "CourseUpMode" ), g_bCourseUp);
628 if (!g_bInlandEcdis) conf->Write(_T ( "LookAheadMode" ), g_bLookAhead);
629 conf->Write(_T ( "TenHzUpdate" ), g_btenhertz);
630
631 conf->Write(_T ( "COGUPAvgSeconds" ), g_COGAvgSec);
632 conf->Write(_T ( "UseMagAPB" ), g_bMagneticAPB);
633
634 conf->Write(_T ( "OwnshipCOGPredictorMinutes" ), g_ownship_predictor_minutes);
635 conf->Write(_T ( "OwnshipCOGPredictorWidth" ), g_cog_predictor_width);
636 conf->Write(_T ( "OwnshipHDTPredictorMiles" ), g_ownship_HDTpredictor_miles);
637 conf->Write(_T ( "OwnShipIconType" ), g_OwnShipIconType);
638 conf->Write(_T ( "OwnShipLength" ), g_n_ownship_length_meters);
639 conf->Write(_T ( "OwnShipWidth" ), g_n_ownship_beam_meters);
640 conf->Write(_T ( "OwnShipGPSOffsetX" ), g_n_gps_antenna_offset_x);
641 conf->Write(_T ( "OwnShipGPSOffsetY" ), g_n_gps_antenna_offset_y);
642 conf->Write(_T ( "OwnShipMinSize" ), g_n_ownship_min_mm);
643 conf->Write(_T ( "OwnShipSogCogCalc" ), g_own_ship_sog_cog_calc);
644 conf->Write(_T ( "OwnShipSogCogCalcDampSec"),
645 g_own_ship_sog_cog_calc_damp_sec);
646
647 conf->Write(_T ( "RouteArrivalCircleRadius" ),
648 wxString::Format("%.3f", g_n_arrival_circle_radius));
649 conf->Write(_T ( "ChartQuilting" ), g_bQuiltEnable);
650
651 conf->Write(_T ( "StartWithTrackActive" ), g_bTrackCarryOver);
652 conf->Write(_T ( "AutomaticDailyTracks" ), g_bTrackDaily);
653 conf->Write(_T ( "TrackRotateAt" ), g_track_rotate_time);
654 conf->Write(_T ( "TrackRotateTimeType" ), g_track_rotate_time_type);
655 conf->Write(_T ( "HighlightTracks" ), g_bHighliteTracks);
656
657 conf->Write(_T ( "DateTimeFormat" ), g_datetime_format);
658
659 conf->Write(_T ( "InitialStackIndex" ), g_restore_stackindex);
660 conf->Write(_T ( "InitialdBIndex" ), g_restore_dbindex);
661
662 conf->Write(_T ( "AnchorWatch1GUID" ), g_AW1GUID);
663 conf->Write(_T ( "AnchorWatch2GUID" ), g_AW2GUID);
664
665 conf->Write(_T ( "ToolbarX" ), g_maintoolbar_x);
666 conf->Write(_T ( "ToolbarY" ), g_maintoolbar_y);
667 conf->Write(_T ( "ToolbarOrient" ), g_maintoolbar_orient);
668
669 conf->Write(_T ( "iENCToolbarX" ), g_iENCToolbarPosX);
670 conf->Write(_T ( "iENCToolbarY" ), g_iENCToolbarPosY);
671
672 if (!g_bInlandEcdis) {
673 conf->Write(_T ( "GlobalToolbarConfig" ), g_toolbarConfig);
674 conf->Write(_T ( "DistanceFormat" ), g_iDistanceFormat);
675 conf->Write(_T ( "SpeedFormat" ), g_iSpeedFormat);
676 conf->Write(_T ( "WindSpeedFormat" ), g_iWindSpeedFormat);
677 conf->Write(_T ( "ShowDepthUnits" ), g_bShowDepthUnits);
678 }
679
680 conf->Write(_T ( "MobileTouch" ), g_btouch);
681 conf->Write(_T ( "ResponsiveGraphics" ), g_bresponsive);
682
683 conf->Write(_T ( "AutoHideToolbar" ), g_bAutoHideToolbar);
684 conf->Write(_T ( "AutoHideToolbarSecs" ), g_nAutoHideToolbar);
685
686 wxString st0;
687 for (const auto &mm : g_config_display_size_mm) {
688 st0.Append(wxString::Format(_T ( "%zu," ), mm));
689 }
690 st0.RemoveLast(); // Strip last comma
691 conf->Write(_T ( "DisplaySizeMM" ), st0);
692 conf->Write(_T ( "DisplaySizeManual" ), g_config_display_size_manual);
693
694 conf->Write(_T ( "PlanSpeed" ), wxString::Format("%.2f", g_PlanSpeed));
695
696#if 0
697 wxString vis, invis;
698 LayerList::iterator it;
699 int index = 0;
700 for( it = ( *pLayerList ).begin(); it != ( *pLayerList ).end(); ++it, ++index ) {
701 Layer *lay = (Layer *) ( *it );
702 if( lay->IsVisibleOnChart() ) vis += ( lay->m_LayerName ) + ";";
703 else
704 invis += ( lay->m_LayerName ) + ";";
705 }
706 conf->Write( _T ( "VisibleLayers" ), vis );
707 conf->Write( _T ( "InvisibleLayers" ), invis );
708#endif
709
710 conf->Write(_T ( "Locale" ), g_locale);
711 conf->Write(_T ( "LocaleOverride" ), g_localeOverride);
712
713 // LIVE ETA OPTION
714 conf->Write(_T( "LiveETA" ), g_bShowLiveETA);
715 conf->Write(_T( "DefaultBoatSpeed" ), g_defaultBoatSpeed);
716
717 // S57 Object Filter Settings
718 conf->SetPath(_T ( "/Settings/ObjectFilter" ));
719
720 if (ps52plib) {
721 for (unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
722 iPtr++) {
723 OBJLElement *pOLE = (OBJLElement *)(ps52plib->pOBJLArray->Item(iPtr));
724
725 wxString st1(_T ( "viz" ));
726 char name[7];
727 strncpy(name, pOLE->OBJLName, 6);
728 name[6] = 0;
729 st1.Append(wxString(name, wxConvUTF8));
730 conf->Write(st1, pOLE->nViz);
731 }
732 }
733
734 // Global State
735
736 conf->SetPath(_T ( "/Settings/GlobalState" ));
737
738 // Various Options
739 if (!g_bInlandEcdis)
740 conf->Write(_T ( "nColorScheme" ), (int)gFrame->GetColorScheme());
741
742 // AIS
743 conf->SetPath(_T ( "/Settings/AIS" ));
744
745 conf->Write(_T ( "bNoCPAMax" ), g_bCPAMax);
746 conf->Write(_T ( "NoCPAMaxNMi" ), g_CPAMax_NM);
747 conf->Write(_T ( "bCPAWarn" ), g_bCPAWarn);
748 conf->Write(_T ( "CPAWarnNMi" ), g_CPAWarn_NM);
749 conf->Write(_T ( "bTCPAMax" ), g_bTCPA_Max);
750 conf->Write(_T ( "TCPAMaxMinutes" ), g_TCPA_Max);
751 conf->Write(_T ( "bMarkLostTargets" ), g_bMarkLost);
752 conf->Write(_T ( "MarkLost_Minutes" ), g_MarkLost_Mins);
753 conf->Write(_T ( "bRemoveLostTargets" ), g_bRemoveLost);
754 conf->Write(_T ( "RemoveLost_Minutes" ), g_RemoveLost_Mins);
755 conf->Write(_T ( "bShowCOGArrows" ), g_bShowCOG);
756 conf->Write(_T ( "CogArrowMinutes" ), g_ShowCOG_Mins);
757 conf->Write(_T ( "bShowTargetTracks" ), g_bAISShowTracks);
758 conf->Write(_T ( "TargetTracksMinutes" ), g_AISShowTracks_Mins);
759
760 conf->Write(_T ( "bHideMooredTargets" ), g_bHideMoored);
761 conf->Write(_T ( "MooredTargetMaxSpeedKnots" ), g_ShowMoored_Kts);
762
763 conf->Write(_T ( "bAISAlertDialog" ), g_bAIS_CPA_Alert);
764 conf->Write(_T ( "bAISAlertAudio" ), g_bAIS_CPA_Alert_Audio);
765 conf->Write(_T ( "AISAlertAudioFile" ), g_sAIS_Alert_Sound_File);
766 conf->Write(_T ( "bAISAlertSuppressMoored" ),
767 g_bAIS_CPA_Alert_Suppress_Moored);
768 conf->Write(_T ( "bShowAreaNotices" ), g_bShowAreaNotices);
769 conf->Write(_T ( "bDrawAISSize" ), g_bDrawAISSize);
770 conf->Write(_T ( "bDrawAISRealtime" ), g_bDrawAISRealtime);
771 conf->Write(_T ( "AISRealtimeMinSpeedKnots" ), g_AIS_RealtPred_Kts);
772 conf->Write(_T ( "bShowAISName" ), g_bShowAISName);
773 conf->Write(_T ( "ShowAISTargetNameScale" ), g_Show_Target_Name_Scale);
774 conf->Write(_T ( "bWplIsAprsPositionReport" ), g_bWplUsePosition);
775 conf->Write(_T ( "WplSelAction" ), g_WplAction);
776 conf->Write(_T ( "AISCOGPredictorWidth" ), g_ais_cog_predictor_width);
777 conf->Write(_T ( "bShowScaledTargets" ), g_bAllowShowScaled);
778 conf->Write(_T ( "AISScaledNumber" ), g_ShowScaled_Num);
779 conf->Write(_T ( "AISScaledNumberWeightSOG" ), g_ScaledNumWeightSOG);
780 conf->Write(_T ( "AISScaledNumberWeightCPA" ), g_ScaledNumWeightCPA);
781 conf->Write(_T ( "AISScaledNumberWeightTCPA" ), g_ScaledNumWeightTCPA);
782 conf->Write(_T ( "AISScaledNumberWeightRange" ), g_ScaledNumWeightRange);
783 conf->Write(_T ( "AISScaledNumberWeightSizeOfTarget" ),
784 g_ScaledNumWeightSizeOfT);
785 conf->Write(_T ( "AISScaledSizeMinimal" ), g_ScaledSizeMinimal);
786 conf->Write(_T ( "AISShowScaled"), g_bShowScaled);
787
788 conf->Write(_T ( "AlertDialogSizeX" ), g_ais_alert_dialog_sx);
789 conf->Write(_T ( "AlertDialogSizeY" ), g_ais_alert_dialog_sy);
790 conf->Write(_T ( "AlertDialogPosX" ), g_ais_alert_dialog_x);
791 conf->Write(_T ( "AlertDialogPosY" ), g_ais_alert_dialog_y);
792 conf->Write(_T ( "QueryDialogPosX" ), g_ais_query_dialog_x);
793 conf->Write(_T ( "QueryDialogPosY" ), g_ais_query_dialog_y);
794 conf->Write(_T ( "AISTargetListPerspective" ), g_AisTargetList_perspective);
795 conf->Write(_T ( "AISTargetListRange" ), g_AisTargetList_range);
796 conf->Write(_T ( "AISTargetListSortColumn" ), g_AisTargetList_sortColumn);
797 conf->Write(_T ( "bAISTargetListSortReverse" ), g_bAisTargetList_sortReverse);
798 conf->Write(_T ( "AISTargetListColumnSpec" ), g_AisTargetList_column_spec);
799 conf->Write(_T ( "AISTargetListColumnOrder" ), g_AisTargetList_column_order);
800 conf->Write(_T ( "S57QueryDialogSizeX" ), g_S57_dialog_sx);
801 conf->Write(_T ( "S57QueryDialogSizeY" ), g_S57_dialog_sy);
802 conf->Write(_T ( "bAISRolloverShowClass" ), g_bAISRolloverShowClass);
803 conf->Write(_T ( "bAISRolloverShowCOG" ), g_bAISRolloverShowCOG);
804 conf->Write(_T ( "bAISRolloverShowCPA" ), g_bAISRolloverShowCPA);
805 conf->Write(_T ( "bAISAlertAckTimeout" ), g_bAIS_ACK_Timeout);
806 conf->Write(_T ( "AlertAckTimeoutMinutes" ), g_AckTimeout_Mins);
807
808 conf->SetPath(_T ( "/Settings/GlobalState" ));
809 if (ps52plib) {
810 conf->Write(_T ( "bShowS57Text" ), ps52plib->GetShowS57Text());
811 conf->Write(_T ( "bShowS57ImportantTextOnly" ),
812 ps52plib->GetShowS57ImportantTextOnly());
813 if (!g_bInlandEcdis)
814 conf->Write(_T ( "nDisplayCategory" ),
815 (long)ps52plib->GetDisplayCategory());
816 conf->Write(_T ( "nSymbolStyle" ), (int)ps52plib->m_nSymbolStyle);
817 conf->Write(_T ( "nBoundaryStyle" ), (int)ps52plib->m_nBoundaryStyle);
818
819 conf->Write(_T ( "bShowSoundg" ), ps52plib->m_bShowSoundg);
820 conf->Write(_T ( "bShowMeta" ), ps52plib->m_bShowMeta);
821 conf->Write(_T ( "bUseSCAMIN" ), ps52plib->m_bUseSCAMIN);
822 conf->Write(_T ( "bUseSUPER_SCAMIN" ), ps52plib->m_bUseSUPER_SCAMIN);
823 conf->Write(_T ( "bShowAtonText" ), ps52plib->m_bShowAtonText);
824 conf->Write(_T ( "bShowLightDescription" ), ps52plib->m_bShowLdisText);
825 conf->Write(_T ( "bExtendLightSectors" ), ps52plib->m_bExtendLightSectors);
826 conf->Write(_T ( "bDeClutterText" ), ps52plib->m_bDeClutterText);
827 conf->Write(_T ( "bShowNationalText" ), ps52plib->m_bShowNationalTexts);
828
829 conf->Write(_T ( "S52_MAR_SAFETY_CONTOUR" ),
830 S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR));
831 conf->Write(_T ( "S52_MAR_SHALLOW_CONTOUR" ),
832 S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR));
833 conf->Write(_T ( "S52_MAR_DEEP_CONTOUR" ),
834 S52_getMarinerParam(S52_MAR_DEEP_CONTOUR));
835 conf->Write(_T ( "S52_MAR_TWO_SHADES" ),
836 S52_getMarinerParam(S52_MAR_TWO_SHADES));
837 conf->Write(_T ( "S52_DEPTH_UNIT_SHOW" ), ps52plib->m_nDepthUnitDisplay);
838 }
839
840 conf->SetPath(_T ( "/Settings/Others" ));
841
842 // Radar rings
843 conf->Write(_T ( "ShowRadarRings" ), (bool)(g_iNavAidRadarRingsNumberVisible >
844 0)); // 3.0.0 config support
845 conf->Write(_T ( "RadarRingsNumberVisible" ),
846 g_iNavAidRadarRingsNumberVisible);
847 g_bNavAidRadarRingsShown = g_iNavAidRadarRingsNumberVisible > 0;
848 conf->Write(_T ( "RadarRingsStep" ), g_fNavAidRadarRingsStep);
849 conf->Write(_T ( "RadarRingsStepUnits" ), g_pNavAidRadarRingsStepUnits);
850 conf->Write(_T ( "RadarRingsColour" ),
851 g_colourOwnshipRangeRingsColour.GetAsString(wxC2S_HTML_SYNTAX));
852
853 // Waypoint Radar rings
854 conf->Write(_T ( "WaypointRangeRingsNumber" ), g_iWaypointRangeRingsNumber);
855 conf->Write(_T ( "WaypointRangeRingsStep" ), g_fWaypointRangeRingsStep);
856 conf->Write(_T ( "WaypointRangeRingsStepUnits" ),
857 g_iWaypointRangeRingsStepUnits);
858 conf->Write(_T ( "WaypointRangeRingsColour" ),
859 g_colourWaypointRangeRingsColour.GetAsString(wxC2S_HTML_SYNTAX));
860
861 conf->Write(_T ( "ConfirmObjectDeletion" ), g_bConfirmObjectDelete);
862
863 // Waypoint dragging with mouse
864 conf->Write(_T ( "WaypointPreventDragging" ), g_bWayPointPreventDragging);
865
866 conf->Write(_T ( "EnableZoomToCursor" ), g_bEnableZoomToCursor);
867
868 conf->Write(_T ( "TrackIntervalSeconds" ), g_TrackIntervalSeconds);
869 conf->Write(_T ( "TrackDeltaDistance" ), g_TrackDeltaDistance);
870 conf->Write(_T ( "TrackPrecision" ), g_nTrackPrecision);
871
872 conf->Write(_T ( "RouteLineWidth" ), g_route_line_width);
873 conf->Write(_T ( "TrackLineWidth" ), g_track_line_width);
874 conf->Write(_T ( "TrackLineColour" ),
875 g_colourTrackLineColour.GetAsString(wxC2S_HTML_SYNTAX));
876 conf->Write(_T ( "DefaultWPIcon" ), g_default_wp_icon);
877
878 // Fonts
879
880 // Store the persistent Auxiliary Font descriptor Keys
881 conf->SetPath(_T ( "/Settings/AuxFontKeys" ));
882
883 wxArrayString keyArray = FontMgr::Get().GetAuxKeyArray();
884 for (unsigned int i = 0; i < keyArray.GetCount(); i++) {
885 wxString key;
886 key.Printf("Key%i", i);
887 wxString keyval = keyArray[i];
888 conf->Write(key, keyval);
889 }
890
891 wxString font_path;
892#ifdef __WXX11__
893 font_path = (_T ( "/Settings/X11Fonts" ));
894#endif
895
896#ifdef __WXGTK__
897 font_path = (_T ( "/Settings/GTKFonts" ));
898#endif
899
900#ifdef __WXMSW__
901 font_path = (_T ( "/Settings/MSWFonts" ));
902#endif
903
904#ifdef __WXMAC__
905 font_path = (_T ( "/Settings/MacFonts" ));
906#endif
907
908#ifdef __WXQT__
909 font_path = (_T ( "/Settings/QTFonts" ));
910#endif
911
912 conf->DeleteGroup(font_path);
913
914 conf->SetPath(font_path);
915
916 int nFonts = FontMgr::Get().GetNumFonts();
917
918 for (int i = 0; i < nFonts; i++) {
919 wxString cfstring(FontMgr::Get().GetConfigString(i));
920 wxString valstring = FontMgr::Get().GetFullConfigDesc(i);
921 conf->Write(cfstring, valstring);
922 }
923
924 // Save the per-canvas config options
925 conf->SaveCanvasConfigs();
926
927 conf->Flush();
928
929 delete conf;
930
931 return true;
932}
933
934bool ConfigMgr::CheckTemplateGUID(wxString GUID) {
935 bool rv = false;
936
937 OCPNConfigObject *config = GetConfig(GUID);
938 if (config) {
939 rv = CheckTemplate(GetConfigDir() + config->templateFileName);
940 }
941
942 return rv;
943}
944
945#define CHECK_INT(s, t) \
946 read_int = *t; \
947 if (!conf.Read(s, &read_int)) wxLogMessage(s); \
948 if ((int)*t != read_int) return false;
949
950#define CHECK_STR(s, t) \
951 val = t; \
952 conf.Read(s, &val); \
953 if (!t.IsSameAs(val)) return false;
954
955#define CHECK_STRP(s, t) \
956 conf.Read(s, &val); \
957 if (!t->IsSameAs(val)) return false;
958
959#define CHECK_FLT(s, t, eps) \
960 conf.Read(s, &val); \
961 val.ToDouble(&dval); \
962 if (fabs(dval - *t) > eps) return false;
963
964bool ConfigMgr::CheckTemplate(wxString fileName) {
965 bool rv = true;
966
967 int read_int;
968 wxString val;
969 double dval;
970
971 MyConfig conf(fileName);
972
973 // Global options and settings
974 conf.SetPath(_T ( "/Settings" ));
975
976 CHECK_INT(_T ( "UIexpert" ), &g_bUIexpert);
977
979
980 CHECK_INT(_T ( "InlandEcdis" ), &g_bInlandEcdis);
981
982 CHECK_INT(_T( "SpaceDropMark" ), &g_bSpaceDropMark);
983
985
986#if 0
987 CHECK_INT( _T ( "DebugGDAL" ), &g_bGDAL_Debug );
988 CHECK_INT( _T ( "DebugNMEA" ), &g_nNMEADebug );
989 CHECK_INT( _T ( "DebugOpenGL" ), &g_bDebugOGL );
993 CHECK_INT( _T ( "DebugCM93" ), &g_bDebugCM93 );
994 CHECK_INT( _T ( "DebugS57" ), &g_bDebugS57 ); // Show LUP and Feature info in object query
995 CHECK_INT( _T ( "DebugBSBImg" ), &g_BSBImgDebug );
996 CHECK_INT( _T ( "DebugGPSD" ), &g_bDebugGPSD );
997#endif
998
999 CHECK_INT(_T ( "DefaultFontSize"), &g_default_font_size);
1000
1001 // Read( _T ( "GPSIdent" ), &g_GPS_Ident );
1002 CHECK_INT(_T ( "UseGarminHostUpload" ), &g_bGarminHostUpload);
1003
1004 CHECK_INT(_T ( "UseNMEA_GLL" ), &g_bUseGLL);
1005
1006 CHECK_INT(_T ( "AutoHideToolbar" ), &g_bAutoHideToolbar);
1007 CHECK_INT(_T ( "AutoHideToolbarSecs" ), &g_nAutoHideToolbar);
1008
1009 CHECK_INT(_T ( "UseSimplifiedScalebar" ), &g_bsimplifiedScalebar);
1010
1011 CHECK_INT(_T ( "DisplaySizeMM" ), &g_display_size_mm);
1012 CHECK_INT(_T ( "DisplaySizeManual" ), &g_config_display_size_manual);
1013
1014 CHECK_INT(_T ( "GUIScaleFactor" ), &g_GUIScaleFactor);
1015
1016 CHECK_INT(_T ( "ChartObjectScaleFactor" ), &g_ChartScaleFactor);
1017 CHECK_INT(_T ( "ShipScaleFactor" ), &g_ShipScaleFactor);
1018
1019 CHECK_INT(_T ( "FilterNMEA_Avg" ), &g_bfilter_cogsog);
1020 CHECK_INT(_T ( "FilterNMEA_Sec" ), &g_COGFilterSec);
1021
1022 CHECK_INT(_T ( "ShowTrue" ), &g_bShowTrue);
1023 CHECK_INT(_T ( "ShowMag" ), &g_bShowMag);
1024
1025 CHECK_FLT(_T ( "UserMagVariation" ), &g_UserVar, 0.1)
1026
1027 CHECK_INT(_T ( "UseMagAPB" ), &g_bMagneticAPB);
1028
1029 CHECK_INT(_T ( "ScreenBrightness" ), &g_nbrightness);
1030
1031 CHECK_INT(_T ( "MemFootprintTargetMB" ), &g_MemFootMB);
1032
1033 CHECK_INT(_T ( "WindowsComPortMax" ), &g_nCOMPortCheck);
1034
1035 CHECK_INT(_T ( "ChartQuilting" ), &g_bQuiltEnable);
1036 CHECK_INT(_T ( "ChartQuiltingInitial" ), &g_bQuiltStart);
1037
1038 CHECK_INT(_T ( "CourseUpMode" ), &g_bCourseUp);
1039 CHECK_INT(_T ( "COGUPAvgSeconds" ), &g_COGAvgSec);
1040 // CHECK_INT( _T ( "LookAheadMode" ), &g_bLookAhead );
1041 // CHECK_INT( _T ( "SkewToNorthUp" ), &g_bskew_comp );
1042 CHECK_INT(_T ( "OpenGL" ), &g_bopengl);
1043 CHECK_INT(_T ( "SoftwareGL" ), &g_bSoftwareGL);
1044
1045 CHECK_INT(_T( "NMEAAPBPrecision" ), &g_NMEAAPBPrecision);
1046
1047 CHECK_STR(_T( "TalkerIdText" ), g_TalkerIdText);
1048 CHECK_INT(_T( "MaxWaypointNameLength" ), &g_maxWPNameLength);
1049 CHECK_INT(_T( "MbtilesMaxLayers" ), &g_mbtilesMaxLayers);
1050
1051 /* opengl options */
1052#ifdef ocpnUSE_GL
1053 CHECK_INT(_T ( "OpenGLExpert" ), &g_bGLexpert);
1054 CHECK_INT(_T ( "UseAcceleratedPanning" ),
1055 &g_GLOptions.m_bUseAcceleratedPanning);
1056 CHECK_INT(_T ( "GPUTextureCompression" ), &g_GLOptions.m_bTextureCompression);
1057 CHECK_INT(_T ( "GPUTextureCompressionCaching" ),
1058 &g_GLOptions.m_bTextureCompressionCaching);
1059 CHECK_INT(_T ( "PolygonSmoothing" ), &g_GLOptions.m_GLPolygonSmoothing);
1060 CHECK_INT(_T ( "LineSmoothing" ), &g_GLOptions.m_GLLineSmoothing);
1061 CHECK_INT(_T ( "GPUTextureDimension" ), &g_GLOptions.m_iTextureDimension);
1062 CHECK_INT(_T ( "GPUTextureMemSize" ), &g_GLOptions.m_iTextureMemorySize);
1063
1064#endif
1065 CHECK_INT(_T ( "SmoothPanZoom" ), &g_bsmoothpanzoom);
1066
1067 CHECK_INT(_T ( "ToolbarX"), &g_maintoolbar_x);
1068 CHECK_INT(_T ( "ToolbarY" ), &g_maintoolbar_y);
1069 CHECK_INT(_T ( "ToolbarOrient" ), &g_maintoolbar_orient);
1070 CHECK_STR(_T ( "GlobalToolbarConfig" ), g_toolbarConfig);
1071
1072 CHECK_INT(_T ( "iENCToolbarX"), &g_iENCToolbarPosX);
1073 CHECK_INT(_T ( "iENCToolbarY"), &g_iENCToolbarPosY);
1074
1075 CHECK_STR(_T ( "AnchorWatch1GUID" ), g_AW1GUID);
1076 CHECK_STR(_T ( "AnchorWatch2GUID" ), g_AW2GUID);
1077
1078 CHECK_INT(_T ( "MobileTouch" ), &g_btouch);
1079 CHECK_INT(_T ( "ResponsiveGraphics" ), &g_bresponsive);
1080
1081 CHECK_INT(_T ( "ZoomDetailFactor" ), &g_chart_zoom_modifier_raster);
1082 CHECK_INT(_T ( "ZoomDetailFactorVector" ), &g_chart_zoom_modifier_vector);
1083
1084 CHECK_INT(_T ( "CM93DetailFactor" ), &g_cm93_zoom_factor);
1085 CHECK_INT(_T ( "CM93DetailZoomPosX" ), &g_detailslider_dialog_x);
1086 CHECK_INT(_T ( "CM93DetailZoomPosY" ), &g_detailslider_dialog_y);
1087 CHECK_INT(_T ( "ShowCM93DetailSlider" ), &g_bShowDetailSlider);
1088
1089 CHECK_INT(_T ( "SENC_LOD_Pixels" ), &g_SENC_LOD_pixels);
1090
1091 CHECK_INT(_T ( "SkewCompUpdatePeriod" ), &g_SkewCompUpdatePeriod);
1092
1093 CHECK_INT(_T ( "ShowStatusBar" ), &g_bShowStatusBar);
1094#ifndef __WXOSX__
1095 CHECK_INT(_T ( "ShowMenuBar" ), &g_bShowMenuBar);
1096#endif
1097 CHECK_INT(_T ( "Fullscreen" ), &g_bFullscreen);
1098 CHECK_INT(_T ( "ShowCompassWindow" ), &g_bShowCompassWin);
1099 CHECK_INT(_T ( "PlayShipsBells" ), &g_bPlayShipsBells);
1100 CHECK_INT(_T ( "SoundDeviceIndex" ), &g_iSoundDeviceIndex);
1101 CHECK_INT(_T ( "FullscreenToolbar" ), &g_bFullscreenToolbar);
1102 // CHECK_INT( _T ( "TransparentToolbar" ), &g_bTransparentToolbar );
1103 CHECK_INT(_T ( "PermanentMOBIcon" ), &g_bPermanentMOBIcon);
1104 CHECK_INT(_T ( "ShowLayers" ), &g_bShowLayers);
1105 CHECK_INT(_T ( "ShowDepthUnits" ), &g_bShowDepthUnits);
1106 CHECK_INT(_T ( "AutoAnchorDrop" ), &g_bAutoAnchorMark);
1107 CHECK_INT(_T ( "ShowActiveRouteHighway" ), &g_bShowActiveRouteHighway);
1108 CHECK_INT(_T ( "ShowActiveRouteTotal" ), &g_bShowRouteTotal);
1109 CHECK_STR(_T ( "MostRecentGPSUploadConnection" ), g_uploadConnection);
1110 CHECK_INT(_T ( "ShowChartBar" ), &g_bShowChartBar);
1111 CHECK_INT(_T ( "SDMMFormat" ),
1112 &g_iSDMMFormat); // 0 = "Degrees, Decimal minutes"), 1 = "Decimal
1113 // degrees", 2 = "Degrees,Minutes, Seconds"
1114
1115 CHECK_INT(_T ( "DistanceFormat" ),
1116 &g_iDistanceFormat); // 0 = "Nautical miles"), 1 = "Statute miles",
1117 // 2 = "Kilometers", 3 = "Meters"
1118 CHECK_INT(_T ( "SpeedFormat" ),
1119 &g_iSpeedFormat); // 0 = "kts"), 1 = "mph", 2 = "km/h", 3 = "m/s"
1120 CHECK_INT(
1121 _T ( "WindSpeedFormat" ),
1122 &g_iWindSpeedFormat); // 0 = "knots"), 1 = "m/s", 2 = "Mph", 3 = "km/h"
1123
1124 // LIVE ETA OPTION
1125 CHECK_INT(_T ( "LiveETA" ), &g_bShowLiveETA);
1126 CHECK_INT(_T ( "DefaultBoatSpeed" ), &g_defaultBoatSpeed);
1127
1128 CHECK_INT(_T ( "OwnshipCOGPredictorMinutes" ), &g_ownship_predictor_minutes);
1129 CHECK_INT(_T ( "OwnshipCOGPredictorWidth" ), &g_cog_predictor_width);
1130 CHECK_INT(_T ( "OwnshipHDTPredictorMiles" ), &g_ownship_HDTpredictor_miles);
1131
1132 CHECK_INT(_T ( "OwnShipIconType" ), &g_OwnShipIconType);
1133 CHECK_FLT(_T ( "OwnShipLength" ), &g_n_ownship_length_meters, 0.1);
1134 CHECK_FLT(_T ( "OwnShipWidth" ), &g_n_ownship_beam_meters, 0.1);
1135 CHECK_FLT(_T ( "OwnShipGPSOffsetX" ), &g_n_gps_antenna_offset_x, 0.1);
1136 CHECK_FLT(_T ( "OwnShipGPSOffsetY" ), &g_n_gps_antenna_offset_y, 0.1);
1137 CHECK_INT(_T ( "OwnShipMinSize" ), &g_n_ownship_min_mm);
1138 CHECK_INT(_T ( "OwnShipSogCogCalc" ), &g_own_ship_sog_cog_calc);
1139 CHECK_INT(_T ( "OwnShipSogCogCalcDampSec"),
1140 &g_own_ship_sog_cog_calc_damp_sec);
1141
1142 CHECK_FLT(_T ( "RouteArrivalCircleRadius" ), &g_n_arrival_circle_radius, .01);
1143
1144 CHECK_INT(_T ( "FullScreenQuilt" ), &g_bFullScreenQuilt);
1145
1146 CHECK_INT(_T ( "StartWithTrackActive" ), &g_bTrackCarryOver);
1147 CHECK_INT(_T ( "AutomaticDailyTracks" ), &g_bTrackDaily);
1148 CHECK_INT(_T ( "TrackRotateAt" ), &g_track_rotate_time);
1149 CHECK_INT(_T ( "TrackRotateTimeType" ), &g_track_rotate_time_type);
1150 CHECK_INT(_T ( "HighlightTracks" ), &g_bHighliteTracks);
1151
1152 CHECK_STR(_T ( "DateTimeFormat" ), g_datetime_format);
1153
1154 CHECK_FLT(_T ( "PlanSpeed" ), &g_PlanSpeed, 0.1)
1155
1156
1158
1159 CHECK_INT(_T ( "PreserveScaleOnX" ), &g_bPreserveScaleOnX);
1160
1161 CHECK_STR(_T ( "Locale" ), g_locale);
1162 CHECK_STR(_T ( "LocaleOverride" ), g_localeOverride);
1163
1164 // We allow 0-99 backups ov navobj.xml
1165 CHECK_INT(_T ( "KeepNavobjBackups" ), &g_navobjbackups);
1166
1167 // NMEALogWindow::Get().SetSize(Read("NMEALogWindowSizeX", 600L),
1168 // Read("NMEALogWindowSizeY", 400L));
1169 // NMEALogWindow::Get().SetPos(Read("NMEALogWindowPosX", 10L),
1170 // Read("NMEALogWindowPosY", 10L));
1171 // NMEALogWindow::Get().CheckPos(display_width, display_height);
1172
1173 // Boolean to cater for legacy Input COM Port filer behaviour, i.e. show msg
1174 // filtered but put msg on bus.
1175 CHECK_INT(_T ( "LegacyInputCOMPortFilterBehaviour" ),
1176 &g_b_legacy_input_filter_behaviour);
1177
1178 CHECK_INT(_T( "AdvanceRouteWaypointOnArrivalOnly" ),
1179 &g_bAdvanceRouteWaypointOnArrivalOnly);
1180
1181 CHECK_INT(_T ( "EnableRotateKeys" ), &g_benable_rotate);
1182 CHECK_INT(_T ( "EmailCrashReport" ), &g_bEmailCrashReport);
1183
1184 CHECK_INT(_T ( "EnableAISNameCache" ), &g_benableAISNameCache);
1185
1186 CHECK_INT(_T ( "EnableUDPNullHeader" ), &g_benableUDPNullHeader);
1187
1188 conf.SetPath(_T ( "/Settings/GlobalState" ));
1189
1190 CHECK_INT(_T ( "FrameWinX" ), &g_nframewin_x);
1191 CHECK_INT(_T ( "FrameWinY" ), &g_nframewin_y);
1192 CHECK_INT(_T ( "FrameWinPosX" ), &g_nframewin_posx);
1193 CHECK_INT(_T ( "FrameWinPosY" ), &g_nframewin_posy);
1194 CHECK_INT(_T ( "FrameMax" ), &g_bframemax);
1195
1196 CHECK_INT(_T ( "ClientPosX" ), &g_lastClientRectx);
1197 CHECK_INT(_T ( "ClientPosY" ), &g_lastClientRecty);
1198 CHECK_INT(_T ( "ClientSzX" ), &g_lastClientRectw);
1199 CHECK_INT(_T ( "ClientSzY" ), &g_lastClientRecth);
1200
1201 CHECK_INT(_T( "RoutePropSizeX" ), &g_route_prop_sx);
1202 CHECK_INT(_T( "RoutePropSizeY" ), &g_route_prop_sy);
1203 CHECK_INT(_T( "RoutePropPosX" ), &g_route_prop_x);
1204 CHECK_INT(_T( "RoutePropPosY" ), &g_route_prop_y);
1205
1206 CHECK_INT(_T ( "S52_DEPTH_UNIT_SHOW" ),
1207 &g_nDepthUnitDisplay); // default is metres
1208
1209 // AIS
1210 conf.SetPath(_T ( "/Settings/AIS" ));
1211 CHECK_INT(_T ( "bNoCPAMax" ), &g_bCPAMax);
1212 CHECK_FLT(_T ( "NoCPAMaxNMi" ), &g_CPAMax_NM, .01)
1213 CHECK_INT(_T ( "bCPAWarn" ), &g_bCPAWarn);
1214 CHECK_FLT(_T ( "CPAWarnNMi" ), &g_CPAWarn_NM, .01)
1215 CHECK_INT(_T ( "bTCPAMax" ), &g_bTCPA_Max);
1216 CHECK_FLT(_T ( "TCPAMaxMinutes" ), &g_TCPA_Max, 1)
1217 CHECK_INT(_T ( "bMarkLostTargets" ), &g_bMarkLost);
1218 CHECK_FLT(_T ( "MarkLost_Minutes" ), &g_MarkLost_Mins, 1)
1219 CHECK_INT(_T ( "bRemoveLostTargets" ), &g_bRemoveLost);
1220 CHECK_FLT(_T ( "RemoveLost_Minutes" ), &g_RemoveLost_Mins, 1)
1221 CHECK_INT(_T ( "bShowCOGArrows" ), &g_bShowCOG);
1222 CHECK_INT(_T ( "bSyncCogPredictors" ), &g_bSyncCogPredictors);
1223 CHECK_FLT(_T ( "CogArrowMinutes" ), &g_ShowCOG_Mins, 1);
1224 CHECK_INT(_T ( "bShowTargetTracks" ), &g_bAISShowTracks);
1225 CHECK_FLT(_T ( "TargetTracksMinutes" ), &g_AISShowTracks_Mins, 1)
1226 CHECK_FLT(_T ( "TargetTracksLimit" ), &g_AISShowTracks_Limit, 300)
1227 CHECK_INT(_T ( "bHideMooredTargets" ), &g_bHideMoored)
1228 CHECK_FLT(_T ( "MooredTargetMaxSpeedKnots" ), &g_ShowMoored_Kts, .1)
1229 CHECK_INT(_T ( "bShowScaledTargets"), &g_bAllowShowScaled);
1230 CHECK_INT(_T ( "AISScaledNumber" ), &g_ShowScaled_Num);
1231 CHECK_INT(_T ( "AISScaledNumberWeightSOG" ), &g_ScaledNumWeightSOG);
1232 CHECK_INT(_T ( "AISScaledNumberWeightCPA" ), &g_ScaledNumWeightCPA);
1233 CHECK_INT(_T ( "AISScaledNumberWeightTCPA" ), &g_ScaledNumWeightTCPA);
1234 CHECK_INT(_T ( "AISScaledNumberWeightRange" ), &g_ScaledNumWeightRange);
1235 CHECK_INT(_T ( "AISScaledNumberWeightSizeOfTarget" ),
1236 &g_ScaledNumWeightSizeOfT);
1237 CHECK_INT(_T ( "AISScaledSizeMinimal" ), &g_ScaledSizeMinimal);
1238 CHECK_INT(_T( "AISShowScaled"), &g_bShowScaled);
1239 CHECK_INT(_T ( "bShowAreaNotices" ), &g_bShowAreaNotices);
1240 CHECK_INT(_T ( "bDrawAISSize" ), &g_bDrawAISSize);
1241 CHECK_INT(_T ( "bDrawAISRealtime" ), &g_bDrawAISRealtime);
1242 CHECK_FLT(_T ( "AISRealtimeMinSpeedKnots" ), &g_AIS_RealtPred_Kts, .1);
1243 CHECK_INT(_T ( "bShowAISName" ), &g_bShowAISName);
1244 CHECK_INT(_T ( "bAISAlertDialog" ), &g_bAIS_CPA_Alert);
1245 CHECK_INT(_T ( "ShowAISTargetNameScale" ), &g_Show_Target_Name_Scale);
1246 CHECK_INT(_T ( "bWplIsAprsPositionReport" ), &g_bWplUsePosition);
1247 CHECK_INT(_T ( "WplSelAction" ), &g_WplAction);
1248 CHECK_INT(_T ( "AISCOGPredictorWidth" ), &g_ais_cog_predictor_width);
1249 CHECK_INT(_T ( "bAISAlertAudio" ), &g_bAIS_CPA_Alert_Audio);
1250 CHECK_STR(_T ( "AISAlertAudioFile" ), g_sAIS_Alert_Sound_File);
1251 CHECK_INT(_T ( "bAISAlertSuppressMoored" ),
1252 &g_bAIS_CPA_Alert_Suppress_Moored);
1253 CHECK_INT(_T ( "bAISAlertAckTimeout" ), &g_bAIS_ACK_Timeout);
1254 CHECK_FLT(_T ( "AlertAckTimeoutMinutes" ), &g_AckTimeout_Mins, 1)
1255 CHECK_STR(_T ( "AISTargetListPerspective" ), g_AisTargetList_perspective);
1256 CHECK_INT(_T ( "AISTargetListRange" ), &g_AisTargetList_range);
1257 CHECK_INT(_T ( "AISTargetListSortColumn" ), &g_AisTargetList_sortColumn);
1258 CHECK_INT(_T ( "bAISTargetListSortReverse" ), &g_bAisTargetList_sortReverse);
1259 CHECK_STR(_T ( "AISTargetListColumnSpec" ), g_AisTargetList_column_spec);
1260 CHECK_STR(_T ("AISTargetListColumnOrder"), g_AisTargetList_column_order);
1261 CHECK_INT(_T ( "bAISRolloverShowClass" ), &g_bAISRolloverShowClass);
1262 CHECK_INT(_T ( "bAISRolloverShowCOG" ), &g_bAISRolloverShowCOG);
1263 CHECK_INT(_T ( "bAISRolloverShowCPA" ), &g_bAISRolloverShowCPA);
1264
1265 CHECK_INT(_T ( "S57QueryDialogSizeX" ), &g_S57_dialog_sx);
1266 CHECK_INT(_T ( "S57QueryDialogSizeY" ), &g_S57_dialog_sy);
1267 CHECK_INT(_T ( "AlertDialogSizeX" ), &g_ais_alert_dialog_sx);
1268 CHECK_INT(_T ( "AlertDialogSizeY" ), &g_ais_alert_dialog_sy);
1269 CHECK_INT(_T ( "AlertDialogPosX" ), &g_ais_alert_dialog_x);
1270 CHECK_INT(_T ( "AlertDialogPosY" ), &g_ais_alert_dialog_y);
1271 CHECK_INT(_T ( "QueryDialogPosX" ), &g_ais_query_dialog_x);
1272 CHECK_INT(_T ( "QueryDialogPosY" ), &g_ais_query_dialog_y);
1273
1274 conf.SetPath(_T ( "/Directories" ));
1275 CHECK_STR(_T ( "PresentationLibraryData" ), g_UserPresLibData)
1277
1278 CHECK_STR(_T ( "SENCFileLocation" ), g_SENCPrefix)
1279
1280 CHECK_STR(_T ( "GPXIODir" ), g_gpx_path); // Get the Directory name
1281 CHECK_STR(_T ( "TCDataDir" ), g_TCData_Dir); // Get the Directory name
1282 CHECK_STR(_T ( "BasemapDir"), gWorldMapLocation);
1283 CHECK_STR(_T ( "BaseShapefileDir"), gWorldShapefileLocation);
1284
1285 // Fonts
1286
1287#if 0
1288 // Load the persistent Auxiliary Font descriptor Keys
1289 conf.SetPath ( _T ( "/Settings/AuxFontKeys" ) );
1290
1291 wxString strk;
1292 long dummyk;
1293 wxString kval;
1294 bool bContk = conf,GetFirstEntry( strk, dummyk );
1295 bool bNewKey = false;
1296 while( bContk ) {
1297 Read( strk, &kval );
1298 bNewKey = FontMgr::Get().AddAuxKey(kval);
1299 if(!bNewKey) {
1300 DeleteEntry( strk );
1301 dummyk--;
1302 }
1303 bContk = GetNextEntry( strk, dummyk );
1304 }
1305#endif
1306
1307#ifdef __WXX11__
1308 conf.SetPath(_T ( "/Settings/X11Fonts" ));
1309#endif
1310
1311#ifdef __WXGTK__
1312 conf.SetPath(_T ( "/Settings/GTKFonts" ));
1313#endif
1314
1315#ifdef __WXMSW__
1316 conf.SetPath(_T ( "/Settings/MSWFonts" ));
1317#endif
1318
1319#ifdef __WXMAC__
1320 conf.SetPath(_T ( "/Settings/MacFonts" ));
1321#endif
1322
1323#ifdef __WXQT__
1324 conf.SetPath(_T ( "/Settings/QTFonts" ));
1325#endif
1326
1327 conf.SetPath(_T ( "/Settings/Others" ));
1328
1329 // Radar rings
1330 CHECK_INT(_T ( "RadarRingsNumberVisible" ), &g_iNavAidRadarRingsNumberVisible)
1331 CHECK_INT(_T ( "RadarRingsStep" ), &g_fNavAidRadarRingsStep)
1332
1333 CHECK_INT(_T ( "RadarRingsStepUnits" ), &g_pNavAidRadarRingsStepUnits);
1334
1335 // wxString l_wxsOwnshipRangeRingsColour;
1336 // CHECK_STR( _T ( "RadarRingsColour" ), &l_wxsOwnshipRangeRingsColour );
1337 // if(l_wxsOwnshipRangeRingsColour.Length())
1338 // g_colourOwnshipRangeRingsColour.Set( l_wxsOwnshipRangeRingsColour );
1339
1340 // Waypoint Radar rings
1341 CHECK_INT(_T ( "WaypointRangeRingsNumber" ), &g_iWaypointRangeRingsNumber)
1342
1343 CHECK_FLT(_T ( "WaypointRangeRingsStep" ), &g_fWaypointRangeRingsStep, .1)
1344
1345 CHECK_INT(_T ( "WaypointRangeRingsStepUnits" ),
1346 &g_iWaypointRangeRingsStepUnits);
1347
1348 // wxString l_wxsWaypointRangeRingsColour;
1349 // CHECK_STR( _T( "WaypointRangeRingsColour" ),
1350 // &l_wxsWaypointRangeRingsColour ); g_colourWaypointRangeRingsColour.Set(
1351 // l_wxsWaypointRangeRingsColour );
1352
1353 CHECK_INT(_T ( "ConfirmObjectDeletion" ), &g_bConfirmObjectDelete);
1354
1355 // Waypoint dragging with mouse
1356 CHECK_INT(_T ( "WaypointPreventDragging" ), &g_bWayPointPreventDragging);
1357
1358 CHECK_INT(_T ( "EnableZoomToCursor" ), &g_bEnableZoomToCursor);
1359
1360 CHECK_FLT(_T ( "TrackIntervalSeconds" ), &g_TrackIntervalSeconds, 1)
1361
1362 CHECK_FLT(_T ( "TrackDeltaDistance" ), &g_TrackDeltaDistance, .1)
1363
1364 CHECK_INT(_T ( "TrackPrecision" ), &g_nTrackPrecision);
1365
1366 // CHECK_STR( _T ( "NavObjectFileName" ), m_sNavObjSetFile );
1367
1368 CHECK_INT(_T ( "RouteLineWidth" ), &g_route_line_width);
1369 CHECK_INT(_T ( "TrackLineWidth" ), &g_track_line_width);
1370
1371 // wxString l_wxsTrackLineColour;
1372 // CHECK_STR( _T( "TrackLineColour" ), l_wxsTrackLineColour )
1373 // g_colourTrackLineColour.Set( l_wxsTrackLineColour );
1374
1375 CHECK_STR(_T ( "DefaultWPIcon" ), g_default_wp_icon)
1376
1377 // S57 template items
1378
1379#define CHECK_BFN(s, t) \
1380 conf.Read(s, &read_int); \
1381 bval = t; \
1382 bval0 = read_int != 0; \
1383 if (bval != bval0) return false;
1384
1385#define CHECK_IFN(s, t) \
1386 conf.Read(s, &read_int); \
1387 if (read_int != t) return false;
1388
1389#define CHECK_FFN(s, t) \
1390 conf.Read(s, &dval); \
1391 if (fabs(dval - t) > 0.1) return false;
1392
1393 if (ps52plib) {
1394 int read_int;
1395 double dval;
1396 bool bval, bval0;
1397
1398 conf.SetPath(_T ( "/Settings/GlobalState" ));
1399
1400 CHECK_BFN(_T ( "bShowS57Text" ), ps52plib->GetShowS57Text());
1401
1402 CHECK_BFN(_T ( "bShowS57ImportantTextOnly" ),
1403 ps52plib->GetShowS57ImportantTextOnly());
1404 CHECK_BFN(_T ( "bShowLightDescription" ), ps52plib->m_bShowLdisText);
1405 CHECK_BFN(_T ( "bExtendLightSectors" ), ps52plib->m_bExtendLightSectors);
1406 CHECK_BFN(_T ( "bShowSoundg" ), ps52plib->m_bShowSoundg);
1407 CHECK_BFN(_T ( "bShowMeta" ), ps52plib->m_bShowMeta);
1408 CHECK_BFN(_T ( "bUseSCAMIN" ), ps52plib->m_bUseSCAMIN);
1409 CHECK_BFN(_T ( "bUseSUPERSCAMIN" ), ps52plib->m_bUseSUPER_SCAMIN);
1410 CHECK_BFN(_T ( "bShowAtonText" ), ps52plib->m_bShowAtonText);
1411 CHECK_BFN(_T ( "bDeClutterText" ), ps52plib->m_bDeClutterText);
1412 CHECK_BFN(_T ( "bShowNationalText" ), ps52plib->m_bShowNationalTexts);
1413 CHECK_IFN(_T ( "nDisplayCategory" ), ps52plib->GetDisplayCategory());
1414 CHECK_IFN(_T ( "nSymbolStyle" ), ps52plib->m_nSymbolStyle);
1415 CHECK_IFN(_T ( "nBoundaryStyle" ), ps52plib->m_nBoundaryStyle);
1416 CHECK_FFN(_T ( "S52_MAR_SAFETY_CONTOUR" ),
1417 S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR));
1418 CHECK_FFN(_T ( "S52_MAR_SHALLOW_CONTOUR" ),
1419 S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR));
1420 CHECK_FFN(_T ( "S52_MAR_DEEP_CONTOUR" ),
1421 S52_getMarinerParam(S52_MAR_DEEP_CONTOUR));
1422 CHECK_FFN(_T ( "S52_MAR_TWO_SHADES" ),
1423 S52_getMarinerParam(S52_MAR_TWO_SHADES));
1424 CHECK_INT(_T ( "S52_DEPTH_UNIT_SHOW" ), &g_nDepthUnitDisplay);
1425
1426 // S57 Object Class Visibility
1427
1428 OBJLElement *pOLE;
1429
1430 conf.SetPath(_T ( "/Settings/ObjectFilter" ));
1431
1432 unsigned int iOBJMax = conf.GetNumberOfEntries();
1433
1434 if (iOBJMax != ps52plib->pOBJLArray->GetCount()) return false;
1435
1436 if (iOBJMax) {
1437 wxString str, sObj;
1438 long val;
1439 long dummy;
1440
1441 bool bCont = conf.GetFirstEntry(str, dummy);
1442 while (bCont) {
1443 conf.Read(str, &val); // Get an Object Viz
1444
1445 // scan for the same key in the global list
1446 bool bfound = false;
1447 if (str.StartsWith(_T ( "viz" ), &sObj)) {
1448 for (unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
1449 iPtr++) {
1450 pOLE = (OBJLElement *)(ps52plib->pOBJLArray->Item(iPtr));
1451 if (!strncmp(pOLE->OBJLName, sObj.mb_str(), 6)) {
1452 bfound = true;
1453 if (pOLE->nViz != val) {
1454 return false;
1455 }
1456 }
1457 }
1458
1459 if (!bfound) return false;
1460 }
1461 bCont = conf.GetNextEntry(str, dummy);
1462 }
1463 }
1464 }
1465
1466 conf.SetPath(_T ( "/MmsiProperties" ));
1467 int iPMax = conf.GetNumberOfEntries();
1468 if (iPMax) {
1469 wxString str, val;
1470 long dummy;
1471
1472 bool bCont = conf.GetFirstEntry(str, dummy);
1473 while (bCont) {
1474 conf.Read(str, &val); // Get an entry
1475
1476 bool bfound = false;
1477 for (unsigned int j = 0; j < g_MMSI_Props_Array.GetCount(); j++) {
1478 MmsiProperties *pProps = g_MMSI_Props_Array.Item(j);
1479 if (pProps->Serialize().IsSameAs(val)) {
1480 bfound = true;
1481 break;
1482 }
1483 }
1484 if (!bfound) return false;
1485
1486 bCont = conf.GetNextEntry(str, dummy);
1487 }
1488 }
1489
1490 return rv;
1491}
Class AisDecoder and helpers.
Global state for AIS decoder.
Charts database management
Generic Chart canvas base.
wxString & GetPrivateDataDir()
Return dir path for opencpn.log, etc., respecting -c cli option.
Manages the user configuration matrix.
Definition config_mgr.h:47
Represents a panel for displaying and editing a configuration.
Definition config_mgr.h:92
wxString GetFullConfigDesc(int i) const
Gets description of font at index i.
Definition FontMgr.cpp:367
bool AddAuxKey(wxString key)
Adds new plugin-defined font configuration key.
Definition FontMgr.cpp:660
int GetNumFonts(void) const
Gets the total number of font configurations currently loaded.
Definition FontMgr.cpp:329
wxArrayString & GetAuxKeyArray()
Gets array of plugin-defined font configuration keys.
Definition FontMgr.h:183
Represents a layer of chart objects in OpenCPN.
Definition Layer.h:40
Process incoming AIS messages.
Definition ais_decoder.h:73
Config file user configuration interface.
wxString g_datetime_format
Date/time format to use when formatting date/time strings.
bool g_bsmoothpanzoom
Controls how the chart panning and zooming smoothing is done during user interactions.
int g_COGAvgSec
COG average period for Course Up Mode (sec)
std::vector< size_t > g_config_display_size_mm
g_config_display_size_mm: Size of pysical screen in millimeters.
bool g_bDisplayGrid
Should lat/lon grid be displayed ?
double g_display_size_mm
Physical display width (mm)
Global variables stored in configuration file.
NavmsgFilter Read(const std::string &name)
Read filter with given name from disk.
Miscellaneous globals primarely used by gui layer.
Multiplexer class and helpers.
Class ocpnGLOptions – OpenGL runtime options.
PlugIn Object Definition/API.
wxString * GetpSharedDataLocation(void)
Gets shared application data location.