Merge lp:~inkscape+alexander/inkscape/comments into lp:~inkscape.dev/inkscape/trunk

Proposed by jazzynico
Status: Merged
Merged at revision: 14986
Proposed branch: lp:~inkscape+alexander/inkscape/comments
Merge into: lp:~inkscape.dev/inkscape/trunk
Diff against target: 159 lines (+60/-3) (has conflicts)
3 files modified
src/document.cpp (+45/-1)
src/document.h (+1/-1)
src/sp-object.cpp (+14/-1)
Text conflict in src/document.cpp
To merge this branch: bzr merge lp:~inkscape+alexander/inkscape/comments
Reviewer Review Type Date Requested Status
jazzynico (community) Approve
Review via email: mp+297150@code.launchpad.net
To post a comment you must log in.
Revision history for this message
jazzynico (jazzynico) wrote :

Conflicts fixed and comments merged rev. 14986.
Thanks Alexander!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/document.cpp'
--- src/document.cpp 2016-06-08 09:16:29 +0000
+++ src/document.cpp 2016-06-13 05:33:40 +0000
@@ -1591,6 +1591,23 @@
15911591
1592/* Helpers */1592/* Helpers */
15931593
1594<<<<<<< TREE
1595=======
1596gboolean
1597sp_document_resource_list_free(gpointer /*key*/, gpointer value, gpointer /*data*/)
1598{
1599 g_slist_free((GSList *) value);
1600 return TRUE;
1601}
1602
1603/**
1604 * Count the siblings of an object (plus the object itself).
1605 *
1606 * @param [in] obj Pointer to the object which siblings shall be counted.
1607 * @param [inout] Number of objects counted so far (in previous iterations / recursion levels)
1608 * @return Number of siblings (plus the object itself)
1609 */
1610>>>>>>> MERGE-SOURCE
1594static unsigned int count_objects_recursive(SPObject *obj, unsigned int count)1611static unsigned int count_objects_recursive(SPObject *obj, unsigned int count)
1595{1612{
1596 count++; // obj itself1613 count++; // obj itself
@@ -1602,11 +1619,22 @@
1602 return count;1619 return count;
1603}1620}
16041621
1622/**
1623 * Count the number of objects in a given document recursively using the count_objects_recursive helper function
1624 *
1625 * @param[in] document Pointer to the document for counting objects
1626 * @return Numer of objects in the document
1627 */
1605static unsigned int objects_in_document(SPDocument *document)1628static unsigned int objects_in_document(SPDocument *document)
1606{1629{
1607 return count_objects_recursive(document->getRoot(), 0);1630 return count_objects_recursive(document->getRoot(), 0);
1608}1631}
16091632
1633/**
1634 * Remove unused definitions etc. recursively from an object and its siblings
1635 *
1636 * @param[inout] obj Object which shall be "cleaned"
1637 */
1610static void vacuum_document_recursive(SPObject *obj)1638static void vacuum_document_recursive(SPObject *obj)
1611{1639{
1612 if (SP_IS_DEFS(obj)) {1640 if (SP_IS_DEFS(obj)) {
@@ -1621,10 +1649,20 @@
1621 }1649 }
1622}1650}
16231651
1652/**
1653 * Remove unused definitions etc. recursively from an entire document.
1654 *
1655 * @return Number of removed objects
1656 */
1624unsigned int SPDocument::vacuumDocument()1657unsigned int SPDocument::vacuumDocument()
1625{1658{
1659<<<<<<< TREE
1626 unsigned int start = objects_in_document(this);1660 unsigned int start = objects_in_document(this);
1627 unsigned int end;1661 unsigned int end;
1662=======
1663 unsigned int const start = objects_in_document(this);
1664 unsigned int end = start;
1665>>>>>>> MERGE-SOURCE
1628 unsigned int newend = start;1666 unsigned int newend = start;
16291667
1630 unsigned int iterations = 0;1668 unsigned int iterations = 0;
@@ -1639,6 +1677,7 @@
1639 newend = objects_in_document(this);1677 newend = objects_in_document(this);
16401678
1641 } while (iterations < 100 && newend < end);1679 } while (iterations < 100 && newend < end);
1680 // We stop if vacuum_document_recursive doesn't remove any more objects or after 100 iterations, whichever occurs first.
16421681
1643 return start - newend;1682 return start - newend;
1644}1683}
@@ -1647,7 +1686,12 @@
1647 return priv->seeking;1686 return priv->seeking;
1648}1687}
16491688
1650void SPDocument::setModifiedSinceSave(bool modified) {1689/**
1690 * 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.
1691 *
1692 * @param[in] modified True if the document has been modified.
1693 */
1694void SPDocument::setModifiedSinceSave(bool const modified) {
1651 this->modified_since_save = modified;1695 this->modified_since_save = modified;
1652 if (SP_ACTIVE_DESKTOP) {1696 if (SP_ACTIVE_DESKTOP) {
1653 Gtk::Window *parent = SP_ACTIVE_DESKTOP->getToplevel();1697 Gtk::Window *parent = SP_ACTIVE_DESKTOP->getToplevel();
16541698
=== modified file 'src/document.h'
--- src/document.h 2016-06-01 19:13:32 +0000
+++ src/document.h 2016-06-13 05:33:40 +0000
@@ -198,7 +198,7 @@
198 bool isSeeking() const;198 bool isSeeking() const;
199199
200 bool isModifiedSinceSave() const { return modified_since_save; }200 bool isModifiedSinceSave() const { return modified_since_save; }
201 void setModifiedSinceSave(bool modified = true);201 void setModifiedSinceSave(bool const modified = true);
202202
203private:203private:
204 SPDocument(SPDocument const &); // no copy204 SPDocument(SPDocument const &); // no copy
205205
=== modified file 'src/sp-object.cpp'
--- src/sp-object.cpp 2016-03-18 17:58:10 +0000
+++ src/sp-object.cpp 2016-06-13 05:33:40 +0000
@@ -71,13 +71,17 @@
71 SPObject::repr_order_changed71 SPObject::repr_order_changed
72};72};
7373
74// A friend class used to set internal members on SPObject so as to not expose settors in SPObject's public API74/**
75 * A friend class used to set internal members on SPObject so as to not expose settors in SPObject's public API
76 */
75class SPObjectImpl77class SPObjectImpl
76{78{
77public:79public:
7880
79/**81/**
80 * Null's the id member of an SPObject without attempting to free prior contents.82 * Null's the id member of an SPObject without attempting to free prior contents.
83 *
84 * @param[inout] obj Pointer to the object which's id shall be nulled.
81 */85 */
82 static void setIdNull( SPObject* obj ) {86 static void setIdNull( SPObject* obj ) {
83 if (obj) {87 if (obj) {
@@ -87,6 +91,9 @@
8791
88/**92/**
89 * Sets the id member of an object, freeing any prior content.93 * Sets the id member of an object, freeing any prior content.
94 *
95 * @param[inout] obj Pointer to the object which's id shall be set.
96 * @param[in] id New id
90 */97 */
91 static void setId( SPObject* obj, gchar const* id ) {98 static void setId( SPObject* obj, gchar const* id ) {
92 if (obj && (id != obj->id) ) {99 if (obj && (id != obj->id) ) {
@@ -104,6 +111,9 @@
104static gchar *sp_object_get_unique_id(SPObject *object,111static gchar *sp_object_get_unique_id(SPObject *object,
105 gchar const *defid);112 gchar const *defid);
106113
114/**
115 * Constructor, sets all attributes to default values.
116 */
107SPObject::SPObject()117SPObject::SPObject()
108 : cloned(0), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0),118 : cloned(0), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0),
109 document(NULL), parent(NULL), children(NULL), _last_child(NULL),119 document(NULL), parent(NULL), children(NULL), _last_child(NULL),
@@ -126,6 +136,9 @@
126 this->context_style = NULL;136 this->context_style = NULL;
127}137}
128138
139/**
140 * Destructor, frees the used memory and unreferences a potential successor of the object.
141 */
129SPObject::~SPObject() {142SPObject::~SPObject() {
130 g_free(this->_label);143 g_free(this->_label);
131 g_free(this->_default_label);144 g_free(this->_default_label);