From b0caf0cf11a3afdfbc9327641dde6ea7a8257fc5 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Sat, 26 Dec 2009 01:31:51 +0100 Subject: Refactoring of 3D box tool, mainly to avoid unnecessary creation of perspectives. (bzr r8910) --- src/document.h | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/document.h') diff --git a/src/document.h b/src/document.h index 06174c265..e83c37a96 100644 --- a/src/document.h +++ b/src/document.h @@ -55,6 +55,7 @@ namespace Inkscape { class SP3DBox; class Persp3D; +class Persp3DImpl; namespace Proj { class TransfMat3x4; @@ -107,17 +108,26 @@ struct SPDocument : public Inkscape::GC::Managed<>, // Instance of the connector router Avoid::Router *router; - GSList *perspectives; - - Persp3D *current_persp3d; // "currently active" perspective (e.g., newly created boxes are attached to this one) - GSList *_collection_queue; bool oldSignalsConnected; - void add_persp3d(Persp3D * const persp); - void remove_persp3d(Persp3D * const persp); - void initialize_current_persp3d(); + void setCurrentPersp3D(Persp3D * const persp); + inline void setCurrentPersp3DImpl(Persp3DImpl * const persp_impl) { current_persp3d_impl = persp_impl; } + /* + * getCurrentPersp3D returns current_persp3d (if non-NULL) or the first + * perspective in the defs. If no perspective exists, returns NULL. + */ + Persp3D * getCurrentPersp3D(); + Persp3DImpl * getCurrentPersp3DImpl(); + void getPerspectivesInDefs(std::vector &list); + unsigned int numPerspectivesInDefs() { + std::vector list; + getPerspectivesInDefs(list); + return list.size(); + } + + //void initialize_current_persp3d(); sigc::connection connectModified(ModifiedSignal::slot_type slot); sigc::connection connectURISet(URISetSignal::slot_type slot); @@ -155,6 +165,9 @@ private: SPDocument(SPDocument const &); // no copy void operator=(SPDocument const &); // no assign + Persp3D *current_persp3d; /**< Currently 'active' perspective (to which, e.g., newly created boxes are attached) */ + Persp3DImpl *current_persp3d_impl; + public: sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot); sigc::connection connectReconstructionFinish(ReconstructionFinish::slot_type slot); -- cgit v1.2.3