Some updates (incomplete)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22846 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
74ee21fd66
commit
61775320c5
246
utils/configtool/src/configbrowser.cpp
Normal file
246
utils/configtool/src/configbrowser.cpp
Normal file
@ -0,0 +1,246 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: configbrowser.cpp
|
||||
// Purpose:
|
||||
// Author:
|
||||
// Modified by:
|
||||
// Created:
|
||||
// RCS-ID:
|
||||
// Copyright:
|
||||
// Licence:
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////@begin includes
|
||||
#include "wx/wx.h"
|
||||
#include "wx/splitter.h"
|
||||
#include "wx/treectrl.h"
|
||||
////@end includes
|
||||
|
||||
#include "configbrowser.h"
|
||||
|
||||
////@begin XPM images
|
||||
////@end XPM images
|
||||
|
||||
/*!
|
||||
* ctConfigurationBrowserWindow type definition
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS( ctConfigurationBrowserWindow, wxPanel )
|
||||
|
||||
/*!
|
||||
* ctConfigurationBrowserWindow event table definition
|
||||
*/
|
||||
|
||||
BEGIN_EVENT_TABLE( ctConfigurationBrowserWindow, wxPanel )
|
||||
|
||||
////@begin ctConfigurationBrowserWindow event table entries
|
||||
EVT_TREE_SEL_CHANGED( ID_CONFIGURATION_BROWSER_TREECTRL, ctConfigurationBrowserWindow::OnConfigurationBrowserTreectrl )
|
||||
|
||||
////@end ctConfigurationBrowserWindow event table entries
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/*!
|
||||
* ctConfigurationBrowserWindow constructor
|
||||
*/
|
||||
|
||||
ctConfigurationBrowserWindow::ctConfigurationBrowserWindow( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
////@begin ctConfigurationBrowserWindow member initialisation
|
||||
////@end ctConfigurationBrowserWindow member initialisation
|
||||
|
||||
wxPanel::Create( parent, id, pos, size, style );
|
||||
|
||||
CreateControls();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Control creation for ctConfigurationBrowserWindow
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserWindow::CreateControls()
|
||||
{
|
||||
////@begin ctConfigurationBrowserWindow content construction
|
||||
|
||||
ctConfigurationBrowserWindow* item1 = this;
|
||||
|
||||
wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL);
|
||||
item1->SetSizer(item2);
|
||||
item1->SetAutoLayout(TRUE);
|
||||
|
||||
wxSplitterWindow* item3 = new wxSplitterWindow(item1, ID_CONFIGBROWSER_SPLITTERWINDOW, wxDefaultPosition, wxSize(400, 400), wxSP_3DBORDER|wxSP_3DSASH|wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE);
|
||||
wxTreeCtrl* item4 = new wxTreeCtrl(item3, ID_CONFIGURATION_BROWSER_TREECTRL, wxDefaultPosition, wxSize(100, 100), wxTR_SINGLE|wxNO_BORDER);
|
||||
ctConfigurationBrowserControlPanel* item5 = new ctConfigurationBrowserControlPanel(item3, ID_PANEL, wxDefaultPosition, wxSize(100, 80), wxNO_BORDER|wxTAB_TRAVERSAL);
|
||||
item3->SplitVertically(item4, item5, 200);
|
||||
item2->Add(item3, 1, wxGROW, 5);
|
||||
|
||||
////@end ctConfigurationBrowserWindow content construction
|
||||
}
|
||||
|
||||
/*!
|
||||
* Event handler for ID_CONFIGURATION_BROWSER_TREECTRL
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserWindow::OnConfigurationBrowserTreectrl( wxTreeEvent& event )
|
||||
{
|
||||
// Replace with custom code
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Should we show tooltips?
|
||||
*/
|
||||
|
||||
bool ctConfigurationBrowserWindow::ShowToolTips()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*!
|
||||
* ctConfigurationBrowserControlPanel type definition
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS( ctConfigurationBrowserControlPanel, wxPanel )
|
||||
|
||||
/*!
|
||||
* ctConfigurationBrowserControlPanel event table definition
|
||||
*/
|
||||
|
||||
BEGIN_EVENT_TABLE( ctConfigurationBrowserControlPanel, wxPanel )
|
||||
|
||||
////@begin ctConfigurationBrowserControlPanel event table entries
|
||||
EVT_BUTTON( ID_ADD_CONFIGURATION, ctConfigurationBrowserControlPanel::OnAddConfiguration )
|
||||
EVT_UPDATE_UI( ID_ADD_CONFIGURATION, ctConfigurationBrowserControlPanel::OnUpdateAddConfiguration )
|
||||
|
||||
EVT_BUTTON( ID_REMOVE_CONFIGURATION, ctConfigurationBrowserControlPanel::OnRemoveConfiguration )
|
||||
EVT_UPDATE_UI( ID_REMOVE_CONFIGURATION, ctConfigurationBrowserControlPanel::OnUpdateRemoveConfiguration )
|
||||
|
||||
EVT_BUTTON( ID_RENAME_CONFIGURATION, ctConfigurationBrowserControlPanel::OnRenameConfiguration )
|
||||
EVT_UPDATE_UI( ID_RENAME_CONFIGURATION, ctConfigurationBrowserControlPanel::OnUpdateRenameConfiguration )
|
||||
|
||||
////@end ctConfigurationBrowserControlPanel event table entries
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/*!
|
||||
* ctConfigurationBrowserControlPanel constructor
|
||||
*/
|
||||
|
||||
ctConfigurationBrowserControlPanel::ctConfigurationBrowserControlPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
////@begin ctConfigurationBrowserControlPanel member initialisation
|
||||
////@end ctConfigurationBrowserControlPanel member initialisation
|
||||
|
||||
////@begin ctConfigurationBrowserControlPanel creation
|
||||
wxPanel::Create( parent, id, pos, size, style );
|
||||
|
||||
CreateControls();
|
||||
////@end ctConfigurationBrowserControlPanel creation
|
||||
}
|
||||
|
||||
/*!
|
||||
* Control creation for ctConfigurationBrowserControlPanel
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserControlPanel::CreateControls()
|
||||
{
|
||||
////@begin ctConfigurationBrowserControlPanel content construction
|
||||
|
||||
ctConfigurationBrowserControlPanel* item5 = this;
|
||||
|
||||
wxBoxSizer* item6 = new wxBoxSizer(wxVERTICAL);
|
||||
item5->SetSizer(item6);
|
||||
item5->SetAutoLayout(TRUE);
|
||||
|
||||
wxStaticText* item7 = new wxStaticText(item5, wxID_STATIC, _("Browse, add and remove configurations"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
item6->Add(item7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 5);
|
||||
|
||||
item6->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
||||
|
||||
wxButton* item9 = new wxButton(item5, ID_ADD_CONFIGURATION, _("&Add..."), wxDefaultPosition, wxDefaultSize, 0);
|
||||
item6->Add(item9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
||||
|
||||
wxButton* item10 = new wxButton(item5, ID_REMOVE_CONFIGURATION, _("&Remove..."), wxDefaultPosition, wxDefaultSize, 0);
|
||||
item6->Add(item10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
||||
|
||||
wxButton* item11 = new wxButton(item5, ID_RENAME_CONFIGURATION, _("&Rename..."), wxDefaultPosition, wxDefaultSize, 0);
|
||||
item6->Add(item11, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
||||
|
||||
item6->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
||||
|
||||
wxStaticText* item13 = new wxStaticText(item5, ID_CONFIGURATION_NAME, _("Configuration:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
item6->Add(item13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
|
||||
wxTextCtrl* item14 = new wxTextCtrl(item5, ID_CONFIGURATION_DESCRIPTION, _(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH);
|
||||
item6->Add(item14, 1, wxGROW|wxALL, 5);
|
||||
|
||||
////@end ctConfigurationBrowserControlPanel content construction
|
||||
}
|
||||
|
||||
/*!
|
||||
* Event handler for ID_ADD_CONFIGURATION
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserControlPanel::OnAddConfiguration( wxCommandEvent& event )
|
||||
{
|
||||
// Replace with custom code
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Update event handler for ID_ADD_CONFIGURATION
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserControlPanel::OnUpdateAddConfiguration( wxUpdateUIEvent& event )
|
||||
{
|
||||
// Replace with custom code
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Event handler for ID_REMOVE_CONFIGURATION
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserControlPanel::OnRemoveConfiguration( wxCommandEvent& event )
|
||||
{
|
||||
// Replace with custom code
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Update event handler for ID_REMOVE_CONFIGURATION
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserControlPanel::OnUpdateRemoveConfiguration( wxUpdateUIEvent& event )
|
||||
{
|
||||
// Replace with custom code
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Event handler for ID_RENAME_CONFIGURATION
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserControlPanel::OnRenameConfiguration( wxCommandEvent& event )
|
||||
{
|
||||
// Replace with custom code
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Update event handler for ID_RENAME_CONFIGURATION
|
||||
*/
|
||||
|
||||
void ctConfigurationBrowserControlPanel::OnUpdateRenameConfiguration( wxUpdateUIEvent& event )
|
||||
{
|
||||
// Replace with custom code
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Should we show tooltips?
|
||||
*/
|
||||
|
||||
bool ctConfigurationBrowserControlPanel::ShowToolTips()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
130
utils/configtool/src/configbrowser.h
Normal file
130
utils/configtool/src/configbrowser.h
Normal file
@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: configbrowser.h
|
||||
// Purpose:
|
||||
// Author:
|
||||
// Modified by:
|
||||
// Created:
|
||||
// RCS-ID:
|
||||
// Copyright:
|
||||
// Licence:
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _CONFIGBROWSER_H_
|
||||
#define _CONFIGBROWSER_H_
|
||||
|
||||
/*!
|
||||
* Includes
|
||||
*/
|
||||
|
||||
////@begin includes
|
||||
////@end includes
|
||||
|
||||
/*!
|
||||
* Forward declarations
|
||||
*/
|
||||
|
||||
////@begin forward declarations
|
||||
class ctConfigurationBrowserControlPanel;
|
||||
////@end forward declarations
|
||||
|
||||
/*!
|
||||
* Control identifiers
|
||||
*/
|
||||
|
||||
////@begin control identifiers
|
||||
#define ID_DIALOG 2000
|
||||
#define ID_CONFIGBROWSER_SPLITTERWINDOW 2001
|
||||
#define ID_CONFIGURATION_BROWSER_TREECTRL 2002
|
||||
#define ID_PANEL 2003
|
||||
#define ID_ADD_CONFIGURATION 2004
|
||||
#define ID_REMOVE_CONFIGURATION 2005
|
||||
#define ID_RENAME_CONFIGURATION 2006
|
||||
#define ID_CONFIGURATION_NAME 2007
|
||||
#define ID_CONFIGURATION_DESCRIPTION 2008
|
||||
////@end control identifiers
|
||||
|
||||
/*!
|
||||
* ctConfigurationBrowserWindow class declaration
|
||||
*/
|
||||
|
||||
class ctConfigurationBrowserWindow: public wxPanel
|
||||
{
|
||||
DECLARE_CLASS( ctConfigurationBrowserWindow )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
ctConfigurationBrowserWindow( wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN );
|
||||
|
||||
/// Creates the controls and sizers
|
||||
void CreateControls();
|
||||
|
||||
////@begin ctConfigurationBrowserWindow event handler declarations
|
||||
|
||||
/// Event handler for ID_CONFIGURATION_BROWSER_TREECTRL
|
||||
void OnConfigurationBrowserTreectrl( wxTreeEvent& event );
|
||||
|
||||
////@end ctConfigurationBrowserWindow event handler declarations
|
||||
|
||||
////@begin ctConfigurationBrowserWindow member function declarations
|
||||
|
||||
////@end ctConfigurationBrowserWindow member function declarations
|
||||
|
||||
/// Should we show tooltips?
|
||||
static bool ShowToolTips();
|
||||
|
||||
////@begin ctConfigurationBrowserWindow member variables
|
||||
////@end ctConfigurationBrowserWindow member variables
|
||||
};
|
||||
|
||||
/*!
|
||||
* ctConfigurationBrowserControlPanel class declaration
|
||||
*/
|
||||
|
||||
class ctConfigurationBrowserControlPanel: public wxPanel
|
||||
{
|
||||
DECLARE_CLASS( ctConfigurationBrowserControlPanel )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
ctConfigurationBrowserControlPanel( wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER|wxTAB_TRAVERSAL );
|
||||
|
||||
/// Creates the controls and sizers
|
||||
void CreateControls();
|
||||
|
||||
////@begin ctConfigurationBrowserControlPanel event handler declarations
|
||||
|
||||
/// Event handler for ID_ADD_CONFIGURATION
|
||||
void OnAddConfiguration( wxCommandEvent& event );
|
||||
|
||||
/// Update event handler for ID_ADD_CONFIGURATION
|
||||
void OnUpdateAddConfiguration( wxUpdateUIEvent& event );
|
||||
|
||||
/// Event handler for ID_REMOVE_CONFIGURATION
|
||||
void OnRemoveConfiguration( wxCommandEvent& event );
|
||||
|
||||
/// Update event handler for ID_REMOVE_CONFIGURATION
|
||||
void OnUpdateRemoveConfiguration( wxUpdateUIEvent& event );
|
||||
|
||||
/// Event handler for ID_RENAME_CONFIGURATION
|
||||
void OnRenameConfiguration( wxCommandEvent& event );
|
||||
|
||||
/// Update event handler for ID_RENAME_CONFIGURATION
|
||||
void OnUpdateRenameConfiguration( wxUpdateUIEvent& event );
|
||||
|
||||
////@end ctConfigurationBrowserControlPanel event handler declarations
|
||||
|
||||
////@begin ctConfigurationBrowserControlPanel member function declarations
|
||||
|
||||
////@end ctConfigurationBrowserControlPanel member function declarations
|
||||
|
||||
/// Should we show tooltips?
|
||||
static bool ShowToolTips();
|
||||
|
||||
////@begin ctConfigurationBrowserControlPanel member variables
|
||||
////@end ctConfigurationBrowserControlPanel member variables
|
||||
};
|
||||
|
||||
#endif
|
||||
// _CONFIGBROWSER_H_
|
@ -1039,4 +1039,210 @@ bool ctConfigCommand::DoAndUndo(bool doCmd)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
IMPLEMENT_CLASS(ctConfiguration, wxObject)
|
||||
|
||||
ctConfiguration::ctConfiguration()
|
||||
{
|
||||
m_treeItemId = wxTreeItemId();
|
||||
m_parent = NULL;
|
||||
m_topItem = NULL;
|
||||
}
|
||||
|
||||
ctConfiguration::ctConfiguration(ctConfiguration* parent, const wxString& name)
|
||||
{
|
||||
m_treeItemId = wxTreeItemId();
|
||||
SetName(name);
|
||||
m_parent = parent;
|
||||
if (parent)
|
||||
parent->AddChild(this);
|
||||
}
|
||||
|
||||
ctConfiguration::~ctConfiguration()
|
||||
{
|
||||
/*
|
||||
ctConfigTreeCtrl* treeCtrl = wxGetApp().GetMainFrame()->GetConfigTreeCtrl();
|
||||
if (m_treeItemId.IsOk() && treeCtrl)
|
||||
{
|
||||
ctTreeItemData* data = (ctTreeItemData*) treeCtrl->GetItemData(m_treeItemId);
|
||||
if (data)
|
||||
data->SetConfigItem(NULL);
|
||||
}
|
||||
if (GetParent())
|
||||
GetParent()->RemoveChild(this);
|
||||
else
|
||||
{
|
||||
if (wxGetApp().GetMainFrame()->GetDocument() &&
|
||||
wxGetApp().GetMainFrame()->GetDocument()->GetTopItem() == this)
|
||||
wxGetApp().GetMainFrame()->GetDocument()->SetTopItem(NULL);
|
||||
}
|
||||
*/
|
||||
|
||||
Clear();
|
||||
}
|
||||
|
||||
/// Assignment operator.
|
||||
void ctConfiguration::operator= (const ctConfiguration& configuration)
|
||||
{
|
||||
m_name = configuration.m_name;
|
||||
m_description = configuration.m_description;
|
||||
}
|
||||
|
||||
/// Clear children
|
||||
void ctConfiguration::Clear()
|
||||
{
|
||||
wxNode* node = m_children.GetFirst();
|
||||
while (node)
|
||||
{
|
||||
wxNode* next = node->GetNext();
|
||||
ctConfiguration* child = (ctConfiguration*) node->GetData();
|
||||
|
||||
// This should delete 'node' too, assuming
|
||||
// child's m_parent points to 'this'. If not,
|
||||
// it'll be cleaned up by m_children.Clear().
|
||||
delete child;
|
||||
|
||||
node = next;
|
||||
}
|
||||
m_children.Clear();
|
||||
}
|
||||
|
||||
// Get the nth child
|
||||
ctConfiguration* ctConfiguration::GetChild(int n) const
|
||||
{
|
||||
wxASSERT ( n < GetChildCount() && n > -1 );
|
||||
|
||||
if ( n < GetChildCount() && n > -1 )
|
||||
{
|
||||
ctConfiguration* child = wxDynamicCast(m_children.Item(n)->GetData(), ctConfiguration);
|
||||
return child;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get the child count
|
||||
int ctConfiguration::GetChildCount() const
|
||||
{
|
||||
return m_children.GetCount();
|
||||
}
|
||||
|
||||
/// Add a child
|
||||
void ctConfiguration::AddChild(ctConfiguration* configuration)
|
||||
{
|
||||
m_children.Append(configuration);
|
||||
configuration->SetParent(this);
|
||||
}
|
||||
|
||||
/// Remove (but don't delete) a child
|
||||
void ctConfiguration::RemoveChild(ctConfiguration* configuration)
|
||||
{
|
||||
m_children.DeleteObject(configuration);
|
||||
configuration->SetParent(NULL);
|
||||
}
|
||||
|
||||
/// Get the associated document (currently, assumes
|
||||
/// there's only ever one document active)
|
||||
ctConfigToolDoc* ctConfiguration::GetDocument()
|
||||
{
|
||||
ctConfigToolDoc* doc = wxGetApp().GetMainFrame()->GetDocument();
|
||||
return doc;
|
||||
}
|
||||
|
||||
/// Find an item in this hierarchy
|
||||
// TODO: ensure that names are unique, somehow.
|
||||
ctConfiguration* ctConfiguration::FindConfiguration(const wxString& name)
|
||||
{
|
||||
if (GetName() == name)
|
||||
return this;
|
||||
|
||||
for ( wxNode* node = GetChildren().GetFirst(); node; node = node->GetNext() )
|
||||
{
|
||||
ctConfiguration* child = (ctConfiguration*) node->GetData();
|
||||
ctConfiguration* found = child->FindConfiguration(name);
|
||||
if (found)
|
||||
return found;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// Find the next sibling
|
||||
ctConfiguration* ctConfiguration::FindNextSibling()
|
||||
{
|
||||
if (!GetParent())
|
||||
return NULL;
|
||||
wxNode* node = GetParent()->GetChildren().Member(this);
|
||||
if (node && node->GetNext())
|
||||
{
|
||||
return (ctConfiguration*) node->GetNext()->GetData();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// Find the previous sibling
|
||||
ctConfiguration* ctConfiguration::FindPreviousSibling()
|
||||
{
|
||||
if (!GetParent())
|
||||
return NULL;
|
||||
wxNode* node = GetParent()->GetChildren().Member(this);
|
||||
if (node && node->GetPrevious())
|
||||
{
|
||||
return (ctConfiguration*) node->GetPrevious()->GetData();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// Create a clone of this and children
|
||||
ctConfiguration* ctConfiguration::DeepClone()
|
||||
{
|
||||
ctConfiguration* newItem = Clone();
|
||||
|
||||
for ( wxNode* node = GetChildren().GetFirst(); node; node = node->GetNext() )
|
||||
{
|
||||
ctConfiguration* child = (ctConfiguration*) node->GetData();
|
||||
ctConfiguration* newChild = child->DeepClone();
|
||||
newItem->AddChild(newChild);
|
||||
}
|
||||
return newItem;
|
||||
}
|
||||
|
||||
/// Detach: remove from parent, and remove tree items
|
||||
void ctConfiguration::Detach()
|
||||
{
|
||||
// TODO
|
||||
if (GetParent())
|
||||
GetParent()->RemoveChild(this);
|
||||
else
|
||||
GetDocument()->SetTopItem(NULL);
|
||||
SetParent(NULL);
|
||||
|
||||
/*
|
||||
wxTreeItemId treeItem = GetTreeItemId();
|
||||
|
||||
DetachFromTree();
|
||||
|
||||
// Will delete the branch, but not the config items.
|
||||
wxGetApp().GetMainFrame()->GetConfigTreeCtrl()->Delete(treeItem);
|
||||
*/
|
||||
}
|
||||
|
||||
/// Hide from tree: make sure tree deletions won't delete
|
||||
/// the config items
|
||||
void ctConfiguration::DetachFromTree()
|
||||
{
|
||||
wxTreeItemId item = GetTreeItemId();
|
||||
|
||||
// TODO
|
||||
/*
|
||||
ctTreeItemData* data = (ctTreeItemData*) wxGetApp().GetMainFrame()->GetConfigTreeCtrl()->GetItemData(item);
|
||||
data->SetConfigItem(NULL);
|
||||
m_treeItemId = wxTreeItemId();
|
||||
|
||||
for ( wxNode* node = GetChildren().GetFirst(); node; node = node->GetNext() )
|
||||
{
|
||||
ctConfiguration* child = (ctConfiguration*) node->GetData();
|
||||
child->DetachFromTree();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "configitem.h"
|
||||
|
||||
class wxSimpleHtmlTag;
|
||||
class ctConfiguration;
|
||||
|
||||
/*!
|
||||
* ctConfigToolDoc
|
||||
@ -112,6 +113,135 @@ protected:
|
||||
ctConfigItem* m_clipboardItem;
|
||||
};
|
||||
|
||||
/*!
|
||||
* ctConfiguration is a configuration or a place-holder node within the
|
||||
* hierarchy of configurations.
|
||||
*/
|
||||
|
||||
class ctConfiguration: public wxObject
|
||||
{
|
||||
public:
|
||||
/// Ctor and dtor
|
||||
ctConfiguration(ctConfiguration* parent, const wxString& name);
|
||||
ctConfiguration();
|
||||
~ctConfiguration();
|
||||
|
||||
/// Copy constructor.
|
||||
ctConfiguration(const ctConfiguration& configuration)
|
||||
{
|
||||
(*this) = configuration;
|
||||
}
|
||||
|
||||
/// Operations
|
||||
|
||||
/// Assignment operator.
|
||||
void operator= (const ctConfiguration& configuration);
|
||||
|
||||
/// Create a clone
|
||||
ctConfiguration* Clone()
|
||||
{
|
||||
ctConfiguration* configuration = new ctConfiguration;
|
||||
*configuration = *this;
|
||||
return configuration;
|
||||
}
|
||||
|
||||
/// Create a clone of this and children
|
||||
ctConfiguration* DeepClone();
|
||||
|
||||
/// Clear children
|
||||
void Clear();
|
||||
|
||||
/// Add a child
|
||||
void AddChild(ctConfiguration* config);
|
||||
|
||||
/// Remove (but don't delete) a child
|
||||
void RemoveChild(ctConfiguration* config);
|
||||
|
||||
/// Find an item in this hierarchy
|
||||
ctConfiguration* FindConfiguration(const wxString& name);
|
||||
|
||||
/// Find the next sibling
|
||||
ctConfiguration* FindNextSibling();
|
||||
|
||||
/// Find the previous sibling
|
||||
ctConfiguration* FindPreviousSibling();
|
||||
|
||||
/// Detach: remove from parent, and remove tree items
|
||||
void Detach();
|
||||
|
||||
/// Attach: insert before the given position
|
||||
void Attach(ctConfiguration* parent, ctConfiguration* insertbefore);
|
||||
|
||||
void DetachFromTree();
|
||||
|
||||
/// Accessors
|
||||
|
||||
/// Returns the top-level item.
|
||||
ctConfigItem* GetTopItem() const { return m_topItem; }
|
||||
|
||||
/// Sets the top-level item.
|
||||
void SetTopItem(ctConfigItem* item) { m_topItem = item; }
|
||||
|
||||
/// Returns the name.
|
||||
wxString GetName() const { return m_name; }
|
||||
|
||||
/// Sets the name.
|
||||
void SetName(const wxString& name ) { m_name = name; }
|
||||
|
||||
/// Get description.
|
||||
wxString GetDescription() const { return m_description; }
|
||||
|
||||
/// Set description.
|
||||
void SetDescription(const wxString& descr) { m_description = descr; }
|
||||
|
||||
/// Set the tree item id
|
||||
void SetTreeItem(wxTreeItemId id) { m_treeItemId = id; }
|
||||
|
||||
// Get the type
|
||||
wxTreeItemId GetTreeItemId() const { return m_treeItemId ; }
|
||||
|
||||
/// Get the list of children
|
||||
wxList& GetChildren() { return m_children; }
|
||||
|
||||
/// Get the nth child
|
||||
ctConfiguration* GetChild(int n) const;
|
||||
|
||||
/// Get the child count
|
||||
int GetChildCount() const;
|
||||
|
||||
/// Get the parent
|
||||
ctConfiguration* GetParent() const { return m_parent; }
|
||||
|
||||
/// Set the parent
|
||||
void SetParent(ctConfiguration* parent) { m_parent = parent; }
|
||||
|
||||
/// Get the associated document (currently, assumes
|
||||
/// there's only ever one document active)
|
||||
ctConfigToolDoc* GetDocument() ;
|
||||
|
||||
protected:
|
||||
|
||||
/// The corresponding tree item
|
||||
wxTreeItemId m_treeItemId;
|
||||
|
||||
/// The list of children.
|
||||
wxList m_children;
|
||||
|
||||
/// The parent config item
|
||||
ctConfiguration* m_parent;
|
||||
|
||||
/// The name
|
||||
wxString m_name;
|
||||
|
||||
/// The description
|
||||
wxString m_description;
|
||||
|
||||
/// The top-level item of this description, if any
|
||||
ctConfigItem* m_topItem;
|
||||
|
||||
DECLARE_CLASS(ctConfiguration)
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* Implements a document editing command.
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "propeditor.h"
|
||||
#include "configtooldoc.h"
|
||||
#include "configtoolview.h"
|
||||
#include "configbrowser.h"
|
||||
|
||||
#include "bitmaps/wxconfigtool.xpm"
|
||||
|
||||
@ -96,24 +97,35 @@ ctMainFrame::ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id,
|
||||
m_editMenu = NULL;
|
||||
m_configurePage = NULL;
|
||||
m_setupPage = NULL;
|
||||
m_configBrowserPage = NULL;
|
||||
m_mainNotebook = NULL;
|
||||
m_findDialog = NULL;
|
||||
|
||||
m_treeSplitterWindow = new wxSplitterWindow(this, -1, wxDefaultPosition, wxSize(400, 300),
|
||||
wxSP_3DSASH|wxSP_3DBORDER);
|
||||
wxSP_3DSASH|wxSP_3DBORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
|
||||
m_configTreeCtrl = new ctConfigTreeCtrl(m_treeSplitterWindow, -1, wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS|wxNO_BORDER);
|
||||
wxTR_HAS_BUTTONS|wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
|
||||
m_mainNotebook = new wxNotebook(m_treeSplitterWindow, -1, wxDefaultPosition, wxSize(300, 300));
|
||||
m_mainNotebook = new wxNotebook(m_treeSplitterWindow, -1, wxDefaultPosition, wxSize(300, 300),
|
||||
wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
|
||||
m_propertyEditor = new ctPropertyEditor(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
|
||||
wxNO_BORDER);
|
||||
wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
m_setupPage = new ctOutputWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
|
||||
wxNO_BORDER);
|
||||
wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
m_configurePage = new ctOutputWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
|
||||
wxNO_BORDER);
|
||||
wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
|
||||
#if 0
|
||||
m_configBrowserPage = new ctConfigurationBrowserWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
|
||||
wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
#endif
|
||||
|
||||
m_mainNotebook->AddPage(m_propertyEditor, _T("Properties"));
|
||||
#if 0
|
||||
m_mainNotebook->AddPage(m_configBrowserPage, _T("Configuration Browser"));
|
||||
#endif
|
||||
m_mainNotebook->AddPage(m_setupPage, _T("setup.h"));
|
||||
m_mainNotebook->AddPage(m_configurePage, _T("configure"));
|
||||
|
||||
@ -131,7 +143,7 @@ ctMainFrame::ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id,
|
||||
wxMenuBar* menuBar = CreateMenuBar();
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL);
|
||||
CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
InitToolBar(GetToolBar());
|
||||
|
||||
if (wxGetApp().GetSettings().m_showToolBar)
|
||||
|
@ -27,6 +27,7 @@ class ctConfigTreeCtrl;
|
||||
class ctPropertyEditor;
|
||||
class ctOutputWindow;
|
||||
class ctFindReplaceDialog;
|
||||
class ctConfigurationBrowserWindow;
|
||||
|
||||
/*!
|
||||
* \brief The main window of the application.
|
||||
@ -153,6 +154,10 @@ protected:
|
||||
ctOutputWindow* m_setupPage;
|
||||
ctOutputWindow* m_configurePage;
|
||||
|
||||
// The control panel for browsing, adding and removing
|
||||
// configurations.
|
||||
ctConfigurationBrowserWindow* m_configBrowserPage;
|
||||
|
||||
ctFindReplaceDialog* m_findDialog;
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,7 @@ bool ctApp::OnInit(void)
|
||||
|
||||
ctMainFrame* frame = new ctMainFrame(m_docManager, NULL, -1, wxGetApp().GetSettings().GetAppName(),
|
||||
GetSettings().m_frameSize.GetPosition(), GetSettings().m_frameSize.GetSize(),
|
||||
wxDEFAULT_FRAME_STYLE);
|
||||
wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
SetTopWindow(frame);
|
||||
|
||||
switch (wxGetApp().GetSettings().m_frameStatus)
|
||||
|
@ -159,8 +159,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(WXWINDEV)\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(WXWINDEV)/include" /I "$(WXWINDEV)/lib/mswd" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(WXWIN)/include" /I "$(WXWIN)/lib/mswd" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
@ -187,7 +186,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "$(WXWINDEV)\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "$(WXWINDEV)/include" /I "$(WXWINDEV)/lib/mswd" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "$(WXWIN)/include" /I "$(WXWIN)/lib/mswd" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
@ -222,6 +221,10 @@ SOURCE=.\appsettings.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\configbrowser.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\configitem.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -283,6 +286,10 @@ SOURCE=.\appsettings.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\configbrowser.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\configitem.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -366,12 +373,12 @@ SOURCE=.\wxconfigtool.rc
|
||||
!ELSEIF "$(CFG)" == "wxconfigtool - Win32 DebugDev"
|
||||
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809 /i "$(WXWINDEV)\include"
|
||||
# ADD RSC /l 0x809 /i "$(WXWIN)\include"
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxconfigtool - Win32 ReleaseDev"
|
||||
|
||||
# ADD BASE RSC /l 0x809
|
||||
# ADD RSC /l 0x809 /i "$(WXWINDEV)\include"
|
||||
# ADD RSC /l 0x809 /i "$(WXWIN)\include"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
@ -99,12 +99,6 @@ protected:
|
||||
/// The application directory.
|
||||
wxString m_appDir;
|
||||
|
||||
/// Global print data, to remember settings during the session.
|
||||
wxPrintData m_printData;
|
||||
|
||||
/// Global page setup data.
|
||||
wxPageSetupDialogData m_pageSetupData;
|
||||
|
||||
/// Notebook window.
|
||||
wxNotebook* m_notebookWindow;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,10 @@ aaaa ICON "bitmaps/wxconfigtool.ico"
|
||||
|
||||
wxconfigtool ICON "bitmaps/wxconfigtool.ico"
|
||||
|
||||
#define wxUSE_NO_MANIFEST 0
|
||||
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
/* Use if compiling with earlier versions of wxWindows */
|
||||
1 24 "wxconfigtool.exe.manifest"
|
||||
/* 1 24 "wxconfigtool.exe.manifest" */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user