37#include <wx/fileconf.h>
38#include <wx/filename.h>
40#include <wx/statline.h>
47#include "model/georef.h"
49#include "model/route_point.h"
58#include "ocpn_frame.h"
60#include "OCPNPlatform.h"
62#include "RoutePropDlgImpl.h"
66extern s52plib *ps52plib;
69static const long long lNaN = 0xfff8000000000000;
70#define NAN (*(double *)&lNaN)
80int GetRandomNumber(
int range_min,
int range_max) {
81 long u = (long)wxRound(
82 ((
double)rand() / ((
double)(RAND_MAX) + 1) * (range_max - range_min)) +
88void appendOSDirSlash(wxString *pString);
98 wxPanel *GetSettingsPanel();
102 wxString templateFileName;
104 wxString m_description;
107OCPNConfigObject::OCPNConfigObject() { Init(); }
109OCPNConfigObject::OCPNConfigObject(
int canvas_config) {
111 m_canvasConfig = canvas_config;
114OCPNConfigObject::~OCPNConfigObject() {}
116void OCPNConfigObject::Init() { m_canvasConfig = 0; }
128 bool RemoveConfig(wxString GUID);
130 void SetRootConfigNode(
void);
132 bool SaveFile(
const wxString filename);
133 bool LoadFile(
const wxString filename);
138OCPNConfigCatalog::OCPNConfigCatalog() : pugi::xml_document() {}
140OCPNConfigCatalog::~OCPNConfigCatalog() {}
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";
160bool OCPNConfigCatalog::IsOpenCPN() {
162 attr = attr.next_attribute())
163 if (!strcmp(attr.name(),
"creator") && !strcmp(attr.value(),
"OpenCPN"))
168bool OCPNConfigCatalog::SaveFile(
const wxString filename) {
169 save_file(filename.fn_str(),
" ");
173bool OCPNConfigCatalog::LoadFile(
const wxString filename) {
174 load_file(filename.fn_str());
175 m_config_root = this->child(
"configs");
180 unsigned int flags) {
183 node.append_attribute(
"GUID") = config->m_GUID.mb_str();
186 wxCharBuffer abuf = config->m_title.ToUTF8();
188 node.append_attribute(
"title") = abuf.data();
190 node.append_attribute(
"title") =
"Substitute Title";
192 abuf = config->m_description.ToUTF8();
194 node.append_attribute(
"description") = abuf.data();
196 node.append_attribute(
"description") =
"Substitute Description";
198 node.append_attribute(
"templateFile") = config->templateFileName.mb_str();
203bool OCPNConfigCatalog::RemoveConfig(wxString GUID) {
204 for (
pugi::xml_node child = m_config_root.first_child(); child;) {
206 const char *guid = child.attribute(
"GUID").value();
208 if (!strcmp(guid, GUID.mb_str())) {
209 child.parent().remove_child(child);
224 wxWindowID
id,
const wxPoint &pos,
const wxSize &size)
225 : wxPanel(parent, id, pos, size, wxSIMPLE_BORDER)
229 wxBoxSizer *mainSizer =
new wxBoxSizer(wxVERTICAL);
232 mainSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Title")));
233 mainSizer->Add(
new wxStaticText(
this, wxID_ANY, config->m_title));
235 mainSizer->Add(
new wxStaticLine(
this, wxID_ANY), 0, wxEXPAND | wxALL, 1);
237 mainSizer->Add(
new wxStaticText(
this, wxID_ANY, _(
"Description")));
238 mainSizer->Add(
new wxStaticText(
this, wxID_ANY, config->m_description));
240 SetMinSize(wxSize(-1, 6 * GetCharHeight()));
243 wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW));
248ConfigPanel::~ConfigPanel() {}
250void ConfigPanel::OnConfigPanelMouseSelected(wxMouseEvent &event) {
255wxString ConfigPanel::GetConfigGUID() {
return m_config->m_GUID; }
267void ConfigMgr::Shutdown() {
274ConfigMgr::ConfigMgr() {
281ConfigMgr::~ConfigMgr() {
286void ConfigMgr::Init() {
288 appendOSDirSlash(&m_configDir);
289 m_configDir.append(
"Configs");
290 appendOSDirSlash(&m_configDir);
291 if (!wxFileName::DirExists(m_configDir)) {
292 wxFileName::Mkdir(m_configDir);
296 appendOSDirSlash(&m_configCatalogName);
297 m_configCatalogName.append(
"Configs");
298 appendOSDirSlash(&m_configCatalogName);
299 m_configCatalogName.append(
"configs.xml");
302 if (!wxFileExists(m_configCatalogName)) {
303 wxLogMessage(
"Creating new Configs catalog: " + m_configCatalogName);
306 cat->SetRootConfigNode();
307 cat->SaveFile(m_configCatalogName);
313 configList =
new ConfigObjectList;
316 wxString t_title = _(
"Recovery Template");
318 _(
"Apply this template to return to a known safe configuration");
319 CreateNamedConfig(t_title, t_desc,
"11111111-1111-1111-1111-111111111111");
322bool ConfigMgr::LoadCatalog() {
323 wxLogMessage(
"Loading Configs catalog: " + m_configCatalogName);
324 m_configCatalog->LoadFile(m_configCatalogName);
337 object =
object.next_sibling()) {
338 if (!strcmp(
object.name(),
"config")) {
341 wxString::FromUTF8(
object.attribute(
"GUID").as_string());
344 for (
auto it = configList->begin(); it != configList->end(); ++it) {
346 if (look->m_GUID == testGUID) {
356 wxString::FromUTF8(
object.attribute(
"GUID").as_string());
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());
365 configList->push_back(newConfig);
373bool ConfigMgr::SaveCatalog() {
374 m_configCatalog->SaveFile(m_configCatalogName);
379wxString ConfigMgr::CreateNamedConfig(
const wxString &title,
380 const wxString &description,
385 if (title.IsEmpty())
return GUID;
395 pConfig->m_GUID = GUID;
396 pConfig->m_title = title;
397 pConfig->m_description = description;
399 if (UUID.IsEmpty()) {
401 pConfig->templateFileName =
"OCPNTemplate-" + GUID +
".conf";
404 wxString templateFullFileName = GetConfigDir() + pConfig->templateFileName;
405 if (!SaveTemplate(templateFullFileName)) {
406 wxLogMessage(
"Unable to save template titled: " + title +
407 " as file: " + templateFullFileName);
414 if (!m_configCatalog->AddConfig(pConfig, 0)) {
415 wxLogMessage(
"Unable to add config to catalog...Title: " + title);
421 configList->push_back(pConfig);
423 if (UUID.IsEmpty()) SaveCatalog();
428bool ConfigMgr::DeleteConfig(wxString GUID) {
430 if (!cfg)
return false;
433 wxString templateFullFileName = GetConfigDir() + cfg->templateFileName;
434 if (wxFileExists(templateFullFileName)) wxRemoveFile(templateFullFileName);
437 bool rv = m_configCatalog->RemoveConfig(GUID);
439 if (rv) SaveCatalog();
442 auto found = std::find(configList->begin(), configList->end(), cfg);
443 if (found != configList->end()) configList->erase(found);
448wxPanel *ConfigMgr::GetConfigPanel(wxWindow *parent, wxString GUID) {
449 wxPanel *retPanel = NULL;
464 for (
auto it = configList->begin(); it != configList->end(); ++it) {
466 if (look->m_GUID == GUID) {
474wxString ConfigMgr::GetTemplateTitle(wxString GUID) {
475 for (
auto it = configList->begin(); it != configList->end(); ++it) {
477 if (look->m_GUID == GUID) {
478 return look->m_title;
482 return wxEmptyString;
485wxArrayString ConfigMgr::GetConfigGUIDArray() {
486 wxArrayString ret_val;
488 for (
auto it = configList->begin(); it != configList->end(); ++it) {
490 ret_val.Add(look->m_GUID);
495bool ConfigMgr::ApplyConfigGUID(wxString GUID) {
501 wxString thisConfig = GetConfigDir() + config->templateFileName;
504 if (GUID.StartsWith(
"11111111")) {
512 fconf.LoadMyConfigRaw(
true);
515 fconf.LoadCanvasConfigs(
true);
517 if (ps52plib && ps52plib->m_bOK) fconf.LoadS57Config();
526wxString ConfigMgr::GetUUID(
void) {
531 int time_hi_and_version;
532 int clock_seq_hi_and_rsv;
538 uuid.time_low = GetRandomNumber(
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);
550 uuid.clock_seq_hi_and_rsv = (uuid.clock_seq_hi_and_rsv & 0x3F) | 0x80;
554 uuid.time_hi_and_version = (uuid.time_hi_and_version & 0x0fff) | 0x4000;
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);
563bool ConfigMgr::SaveTemplate(wxString fileName) {
578 conf->SetPath(_T (
"/Settings" ));
580 conf->Write(_T (
"InlandEcdis" ), g_bInlandEcdis);
581 conf->Write(_T (
"UIexpert" ), g_bUIexpert);
582 conf->Write(_T (
"SpaceDropMark" ), g_bSpaceDropMark);
584 conf->Write(_T (
"ShowStatusBar" ), g_bShowStatusBar);
586 conf->Write(_T (
"ShowMenuBar" ), g_bShowMenuBar);
588 conf->Write(_T (
"DefaultFontSize" ), g_default_font_size);
590 conf->Write(_T (
"Fullscreen" ), g_bFullscreen);
591 conf->Write(_T (
"ShowCompassWindow" ), g_bShowCompassWin);
592 conf->Write(_T (
"SetSystemTime" ), s_bSetSystemTime);
594 conf->Write(_T (
"PlayShipsBells" ), g_bPlayShipsBells);
595 conf->Write(_T (
"SoundDeviceIndex" ), g_iSoundDeviceIndex);
596 conf->Write(_T (
"FullscreenToolbar" ), g_bFullscreenToolbar);
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);
607 conf->Write(_T (
"GUIScaleFactor" ), g_GUIScaleFactor);
608 conf->Write(_T (
"ChartObjectScaleFactor" ), g_ChartScaleFactor);
609 conf->Write(_T (
"ShipScaleFactor" ), g_ShipScaleFactor);
611 conf->Write(_T (
"ShowTrue" ), g_bShowTrue);
612 conf->Write(_T (
"ShowMag" ), g_bShowMag);
613 conf->Write(_T (
"UserMagVariation" ), wxString::Format(
"%.2f", g_UserVar));
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);
620 conf->Write(_T (
"SkewToNorthUp" ), g_bskew_comp);
622 conf->Write(_T (
"ZoomDetailFactor" ), g_chart_zoom_modifier_raster);
623 conf->Write(_T (
"ZoomDetailFactorVector" ), g_chart_zoom_modifier_vector);
627 conf->Write(_T (
"CourseUpMode" ), g_bCourseUp);
628 if (!g_bInlandEcdis) conf->Write(_T (
"LookAheadMode" ), g_bLookAhead);
629 conf->Write(_T (
"TenHzUpdate" ), g_btenhertz);
631 conf->Write(_T (
"COGUPAvgSeconds" ),
g_COGAvgSec);
632 conf->Write(_T (
"UseMagAPB" ), g_bMagneticAPB);
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);
647 conf->Write(_T (
"RouteArrivalCircleRadius" ),
648 wxString::Format(
"%.3f", g_n_arrival_circle_radius));
649 conf->Write(_T (
"ChartQuilting" ), g_bQuiltEnable);
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);
659 conf->Write(_T (
"InitialStackIndex" ), g_restore_stackindex);
660 conf->Write(_T (
"InitialdBIndex" ), g_restore_dbindex);
662 conf->Write(_T (
"AnchorWatch1GUID" ), g_AW1GUID);
663 conf->Write(_T (
"AnchorWatch2GUID" ), g_AW2GUID);
665 conf->Write(_T (
"ToolbarX" ), g_maintoolbar_x);
666 conf->Write(_T (
"ToolbarY" ), g_maintoolbar_y);
667 conf->Write(_T (
"ToolbarOrient" ), g_maintoolbar_orient);
669 conf->Write(_T (
"iENCToolbarX" ), g_iENCToolbarPosX);
670 conf->Write(_T (
"iENCToolbarY" ), g_iENCToolbarPosY);
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);
680 conf->Write(_T (
"MobileTouch" ), g_btouch);
681 conf->Write(_T (
"ResponsiveGraphics" ), g_bresponsive);
683 conf->Write(_T (
"AutoHideToolbar" ), g_bAutoHideToolbar);
684 conf->Write(_T (
"AutoHideToolbarSecs" ), g_nAutoHideToolbar);
688 st0.Append(wxString::Format(_T (
"%zu," ), mm));
691 conf->Write(_T (
"DisplaySizeMM" ), st0);
692 conf->Write(_T (
"DisplaySizeManual" ), g_config_display_size_manual);
694 conf->Write(_T (
"PlanSpeed" ), wxString::Format(
"%.2f", g_PlanSpeed));
698 LayerList::iterator it;
700 for( it = ( *pLayerList ).begin(); it != ( *pLayerList ).end(); ++it, ++index ) {
702 if( lay->IsVisibleOnChart() ) vis += ( lay->m_LayerName ) +
";";
704 invis += ( lay->m_LayerName ) +
";";
706 conf->Write( _T (
"VisibleLayers" ), vis );
707 conf->Write( _T (
"InvisibleLayers" ), invis );
710 conf->Write(_T (
"Locale" ), g_locale);
711 conf->Write(_T (
"LocaleOverride" ), g_localeOverride);
714 conf->Write(_T(
"LiveETA" ), g_bShowLiveETA);
715 conf->Write(_T(
"DefaultBoatSpeed" ), g_defaultBoatSpeed);
718 conf->SetPath(_T (
"/Settings/ObjectFilter" ));
721 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
723 OBJLElement *pOLE = (OBJLElement *)(ps52plib->pOBJLArray->Item(iPtr));
725 wxString st1(_T (
"viz" ));
727 strncpy(name, pOLE->OBJLName, 6);
729 st1.Append(wxString(name, wxConvUTF8));
730 conf->Write(st1, pOLE->nViz);
736 conf->SetPath(_T (
"/Settings/GlobalState" ));
740 conf->Write(_T (
"nColorScheme" ), (
int)gFrame->GetColorScheme());
743 conf->SetPath(_T (
"/Settings/AIS" ));
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);
760 conf->Write(_T (
"bHideMooredTargets" ), g_bHideMoored);
761 conf->Write(_T (
"MooredTargetMaxSpeedKnots" ), g_ShowMoored_Kts);
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);
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);
808 conf->SetPath(_T (
"/Settings/GlobalState" ));
810 conf->Write(_T (
"bShowS57Text" ), ps52plib->GetShowS57Text());
811 conf->Write(_T (
"bShowS57ImportantTextOnly" ),
812 ps52plib->GetShowS57ImportantTextOnly());
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);
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);
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);
840 conf->SetPath(_T (
"/Settings/Others" ));
843 conf->Write(_T (
"ShowRadarRings" ), (
bool)(g_iNavAidRadarRingsNumberVisible >
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));
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));
861 conf->Write(_T (
"ConfirmObjectDeletion" ), g_bConfirmObjectDelete);
864 conf->Write(_T (
"WaypointPreventDragging" ), g_bWayPointPreventDragging);
866 conf->Write(_T (
"EnableZoomToCursor" ), g_bEnableZoomToCursor);
868 conf->Write(_T (
"TrackIntervalSeconds" ), g_TrackIntervalSeconds);
869 conf->Write(_T (
"TrackDeltaDistance" ), g_TrackDeltaDistance);
870 conf->Write(_T (
"TrackPrecision" ), g_nTrackPrecision);
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);
881 conf->SetPath(_T (
"/Settings/AuxFontKeys" ));
884 for (
unsigned int i = 0; i < keyArray.GetCount(); i++) {
886 key.Printf(
"Key%i", i);
887 wxString keyval = keyArray[i];
888 conf->Write(key, keyval);
893 font_path = (_T (
"/Settings/X11Fonts" ));
897 font_path = (_T (
"/Settings/GTKFonts" ));
901 font_path = (_T (
"/Settings/MSWFonts" ));
905 font_path = (_T (
"/Settings/MacFonts" ));
909 font_path = (_T (
"/Settings/QTFonts" ));
912 conf->DeleteGroup(font_path);
914 conf->SetPath(font_path);
918 for (
int i = 0; i < nFonts; i++) {
919 wxString cfstring(FontMgr::Get().GetConfigString(i));
921 conf->Write(cfstring, valstring);
925 conf->SaveCanvasConfigs();
934bool ConfigMgr::CheckTemplateGUID(wxString GUID) {
939 rv = CheckTemplate(GetConfigDir() + config->templateFileName);
945#define CHECK_INT(s, t) \
947 if (!conf.Read(s, &read_int)) wxLogMessage(s); \
948 if ((int)*t != read_int) return false;
950#define CHECK_STR(s, t) \
952 conf.Read(s, &val); \
953 if (!t.IsSameAs(val)) return false;
955#define CHECK_STRP(s, t) \
956 conf.Read(s, &val); \
957 if (!t->IsSameAs(val)) return false;
959#define CHECK_FLT(s, t, eps) \
960 conf.Read(s, &val); \
961 val.ToDouble(&dval); \
962 if (fabs(dval - *t) > eps) return false;
964bool ConfigMgr::CheckTemplate(wxString fileName) {
974 conf.SetPath(_T (
"/Settings" ));
976 CHECK_INT(_T (
"UIexpert" ), &g_bUIexpert);
980 CHECK_INT(_T (
"InlandEcdis" ), &g_bInlandEcdis);
982 CHECK_INT(_T(
"SpaceDropMark" ), &g_bSpaceDropMark);
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 );
995 CHECK_INT( _T (
"DebugBSBImg" ), &g_BSBImgDebug );
996 CHECK_INT( _T (
"DebugGPSD" ), &g_bDebugGPSD );
999 CHECK_INT(_T (
"DefaultFontSize"), &g_default_font_size);
1002 CHECK_INT(_T (
"UseGarminHostUpload" ), &g_bGarminHostUpload);
1004 CHECK_INT(_T (
"UseNMEA_GLL" ), &g_bUseGLL);
1006 CHECK_INT(_T (
"AutoHideToolbar" ), &g_bAutoHideToolbar);
1007 CHECK_INT(_T (
"AutoHideToolbarSecs" ), &g_nAutoHideToolbar);
1009 CHECK_INT(_T (
"UseSimplifiedScalebar" ), &g_bsimplifiedScalebar);
1012 CHECK_INT(_T (
"DisplaySizeManual" ), &g_config_display_size_manual);
1014 CHECK_INT(_T (
"GUIScaleFactor" ), &g_GUIScaleFactor);
1016 CHECK_INT(_T (
"ChartObjectScaleFactor" ), &g_ChartScaleFactor);
1017 CHECK_INT(_T (
"ShipScaleFactor" ), &g_ShipScaleFactor);
1019 CHECK_INT(_T (
"FilterNMEA_Avg" ), &g_bfilter_cogsog);
1020 CHECK_INT(_T (
"FilterNMEA_Sec" ), &g_COGFilterSec);
1022 CHECK_INT(_T (
"ShowTrue" ), &g_bShowTrue);
1023 CHECK_INT(_T (
"ShowMag" ), &g_bShowMag);
1025 CHECK_FLT(_T (
"UserMagVariation" ), &g_UserVar, 0.1)
1027 CHECK_INT(_T ( "UseMagAPB" ), &g_bMagneticAPB);
1029 CHECK_INT(_T ( "ScreenBrightness" ), &g_nbrightness);
1031 CHECK_INT(_T ( "MemFootprintTargetMB" ), &g_MemFootMB);
1033 CHECK_INT(_T ( "WindowsComPortMax" ), &g_nCOMPortCheck);
1035 CHECK_INT(_T ( "ChartQuilting" ), &g_bQuiltEnable);
1036 CHECK_INT(_T ( "ChartQuiltingInitial" ), &g_bQuiltStart);
1038 CHECK_INT(_T ( "CourseUpMode" ), &g_bCourseUp);
1039 CHECK_INT(_T ( "COGUPAvgSeconds" ), &
g_COGAvgSec);
1042 CHECK_INT(_T ( "OpenGL" ), &g_bopengl);
1043 CHECK_INT(_T ( "SoftwareGL" ), &g_bSoftwareGL);
1045 CHECK_INT(_T( "NMEAAPBPrecision" ), &g_NMEAAPBPrecision);
1047 CHECK_STR(_T( "TalkerIdText" ), g_TalkerIdText);
1048 CHECK_INT(_T( "MaxWaypointNameLength" ), &g_maxWPNameLength);
1049 CHECK_INT(_T( "MbtilesMaxLayers" ), &g_mbtilesMaxLayers);
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);
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);
1072 CHECK_INT(_T (
"iENCToolbarX"), &g_iENCToolbarPosX);
1073 CHECK_INT(_T (
"iENCToolbarY"), &g_iENCToolbarPosY);
1075 CHECK_STR(_T (
"AnchorWatch1GUID" ), g_AW1GUID);
1076 CHECK_STR(_T (
"AnchorWatch2GUID" ), g_AW2GUID);
1078 CHECK_INT(_T (
"MobileTouch" ), &g_btouch);
1079 CHECK_INT(_T (
"ResponsiveGraphics" ), &g_bresponsive);
1081 CHECK_INT(_T (
"ZoomDetailFactor" ), &g_chart_zoom_modifier_raster);
1082 CHECK_INT(_T (
"ZoomDetailFactorVector" ), &g_chart_zoom_modifier_vector);
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);
1089 CHECK_INT(_T (
"SENC_LOD_Pixels" ), &g_SENC_LOD_pixels);
1091 CHECK_INT(_T (
"SkewCompUpdatePeriod" ), &g_SkewCompUpdatePeriod);
1093 CHECK_INT(_T (
"ShowStatusBar" ), &g_bShowStatusBar);
1095 CHECK_INT(_T (
"ShowMenuBar" ), &g_bShowMenuBar);
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);
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" ),
1115 CHECK_INT(_T (
"DistanceFormat" ),
1116 &g_iDistanceFormat);
1118 CHECK_INT(_T (
"SpeedFormat" ),
1121 _T (
"WindSpeedFormat" ),
1122 &g_iWindSpeedFormat);
1125 CHECK_INT(_T (
"LiveETA" ), &g_bShowLiveETA);
1126 CHECK_INT(_T (
"DefaultBoatSpeed" ), &g_defaultBoatSpeed);
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);
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);
1142 CHECK_FLT(_T (
"RouteArrivalCircleRadius" ), &g_n_arrival_circle_radius, .01);
1144 CHECK_INT(_T (
"FullScreenQuilt" ), &g_bFullScreenQuilt);
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);
1154 CHECK_FLT(_T (
"PlanSpeed" ), &g_PlanSpeed, 0.1)
1159 CHECK_INT(_T ( "PreserveScaleOnX" ), &g_bPreserveScaleOnX);
1161 CHECK_STR(_T ( "Locale" ), g_locale);
1162 CHECK_STR(_T ( "LocaleOverride" ), g_localeOverride);
1165 CHECK_INT(_T ( "KeepNavobjBackups" ), &g_navobjbackups);
1175 CHECK_INT(_T ( "LegacyInputCOMPortFilterBehaviour" ),
1176 &g_b_legacy_input_filter_behaviour);
1178 CHECK_INT(_T( "AdvanceRouteWaypointOnArrivalOnly" ),
1179 &g_bAdvanceRouteWaypointOnArrivalOnly);
1181 CHECK_INT(_T ( "EnableRotateKeys" ), &g_benable_rotate);
1182 CHECK_INT(_T ( "EmailCrashReport" ), &g_bEmailCrashReport);
1184 CHECK_INT(_T ( "EnableAISNameCache" ), &g_benableAISNameCache);
1186 CHECK_INT(_T ( "EnableUDPNullHeader" ), &g_benableUDPNullHeader);
1188 conf.SetPath(_T ( "/Settings/GlobalState" ));
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);
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);
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);
1206 CHECK_INT(_T ( "S52_DEPTH_UNIT_SHOW" ),
1207 &g_nDepthUnitDisplay);
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);
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);
1274 conf.SetPath(_T ( "/Directories" ));
1275 CHECK_STR(_T ( "PresentationLibraryData" ), g_UserPresLibData)
1278 CHECK_STR(_T ( "SENCFileLocation" ), g_SENCPrefix)
1280 CHECK_STR(_T ( "GPXIODir" ), g_gpx_path);
1281 CHECK_STR(_T ( "TCDataDir" ), g_TCData_Dir);
1282 CHECK_STR(_T ( "BasemapDir"), gWorldMapLocation);
1283 CHECK_STR(_T ( "BaseShapefileDir"), gWorldShapefileLocation);
1289 conf.SetPath ( _T (
"/Settings/AuxFontKeys" ) );
1294 bool bContk = conf,GetFirstEntry( strk, dummyk );
1295 bool bNewKey =
false;
1297 Read( strk, &kval );
1298 bNewKey = FontMgr::Get().
AddAuxKey(kval);
1300 DeleteEntry( strk );
1303 bContk = GetNextEntry( strk, dummyk );
1308 conf.SetPath(_T (
"/Settings/X11Fonts" ));
1312 conf.SetPath(_T (
"/Settings/GTKFonts" ));
1316 conf.SetPath(_T (
"/Settings/MSWFonts" ));
1320 conf.SetPath(_T (
"/Settings/MacFonts" ));
1324 conf.SetPath(_T (
"/Settings/QTFonts" ));
1327 conf.SetPath(_T (
"/Settings/Others" ));
1330 CHECK_INT(_T (
"RadarRingsNumberVisible" ), &g_iNavAidRadarRingsNumberVisible)
1331 CHECK_INT(_T (
"RadarRingsStep" ), &g_fNavAidRadarRingsStep)
1333 CHECK_INT(_T (
"RadarRingsStepUnits" ), &g_pNavAidRadarRingsStepUnits);
1341 CHECK_INT(_T (
"WaypointRangeRingsNumber" ), &g_iWaypointRangeRingsNumber)
1343 CHECK_FLT(_T (
"WaypointRangeRingsStep" ), &g_fWaypointRangeRingsStep, .1)
1345 CHECK_INT(_T ( "WaypointRangeRingsStepUnits" ),
1346 &g_iWaypointRangeRingsStepUnits);
1353 CHECK_INT(_T ( "ConfirmObjectDeletion" ), &g_bConfirmObjectDelete);
1356 CHECK_INT(_T ( "WaypointPreventDragging" ), &g_bWayPointPreventDragging);
1358 CHECK_INT(_T ( "EnableZoomToCursor" ), &g_bEnableZoomToCursor);
1360 CHECK_FLT(_T ( "TrackIntervalSeconds" ), &g_TrackIntervalSeconds, 1)
1362 CHECK_FLT(_T ( "TrackDeltaDistance" ), &g_TrackDeltaDistance, .1)
1364 CHECK_INT(_T ( "TrackPrecision" ), &g_nTrackPrecision);
1368 CHECK_INT(_T ( "RouteLineWidth" ), &g_route_line_width);
1369 CHECK_INT(_T ( "TrackLineWidth" ), &g_track_line_width);
1375 CHECK_STR(_T ( "DefaultWPIcon" ), g_default_wp_icon)
1379#define CHECK_BFN(s, t) \
1380 conf.Read(s, &read_int); \
1382 bval0 = read_int != 0; \
1383 if (bval != bval0) return false;
1385#define CHECK_IFN(s, t) \
1386 conf.Read(s, &read_int); \
1387 if (read_int != t) return false;
1389#define CHECK_FFN(s, t) \
1390 conf.Read(s, &dval); \
1391 if (fabs(dval - t) > 0.1) return false;
1398 conf.SetPath(_T (
"/Settings/GlobalState" ));
1400 CHECK_BFN(_T (
"bShowS57Text" ), ps52plib->GetShowS57Text());
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);
1430 conf.SetPath(_T (
"/Settings/ObjectFilter" ));
1432 unsigned int iOBJMax = conf.GetNumberOfEntries();
1434 if (iOBJMax != ps52plib->pOBJLArray->GetCount())
return false;
1441 bool bCont = conf.GetFirstEntry(str, dummy);
1443 conf.Read(str, &val);
1446 bool bfound =
false;
1447 if (str.StartsWith(_T (
"viz" ), &sObj)) {
1448 for (
unsigned int iPtr = 0; iPtr < ps52plib->pOBJLArray->GetCount();
1450 pOLE = (OBJLElement *)(ps52plib->pOBJLArray->Item(iPtr));
1451 if (!strncmp(pOLE->OBJLName, sObj.mb_str(), 6)) {
1453 if (pOLE->nViz != val) {
1459 if (!bfound)
return false;
1461 bCont = conf.GetNextEntry(str, dummy);
1466 conf.SetPath(_T (
"/MmsiProperties" ));
1467 int iPMax = conf.GetNumberOfEntries();
1472 bool bCont = conf.GetFirstEntry(str, dummy);
1474 conf.Read(str, &val);
1476 bool bfound =
false;
1477 for (
unsigned int j = 0; j < g_MMSI_Props_Array.GetCount(); j++) {
1479 if (pProps->Serialize().IsSameAs(val)) {
1484 if (!bfound)
return false;
1486 bCont = conf.GetNextEntry(str, dummy);
Class AisDecoder and helpers.
Global state for AIS decoder.
Charts database management
Generic Chart canvas base.
Manages the user configuration matrix.
Represents a panel for displaying and editing a configuration.
wxString GetFullConfigDesc(int i) const
Gets description of font at index i.
bool AddAuxKey(wxString key)
Adds new plugin-defined font configuration key.
int GetNumFonts(void) const
Gets the total number of font configurations currently loaded.
wxArrayString & GetAuxKeyArray()
Gets array of plugin-defined font configuration keys.
Represents a layer of chart objects in OpenCPN.
Process incoming AIS messages.
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.