void ClimatologyConfigDialog::SaveSettings() { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T ( "/Settings/Climatology" ) ); pConf->Write ( _T ( "lastdatatype" ), m_lastdatatype); pConf->SetPath ( _T( "/PlugIns/Climatology/WindAtlas" ) ); /* wind atlas settings */ pConf->Write ( _T ( "Enabled" ), m_cbWindAtlasEnable->GetValue()); pConf->Write ( _T ( "Size1" ), m_sWindAtlasSize->GetValue()); pConf->Write ( _T ( "Spacing1" ), m_sWindAtlasSpacing->GetValue()); pConf->Write ( _T ( "Opacity" ), m_sWindAtlasOpacity->GetValue()); /* cyclone settings */ pConf->SetPath ( _T( "/PlugIns/Climatology/Cyclones" ) ); pConf->Write( _T ( "StartDate" ), m_dPStart->GetValue().FormatDate()); pConf->Write( _T ( "EndDate" ), m_dPEnd->GetValue().FormatDate()); pConf->Write ( _T ( "CycloneDaySpan" ), m_sCycloneDaySpan->GetValue() ); pConf->Write ( _T ( "MinWindSpeed" ), m_sMinWindSpeed->GetValue() ); pConf->Write ( _T ( "MaxPressure" ), m_sMaxPressure->GetValue() ); /* implement check boxes too? */ }
int vdr_pi::Init(void) { AddLocaleCatalog( _T("opencpn-vdr_pi") ); // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); m_pauimgr = GetFrameAuiManager(); m_pvdrcontrol = NULL; // And load the configuration items LoadConfig(); // This PlugIn needs two toolbar icons m_tb_item_id_record = InsertPlugInTool(_T(""), _img_vdr_record, _img_vdr_record, wxITEM_CHECK, _("Record"), _T(""), NULL, VDR_TOOL_POSITION, 0, this); m_tb_item_id_play = InsertPlugInTool(_T(""), _img_vdr_play, _img_vdr_play, wxITEM_CHECK, _("Play"), _T(""), NULL, VDR_TOOL_POSITION, 0, this); m_recording = false; return ( WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL | WANTS_CONFIG | WANTS_NMEA_SENTENCES | WANTS_AIS_SENTENCES ); }
PreferencesDialog::PreferencesDialog(wxWindow* parent) : PreferencesDialogBase(parent) { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T ( "/Settings/Plots" ) ); if(!pConf) return; bool bvalue; int ivalue; pConf->Read(_T("PlotCount"), &ivalue, 1); m_sPlotCount->SetValue(ivalue); pConf->Read(_T("CoursePrediction"), &bvalue, false); m_cbCoursePrediction->SetValue(bvalue); pConf->Read(_T("CoursePredictionBlended"), &bvalue, false); m_cbCoursePredictionBlended->SetValue(bvalue); pConf->Read(_T("CoursePredictionLength"), &ivalue, 10); m_sCoursePredictionLength->SetValue(ivalue); pConf->Read(_T("CoursePredictionSeconds"), &ivalue, 10); m_sCoursePredictionSeconds->SetValue(ivalue); }
int weather_routing_pi::Init(void) { AddLocaleCatalog( _T("opencpn-weather_routing_pi") ); // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); // Get a pointer to the opencpn display canvas, to use as a parent for the WEATHER_ROUTING dialog m_parent_window = GetOCPNCanvasWindow(); m_pWeather_Routing = NULL; m_leftclick_tool_id = InsertPlugInTool (_T(""), _img_WeatherRouting, _img_WeatherRouting, wxITEM_CHECK, _("Weather_Routing"), _T(""), NULL, WEATHER_ROUTING_TOOL_POSITION, 0, this); wxMenu dummy_menu; m_position_menu_id = AddCanvasContextMenuItem (new wxMenuItem(&dummy_menu, -1, _("Weather Route Position")), this ); SetCanvasContextMenuItemViz(m_position_menu_id, false); // And load the configuration items LoadConfig(); return (WANTS_OVERLAY_CALLBACK | WANTS_OPENGL_OVERLAY_CALLBACK | WANTS_TOOLBAR_CALLBACK | WANTS_CONFIG | WANTS_CURSOR_LATLON | WANTS_NMEA_EVENTS | WANTS_PLUGIN_MESSAGING ); }
void DecoderOptionsDialog::OnDone( wxCommandEvent& event ) { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T ( "/Settings/WeatherFax/Audio" ) ); bool spin_options_changed = m_sBitsPerPixel->GetValue() != pConf->Read ( _T ( "BitsPerPixel" ), 8L ) || m_sCarrier->GetValue() != pConf->Read ( _T ( "Carrier" ), 1900L ) || m_sDeviation->GetValue() != pConf->Read ( _T ( "Deviation" ), 400L ) || m_sMinusSaturationThreshold->GetValue() != pConf->Read ( _T ( "MinusSaturationThreshold" ), 15L ); pConf->Write ( _T ( "ImageWidth" ), m_sImageWidth->GetValue()); pConf->Write ( _T ( "BitsPerPixel" ), m_sBitsPerPixel->GetValue()); pConf->Write ( _T ( "Carrier" ), m_sCarrier->GetValue()); pConf->Write ( _T ( "Deviation" ), m_sDeviation->GetValue()); pConf->Write ( _T ( "MinusSaturationThreshold" ), m_sMinusSaturationThreshold->GetValue()); pConf->Write ( _T ( "Filter" ), m_cFilter->GetSelection()); pConf->Write ( _T ( "SkipHeaderDetection" ), m_cbSkip->GetValue()); pConf->Write ( _T ( "IncludeHeadersInImage" ), m_cbInclude->GetValue()); FaxDecoder &decoder = m_wizard.m_decoder; bool capture = decoder.m_CaptureSettings.type == FaxDecoderCaptureSettings::AUDIO || decoder.m_CaptureSettings.type == FaxDecoderCaptureSettings::RTLSDR; // Hide(); EndModal(wxID_OK); if(origwidth != m_sImageWidth->GetValue() || (!capture && spin_options_changed)) { origwidth = m_sImageWidth->GetValue(); ResetDecoder(); } }
GRIBUIDialog::~GRIBUIDialog() { wxFileConfig *pConf = GetOCPNConfigObject();; if(pConf) { pConf->SetPath ( _T ( "/Settings/GRIB" ) ); pConf->Write( _T ( "WindPlot" ), m_cbWind->GetValue()); pConf->Write( _T ( "WindGustPlot" ), m_cbWindGust->GetValue()); pConf->Write( _T ( "PressurePlot" ), m_cbPressure->GetValue()); pConf->Write( _T ( "WavePlot" ), m_cbWave->GetValue()); pConf->Write( _T ( "CurrentPlot" ), m_cbCurrent->GetValue()); pConf->Write( _T ( "PrecipitationPlot" ), m_cbPrecipitation->GetValue()); pConf->Write( _T ( "CloudPlot" ), m_cbCloud->GetValue()); pConf->Write( _T ( "AirTemperaturePlot" ), m_cbAirTemperature->GetValue()); pConf->Write( _T ( "SeaTemperaturePlot" ), m_cbSeaTemperature->GetValue()); pConf->Write( _T ( "lastdatatype" ), m_lastdatatype); pConf->Write ( _T ( "Filename" ), m_file_name ); pConf->SetPath ( _T ( "/Directories" ) ); pConf->Write ( _T ( "GRIBDirectory" ), m_grib_dir ); } delete m_pTimelineSet; }
int calculator_pi::Init(void) { AddLocaleCatalog( _T("opencpn-calculator_pi") ); // Set some default private member parameters m_calculator_dialog_x = 0; m_calculator_dialog_y = 0; m_calculator_dialog_width = 20; m_calculator_dialog_height = 20; ::wxDisplaySize(&m_display_width, &m_display_height); // Get a pointer to the opencpn display canvas, to use as a parent for the POI Manager dialog m_parent_window = GetOCPNCanvasWindow(); // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); // And load the configuration items LoadConfig(); // This PlugIn needs a toolbar icon, so request its insertion m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_calc, _img_calc, wxITEM_NORMAL, _("Calculator"), _T(""), NULL, CALCULATOR_TOOL_POSITION, 0, this); m_pDialog = NULL; return (WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL | WANTS_PREFERENCES | WANTS_CONFIG ); }
void GribOverlaySettings::Write() { /* save settings here */ wxFileConfig *pConf = GetOCPNConfigObject(); if(!pConf) return; pConf->SetPath ( _T( "/PlugIns/GRIB" ) ); pConf->Write ( _T ( "Interpolate" ), m_bInterpolate); pConf->Write ( _T ( "LoopMode" ), m_bLoopMode ); pConf->Write ( _T ( "SlicesPerUpdate" ), m_SlicesPerUpdate); pConf->Write ( _T ( "UpdatesPerSecond" ), m_UpdatesPerSecond); pConf->Write ( _T ( "HourDivider" ), m_HourDivider); for(int i=0; i<SETTINGS_COUNT; i++) { wxString Name=name_from_index[i]; pConf->Write ( Name + _T ( "Units" ), (int)Settings[i].m_Units); pConf->Write ( Name + _T ( "BarbedArrows" ), Settings[i].m_bBarbedArrows); pConf->Write ( Name + _T ( "BarbedRange" ), Settings[i].m_iBarbedRange); pConf->Write ( Name + _T ( "IsoBars" ), Settings[i].m_bIsoBars); pConf->Write ( Name + _T ( "IsoBarSpacing" ), Settings[i].m_iIsoBarSpacing); pConf->Write ( Name + _T ( "DirectionArrows" ), Settings[i].m_bDirectionArrows); pConf->Write ( Name + _T ( "DirectionArrowSize" ), Settings[i].m_iDirectionArrowSize); pConf->Write ( Name + _T ( "OverlayMap" ), Settings[i].m_bOverlayMap); pConf->Write ( Name + _T ( "OverlayMapColors" ), Settings[i].m_iOverlayMapColors); pConf->Write ( Name + _T ( "Numbers" ), Settings[i].m_bNumbers); pConf->Write ( Name + _T ( "NumbersSpacing" ), Settings[i].m_iNumbersSpacing); } }
int locapi_pi::Init ( void ) { AddLocaleCatalog ( _T ( "opencpn-locapi_pi" ) ); m_pconfig = GetOCPNConfigObject(); LoadConfig(); status = REPORT_NOT_SUPPORTED; if (SUCCEEDED(spLoc.CoCreateInstance(CLSID_Location))) // Create the Location object { wxLogMessage(_T("LOCAPI: Instance created")); // Array of report types of interest. Other ones include IID_ICivicAddressReport IID REPORT_TYPES[] = { IID_ILatLongReport }; // Request permissions for this user account to receive location data for all the // types defined in REPORT_TYPES (which is currently just one report) if (FAILED(spLoc->RequestPermissions(NULL, REPORT_TYPES, ARRAYSIZE(REPORT_TYPES), TRUE))) // TRUE means a synchronous request { wxMessageBox( _("Warning: Unable to request permissions to receive location updates.") ); } } else { wxLogMessage(_T("LOCAPI: Instance creation failed")); } Start( m_interval, wxTIMER_CONTINUOUS ); return ( WANTS_CONFIG ); }
WatchdogDialog::WatchdogDialog( watchdog_pi &_watchdog_pi, wxWindow* parent) : WatchdogDialogBase( parent ), m_watchdog_pi(_watchdog_pi) { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T( "/Settings/Watchdog" ) ); #ifdef __WXGTK__ Move(0, 0); // workaround for gtk autocentre dialog behavior #endif Move(pConf->Read ( _T ( "DialogPosX" ), 20L ), pConf->Read ( _T ( "DialogPosY" ), 20L )); wxImageList *imglist = new wxImageList(20, 20, true, 1); imglist->Add(wxBitmap(box_xpm)); imglist->Add(wxBitmap(check_xpm)); m_lStatus->AssignImageList(imglist, wxIMAGE_LIST_SMALL); m_lStatus->InsertColumn(ALARM_ENABLED, _T("X")); m_lStatus->InsertColumn(ALARM_TYPE, _("Type")); m_lStatus->InsertColumn(ALARM_STATUS, _("Status")); m_lStatus->SetColumnWidth(ALARM_ENABLED, wxLIST_AUTOSIZE); m_lStatus->SetColumnWidth(ALARM_TYPE, wxLIST_AUTOSIZE); m_lStatus->SetColumnWidth(ALARM_STATUS, wxLIST_AUTOSIZE); this->GetSizer()->Fit( this ); this->Layout(); this->SetSizeHints( GetSize().x, GetSize().y ); }
void BoatDialog::OnSaveFile ( wxCommandEvent& event ) { long index = SelectedPolar(); if(index < 0) return; wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); wxString path; pConf->Read ( _T ( "FilePath" ), &path, weather_routing_pi::StandardPath()); wxFileDialog saveDialog( this, _( "Select Polar" ), path, wxT ( "" ), wxT ( "Boat Polar files (*.file)|*.FILE;*.file|All files (*.*)|*.*" ), wxFD_SAVE ); if( saveDialog.ShowModal() == wxID_OK ) { wxString filename = saveDialog.GetPath(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); pConf->Write ( _T ( "FILEPath" ), wxFileName(filename).GetPath() ); Polar &polar = m_Boat.Polars[index]; if(!polar.Save(saveDialog.GetPath().mb_str())) { wxMessageDialog md(this, _("Failed saving boat polar to file"), _("OpenCPN Weather Routing Plugin"), wxICON_ERROR | wxOK ); md.ShowModal(); } } }
int findit_pi::Init(void) { AddLocaleCatalog( _T("opencpn-findit_pi") ); m_pFindItWindow = NULL; isLogbookReady = FALSE;; isLogbookWindowShown = FALSE; // Get a pointer to the opencpn display canvas, to use as a parent for windows created m_parent_window = GetOCPNCanvasWindow(); m_pconfig = GetOCPNConfigObject(); LoadConfig(); // Create the Context Menu Items // In order to avoid an ASSERT on msw debug builds, // we need to create a dummy menu to act as a surrogate parent of the created MenuItems // The Items will be re-parented when added to the real context meenu wxMenu dummy_menu; m_bFINDITShowIcon = true; if(m_bFINDITShowIcon) m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_findit, _img_findit, wxITEM_NORMAL, _("FindIt"), _T(""), NULL, FINDIT_TOOL_POSITION, 0, this); return ( WANTS_TOOLBAR_CALLBACK | WANTS_PREFERENCES | WANTS_PLUGIN_MESSAGING ); }
void BoatDialog::OnOpenBoat ( wxCommandEvent& event ) { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); wxString path; pConf->Read ( _T ( "Path" ), &path, weather_routing_pi::StandardPath()); wxFileDialog openDialog ( this, _( "Select Boat" ), path, wxT ( "" ), wxT ( "Boat polar (*.xml)|*.XML;*.xml|All files (*.*)|*.*" ), wxFD_OPEN ); if( openDialog.ShowModal() == wxID_OK ) { wxString filename = openDialog.GetPath(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); pConf->Write ( _T ( "Path" ), wxFileName(filename).GetPath() ); wxString error = m_Boat.OpenXML(filename); if(error.empty()) { RepopulatePolars(); } else { wxMessageDialog md(this, error, _("OpenCPN Weather Routing Plugin"), wxICON_ERROR | wxOK ); md.ShowModal(); return; } UpdateVMG(); RefreshPlots(); } }
int kmloverlay_pi::Init(void) { m_puserinput = NULL; AddLocaleCatalog( _T("opencpn-kmloverlay_pi") ); m_toolbar_item_id = InsertPlugInTool( _T(""), _img_kmloverlay, _img_kmloverlay, wxITEM_NORMAL, _("KML overlay"), _T(""), NULL, KMLOVERLAY_TOOL_POSITION, 0, this ); m_pauimgr = GetFrameAuiManager(); m_puserinput = new KMLOverlayUI( GetOCPNCanvasWindow(), wxID_ANY, _T("") ); wxAuiPaneInfo pane = wxAuiPaneInfo().Name(_T("KMLOverlay")).Caption(_("KML overlay")).CaptionVisible(true).Float().FloatingPosition(50,150).Dockable(false).Resizable().CloseButton(true).Show(false); m_pauimgr->AddPane( m_puserinput, pane ); m_pauimgr->Update(); // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); // And load the configuration items LoadConfig(); ApplyConfig(); return ( WANTS_OVERLAY_CALLBACK | WANTS_OPENGL_OVERLAY_CALLBACK | WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL | // nothing yet // WANTS_PREFERENCES | WANTS_CONFIG ); }
DecoderOptionsDialog::DecoderOptionsDialog(WeatherFaxWizard &wizard) #ifndef __WXOSX__ : DecoderOptionsDialogBase(&wizard), #else : DecoderOptionsDialogBase(&wizard, wxID_ANY, _("Fax Decoding Options"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP), #endif m_wizard(wizard) { Hide(); wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T ( "/Settings/WeatherFax/Audio" ) ); m_sImageWidth->SetValue(pConf->Read ( _T ( "ImageWidth" ), 1024L )); m_sBitsPerPixel->SetValue(pConf->Read ( _T ( "BitsPerPixel" ), 8L )); m_sCarrier->SetValue(pConf->Read ( _T ( "Carrier" ), 1900L )); m_sDeviation->SetValue(pConf->Read ( _T ( "Deviation" ), 400L )); m_sMinusSaturationThreshold->SetValue(pConf->Read ( _T ( "MinusSaturationThreshold" ), 15L )); m_cFilter->SetSelection(pConf->Read ( _T ( "Filter" ), FaxDecoder::firfilter::MIDDLE )); m_cbSkip->SetValue((bool)pConf->Read ( _T ( "SkipHeaderDetection" ), 0L )); m_cbInclude->SetValue((bool)pConf->Read ( _T ( "IncludeHeadersInImage" ), 0L )); origwidth = m_sImageWidth->GetValue(); // FaxDecoder &decoder = m_wizard.m_decoder; ConfigureDecoder(true); }
PlotConfigurationDialog::~PlotConfigurationDialog() { wxFileConfig *pConf = GetOCPNConfigObject(); if(!pConf) return; pConf->SetPath ( wxString::Format( "/Settings/Plots/%d", m_index ) ); for(std::list<cbState>::iterator it = m_cbStates.begin(); it != m_cbStates.end(); it++) pConf->Write(_T("Plot ") + it->name, it->cb->GetValue()); double vmgcourse; m_tVMGCourse->GetValue().ToDouble(&vmgcourse); pConf->Write(_T("VMGCourse"), vmgcourse); #if wxCHECK_VERSION(3,0,0) pConf->Write(_T("PlotFont"), m_fpPlotFont->GetSelectedFont()); #endif pConf->Write(_T("PlotMinHeight"), m_sPlotMinHeight->GetValue()); pConf->Write(_T("PlotColors"), m_cColors->GetSelection()); pConf->Write(_T("PlotTransparency"), m_sPlotTransparency->GetValue()); pConf->Write(_T("PlotStyle"), m_cPlotStyle->GetSelection()); pConf->Write(_T("PlotShowTitleBar"), m_cbShowTitleBar->GetValue()); }
int gecomapi_pi::Init(void) { m_bshuttingDown = false; mPriPosition = 99; m_pgecomapi_window = NULL; AddLocaleCatalog( _T("opencpn-gecomapi_pi") ); // Get a pointer to the opencpn display canvas, to use as a parent for the POI Manager dialog m_parent_window = GetOCPNCanvasWindow(); m_pauimgr = GetFrameAuiManager(); // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); // And load the configuration items LoadConfig(); // This PlugIn needs a toolbar icon #ifdef GECOMAPI_USE_SVG m_toolbar_item_id = InsertPlugInToolSVG(_T("GoogleEarth"), _svg_gecomapi, _svg_gecomapi_rollover, _svg_gecomapi_toggled, wxITEM_CHECK, _T("GoogleEarth"), _T(""), NULL, GECOMAPI_TOOL_POSITION, 0, this); #else m_toolbar_item_id = InsertPlugInTool(_T("GoogleEarth"), _img_gecomapi, _img_gecomapi, wxITEM_CHECK, _T("GoogleEarth"), _T(""), NULL, GECOMAPI_TOOL_POSITION, 0, this); #endif m_pgecomapi_window = new GEUIDialog(GetOCPNCanvasWindow(), wxID_ANY, m_pauimgr, m_toolbar_item_id, this); wxAuiPaneInfo pane = wxAuiPaneInfo().Name(_T("GoogleEarth")).Caption(_T("GoogleEarth")).CaptionVisible(true).Float().FloatingPosition(0,0).Show(!m_bstartHidden).TopDockable(false).BottomDockable(false).LeftDockable(true).RightDockable(true).CaptionVisible(true).CloseButton(false).MinSize(300,300); m_pauimgr->AddPane(m_pgecomapi_window, pane); if(m_pgecomapi_window) { m_pgecomapi_window->SetCameraParameters(m_iCameraAzimuth, m_iCameraTilt, m_iCameraRange); } ApplyConfig(); m_pauimgr->Update(); //m_pauimgr->Connect( wxEVT_AUI_RENDER, wxAuiManagerEventHandler( gecomapi_pi::OnAuiRender ), NULL, this ); return (WANTS_OVERLAY_CALLBACK | WANTS_CURSOR_LATLON | WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL | WANTS_PREFERENCES | WANTS_CONFIG | WANTS_NMEA_EVENTS | WANTS_NMEA_SENTENCES | USES_AUI_MANAGER | WANTS_ONPAINT_VIEWPORT ); }
BoatDialog::~BoatDialog() { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); pConf->Read ( _T ( "Orientation0" ), m_orientation[0] ); pConf->Write ( _T ( "Orientation1" ), m_orientation[1] ); }
ConfigurationDialog::~ConfigurationDialog( ) { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting" ) ); wxPoint p = GetPosition(); pConf->Write ( _T ( "ConfigurationX" ), p.x); pConf->Write ( _T ( "ConfigurationY" ), p.y); }
//------------------------------------------------------------------------------ // custom grid implementation //------------------------------------------------------------------------------ CustomGrid::CustomGrid( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) : wxGrid( parent, id, pos, size, style, name ) { //create grid SetTable( new wxGridStringTable(0, 0), true, wxGridSelectRows ); //some general settings EnableEditing( false ); EnableGridLines( true ); EnableDragGridSize( false ); SetMargins( 0, 0 ); EnableDragColMove( false ); EnableDragColSize( false ); EnableDragRowSize( false ); //init rows pref wxFileConfig *pConf = GetOCPNConfigObject(); if (pConf) { pConf->SetPath(_T("/Settings/GRIB")); m_IsDigit = pConf->Read(_T("GribDataTableRowPref"), _T("XXX")); } if( m_IsDigit.Len() != wxString(_T("XXX")).Len() ) m_IsDigit = _T("XXX"); //create structure for all numerical rows for( unsigned int i = 0; i < m_IsDigit.Len(); i++ ){ m_NumRow.push_back(wxNOT_FOUND); m_NumRowVal.push_back(std::vector <double>()); } //init labels attr wxFont labelfont = GetOCPNGUIScaledFont_PlugIn( _T("Dialog") ).MakeBold(); SetLabelFont(labelfont); wxColour colour; GetGlobalColor(_T("DILG0"), &colour); SetLabelBackgroundColour(colour); //set row label size int w; GetTextExtent( _T("Ab"), &w, NULL, 0, 0, &labelfont); double x = (double)w * 6.5; SetRowLabelSize((int)x); //colour settings GetGlobalColor(_T("GREEN1"), &m_greenColour); GetGlobalColor(_T("DILG1"), &m_greyColour); #ifdef __WXOSX__ m_bLeftDown = false; #endif //connect events at dialog level Connect(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollEventHandler( CustomGrid::OnScroll ), NULL, this ); Connect(wxEVT_SIZE, wxSizeEventHandler( CustomGrid::OnResize ), NULL, this ); Connect(wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( CustomGrid::OnLabeClick ), NULL, this ); //connect events at grid level GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this ); GetGridWindow()->Connect(wxEVT_LEFT_UP, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this ); GetGridWindow()->Connect(wxEVT_MOTION, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this ); //timer event m_tRefreshTimer.Connect(wxEVT_TIMER, wxTimerEventHandler( CustomGrid::OnRefreshTimer ), NULL, this); }
void GribOverlaySettings::Write() { /* save settings here */ wxFileConfig *pConf = GetOCPNConfigObject(); if(!pConf) return; pConf->SetPath ( _T( "/PlugIns/GRIB" ) ); //Overlay general parameter pConf->Write ( _T ( "OverlayTransparency" ), m_iOverlayTransparency); //playback options pConf->Write ( _T ( "Interpolate" ), m_bInterpolate); pConf->Write ( _T ( "LoopMode" ), m_bLoopMode ); pConf->Write ( _T ( "LoopStartPoint" ), m_LoopStartPoint); pConf->Write ( _T ( "SlicesPerUpdate" ), m_SlicesPerUpdate); pConf->Write ( _T ( "UpdatesPerSecond" ), m_UpdatesPerSecond); //gui options pConf->Write( _T ( "GribCursorDataDisplayStyle" ), m_iCtrlandDataStyle ); wxString s1 = m_iCtrlBarCtrlVisible[0], s2 = m_iCtrlBarCtrlVisible[1]; pConf->Write( _T ( "CtrlBarCtrlVisibility1" ), s1 ); pConf->Write( _T ( "CtrlBarCtrlVisibility2" ), s2 ); for(int i=0; i<SETTINGS_COUNT; i++) { pConf->Write ( name_from_index[i] + _T ( "Units" ), (int)Settings[i].m_Units); if(i == WIND){ SaveSettingGroups(pConf, i, B_ARROWS); SaveSettingGroups(pConf, i, ISO_LINE_SHORT); SaveSettingGroups(pConf, i, OVERLAY); SaveSettingGroups(pConf, i, NUMBERS); SaveSettingGroups(pConf, i, PARTICLES); } else if(i == WIND_GUST || i == AIR_TEMPERATURE || i == SEA_TEMPERATURE || i == CAPE || i == COMP_REFL) { SaveSettingGroups(pConf, i, ISO_LINE_SHORT); SaveSettingGroups(pConf, i, OVERLAY); SaveSettingGroups(pConf, i, NUMBERS); } else if(i == PRESSURE) { SaveSettingGroups(pConf, i, ISO_LINE_SHORT); SaveSettingGroups(pConf, i, ISO_LINE_VISI); SaveSettingGroups(pConf, i, NUMBERS); } else if(i == WAVE || i == CURRENT) { SaveSettingGroups(pConf, i, D_ARROWS); SaveSettingGroups(pConf, i, OVERLAY); SaveSettingGroups(pConf, i, NUMBERS); SaveSettingGroups(pConf, i, PARTICLES); } else if( i == PRECIPITATION || i == CLOUD) { SaveSettingGroups(pConf, i, OVERLAY); SaveSettingGroups(pConf, i, NUMBERS); } } }
WatchdogDialog::~WatchdogDialog() { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T ( "/Settings/Watchdog" ) ); wxPoint p = GetPosition(); pConf->Write ( _T ( "DialogPosX" ), p.x ); pConf->Write ( _T ( "DialogPosY" ), p.y ); }
CustomGrid::~CustomGrid() { wxFileConfig *pConf = GetOCPNConfigObject(); if(pConf) { pConf->SetPath ( _T ( "/Settings/GRIB" ) ); pConf->Write( _T ( "GribDataTableRowPref" ), m_IsDigit ); } m_NumRowVal.clear(); m_NumRow.clear(); }
void GribSettingsDialog::SaveLastPage() { wxFileConfig *pConf = GetOCPNConfigObject(); if(pConf) { pConf->SetPath ( _T ( "/Settings/GRIB" ) ); pConf->Write( _T ( "GribSettingsBookPageIndex" ), m_SetBookpageIndex ); } }
ConfigurationDialog::ConfigurationDialog(WeatherRouting *weatherrouting) : ConfigurationDialogBase(weatherrouting), m_WeatherRouting(weatherrouting) { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting" ) ); wxPoint p = GetPosition(); pConf->Read ( _T ( "ConfigurationX" ), &p.x, p.x); pConf->Read ( _T ( "ConfigurationY" ), &p.y, p.y); SetPosition(p); }
int NmeaConverter_pi::Init(void) { prefDlg = NULL; p_nmeaSendObjectDlg=NULL; b_CheckChecksum = true; // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); // And load the configuration items LoadConfig(); return ( WANTS_NMEA_SENTENCES | WANTS_PREFERENCES ); }
PlotConfigurationDialog::PlotConfigurationDialog(wxWindow* parent, PlotsDialog &m_dialog, int index) : PlotConfigurationDialogBase(parent), m_PlotsDialog(m_dialog), m_index(index) { wxFileConfig *pConf = GetOCPNConfigObject(); if(!pConf) return; #define ADD_CB(NAME) \ m_cbStates.push_back(cbState(m_cb##NAME, _T(#NAME))); ADD_CB(SOG); ADD_CB(PDS10); ADD_CB(PDS60); ADD_CB(COG); ADD_CB(PDC10); ADD_CB(PDC60); ADD_CB(HDG); ADD_CB(HDM); ADD_CB(CourseFFTWPlot); ADD_CB(VMG); ADD_CB(AWS); ADD_CB(TWS); ADD_CB(AWA); ADD_CB(TWA); ADD_CB(TWD); pConf->SetPath ( wxString::Format( "/Settings/Plots/%d", index ) ); for(std::list<cbState>::iterator it = m_cbStates.begin(); it != m_cbStates.end(); it++) it->cb->SetValue(pConf->Read(_T("Plot ") + it->name, it->cb->GetValue())); double vmgcourse; pConf->Read(_T("VMGCourse"), &vmgcourse, 0); m_tVMGCourse->SetValue(wxString::Format(_T("%f"), vmgcourse)); #if wxCHECK_VERSION(3,0,0) // m_fpPlotFont->SetSelectedFont(pConf->Read(_T("PlotFont"), wxToString(m_fpPlotFont->GetSelectedFont()))); #else wxLogMessage(_T("plots_pi: cannot save and load fonts using wxwidgets version < 3")); #endif m_sPlotMinHeight->SetValue(pConf->Read(_T("PlotMinHeight"), m_sPlotMinHeight->GetValue())); m_cColors->SetSelection(pConf->Read(_T("PlotColors"), m_cColors->GetSelection())); m_sPlotTransparency->SetValue(pConf->Read(_T("PlotTransparency"), m_sPlotTransparency->GetValue())); m_cPlotStyle->SetSelection(pConf->Read(_T("PlotStyle"), m_cPlotStyle->GetSelection())); #ifdef WIN32 m_cbShowTitleBar->Disable(); #else m_cbShowTitleBar->SetValue(pConf->Read(_T("PlotShowTitleBar"), m_cbShowTitleBar->GetValue())); #endif }
int connector_pi::Init(void) { AddLocaleCatalog( _T("opencpn-connector_pi") ); // Set some default private member parameters m_connector_dialog_x = 0; m_connector_dialog_y = 0; ::wxDisplaySize(&m_display_width, &m_display_height); // Get a pointer to the opencpn display canvas, to use as a parent m_parent_window = GetOCPNCanvasWindow(); // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); // And load the configuration items LoadConfig(); // This PlugIn needs a toolbar icon, so request its insertion m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_connector, _img_connector, wxITEM_NORMAL, _("Connector"), _T(""), NULL, CONNECTOR_TOOL_POSITION, 0, this); m_pConnectorDialog = NULL; /* * * * */ if (m_DataSources.GetCount() > 0) { unsigned int i; DataSource* p; for (i=0;i<m_DataSources.GetCount();i++){ p = m_DataSources.Item(i); if( p->protocol==2) St_init(p); } } return (WANTS_CURSOR_LATLON | WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL | WANTS_PREFERENCES | // WANTS_NMEA_SENTENCES | // WANTS_NMEA_EVENTS | WANTS_CONFIG ); }
int route_pi::Init(void) { AddLocaleCatalog( _T("opencpn-route_pi") ); // Set some default private member parameters m_route_dialog_x = 0; m_route_dialog_y = 0; ::wxDisplaySize(&m_display_width, &m_display_height); // Get a pointer to the opencpn display canvas, to use as a parent for the POI Manager dialog m_parent_window = GetOCPNCanvasWindow(); // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); // And load the configuration items LoadConfig(); // Create the Context Menu Items // In order to avoid an ASSERT on msw debug builds, // we need to create a dummy menu to act as a surrogate parent of the created MenuItems // The Items will be re-parented when added to the real context meenu wxMenu dummy_menu; wxMenuItem *pmi = new wxMenuItem(&dummy_menu, -1, _("Start Route_pi Here")); m_add_start = AddCanvasContextMenuItem(pmi, this ); SetCanvasContextMenuItemViz(m_add_start, true); wxMenuItem *pmih = new wxMenuItem(&dummy_menu, -1, _("Finish Route_pi Here.")); m_add_finish = AddCanvasContextMenuItem(pmih, this ); SetCanvasContextMenuItemViz(m_add_finish, true); // This PlugIn needs a toolbar icon, so request its insertion m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_route_pi, _img_route_pi, wxITEM_NORMAL, _("Route"), _T(""), NULL, CALCULATOR_TOOL_POSITION, 0, this); m_pDialog = NULL; return (WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL | WANTS_PREFERENCES | WANTS_CURSOR_LATLON | WANTS_CONFIG ); }
PreferencesDialog::~PreferencesDialog() { wxFileConfig *pConf = GetOCPNConfigObject(); if(!pConf) return; pConf->SetPath ( _T ( "/Settings/Plots" ) ); pConf->Write(_T("PlotCount"), m_sPlotCount->GetValue()); pConf->Write(_T("CoursePrediction"), m_cbCoursePrediction->GetValue()); pConf->Write(_T("CoursePredictionBlended"), m_cbCoursePredictionBlended->GetValue()); pConf->Write(_T("CoursePredictionLength"), m_sCoursePredictionLength->GetValue()); pConf->Write(_T("CoursePredictionSeconds"), m_sCoursePredictionSeconds->GetValue()); }