⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 saveassettingsdialog.cpp

📁 Powerful and Portable GPS application -- support Linux, Windows, Windows CE GPS navigation and Map m
💻 CPP
字号:
/* *  Roadnav *  SaveAsSettingsDialog.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 SaveAsSettingsDialog - a dialog box prompting the user for/// file->save as settings like how big the map should be, AA level, etc./////////////////////////////////////////////////////////////////////////////////#ifdef HAVE_CONFIG_H#  include <config.h>#endif#include <wx/wx.h>#ifdef _MSC_VER#pragma warning(disable: 4786)#endif#include "App.h"#include "SaveAsSettingsDialog.h"#include <vector>using namespace std;//////////////////////////////////////////////////////////////////////////////// button IDs//////////////////////////////////////////////////////////////////////////////enum{	idVisibleSize,	idCustomSize};BEGIN_EVENT_TABLE(SaveAsSettingsDialog, wxDialog)	EVT_BUTTON(wxID_OK, SaveAsSettingsDialog::OnOk)	EVT_RADIOBUTTON(idVisibleSize, SaveAsSettingsDialog::OnSizeType)	EVT_RADIOBUTTON(idCustomSize, SaveAsSettingsDialog::OnSizeType)END_EVENT_TABLE()//////////////////////////////////////////////////////////////////////////////////// \brief Constructor - creates all of the controls and initializes them with/// default values from the registry./////////////////////////////////////////////////////////////////////////////////SaveAsSettingsDialog::SaveAsSettingsDialog(MapFrame * parent)             : wxDialog(parent, -1, wxString(wxT("Save File As Settings"))){	wxBoxSizer * psizerWnd;	wxFlexGridSizer * psizerGrid;	int iVisibleWidth;	int iVisibleHeight;	m_iWidth = 0;	m_iHeight = 0;		m_pParent = parent;		psizerGrid = new wxFlexGridSizer(2, 5, 10);	//////////////////////////////////////////////////////////////////////////	// Visible size radio button	//////////////////////////////////////////////////////////////////////////	iVisibleWidth = m_pParent->GetMapControl()->GetSize().GetWidth();	iVisibleHeight = m_pParent->GetMapControl()->GetSize().GetHeight();	m_pctlVisibleSize = new wxRadioButton(this, idVisibleSize, wxString::Format(wxT("Visible Size (%d x %d)"), iVisibleWidth, iVisibleHeight), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);	psizerGrid->Add(		m_pctlVisibleSize,		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT,		0	);		//////////////////////////////////////////////////////////////////////////	// Blank text	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Custom size radio button	//////////////////////////////////////////////////////////////////////////	m_pctlCustomSize = new wxRadioButton(this, idCustomSize, wxT("Custom Size"), wxDefaultPosition, wxDefaultSize, 0);		psizerGrid->Add(		m_pctlCustomSize,		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT,		0	);		//////////////////////////////////////////////////////////////////////////	// Blank text	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Width text	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("Width")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Width spinner	//////////////////////////////////////////////////////////////////////////	m_pctlWidth = new wxSpinCtrl(this, -1);	m_pctlWidth->SetRange(1, 8192);	m_pctlWidth->SetValue(g_pConfig->Read(wxT("SaveAsWidth"), 1024));	psizerGrid->Add(		m_pctlWidth, 		0,		wxALIGN_LEFT,		0	);	//////////////////////////////////////////////////////////////////////////	// Height text	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("Height")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Height spinner	//////////////////////////////////////////////////////////////////////////	m_pctlHeight = new wxSpinCtrl(this, -1);	m_pctlHeight->SetRange(1, 8192);	m_pctlHeight->SetValue(g_pConfig->Read(wxT("SaveAsHeight"), 768));	psizerGrid->Add(		m_pctlHeight, 		0,		wxALIGN_LEFT,		0	);	//////////////////////////////////////////////////////////////////////////	// psizerWnd just adds a border to psizerGrid	//////////////////////////////////////////////////////////////////////////		psizerWnd = new wxBoxSizer(wxVERTICAL);	psizerWnd->Add(		psizerGrid,		0,		wxALL | wxGROW,		10	);		//////////////////////////////////////////////////////////////////////////////	// ok and cancel button	//////////////////////////////////////////////////////////////////////////////    wxBoxSizer *sizerBottom = new wxBoxSizer(wxHORIZONTAL);    wxButton * btnOk = new wxButton(this, wxID_OK, wxT("&OK"));    sizerBottom->Add(btnOk, 0, wxALIGN_CENTER | wxALL, 5);    wxButton * btnCancel = new wxButton(this, wxID_CANCEL, wxT("&Cancel"));    sizerBottom->Add(btnCancel, 0, wxALIGN_CENTER | wxALL, 5);	psizerWnd->Add(sizerBottom, 0, wxALIGN_CENTER, 0);	//////////////////////////////////////////////////////////////////////////	// Set up the sizer	//////////////////////////////////////////////////////////////////////////	psizerWnd->Fit(this);	SetSizer(psizerWnd);	Layout();	psizerWnd->SetSizeHints(this);    btnOk->SetDefault();        m_pctlVisibleSize->SetValue(g_pConfig->Read(wxT("SaveAsType"), (long) 0) == 0);    m_pctlCustomSize->SetValue(g_pConfig->Read(wxT("SaveAsType"), (long) 0) == 1);        wxCommandEvent ev;    OnSizeType(ev);		Center();}//////////////////////////////////////////////////////////////////////////////////// \brief Ok pressed/////////////////////////////////////////////////////////////////////////////////void SaveAsSettingsDialog::OnOk(wxCommandEvent& event){	if (m_pctlCustomSize->GetValue())	{		// custom size		m_iWidth = m_pctlWidth->GetValue();		m_iHeight = m_pctlHeight->GetValue();		g_pConfig->Write(wxT("SaveAsHeight"), m_iHeight);		g_pConfig->Write(wxT("SaveAsWidth"), m_iWidth);				g_pConfig->Write(wxT("SaveAsType"), 1);	}	else 	{		// visible size				m_iWidth = m_pParent->GetMapControl()->GetSize().GetWidth();		m_iHeight = m_pParent->GetMapControl()->GetSize().GetHeight();				g_pConfig->Write(wxT("SaveAsType"), 0);	}	EndModal(wxID_OK);}//////////////////////////////////////////////////////////////////////////////////// \brief Radio button pressed/////////////////////////////////////////////////////////////////////////////////void SaveAsSettingsDialog::OnSizeType(wxCommandEvent& event){	m_pctlWidth->Enable(m_pctlCustomSize->GetValue());	m_pctlHeight->Enable(m_pctlCustomSize->GetValue());}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -