📄 preferencespagegeneral.cpp
字号:
/* * Roadnav * PreferencesPageGeneral.cpp * * Copyright (c) 2004 - 2007 Richard L. Lynch <rllynch@users.sourceforge.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *////////////////////////////////////////////////////////////////////////////////// \file////// Contains the general page of the preferences dialog box./////////////////////////////////////////////////////////////////////////////////#ifdef HAVE_CONFIG_H# include <config.h>#endif#ifdef _MSC_VER#pragma warning(disable: 4786)#pragma warning(disable: 4800)#endif#include <wx/wx.h>#include <vector>#include "libroadnav/Map.h"#include "libroadnav/DownloadFiles.h"#include "libroadnav/MapSupport.h"#include "App.h"#include "PreferencesPageGeneral.h"#include "SerialIO.h"#include "wxSkinnableFrame.h"#include "Support.h"using namespace std;enum{ idClearCache, idClearMaps, idEnableExitCommand};//////////////////////////////////////////////////////////////////////////////////// PreferencesPageGeneral event table/////////////////////////////////////////////////////////////////////////////////BEGIN_EVENT_TABLE(PreferencesPageGeneral, wxPanel) EVT_BUTTON(idClearCache, PreferencesPageGeneral::OnClearCache) EVT_BUTTON(idClearMaps, PreferencesPageGeneral::OnClearMaps) EVT_CHECKBOX(idEnableExitCommand, PreferencesPageGeneral::OnCheckEnableExitCommand)END_EVENT_TABLE()//////////////////////////////////////////////////////////////////////////////////// \brief PreferencesPageGeneral constructor - create controls and initialize them/////////////////////////////////////////////////////////////////////////////////PreferencesPageGeneral::PreferencesPageGeneral(wxWindow *parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL){ wxBoxSizer * psizerWnd; wxFlexGridSizer * psizerGrid; int i; psizerGrid = new wxFlexGridSizer(2, 5, 10); ////////////////////////////////////////////////////////////////////////// // Automatic download maps label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Automatically download maps")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Automatic download maps check box ////////////////////////////////////////////////////////////////////////// m_pctlAutoDownloadMaps = new wxCheckBox(this, -1, wxT("")); g_pConfig->Read(wxT("AutoDownloadMaps"), &i, 1); m_pctlAutoDownloadMaps->SetValue(i); psizerGrid->Add( m_pctlAutoDownloadMaps, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // Cache downloads label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Cache downloads")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Cache downloads check box ////////////////////////////////////////////////////////////////////////// m_pctlCacheDownloads = new wxCheckBox(this, -1, wxT("")); m_pctlCacheDownloads->SetValue(g_pConfig->Read(wxT("CacheDownloads"), (long) 1)); psizerGrid->Add( m_pctlCacheDownloads, 0, wxALIGN_LEFT, 0 ); { ////////////////////////////////////////////////////////////////////////// // Day Skin Path Label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Daytime Skin")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Day Skin Path Entry ////////////////////////////////////////////////////////////////////////// vector<wxString> vSkins = EnumerateSkins(); wxString * strSkins = new wxString[vSkins.size()]; int nSkins = vSkins.size(); unsigned int iSkin; for (iSkin = 0; iSkin < vSkins.size(); iSkin++) strSkins[iSkin] = vSkins[iSkin]; m_pctlSkinPathDay = new wxComboBox(this, -1, g_pConfig->Read(wxT("SkinPath-Day"), wxT("Default-Day")), wxDefaultPosition, wxSize(200, -1), nSkins, strSkins, wxCB_DROPDOWN | wxCB_SORT); delete [] strSkins; psizerGrid->Add( m_pctlSkinPathDay, 0, wxALIGN_LEFT, 0 ); } { ////////////////////////////////////////////////////////////////////////// // Night Skin Path Label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Nighttime Skin")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Night Skin Path Entry ////////////////////////////////////////////////////////////////////////// vector<wxString> vSkins = EnumerateSkins(); wxString * strSkins = new wxString[vSkins.size()]; int nSkins = vSkins.size(); unsigned int iSkin; for (iSkin = 0; iSkin < vSkins.size(); iSkin++) strSkins[iSkin] = vSkins[iSkin]; m_pctlSkinPathNight = new wxComboBox(this, -1, g_pConfig->Read(wxT("SkinPath-Night"), wxT("Default-Night")), wxDefaultPosition, wxSize(200, -1), nSkins, strSkins, wxCB_DROPDOWN | wxCB_SORT); delete [] strSkins; psizerGrid->Add( m_pctlSkinPathNight, 0, wxALIGN_LEFT, 0 ); } ////////////////////////////////////////////////////////////////////////// // Proxy Host Label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Proxy Host")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Proxy Host Entry ////////////////////////////////////////////////////////////////////////// m_pctlProxyHost = new wxTextCtrl(this, -1, g_pConfig->Read(wxT("ProxyHost"), wxT("")), wxDefaultPosition, wxSize(250, -1)); psizerGrid->Add( m_pctlProxyHost, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // Proxy Port Label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Proxy Port")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Proxy Port Entry ////////////////////////////////////////////////////////////////////////// long lPort = 0; g_pConfig->Read(wxT("ProxyPort"), &lPort); m_pctlProxyPort = new wxTextCtrl(this, -1, wxString::Format(wxT("%ld"), lPort), wxDefaultPosition, wxSize(250, -1)); psizerGrid->Add( m_pctlProxyPort, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // Antialiasing label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Antialiased maps (requires fast CPU)")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Antialiasing check box ////////////////////////////////////////////////////////////////////////// m_pctlAntiAliasedMaps = new wxCheckBox(this, -1, wxT("")); g_pConfig->Read(wxT("AntialiasedMaps"), &i, 0); m_pctlAntiAliasedMaps->SetValue(i); psizerGrid->Add( m_pctlAntiAliasedMaps, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // Zoom maps Label ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Zoom Maps")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Zoom maps Entry ////////////////////////////////////////////////////////////////////////// double fDrawingScaleFactor; g_pConfig->Read(wxT("DrawingScaleFactor"), &fDrawingScaleFactor, 1); m_pctlZoomMaps = new wxTextCtrl(this, -1, wxString::Format(wxT("%.2f"), fDrawingScaleFactor), wxDefaultPosition, wxSize(250, -1)); psizerGrid->Add( m_pctlZoomMaps,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -