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

📄 preferencespagescripting.cpp

📁 Powerful and Portable GPS application -- support Linux, Windows, Windows CE GPS navigation and Map m
💻 CPP
字号:
/* *  Roadnav *  PreferencesPageScripting.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 scripting 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 "libroadnav/MapSupport.h"#include "App.h"#include "PreferencesPageScripting.h"#ifdef USE_SCRIPTINGenum{	idScriptingTCPServerEnabled,	idScriptingStartupScriptEnabled};//////////////////////////////////////////////////////////////////////////////////// PreferencesPageScripting event table/////////////////////////////////////////////////////////////////////////////////BEGIN_EVENT_TABLE(PreferencesPageScripting, wxPanel)	EVT_CHECKBOX(idScriptingTCPServerEnabled, PreferencesPageScripting::OnCheckBox)	EVT_CHECKBOX(idScriptingStartupScriptEnabled, PreferencesPageScripting::OnCheckBox)END_EVENT_TABLE()//////////////////////////////////////////////////////////////////////////////////// \brief PreferencesPageScripting constructor - create controls and initialize them/////////////////////////////////////////////////////////////////////////////////PreferencesPageScripting::PreferencesPageScripting(wxWindow *parent)             : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL){	wxBoxSizer * psizerWnd;	wxFlexGridSizer * psizerGrid;		psizerGrid = new wxFlexGridSizer(2, 5, 10);	//////////////////////////////////////////////////////////////////////////	// TCP server enabled Label	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("TCP Server Enabled")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// TCP server enabled check box	//////////////////////////////////////////////////////////////////////////	m_pctlTCPServerEnabled = new wxCheckBox(this, idScriptingTCPServerEnabled, wxT(""));	m_pctlTCPServerEnabled->SetValue(g_pConfig->Read(wxT("ScriptingTCPServerEnabled"), (long) 0));	psizerGrid->Add(		m_pctlTCPServerEnabled,		0,		wxALIGN_LEFT,		0	);	//////////////////////////////////////////////////////////////////////////	// Accept TCP connections only from this computer Label	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("Accept TCP Connections Only From This Computer")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Accept TCP connections only from this computer check box	//////////////////////////////////////////////////////////////////////////	m_pctlTCPServerAcceptOnlyLocal = new wxCheckBox(this, -1, wxT(""));	m_pctlTCPServerAcceptOnlyLocal->SetValue(g_pConfig->Read(wxT("ScriptingTCPServerAcceptOnlyLocal"), (long) 1));	psizerGrid->Add(		m_pctlTCPServerAcceptOnlyLocal,		0,		wxALIGN_LEFT,		0	);	//////////////////////////////////////////////////////////////////////////	// TCP Server Port Number Label	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("TCP Server Port Number")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// TCP server port number Entry	//////////////////////////////////////////////////////////////////////////	m_pctlTCPServerPortNumber = new wxTextCtrl(this, -1, wxString::Format(wxT("%d"), (int) g_pConfig->Read(wxT("ScriptingTCPServerPortNumber"), DEFAULT_SCRIPTING_TCP_PORT_NUMBER)), wxDefaultPosition, wxSize(250, -1));	psizerGrid->Add(		m_pctlTCPServerPortNumber, 		0,		wxALIGN_LEFT,		0	);	//////////////////////////////////////////////////////////////////////////	// Startup script enabled Label	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("Startup Script Enabled")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Startup script enabled check box	//////////////////////////////////////////////////////////////////////////	m_pctlStartupScriptEnabled = new wxCheckBox(this, idScriptingStartupScriptEnabled, wxT(""));	m_pctlStartupScriptEnabled->SetValue(g_pConfig->Read(wxT("ScriptingStartupScriptEnabled"), (long) 0));	psizerGrid->Add(		m_pctlStartupScriptEnabled,		0,		wxALIGN_LEFT,		0	);	//////////////////////////////////////////////////////////////////////////	// Startup script erase Label	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("Erase Startup Script Once Run")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Startup script erase check box	//////////////////////////////////////////////////////////////////////////	m_pctlStartupScriptErase = new wxCheckBox(this, -1, wxT(""));	m_pctlStartupScriptErase->SetValue(g_pConfig->Read(wxT("ScriptingStartupScriptErase"), (long) 0));	psizerGrid->Add(		m_pctlStartupScriptErase,		0,		wxALIGN_LEFT,		0	);	//////////////////////////////////////////////////////////////////////////	// Startup Script Filename Label	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("Startup Script Filename")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Startup Script Filename Entry	//////////////////////////////////////////////////////////////////////////	m_pctlStartupScriptFilename = new wxTextCtrl(this, -1, g_pConfig->Read(wxT("ScriptingStartupScriptFilename"), wxT("")), wxDefaultPosition, wxSize(250, -1));	psizerGrid->Add(		m_pctlStartupScriptFilename, 		0,		wxALIGN_LEFT,		0	);		//////////////////////////////////////////////////////////////////////////	// Export Script Filename Label	//////////////////////////////////////////////////////////////////////////	psizerGrid->Add(		new wxStaticText(this, -1, wxT("Export Script Filename")),		0,		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,		0	);		//////////////////////////////////////////////////////////////////////////	// Export Script Filename Entry	//////////////////////////////////////////////////////////////////////////	m_pctlExportScriptFilename = new wxTextCtrl(this, -1, g_pConfig->Read(wxT("ScriptingExportScriptFilename"), wxT("")), wxDefaultPosition, wxSize(250, -1));	psizerGrid->Add(		m_pctlExportScriptFilename, 		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_pctlTCPServerEnabled->SetFocus();	psizerWnd->Fit(this);	SetSizer(psizerWnd);	Layout();	psizerWnd->SetSizeHints(this);		wxCommandEvent ev;	OnCheckBox(ev);}void PreferencesPageScripting::OnCheckBox(wxCommandEvent & event){	m_pctlTCPServerAcceptOnlyLocal->Enable(m_pctlTCPServerEnabled->GetValue());	m_pctlTCPServerPortNumber->Enable(m_pctlTCPServerEnabled->GetValue());	m_pctlStartupScriptErase->Enable(m_pctlStartupScriptEnabled->GetValue());	m_pctlStartupScriptFilename->Enable(m_pctlStartupScriptEnabled->GetValue());}//////////////////////////////////////////////////////////////////////////////////// \brief Ok was pressed .. save the settings/////////////////////////////////////////////////////////////////////////////////void PreferencesPageScripting::OnOk(wxCommandEvent& event){	g_pConfig->Write(wxT("ScriptingTCPServerEnabled"), m_pctlTCPServerEnabled->GetValue());	g_pConfig->Write(wxT("ScriptingTCPServerAcceptOnlyLocal"), m_pctlTCPServerAcceptOnlyLocal->GetValue());	g_pConfig->Write(wxT("ScriptingTCPServerPortNumber"), wxtoi(m_pctlTCPServerPortNumber->GetValue()));	g_pConfig->Write(wxT("ScriptingStartupScriptEnabled"), m_pctlStartupScriptEnabled->GetValue());	g_pConfig->Write(wxT("ScriptingStartupScriptErase"), m_pctlStartupScriptErase->GetValue());	g_pConfig->Write(wxT("ScriptingStartupScriptFilename"), m_pctlStartupScriptFilename->GetValue());	g_pConfig->Write(wxT("ScriptingExportScriptFilename"), m_pctlExportScriptFilename->GetValue());}#endif

⌨️ 快捷键说明

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