|
From: Markus R. <rol...@us...> - 2006-01-22 17:25:33
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8982 Modified Files: Makefile.am mainframe.cpp mainframe.h property.cpp property.h propertyframe.cpp propertyframe.h Log Message: - replaced the text control above the tree with a property list of the current selected node Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mainframe.h 22 Jan 2006 12:19:28 -0000 1.6 --- mainframe.h 22 Jan 2006 17:25:23 -0000 1.7 *************** *** 22,25 **** --- 22,26 ---- #include <wx/image.h> #include "sparktree.h" + #include "propertylist.h" #ifndef MAINFRAME_H *************** *** 30,33 **** --- 31,35 ---- // begin wxGlade: ::dependencies #include <wx/splitter.h> + #include <wx/listctrl.h> #include <wx/treectrl.h> // end wxGlade *************** *** 83,86 **** --- 85,90 ---- bool CanClose(); + void InitTreeNodeProperties(); + void OnTreeItemExpanding(wxTreeEvent& event); void OnTreeSelChanged(wxTreeEvent& event); *************** *** 97,102 **** wxMenuBar* MainFrame_menubar; wxStatusBar* MainFrame_statusbar; ! wxTextCtrl* mCtrLocation; wxTreeCtrl* mCtrTree; wxPanel* mLeftPane; SparkGLCanvas* mCanvas; --- 101,109 ---- wxMenuBar* MainFrame_menubar; wxStatusBar* MainFrame_statusbar; ! wxListCtrl* mCtrPropList; ! wxPanel* mLeftTopPane; wxTreeCtrl* mCtrTree; + wxPanel* mLeftBottomPane; + wxSplitterWindow* window_1; wxPanel* mLeftPane; SparkGLCanvas* mCanvas; *************** *** 113,116 **** --- 120,124 ---- wxToolBar* mToolBar; SparkTree mSparkTree; + PropertyList mPropList; int mLastHorSashPosition; Index: propertyframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/propertyframe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** propertyframe.cpp 22 Jan 2006 12:18:18 -0000 1.1 --- propertyframe.cpp 22 Jan 2006 17:25:23 -0000 1.2 *************** *** 66,142 **** { mLeaf = leaf; ! ! shared_ptr<Property> property = wxGetApp().GetProperty(); ! if (property.get() != 0) ! { ! property->GetClassList(mLeaf.lock(), mClassList); ! } ! ! InitList(); } void propertyframe::RefreshProperties() { ! if (mLeaf.expired()) ! { ! return; ! } ! ! shared_ptr<Property> property = wxGetApp().GetProperty(); ! if (property.get() == 0) ! { ! return; ! } ! ! shared_ptr<Leaf> leaf = mLeaf.lock(); ! ! Property::TEntryList entries; ! property->GenEntries(leaf, mClassList, entries); ! ! int line = 0; ! bool valRefresh = (mCtrList->GetItemCount() == entries.size()); ! ! if (valRefresh) ! { ! // just refresh values to prevent flicker ! int line = 0; ! for ( ! Property::TEntryList::const_iterator iter = entries.begin(); ! iter != entries.end(); ! ++iter ! ) ! { ! const Property::Entry& entry = (*iter); ! mCtrList->SetItem(line, 1, entry.value); ! ++line; ! } ! } else ! { ! // complete refresh ! mCtrList->DeleteAllItems(); ! ! for ( ! Property::TEntryList::const_iterator iter = entries.begin(); ! iter != entries.end(); ! ++iter ! ) ! { ! const Property::Entry& entry = (*iter); ! ! int row = mCtrList->InsertItem(line, entry.name); ! mCtrList->SetItem(row, 1, entry.value); ! ! ++line; ! } ! } ! } ! ! void propertyframe::InitList() ! { ! mCtrList->ClearAll(); ! ! mCtrList->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, 120); ! mCtrList->InsertColumn(1, _T("value"), wxLIST_FORMAT_LEFT, 600); ! ! RefreshProperties(); } --- 66,75 ---- { mLeaf = leaf; ! mPropList.Init(mLeaf,mCtrList); ! RefreshProperties(); } void propertyframe::RefreshProperties() { ! mPropList.Refresh(); } Index: property.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/property.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** property.h 22 Jan 2006 12:17:33 -0000 1.1 --- property.h 22 Jan 2006 17:25:23 -0000 1.2 *************** *** 18,25 **** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <list> #include <map> #include <boost/weak_ptr.hpp> - #include <wx/string.h> --- 18,27 ---- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + #ifndef PROPERTY_H__ + #define PROPERTY_H__ + #include <list> #include <map> #include <boost/weak_ptr.hpp> #include <wx/string.h> *************** *** 79,80 **** --- 81,84 ---- TClassMap mClassMap; }; + + #endif // PROPERTY_H__ Index: Makefile.am =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.am 22 Jan 2006 12:19:28 -0000 1.4 --- Makefile.am 22 Jan 2006 17:25:23 -0000 1.5 *************** *** 25,28 **** --- 25,29 ---- inputwx.cpp\ sparktree.cpp\ + propertylist.cpp\ propertyframe.cpp\ property.cpp Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mainframe.cpp 22 Jan 2006 12:19:28 -0000 1.7 --- mainframe.cpp 22 Jan 2006 17:25:23 -0000 1.8 *************** *** 72,76 **** // the default width of the tree window pane [pixel] ! static const int TREEWND_DEFAULT_WIDTH = 150; mainframe::mainframe(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): --- 72,76 ---- // the default width of the tree window pane [pixel] ! static const int TREEWND_DEFAULT_WIDTH = 270; mainframe::mainframe(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): *************** *** 85,88 **** --- 85,91 ---- mTopPane = new wxPanel(mCtrHorSplitter, -1); mLeftPane = new wxPanel(mCtrVertSplitter, -1); + window_1 = new wxSplitterWindow(mLeftPane, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_BORDER); + mLeftBottomPane = new wxPanel(window_1, -1); + mLeftTopPane = new wxPanel(window_1, -1); MainFrame_menubar = new wxMenuBar(); SetMenuBar(MainFrame_menubar); *************** *** 99,104 **** MainFrame_menubar->Append(wxglade_tmp_menu_3, wxT("&Simulation")); MainFrame_statusbar = CreateStatusBar(1, 0); ! mCtrLocation = new wxTextCtrl(mLeftPane, -1, wxT("")); ! mCtrTree = new wxTreeCtrl(mLeftPane, 1, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_NO_LINES|wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER); mCanvas = new SparkGLCanvas(mTopPane, -1); mCtrLog = new wxTextCtrl(mBottomPane, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxTE_LINEWRAP); --- 102,107 ---- MainFrame_menubar->Append(wxglade_tmp_menu_3, wxT("&Simulation")); MainFrame_statusbar = CreateStatusBar(1, 0); ! mCtrPropList = new wxListCtrl(mLeftTopPane, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER); ! mCtrTree = new wxTreeCtrl(mLeftBottomPane, 1, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_NO_LINES|wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER); mCanvas = new SparkGLCanvas(mTopPane, -1); mCtrLog = new wxTextCtrl(mBottomPane, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxTE_LINEWRAP); *************** *** 130,133 **** --- 133,137 ---- // init spark tree mSparkTree.Init(mCtrTree); + InitTreeNodeProperties(); // init log wnd timer *************** *** 140,144 **** mCtrHorSplitter->SetSashPosition(mLastHorSashPosition); ! // only resize top pane, when window is resized mCtrHorSplitter->SetSashGravity(1.0); } --- 144,148 ---- mCtrHorSplitter->SetSashPosition(mLastHorSashPosition); ! mCtrHorSplitter->SetSashGravity(1.0); } *************** *** 177,182 **** wxBoxSizer* sizer_5 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* sizer_7 = new wxBoxSizer(wxVERTICAL); ! sizer_7->Add(mCtrLocation, 0, wxEXPAND|wxADJUST_MINSIZE, 0); ! sizer_7->Add(mCtrTree, 1, wxEXPAND, 0); mLeftPane->SetAutoLayout(true); mLeftPane->SetSizer(sizer_7); --- 181,198 ---- wxBoxSizer* sizer_5 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* sizer_7 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_8 = new wxBoxSizer(wxHORIZONTAL); ! wxBoxSizer* sizer_4 = new wxBoxSizer(wxHORIZONTAL); ! sizer_4->Add(mCtrPropList, 1, wxEXPAND, 0); ! mLeftTopPane->SetAutoLayout(true); ! mLeftTopPane->SetSizer(sizer_4); ! sizer_4->Fit(mLeftTopPane); ! sizer_4->SetSizeHints(mLeftTopPane); ! sizer_8->Add(mCtrTree, 1, wxEXPAND, 0); ! mLeftBottomPane->SetAutoLayout(true); ! mLeftBottomPane->SetSizer(sizer_8); ! sizer_8->Fit(mLeftBottomPane); ! sizer_8->SetSizeHints(mLeftBottomPane); ! window_1->SplitHorizontally(mLeftTopPane, mLeftBottomPane); ! sizer_7->Add(window_1, 1, wxEXPAND, 0); mLeftPane->SetAutoLayout(true); mLeftPane->SetSizer(sizer_7); *************** *** 377,390 **** } void mainframe::OnTreeSelChanged(wxTreeEvent& event) { ! wxString location; ! if (! mSparkTree.GetLocation(event.GetItem(), location)) ! { ! location = _T("?"); ! } ! ! mCtrLocation->SetValue(location); } --- 393,405 ---- } + void mainframe::InitTreeNodeProperties() + { + mPropList.Init(mSparkTree.GetLeaf(mCtrTree->GetSelection()), mCtrPropList); + RefreshProperties(); + } void mainframe::OnTreeSelChanged(wxTreeEvent& event) { ! InitTreeNodeProperties(); } *************** *** 407,410 **** --- 422,427 ---- void mainframe::RefreshProperties() { + mPropList.Refresh(); + wxWindowList& children = GetChildren(); for ( Index: property.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/property.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** property.cpp 22 Jan 2006 12:17:33 -0000 1.1 --- property.cpp 22 Jan 2006 17:25:23 -0000 1.2 *************** *** 70,77 **** mClassMap.clear(); ! mClassMap["/classes/zeitgeist/Leaf"] = CL_LEAF; ! mClassMap["ClassClass"] = CL_CLASS; ! mClassMap["/classes/oxygen/BaseNode"] = CL_BASENODE; ! mClassMap["/classes/oxygen/Transform"] = CL_TRANSFORM; } --- 70,77 ---- mClassMap.clear(); ! mClassMap[_T("/classes/zeitgeist/Leaf")] = CL_LEAF; ! mClassMap[_T("ClassClass")] = CL_CLASS; ! mClassMap[_T("/classes/oxygen/BaseNode")] = CL_BASENODE; ! mClassMap[_T("/classes/oxygen/Transform")] = CL_TRANSFORM; } Index: propertyframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/propertyframe.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** propertyframe.h 22 Jan 2006 12:18:18 -0000 1.1 --- propertyframe.h 22 Jan 2006 17:25:23 -0000 1.2 *************** *** 32,35 **** --- 32,36 ---- #include <boost/weak_ptr.hpp> + #include "propertylist.h" namespace zeitgeist *************** *** 47,51 **** void SetLeaf(boost::weak_ptr<zeitgeist::Leaf> leaf); - void InitList(); void RefreshProperties(); --- 48,51 ---- *************** *** 62,66 **** boost::weak_ptr<zeitgeist::Leaf> mLeaf; ! Property::TClassList mClassList; }; // wxGlade: end class --- 62,66 ---- boost::weak_ptr<zeitgeist::Leaf> mLeaf; ! PropertyList mPropList; }; // wxGlade: end class |