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
This commit is contained in:
Włodzimierz Skiba 2004-07-27 19:14:36 +00:00
parent 413fac165f
commit d9ab621ea2
23 changed files with 374 additions and 295 deletions

View File

@ -13,28 +13,29 @@
#pragma implementation "appsettings.h" #pragma implementation "appsettings.h"
#endif #endif
#include "wx/wx.h" // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/wfstream.h"
#include "wx/datstrm.h" #include "wx/datstrm.h"
#include "wx/config.h"
#include "wx/fileconf.h"
#include "wx/dir.h" #include "wx/dir.h"
#include "wx/valgen.h"
#include "wx/colordlg.h" #include "wx/colordlg.h"
#include "wx/wxhtml.h" #include "wx/wxhtml.h"
#include "wx/effects.h" #include "wx/effects.h"
#include "wx/spinctrl.h" #include "wx/spinctrl.h"
#include "wx/tooltip.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 "utils.h"
#include "wxconfigtool.h" #include "wxconfigtool.h"
#include "appsettings.h" #include "appsettings.h"

View File

@ -1,19 +1,28 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: configbrowser.cpp // Name: configbrowser.cpp
// Purpose: // Purpose: Configuration browser
// Author: // Author: Julian Smart
// Modified by: // Modified by:
// Created: // Created: 2003-08-14
// RCS-ID: // RCS-ID: $Id$
// Copyright: // Copyright: (c) Julian Smart
// Licence: // 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/wx.h"
#include "wx/splitter.h" #include "wx/splitter.h"
#include "wx/treectrl.h" #include "wx/treectrl.h"
////@end includes
#endif
#include "configbrowser.h" #include "configbrowser.h"

View File

@ -1,11 +1,11 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: configbrowser.h // Name: configbrowser.h
// Purpose: // Purpose: Configuration browser
// Author: // Author: Julian Smart
// Modified by: // Modified by:
// Created: // Created: 2003-08-14
// RCS-ID: // RCS-ID: $Id$
// Copyright: // Copyright: (c) Julian Smart
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -88,7 +88,7 @@ class ctConfigurationBrowserControlPanel: public wxPanel
public: public:
/// Constructor /// 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 /// Creates the controls and sizers
void CreateControls(); void CreateControls();

View File

@ -13,15 +13,14 @@
#pragma implementation "configitem.h" #pragma implementation "configitem.h"
#endif #endif
// Includes other headers for precompiled compilation // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wx.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/tokenzr.h" #include "wx/tokenzr.h"
#include "configitem.h" #include "configitem.h"
#include "configtree.h" #include "configtree.h"
#include "configtooldoc.h" #include "configtooldoc.h"
@ -439,12 +438,14 @@ void ctConfigItem::Attach(ctConfigItem* parent, ctConfigItem* insertBefore)
if (parent) if (parent)
{ {
SetParent(parent); SetParent(parent);
wxObjectList::compatibility_iterator node = (wxObjectList::compatibility_iterator)NULL;
if (insertBefore) if (insertBefore)
node = parent->GetChildren().Member(insertBefore); {
wxObjectList::compatibility_iterator node = parent->GetChildren().Member(insertBefore);
if (node) if (node)
parent->GetChildren().Insert(node, this); parent->GetChildren().Insert(node, this);
else
parent->GetChildren().Append(this);
}
else else
parent->GetChildren().Append(this); parent->GetChildren().Append(this);
} }

View File

@ -13,25 +13,26 @@
#pragma implementation "configitemselector.h" #pragma implementation "configitemselector.h"
#endif #endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP #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 #endif
#include <wx/cshelp.h> #include "wx/cshelp.h"
#include <wx/statline.h> #include "wx/notebook.h"
#include <wx/splitter.h> #include "wx/valgen.h"
#include <wx/scrolwin.h>
#include <wx/spinctrl.h>
#include <wx/spinbutt.h>
#include <wx/valgen.h>
#include <wx/notebook.h>
#include "configitemselector.h" #include "configitemselector.h"
#include "configtooldoc.h" #include "configtooldoc.h"
#include "configtoolview.h" #include "configtoolview.h"
@ -71,9 +72,9 @@ END_EVENT_TABLE()
* ctConfigItemsSelector constructor * 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(); CreateControls();
InitSourceConfigList(); InitSourceConfigList();
@ -251,7 +252,7 @@ void ctConfigItemsSelector::InitSourceConfigList(ctConfigItem* item)
masterList->Append(item->GetName()); masterList->Append(item->GetName());
} }
wxNode* node = item->GetChildren().GetFirst(); wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst();
while (node) while (node)
{ {
ctConfigItem* child = (ctConfigItem*) node->GetData(); ctConfigItem* child = (ctConfigItem*) node->GetData();

View File

@ -52,7 +52,7 @@ class ctConfigItemsSelector: public wxDialog
{ {
public: public:
/// Constructor /// 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 /// Creates the controls and sizers
void CreateControls(); void CreateControls();

View File

@ -13,23 +13,24 @@
#pragma implementation "configtooldoc.h" #pragma implementation "configtooldoc.h"
#endif #endif
#include "wx/wx.h" // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/config.h" #ifndef WX_PRECOMP
#include "wx/textfile.h"
#include "wx/process.h" #include "wx/process.h"
#include "wx/mimetype.h" #include "wx/mimetype.h"
#include "wx/process.h" #include "wx/process.h"
#include "wx/wfstream.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif #endif
#include "wx/textfile.h"
#include "wx/wfstream.h"
#include "wx/config.h"
#include "configtooldoc.h" #include "configtooldoc.h"
#include "configtoolview.h" #include "configtoolview.h"
#include "configtree.h" #include "configtree.h"
@ -324,7 +325,7 @@ bool ctConfigToolDoc::DoSave(ctConfigItem* item, wxOutputStream& stream, int ind
stream << wxT("<enabled>0</enabled>"); stream << wxT("<enabled>0</enabled>");
// Output properties // Output properties
wxNode* node = item->GetProperties().GetList().GetFirst(); wxObjectList::compatibility_iterator node = item->GetProperties().GetList().GetFirst();
while (node) while (node)
{ {
ctProperty* prop = (ctProperty*) node->GetData(); ctProperty* prop = (ctProperty*) node->GetData();
@ -551,7 +552,7 @@ void ctConfigToolDoc::ClearDependencies(ctConfigItem* item)
item = GetTopItem(); item = GetTopItem();
item->GetDependents().Clear(); 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(); ctConfigItem* child = (ctConfigItem*) node->GetData();
ClearDependencies(child); ClearDependencies(child);
@ -616,7 +617,7 @@ void ctConfigToolDoc::RefreshDependencies(ctConfigItem* item)
otherItem->GetDependents().Append(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(); ctConfigItem* child = (ctConfigItem*) node->GetData();
RefreshDependencies(child); 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(); ctConfigItem* child = (ctConfigItem*) node->GetData();
GenerateSetup(child, str); GenerateSetup(child, str);
@ -695,7 +696,7 @@ wxString ctConfigToolDoc::GenerateConfigureCommand()
ctConfigItem* platformsFolder = GetTopItem()->FindItem(wxT("Target")); ctConfigItem* platformsFolder = GetTopItem()->FindItem(wxT("Target"));
if (platformsFolder) 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(); ctConfigItem* child = (ctConfigItem*) node->GetData();
if (child->GetType() == ctTypeBoolRadio && child->IsEnabled()) 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(); ctConfigItem* child = (ctConfigItem*) node->GetData();
GenerateConfigureCommand(child, str); GenerateConfigureCommand(child, str);
@ -784,7 +785,8 @@ wxString ctConfigToolDoc::GetFrameworkDir(bool makeUnix)
{ {
// Should probably allow other variables // Should probably allow other variables
// to be used, and maybe expand variables within m_frameworkDir // to be used, and maybe expand variables within m_frameworkDir
path = wxGetenv(wxT("WXWIN")); wxString pathEnv(wxGetenv(wxT("WXWIN")));
path = pathEnv;
#ifdef __WXMSW__ #ifdef __WXMSW__
if (makeUnix) if (makeUnix)
path.Replace(wxT("\\"), wxT("/")); path.Replace(wxT("\\"), wxT("/"));
@ -828,7 +830,7 @@ ctConfigItem* ctConfigToolDoc::FindNextSibling(ctConfigItem* item)
{ {
if (item->GetParent()) if (item->GetParent())
{ {
wxNode* node = item->GetParent()->GetChildren().Member(item); wxObjectList::compatibility_iterator node = item->GetParent()->GetChildren().Member(item);
if (node && node->GetNext()) if (node && node->GetNext())
{ {
ctConfigItem* nextItem = (ctConfigItem*) node->GetNext()->GetData(); ctConfigItem* nextItem = (ctConfigItem*) node->GetNext()->GetData();
@ -1010,7 +1012,7 @@ bool ctConfigCommand::DoAndUndo(bool doCmd)
// Apply only those that need applying // Apply only those that need applying
// (those properties in activeState that are not in propsTemp) // (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) while (node)
{ {
ctProperty* prop = (ctProperty*) node->GetData(); ctProperty* prop = (ctProperty*) node->GetData();
@ -1088,10 +1090,10 @@ void ctConfiguration::operator= (const ctConfiguration& configuration)
/// Clear children /// Clear children
void ctConfiguration::Clear() void ctConfiguration::Clear()
{ {
wxNode* node = m_children.GetFirst(); wxObjectList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxNode* next = node->GetNext(); wxObjectList::compatibility_iterator next = node->GetNext();
ctConfiguration* child = (ctConfiguration*) node->GetData(); ctConfiguration* child = (ctConfiguration*) node->GetData();
// This should delete 'node' too, assuming // This should delete 'node' too, assuming
@ -1153,7 +1155,7 @@ ctConfiguration* ctConfiguration::FindConfiguration(const wxString& name)
if (GetName() == name) if (GetName() == name)
return this; 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* child = (ctConfiguration*) node->GetData();
ctConfiguration* found = child->FindConfiguration(name); ctConfiguration* found = child->FindConfiguration(name);
@ -1168,7 +1170,7 @@ ctConfiguration* ctConfiguration::FindNextSibling()
{ {
if (!GetParent()) if (!GetParent())
return NULL; return NULL;
wxNode* node = GetParent()->GetChildren().Member(this); wxObjectList::compatibility_iterator node = GetParent()->GetChildren().Member(this);
if (node && node->GetNext()) if (node && node->GetNext())
{ {
return (ctConfiguration*) node->GetNext()->GetData(); return (ctConfiguration*) node->GetNext()->GetData();
@ -1181,7 +1183,7 @@ ctConfiguration* ctConfiguration::FindPreviousSibling()
{ {
if (!GetParent()) if (!GetParent())
return NULL; return NULL;
wxNode* node = GetParent()->GetChildren().Member(this); wxObjectList::compatibility_iterator node = GetParent()->GetChildren().Member(this);
if (node && node->GetPrevious()) if (node && node->GetPrevious())
{ {
return (ctConfiguration*) node->GetPrevious()->GetData(); return (ctConfiguration*) node->GetPrevious()->GetData();
@ -1194,7 +1196,7 @@ ctConfiguration* ctConfiguration::DeepClone()
{ {
ctConfiguration* newItem = Clone(); 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* child = (ctConfiguration*) node->GetData();
ctConfiguration* newChild = child->DeepClone(); ctConfiguration* newChild = child->DeepClone();

View File

@ -13,15 +13,14 @@
#pragma implementation "configtoolview.h" #pragma implementation "configtoolview.h"
#endif #endif
// Includes other headers for precompiled compilation // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wx.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/wfstream.h" #include "wx/wfstream.h"
#include "configtoolview.h" #include "configtoolview.h"
#include "configtooldoc.h" #include "configtooldoc.h"
#include "configtree.h" #include "configtree.h"

View File

@ -13,15 +13,15 @@
#pragma implementation "configtree.h" #pragma implementation "configtree.h"
#endif #endif
// Includes other headers for precompiled compilation // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wx.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/imaglist.h"
#include "wx/cshelp.h" #include "wx/cshelp.h"
#include "wx/imaglist.h"
// Include XPM icons // Include XPM icons
#include "bitmaps/closedfolder.xpm" #include "bitmaps/closedfolder.xpm"

View File

@ -13,15 +13,26 @@
#pragma implementation "custompropertydialog.h" #pragma implementation "custompropertydialog.h"
#endif #endif
#include <wx/wx.h> // For compilers that support precompilation, includes "wx/wx.h".
#include <wx/cshelp.h> #include "wx/wxprec.h"
#include <wx/statline.h>
#include <wx/splitter.h>
#include <wx/scrolwin.h>
#include <wx/spinctrl.h>
#include <wx/spinbutt.h>
#include <wx/valgen.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" #include "custompropertydialog.h"
////@begin XPM images ////@begin XPM images
@ -56,11 +67,11 @@ END_EVENT_TABLE()
* ctCustomPropertyDialog constructor * 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"); m_type = wxT("string");
wxDialog::Create( parent, id, caption, pos, size, style ); wxDialog::Create( parent, id, caption);
CreateControls(); CreateControls();
} }
@ -73,6 +84,8 @@ void ctCustomPropertyDialog::CreateControls()
{ {
////@begin ctCustomPropertyDialog content construction ////@begin ctCustomPropertyDialog content construction
wxArrayString items;
ctCustomPropertyDialog* item1 = this; ctCustomPropertyDialog* item1 = this;
wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL);
@ -87,8 +100,8 @@ void ctCustomPropertyDialog::CreateControls()
wxStaticText* item5 = new wxStaticText(item1, wxID_STATIC, _("&Name:"), wxDefaultPosition, wxDefaultSize, 0); wxStaticText* item5 = new wxStaticText(item1, wxID_STATIC, _("&Name:"), wxDefaultPosition, wxDefaultSize, 0);
item3->Add(item5, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); item3->Add(item5, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);
wxTextCtrl* item6 = new wxTextCtrl(item1, ID_CUSTOMPROPERTYNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); m_customPropertyName = new wxTextCtrl(item1, wxID_ANY);
item3->Add(item6, 0, wxGROW|wxALL, 5); item3->Add(m_customPropertyName, 0, wxGROW|wxALL, 5);
wxBoxSizer* item7 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* item7 = new wxBoxSizer(wxHORIZONTAL);
item3->Add(item7, 0, wxGROW, 5); 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); wxStaticText* item9 = new wxStaticText(item1, wxID_STATIC, _("&Data type:"), wxDefaultPosition, wxDefaultSize, 0);
item8->Add(item9, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); item8->Add(item9, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);
wxString item10Strings[] = { items.Empty();
_("string"), items.Add(_("string"));
_("bool"), items.Add(_("bool"));
_("double"), items.Add(_("double"));
_("long") items.Add(_("long"));
}; m_customPrototype = new wxChoice(item1, wxID_ANY, wxDefaultPosition, wxDefaultSize, items);
wxChoice* item10 = new wxChoice(item1, ID_CUSTOMPROPERTYTYPE, wxDefaultPosition, wxDefaultSize, 4, item10Strings, 0); m_customPrototype->SetStringSelection(_("string"));
item10->SetStringSelection(_("string")); item8->Add(m_customPrototype, 1, wxGROW|wxALL, 5);
item8->Add(item10, 1, wxGROW|wxALL, 5);
wxBoxSizer* item11 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* item11 = new wxBoxSizer(wxVERTICAL);
item7->Add(item11, 0, wxALIGN_CENTER_VERTICAL, 5); 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); wxStaticText* item12 = new wxStaticText(item1, wxID_STATIC, _("&Editor type:"), wxDefaultPosition, wxDefaultSize, 0);
item11->Add(item12, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); item11->Add(item12, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);
wxString item13Strings[] = { items.Empty();
_("string"), items.Add(_("string"));
_("choice"), items.Add(_("choice"));
_("bool"), items.Add(_("bool"));
_("float"), items.Add(_("float"));
_("integer"), items.Add(_("integer"));
_("configitems") items.Add(_("configitems"));
}; m_customPropertyEditorType = new wxChoice(item1, wxID_ANY, wxDefaultPosition, wxDefaultSize, items);
wxChoice* item13 = new wxChoice(item1, ID_CUSTOMPROPERTYEDITORTYPE, wxDefaultPosition, wxDefaultSize, 6, item13Strings, 0); m_customPropertyEditorType->SetStringSelection(_("string"));
item13->SetStringSelection(_("string")); item11->Add(m_customPropertyEditorType, 1, wxGROW|wxALL, 5);
item11->Add(item13, 1, wxGROW|wxALL, 5);
wxStaticBox* item14Static = new wxStaticBox(item1, wxID_ANY, _("Choices")); wxStaticBox* item14Static = new wxStaticBox(item1, wxID_ANY, _("Choices"));
wxStaticBoxSizer* item14 = new wxStaticBoxSizer(item14Static, wxHORIZONTAL); wxStaticBoxSizer* item14 = new wxStaticBoxSizer(item14Static, wxHORIZONTAL);
item3->Add(item14, 0, wxGROW|wxALL, 5); item3->Add(item14, 0, wxGROW|wxALL, 5);
wxString* item15Strings = NULL; wxString* item15Strings = NULL;
wxListBox* item15 = new wxListBox(item1, ID_PROPERTY_CHOICES, wxDefaultPosition, wxDefaultSize, 0, item15Strings, wxLB_SINGLE); m_propertyChoices = new wxListBox(item1, ID_PROPERTY_CHOICES, wxDefaultPosition, wxDefaultSize, 0, item15Strings, wxLB_SINGLE);
item14->Add(item15, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); item14->Add(m_propertyChoices, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* item16 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* item16 = new wxBoxSizer(wxVERTICAL);
item14->Add(item16, 0, wxALIGN_CENTER_VERTICAL, 5); 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); wxStaticText* item19 = new wxStaticText(item1, wxID_STATIC, _("&Description:"), wxDefaultPosition, wxDefaultSize, 0);
item3->Add(item19, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); item3->Add(item19, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);
wxTextCtrl* item20 = new wxTextCtrl(item1, ID_CUSTOMPROPERTYDESCRIPTION, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH); m_customPropertyDescription = new wxTextCtrl(item1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH);
item3->Add(item20, 1, wxGROW|wxALL, 5); item3->Add(m_customPropertyDescription, 1, wxGROW|wxALL, 5);
wxBoxSizer* item21 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* item21 = new wxBoxSizer(wxHORIZONTAL);
item3->Add(item21, 0, wxGROW|wxALL, 5); item3->Add(item21, 0, wxGROW|wxALL, 5);
@ -170,10 +181,10 @@ void ctCustomPropertyDialog::CreateControls()
////@end ctCustomPropertyDialog content construction ////@end ctCustomPropertyDialog content construction
// Add validators // Add validators
FindWindow(ID_CUSTOMPROPERTYNAME)->SetValidator(wxGenericValidator(& m_name)); m_customPropertyName->SetValidator(wxGenericValidator(& m_name));
FindWindow(ID_CUSTOMPROPERTYTYPE)->SetValidator(wxGenericValidator(& m_type)); m_customPrototype->SetValidator(wxGenericValidator(& m_type));
FindWindow(ID_CUSTOMPROPERTYEDITORTYPE)->SetValidator(wxGenericValidator(& m_editorType)); m_customPropertyEditorType->SetValidator(wxGenericValidator(& m_editorType));
FindWindow(ID_CUSTOMPROPERTYDESCRIPTION)->SetValidator(wxGenericValidator(& m_description)); m_customPropertyDescription->SetValidator(wxGenericValidator(& m_description));
} }
/*! /*!
@ -191,8 +202,8 @@ bool ctCustomPropertyDialog::ShowToolTips()
void ctCustomPropertyDialog::OnUpdatePropertyChoices( wxUpdateUIEvent& event ) void ctCustomPropertyDialog::OnUpdatePropertyChoices( wxUpdateUIEvent& event )
{ {
wxChoice* choice = (wxChoice* ) FindWindow(ID_CUSTOMPROPERTYTYPE); if(m_customPrototype)
event.Enable( choice->GetSelection() > -1 && choice->GetStringSelection() == wxT("choice") ); 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) ) void ctCustomPropertyDialog::OnPropertyChoiceAdd( wxCommandEvent& WXUNUSED(event) )
{ {
wxChoice* choice = (wxChoice* ) FindWindow(ID_CUSTOMPROPERTYTYPE); if(m_customPrototype)
if ( choice->GetSelection() > -1 && choice->GetStringSelection() == wxT("choice") )
{ {
wxString str = wxGetTextFromUser(_T("New choice"), _("Add choice")); if ( m_customPropertyEditorType->GetSelection() > -1 && m_customPropertyEditorType->GetStringSelection() == wxT("choice") )
if (!str.IsEmpty())
{ {
wxListBox* listBox = (wxListBox* ) FindWindow(ID_PROPERTY_CHOICES); wxString str = wxGetTextFromUser(_T("New choice"), _("Add choice"));
listBox->Append(str); if (!str.IsEmpty() && m_propertyChoices)
m_choices.Add(str); {
m_propertyChoices->Append(str);
m_choices.Add(str);
}
} }
} }
} }
@ -220,8 +232,9 @@ void ctCustomPropertyDialog::OnPropertyChoiceAdd( wxCommandEvent& WXUNUSED(event
void ctCustomPropertyDialog::OnUpdatePropertyChoiceAdd( wxUpdateUIEvent& event ) void ctCustomPropertyDialog::OnUpdatePropertyChoiceAdd( wxUpdateUIEvent& event )
{ {
wxChoice* choice = (wxChoice* ) FindWindow(ID_CUSTOMPROPERTYEDITORTYPE); if(m_customPropertyEditorType)
event.Enable( choice->GetSelection() > -1 && choice->GetStringSelection() == wxT("choice") ); 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) ) void ctCustomPropertyDialog::OnPropertyChoiceRemove( wxCommandEvent& WXUNUSED(event) )
{ {
/* wxChoice* choice = (wxChoice* ) */ FindWindow(ID_CUSTOMPROPERTYEDITORTYPE); if (m_propertyChoices && m_propertyChoices->GetSelection() > -1)
wxListBox* listBox = (wxListBox* ) FindWindow(ID_PROPERTY_CHOICES);
if (listBox->GetSelection() > -1)
{ {
listBox->Delete(listBox->GetSelection()); m_propertyChoices->Delete(m_propertyChoices->GetSelection());
m_choices.RemoveAt(listBox->GetSelection()); m_choices.RemoveAt(m_propertyChoices->GetSelection());
} }
} }
@ -245,16 +256,16 @@ void ctCustomPropertyDialog::OnPropertyChoiceRemove( wxCommandEvent& WXUNUSED(ev
void ctCustomPropertyDialog::OnUpdatePropertyChoiceRemove( wxUpdateUIEvent& event ) void ctCustomPropertyDialog::OnUpdatePropertyChoiceRemove( wxUpdateUIEvent& event )
{ {
wxChoice* choice = (wxChoice* ) FindWindow(ID_CUSTOMPROPERTYEDITORTYPE); if (m_customPropertyEditorType && m_propertyChoices)
wxListBox* listBox = (wxListBox* ) FindWindow(ID_PROPERTY_CHOICES); event.Enable( m_customPropertyEditorType->GetSelection() > -1 &&
event.Enable( choice->GetSelection() > -1 && choice->GetStringSelection() == wxT("choice") && m_customPropertyEditorType->GetStringSelection() == wxT("choice") &&
listBox->GetSelection() > -1 ); m_propertyChoices->GetSelection() > -1 );
} }
void ctCustomPropertyDialog::SetChoices(const wxArrayString& choices) void ctCustomPropertyDialog::SetChoices(const wxArrayString& choices)
{ {
wxListBox* listBox = (wxListBox* ) FindWindow(ID_PROPERTY_CHOICES);
size_t i, len = choices.GetCount(); size_t i, len = choices.GetCount();
for (i = 0; i < len; i++) if (m_propertyChoices)
listBox->Append(m_choices[i]); for (i = 0; i < len; i++)
m_propertyChoices->Append(m_choices[i]);
} }

View File

@ -36,13 +36,9 @@
////@begin control identifiers ////@begin control identifiers
#define ID_CUSTOMPROPERTYDIALOG 10000 #define ID_CUSTOMPROPERTYDIALOG 10000
#define ID_CUSTOMPROPERTYNAME 10003
#define ID_CUSTOMPROPERTYTYPE 10002
#define ID_CUSTOMPROPERTYEDITORTYPE 10008
#define ID_PROPERTY_CHOICES 10001 #define ID_PROPERTY_CHOICES 10001
#define ID_PROPERTY_CHOICE_ADD 10005 #define ID_PROPERTY_CHOICE_ADD 10005
#define ID_PROPERTY_CHOICE_REMOVE 10006 #define ID_PROPERTY_CHOICE_REMOVE 10006
#define ID_CUSTOMPROPERTYDESCRIPTION 10004
////@end control identifiers ////@end control identifiers
/*! /*!
@ -53,7 +49,7 @@ class ctCustomPropertyDialog: public wxDialog
{ {
public: public:
/// Constructor /// 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 /// Creates the controls and sizers
void CreateControls(); void CreateControls();
@ -102,11 +98,19 @@ public:
DECLARE_CLASS( ctCustomPropertyDialog ) DECLARE_CLASS( ctCustomPropertyDialog )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
wxString m_name; protected:
wxString m_type; wxString m_name;
wxString m_description; wxString m_type;
wxString m_editorType; wxString m_description;
wxString m_editorType;
wxArrayString m_choices; wxArrayString m_choices;
// Dialog controls
wxTextCtrl* m_customPropertyName;
wxTextCtrl* m_customPropertyDescription;
wxChoice* m_customPrototype;
wxChoice* m_customPropertyEditorType;
wxListBox* m_propertyChoices;
}; };
#endif #endif

View File

@ -16,18 +16,16 @@
#pragma implementation "htmlparser.h" #pragma implementation "htmlparser.h"
#endif #endif
#include "wx/wx.h" // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/textfile.h"
#include "wx/wfstream.h" #include "wx/wfstream.h"
#include "wx/textfile.h"
#include "wx/txtstrm.h" #include "wx/txtstrm.h"
#include <ctype.h>
#include "htmlparser.h" #include "htmlparser.h"
/// Useful insertion operators for wxOutputStream. /// Useful insertion operators for wxOutputStream.

View File

@ -13,19 +13,24 @@
#pragma implementation "mainframe.h" #pragma implementation "mainframe.h"
#endif #endif
#include "wx/wx.h" // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP
#include "wx/splitter.h"
#endif
#include "wx/cshelp.h"
#include "wx/html/htmlwin.h" #include "wx/html/htmlwin.h"
#include "wx/notebook.h" #include "wx/notebook.h"
#include "wx/splitter.h"
#include "wx/clipbrd.h"
#include "wx/dataobj.h" #include "wx/dataobj.h"
#include "wx/cshelp.h" #include "wx/clipbrd.h"
#include "wxconfigtool.h" #include "wxconfigtool.h"
#include "mainframe.h" #include "mainframe.h"
#include "appsettings.h" #include "appsettings.h"

View File

@ -18,6 +18,7 @@
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/docview.h" #include "wx/docview.h"
#include "wx/notebook.h"
// #define USE_CONFIG_BROWSER_PAGE // #define USE_CONFIG_BROWSER_PAGE

View File

@ -13,23 +13,29 @@
#pragma implementation "propeditor.h" #pragma implementation "propeditor.h"
#endif #endif
#include <wx/wx.h> // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/html/htmlwin.h" #ifndef WX_PRECOMP
#include "wx/grid.h" #include "wx/grid.h"
#include "wx/filedlg.h" #include "wx/filedlg.h"
#endif
#include "wx/html/htmlwin.h"
#include "wx/tokenzr.h" #include "wx/tokenzr.h"
#include "wx/valgen.h" #include "wx/valgen.h"
#include "propeditor.h" #include "propeditor.h"
#include "symbols.h" #include "symbols.h"
#include "utils.h" #include "utils.h"
#include "configtooldoc.h" #include "configtooldoc.h"
#include "configitemselector.h" #include "configitemselector.h"
#include "bitmaps/ellipsis.xpm" #include "bitmaps/ellipsis.xpm"
@ -75,8 +81,8 @@ void ctPropertyEditor::CreateControls(wxWindow* parent)
wxTextCtrl *item2 = m_elementTitleTextCtrl; wxTextCtrl *item2 = m_elementTitleTextCtrl;
item1->Add( item2, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item1->Add( item2, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxButton *item3a = new wxButton( parent, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS, wxT("Edit...")); m_attributeEditorEditDetails = new wxButton( parent, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS, wxT("Edit..."));
item1->Add( item3a, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ); item1->Add( m_attributeEditorEditDetails, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 );
item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
@ -103,9 +109,9 @@ void ctPropertyEditor::CreateControls(wxWindow* parent)
/// Add help text /// Add help text
m_elementTitleTextCtrl->SetHelpText(_("The title of the property being edited.")); 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).")); m_attributeEditorEditDetails->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.")); m_attributeEditorGrid->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_propertyDescriptionWindow->SetHelpText(_("Shows a description of the selected property, or a summary of the whole item."));
/// Set up the grid to display properties /// Set up the grid to display properties
m_attributeEditorGrid->RegisterDataType(ctGRID_VALUE_STRING, m_attributeEditorGrid->RegisterDataType(ctGRID_VALUE_STRING,
@ -205,7 +211,7 @@ void ctPropertyEditor::ShowItem(ctConfigItem* item)
m_attributeEditorGrid->AppendRows(m_item->GetProperties().GetCount()); 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; int i = 0;
while (node) while (node)
{ {
@ -255,7 +261,7 @@ void ctPropertyEditor::UpdateItem()
{ {
UpdateTitle(); UpdateTitle();
wxNode* node = m_item->GetProperties().GetList().GetFirst(); wxObjectList::compatibility_iterator node = m_item->GetProperties().GetList().GetFirst();
int i = 0; int i = 0;
while (node) while (node)
{ {
@ -808,7 +814,6 @@ bool ctMultiLineTextEditor::AddControls(wxWindow* parent, const wxString& msg)
item4->Add( 5, 5, 1, wxALIGN_CENTRE|wxALL, 5 ); item4->Add( 5, 5, 1, wxALIGN_CENTRE|wxALL, 5 );
wxButton *item5 = new wxButton( parent, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton *item5 = new wxButton( parent, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
item5->SetDefault();
item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 ); item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 );
wxButton *item6 = new wxButton( parent, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); 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(); item3->SetFocus();
((wxButton*) FindWindow(wxID_OK))->SetDefault(); item5->SetDefault();
parent->SetSizer(item0); parent->SetSizer(item0);
item0->Fit(parent); item0->Fit(parent);

View File

@ -139,6 +139,8 @@ class ctPropertyEditor: public wxPanel
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
protected: protected:
// Dialog controls
wxButton* m_attributeEditorEditDetails;
ctPropertyEditorGrid* m_attributeEditorGrid; ctPropertyEditorGrid* m_attributeEditorGrid;
wxHtmlWindow* m_propertyDescriptionWindow; wxHtmlWindow* m_propertyDescriptionWindow;
wxSplitterWindow* m_splitterWindow; wxSplitterWindow* m_splitterWindow;

View File

@ -14,7 +14,12 @@
#pragma implementation "property.h" #pragma implementation "property.h"
#endif #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" #include "property.h"
@ -27,19 +32,23 @@ void ctProperties::AddProperty(ctProperty* property, const wxString& insertAfter
if (oldProp) if (oldProp)
m_list.DeleteObject(oldProp); m_list.DeleteObject(oldProp);
wxNode* insertBeforeNode = NULL;
if (insertAfter) if (insertAfter)
{ {
ctProperty* insertAfterProp = FindProperty(insertAfter); ctProperty* insertAfterProp = FindProperty(insertAfter);
if (insertAfterProp) if (insertAfterProp)
{ {
wxNode* node = m_list.Member(insertAfterProp); wxObjectList::compatibility_iterator node = m_list.Member(insertAfterProp);
if (node) 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 else
m_list.Append(property); m_list.Append(property);
@ -68,7 +77,7 @@ void ctProperties::DeleteProperty(const wxString& name)
ctProperty* ctProperties::FindProperty(const wxString& name) const ctProperty* ctProperties::FindProperty(const wxString& name) const
{ {
wxNode* node = m_list.GetFirst(); wxObjectList::compatibility_iterator node = m_list.GetFirst();
while (node) while (node)
{ {
ctProperty* prop = (ctProperty*) node->GetData(); ctProperty* prop = (ctProperty*) node->GetData();
@ -111,14 +120,12 @@ ctProperty* ctProperties::FindOrCreateProperty(const wxString& name)
void ctProperties::Clear() void ctProperties::Clear()
{ {
m_list.DeleteContents(true); WX_CLEAR_LIST(wxObjectList,m_list);
m_list.Clear();
m_list.DeleteContents(false);
} }
void ctProperties::Copy(const ctProperties& properties) void ctProperties::Copy(const ctProperties& properties)
{ {
wxNode* node = properties.m_list.GetFirst(); wxObjectList::compatibility_iterator node = properties.m_list.GetFirst();
while (node) while (node)
{ {
ctProperty* prop = (ctProperty*) node->GetData(); ctProperty* prop = (ctProperty*) node->GetData();
@ -158,7 +165,7 @@ ctProperty* ctProperties::GetNth(int i) const
wxASSERT( i < (int) GetCount() ); wxASSERT( i < (int) GetCount() );
if (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 (ctProperty*) node->GetData();
} }
return NULL; return NULL;

View File

@ -1,28 +1,38 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: settingsdialog.cpp // Name: settingsdialog.cpp
// Purpose: // Purpose: Settings dialog
// Author: // Author: Julian Smart
// Modified by: // Modified by:
// Created: // Created: 2003-06-12
// RCS-ID: // RCS-ID: $Id$
// Copyright: // Copyright: (c) Julian Smart
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "settingsdialog.h" #pragma implementation "settingsdialog.h"
#endif #endif
#include "wx/wx.h" // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/cshelp.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/statline.h" #include "wx/statline.h"
#include "wx/splitter.h" #include "wx/splitter.h"
#include "wx/scrolwin.h" #include "wx/scrolwin.h"
#include "wx/spinctrl.h" #include "wx/spinctrl.h"
#include "wx/spinbutt.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 "wxconfigtool.h"
#include "settingsdialog.h" #include "settingsdialog.h"
@ -56,11 +66,10 @@ END_EVENT_TABLE()
* ctSettingsDialog constructor * 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); SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY);
wxDialog::Create( parent, id, caption, pos, size, style ); wxDialog::Create( parent, wxID_ANY, _("Configuration Settings"));
CreateControls(); CreateControls();
} }
@ -77,12 +86,12 @@ void ctSettingsDialog::CreateControls()
wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL);
item1->SetSizer(item2); item1->SetSizer(item2);
wxNotebook* item3 = new wxNotebook(item1, ID_NOTEBOOK, wxDefaultPosition, wxSize(200, 200), wxNB_TOP); m_notebook = new wxNotebook(item1, wxID_ANY, wxDefaultPosition, wxSize(200, 200), wxNB_TOP);
ctGeneralSettingsDialog* item4 = new ctGeneralSettingsDialog(item3, ID_GENERAL_SETTINGS_DIALOG, wxDefaultPosition, wxSize(100, 80), 0); ctGeneralSettingsDialog* item4 = new ctGeneralSettingsDialog(m_notebook, ID_GENERAL_SETTINGS_DIALOG, wxDefaultPosition, wxSize(100, 80), 0);
item3->AddPage(item4, _("General")); m_notebook->AddPage(item4, _("General"));
ctLocationSettingsDialog* item11 = new ctLocationSettingsDialog(item3, ID_LOCATION_SETTINGS_DIALOG, wxDefaultPosition, wxSize(100, 80), 0); ctLocationSettingsDialog* item11 = new ctLocationSettingsDialog(m_notebook, ID_LOCATION_SETTINGS_DIALOG, wxDefaultPosition, wxSize(100, 80), 0);
item3->AddPage(item11, _("Locations")); m_notebook->AddPage(item11, _("Locations"));
item2->Add(item3, 0, wxGROW|wxALL, 5); item2->Add(m_notebook, 0, wxGROW|wxALL, 5);
wxBoxSizer* item21 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* item21 = new wxBoxSizer(wxHORIZONTAL);
item2->Add(item21, 0, wxGROW|wxALL, 5); item2->Add(item21, 0, wxGROW|wxALL, 5);
@ -136,27 +145,28 @@ void ctSettingsDialog::OnCancel( wxCommandEvent& event )
void ctSettingsDialog::OnHelp( wxCommandEvent& WXUNUSED(event) ) void ctSettingsDialog::OnHelp( wxCommandEvent& WXUNUSED(event) )
{ {
wxNotebook* notebook = (wxNotebook*) FindWindow(ID_NOTEBOOK); if(m_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)
{ {
helpTopic = wxT("General settings dialog"); int sel = m_notebook->GetSelection();
}
else if (page->GetId() == ID_LOCATION_SETTINGS_DIALOG)
{
helpTopic = wxT("Location settings dialog");
}
if (!helpTopic.IsEmpty()) wxASSERT_MSG( (sel != -1), wxT("A notebook tab should always be selected."));
{
wxGetApp().GetHelpController().DisplaySection(helpTopic); 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); GetSizer()->Fit(this);
////@end ctGeneralSettingsDialog content construction ////@end ctGeneralSettingsDialog content construction
FindWindow(ID_LOAD_LAST_DOCUMENT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_loadLastDocument)); item7->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_loadLastDocument));
FindWindow(ID_SHOW_TOOLTIPS)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_useToolTips)); item8->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_useToolTips));
FindWindow(ID_DEFAULT_FILE_KIND)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_defaultFileKind)); item10->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_defaultFileKind));
} }
/*! /*!
@ -321,13 +331,13 @@ void ctLocationSettingsDialog::CreateControls()
wxBoxSizer* item15 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* item15 = new wxBoxSizer(wxHORIZONTAL);
item13->Add(item15, 0, wxGROW, 5); item13->Add(item15, 0, wxGROW, 5);
wxTextCtrl* item16 = new wxTextCtrl(item11, ID_WXWIN_HIERARCHY, wxEmptyString, wxDefaultPosition, wxSize(200, wxDefaultCoord), 0); m_wxWinHierarchy = new wxTextCtrl(item11, ID_WXWIN_HIERARCHY, wxEmptyString, wxDefaultPosition, wxSize(200, wxDefaultCoord), 0);
item16->SetHelpText(_("Enter the root path of the wxWidgets hierarchy")); m_wxWinHierarchy->SetHelpText(_("Enter the root path of the wxWidgets hierarchy"));
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
if (ShowToolTips()) if (ShowToolTips())
item16->SetToolTip(_("Enter the root path of the wxWidgets hierarchy")); m_wxWinHierarchy->SetToolTip(_("Enter the root path of the wxWidgets hierarchy"));
#endif #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); 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")); 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); 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); m_wxWinUse = new wxCheckBox(item11, ID_USE_WXWIN, _("&Use WXWIN environment variable"));
item20->SetValue(false); m_wxWinUse->SetValue(false);
item20->SetHelpText(_("Check to use the value of WXWIN instead")); m_wxWinUse->SetHelpText(_("Check to use the value of WXWIN instead"));
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
if (ShowToolTips()) if (ShowToolTips())
item20->SetToolTip(_("Check to use the value of WXWIN instead")); m_wxWinUse->SetToolTip(_("Check to use the value of WXWIN instead"));
#endif #endif
item18->Add(item20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); item18->Add(m_wxWinUse, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
GetSizer()->Fit(this); GetSizer()->Fit(this);
////@end ctLocationSettingsDialog content construction ////@end ctLocationSettingsDialog content construction
FindWindow(ID_WXWIN_HIERARCHY)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_frameworkDir)); m_wxWinHierarchy->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_frameworkDir));
FindWindow(ID_USE_WXWIN)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_useEnvironmentVariable)); m_wxWinUse->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_useEnvironmentVariable));
} }
/*! /*!
@ -364,8 +374,8 @@ void ctLocationSettingsDialog::CreateControls()
void ctLocationSettingsDialog::OnUpdateWxwinHierarchy( wxUpdateUIEvent& event ) void ctLocationSettingsDialog::OnUpdateWxwinHierarchy( wxUpdateUIEvent& event )
{ {
wxCheckBox* checkbox = (wxCheckBox*) FindWindow(ID_USE_WXWIN); if(m_wxWinUse)
event.Enable(!checkbox->GetValue()); event.Enable(!m_wxWinUse->GetValue());
} }
/*! /*!
@ -374,15 +384,16 @@ void ctLocationSettingsDialog::OnUpdateWxwinHierarchy( wxUpdateUIEvent& event )
void ctLocationSettingsDialog::OnChooseWxwinHierarchy( wxCommandEvent& WXUNUSED(event) ) void ctLocationSettingsDialog::OnChooseWxwinHierarchy( wxCommandEvent& WXUNUSED(event) )
{ {
wxTextCtrl* textCtrl = (wxTextCtrl*) FindWindow( ID_WXWIN_HIERARCHY ); if (m_wxWinHierarchy)
wxASSERT( textCtrl != NULL );
wxString defaultPath = textCtrl->GetValue();
wxDirDialog dialog(this, _("Choose the location of the wxWidgets hierarchy"),
defaultPath);
if (dialog.ShowModal() == wxID_OK)
{ {
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 ) void ctLocationSettingsDialog::OnUpdateChooseWxwinHierarchy( wxUpdateUIEvent& event )
{ {
wxCheckBox* checkbox = (wxCheckBox*) FindWindow(ID_USE_WXWIN); if (m_wxWinUse)
event.Enable(!checkbox->GetValue()); event.Enable(!m_wxWinUse->GetValue());
} }
/*! /*!

View File

@ -1,12 +1,12 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: settingsdialog.h // Name: settingsdialog.h
// Purpose: // Purpose: Settings dialog
// Author: // Author: Julian Smart
// Modified by: // Modified by:
// Created: // Created: 2002-09-04
// RCS-ID: // RCS-ID: $Id$
// Copyright: // Copyright: (c) Julian Smart
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _SETTINGSDIALOG_H_ #ifndef _SETTINGSDIALOG_H_
@ -57,11 +57,7 @@ class ctSettingsDialog: public wxDialog
{ {
public: public:
/// Constructor /// Constructor
ctSettingsDialog( wxWindow* parent, wxWindowID id = wxID_ANY, ctSettingsDialog( wxWindow* parent );
const wxString& caption = _("Configuration Settings"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAPTION|wxSYSTEM_MENU );
/// Creates the controls and sizers /// Creates the controls and sizers
void CreateControls(); void CreateControls();
@ -88,6 +84,11 @@ public:
DECLARE_CLASS( ctSettingsDialog ) DECLARE_CLASS( ctSettingsDialog )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
protected:
// Dialog controls.
wxNotebook* m_notebook;
}; };
/*! /*!
@ -153,6 +154,12 @@ public:
DECLARE_CLASS( ctLocationSettingsDialog ) DECLARE_CLASS( ctLocationSettingsDialog )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
protected:
// Dialog controls.
wxTextCtrl* m_wxWinHierarchy;
wxCheckBox* m_wxWinUse;
}; };
#endif #endif

View File

@ -1,9 +1,9 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: symbols.h // Name: symbols.h
// Purpose: Application symbols file // Purpose: Application symbols file
// Author: // Author: Julian Smart
// Modified by: // Modified by:
// Created: // Created: 2003-06-12
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: // Licence:

View File

@ -13,29 +13,34 @@
// #pragma implementation // #pragma implementation
#endif #endif
#include "wx/wx.h" // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/image.h" #include "wx/wxprec.h"
#include "wx/notebook.h"
#include "wx/splitter.h" #ifdef __BORLANDC__
#include "wx/wfstream.h" #pragma hdrstop
#include "wx/datstrm.h" #endif
#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"
#include <math.h> #include <math.h>
#ifdef __WXMSW__ #ifndef WX_PRECOMP
#include <windows.h>
#include "wx/msw/winundef.h" #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 #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" #include "utils.h"
// Returns the image type, or -1, determined from the extension. // Returns the image type, or -1, determined from the extension.
@ -218,10 +223,12 @@ wxString wxGetTempDir()
#if defined(__WXMAC__) && !defined(__DARWIN__) #if defined(__WXMAC__) && !defined(__DARWIN__)
dir = wxMacFindFolder( (short) kOnSystemDisk, kTemporaryFolderType, kCreateFolder ) ; dir = wxMacFindFolder( (short) kOnSystemDisk, kTemporaryFolderType, kCreateFolder ) ;
#else // !Mac #else // !Mac
dir = wxGetenv(_T("TMP")); wxString dirEnv(wxGetenv(_T("TMP")));
dir = dirEnv;
if ( dir.empty() ) if ( dir.empty() )
{ {
dir = wxGetenv(_T("TEMP")); wxString envVar(wxGetenv(_T("TEMP")));
dir = envVar;
} }
if ( dir.empty() ) if ( dir.empty() )
@ -269,14 +276,12 @@ bool apInvokeAppForFile(const wxString& filename)
wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName) wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName)
{ {
wxString str;
// Try appVariableName // Try appVariableName
if (!appVariableName.IsEmpty()) if (!appVariableName.IsEmpty())
{ {
str = wxGetenv(appVariableName); wxString strVar(wxGetenv(appVariableName.c_str()));
if (!str.IsEmpty()) if (!strVar.IsEmpty())
return str; return strVar;
} }
if (wxIsAbsolutePath(argv0)) if (wxIsAbsolutePath(argv0))
@ -288,9 +293,9 @@ wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin
if (currentDir.Last() != wxFILE_SEP_PATH) if (currentDir.Last() != wxFILE_SEP_PATH)
currentDir += wxFILE_SEP_PATH; currentDir += wxFILE_SEP_PATH;
str = currentDir + argv0; currentDir += argv0;
if (wxFileExists(str)) if (wxFileExists(currentDir))
return wxPathOnly(str); return wxPathOnly(currentDir);
} }
// OK, it's neither an absolute path nor a relative path. // 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; wxPathList pathList;
pathList.AddEnvList(wxT("PATH")); pathList.AddEnvList(wxT("PATH"));
str = pathList.FindAbsoluteValidPath(argv0); wxString strPath = pathList.FindAbsoluteValidPath(argv0);
if (!str.IsEmpty()) if (!strPath.IsEmpty())
return wxPathOnly(str); return wxPathOnly(strPath);
// Failed // Failed
return wxEmptyString; return wxEmptyString;
@ -408,7 +413,7 @@ void wxIconInfo::SetIconId(int state, bool enabled, int iconId)
wxIconTable::wxIconTable(wxImageList* imageList) wxIconTable::wxIconTable(wxImageList* imageList)
{ {
m_imageList = imageList; m_imageList = imageList;
DeleteContents(true); WX_CLEAR_LIST(wxIconTable,*this);
} }
void wxIconTable::AppendInfo(wxIconInfo* info) 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 wxIconInfo* wxIconTable::FindInfo(const wxString& name) const
{ {
wxNode* node = GetFirst(); wxObjectList::compatibility_iterator node = GetFirst();
while (node) while (node)
{ {
wxIconInfo* info = (wxIconInfo*) node->GetData(); wxIconInfo* info = (wxIconInfo*) node->GetData();

View File

@ -21,6 +21,8 @@
#ifndef _AP_UTILS_H_ #ifndef _AP_UTILS_H_
#define _AP_UTILS_H_ #define _AP_UTILS_H_
#include "wx/imaglist.h"
#ifndef DOXYGEN_SKIP #ifndef DOXYGEN_SKIP
/*! /*!

View File

@ -13,27 +13,32 @@
#pragma implementation "wxconfigtool.h" #pragma implementation "wxconfigtool.h"
#endif #endif
#include "wx/wx.h" // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/config.h" #ifndef WX_PRECOMP
#include "wx/laywin.h" #include "wx/laywin.h"
#include "wx/image.h"
#include "wx/menuitem.h" #include "wx/menuitem.h"
#include "wx/tooltip.h" #include "wx/tooltip.h"
#include "wx/variant.h"
#endif
#include "wx/cshelp.h" #include "wx/cshelp.h"
#include "wx/helphtml.h" #include "wx/helphtml.h"
#include "wx/html/htmprint.h" #include "wx/html/htmprint.h"
#include "wx/html/htmlwin.h" #include "wx/html/htmlwin.h"
#include "wx/image.h"
#include "wx/filesys.h" #include "wx/filesys.h"
#include "wx/fs_mem.h" #include "wx/fs_mem.h"
#include "wx/fs_zip.h" #include "wx/fs_zip.h"
#include "wx/wfstream.h" #include "wx/wfstream.h"
#include "wx/variant.h" #include "wx/config.h"
#include "wxconfigtool.h" #include "wxconfigtool.h"
#include "configtooldoc.h" #include "configtooldoc.h"
#include "configtoolview.h" #include "configtoolview.h"
@ -58,6 +63,7 @@ ctApp::~ctApp()
bool ctApp::OnInit(void) bool ctApp::OnInit(void)
{ {
#if wxUSE_LOG #if wxUSE_LOG
wxLog::SetTimestamp(NULL); wxLog::SetTimestamp(NULL);
#endif // wxUSE_LOG #endif // wxUSE_LOG
@ -92,7 +98,9 @@ bool ctApp::OnInit(void)
wxString currentDir = wxGetCwd(); wxString currentDir = wxGetCwd();
// Use argv to get current app directory // 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__ #ifdef __WXMSW__
// If the development version, go up a directory. // If the development version, go up a directory.