Code

now that selection description includes style (filtered, clipped), we need to update...
[inkscape.git] / src / document.h
index 6e2693aedc53fc827360b2dba15a48f01fdd1223..3ede5a3d0bdc7b4946162b7799595582ca3bec74 100644 (file)
@@ -21,7 +21,7 @@
 #include <sigc++/class_slot.h>
 
 #include "libcroco/cr-cascade.h"
-#include "libnr/nr-forward.h"
+#include <2geom/forward.h>
 
 #include "gc-managed.h"
 #include "gc-finalized.h"
@@ -67,95 +67,102 @@ struct SPDocument : public Inkscape::GC::Managed<>,
                     public Inkscape::GC::Finalized,
                     public Inkscape::GC::Anchored
 {
-       typedef sigc::signal<void, SPObject *> IDChangedSignal;
-       typedef sigc::signal<void> ResourcesChangedSignal;
-       typedef sigc::signal<void, guint> ModifiedSignal;
-       typedef sigc::signal<void, gchar const *> URISetSignal;
-       typedef sigc::signal<void, double, double> ResizedSignal;
-       typedef sigc::signal<void> ReconstructionStart;
-       typedef sigc::signal<void> ReconstructionFinish;
+    typedef sigc::signal<void, SPObject *> IDChangedSignal;
+    typedef sigc::signal<void> ResourcesChangedSignal;
+    typedef sigc::signal<void, guint> ModifiedSignal;
+    typedef sigc::signal<void, gchar const *> URISetSignal;
+    typedef sigc::signal<void, double, double> ResizedSignal;
+    typedef sigc::signal<void> ReconstructionStart;
+    typedef sigc::signal<void> ReconstructionFinish;
     typedef sigc::signal<void> CommitSignal;
 
-       SPDocument();
+    SPDocument();
     virtual ~SPDocument();
 
-       unsigned int keepalive : 1;
-       unsigned int virgin    : 1; ///< Has the document never been touched?
+    unsigned int keepalive : 1;
+    unsigned int virgin    : 1; ///< Has the document never been touched?
+    unsigned int modified_since_save : 1;
 
-       Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document
-       Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document
-       SPObject *root;             ///< Our SPRoot
-       CRCascade *style_cascade;
+    Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document
+    Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document
+    SPObject *root;             ///< Our SPRoot
+    CRCascade *style_cascade;
 
-       gchar *uri; ///< URI string or NULL
-       gchar *base;
-       gchar *name;
+    gchar *uri; ///< URI string or NULL
+    gchar *base;
+    gchar *name;
 
-       SPDocumentPrivate *priv;
+    SPDocumentPrivate *priv;
 
-       /// Last action key
-       const gchar *actionkey;
-       /// Handler ID
-       guint modified_id;
+    /// Last action key
+    const gchar *actionkey;
+    /// Handler ID
+    guint modified_id;
 
     Inkscape::ProfileManager* profileManager;
 
-       // Instance of the connector router
-       Avoid::Router *router;
+    // Instance of the connector router
+    Avoid::Router *router;
 
-        GSList *perspectives;
+    GSList *perspectives;
 
     Persp3D *current_persp3d; // "currently active" perspective (e.g., newly created boxes are attached to this one)
-    std::set<Persp3D *> persps_sel; // perspectives associated to currently selected boxes
 
-        void add_persp3d (Persp3D * const persp);
-        void remove_persp3d (Persp3D * const persp);
+    GSList *_collection_queue;
 
-       sigc::connection connectModified(ModifiedSignal::slot_type slot);
-       sigc::connection connectURISet(URISetSignal::slot_type slot);
-       sigc::connection connectResized(ResizedSignal::slot_type slot);
-  sigc::connection connectCommit(CommitSignal::slot_type slot);
+    bool oldSignalsConnected;
 
-       void bindObjectToId(gchar const *id, SPObject *object);
-       SPObject *getObjectById(gchar const *id);
-       sigc::connection connectIdChanged(const gchar *id, IDChangedSignal::slot_type slot);
+    void add_persp3d (Persp3D * const persp);
+    void remove_persp3d (Persp3D * const persp);
 
-       void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object);
-       SPObject *getObjectByRepr(Inkscape::XML::Node *repr);
+    sigc::connection connectModified(ModifiedSignal::slot_type slot);
+    sigc::connection connectURISet(URISetSignal::slot_type slot);
+    sigc::connection connectResized(ResizedSignal::slot_type slot);
+sigc::connection connectCommit(CommitSignal::slot_type slot);
+
+    void bindObjectToId(gchar const *id, SPObject *object);
+    SPObject *getObjectById(gchar const *id);
+    sigc::connection connectIdChanged(const gchar *id, IDChangedSignal::slot_type slot);
+
+    void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object);
+    SPObject *getObjectByRepr(Inkscape::XML::Node *repr);
 
     Glib::ustring getLanguage();
 
-       void queueForOrphanCollection(SPObject *object);
-       void collectOrphans();
+    void queueForOrphanCollection(SPObject *object);
+    void collectOrphans();
 
-       void _emitModified();
+    void _emitModified();
 
-       GSList *_collection_queue;
+    void addUndoObserver(Inkscape::UndoStackObserver& observer);
+    void removeUndoObserver(Inkscape::UndoStackObserver& observer);
 
-       void addUndoObserver(Inkscape::UndoStackObserver& observer);
-       void removeUndoObserver(Inkscape::UndoStackObserver& observer);
+    bool _updateDocument();
 
-        bool _updateDocument();
+    /// Are we currently in a transition between two "known good" states of the document?
+    bool isSeeking() const;
 
-       /// Are we currently in a transition between two "known good" states of the document?
-       bool isSeeking() const;
+    bool isModifiedSinceSave() const { return modified_since_save; }
+    void setModifiedSinceSave(bool modified = true) {
+        modified_since_save = modified;
+    }
 
 private:
-       SPDocument(SPDocument const &); // no copy
-       void operator=(SPDocument const &); // no assign
+    SPDocument(SPDocument const &); // no copy
+    void operator=(SPDocument const &); // no assign
 
 public:
-       sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot);
-       sigc::connection connectReconstructionFinish (ReconstructionFinish::slot_type  slot);
-       void emitReconstructionStart (void);
-       void emitReconstructionFinish  (void);
+    sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot);
+    sigc::connection connectReconstructionFinish (ReconstructionFinish::slot_type  slot);
+    void emitReconstructionStart (void);
+    void emitReconstructionFinish  (void);
 
-       unsigned long serial() const;
-        void reset_key (void *dummy);
-        sigc::connection _selection_changed_connection;
-        sigc::connection _desktop_activated_connection;
+    unsigned long serial() const;
+    void reset_key (void *dummy);
+    sigc::connection _selection_changed_connection;
+    sigc::connection _desktop_activated_connection;
 
-       void fitToRect(NR::Rect const &rect);
+    void fitToRect(Geom::Rect const &rect);
 };
 
 SPDocument *sp_document_new (const gchar *uri, unsigned int keepalive, bool make_new = false);
@@ -178,6 +185,7 @@ SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri,
 
 gdouble sp_document_width (SPDocument * document);
 gdouble sp_document_height (SPDocument * document);
+Geom::Point sp_document_dimensions (SPDocument * document);
 
 struct SPUnit;
 
@@ -249,12 +257,12 @@ sigc::connection sp_document_resources_changed_connect(SPDocument *document, con
  * Misc
  */
 
-GSList * sp_document_items_in_box(SPDocument *document, unsigned int dkey, NR::Rect const &box);
-GSList * sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, NR::Rect const &box);
-SPItem* sp_document_item_from_list_at_point_bottom (unsigned int dkey, SPGroup *group, const GSList *list, NR::Point const p, bool take_insensitive = false);
-SPItem * sp_document_item_at_point (SPDocument *document, unsigned int key, NR::Point const p, gboolean into_groups, SPItem *upto = NULL);
-GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<NR::Point> points);
-SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key,  NR::Point const p);
+GSList * sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
+GSList * sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
+SPItem* sp_document_item_from_list_at_point_bottom (unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
+SPItem * sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
+GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
+SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key,  Geom::Point const p);
 
 void sp_document_set_uri (SPDocument *document, const gchar *uri);
 void sp_document_resized_signal_emit (SPDocument *doc, gdouble width, gdouble height);