diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2019-04-05 08:57:38 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2019-04-05 08:57:38 +0000 |
| commit | 98d368ee1fbfce8a561479da078e97a7f5d7ccd4 (patch) | |
| tree | c2bf896c3bebb8766dec9fd1a0032ffd2ebc0824 /src | |
| parent | Fix indentating. (diff) | |
| download | inkscape-98d368ee1fbfce8a561479da078e97a7f5d7ccd4.tar.gz inkscape-98d368ee1fbfce8a561479da078e97a7f5d7ccd4.zip | |
More cleanup of document.h.
Diffstat (limited to 'src')
| -rw-r--r-- | src/document-undo.cpp | 6 | ||||
| -rw-r--r-- | src/document-undo.h | 8 | ||||
| -rw-r--r-- | src/document.h | 34 | ||||
| -rw-r--r-- | src/ui/widget/entity-entry.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/licensor.cpp | 2 |
5 files changed, 26 insertions, 26 deletions
diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 8284dac55..de526a60c 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -189,7 +189,8 @@ void Inkscape::DocumentUndo::cancel(SPDocument *doc) sp_repr_begin_transaction (doc->rdoc); } -static void finish_incomplete_transaction(SPDocument &doc) { +// Member function for friend access to SPDocument privates. +void Inkscape::DocumentUndo::finish_incomplete_transaction(SPDocument &doc) { Inkscape::XML::Event *log=sp_repr_commit_undoable(doc.rdoc); if (log || doc.partial) { g_warning ("Incomplete undo transaction:"); @@ -202,7 +203,8 @@ static void finish_incomplete_transaction(SPDocument &doc) { } } -static void perform_document_update(SPDocument &doc) { +// Member function for friend access to SPDocument privates. +void Inkscape::DocumentUndo::perform_document_update(SPDocument &doc) { sp_repr_begin_transaction(doc.rdoc); doc.ensureUpToDate(); diff --git a/src/document-undo.h b/src/document-undo.h index 5ed9db8f6..2cff6be28 100644 --- a/src/document-undo.h +++ b/src/document-undo.h @@ -39,7 +39,13 @@ public: static void maybeDone(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring const &event_description); - static void resetKey(SPDocument *doc); +private: + static void finish_incomplete_transaction(SPDocument &document); + + static void perform_document_update(SPDocument &document); + +public: + static void resetKey(SPDocument *document); static void cancel(SPDocument *document); diff --git a/src/document.h b/src/document.h index d1d822f2e..b8f1aeb43 100644 --- a/src/document.h +++ b/src/document.h @@ -33,6 +33,7 @@ #include "3rdparty/libcroco/cr-cascade.h" +#include "document-undo.h" #include "event.h" #include "gc-anchored.h" #include "gc-finalized.h" @@ -237,7 +238,6 @@ public: static SPItem *getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, const std::vector<SPItem*> &list, Geom::Point const &p, bool take_insensitive = false); - // Box tool ------------------------------- void setCurrentPersp3D(Persp3D * const persp); /* @@ -256,15 +256,12 @@ public: return list.size(); } - // Document undo/redo ---------------------- - unsigned long serial() const; // Returns document's unique number. - - /// Are we currently in a transition between two "known good" states of the document? - bool isSeeking() const; - // Document undo/redo ---------------------- + unsigned long serial() const; // Returns document's unique number. + bool isSeeking() const; // Are we in a transition between two "known good" states of document? void reset_key(void *dummy); + bool isSensitive() const { return sensitive; }; // Garbage collecting ---------------------- @@ -307,13 +304,12 @@ public: CRStyleSheet *style_sheet; // File information ---------------------- -protected: +private: char *document_uri; ///< A filename (not a URI yet), or NULL char *document_base; ///< To be used for resolving relative hrefs. char *document_name; ///< basename(uri) or other human-readable label for the document. // Find items ---------------------------- -private: std::map<std::string, SPObject *> iddef; std::map<Inkscape::XML::Node *, SPObject *> reprdef; @@ -322,12 +318,12 @@ private: mutable bool _node_cache_valid; // Box tool ---------------------------- -private: Persp3D *current_persp3d; /**< Currently 'active' perspective (to which, e.g., newly created boxes are attached) */ Persp3DImpl *current_persp3d_impl; // Document undo/redo ---------------------- -public: + + friend Inkscape::DocumentUndo; /* Undo/Redo state */ bool sensitive; /* If we save actions to undo stack */ @@ -343,22 +339,22 @@ public: Inkscape::ConsoleOutputUndoObserver console_output_undo_observer; bool seeking; // Related to undo/redo/unique id -private: unsigned long _serial; // Unique document number (used by undo/redo). - -public: Glib::ustring actionkey; // Last action key, used to combine actions in undo. - // Garbage collecting ---------------------- + std::vector<SPObject *> _collection_queue; ///< Orphans /*********** Signals **************/ + +public: void addUndoObserver(Inkscape::UndoStackObserver& observer); void removeUndoObserver(Inkscape::UndoStackObserver& observer); +private: typedef sigc::signal<void, SPObject *> IDChangedSignal; typedef sigc::signal<void> ResourcesChangedSignal; typedef sigc::signal<void, unsigned> ModifiedSignal; @@ -379,10 +375,8 @@ public: SPDocument::ResizedSignal resized_signal; SPDocument::ReconstructionStart _reconstruction_start_signal; SPDocument::ReconstructionFinish _reconstruction_finish_signal; -public: - SPDocument::CommitSignal commit_signal; + SPDocument::CommitSignal commit_signal; // Used by friend Inkscape::DocumentUndo -private: bool oldSignalsConnected; public: @@ -405,15 +399,13 @@ private: /* Resources */ std::map<std::string, std::vector<SPObject *> > resources; public: - ResourcesChangedSignalMap resources_changed_signals; + ResourcesChangedSignalMap resources_changed_signals; // Used by Extension::Internal::Filter private: sigc::signal<void> destroySignal; public: void _emitModified(); // Used by SPItem - -public: void emitReconstructionStart(); void emitReconstructionFinish(); void emitResizedSignal(double width, double height); diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index 7cabed1b5..6e87459df 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -122,7 +122,7 @@ EntityLineEntry::on_changed() SPDocument *doc = SP_ACTIVE_DOCUMENT; Glib::ustring text = static_cast<Gtk::Entry*>(_packable)->get_text(); if (rdf_set_work_entity (doc, _entity, text.c_str())) { - if (doc->sensitive) { + if (doc->isSensitive()) { DocumentUndo::done(doc, SP_VERB_NONE, "Document metadata updated"); } } diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index c5d6a9aca..2ad811f17 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -64,7 +64,7 @@ void LicenseItem::on_toggled() _wr.setUpdating (true); SPDocument *doc = SP_ACTIVE_DOCUMENT; rdf_set_license (doc, _lic->details ? _lic : nullptr); - if (doc->sensitive) { + if (doc->isSensitive()) { DocumentUndo::done(doc, SP_VERB_NONE, _("Document license updated")); } _wr.setUpdating (false); |
