📄 preferencespagegps.cpp
字号:
m_pctlgpsdCompatibilityCheck, 0, wxALIGN_LEFT, 0 ); #endif ////////////////////////////////////////////////////////////////////////// // GPS Callout Box label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("GPS Callout Box")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // GPS Callout Box checkbox ////////////////////////////////////////////////////////////////////////// m_pctlGPSCalloutBox = new wxCheckBox(this, -1, wxT("")); m_pctlGPSCalloutBox->SetValue(g_pConfig->Read(wxT("GPS Callout Box"), (long) false)); psizerGrid->Add( m_pctlGPSCalloutBox, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // GPS small label label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("GPS Small Label")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // GPS small label checkbox ////////////////////////////////////////////////////////////////////////// m_pctlGPSSmallLabel = new wxCheckBox(this, -1, wxT("")); m_pctlGPSSmallLabel->SetValue(g_pConfig->Read(wxT("GPS Small Label"), true)); psizerGrid->Add( m_pctlGPSSmallLabel, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // GPS arrow label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("GPS Arrow")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // GPS arrow checkbox ////////////////////////////////////////////////////////////////////////// m_pctlGPSArrow = new wxCheckBox(this, -1, wxT("")); m_pctlGPSArrow->SetValue(g_pConfig->Read(wxT("GPS Arrow"), true)); psizerGrid->Add( m_pctlGPSArrow, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // GPS icon label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("GPS Icon")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); wxBoxSizer * sizerIcon = new wxBoxSizer(wxHORIZONTAL); ////////////////////////////////////////////////////////////////////////// // GPS icon text control ////////////////////////////////////////////////////////////////////////// m_pctlGPSIcon = new wxTextCtrl(this, -1, g_pConfig->Read(wxT("GPS Icon"), wxT("")), wxDefaultPosition, wxSize(250, -1)); sizerIcon->Add(m_pctlGPSIcon, 1, wxGROW | wxALL, 5); wxButton * btnIconBrowse= new wxButton(this, idIconBrowse, wxT("&Browse...")); sizerIcon->Add(btnIconBrowse, 0, wxALIGN_RIGHT | wxALL, 5); psizerGrid->Add( sizerIcon, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // Rotate Map to Match Heading label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Rotate Map to Match Heading")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Rotate Map to Match Heading check box ////////////////////////////////////////////////////////////////////////// m_pctlRotateMapToMatchHeading = new wxCheckBox(this, -1, wxT("")); m_pctlRotateMapToMatchHeading->SetValue(!g_pConfig->Read(wxT("NorthAlwaysUp"), (long) false)); psizerGrid->Add( m_pctlRotateMapToMatchHeading, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // Keep GPS centered label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Keep GPS Centered")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Keep GPS centered check box ////////////////////////////////////////////////////////////////////////// m_pctlKeepGPSCentered = new wxCheckBox(this, -1, wxT("")); m_pctlKeepGPSCentered->SetValue(g_pConfig->Read(wxT("KeepGPSCentered"), (long) true)); psizerGrid->Add( m_pctlKeepGPSCentered, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // Zoom Based on Road Type label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Zoom Based on Road Type")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Zoom Based on Road Type check box ////////////////////////////////////////////////////////////////////////// m_pctlZoomBasedOnRoadType = new wxCheckBox(this, -1, wxT("")); m_pctlZoomBasedOnRoadType->SetValue(g_pConfig->Read(wxT("RoadTypeZooming"), (long) false)); psizerGrid->Add( m_pctlZoomBasedOnRoadType, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // psizerWnd just adds a border to psizerGrid ////////////////////////////////////////////////////////////////////////// psizerWnd = new wxBoxSizer(wxVERTICAL); psizerWnd->Add( psizerGrid, 0, wxALL | wxGROW, 10 ); ////////////////////////////////////////////////////////////////////////// // Set up the sizer ////////////////////////////////////////////////////////////////////////// m_pctlGPSType->SetFocus(); psizerWnd->Fit(this); SetSizer(psizerWnd); Layout(); psizerWnd->SetSizeHints(this); wxCommandEvent ev; OnGPSTypeChange(ev); }//////////////////////////////////////////////////////////////////////////////////// \brief Ok was pressed .. save the settings/////////////////////////////////////////////////////////////////////////////////void PreferencesPageGPS::OnOk(wxCommandEvent& event){ long lBaudRate; if (m_pctlGPSType->GetValue() == wxT("None")) GPSMonitorThread::SetGPSType(GPSTypeNone); if (m_pctlGPSType->GetValue() == wxT("Auto Detect")) GPSMonitorThread::SetGPSType(GPSTypeAutoDetect);#ifdef ROADNAV_SERIAL_SUPPORT if (m_pctlGPSType->GetValue() == wxT("Serial/USB")) GPSMonitorThread::SetGPSType(GPSTypeSerial);#endif#ifdef HAVE_LIBGPS if (m_pctlGPSType->GetValue() == wxT("gpsd")) GPSMonitorThread::SetGPSType(GPSTypeGPSD);#endif#ifdef HAVE_SIMULATED_GPS_SUPPORT if (m_pctlGPSType->GetValue() == wxT("Simulated")) GPSMonitorThread::SetGPSType(GPSTypeSimulated);#endif g_pConfig->Write(wxT("GPSSerialPort"), m_pctlSerialPort->GetValue()); m_pctlBaudRate->GetValue().ToLong(&lBaudRate); g_pConfig->Write(wxT("GPSBaudRate"), lBaudRate);#ifdef HAVE_LIBGPS g_pConfig->Write(wxT("gpsdHost"), m_pctlgpsdHost->GetValue()); g_pConfig->Write(wxT("gpsdPort"), m_pctlgpsdPort->GetValue()); g_pConfig->Write(wxT("gpsdCompatibilityCheck"), m_pctlgpsdCompatibilityCheck->GetValue());#endif g_pConfig->Write(wxT("GPS Callout Box"), m_pctlGPSCalloutBox->GetValue()); g_pConfig->Write(wxT("GPS Small Label"), m_pctlGPSSmallLabel->GetValue()); g_pConfig->Write(wxT("GPS Arrow"), m_pctlGPSArrow->GetValue()); g_pConfig->Write(wxT("GPS Icon"), m_pctlGPSIcon->GetValue()); g_pConfig->Write(wxT("NorthAlwaysUp"), !m_pctlRotateMapToMatchHeading->GetValue()); g_pConfig->Write(wxT("KeepGPSCentered"), m_pctlKeepGPSCentered->GetValue()); g_pConfig->Write(wxT("RoadTypeZooming"), m_pctlZoomBasedOnRoadType->GetValue());}///////////////////////////////////////////////////////////////////////////////// /// \brief GPS type was changed - enable/disable the appropriate controls./////////////////////////////////////////////////////////////////////////////////void PreferencesPageGPS::OnGPSTypeChange(wxCommandEvent & event){#ifdef ROADNAV_SERIAL_SUPPORT m_pctlSerialPort->Enable(m_pctlGPSType->GetValue() == wxT("Serial/USB")); m_pctlBaudRate->Enable(m_pctlGPSType->GetValue() == wxT("Serial/USB"));#endif#ifdef HAVE_LIBGPS m_pctlgpsdHost->Enable(m_pctlGPSType->GetValue() == wxT("gpsd")); m_pctlgpsdPort->Enable(m_pctlGPSType->GetValue() == wxT("gpsd")); m_pctlgpsdCompatibilityCheck->Enable(m_pctlGPSType->GetValue() == wxT("gpsd"));#endif}//////////////////////////////////////////////////////////////////////////////////// \brief Browse button pressed. Lets a bitmap be used to indicate GPS/// position./////////////////////////////////////////////////////////////////////////////////void PreferencesPageGPS::OnIconBrowse(wxCommandEvent& event){ wxFileDialog dlg(this, wxT("Select icon..."), wxT(""), wxT(""), wxT("Images|*.bmp;*.png;*.jpg;*.jpeg;*.gif;*.pcx;*.pnm;*.tif;*.tiff;*.xpm;*.ico"),#if wxCHECK_VERSION(2, 8, 0) wxFD_OPEN#else wxOPEN#endif ); if (dlg.ShowModal() == wxID_OK) m_pctlGPSIcon->SetValue(dlg.GetPath());}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -