📄 editthemedialog.cpp
字号:
/* * Roadnav * EditThemeDialog.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 a dialog box used to edit a specific theme./////////////////////////////////////////////////////////////////////////////////#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 "EditThemeDialog.h"using namespace std;//////////////////////////////////////////////////////////////////////////////////// IDs for EditThemeDialog.cpp/////////////////////////////////////////////////////////////////////////////////enum{ idName, idDetailLevel, idRecordType, idColor};//////////////////////////////////////////////////////////////////////////////////// EditThemeDialog event table/////////////////////////////////////////////////////////////////////////////////BEGIN_EVENT_TABLE(EditThemeDialog, wxDialog) EVT_TEXT(idDetailLevel, EditThemeDialog::OnDetailLevelChange) EVT_TEXT(idRecordType, EditThemeDialog::OnRecordTypeChange) EVT_BUTTON(wxID_OK, EditThemeDialog::OnOk) EVT_CUSTOM_RANGE(wxEVT_COMMAND_CHECKBOX_CLICKED, 0, EDITTHEMEDIALOG_MAX_DETAILLEVELS * 2, EditThemeDialog::OnCheckBox)END_EVENT_TABLE()//////////////////////////////////////////////////////////////////////////////////// \brief EditThemeDialog constructor - create and initialize controls/////////////////////////////////////////////////////////////////////////////////EditThemeDialog::EditThemeDialog( wxWindow * pParent, const wxString & strTheme, const MapAppearanceSettings & cTheme, IMapControlData * pMapControlData) : wxDialog( pParent, -1, wxT("Edit Theme"), wxDefaultPosition, wxDefaultSize), m_Theme(cTheme), m_strTheme(strTheme){ wxBoxSizer * psizerWnd; wxFlexGridSizer * psizerGrid; int iDetailLevel; int iRow; int iCol; int nDetailLevels; int iHeading; wxChar * pszHeadings[] = {wxT("Detail Lvl"), wxT(""), wxT("Clr"), wxT("Font Size"), wxT(""), wxT("Clr"), wxT("Line Width"), NULL}; m_pMapControlData = pMapControlData, nDetailLevels = m_Theme.GetDetailLevelCount(); wxASSERT(nDetailLevels <= EDITTHEMEDIALOG_MAX_DETAILLEVELS); ////////////////////////////////////////////////////////////////////////// // Box sizer for entire window ////////////////////////////////////////////////////////////////////////// psizerWnd = new wxBoxSizer(wxVERTICAL); ////////////////////////////////////////////////////////////////////////// // Sizer for top half ////////////////////////////////////////////////////////////////////////// psizerGrid = new wxFlexGridSizer(2, 4, 10); psizerWnd->Add( psizerGrid, 0, wxGROW | wxTOP | wxLEFT | wxRIGHT, 10 ); ////////////////////////////////////////////////////////////////////////// // Theme Name ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, idName, wxT("Theme Name")), 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Theme Name Control ////////////////////////////////////////////////////////////////////////// m_pctlThemeName = new wxTextCtrl(this, idName, m_strTheme); psizerGrid->Add(m_pctlThemeName, 1, wxGROW, 0); ////////////////////////////////////////////////////////////////////////// // Feature type text ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Feature Type")), 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Feature type combo box ////////////////////////////////////////////////////////////////////////// m_pctlRecordType = new wxComboBox(this, idRecordType, wxT(""), wxDefaultPosition, wxSize(200, -1), 0, NULL, wxCB_READONLY); m_pctlRecordType->Append(GetRecordTypeNames()); wxASSERT(m_pctlRecordType->GetCount() >= 1); m_pctlRecordType->SetSelection(0); psizerGrid->Add(m_pctlRecordType, 1, wxGROW, 0 ); ////////////////////////////////////////////////////////////////////////// // Static box surrounding feature specific settings ////////////////////////////////////////////////////////////////////////// wxStaticBoxSizer * psizerDetailSpecific = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Feature Settings")); psizerWnd->Add(psizerDetailSpecific, 1, wxGROW | wxLEFT | wxRIGHT, 10 ); ////////////////////////////////////////////////////////////////////////// // Flex grid inside static box ////////////////////////////////////////////////////////////////////////// wxFlexGridSizer * psizerDetailSpecificGrid = new wxFlexGridSizer((sizeof(pszHeadings) / sizeof(wxChar *) - 1) * 2, 1, 6); psizerDetailSpecific->Add(psizerDetailSpecificGrid, 1, wxGROW, 0 ); ////////////////////////////////////////////////////////////////////////// // Column headings for flex grid inside static box ////////////////////////////////////////////////////////////////////////// for (iCol = 0; iCol < 2; iCol++) { for (iHeading = 0; pszHeadings[iHeading]; iHeading++) { psizerDetailSpecificGrid->Add( new wxStaticText(this, -1, pszHeadings[iHeading]), 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxLEFT, 5 ); } } ////////////////////////////////////////////////////////////////////////// // Go through each detail level ////////////////////////////////////////////////////////////////////////// for (iRow = 0; iRow < (nDetailLevels + 1) / 2; iRow++) { for (iCol = 0; iCol < 2; iCol++) { iDetailLevel = iRow + iCol * ((nDetailLevels + 1) / 2); if (iDetailLevel < nDetailLevels) { ////////////////////////////////////////////////////////////////////////// // Detail level label ////////////////////////////////////////////////////////////////////////// psizerDetailSpecificGrid->Add( new wxStaticText(this, -1, wxString::Format(wxT("%d"), iDetailLevel)), 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Label Visible checkbox ////////////////////////////////////////////////////////////////////////// m_pctlLabelVisible[iDetailLevel] = new wxCheckBox(this, iDetailLevel, wxT("")); psizerDetailSpecificGrid->Add(m_pctlLabelVisible[iDetailLevel], 1, wxALIGN_RIGHT | wxLEFT, 10 ); ////////////////////////////////////////////////////////////////////////// // Label color control ////////////////////////////////////////////////////////////////////////// m_pctlLabelColor[iDetailLevel] = new ColorPickerControl(this, idColor, wxDefaultPosition, wxSize(30, 20)); psizerDetailSpecificGrid->Add(m_pctlLabelColor[iDetailLevel], 1, wxFIXED_MINSIZE | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Label Font Size text control ////////////////////////////////////////////////////////////////////////// m_pctlLabelFontSize[iDetailLevel] = new wxTextCtrl(this, -1, wxT("")); psizerDetailSpecificGrid->Add(m_pctlLabelFontSize[iDetailLevel], 1, wxGROW, 0 );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -