29#include <wx/tokenzr.h>
32#include "config_vars.h"
35#include <wx/filename.h>
36#include <wx/fileconf.h>
37#include <wx/statline.h>
47#include <wx/listimpl.cpp>
48#include <wx/progdlg.h>
60#include "multiplexer.h"
67#include "nav_object_database.h"
68#include "NMEALogWindow.h"
69#include "ais_decoder.h"
70#include "OCPNPlatform.h"
73#include "CanvasConfig.h"
74#include "ocpn_frame.h"
80#include "glChartCanvas.h"
89extern int g_restore_stackindex;
90extern int g_restore_dbindex;
91extern LayerList *pLayerList;
93extern double initial_scale_ppm, initial_rotation;
94extern int g_nbrightness;
95extern bool g_bShowTrue, g_bShowMag;
96extern bool g_bShowStatusBar;
97extern bool g_bUIexpert;
98extern bool g_bFullscreen;
99extern int g_nDepthUnitDisplay;
101extern wxString g_SENCPrefix;
102extern wxString g_UserPresLibData;
104extern wxString *pInit_Chart_Dir;
105extern wxString gWorldMapLocation;
107extern bool s_bSetSystemTime;
108extern bool g_bDisplayGrid;
109extern bool g_bPlayShipsBells;
110extern int g_iSoundDeviceIndex;
111extern bool g_bFullscreenToolbar;
112extern bool g_bShowLayers;
113extern bool g_bTransparentToolbar;
114extern bool g_bPermanentMOBIcon;
116extern bool g_bShowDepthUnits;
117extern bool g_bAutoAnchorMark;
118extern bool g_bskew_comp;
119extern bool g_bopengl;
120extern bool g_bSoftwareGL;
121extern bool g_bShowFPS;
122extern bool g_bsmoothpanzoom;
124extern bool g_bShowOutlines;
125extern bool g_bShowActiveRouteHighway;
126extern bool g_bShowRouteTotal;
127extern int g_nAWDefault;
129extern int g_nTrackPrecision;
131extern int g_iSDMMFormat;
132extern int g_iDistanceFormat;
133extern int g_iSpeedFormat;
135extern int g_nframewin_x;
136extern int g_nframewin_y;
137extern int g_nframewin_posx;
138extern int g_nframewin_posy;
139extern bool g_bframemax;
140extern int g_route_prop_x, g_route_prop_y;
141extern int g_route_prop_sx, g_route_prop_sy;
143extern double g_PlanSpeed;
144extern wxString g_VisibleLayers;
145extern wxString g_InvisibleLayers;
148extern bool g_bShowLiveETA;
149extern double g_defaultBoatSpeed;
152extern bool g_bCPAMax;
153extern double g_CPAMax_NM;
154extern bool g_bCPAWarn;
155extern double g_CPAWarn_NM;
156extern bool g_bTCPA_Max;
157extern double g_TCPA_Max;
158extern bool g_bMarkLost;
159extern double g_MarkLost_Mins;
160extern bool g_bRemoveLost;
161extern double g_RemoveLost_Mins;
162extern bool g_bShowCOG;
163extern bool g_bSyncCogPredictors;
164extern double g_ShowCOG_Mins;
165extern bool g_bAISShowTracks;
166extern bool g_bTrackCarryOver;
167extern bool g_bTrackDaily;
168extern int g_track_rotate_time;
169extern int g_track_rotate_time_type;
170extern double g_AISShowTracks_Mins;
171extern double g_AISShowTracks_Limit;
172extern bool g_bHideMoored;
173extern double g_ShowMoored_Kts;
174extern bool g_bAllowShowScaled;
175extern bool g_bShowScaled;
176extern int g_ShowScaled_Num;
177extern bool g_bAIS_CPA_Alert;
178extern bool g_bAIS_CPA_Alert_Audio;
179extern int g_ais_alert_dialog_x, g_ais_alert_dialog_y;
180extern int g_ais_alert_dialog_sx, g_ais_alert_dialog_sy;
181extern int g_ais_query_dialog_x, g_ais_query_dialog_y;
182extern wxString g_sAIS_Alert_Sound_File;
183extern bool g_bAIS_CPA_Alert_Suppress_Moored;
184extern bool g_bAIS_ACK_Timeout;
185extern double g_AckTimeout_Mins;
186extern wxString g_AisTargetList_perspective;
187extern int g_AisTargetList_range;
188extern int g_AisTargetList_sortColumn;
189extern bool g_bAisTargetList_sortReverse;
190extern wxString g_AisTargetList_column_spec;
191extern wxString g_AisTargetList_column_order;
192extern bool g_bShowAreaNotices;
193extern bool g_bDrawAISSize;
194extern bool g_bDrawAISRealtime;
195extern double g_AIS_RealtPred_Kts;
196extern bool g_bShowAISName;
197extern int g_Show_Target_Name_Scale;
198extern int g_WplAction;
199extern bool g_benableAISNameCache;
200extern int g_ScaledNumWeightSOG;
201extern int g_ScaledNumWeightCPA;
202extern int g_ScaledNumWeightTCPA;
203extern int g_ScaledNumWeightRange;
204extern int g_ScaledNumWeightSizeOfT;
205extern int g_ScaledSizeMinimal;
207extern int g_S57_dialog_sx, g_S57_dialog_sy;
209extern int g_iNavAidRadarRingsNumberVisible;
210extern float g_fNavAidRadarRingsStep;
211extern int g_pNavAidRadarRingsStepUnits;
212extern int g_iWaypointRangeRingsNumber;
213extern float g_fWaypointRangeRingsStep;
214extern int g_iWaypointRangeRingsStepUnits;
215extern wxColour g_colourWaypointRangeRingsColour;
216extern bool g_bWayPointPreventDragging;
217extern bool g_bConfirmObjectDelete;
218extern wxColour g_colourOwnshipRangeRingsColour;
220extern bool g_bEnableZoomToCursor;
221extern wxString g_toolbarConfig;
222extern double g_TrackIntervalSeconds;
223extern double g_TrackDeltaDistance;
225extern bool g_bGDAL_Debug;
226extern bool g_bDebugCM93;
227extern bool g_bDebugS57;
229extern double g_ownship_predictor_minutes;
230extern double g_ownship_HDTpredictor_miles;
232extern bool g_own_ship_sog_cog_calc;
233extern int g_own_ship_sog_cog_calc_damp_sec;
235extern s52plib *ps52plib;
237extern int g_cm93_zoom_factor;
238extern bool g_b_legacy_input_filter_behaviour;
239extern bool g_bShowDetailSlider;
240extern int g_detailslider_dialog_x, g_detailslider_dialog_y;
242extern int g_OwnShipIconType;
243extern double g_n_ownship_length_meters;
244extern double g_n_ownship_beam_meters;
245extern double g_n_gps_antenna_offset_y;
246extern double g_n_gps_antenna_offset_x;
247extern int g_n_ownship_min_mm;
248extern double g_n_arrival_circle_radius;
250extern bool g_bPreserveScaleOnX;
251extern bool g_bsimplifiedScalebar;
253extern bool g_bUseGLL;
255extern wxString g_locale;
256extern wxString g_localeOverride;
258extern bool g_bCourseUp;
259extern bool g_bLookAhead;
260extern int g_COGAvgSec;
261extern bool g_bMagneticAPB;
262extern bool g_bShowChartBar;
264extern int g_MemFootMB;
266extern int g_nCOMPortCheck;
268extern wxString g_AW1GUID;
269extern wxString g_AW2GUID;
270extern int g_BSBImgDebug;
272extern wxString g_config_version_string;
273extern wxString g_config_version_string;
275extern bool g_bAISRolloverShowClass;
276extern bool g_bAISRolloverShowCOG;
277extern bool g_bAISRolloverShowCPA;
279extern bool g_bDebugGPSD;
281extern bool g_bfilter_cogsog;
282extern int g_COGFilterSec;
284extern int g_navobjbackups;
286extern bool g_bQuiltEnable;
287extern bool g_bFullScreenQuilt;
288extern bool g_bQuiltStart;
290extern int g_SkewCompUpdatePeriod;
292extern int g_maintoolbar_x;
293extern int g_maintoolbar_y;
294extern long g_maintoolbar_orient;
296extern int g_lastClientRectx;
297extern int g_lastClientRecty;
298extern int g_lastClientRectw;
299extern int g_lastClientRecth;
301extern bool g_bHighliteTracks;
302extern int g_cog_predictor_width;
303extern int g_ais_cog_predictor_width;
305extern int g_route_line_width;
306extern int g_track_line_width;
307extern wxColour g_colourTrackLineColour;
308extern wxString g_default_wp_icon;
310extern ChartGroupArray *g_pGroupArray;
312extern bool g_bDebugOGL;
313extern wxString g_uploadConnection;
315extern wxArrayString TideCurrentDataSet;
316extern wxString g_TCData_Dir;
319extern bool g_bresponsive;
321extern bool g_bGLexpert;
323extern int g_SENC_LOD_pixels;
324extern ArrayOfMmsiProperties g_MMSI_Props_Array;
326extern int g_chart_zoom_modifier_raster;
327extern int g_chart_zoom_modifier_vector;
329extern int g_NMEAAPBPrecision;
331extern bool g_bAdvanceRouteWaypointOnArrivalOnly;
332extern double g_display_size_mm;
333extern double g_config_display_size_mm;
334extern bool g_config_display_size_manual;
336extern bool g_benable_rotate;
337extern bool g_bEmailCrashReport;
339extern int g_default_font_size;
341extern bool g_bAutoHideToolbar;
342extern int g_nAutoHideToolbar;
343extern int g_GUIScaleFactor;
344extern int g_ChartScaleFactor;
345extern int g_ShipScaleFactor;
347extern bool g_bInlandEcdis;
348extern int g_iENCToolbarPosX;
349extern int g_iENCToolbarPosY;
351extern bool g_bSpaceDropMark;
353extern bool g_benableUDPNullHeader;
354extern bool g_bShowMenuBar;
355extern bool g_bShowCompassWin;
357extern wxString g_uiStyle;
359extern wxString g_gpx_path;
361extern unsigned int g_canvasConfig;
368static const long long lNaN = 0xfff8000000000000;
369#define NAN (*(double *)&lNaN)
379int GetRandomNumber(
int range_min,
int range_max) {
380 long u = (long)wxRound(
381 ((
double)rand() / ((
double)(RAND_MAX) + 1) * (range_max - range_min)) +
387void appendOSDirSlash(wxString *pString);
397 wxPanel *GetSettingsPanel();
401 wxString templateFileName;
403 wxString m_description;
406OCPNConfigObject::OCPNConfigObject() { Init(); }
408OCPNConfigObject::OCPNConfigObject(
int canvas_config) {
410 m_canvasConfig = canvas_config;
413OCPNConfigObject::~OCPNConfigObject() {}
415void OCPNConfigObject::Init() { m_canvasConfig = 0; }
417#include <wx/listimpl.cpp>
418WX_DEFINE_LIST(ConfigObjectList);
430 bool RemoveConfig(wxString GUID);
432 void SetRootConfigNode(
void);
434 bool SaveFile(
const wxString filename);
435 bool LoadFile(
const wxString filename);
437 pugi::xml_node m_config_root;
440OCPNConfigCatalog::OCPNConfigCatalog() : pugi::xml_document() {}
442OCPNConfigCatalog::~OCPNConfigCatalog() {}
444void OCPNConfigCatalog::SetRootConfigNode(
void) {
445 if (!strlen(m_config_root.name())) {
446 m_config_root = append_child(
"configs");
447 m_config_root.append_attribute(
"version") =
"1.0";
448 m_config_root.append_attribute(
"creator") =
"OpenCPN";
449 m_config_root.append_attribute(
"xmlns:xsi") =
450 "http://www.w3.org/2001/XMLSchema-instance";
451 m_config_root.append_attribute(
"xmlns") =
452 "http://www.topografix.com/GPX/1/1";
453 m_config_root.append_attribute(
"xmlns:gpxx") =
454 "http://www.garmin.com/xmlschemas/GpxExtensions/v3";
455 m_config_root.append_attribute(
"xsi:schemaLocation") =
456 "http://www.topografix.com/GPX/1/1 "
457 "http://www.topografix.com/GPX/1/1/gpx.xsd";
458 m_config_root.append_attribute(
"xmlns:opencpn") =
"http://www.opencpn.org";
462bool OCPNConfigCatalog::IsOpenCPN() {
463 for (pugi::xml_attribute attr = root().first_child().first_attribute(); attr;
464 attr = attr.next_attribute())
465 if (!strcmp(attr.name(),
"creator") && !strcmp(attr.value(),
"OpenCPN"))
470bool OCPNConfigCatalog::SaveFile(
const wxString filename) {
471 save_file(filename.fn_str(),
" ");
475bool OCPNConfigCatalog::LoadFile(
const wxString filename) {
476 load_file(filename.fn_str());
477 m_config_root = this->child(
"configs");
482 unsigned int flags) {
483 pugi::xml_node node = m_config_root.append_child(
"config");
485 node.append_attribute(
"GUID") = config->m_GUID.mb_str();
488 wxCharBuffer abuf = config->m_title.ToUTF8();
490 node.append_attribute(
"title") = abuf.data();
492 node.append_attribute(
"title") = _T(
"Substitute Title");
494 abuf = config->m_description.ToUTF8();
496 node.append_attribute(
"description") = abuf.data();
498 node.append_attribute(
"description") = _T(
"Substitute Description");
500 node.append_attribute(
"templateFile") = config->templateFileName.mb_str();
505bool OCPNConfigCatalog::RemoveConfig(wxString GUID) {
506 for (pugi::xml_node child = m_config_root.first_child(); child;) {
507 pugi::xml_node next = child.next_sibling();
508 const char *guid = child.attribute(
"GUID").value();
510 if (!strcmp(guid, GUID.mb_str())) {
511 child.parent().remove_child(child);
526 wxWindowID
id,
const wxPoint &pos,
const wxSize &size)
527 : wxPanel(parent, id, pos, size, wxSIMPLE_BORDER)
531 wxBoxSizer *mainSizer =
new wxBoxSizer(wxVERTICAL);
534 mainSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Title")));
535 mainSizer->Add(
new wxStaticText(
this, wxID_ANY, config->m_title));
537 mainSizer->Add(
new wxStaticLine(
this, wxID_ANY), 0, wxEXPAND | wxALL, 1);
539 mainSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Description")));
540 mainSizer->Add(
new wxStaticText(
this, wxID_ANY, config->m_description));
542 SetMinSize(wxSize(-1, 6 * GetCharHeight()));
545 GetGlobalColor(_T(
"COMP1"), &colour);
546 SetBackgroundColour(colour);
551ConfigPanel::~ConfigPanel() {}
553void ConfigPanel::OnConfigPanelMouseSelected(wxMouseEvent &event) {
558wxString ConfigPanel::GetConfigGUID() {
return m_config->m_GUID; }
570void ConfigMgr::Shutdown() {
577ConfigMgr::ConfigMgr() {
584ConfigMgr::~ConfigMgr() {
delete configList; }
586void ConfigMgr::Init() {
587 m_configDir = g_Platform->GetPrivateDataDir();
588 appendOSDirSlash(&m_configDir);
589 m_configDir.append(_T(
"Configs"));
590 appendOSDirSlash(&m_configDir);
591 if (!wxFileName::DirExists(m_configDir)) {
592 wxFileName::Mkdir(m_configDir);
595 m_configCatalogName = g_Platform->GetPrivateDataDir();
596 appendOSDirSlash(&m_configCatalogName);
597 m_configCatalogName.append(_T(
"Configs"));
598 appendOSDirSlash(&m_configCatalogName);
599 m_configCatalogName.append(_T(
"configs.xml"));
602 if (!wxFileExists(m_configCatalogName)) {
603 wxLogMessage(_T(
"Creating new Configs catalog: ") + m_configCatalogName);
606 cat->SetRootConfigNode();
607 cat->SaveFile(m_configCatalogName);
613 configList =
new ConfigObjectList;
616 wxString t_title = _(
"Recovery Template");
618 _(
"Apply this template to return to a known safe configuration");
619 CreateNamedConfig(t_title, t_desc,
620 _T(
"11111111-1111-1111-1111-111111111111"));
623bool ConfigMgr::LoadCatalog() {
624 wxLogMessage(_T(
"Loading Configs catalog: ") + m_configCatalogName);
625 m_configCatalog->LoadFile(m_configCatalogName);
628 pugi::xml_node objects = m_configCatalog->child(
"configs");
637 for (pugi::xml_node
object = objects.first_child();
object;
638 object =
object.next_sibling()) {
639 if (!strcmp(
object.name(),
"config")) {
642 wxString::FromUTF8(
object.attribute(
"GUID").as_string());
645 for (ConfigObjectList::Node *node = configList->GetFirst(); node;
646 node = node->GetNext()) {
648 if (look->m_GUID == testGUID) {
658 wxString::FromUTF8(
object.attribute(
"GUID").as_string());
660 wxString::FromUTF8(
object.attribute(
"title").as_string());
661 newConfig->m_description =
662 wxString::FromUTF8(
object.attribute(
"description").as_string());
663 newConfig->templateFileName =
664 wxString::FromUTF8(
object.attribute(
"templateFile").as_string());
667 configList->Append(newConfig);
675bool ConfigMgr::SaveCatalog() {
676 m_configCatalog->SaveFile(m_configCatalogName);
681wxString ConfigMgr::CreateNamedConfig(
const wxString &title,
682 const wxString &description,
687 if (title.IsEmpty())
return GUID;
697 pConfig->m_GUID = GUID;
698 pConfig->m_title = title;
699 pConfig->m_description = description;
701 if (UUID.IsEmpty()) {
703 pConfig->templateFileName = _T(
"OCPNTemplate-") + GUID + _T(
".conf");
706 wxString templateFullFileName = GetConfigDir() + pConfig->templateFileName;
707 if (!SaveTemplate(templateFullFileName)) {
708 wxLogMessage(_T(
"Unable to save template titled: ") + title +
709 _T(
" as file: ") + templateFullFileName);
716 if (!m_configCatalog->AddConfig(pConfig, 0)) {
717 wxLogMessage(_T(
"Unable to add config to catalog...Title: ") + title);
723 configList->Append(pConfig);
725 if (UUID.IsEmpty()) SaveCatalog();
730bool ConfigMgr::DeleteConfig(wxString GUID) {
732 if (!cfg)
return false;
735 wxString templateFullFileName = GetConfigDir() + cfg->templateFileName;
736 if (wxFileExists(templateFullFileName)) wxRemoveFile(templateFullFileName);
739 bool rv = m_configCatalog->RemoveConfig(GUID);
741 if (rv) SaveCatalog();
744 bool bDel = configList->DeleteObject(cfg);
745 if (bDel)
delete cfg;
750wxPanel *ConfigMgr::GetConfigPanel(wxWindow *parent, wxString GUID) {
751 wxPanel *retPanel = NULL;
766 for (ConfigObjectList::Node *node = configList->GetFirst(); node;
767 node = node->GetNext()) {
769 if (look->m_GUID == GUID) {
778wxString ConfigMgr::GetTemplateTitle(wxString GUID) {
779 for (ConfigObjectList::Node *node = configList->GetFirst(); node;
780 node = node->GetNext()) {
782 if (look->m_GUID == GUID) {
783 return look->m_title;
788 return wxEmptyString;
791wxArrayString ConfigMgr::GetConfigGUIDArray() {
792 wxArrayString ret_val;
794 for (ConfigObjectList::Node *node = configList->GetFirst(); node;
795 node = node->GetNext()) {
797 ret_val.Add(look->m_GUID);
803bool ConfigMgr::ApplyConfigGUID(wxString GUID) {
809 wxString thisConfig = GetConfigDir() + config->templateFileName;
812 if (GUID.StartsWith(_T(
"11111111"))) {
814 *GetpSharedDataLocation() + _T(
"configs/OCPNTemplate-Recovery.conf");
820 fconf.LoadMyConfigRaw(
true);
823 fconf.LoadCanvasConfigs(
true);
825 if (ps52plib && ps52plib->m_bOK) fconf.LoadS57Config();
834wxString ConfigMgr::GetUUID(
void) {
839 int time_hi_and_version;
840 int clock_seq_hi_and_rsv;
846 uuid.time_low = GetRandomNumber(
849 uuid.time_mid = GetRandomNumber(0, 65535);
850 uuid.time_hi_and_version = GetRandomNumber(0, 65535);
851 uuid.clock_seq_hi_and_rsv = GetRandomNumber(0, 255);
852 uuid.clock_seq_low = GetRandomNumber(0, 255);
853 uuid.node_hi = GetRandomNumber(0, 65535);
854 uuid.node_low = GetRandomNumber(0, 2147483647);
858 uuid.clock_seq_hi_and_rsv = (uuid.clock_seq_hi_and_rsv & 0x3F) | 0x80;
862 uuid.time_hi_and_version = (uuid.time_hi_and_version & 0x0fff) | 0x4000;
864 str.Printf(_T(
"%08x-%04x-%04x-%02x%02x-%04x%08x"), uuid.time_low,
865 uuid.time_mid, uuid.time_hi_and_version, uuid.clock_seq_hi_and_rsv,
866 uuid.clock_seq_low, uuid.node_hi, uuid.node_low);
871bool ConfigMgr::SaveTemplate(wxString fileName) {
881#ifdef __OCPN__ANDROID__
886 conf->SetPath(_T (
"/Settings" ));
888 conf->Write(_T (
"InlandEcdis" ), g_bInlandEcdis);
889 conf->Write(_T (
"UIexpert" ), g_bUIexpert);
890 conf->Write(_T (
"SpaceDropMark" ), g_bSpaceDropMark);
892 conf->Write(_T (
"ShowStatusBar" ), g_bShowStatusBar);
894 conf->Write(_T (
"ShowMenuBar" ), g_bShowMenuBar);
896 conf->Write(_T (
"DefaultFontSize" ), g_default_font_size);
898 conf->Write(_T (
"Fullscreen" ), g_bFullscreen);
899 conf->Write(_T (
"ShowCompassWindow" ), g_bShowCompassWin);
900 conf->Write(_T (
"SetSystemTime" ), s_bSetSystemTime);
901 conf->Write(_T (
"ShowGrid" ), g_bDisplayGrid);
902 conf->Write(_T (
"PlayShipsBells" ), g_bPlayShipsBells);
903 conf->Write(_T (
"SoundDeviceIndex" ), g_iSoundDeviceIndex);
904 conf->Write(_T (
"FullscreenToolbar" ), g_bFullscreenToolbar);
906 conf->Write(_T (
"PermanentMOBIcon" ), g_bPermanentMOBIcon);
907 conf->Write(_T (
"ShowLayers" ), g_bShowLayers);
908 conf->Write(_T (
"AutoAnchorDrop" ), g_bAutoAnchorMark);
909 conf->Write(_T (
"ShowChartOutlines" ), g_bShowOutlines);
910 conf->Write(_T (
"ShowActiveRouteTotal" ), g_bShowRouteTotal);
911 conf->Write(_T (
"ShowActiveRouteHighway" ), g_bShowActiveRouteHighway);
912 conf->Write(_T (
"SDMMFormat" ), g_iSDMMFormat);
913 conf->Write(_T (
"ShowChartBar" ), g_bShowChartBar);
915 conf->Write(_T (
"GUIScaleFactor" ), g_GUIScaleFactor);
916 conf->Write(_T (
"ChartObjectScaleFactor" ), g_ChartScaleFactor);
917 conf->Write(_T (
"ShipScaleFactor" ), g_ShipScaleFactor);
919 conf->Write(_T (
"ShowTrue" ), g_bShowTrue);
920 conf->Write(_T (
"ShowMag" ), g_bShowMag);
921 conf->Write(_T (
"UserMagVariation" ),
922 wxString::Format(_T(
"%.2f"), g_UserVar));
924 conf->Write(_T (
"CM93DetailFactor" ), g_cm93_zoom_factor);
925 conf->Write(_T (
"CM93DetailZoomPosX" ), g_detailslider_dialog_x);
926 conf->Write(_T (
"CM93DetailZoomPosY" ), g_detailslider_dialog_y);
927 conf->Write(_T (
"ShowCM93DetailSlider" ), g_bShowDetailSlider);
929 conf->Write(_T (
"SkewToNorthUp" ), g_bskew_comp);
931 conf->Write(_T (
"ZoomDetailFactor" ), g_chart_zoom_modifier_raster);
932 conf->Write(_T (
"ZoomDetailFactorVector" ), g_chart_zoom_modifier_vector);
934 conf->Write(_T (
"SmoothPanZoom" ), g_bsmoothpanzoom);
936 conf->Write(_T (
"CourseUpMode" ), g_bCourseUp);
937 if (!g_bInlandEcdis) conf->Write(_T (
"LookAheadMode" ), g_bLookAhead);
938 conf->Write(_T (
"COGUPAvgSeconds" ), g_COGAvgSec);
939 conf->Write(_T (
"UseMagAPB" ), g_bMagneticAPB);
941 conf->Write(_T (
"OwnshipCOGPredictorMinutes" ), g_ownship_predictor_minutes);
942 conf->Write(_T (
"OwnshipCOGPredictorWidth" ), g_cog_predictor_width);
943 conf->Write(_T (
"OwnshipHDTPredictorMiles" ), g_ownship_HDTpredictor_miles);
944 conf->Write(_T (
"OwnShipIconType" ), g_OwnShipIconType);
945 conf->Write(_T (
"OwnShipLength" ), g_n_ownship_length_meters);
946 conf->Write(_T (
"OwnShipWidth" ), g_n_ownship_beam_meters);
947 conf->Write(_T (
"OwnShipGPSOffsetX" ), g_n_gps_antenna_offset_x);
948 conf->Write(_T (
"OwnShipGPSOffsetY" ), g_n_gps_antenna_offset_y);
949 conf->Write(_T (
"OwnShipMinSize" ), g_n_ownship_min_mm);
950 conf->Write(_T (
"OwnShipSogCogCalc" ), g_own_ship_sog_cog_calc);
951 conf->Write(_T (
"OwnShipSogCogCalcDampSec"),
952 g_own_ship_sog_cog_calc_damp_sec);
954 conf->Write(_T (
"RouteArrivalCircleRadius" ),
955 wxString::Format(_T(
"%.3f"), g_n_arrival_circle_radius));
956 conf->Write(_T (
"ChartQuilting" ), g_bQuiltEnable);
958 conf->Write(_T (
"StartWithTrackActive" ), g_bTrackCarryOver);
959 conf->Write(_T (
"AutomaticDailyTracks" ), g_bTrackDaily);
960 conf->Write(_T (
"TrackRotateAt" ), g_track_rotate_time);
961 conf->Write(_T (
"TrackRotateTimeType" ), g_track_rotate_time_type);
962 conf->Write(_T (
"HighlightTracks" ), g_bHighliteTracks);
964 conf->Write(_T (
"InitialStackIndex" ), g_restore_stackindex);
965 conf->Write(_T (
"InitialdBIndex" ), g_restore_dbindex);
967 conf->Write(_T (
"AnchorWatch1GUID" ), g_AW1GUID);
968 conf->Write(_T (
"AnchorWatch2GUID" ), g_AW2GUID);
970 conf->Write(_T (
"ToolbarX" ), g_maintoolbar_x);
971 conf->Write(_T (
"ToolbarY" ), g_maintoolbar_y);
972 conf->Write(_T (
"ToolbarOrient" ), g_maintoolbar_orient);
974 conf->Write(_T (
"iENCToolbarX" ), g_iENCToolbarPosX);
975 conf->Write(_T (
"iENCToolbarY" ), g_iENCToolbarPosY);
977 if (!g_bInlandEcdis) {
978 conf->Write(_T (
"GlobalToolbarConfig" ), g_toolbarConfig);
979 conf->Write(_T (
"DistanceFormat" ), g_iDistanceFormat);
980 conf->Write(_T (
"SpeedFormat" ), g_iSpeedFormat);
981 conf->Write(_T (
"ShowDepthUnits" ), g_bShowDepthUnits);
984 conf->Write(_T (
"MobileTouch" ), g_btouch);
985 conf->Write(_T (
"ResponsiveGraphics" ), g_bresponsive);
987 conf->Write(_T (
"AutoHideToolbar" ), g_bAutoHideToolbar);
988 conf->Write(_T (
"AutoHideToolbarSecs" ), g_nAutoHideToolbar);
990 conf->Write(_T (
"DisplaySizeMM" ), g_config_display_size_mm);
991 conf->Write(_T (
"DisplaySizeManual" ), g_config_display_size_manual);
993 conf->Write(_T (
"PlanSpeed" ), wxString::Format(_T(
"%.2f"), g_PlanSpeed));
997 LayerList::iterator it;
999 for( it = ( *pLayerList ).begin(); it != ( *pLayerList ).end(); ++it, ++index ) {
1001 if( lay->IsVisibleOnChart() ) vis += ( lay->m_LayerName ) + _T(
";");
1003 invis += ( lay->m_LayerName ) + _T(
";");
1005 conf->Write( _T (
"VisibleLayers" ), vis );
1006 conf->Write( _T (
"InvisibleLayers" ), invis );
1009 conf->Write(_T (
"Locale" ), g_locale);
1010 conf->Write(_T (
"LocaleOverride" ), g_localeOverride);
1013 conf->Write(_T(
"LiveETA" ), g_bShowLiveETA);
1014 conf->Write(_T(
"DefaultBoatSpeed" ), g_defaultBoatSpeed);
1017 conf->SetPath(_T (
"/Settings/ObjectFilter" ));
1020 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
1022 OBJLElement *pOLE = (OBJLElement *)(ps52plib->pOBJLArray->Item(iPtr));
1024 wxString st1(_T (
"viz" ));
1026 strncpy(name, pOLE->OBJLName, 6);
1028 st1.Append(wxString(name, wxConvUTF8));
1029 conf->Write(st1, pOLE->nViz);
1035 conf->SetPath(_T (
"/Settings/GlobalState" ));
1038 if (!g_bInlandEcdis)
1039 conf->Write(_T (
"nColorScheme" ), (
int)gFrame->GetColorScheme());
1042 conf->SetPath(_T (
"/Settings/AIS" ));
1044 conf->Write(_T (
"bNoCPAMax" ), g_bCPAMax);
1045 conf->Write(_T (
"NoCPAMaxNMi" ), g_CPAMax_NM);
1046 conf->Write(_T (
"bCPAWarn" ), g_bCPAWarn);
1047 conf->Write(_T (
"CPAWarnNMi" ), g_CPAWarn_NM);
1048 conf->Write(_T (
"bTCPAMax" ), g_bTCPA_Max);
1049 conf->Write(_T (
"TCPAMaxMinutes" ), g_TCPA_Max);
1050 conf->Write(_T (
"bMarkLostTargets" ), g_bMarkLost);
1051 conf->Write(_T (
"MarkLost_Minutes" ), g_MarkLost_Mins);
1052 conf->Write(_T (
"bRemoveLostTargets" ), g_bRemoveLost);
1053 conf->Write(_T (
"RemoveLost_Minutes" ), g_RemoveLost_Mins);
1054 conf->Write(_T (
"bShowCOGArrows" ), g_bShowCOG);
1055 conf->Write(_T (
"CogArrowMinutes" ), g_ShowCOG_Mins);
1056 conf->Write(_T (
"bShowTargetTracks" ), g_bAISShowTracks);
1057 conf->Write(_T (
"TargetTracksMinutes" ), g_AISShowTracks_Mins);
1059 conf->Write(_T (
"bHideMooredTargets" ), g_bHideMoored);
1060 conf->Write(_T (
"MooredTargetMaxSpeedKnots" ), g_ShowMoored_Kts);
1062 conf->Write(_T (
"bAISAlertDialog" ), g_bAIS_CPA_Alert);
1063 conf->Write(_T (
"bAISAlertAudio" ), g_bAIS_CPA_Alert_Audio);
1064 conf->Write(_T (
"AISAlertAudioFile" ), g_sAIS_Alert_Sound_File);
1065 conf->Write(_T (
"bAISAlertSuppressMoored" ),
1066 g_bAIS_CPA_Alert_Suppress_Moored);
1067 conf->Write(_T (
"bShowAreaNotices" ), g_bShowAreaNotices);
1068 conf->Write(_T (
"bDrawAISSize" ), g_bDrawAISSize);
1069 conf->Write(_T (
"bDrawAISRealtime" ), g_bDrawAISRealtime);
1070 conf->Write(_T (
"AISRealtimeMinSpeedKnots" ), g_AIS_RealtPred_Kts);
1071 conf->Write(_T (
"bShowAISName" ), g_bShowAISName);
1072 conf->Write(_T (
"ShowAISTargetNameScale" ), g_Show_Target_Name_Scale);
1073 conf->Write(_T (
"bWplIsAprsPositionReport" ), g_bWplUsePosition);
1074 conf->Write(_T (
"WplSelAction" ), g_WplAction);
1075 conf->Write(_T (
"AISCOGPredictorWidth" ), g_ais_cog_predictor_width);
1076 conf->Write(_T (
"bShowScaledTargets" ), g_bAllowShowScaled);
1077 conf->Write(_T (
"AISScaledNumber" ), g_ShowScaled_Num);
1078 conf->Write(_T (
"AISScaledNumberWeightSOG" ), g_ScaledNumWeightSOG);
1079 conf->Write(_T (
"AISScaledNumberWeightCPA" ), g_ScaledNumWeightCPA);
1080 conf->Write(_T (
"AISScaledNumberWeightTCPA" ), g_ScaledNumWeightTCPA);
1081 conf->Write(_T (
"AISScaledNumberWeightRange" ), g_ScaledNumWeightRange);
1082 conf->Write(_T (
"AISScaledNumberWeightSizeOfTarget" ),
1083 g_ScaledNumWeightSizeOfT);
1084 conf->Write(_T (
"AISScaledSizeMinimal" ), g_ScaledSizeMinimal);
1085 conf->Write(_T (
"AISShowScaled"), g_bShowScaled);
1087 conf->Write(_T (
"AlertDialogSizeX" ), g_ais_alert_dialog_sx);
1088 conf->Write(_T (
"AlertDialogSizeY" ), g_ais_alert_dialog_sy);
1089 conf->Write(_T (
"AlertDialogPosX" ), g_ais_alert_dialog_x);
1090 conf->Write(_T (
"AlertDialogPosY" ), g_ais_alert_dialog_y);
1091 conf->Write(_T (
"QueryDialogPosX" ), g_ais_query_dialog_x);
1092 conf->Write(_T (
"QueryDialogPosY" ), g_ais_query_dialog_y);
1093 conf->Write(_T (
"AISTargetListPerspective" ), g_AisTargetList_perspective);
1094 conf->Write(_T (
"AISTargetListRange" ), g_AisTargetList_range);
1095 conf->Write(_T (
"AISTargetListSortColumn" ), g_AisTargetList_sortColumn);
1096 conf->Write(_T (
"bAISTargetListSortReverse" ), g_bAisTargetList_sortReverse);
1097 conf->Write(_T (
"AISTargetListColumnSpec" ), g_AisTargetList_column_spec);
1098 conf->Write(_T (
"AISTargetListColumnOrder" ), g_AisTargetList_column_order);
1099 conf->Write(_T (
"S57QueryDialogSizeX" ), g_S57_dialog_sx);
1100 conf->Write(_T (
"S57QueryDialogSizeY" ), g_S57_dialog_sy);
1101 conf->Write(_T (
"bAISRolloverShowClass" ), g_bAISRolloverShowClass);
1102 conf->Write(_T (
"bAISRolloverShowCOG" ), g_bAISRolloverShowCOG);
1103 conf->Write(_T (
"bAISRolloverShowCPA" ), g_bAISRolloverShowCPA);
1104 conf->Write(_T (
"bAISAlertAckTimeout" ), g_bAIS_ACK_Timeout);
1105 conf->Write(_T (
"AlertAckTimeoutMinutes" ), g_AckTimeout_Mins);
1107 conf->SetPath(_T (
"/Settings/GlobalState" ));
1109 conf->Write(_T (
"bShowS57Text" ), ps52plib->GetShowS57Text());
1110 conf->Write(_T (
"bShowS57ImportantTextOnly" ),
1111 ps52plib->GetShowS57ImportantTextOnly());
1112 if (!g_bInlandEcdis)
1113 conf->Write(_T (
"nDisplayCategory" ),
1114 (
long)ps52plib->GetDisplayCategory());
1115 conf->Write(_T (
"nSymbolStyle" ), (
int)ps52plib->m_nSymbolStyle);
1116 conf->Write(_T (
"nBoundaryStyle" ), (
int)ps52plib->m_nBoundaryStyle);
1118 conf->Write(_T (
"bShowSoundg" ), ps52plib->m_bShowSoundg);
1119 conf->Write(_T (
"bShowMeta" ), ps52plib->m_bShowMeta);
1120 conf->Write(_T (
"bUseSCAMIN" ), ps52plib->m_bUseSCAMIN);
1121 conf->Write(_T (
"bUseSUPER_SCAMIN" ), ps52plib->m_bUseSUPER_SCAMIN);
1122 conf->Write(_T (
"bShowAtonText" ), ps52plib->m_bShowAtonText);
1123 conf->Write(_T (
"bShowLightDescription" ), ps52plib->m_bShowLdisText);
1124 conf->Write(_T (
"bExtendLightSectors" ), ps52plib->m_bExtendLightSectors);
1125 conf->Write(_T (
"bDeClutterText" ), ps52plib->m_bDeClutterText);
1126 conf->Write(_T (
"bShowNationalText" ), ps52plib->m_bShowNationalTexts);
1128 conf->Write(_T (
"S52_MAR_SAFETY_CONTOUR" ),
1129 S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR));
1130 conf->Write(_T (
"S52_MAR_SHALLOW_CONTOUR" ),
1131 S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR));
1132 conf->Write(_T (
"S52_MAR_DEEP_CONTOUR" ),
1133 S52_getMarinerParam(S52_MAR_DEEP_CONTOUR));
1134 conf->Write(_T (
"S52_MAR_TWO_SHADES" ),
1135 S52_getMarinerParam(S52_MAR_TWO_SHADES));
1136 conf->Write(_T (
"S52_DEPTH_UNIT_SHOW" ), ps52plib->m_nDepthUnitDisplay);
1139 conf->SetPath(_T (
"/Settings/Others" ));
1142 conf->Write(_T (
"ShowRadarRings" ), (
bool)(g_iNavAidRadarRingsNumberVisible >
1144 conf->Write(_T (
"RadarRingsNumberVisible" ),
1145 g_iNavAidRadarRingsNumberVisible);
1146 conf->Write(_T (
"RadarRingsStep" ), g_fNavAidRadarRingsStep);
1147 conf->Write(_T (
"RadarRingsStepUnits" ), g_pNavAidRadarRingsStepUnits);
1148 conf->Write(_T (
"RadarRingsColour" ),
1149 g_colourOwnshipRangeRingsColour.GetAsString(wxC2S_HTML_SYNTAX));
1152 conf->Write(_T (
"WaypointRangeRingsNumber" ), g_iWaypointRangeRingsNumber);
1153 conf->Write(_T (
"WaypointRangeRingsStep" ), g_fWaypointRangeRingsStep);
1154 conf->Write(_T (
"WaypointRangeRingsStepUnits" ),
1155 g_iWaypointRangeRingsStepUnits);
1156 conf->Write(_T (
"WaypointRangeRingsColour" ),
1157 g_colourWaypointRangeRingsColour.GetAsString(wxC2S_HTML_SYNTAX));
1159 conf->Write(_T (
"ConfirmObjectDeletion" ), g_bConfirmObjectDelete);
1162 conf->Write(_T (
"WaypointPreventDragging" ), g_bWayPointPreventDragging);
1164 conf->Write(_T (
"EnableZoomToCursor" ), g_bEnableZoomToCursor);
1166 conf->Write(_T (
"TrackIntervalSeconds" ), g_TrackIntervalSeconds);
1167 conf->Write(_T (
"TrackDeltaDistance" ), g_TrackDeltaDistance);
1168 conf->Write(_T (
"TrackPrecision" ), g_nTrackPrecision);
1170 conf->Write(_T (
"RouteLineWidth" ), g_route_line_width);
1171 conf->Write(_T (
"TrackLineWidth" ), g_track_line_width);
1172 conf->Write(_T (
"TrackLineColour" ),
1173 g_colourTrackLineColour.GetAsString(wxC2S_HTML_SYNTAX));
1174 conf->Write(_T (
"DefaultWPIcon" ), g_default_wp_icon);
1179 conf->SetPath(_T (
"/Settings/AuxFontKeys" ));
1181 wxArrayString keyArray = FontMgr::Get().GetAuxKeyArray();
1182 for (
unsigned int i = 0; i < keyArray.GetCount(); i++) {
1184 key.Printf(_T(
"Key%i"), i);
1185 wxString keyval = keyArray[i];
1186 conf->Write(key, keyval);
1191 font_path = (_T (
"/Settings/X11Fonts" ));
1195 font_path = (_T (
"/Settings/GTKFonts" ));
1199 font_path = (_T (
"/Settings/MSWFonts" ));
1203 font_path = (_T (
"/Settings/MacFonts" ));
1207 font_path = (_T (
"/Settings/QTFonts" ));
1210 conf->DeleteGroup(font_path);
1212 conf->SetPath(font_path);
1214 int nFonts = FontMgr::Get().GetNumFonts();
1216 for (
int i = 0; i < nFonts; i++) {
1217 wxString cfstring(FontMgr::Get().GetConfigString(i));
1218 wxString valstring = FontMgr::Get().GetFullConfigDesc(i);
1219 conf->Write(cfstring, valstring);
1223 conf->SaveCanvasConfigs();
1232bool ConfigMgr::CheckTemplateGUID(wxString GUID) {
1237 rv = CheckTemplate(GetConfigDir() + config->templateFileName);
1243#define CHECK_INT(s, t) \
1245 if (!conf->Read(s, &read_int)) wxLogMessage(s); \
1246 if ((int)*t != read_int) return false;
1248#define CHECK_STR(s, t) \
1250 conf->Read(s, &val); \
1251 if (!t.IsSameAs(val)) return false;
1253#define CHECK_STRP(s, t) \
1254 conf->Read(s, &val); \
1255 if (!t->IsSameAs(val)) return false;
1257#define CHECK_FLT(s, t, eps) \
1258 conf->Read(s, &val); \
1259 val.ToDouble(&dval); \
1260 if (fabs(dval - *t) > eps) return false;
1262bool ConfigMgr::CheckTemplate(wxString fileName) {
1272 conf->SetPath(_T (
"/Settings" ));
1274 CHECK_INT(_T (
"UIexpert" ), &g_bUIexpert);
1278 CHECK_INT(_T (
"InlandEcdis" ), &g_bInlandEcdis);
1280 CHECK_INT(_T(
"SpaceDropMark" ), &g_bSpaceDropMark);
1285 CHECK_INT( _T (
"DebugGDAL" ), &g_bGDAL_Debug );
1286 CHECK_INT( _T (
"DebugNMEA" ), &g_nNMEADebug );
1287 CHECK_INT( _T (
"DebugOpenGL" ), &g_bDebugOGL );
1291 CHECK_INT( _T (
"DebugCM93" ), &g_bDebugCM93 );
1292 CHECK_INT( _T (
"DebugS57" ), &g_bDebugS57 );
1293 CHECK_INT( _T (
"DebugBSBImg" ), &g_BSBImgDebug );
1294 CHECK_INT( _T (
"DebugGPSD" ), &g_bDebugGPSD );
1297 CHECK_INT(_T (
"DefaultFontSize"), &g_default_font_size);
1300 CHECK_INT(_T (
"UseGarminHostUpload" ), &g_bGarminHostUpload);
1302 CHECK_INT(_T (
"UseNMEA_GLL" ), &g_bUseGLL);
1304 CHECK_INT(_T (
"AutoHideToolbar" ), &g_bAutoHideToolbar);
1305 CHECK_INT(_T (
"AutoHideToolbarSecs" ), &g_nAutoHideToolbar);
1307 CHECK_INT(_T (
"UseSimplifiedScalebar" ), &g_bsimplifiedScalebar);
1309 CHECK_INT(_T (
"DisplaySizeMM" ), &g_display_size_mm);
1310 CHECK_INT(_T (
"DisplaySizeManual" ), &g_config_display_size_manual);
1312 CHECK_INT(_T (
"GUIScaleFactor" ), &g_GUIScaleFactor);
1314 CHECK_INT(_T (
"ChartObjectScaleFactor" ), &g_ChartScaleFactor);
1315 CHECK_INT(_T (
"ShipScaleFactor" ), &g_ShipScaleFactor);
1317 CHECK_INT(_T (
"FilterNMEA_Avg" ), &g_bfilter_cogsog);
1318 CHECK_INT(_T (
"FilterNMEA_Sec" ), &g_COGFilterSec);
1320 CHECK_INT(_T (
"ShowTrue" ), &g_bShowTrue);
1321 CHECK_INT(_T (
"ShowMag" ), &g_bShowMag);
1323 CHECK_FLT(_T (
"UserMagVariation" ), &g_UserVar, 0.1)
1325 CHECK_INT(_T ( "UseMagAPB" ), &g_bMagneticAPB);
1327 CHECK_INT(_T ( "ScreenBrightness" ), &g_nbrightness);
1329 CHECK_INT(_T ( "MemFootprintTargetMB" ), &g_MemFootMB);
1331 CHECK_INT(_T ( "WindowsComPortMax" ), &g_nCOMPortCheck);
1333 CHECK_INT(_T ( "ChartQuilting" ), &g_bQuiltEnable);
1334 CHECK_INT(_T ( "ChartQuiltingInitial" ), &g_bQuiltStart);
1336 CHECK_INT(_T ( "CourseUpMode" ), &g_bCourseUp);
1337 CHECK_INT(_T ( "COGUPAvgSeconds" ), &g_COGAvgSec);
1340 CHECK_INT(_T ( "OpenGL" ), &g_bopengl);
1341 CHECK_INT(_T ( "SoftwareGL" ), &g_bSoftwareGL);
1343 CHECK_INT(_T ( "ShowFPS" ), &g_bShowFPS);
1345 CHECK_INT(_T( "NMEAAPBPrecision" ), &g_NMEAAPBPrecision);
1347 CHECK_STR(_T( "TalkerIdText" ), g_TalkerIdText);
1348 CHECK_INT(_T( "MaxWaypointNameLength" ), &g_maxWPNameLength);
1352 CHECK_INT(_T (
"OpenGLExpert" ), &g_bGLexpert);
1353 CHECK_INT(_T (
"UseAcceleratedPanning" ),
1354 &g_GLOptions.m_bUseAcceleratedPanning);
1355 CHECK_INT(_T (
"GPUTextureCompression" ), &g_GLOptions.m_bTextureCompression);
1356 CHECK_INT(_T (
"GPUTextureCompressionCaching" ),
1357 &g_GLOptions.m_bTextureCompressionCaching);
1358 CHECK_INT(_T (
"PolygonSmoothing" ), &g_GLOptions.m_GLPolygonSmoothing);
1359 CHECK_INT(_T (
"LineSmoothing" ), &g_GLOptions.m_GLLineSmoothing);
1360 CHECK_INT(_T (
"GPUTextureDimension" ), &g_GLOptions.m_iTextureDimension);
1361 CHECK_INT(_T (
"GPUTextureMemSize" ), &g_GLOptions.m_iTextureMemorySize);
1364 CHECK_INT(_T (
"SmoothPanZoom" ), &g_bsmoothpanzoom);
1366 CHECK_INT(_T (
"ToolbarX"), &g_maintoolbar_x);
1367 CHECK_INT(_T (
"ToolbarY" ), &g_maintoolbar_y);
1368 CHECK_INT(_T (
"ToolbarOrient" ), &g_maintoolbar_orient);
1369 CHECK_STR(_T (
"GlobalToolbarConfig" ), g_toolbarConfig);
1371 CHECK_INT(_T (
"iENCToolbarX"), &g_iENCToolbarPosX);
1372 CHECK_INT(_T (
"iENCToolbarY"), &g_iENCToolbarPosY);
1374 CHECK_STR(_T (
"AnchorWatch1GUID" ), g_AW1GUID);
1375 CHECK_STR(_T (
"AnchorWatch2GUID" ), g_AW2GUID);
1377 CHECK_INT(_T (
"MobileTouch" ), &g_btouch);
1378 CHECK_INT(_T (
"ResponsiveGraphics" ), &g_bresponsive);
1380 CHECK_INT(_T (
"ZoomDetailFactor" ), &g_chart_zoom_modifier_raster);
1381 CHECK_INT(_T (
"ZoomDetailFactorVector" ), &g_chart_zoom_modifier_vector);
1383 CHECK_INT(_T (
"CM93DetailFactor" ), &g_cm93_zoom_factor);
1384 CHECK_INT(_T (
"CM93DetailZoomPosX" ), &g_detailslider_dialog_x);
1385 CHECK_INT(_T (
"CM93DetailZoomPosY" ), &g_detailslider_dialog_y);
1386 CHECK_INT(_T (
"ShowCM93DetailSlider" ), &g_bShowDetailSlider);
1388 CHECK_INT(_T (
"SENC_LOD_Pixels" ), &g_SENC_LOD_pixels);
1390 CHECK_INT(_T (
"SkewCompUpdatePeriod" ), &g_SkewCompUpdatePeriod);
1392 CHECK_INT(_T (
"ShowStatusBar" ), &g_bShowStatusBar);
1394 CHECK_INT(_T (
"ShowMenuBar" ), &g_bShowMenuBar);
1396 CHECK_INT(_T (
"Fullscreen" ), &g_bFullscreen);
1397 CHECK_INT(_T (
"ShowCompassWindow" ), &g_bShowCompassWin);
1398 CHECK_INT(_T (
"PlayShipsBells" ), &g_bPlayShipsBells);
1399 CHECK_INT(_T (
"SoundDeviceIndex" ), &g_iSoundDeviceIndex);
1400 CHECK_INT(_T (
"FullscreenToolbar" ), &g_bFullscreenToolbar);
1402 CHECK_INT(_T (
"PermanentMOBIcon" ), &g_bPermanentMOBIcon);
1403 CHECK_INT(_T (
"ShowLayers" ), &g_bShowLayers);
1404 CHECK_INT(_T (
"ShowDepthUnits" ), &g_bShowDepthUnits);
1405 CHECK_INT(_T (
"AutoAnchorDrop" ), &g_bAutoAnchorMark);
1406 CHECK_INT(_T (
"ShowActiveRouteHighway" ), &g_bShowActiveRouteHighway);
1407 CHECK_INT(_T (
"ShowActiveRouteTotal" ), &g_bShowRouteTotal);
1408 CHECK_STR(_T (
"MostRecentGPSUploadConnection" ), g_uploadConnection);
1409 CHECK_INT(_T (
"ShowChartBar" ), &g_bShowChartBar);
1410 CHECK_INT(_T (
"SDMMFormat" ),
1414 CHECK_INT(_T (
"DistanceFormat" ),
1415 &g_iDistanceFormat);
1417 CHECK_INT(_T (
"SpeedFormat" ),
1421 CHECK_INT(_T (
"LiveETA" ), &g_bShowLiveETA);
1422 CHECK_INT(_T (
"DefaultBoatSpeed" ), &g_defaultBoatSpeed);
1424 CHECK_INT(_T (
"OwnshipCOGPredictorMinutes" ), &g_ownship_predictor_minutes);
1425 CHECK_INT(_T (
"OwnshipCOGPredictorWidth" ), &g_cog_predictor_width);
1426 CHECK_INT(_T (
"OwnshipHDTPredictorMiles" ), &g_ownship_HDTpredictor_miles);
1428 CHECK_INT(_T (
"OwnShipIconType" ), &g_OwnShipIconType);
1429 CHECK_FLT(_T (
"OwnShipLength" ), &g_n_ownship_length_meters, 0.1);
1430 CHECK_FLT(_T (
"OwnShipWidth" ), &g_n_ownship_beam_meters, 0.1);
1431 CHECK_FLT(_T (
"OwnShipGPSOffsetX" ), &g_n_gps_antenna_offset_x, 0.1);
1432 CHECK_FLT(_T (
"OwnShipGPSOffsetY" ), &g_n_gps_antenna_offset_y, 0.1);
1433 CHECK_INT(_T (
"OwnShipMinSize" ), &g_n_ownship_min_mm);
1434 CHECK_INT(_T (
"OwnShipSogCogCalc" ), &g_own_ship_sog_cog_calc);
1435 CHECK_INT(_T (
"OwnShipSogCogCalcDampSec"),
1436 &g_own_ship_sog_cog_calc_damp_sec);
1438 CHECK_FLT(_T (
"RouteArrivalCircleRadius" ), &g_n_arrival_circle_radius, .01);
1440 CHECK_INT(_T (
"FullScreenQuilt" ), &g_bFullScreenQuilt);
1442 CHECK_INT(_T (
"StartWithTrackActive" ), &g_bTrackCarryOver);
1443 CHECK_INT(_T (
"AutomaticDailyTracks" ), &g_bTrackDaily);
1444 CHECK_INT(_T (
"TrackRotateAt" ), &g_track_rotate_time);
1445 CHECK_INT(_T (
"TrackRotateTimeType" ), &g_track_rotate_time_type);
1446 CHECK_INT(_T (
"HighlightTracks" ), &g_bHighliteTracks);
1448 CHECK_FLT(_T (
"PlanSpeed" ), &g_PlanSpeed, 0.1)
1453 CHECK_INT(_T ( "PreserveScaleOnX" ), &g_bPreserveScaleOnX);
1455 CHECK_STR(_T ( "Locale" ), g_locale);
1456 CHECK_STR(_T ( "LocaleOverride" ), g_localeOverride);
1459 CHECK_INT(_T ( "KeepNavobjBackups" ), &g_navobjbackups);
1469 CHECK_INT(_T ( "LegacyInputCOMPortFilterBehaviour" ),
1470 &g_b_legacy_input_filter_behaviour);
1472 CHECK_INT(_T( "AdvanceRouteWaypointOnArrivalOnly" ),
1473 &g_bAdvanceRouteWaypointOnArrivalOnly);
1475 CHECK_INT(_T ( "EnableRotateKeys" ), &g_benable_rotate);
1476 CHECK_INT(_T ( "EmailCrashReport" ), &g_bEmailCrashReport);
1478 CHECK_INT(_T ( "EnableAISNameCache" ), &g_benableAISNameCache);
1480 CHECK_INT(_T ( "EnableUDPNullHeader" ), &g_benableUDPNullHeader);
1482 conf->SetPath(_T ( "/Settings/GlobalState" ));
1484 CHECK_INT(_T ( "FrameWinX" ), &g_nframewin_x);
1485 CHECK_INT(_T ( "FrameWinY" ), &g_nframewin_y);
1486 CHECK_INT(_T ( "FrameWinPosX" ), &g_nframewin_posx);
1487 CHECK_INT(_T ( "FrameWinPosY" ), &g_nframewin_posy);
1488 CHECK_INT(_T ( "FrameMax" ), &g_bframemax);
1490 CHECK_INT(_T ( "ClientPosX" ), &g_lastClientRectx);
1491 CHECK_INT(_T ( "ClientPosY" ), &g_lastClientRecty);
1492 CHECK_INT(_T ( "ClientSzX" ), &g_lastClientRectw);
1493 CHECK_INT(_T ( "ClientSzY" ), &g_lastClientRecth);
1495 CHECK_INT(_T( "RoutePropSizeX" ), &g_route_prop_sx);
1496 CHECK_INT(_T( "RoutePropSizeY" ), &g_route_prop_sy);
1497 CHECK_INT(_T( "RoutePropPosX" ), &g_route_prop_x);
1498 CHECK_INT(_T( "RoutePropPosY" ), &g_route_prop_y);
1500 CHECK_INT(_T ( "S52_DEPTH_UNIT_SHOW" ),
1501 &g_nDepthUnitDisplay);
1504 conf->SetPath(_T ( "/Settings/AIS" ));
1505 CHECK_INT(_T ( "bNoCPAMax" ), &g_bCPAMax);
1506 CHECK_FLT(_T ( "NoCPAMaxNMi" ), &g_CPAMax_NM, .01)
1507 CHECK_INT(_T ( "bCPAWarn" ), &g_bCPAWarn);
1508 CHECK_FLT(_T ( "CPAWarnNMi" ), &g_CPAWarn_NM, .01)
1509 CHECK_INT(_T ( "bTCPAMax" ), &g_bTCPA_Max);
1510 CHECK_FLT(_T ( "TCPAMaxMinutes" ), &g_TCPA_Max, 1)
1511 CHECK_INT(_T ( "bMarkLostTargets" ), &g_bMarkLost);
1512 CHECK_FLT(_T ( "MarkLost_Minutes" ), &g_MarkLost_Mins, 1)
1513 CHECK_INT(_T ( "bRemoveLostTargets" ), &g_bRemoveLost);
1514 CHECK_FLT(_T ( "RemoveLost_Minutes" ), &g_RemoveLost_Mins, 1)
1515 CHECK_INT(_T ( "bShowCOGArrows" ), &g_bShowCOG);
1516 CHECK_INT(_T ( "bSyncCogPredictors" ), &g_bSyncCogPredictors);
1517 CHECK_FLT(_T ( "CogArrowMinutes" ), &g_ShowCOG_Mins, 1);
1518 CHECK_INT(_T ( "bShowTargetTracks" ), &g_bAISShowTracks);
1519 CHECK_FLT(_T ( "TargetTracksMinutes" ), &g_AISShowTracks_Mins, 1)
1520 CHECK_FLT(_T ( "TargetTracksLimit" ), &g_AISShowTracks_Limit, 300)
1521 CHECK_INT(_T ( "bHideMooredTargets" ), &g_bHideMoored)
1522 CHECK_FLT(_T ( "MooredTargetMaxSpeedKnots" ), &g_ShowMoored_Kts, .1)
1523 CHECK_INT(_T ( "bShowScaledTargets"), &g_bAllowShowScaled);
1524 CHECK_INT(_T ( "AISScaledNumber" ), &g_ShowScaled_Num);
1525 CHECK_INT(_T ( "AISScaledNumberWeightSOG" ), &g_ScaledNumWeightSOG);
1526 CHECK_INT(_T ( "AISScaledNumberWeightCPA" ), &g_ScaledNumWeightCPA);
1527 CHECK_INT(_T ( "AISScaledNumberWeightTCPA" ), &g_ScaledNumWeightTCPA);
1528 CHECK_INT(_T ( "AISScaledNumberWeightRange" ), &g_ScaledNumWeightRange);
1529 CHECK_INT(_T ( "AISScaledNumberWeightSizeOfTarget" ),
1530 &g_ScaledNumWeightSizeOfT);
1531 CHECK_INT(_T ( "AISScaledSizeMinimal" ), &g_ScaledSizeMinimal);
1532 CHECK_INT(_T( "AISShowScaled"), &g_bShowScaled);
1533 CHECK_INT(_T ( "bShowAreaNotices" ), &g_bShowAreaNotices);
1534 CHECK_INT(_T ( "bDrawAISSize" ), &g_bDrawAISSize);
1535 CHECK_INT(_T ( "bDrawAISRealtime" ), &g_bDrawAISRealtime);
1536 CHECK_FLT(_T ( "AISRealtimeMinSpeedKnots" ), &g_AIS_RealtPred_Kts, .1);
1537 CHECK_INT(_T ( "bShowAISName" ), &g_bShowAISName);
1538 CHECK_INT(_T ( "bAISAlertDialog" ), &g_bAIS_CPA_Alert);
1539 CHECK_INT(_T ( "ShowAISTargetNameScale" ), &g_Show_Target_Name_Scale);
1540 CHECK_INT(_T ( "bWplIsAprsPositionReport" ), &g_bWplUsePosition);
1541 CHECK_INT(_T ( "WplSelAction" ), &g_WplAction);
1542 CHECK_INT(_T ( "AISCOGPredictorWidth" ), &g_ais_cog_predictor_width);
1543 CHECK_INT(_T ( "bAISAlertAudio" ), &g_bAIS_CPA_Alert_Audio);
1544 CHECK_STR(_T ( "AISAlertAudioFile" ), g_sAIS_Alert_Sound_File);
1545 CHECK_INT(_T ( "bAISAlertSuppressMoored" ),
1546 &g_bAIS_CPA_Alert_Suppress_Moored);
1547 CHECK_INT(_T ( "bAISAlertAckTimeout" ), &g_bAIS_ACK_Timeout);
1548 CHECK_FLT(_T ( "AlertAckTimeoutMinutes" ), &g_AckTimeout_Mins, 1)
1549 CHECK_STR(_T ( "AISTargetListPerspective" ), g_AisTargetList_perspective);
1550 CHECK_INT(_T ( "AISTargetListRange" ), &g_AisTargetList_range);
1551 CHECK_INT(_T ( "AISTargetListSortColumn" ), &g_AisTargetList_sortColumn);
1552 CHECK_INT(_T ( "bAISTargetListSortReverse" ), &g_bAisTargetList_sortReverse);
1553 CHECK_STR(_T ( "AISTargetListColumnSpec" ), g_AisTargetList_column_spec);
1554 CHECK_STR(_T ("AISTargetListColumnOrder"), g_AisTargetList_column_order);
1555 CHECK_INT(_T ( "bAISRolloverShowClass" ), &g_bAISRolloverShowClass);
1556 CHECK_INT(_T ( "bAISRolloverShowCOG" ), &g_bAISRolloverShowCOG);
1557 CHECK_INT(_T ( "bAISRolloverShowCPA" ), &g_bAISRolloverShowCPA);
1559 CHECK_INT(_T ( "S57QueryDialogSizeX" ), &g_S57_dialog_sx);
1560 CHECK_INT(_T ( "S57QueryDialogSizeY" ), &g_S57_dialog_sy);
1561 CHECK_INT(_T ( "AlertDialogSizeX" ), &g_ais_alert_dialog_sx);
1562 CHECK_INT(_T ( "AlertDialogSizeY" ), &g_ais_alert_dialog_sy);
1563 CHECK_INT(_T ( "AlertDialogPosX" ), &g_ais_alert_dialog_x);
1564 CHECK_INT(_T ( "AlertDialogPosY" ), &g_ais_alert_dialog_y);
1565 CHECK_INT(_T ( "QueryDialogPosX" ), &g_ais_query_dialog_x);
1566 CHECK_INT(_T ( "QueryDialogPosY" ), &g_ais_query_dialog_y);
1568 conf->SetPath(_T ( "/Directories" ));
1569 CHECK_STR(_T ( "PresentationLibraryData" ), g_UserPresLibData)
1572 CHECK_STR(_T ( "SENCFileLocation" ), g_SENCPrefix)
1574 CHECK_STR(_T ( "GPXIODir" ), g_gpx_path);
1575 CHECK_STR(_T ( "TCDataDir" ), g_TCData_Dir);
1576 CHECK_STR(_T ( "BasemapDir"), gWorldMapLocation);
1582 conf->SetPath ( _T (
"/Settings/AuxFontKeys" ) );
1587 bool bContk = conf->GetFirstEntry( strk, dummyk );
1588 bool bNewKey =
false;
1590 Read( strk, &kval );
1591 bNewKey = FontMgr::Get().AddAuxKey(kval);
1593 DeleteEntry( strk );
1596 bContk = GetNextEntry( strk, dummyk );
1601 conf->SetPath(_T (
"/Settings/X11Fonts" ));
1605 conf->SetPath(_T (
"/Settings/GTKFonts" ));
1609 conf->SetPath(_T (
"/Settings/MSWFonts" ));
1613 conf->SetPath(_T (
"/Settings/MacFonts" ));
1617 conf->SetPath(_T (
"/Settings/QTFonts" ));
1621 if(conf->GetNumberOfEntries() != (
unsigned int)FontMgr::Get().GetNumFonts() )
1628 bool bCont = conf->GetFirstEntry( str, dummy );
1630 conf->Read( str, &pval );
1631 if(!FontMgr::Get().FindFontByConfigString(str))
1634 bCont = conf->GetNextEntry( str, dummy );
1639 conf->SetPath( _T (
"/TideCurrentDataSources" ) );
1640 if( conf->GetNumberOfEntries() != TideCurrentDataSet.GetCount())
1643 if( conf->GetNumberOfEntries()){
1646 bool bCont = conf->GetFirstEntry( str, dummy );
1648 conf->Read( str, &val );
1649 if( TideCurrentDataSet.Index(val) == wxNOT_FOUND)
1651 bCont = conf->GetNextEntry( str, dummy );
1659 conf->SetPath( _T (
"/Groups" ) );
1660 unsigned int group_count;
1661 conf->Read( _T (
"GroupCount" ), (
int *) &group_count, 0 );
1663 if(group_count != g_pGroupArray->GetCount())
1667 for(
unsigned int i = 0; i < group_count; i++ ) {
1669 s.Printf( _T(
"Group%d"), i + 1 );
1670 s.Prepend( _T (
"/Groups/" ) );
1674 conf->Read( _T (
"GroupName" ), &t );
1677 bool bfound =
false;
1679 for(
unsigned int j = 0 ; j < g_pGroupArray->GetCount() ; j++){
1680 pGroup = g_pGroupArray->Item(i);
1681 if(pGroup && (pGroup->m_group_name.IsSameAs(t))){
1695 conf->SetPath(_T (
"/Settings/Others" ));
1698 CHECK_INT(_T (
"RadarRingsNumberVisible" ), &g_iNavAidRadarRingsNumberVisible)
1699 CHECK_INT(_T (
"RadarRingsStep" ), &g_fNavAidRadarRingsStep)
1701 CHECK_INT(_T (
"RadarRingsStepUnits" ), &g_pNavAidRadarRingsStepUnits);
1709 CHECK_INT(_T (
"WaypointRangeRingsNumber" ), &g_iWaypointRangeRingsNumber)
1711 CHECK_FLT(_T (
"WaypointRangeRingsStep" ), &g_fWaypointRangeRingsStep, .1)
1713 CHECK_INT(_T ( "WaypointRangeRingsStepUnits" ),
1714 &g_iWaypointRangeRingsStepUnits);
1721 CHECK_INT(_T ( "ConfirmObjectDeletion" ), &g_bConfirmObjectDelete);
1724 CHECK_INT(_T ( "WaypointPreventDragging" ), &g_bWayPointPreventDragging);
1726 CHECK_INT(_T ( "EnableZoomToCursor" ), &g_bEnableZoomToCursor);
1728 CHECK_FLT(_T ( "TrackIntervalSeconds" ), &g_TrackIntervalSeconds, 1)
1730 CHECK_FLT(_T ( "TrackDeltaDistance" ), &g_TrackDeltaDistance, .1)
1732 CHECK_INT(_T ( "TrackPrecision" ), &g_nTrackPrecision);
1736 CHECK_INT(_T ( "RouteLineWidth" ), &g_route_line_width);
1737 CHECK_INT(_T ( "TrackLineWidth" ), &g_track_line_width);
1743 CHECK_STR(_T ( "DefaultWPIcon" ), g_default_wp_icon)
1747#define CHECK_BFN(s, t) \
1748 conf->Read(s, &read_int); \
1750 bval0 = read_int != 0; \
1751 if (bval != bval0) return false;
1753#define CHECK_IFN(s, t) \
1754 conf->Read(s, &read_int); \
1755 if (read_int != t) return false;
1757#define CHECK_FFN(s, t) \
1758 conf->Read(s, &dval); \
1759 if (fabs(dval - t) > 0.1) return false;
1766 conf->SetPath(_T (
"/Settings/GlobalState" ));
1768 CHECK_BFN(_T (
"bShowS57Text" ), ps52plib->GetShowS57Text());
1770 CHECK_BFN(_T (
"bShowS57ImportantTextOnly" ),
1771 ps52plib->GetShowS57ImportantTextOnly());
1772 CHECK_BFN(_T (
"bShowLightDescription" ), ps52plib->m_bShowLdisText);
1773 CHECK_BFN(_T (
"bExtendLightSectors" ), ps52plib->m_bExtendLightSectors);
1774 CHECK_BFN(_T (
"bShowSoundg" ), ps52plib->m_bShowSoundg);
1775 CHECK_BFN(_T (
"bShowMeta" ), ps52plib->m_bShowMeta);
1776 CHECK_BFN(_T (
"bUseSCAMIN" ), ps52plib->m_bUseSCAMIN);
1777 CHECK_BFN(_T (
"bUseSUPERSCAMIN" ), ps52plib->m_bUseSUPER_SCAMIN);
1778 CHECK_BFN(_T (
"bShowAtonText" ), ps52plib->m_bShowAtonText);
1779 CHECK_BFN(_T (
"bDeClutterText" ), ps52plib->m_bDeClutterText);
1780 CHECK_BFN(_T (
"bShowNationalText" ), ps52plib->m_bShowNationalTexts);
1781 CHECK_IFN(_T (
"nDisplayCategory" ), ps52plib->GetDisplayCategory());
1782 CHECK_IFN(_T (
"nSymbolStyle" ), ps52plib->m_nSymbolStyle);
1783 CHECK_IFN(_T (
"nBoundaryStyle" ), ps52plib->m_nBoundaryStyle);
1784 CHECK_FFN(_T (
"S52_MAR_SAFETY_CONTOUR" ),
1785 S52_getMarinerParam(S52_MAR_SAFETY_CONTOUR));
1786 CHECK_FFN(_T (
"S52_MAR_SHALLOW_CONTOUR" ),
1787 S52_getMarinerParam(S52_MAR_SHALLOW_CONTOUR));
1788 CHECK_FFN(_T (
"S52_MAR_DEEP_CONTOUR" ),
1789 S52_getMarinerParam(S52_MAR_DEEP_CONTOUR));
1790 CHECK_FFN(_T (
"S52_MAR_TWO_SHADES" ),
1791 S52_getMarinerParam(S52_MAR_TWO_SHADES));
1792 CHECK_INT(_T (
"S52_DEPTH_UNIT_SHOW" ), &g_nDepthUnitDisplay);
1798 conf->SetPath(_T (
"/Settings/ObjectFilter" ));
1800 unsigned int iOBJMax = conf->GetNumberOfEntries();
1802 if (iOBJMax != ps52plib->pOBJLArray->GetCount())
return false;
1809 bool bCont = conf->GetFirstEntry(str, dummy);
1811 conf->Read(str, &val);
1814 bool bfound =
false;
1815 if (str.StartsWith(_T (
"viz" ), &sObj)) {
1816 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
1818 pOLE = (OBJLElement *)(ps52plib->pOBJLArray->Item(iPtr));
1819 if (!strncmp(pOLE->OBJLName, sObj.mb_str(), 6)) {
1821 if (pOLE->nViz != val) {
1827 if (!bfound)
return false;
1829 bCont = conf->GetNextEntry(str, dummy);
1834 conf->SetPath(_T (
"/MmsiProperties" ));
1835 int iPMax = conf->GetNumberOfEntries();
1840 bool bCont = conf->GetFirstEntry(str, dummy);
1842 conf->Read(str, &val);
1844 bool bfound =
false;
1845 for (
unsigned int j = 0; j < g_MMSI_Props_Array.GetCount(); j++) {
1847 if (pProps->Serialize().IsSameAs(val)) {
1852 if (!bfound)
return false;
1854 bCont = conf->GetNextEntry(str, dummy);
Manages the user config matrix.