summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/document.cpp')
-rw-r--r--src/document.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/document.cpp b/src/document.cpp
index e9388893e..9f408788b 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -369,11 +369,6 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc,
// Recursively build object tree
document->root->invoke_build(document, rroot, false);
- /* fixme: Not sure about this, but lets assume ::build updates */
- rroot->setAttribute("inkscape:version", Inkscape::version_string);
- /* fixme: Again, I moved these here to allow version determining in ::build (Lauris) */
-
-
/* Eliminate obsolete sodipodi:docbase, for privacy reasons */
rroot->setAttribute("sodipodi:docbase", NULL);
@@ -960,6 +955,9 @@ SPDocument::emitReconstructionFinish(void)
{
// printf("Finishing Reconstruction\n");
priv->_reconstruction_finish_signal.emit();
+ // indicates that gradients are reloaded (to rebuild the Auto palette)
+ priv->resources_changed_signals[g_quark_from_string("gradient")].emit();
+
/**
// Reference to the old persp3d object is invalid after reconstruction.
@@ -1607,11 +1605,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)) {
@@ -1626,6 +1635,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);
@@ -1644,6 +1658,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;
}
@@ -1652,6 +1667,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) {