From d9ab621ea2513f623f3f7c1699648f189e37be3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 27 Jul 2004 19:14:36 +0000 Subject: [PATCH] Finally whole configtool works regardless of wxUSE_STL value (at least with Borland). Changes followed adjustements of other things like better styles, storing pointers, unified headers of files, etc. etc. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28522 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/configtool/src/appsettings.cpp | 15 +- utils/configtool/src/configbrowser.cpp | 23 ++- utils/configtool/src/configbrowser.h | 12 +- utils/configtool/src/configitem.cpp | 17 ++- utils/configtool/src/configitemselector.cpp | 29 ++-- utils/configtool/src/configitemselector.h | 2 +- utils/configtool/src/configtooldoc.cpp | 44 +++--- utils/configtool/src/configtoolview.cpp | 7 +- utils/configtool/src/configtree.cpp | 6 +- utils/configtool/src/custompropertydialog.cpp | 137 +++++++++-------- utils/configtool/src/custompropertydialog.h | 22 +-- utils/configtool/src/htmlparser.cpp | 8 +- utils/configtool/src/mainframe.cpp | 15 +- utils/configtool/src/mainframe.h | 1 + utils/configtool/src/propeditor.cpp | 29 ++-- utils/configtool/src/propeditor.h | 2 + utils/configtool/src/property.cpp | 31 ++-- utils/configtool/src/settingsdialog.cpp | 141 ++++++++++-------- utils/configtool/src/settingsdialog.h | 31 ++-- utils/configtool/src/symbols.h | 4 +- utils/configtool/src/utils.cpp | 71 +++++---- utils/configtool/src/utils.h | 2 + utils/configtool/src/wxconfigtool.cpp | 20 ++- 23 files changed, 374 insertions(+), 295 deletions(-) diff --git a/utils/configtool/src/appsettings.cpp b/utils/configtool/src/appsettings.cpp index 56af6008d0..22b5571acc 100644 --- a/utils/configtool/src/appsettings.cpp +++ b/utils/configtool/src/appsettings.cpp @@ -13,28 +13,29 @@ #pragma implementation "appsettings.h" #endif -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP -#include "wx/wx.h" -#endif -#include "wx/wfstream.h" #include "wx/datstrm.h" -#include "wx/config.h" -#include "wx/fileconf.h" #include "wx/dir.h" -#include "wx/valgen.h" #include "wx/colordlg.h" #include "wx/wxhtml.h" #include "wx/effects.h" #include "wx/spinctrl.h" #include "wx/tooltip.h" +#endif + +#include "wx/wfstream.h" +#include "wx/config.h" +#include "wx/fileconf.h" +#include "wx/valgen.h" #include "utils.h" #include "wxconfigtool.h" #include "appsettings.h" diff --git a/utils/configtool/src/configbrowser.cpp b/utils/configtool/src/configbrowser.cpp index 0eee4d5fa0..b82261ca0e 100644 --- a/utils/configtool/src/configbrowser.cpp +++ b/utils/configtool/src/configbrowser.cpp @@ -1,19 +1,28 @@ ///////////////////////////////////////////////////////////////////////////// // Name: configbrowser.cpp -// Purpose: -// Author: +// Purpose: Configuration browser +// Author: Julian Smart // Modified by: -// Created: -// RCS-ID: -// Copyright: +// Created: 2003-08-14 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart // Licence: ///////////////////////////////////////////////////////////////////////////// -////@begin includes +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/wx.h" #include "wx/splitter.h" #include "wx/treectrl.h" -////@end includes + +#endif #include "configbrowser.h" diff --git a/utils/configtool/src/configbrowser.h b/utils/configtool/src/configbrowser.h index 08c108931f..f7e0e9a40c 100644 --- a/utils/configtool/src/configbrowser.h +++ b/utils/configtool/src/configbrowser.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// // Name: configbrowser.h -// Purpose: -// Author: +// Purpose: Configuration browser +// Author: Julian Smart // Modified by: -// Created: -// RCS-ID: -// Copyright: +// Created: 2003-08-14 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart // Licence: ///////////////////////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ class ctConfigurationBrowserControlPanel: public wxPanel public: /// Constructor - ctConfigurationBrowserControlPanel( wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER|wxTAB_TRAVERSAL ); + ctConfigurationBrowserControlPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER|wxTAB_TRAVERSAL ); /// Creates the controls and sizers void CreateControls(); diff --git a/utils/configtool/src/configitem.cpp b/utils/configtool/src/configitem.cpp index c19655aeb7..fdf4ceac4f 100644 --- a/utils/configtool/src/configitem.cpp +++ b/utils/configtool/src/configitem.cpp @@ -13,15 +13,14 @@ #pragma implementation "configitem.h" #endif -// Includes other headers for precompiled compilation -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #include "wx/tokenzr.h" - #include "configitem.h" #include "configtree.h" #include "configtooldoc.h" @@ -439,12 +438,14 @@ void ctConfigItem::Attach(ctConfigItem* parent, ctConfigItem* insertBefore) if (parent) { SetParent(parent); - wxObjectList::compatibility_iterator node = (wxObjectList::compatibility_iterator)NULL; if (insertBefore) - node = parent->GetChildren().Member(insertBefore); - - if (node) - parent->GetChildren().Insert(node, this); + { + wxObjectList::compatibility_iterator node = parent->GetChildren().Member(insertBefore); + if (node) + parent->GetChildren().Insert(node, this); + else + parent->GetChildren().Append(this); + } else parent->GetChildren().Append(this); } diff --git a/utils/configtool/src/configitemselector.cpp b/utils/configtool/src/configitemselector.cpp index 111a66c7a0..6b01692a7b 100644 --- a/utils/configtool/src/configitemselector.cpp +++ b/utils/configtool/src/configitemselector.cpp @@ -13,25 +13,26 @@ #pragma implementation "configitemselector.h" #endif +// For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop +#pragma hdrstop #endif #ifndef WX_PRECOMP - #include "wx/wx.h" + +#include "wx/statline.h" +#include "wx/splitter.h" +#include "wx/scrolwin.h" +#include "wx/spinctrl.h" +#include "wx/spinbutt.h" + #endif -#include -#include -#include -#include -#include -#include -#include -#include - +#include "wx/cshelp.h" +#include "wx/notebook.h" +#include "wx/valgen.h" #include "configitemselector.h" #include "configtooldoc.h" #include "configtoolview.h" @@ -71,9 +72,9 @@ END_EVENT_TABLE() * ctConfigItemsSelector constructor */ -ctConfigItemsSelector::ctConfigItemsSelector( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +ctConfigItemsSelector::ctConfigItemsSelector( wxWindow* parent, wxWindowID id, const wxString& caption) { - wxDialog::Create( parent, id, caption, pos, size, style ); + wxDialog::Create( parent, id, caption); CreateControls(); InitSourceConfigList(); @@ -251,7 +252,7 @@ void ctConfigItemsSelector::InitSourceConfigList(ctConfigItem* item) masterList->Append(item->GetName()); } - wxNode* node = item->GetChildren().GetFirst(); + wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); while (node) { ctConfigItem* child = (ctConfigItem*) node->GetData(); diff --git a/utils/configtool/src/configitemselector.h b/utils/configtool/src/configitemselector.h index c19a3af1a1..80d9950f1b 100644 --- a/utils/configtool/src/configitemselector.h +++ b/utils/configtool/src/configitemselector.h @@ -52,7 +52,7 @@ class ctConfigItemsSelector: public wxDialog { public: /// Constructor - ctConfigItemsSelector( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = _("Configuration Items Selector"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU ); + ctConfigItemsSelector( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = _("Configuration Items Selector")); /// Creates the controls and sizers void CreateControls(); diff --git a/utils/configtool/src/configtooldoc.cpp b/utils/configtool/src/configtooldoc.cpp index 6e7a276271..122bd5926a 100644 --- a/utils/configtool/src/configtooldoc.cpp +++ b/utils/configtool/src/configtooldoc.cpp @@ -13,23 +13,24 @@ #pragma implementation "configtooldoc.h" #endif -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif -#include "wx/config.h" -#include "wx/textfile.h" +#ifndef WX_PRECOMP + #include "wx/process.h" #include "wx/mimetype.h" #include "wx/process.h" -#include "wx/wfstream.h" -#ifdef __BORLANDC__ -#pragma hdrstop #endif +#include "wx/textfile.h" +#include "wx/wfstream.h" +#include "wx/config.h" #include "configtooldoc.h" #include "configtoolview.h" #include "configtree.h" @@ -324,7 +325,7 @@ bool ctConfigToolDoc::DoSave(ctConfigItem* item, wxOutputStream& stream, int ind stream << wxT("0"); // Output properties - wxNode* node = item->GetProperties().GetList().GetFirst(); + wxObjectList::compatibility_iterator node = item->GetProperties().GetList().GetFirst(); while (node) { ctProperty* prop = (ctProperty*) node->GetData(); @@ -551,7 +552,7 @@ void ctConfigToolDoc::ClearDependencies(ctConfigItem* item) item = GetTopItem(); item->GetDependents().Clear(); - for ( wxNode* node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) + for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) { ctConfigItem* child = (ctConfigItem*) node->GetData(); ClearDependencies(child); @@ -616,7 +617,7 @@ void ctConfigToolDoc::RefreshDependencies(ctConfigItem* item) otherItem->GetDependents().Append(item); } } - for ( wxNode* node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) + for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) { ctConfigItem* child = (ctConfigItem*) node->GetData(); RefreshDependencies(child); @@ -665,7 +666,7 @@ void ctConfigToolDoc::GenerateSetup(ctConfigItem* item, wxString& str) } } - for ( wxNode* node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) + for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) { ctConfigItem* child = (ctConfigItem*) node->GetData(); GenerateSetup(child, str); @@ -695,7 +696,7 @@ wxString ctConfigToolDoc::GenerateConfigureCommand() ctConfigItem* platformsFolder = GetTopItem()->FindItem(wxT("Target")); if (platformsFolder) { - for ( wxNode* node = platformsFolder->GetChildren().GetFirst(); node; node = node->GetNext() ) + for ( wxObjectList::compatibility_iterator node = platformsFolder->GetChildren().GetFirst(); node; node = node->GetNext() ) { ctConfigItem* child = (ctConfigItem*) node->GetData(); if (child->GetType() == ctTypeBoolRadio && child->IsEnabled()) @@ -769,7 +770,7 @@ void ctConfigToolDoc::GenerateConfigureCommand(ctConfigItem* item, wxString& str } } - for ( wxNode* node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) + for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) { ctConfigItem* child = (ctConfigItem*) node->GetData(); GenerateConfigureCommand(child, str); @@ -784,7 +785,8 @@ wxString ctConfigToolDoc::GetFrameworkDir(bool makeUnix) { // Should probably allow other variables // to be used, and maybe expand variables within m_frameworkDir - path = wxGetenv(wxT("WXWIN")); + wxString pathEnv(wxGetenv(wxT("WXWIN"))); + path = pathEnv; #ifdef __WXMSW__ if (makeUnix) path.Replace(wxT("\\"), wxT("/")); @@ -828,7 +830,7 @@ ctConfigItem* ctConfigToolDoc::FindNextSibling(ctConfigItem* item) { if (item->GetParent()) { - wxNode* node = item->GetParent()->GetChildren().Member(item); + wxObjectList::compatibility_iterator node = item->GetParent()->GetChildren().Member(item); if (node && node->GetNext()) { ctConfigItem* nextItem = (ctConfigItem*) node->GetNext()->GetData(); @@ -1010,7 +1012,7 @@ bool ctConfigCommand::DoAndUndo(bool doCmd) // Apply only those that need applying // (those properties in activeState that are not in propsTemp) - wxNode* node = m_activeState->GetProperties().GetList().GetFirst(); + wxObjectList::compatibility_iterator node = m_activeState->GetProperties().GetList().GetFirst(); while (node) { ctProperty* prop = (ctProperty*) node->GetData(); @@ -1088,10 +1090,10 @@ void ctConfiguration::operator= (const ctConfiguration& configuration) /// Clear children void ctConfiguration::Clear() { - wxNode* node = m_children.GetFirst(); + wxObjectList::compatibility_iterator node = m_children.GetFirst(); while (node) { - wxNode* next = node->GetNext(); + wxObjectList::compatibility_iterator next = node->GetNext(); ctConfiguration* child = (ctConfiguration*) node->GetData(); // This should delete 'node' too, assuming @@ -1153,7 +1155,7 @@ ctConfiguration* ctConfiguration::FindConfiguration(const wxString& name) if (GetName() == name) return this; - for ( wxNode* node = GetChildren().GetFirst(); node; node = node->GetNext() ) + for ( wxObjectList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() ) { ctConfiguration* child = (ctConfiguration*) node->GetData(); ctConfiguration* found = child->FindConfiguration(name); @@ -1168,7 +1170,7 @@ ctConfiguration* ctConfiguration::FindNextSibling() { if (!GetParent()) return NULL; - wxNode* node = GetParent()->GetChildren().Member(this); + wxObjectList::compatibility_iterator node = GetParent()->GetChildren().Member(this); if (node && node->GetNext()) { return (ctConfiguration*) node->GetNext()->GetData(); @@ -1181,7 +1183,7 @@ ctConfiguration* ctConfiguration::FindPreviousSibling() { if (!GetParent()) return NULL; - wxNode* node = GetParent()->GetChildren().Member(this); + wxObjectList::compatibility_iterator node = GetParent()->GetChildren().Member(this); if (node && node->GetPrevious()) { return (ctConfiguration*) node->GetPrevious()->GetData(); @@ -1194,7 +1196,7 @@ ctConfiguration* ctConfiguration::DeepClone() { ctConfiguration* newItem = Clone(); - for ( wxNode* node = GetChildren().GetFirst(); node; node = node->GetNext() ) + for ( wxObjectList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() ) { ctConfiguration* child = (ctConfiguration*) node->GetData(); ctConfiguration* newChild = child->DeepClone(); diff --git a/utils/configtool/src/configtoolview.cpp b/utils/configtool/src/configtoolview.cpp index 726e509bf4..4d1760e81b 100644 --- a/utils/configtool/src/configtoolview.cpp +++ b/utils/configtool/src/configtoolview.cpp @@ -13,15 +13,14 @@ #pragma implementation "configtoolview.h" #endif -// Includes other headers for precompiled compilation -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop +#pragma hdrstop #endif #include "wx/wfstream.h" - #include "configtoolview.h" #include "configtooldoc.h" #include "configtree.h" diff --git a/utils/configtool/src/configtree.cpp b/utils/configtool/src/configtree.cpp index 942457bbbe..7623146bb8 100644 --- a/utils/configtool/src/configtree.cpp +++ b/utils/configtool/src/configtree.cpp @@ -13,15 +13,15 @@ #pragma implementation "configtree.h" #endif -// Includes other headers for precompiled compilation -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif -#include "wx/imaglist.h" #include "wx/cshelp.h" +#include "wx/imaglist.h" // Include XPM icons #include "bitmaps/closedfolder.xpm" diff --git a/utils/configtool/src/custompropertydialog.cpp b/utils/configtool/src/custompropertydialog.cpp index b002d67ced..1791d0865a 100644 --- a/utils/configtool/src/custompropertydialog.cpp +++ b/utils/configtool/src/custompropertydialog.cpp @@ -13,15 +13,26 @@ #pragma implementation "custompropertydialog.h" #endif -#include -#include -#include -#include -#include -#include -#include -#include +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + +#include "wx/wx.h" +#include "wx/statline.h" +#include "wx/splitter.h" +#include "wx/scrolwin.h" +#include "wx/spinctrl.h" +#include "wx/spinbutt.h" + +#endif + +#include "wx/cshelp.h" +#include "wx/valgen.h" #include "custompropertydialog.h" ////@begin XPM images @@ -56,11 +67,11 @@ END_EVENT_TABLE() * ctCustomPropertyDialog constructor */ -ctCustomPropertyDialog::ctCustomPropertyDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +ctCustomPropertyDialog::ctCustomPropertyDialog( wxWindow* parent, wxWindowID id, const wxString& caption) { m_type = wxT("string"); - wxDialog::Create( parent, id, caption, pos, size, style ); + wxDialog::Create( parent, id, caption); CreateControls(); } @@ -73,6 +84,8 @@ void ctCustomPropertyDialog::CreateControls() { ////@begin ctCustomPropertyDialog content construction + wxArrayString items; + ctCustomPropertyDialog* item1 = this; wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL); @@ -87,8 +100,8 @@ void ctCustomPropertyDialog::CreateControls() wxStaticText* item5 = new wxStaticText(item1, wxID_STATIC, _("&Name:"), wxDefaultPosition, wxDefaultSize, 0); item3->Add(item5, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - wxTextCtrl* item6 = new wxTextCtrl(item1, ID_CUSTOMPROPERTYNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); - item3->Add(item6, 0, wxGROW|wxALL, 5); + m_customPropertyName = new wxTextCtrl(item1, wxID_ANY); + item3->Add(m_customPropertyName, 0, wxGROW|wxALL, 5); wxBoxSizer* item7 = new wxBoxSizer(wxHORIZONTAL); item3->Add(item7, 0, wxGROW, 5); @@ -99,15 +112,14 @@ void ctCustomPropertyDialog::CreateControls() wxStaticText* item9 = new wxStaticText(item1, wxID_STATIC, _("&Data type:"), wxDefaultPosition, wxDefaultSize, 0); item8->Add(item9, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - wxString item10Strings[] = { - _("string"), - _("bool"), - _("double"), - _("long") - }; - wxChoice* item10 = new wxChoice(item1, ID_CUSTOMPROPERTYTYPE, wxDefaultPosition, wxDefaultSize, 4, item10Strings, 0); - item10->SetStringSelection(_("string")); - item8->Add(item10, 1, wxGROW|wxALL, 5); + items.Empty(); + items.Add(_("string")); + items.Add(_("bool")); + items.Add(_("double")); + items.Add(_("long")); + m_customPrototype = new wxChoice(item1, wxID_ANY, wxDefaultPosition, wxDefaultSize, items); + m_customPrototype->SetStringSelection(_("string")); + item8->Add(m_customPrototype, 1, wxGROW|wxALL, 5); wxBoxSizer* item11 = new wxBoxSizer(wxVERTICAL); item7->Add(item11, 0, wxALIGN_CENTER_VERTICAL, 5); @@ -115,25 +127,24 @@ void ctCustomPropertyDialog::CreateControls() wxStaticText* item12 = new wxStaticText(item1, wxID_STATIC, _("&Editor type:"), wxDefaultPosition, wxDefaultSize, 0); item11->Add(item12, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - wxString item13Strings[] = { - _("string"), - _("choice"), - _("bool"), - _("float"), - _("integer"), - _("configitems") - }; - wxChoice* item13 = new wxChoice(item1, ID_CUSTOMPROPERTYEDITORTYPE, wxDefaultPosition, wxDefaultSize, 6, item13Strings, 0); - item13->SetStringSelection(_("string")); - item11->Add(item13, 1, wxGROW|wxALL, 5); + items.Empty(); + items.Add(_("string")); + items.Add(_("choice")); + items.Add(_("bool")); + items.Add(_("float")); + items.Add(_("integer")); + items.Add(_("configitems")); + m_customPropertyEditorType = new wxChoice(item1, wxID_ANY, wxDefaultPosition, wxDefaultSize, items); + m_customPropertyEditorType->SetStringSelection(_("string")); + item11->Add(m_customPropertyEditorType, 1, wxGROW|wxALL, 5); wxStaticBox* item14Static = new wxStaticBox(item1, wxID_ANY, _("Choices")); wxStaticBoxSizer* item14 = new wxStaticBoxSizer(item14Static, wxHORIZONTAL); item3->Add(item14, 0, wxGROW|wxALL, 5); wxString* item15Strings = NULL; - wxListBox* item15 = new wxListBox(item1, ID_PROPERTY_CHOICES, wxDefaultPosition, wxDefaultSize, 0, item15Strings, wxLB_SINGLE); - item14->Add(item15, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_propertyChoices = new wxListBox(item1, ID_PROPERTY_CHOICES, wxDefaultPosition, wxDefaultSize, 0, item15Strings, wxLB_SINGLE); + item14->Add(m_propertyChoices, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* item16 = new wxBoxSizer(wxVERTICAL); item14->Add(item16, 0, wxALIGN_CENTER_VERTICAL, 5); @@ -147,8 +158,8 @@ void ctCustomPropertyDialog::CreateControls() wxStaticText* item19 = new wxStaticText(item1, wxID_STATIC, _("&Description:"), wxDefaultPosition, wxDefaultSize, 0); item3->Add(item19, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - wxTextCtrl* item20 = new wxTextCtrl(item1, ID_CUSTOMPROPERTYDESCRIPTION, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH); - item3->Add(item20, 1, wxGROW|wxALL, 5); + m_customPropertyDescription = new wxTextCtrl(item1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH); + item3->Add(m_customPropertyDescription, 1, wxGROW|wxALL, 5); wxBoxSizer* item21 = new wxBoxSizer(wxHORIZONTAL); item3->Add(item21, 0, wxGROW|wxALL, 5); @@ -170,10 +181,10 @@ void ctCustomPropertyDialog::CreateControls() ////@end ctCustomPropertyDialog content construction // Add validators - FindWindow(ID_CUSTOMPROPERTYNAME)->SetValidator(wxGenericValidator(& m_name)); - FindWindow(ID_CUSTOMPROPERTYTYPE)->SetValidator(wxGenericValidator(& m_type)); - FindWindow(ID_CUSTOMPROPERTYEDITORTYPE)->SetValidator(wxGenericValidator(& m_editorType)); - FindWindow(ID_CUSTOMPROPERTYDESCRIPTION)->SetValidator(wxGenericValidator(& m_description)); + m_customPropertyName->SetValidator(wxGenericValidator(& m_name)); + m_customPrototype->SetValidator(wxGenericValidator(& m_type)); + m_customPropertyEditorType->SetValidator(wxGenericValidator(& m_editorType)); + m_customPropertyDescription->SetValidator(wxGenericValidator(& m_description)); } /*! @@ -191,8 +202,8 @@ bool ctCustomPropertyDialog::ShowToolTips() void ctCustomPropertyDialog::OnUpdatePropertyChoices( wxUpdateUIEvent& event ) { - wxChoice* choice = (wxChoice* ) FindWindow(ID_CUSTOMPROPERTYTYPE); - event.Enable( choice->GetSelection() > -1 && choice->GetStringSelection() == wxT("choice") ); + if(m_customPrototype) + event.Enable( m_customPrototype->GetSelection() > -1 && m_customPrototype->GetStringSelection() == wxT("choice") ); } /*! @@ -201,15 +212,16 @@ void ctCustomPropertyDialog::OnUpdatePropertyChoices( wxUpdateUIEvent& event ) void ctCustomPropertyDialog::OnPropertyChoiceAdd( wxCommandEvent& WXUNUSED(event) ) { - wxChoice* choice = (wxChoice* ) FindWindow(ID_CUSTOMPROPERTYTYPE); - if ( choice->GetSelection() > -1 && choice->GetStringSelection() == wxT("choice") ) + if(m_customPrototype) { - wxString str = wxGetTextFromUser(_T("New choice"), _("Add choice")); - if (!str.IsEmpty()) + if ( m_customPropertyEditorType->GetSelection() > -1 && m_customPropertyEditorType->GetStringSelection() == wxT("choice") ) { - wxListBox* listBox = (wxListBox* ) FindWindow(ID_PROPERTY_CHOICES); - listBox->Append(str); - m_choices.Add(str); + wxString str = wxGetTextFromUser(_T("New choice"), _("Add choice")); + if (!str.IsEmpty() && m_propertyChoices) + { + m_propertyChoices->Append(str); + m_choices.Add(str); + } } } } @@ -220,8 +232,9 @@ void ctCustomPropertyDialog::OnPropertyChoiceAdd( wxCommandEvent& WXUNUSED(event void ctCustomPropertyDialog::OnUpdatePropertyChoiceAdd( wxUpdateUIEvent& event ) { - wxChoice* choice = (wxChoice* ) FindWindow(ID_CUSTOMPROPERTYEDITORTYPE); - event.Enable( choice->GetSelection() > -1 && choice->GetStringSelection() == wxT("choice") ); + if(m_customPropertyEditorType) + event.Enable( m_customPropertyEditorType->GetSelection() > -1 && + m_customPropertyEditorType->GetStringSelection() == wxT("choice") ); } /*! @@ -230,12 +243,10 @@ void ctCustomPropertyDialog::OnUpdatePropertyChoiceAdd( wxUpdateUIEvent& event ) void ctCustomPropertyDialog::OnPropertyChoiceRemove( wxCommandEvent& WXUNUSED(event) ) { - /* wxChoice* choice = (wxChoice* ) */ FindWindow(ID_CUSTOMPROPERTYEDITORTYPE); - wxListBox* listBox = (wxListBox* ) FindWindow(ID_PROPERTY_CHOICES); - if (listBox->GetSelection() > -1) + if (m_propertyChoices && m_propertyChoices->GetSelection() > -1) { - listBox->Delete(listBox->GetSelection()); - m_choices.RemoveAt(listBox->GetSelection()); + m_propertyChoices->Delete(m_propertyChoices->GetSelection()); + m_choices.RemoveAt(m_propertyChoices->GetSelection()); } } @@ -245,16 +256,16 @@ void ctCustomPropertyDialog::OnPropertyChoiceRemove( wxCommandEvent& WXUNUSED(ev void ctCustomPropertyDialog::OnUpdatePropertyChoiceRemove( wxUpdateUIEvent& event ) { - wxChoice* choice = (wxChoice* ) FindWindow(ID_CUSTOMPROPERTYEDITORTYPE); - wxListBox* listBox = (wxListBox* ) FindWindow(ID_PROPERTY_CHOICES); - event.Enable( choice->GetSelection() > -1 && choice->GetStringSelection() == wxT("choice") && - listBox->GetSelection() > -1 ); + if (m_customPropertyEditorType && m_propertyChoices) + event.Enable( m_customPropertyEditorType->GetSelection() > -1 && + m_customPropertyEditorType->GetStringSelection() == wxT("choice") && + m_propertyChoices->GetSelection() > -1 ); } void ctCustomPropertyDialog::SetChoices(const wxArrayString& choices) { - wxListBox* listBox = (wxListBox* ) FindWindow(ID_PROPERTY_CHOICES); size_t i, len = choices.GetCount(); - for (i = 0; i < len; i++) - listBox->Append(m_choices[i]); + if (m_propertyChoices) + for (i = 0; i < len; i++) + m_propertyChoices->Append(m_choices[i]); } diff --git a/utils/configtool/src/custompropertydialog.h b/utils/configtool/src/custompropertydialog.h index a756d11fc1..fdde07a57d 100644 --- a/utils/configtool/src/custompropertydialog.h +++ b/utils/configtool/src/custompropertydialog.h @@ -36,13 +36,9 @@ ////@begin control identifiers #define ID_CUSTOMPROPERTYDIALOG 10000 -#define ID_CUSTOMPROPERTYNAME 10003 -#define ID_CUSTOMPROPERTYTYPE 10002 -#define ID_CUSTOMPROPERTYEDITORTYPE 10008 #define ID_PROPERTY_CHOICES 10001 #define ID_PROPERTY_CHOICE_ADD 10005 #define ID_PROPERTY_CHOICE_REMOVE 10006 -#define ID_CUSTOMPROPERTYDESCRIPTION 10004 ////@end control identifiers /*! @@ -53,7 +49,7 @@ class ctCustomPropertyDialog: public wxDialog { public: /// Constructor - ctCustomPropertyDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = _("Edit Custom Property"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU ); + ctCustomPropertyDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = _("Edit Custom Property")); /// Creates the controls and sizers void CreateControls(); @@ -102,11 +98,19 @@ public: DECLARE_CLASS( ctCustomPropertyDialog ) DECLARE_EVENT_TABLE() - wxString m_name; - wxString m_type; - wxString m_description; - wxString m_editorType; +protected: + wxString m_name; + wxString m_type; + wxString m_description; + wxString m_editorType; wxArrayString m_choices; + + // Dialog controls + wxTextCtrl* m_customPropertyName; + wxTextCtrl* m_customPropertyDescription; + wxChoice* m_customPrototype; + wxChoice* m_customPropertyEditorType; + wxListBox* m_propertyChoices; }; #endif diff --git a/utils/configtool/src/htmlparser.cpp b/utils/configtool/src/htmlparser.cpp index 9eba43650b..5e24db20b0 100644 --- a/utils/configtool/src/htmlparser.cpp +++ b/utils/configtool/src/htmlparser.cpp @@ -16,18 +16,16 @@ #pragma implementation "htmlparser.h" #endif -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif -#include "wx/textfile.h" #include "wx/wfstream.h" +#include "wx/textfile.h" #include "wx/txtstrm.h" - -#include - #include "htmlparser.h" /// Useful insertion operators for wxOutputStream. diff --git a/utils/configtool/src/mainframe.cpp b/utils/configtool/src/mainframe.cpp index 4d5177ae38..9926786257 100644 --- a/utils/configtool/src/mainframe.cpp +++ b/utils/configtool/src/mainframe.cpp @@ -13,19 +13,24 @@ #pragma implementation "mainframe.h" #endif -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif +#ifndef WX_PRECOMP + +#include "wx/splitter.h" + +#endif + +#include "wx/cshelp.h" #include "wx/html/htmlwin.h" #include "wx/notebook.h" -#include "wx/splitter.h" -#include "wx/clipbrd.h" #include "wx/dataobj.h" -#include "wx/cshelp.h" - +#include "wx/clipbrd.h" #include "wxconfigtool.h" #include "mainframe.h" #include "appsettings.h" diff --git a/utils/configtool/src/mainframe.h b/utils/configtool/src/mainframe.h index a80dce014c..f809d477e1 100644 --- a/utils/configtool/src/mainframe.h +++ b/utils/configtool/src/mainframe.h @@ -18,6 +18,7 @@ #include "wx/imaglist.h" #include "wx/docview.h" +#include "wx/notebook.h" // #define USE_CONFIG_BROWSER_PAGE diff --git a/utils/configtool/src/propeditor.cpp b/utils/configtool/src/propeditor.cpp index b7b05fb696..27e3e34600 100644 --- a/utils/configtool/src/propeditor.cpp +++ b/utils/configtool/src/propeditor.cpp @@ -13,23 +13,29 @@ #pragma implementation "propeditor.h" #endif -#include +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif -#include "wx/html/htmlwin.h" +#ifndef WX_PRECOMP + #include "wx/grid.h" #include "wx/filedlg.h" + +#endif + +#include "wx/html/htmlwin.h" #include "wx/tokenzr.h" #include "wx/valgen.h" - #include "propeditor.h" #include "symbols.h" #include "utils.h" #include "configtooldoc.h" #include "configitemselector.h" + #include "bitmaps/ellipsis.xpm" @@ -75,8 +81,8 @@ void ctPropertyEditor::CreateControls(wxWindow* parent) wxTextCtrl *item2 = m_elementTitleTextCtrl; item1->Add( item2, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - wxButton *item3a = new wxButton( parent, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS, wxT("Edit...")); - item1->Add( item3a, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ); + m_attributeEditorEditDetails = new wxButton( parent, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS, wxT("Edit...")); + item1->Add( m_attributeEditorEditDetails, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); @@ -103,9 +109,9 @@ void ctPropertyEditor::CreateControls(wxWindow* parent) /// Add help text m_elementTitleTextCtrl->SetHelpText(_("The title of the property being edited.")); - FindWindow(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS)->SetHelpText(_("Click to use an appropriate editor for the selected property (if any).")); - FindWindow(ctID_ATTRIBUTE_EDITOR_GRID)->SetHelpText(_("Shows the properties of the selected item.")); - FindWindow(ctID_ATTRIBUTE_EDITOR_DESCRIPTION)->SetHelpText(_("Shows a description of the selected property, or a summary of the whole item.")); + m_attributeEditorEditDetails->SetHelpText(_("Click to use an appropriate editor for the selected property (if any).")); + m_attributeEditorGrid->SetHelpText(_("Shows the properties of the selected item.")); + m_propertyDescriptionWindow->SetHelpText(_("Shows a description of the selected property, or a summary of the whole item.")); /// Set up the grid to display properties m_attributeEditorGrid->RegisterDataType(ctGRID_VALUE_STRING, @@ -205,7 +211,7 @@ void ctPropertyEditor::ShowItem(ctConfigItem* item) m_attributeEditorGrid->AppendRows(m_item->GetProperties().GetCount()); - wxNode* node = m_item->GetProperties().GetList().GetFirst(); + wxObjectList::compatibility_iterator node = m_item->GetProperties().GetList().GetFirst(); int i = 0; while (node) { @@ -255,7 +261,7 @@ void ctPropertyEditor::UpdateItem() { UpdateTitle(); - wxNode* node = m_item->GetProperties().GetList().GetFirst(); + wxObjectList::compatibility_iterator node = m_item->GetProperties().GetList().GetFirst(); int i = 0; while (node) { @@ -808,7 +814,6 @@ bool ctMultiLineTextEditor::AddControls(wxWindow* parent, const wxString& msg) item4->Add( 5, 5, 1, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item5 = new wxButton( parent, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - item5->SetDefault(); item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item6 = new wxButton( parent, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -823,7 +828,7 @@ bool ctMultiLineTextEditor::AddControls(wxWindow* parent, const wxString& msg) item3->SetFocus(); - ((wxButton*) FindWindow(wxID_OK))->SetDefault(); + item5->SetDefault(); parent->SetSizer(item0); item0->Fit(parent); diff --git a/utils/configtool/src/propeditor.h b/utils/configtool/src/propeditor.h index ae9f9fab73..4ebf1f4dd8 100644 --- a/utils/configtool/src/propeditor.h +++ b/utils/configtool/src/propeditor.h @@ -139,6 +139,8 @@ class ctPropertyEditor: public wxPanel DECLARE_EVENT_TABLE() protected: + // Dialog controls + wxButton* m_attributeEditorEditDetails; ctPropertyEditorGrid* m_attributeEditorGrid; wxHtmlWindow* m_propertyDescriptionWindow; wxSplitterWindow* m_splitterWindow; diff --git a/utils/configtool/src/property.cpp b/utils/configtool/src/property.cpp index 5682362b4f..4200ed6bea 100644 --- a/utils/configtool/src/property.cpp +++ b/utils/configtool/src/property.cpp @@ -14,7 +14,12 @@ #pragma implementation "property.h" #endif -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif #include "property.h" @@ -27,19 +32,23 @@ void ctProperties::AddProperty(ctProperty* property, const wxString& insertAfter if (oldProp) m_list.DeleteObject(oldProp); - wxNode* insertBeforeNode = NULL; if (insertAfter) { ctProperty* insertAfterProp = FindProperty(insertAfter); if (insertAfterProp) { - wxNode* node = m_list.Member(insertAfterProp); + wxObjectList::compatibility_iterator node = m_list.Member(insertAfterProp); if (node) - insertBeforeNode = node->GetNext(); + { + wxObjectList::compatibility_iterator insertBeforeNode = node->GetNext(); + m_list.Insert(insertBeforeNode, property); + } + else + m_list.Append(property); } + else + m_list.Append(property); } - if (insertBeforeNode) - m_list.Insert(insertBeforeNode, property); else m_list.Append(property); @@ -68,7 +77,7 @@ void ctProperties::DeleteProperty(const wxString& name) ctProperty* ctProperties::FindProperty(const wxString& name) const { - wxNode* node = m_list.GetFirst(); + wxObjectList::compatibility_iterator node = m_list.GetFirst(); while (node) { ctProperty* prop = (ctProperty*) node->GetData(); @@ -111,14 +120,12 @@ ctProperty* ctProperties::FindOrCreateProperty(const wxString& name) void ctProperties::Clear() { - m_list.DeleteContents(true); - m_list.Clear(); - m_list.DeleteContents(false); + WX_CLEAR_LIST(wxObjectList,m_list); } void ctProperties::Copy(const ctProperties& properties) { - wxNode* node = properties.m_list.GetFirst(); + wxObjectList::compatibility_iterator node = properties.m_list.GetFirst(); while (node) { ctProperty* prop = (ctProperty*) node->GetData(); @@ -158,7 +165,7 @@ ctProperty* ctProperties::GetNth(int i) const wxASSERT( i < (int) GetCount() ); if (i < (int) GetCount()) { - wxNode* node = m_list.Item(i); + wxObjectList::compatibility_iterator node = m_list.Item(i); return (ctProperty*) node->GetData(); } return NULL; diff --git a/utils/configtool/src/settingsdialog.cpp b/utils/configtool/src/settingsdialog.cpp index 2739518a7d..a01dc52bd9 100644 --- a/utils/configtool/src/settingsdialog.cpp +++ b/utils/configtool/src/settingsdialog.cpp @@ -1,28 +1,38 @@ ///////////////////////////////////////////////////////////////////////////// // Name: settingsdialog.cpp -// Purpose: -// Author: -// Modified by: -// Created: -// RCS-ID: -// Copyright: -// Licence: +// Purpose: Settings dialog +// Author: Julian Smart +// Modified by: +// Created: 2003-06-12 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "settingsdialog.h" #endif -#include "wx/wx.h" -#include "wx/cshelp.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/statline.h" #include "wx/splitter.h" #include "wx/scrolwin.h" #include "wx/spinctrl.h" #include "wx/spinbutt.h" -#include "wx/valgen.h" -#include "wx/notebook.h" +#endif + +#include "wx/cshelp.h" +#include "wx/notebook.h" +#include "wx/valgen.h" #include "wxconfigtool.h" #include "settingsdialog.h" @@ -56,11 +66,10 @@ END_EVENT_TABLE() * ctSettingsDialog constructor */ -ctSettingsDialog::ctSettingsDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +ctSettingsDialog::ctSettingsDialog( wxWindow* parent ) { SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY); - wxDialog::Create( parent, id, caption, pos, size, style ); - + wxDialog::Create( parent, wxID_ANY, _("Configuration Settings")); CreateControls(); } @@ -77,12 +86,12 @@ void ctSettingsDialog::CreateControls() wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL); item1->SetSizer(item2); - wxNotebook* item3 = new wxNotebook(item1, ID_NOTEBOOK, wxDefaultPosition, wxSize(200, 200), wxNB_TOP); - ctGeneralSettingsDialog* item4 = new ctGeneralSettingsDialog(item3, ID_GENERAL_SETTINGS_DIALOG, wxDefaultPosition, wxSize(100, 80), 0); - item3->AddPage(item4, _("General")); - ctLocationSettingsDialog* item11 = new ctLocationSettingsDialog(item3, ID_LOCATION_SETTINGS_DIALOG, wxDefaultPosition, wxSize(100, 80), 0); - item3->AddPage(item11, _("Locations")); - item2->Add(item3, 0, wxGROW|wxALL, 5); + m_notebook = new wxNotebook(item1, wxID_ANY, wxDefaultPosition, wxSize(200, 200), wxNB_TOP); + ctGeneralSettingsDialog* item4 = new ctGeneralSettingsDialog(m_notebook, ID_GENERAL_SETTINGS_DIALOG, wxDefaultPosition, wxSize(100, 80), 0); + m_notebook->AddPage(item4, _("General")); + ctLocationSettingsDialog* item11 = new ctLocationSettingsDialog(m_notebook, ID_LOCATION_SETTINGS_DIALOG, wxDefaultPosition, wxSize(100, 80), 0); + m_notebook->AddPage(item11, _("Locations")); + item2->Add(m_notebook, 0, wxGROW|wxALL, 5); wxBoxSizer* item21 = new wxBoxSizer(wxHORIZONTAL); item2->Add(item21, 0, wxGROW|wxALL, 5); @@ -136,27 +145,28 @@ void ctSettingsDialog::OnCancel( wxCommandEvent& event ) void ctSettingsDialog::OnHelp( wxCommandEvent& WXUNUSED(event) ) { - wxNotebook* notebook = (wxNotebook*) FindWindow(ID_NOTEBOOK); - - int sel = notebook->GetSelection(); - - wxASSERT_MSG( (sel != -1), wxT("A notebook tab should always be selected.")); - - wxWindow* page = (wxWindow*) notebook->GetPage(sel); - - wxString helpTopic; - if (page->GetId() == ID_GENERAL_SETTINGS_DIALOG) + if(m_notebook) { - helpTopic = wxT("General settings dialog"); - } - else if (page->GetId() == ID_LOCATION_SETTINGS_DIALOG) - { - helpTopic = wxT("Location settings dialog"); - } + int sel = m_notebook->GetSelection(); - if (!helpTopic.IsEmpty()) - { - wxGetApp().GetHelpController().DisplaySection(helpTopic); + wxASSERT_MSG( (sel != -1), wxT("A notebook tab should always be selected.")); + + wxWindow* page = (wxWindow*) m_notebook->GetPage(sel); + + wxString helpTopic; + if (page->GetId() == ID_GENERAL_SETTINGS_DIALOG) + { + helpTopic = wxT("General settings dialog"); + } + else if (page->GetId() == ID_LOCATION_SETTINGS_DIALOG) + { + helpTopic = wxT("Location settings dialog"); + } + + if (!helpTopic.IsEmpty()) + { + wxGetApp().GetHelpController().DisplaySection(helpTopic); + } } } @@ -251,9 +261,9 @@ void ctGeneralSettingsDialog::CreateControls() GetSizer()->Fit(this); ////@end ctGeneralSettingsDialog content construction - FindWindow(ID_LOAD_LAST_DOCUMENT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_loadLastDocument)); - FindWindow(ID_SHOW_TOOLTIPS)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_useToolTips)); - FindWindow(ID_DEFAULT_FILE_KIND)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_defaultFileKind)); + item7->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_loadLastDocument)); + item8->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_useToolTips)); + item10->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_defaultFileKind)); } /*! @@ -321,13 +331,13 @@ void ctLocationSettingsDialog::CreateControls() wxBoxSizer* item15 = new wxBoxSizer(wxHORIZONTAL); item13->Add(item15, 0, wxGROW, 5); - wxTextCtrl* item16 = new wxTextCtrl(item11, ID_WXWIN_HIERARCHY, wxEmptyString, wxDefaultPosition, wxSize(200, wxDefaultCoord), 0); - item16->SetHelpText(_("Enter the root path of the wxWidgets hierarchy")); + m_wxWinHierarchy = new wxTextCtrl(item11, ID_WXWIN_HIERARCHY, wxEmptyString, wxDefaultPosition, wxSize(200, wxDefaultCoord), 0); + m_wxWinHierarchy->SetHelpText(_("Enter the root path of the wxWidgets hierarchy")); #if wxUSE_TOOLTIPS if (ShowToolTips()) - item16->SetToolTip(_("Enter the root path of the wxWidgets hierarchy")); + m_wxWinHierarchy->SetToolTip(_("Enter the root path of the wxWidgets hierarchy")); #endif - item15->Add(item16, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + item15->Add(m_wxWinHierarchy, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxButton* item17 = new wxButton(item11, ID_CHOOSE_WXWIN_HIERARCHY, _("&Choose..."), wxDefaultPosition, wxDefaultSize, 0); item17->SetHelpText(_("Click to choose the root path of the wxWidgets hierarchy\\n")); @@ -342,20 +352,20 @@ void ctLocationSettingsDialog::CreateControls() item18->Add(60, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxCheckBox* item20 = new wxCheckBox(item11, ID_USE_WXWIN, _("&Use WXWIN environment variable"), wxDefaultPosition, wxDefaultSize, 0); - item20->SetValue(false); - item20->SetHelpText(_("Check to use the value of WXWIN instead")); + m_wxWinUse = new wxCheckBox(item11, ID_USE_WXWIN, _("&Use WXWIN environment variable")); + m_wxWinUse->SetValue(false); + m_wxWinUse->SetHelpText(_("Check to use the value of WXWIN instead")); #if wxUSE_TOOLTIPS if (ShowToolTips()) - item20->SetToolTip(_("Check to use the value of WXWIN instead")); + m_wxWinUse->SetToolTip(_("Check to use the value of WXWIN instead")); #endif - item18->Add(item20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + item18->Add(m_wxWinUse, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); GetSizer()->Fit(this); ////@end ctLocationSettingsDialog content construction - FindWindow(ID_WXWIN_HIERARCHY)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_frameworkDir)); - FindWindow(ID_USE_WXWIN)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_useEnvironmentVariable)); + m_wxWinHierarchy->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_frameworkDir)); + m_wxWinUse->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_useEnvironmentVariable)); } /*! @@ -364,8 +374,8 @@ void ctLocationSettingsDialog::CreateControls() void ctLocationSettingsDialog::OnUpdateWxwinHierarchy( wxUpdateUIEvent& event ) { - wxCheckBox* checkbox = (wxCheckBox*) FindWindow(ID_USE_WXWIN); - event.Enable(!checkbox->GetValue()); + if(m_wxWinUse) + event.Enable(!m_wxWinUse->GetValue()); } /*! @@ -374,15 +384,16 @@ void ctLocationSettingsDialog::OnUpdateWxwinHierarchy( wxUpdateUIEvent& event ) void ctLocationSettingsDialog::OnChooseWxwinHierarchy( wxCommandEvent& WXUNUSED(event) ) { - wxTextCtrl* textCtrl = (wxTextCtrl*) FindWindow( ID_WXWIN_HIERARCHY ); - wxASSERT( textCtrl != NULL ); - wxString defaultPath = textCtrl->GetValue(); - - wxDirDialog dialog(this, _("Choose the location of the wxWidgets hierarchy"), - defaultPath); - if (dialog.ShowModal() == wxID_OK) + if (m_wxWinHierarchy) { - textCtrl->SetValue(dialog.GetPath()); + wxString defaultPath = m_wxWinHierarchy->GetValue(); + + wxDirDialog dialog(this, _("Choose the location of the wxWidgets hierarchy"), + defaultPath); + if (dialog.ShowModal() == wxID_OK) + { + m_wxWinHierarchy->SetValue(dialog.GetPath()); + } } } @@ -392,8 +403,8 @@ void ctLocationSettingsDialog::OnChooseWxwinHierarchy( wxCommandEvent& WXUNUSED( void ctLocationSettingsDialog::OnUpdateChooseWxwinHierarchy( wxUpdateUIEvent& event ) { - wxCheckBox* checkbox = (wxCheckBox*) FindWindow(ID_USE_WXWIN); - event.Enable(!checkbox->GetValue()); + if (m_wxWinUse) + event.Enable(!m_wxWinUse->GetValue()); } /*! diff --git a/utils/configtool/src/settingsdialog.h b/utils/configtool/src/settingsdialog.h index a58b0645f3..4005476a8a 100644 --- a/utils/configtool/src/settingsdialog.h +++ b/utils/configtool/src/settingsdialog.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: settingsdialog.h -// Purpose: -// Author: -// Modified by: -// Created: -// RCS-ID: -// Copyright: -// Licence: +// Purpose: Settings dialog +// Author: Julian Smart +// Modified by: +// Created: 2002-09-04 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: ///////////////////////////////////////////////////////////////////////////// #ifndef _SETTINGSDIALOG_H_ @@ -57,11 +57,7 @@ class ctSettingsDialog: public wxDialog { public: /// Constructor - ctSettingsDialog( wxWindow* parent, wxWindowID id = wxID_ANY, - const wxString& caption = _("Configuration Settings"), - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCAPTION|wxSYSTEM_MENU ); + ctSettingsDialog( wxWindow* parent ); /// Creates the controls and sizers void CreateControls(); @@ -88,6 +84,11 @@ public: DECLARE_CLASS( ctSettingsDialog ) DECLARE_EVENT_TABLE() + +protected: + + // Dialog controls. + wxNotebook* m_notebook; }; /*! @@ -153,6 +154,12 @@ public: DECLARE_CLASS( ctLocationSettingsDialog ) DECLARE_EVENT_TABLE() + +protected: + + // Dialog controls. + wxTextCtrl* m_wxWinHierarchy; + wxCheckBox* m_wxWinUse; }; #endif diff --git a/utils/configtool/src/symbols.h b/utils/configtool/src/symbols.h index 3f8cd3194b..596b9e29f2 100644 --- a/utils/configtool/src/symbols.h +++ b/utils/configtool/src/symbols.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// // Name: symbols.h // Purpose: Application symbols file -// Author: +// Author: Julian Smart // Modified by: -// Created: +// Created: 2003-06-12 // RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: diff --git a/utils/configtool/src/utils.cpp b/utils/configtool/src/utils.cpp index f4d1920389..78d6aca247 100644 --- a/utils/configtool/src/utils.cpp +++ b/utils/configtool/src/utils.cpp @@ -13,29 +13,34 @@ // #pragma implementation #endif -#include "wx/wx.h" -#include "wx/image.h" -#include "wx/notebook.h" -#include "wx/splitter.h" -#include "wx/wfstream.h" -#include "wx/datstrm.h" -#include "wx/file.h" -#include "wx/listctrl.h" -#include "wx/tokenzr.h" -#include "wx/process.h" -#include "wx/mimetype.h" -#include "wx/variant.h" -#include "wx/cshelp.h" -#include "wx/cmdline.h" -#include "wx/imaglist.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif #include -#ifdef __WXMSW__ -#include -#include "wx/msw/winundef.h" +#ifndef WX_PRECOMP + +#include "wx/splitter.h" +#include "wx/datstrm.h" +#include "wx/file.h" +#include "wx/listctrl.h" +#include "wx/process.h" +#include "wx/variant.h" +#include "wx/cmdline.h" + #endif +#include "wx/wfstream.h" +#include "wx/cshelp.h" +#include "wx/image.h" +#include "wx/imaglist.h" +#include "wx/tokenzr.h" +#include "wx/notebook.h" +#include "wx/mimetype.h" #include "utils.h" // Returns the image type, or -1, determined from the extension. @@ -218,10 +223,12 @@ wxString wxGetTempDir() #if defined(__WXMAC__) && !defined(__DARWIN__) dir = wxMacFindFolder( (short) kOnSystemDisk, kTemporaryFolderType, kCreateFolder ) ; #else // !Mac - dir = wxGetenv(_T("TMP")); + wxString dirEnv(wxGetenv(_T("TMP"))); + dir = dirEnv; if ( dir.empty() ) { - dir = wxGetenv(_T("TEMP")); + wxString envVar(wxGetenv(_T("TEMP"))); + dir = envVar; } if ( dir.empty() ) @@ -269,14 +276,12 @@ bool apInvokeAppForFile(const wxString& filename) wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName) { - wxString str; - // Try appVariableName if (!appVariableName.IsEmpty()) { - str = wxGetenv(appVariableName); - if (!str.IsEmpty()) - return str; + wxString strVar(wxGetenv(appVariableName.c_str())); + if (!strVar.IsEmpty()) + return strVar; } if (wxIsAbsolutePath(argv0)) @@ -288,9 +293,9 @@ wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin if (currentDir.Last() != wxFILE_SEP_PATH) currentDir += wxFILE_SEP_PATH; - str = currentDir + argv0; - if (wxFileExists(str)) - return wxPathOnly(str); + currentDir += argv0; + if (wxFileExists(currentDir)) + return wxPathOnly(currentDir); } // OK, it's neither an absolute path nor a relative path. @@ -298,9 +303,9 @@ wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin wxPathList pathList; pathList.AddEnvList(wxT("PATH")); - str = pathList.FindAbsoluteValidPath(argv0); - if (!str.IsEmpty()) - return wxPathOnly(str); + wxString strPath = pathList.FindAbsoluteValidPath(argv0); + if (!strPath.IsEmpty()) + return wxPathOnly(strPath); // Failed return wxEmptyString; @@ -408,7 +413,7 @@ void wxIconInfo::SetIconId(int state, bool enabled, int iconId) wxIconTable::wxIconTable(wxImageList* imageList) { m_imageList = imageList; - DeleteContents(true); + WX_CLEAR_LIST(wxIconTable,*this); } void wxIconTable::AppendInfo(wxIconInfo* info) @@ -434,7 +439,7 @@ bool wxIconTable::AddInfo(const wxString& name, const wxIcon& icon, int state, b wxIconInfo* wxIconTable::FindInfo(const wxString& name) const { - wxNode* node = GetFirst(); + wxObjectList::compatibility_iterator node = GetFirst(); while (node) { wxIconInfo* info = (wxIconInfo*) node->GetData(); diff --git a/utils/configtool/src/utils.h b/utils/configtool/src/utils.h index 8402525c30..1fbc6866ef 100644 --- a/utils/configtool/src/utils.h +++ b/utils/configtool/src/utils.h @@ -21,6 +21,8 @@ #ifndef _AP_UTILS_H_ #define _AP_UTILS_H_ +#include "wx/imaglist.h" + #ifndef DOXYGEN_SKIP /*! diff --git a/utils/configtool/src/wxconfigtool.cpp b/utils/configtool/src/wxconfigtool.cpp index e65386b853..509039926c 100644 --- a/utils/configtool/src/wxconfigtool.cpp +++ b/utils/configtool/src/wxconfigtool.cpp @@ -13,27 +13,32 @@ #pragma implementation "wxconfigtool.h" #endif -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif -#include "wx/config.h" +#ifndef WX_PRECOMP + #include "wx/laywin.h" -#include "wx/image.h" #include "wx/menuitem.h" #include "wx/tooltip.h" +#include "wx/variant.h" + +#endif + #include "wx/cshelp.h" #include "wx/helphtml.h" #include "wx/html/htmprint.h" #include "wx/html/htmlwin.h" +#include "wx/image.h" #include "wx/filesys.h" #include "wx/fs_mem.h" #include "wx/fs_zip.h" #include "wx/wfstream.h" -#include "wx/variant.h" - +#include "wx/config.h" #include "wxconfigtool.h" #include "configtooldoc.h" #include "configtoolview.h" @@ -58,6 +63,7 @@ ctApp::~ctApp() bool ctApp::OnInit(void) { + #if wxUSE_LOG wxLog::SetTimestamp(NULL); #endif // wxUSE_LOG @@ -92,7 +98,9 @@ bool ctApp::OnInit(void) wxString currentDir = wxGetCwd(); // Use argv to get current app directory - m_appDir = apFindAppPath(argv[0], currentDir, wxT("WXCONFIGTOOLDIR")); + wxString argv0(argv[0]); + wxString appVariableName(wxT("WXCONFIGTOOLDIR")); + m_appDir = apFindAppPath(argv0, currentDir, appVariableName); #ifdef __WXMSW__ // If the development version, go up a directory.