summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
authorbrock-alexander <Brock.Alexander@web.de>2016-06-14 10:26:58 +0000
committerJazzyNico <nicoduf@yahoo.fr>2016-06-14 10:26:58 +0000
commit3e173aedbe72ba21d33eaec804bf4c9f8e9fa158 (patch)
treef8d3149bf2bfa30b030017176698d40808eac903 /src/document.cpp
parent[Bug #1407331] Ukrainian translation update for 0.92. (diff)
downloadinkscape-3e173aedbe72ba21d33eaec804bf4c9f8e9fa158.tar.gz
inkscape-3e173aedbe72ba21d33eaec804bf4c9f8e9fa158.zip
Merging lp:~inkscape+alexander/inkscape/comments into lp:inkscape.
(bzr r14986)
Diffstat (limited to 'src/document.cpp')
-rw-r--r--src/document.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/document.cpp b/src/document.cpp
index d8c3f1269..902dabbc3 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -1602,11 +1602,22 @@ static unsigned int count_objects_recursive(SPObject *obj, unsigned int count)
return count;
}
+/**
+ * Count the number of objects in a given document recursively using the count_objects_recursive helper function
+ *
+ * @param[in] document Pointer to the document for counting objects
+ * @return Numer of objects in the document
+ */
static unsigned int objects_in_document(SPDocument *document)
{
return count_objects_recursive(document->getRoot(), 0);
}
+/**
+ * Remove unused definitions etc. recursively from an object and its siblings
+ *
+ * @param[inout] obj Object which shall be "cleaned"
+ */
static void vacuum_document_recursive(SPObject *obj)
{
if (SP_IS_DEFS(obj)) {
@@ -1621,6 +1632,11 @@ static void vacuum_document_recursive(SPObject *obj)
}
}
+/**
+ * Remove unused definitions etc. recursively from an entire document.
+ *
+ * @return Number of removed objects
+ */
unsigned int SPDocument::vacuumDocument()
{
unsigned int start = objects_in_document(this);
@@ -1639,6 +1655,7 @@ unsigned int SPDocument::vacuumDocument()
newend = objects_in_document(this);
} while (iterations < 100 && newend < end);
+ // We stop if vacuum_document_recursive doesn't remove any more objects or after 100 iterations, whichever occurs first.
return start - newend;
}
@@ -1647,6 +1664,11 @@ bool SPDocument::isSeeking() const {
return priv->seeking;
}
+/**
+ * Indicate to the user if the document has been modified since the last save by displaying a "*" in front of the name of the file in the window title.
+ *
+ * @param[in] modified True if the document has been modified.
+ */
void SPDocument::setModifiedSinceSave(bool modified) {
this->modified_since_save = modified;
if (SP_ACTIVE_DESKTOP) {