From: Markus R. <rol...@us...> - 2007-02-18 08:52:48
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15088 Modified Files: Tag: WIN32 propertyframe.cpp propertyframe.h Log Message: - use a CachedPath to the referenced node so the reference can be reconstructed after a simulation is reloaded Index: propertyframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/propertyframe.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** propertyframe.h 15 Feb 2007 10:57:28 -0000 1.2.2.1 --- propertyframe.h 18 Feb 2007 08:52:44 -0000 1.2.2.2 *************** *** 32,35 **** --- 32,36 ---- #include <boost/weak_ptr.hpp> + #include <zeitgeist/leaf.h> #include "propertylist.h" *************** *** 46,53 **** --- 47,59 ---- propertyframe(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE); + /** set the managed leaf */ void SetLeaf(boost::weak_ptr<zeitgeist::Leaf> leaf); + /** refresh the displayed properties of the managed leaf */ void RefreshProperties(); + /** update the cached reference to the managed leaf */ + void UpdateCached(); + private: // begin wxGlade: propertyframe::methods *************** *** 61,65 **** // end wxGlade ! boost::weak_ptr<zeitgeist::Leaf> mLeaf; PropertyList mPropList; }; // wxGlade: end class --- 67,72 ---- // end wxGlade ! zeitgeist::Leaf::CachedPath<zeitgeist::Leaf> mPath; ! PropertyList mPropList; }; // wxGlade: end class Index: propertyframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/propertyframe.cpp,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** propertyframe.cpp 15 Feb 2007 10:57:27 -0000 1.2.2.1 --- propertyframe.cpp 18 Feb 2007 08:52:44 -0000 1.2.2.2 *************** *** 22,25 **** --- 22,26 ---- #include "propertyframe.h" #include "main.h" + #include "simspark.h" //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro *************** *** 63,70 **** } void propertyframe::SetLeaf(weak_ptr<Leaf> leaf) { ! mLeaf = leaf; ! mPropList.Init(mLeaf,mCtrPropList); RefreshProperties(); } --- 64,97 ---- } + void propertyframe::UpdateCached() + { + shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if (spark.get() == 0) + { + return; + } + + mPath.Update(spark->GetCore()); + mPropList.Init(mPath.get(),mCtrPropList); + } + void propertyframe::SetLeaf(weak_ptr<Leaf> leaf) { ! shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! if (spark.get() == 0) ! { ! return; ! } ! ! if (leaf.expired()) ! { ! mPath = Leaf::CachedPath<zeitgeist::Leaf>(); ! } else ! { ! std::string path = leaf.lock()->GetFullPath(); ! mPath.SetKey(Core::CacheKey(spark->GetCore()->GetRoot(), path)); ! } ! ! UpdateCached(); RefreshProperties(); } |