summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-05-01 00:26:56 +0000
committerMarc Jeanmougin <mc@M0nst3r.bouyguesbox.fr>2015-05-01 00:26:56 +0000
commit6307c00b5774db5e914415127b302cca5e21345b (patch)
tree083366e46db29d29c080d6f6f4caf34445bd52d6 /src
parentcmake: Fix various issues with cmake builds (diff)
downloadinkscape-6307c00b5774db5e914415127b302cca5e21345b.tar.gz
inkscape-6307c00b5774db5e914415127b302cca5e21345b.zip
Fixed crash bug due to some overlooked function changed in the recent merge.
Also fixed the layer ordering in the widget, which was messed up by the same bug in a way i haven't quite sorted out (so the fact that this patch fixed it is quite a mystery, but i won't complain) (bzr r14079)
Diffstat (limited to 'src')
-rw-r--r--src/selection-chemistry.cpp12
-rw-r--r--src/splivarot.cpp2
-rw-r--r--src/xml/repr-util.cpp17
-rw-r--r--src/xml/repr.h3
4 files changed, 20 insertions, 14 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 7255e80cb..c30d22503 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -459,7 +459,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone)
// sorting items from different parents sorts each parent's subset without possibly mixing
// them, just what we need
- sort(reprs.begin(),reprs.end(),sp_repr_compare_position);
+ sort(reprs.begin(),reprs.end(),sp_repr_compare_position_bool);
std::vector<Inkscape::XML::Node*> newsel;
@@ -677,7 +677,7 @@ void sp_edit_invert_in_all_layers(SPDesktop *desktop)
static void sp_selection_group_impl(std::vector<Inkscape::XML::Node*> p, Inkscape::XML::Node *group, Inkscape::XML::Document *xml_doc, SPDocument *doc) {
- sort(p.begin(),p.end(),sp_repr_compare_position);
+ sort(p.begin(),p.end(),sp_repr_compare_position_bool);
// Remember the position and parent of the topmost object.
gint topmost = p.back()->position();
@@ -1002,7 +1002,7 @@ void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *deskto
}
std::vector<Inkscape::XML::Node*> rl(selection->reprList());
- sort(rl.begin(),rl.end(),sp_repr_compare_position);
+ sort(rl.begin(),rl.end(),sp_repr_compare_position_bool);
for (std::vector<Inkscape::XML::Node*>::const_iterator l=rl.begin(); l!=rl.end();l++) {
Inkscape::XML::Node *repr =(*l);
@@ -1086,7 +1086,7 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des
}
std::vector<Inkscape::XML::Node*> rl(selection->reprList());
- sort(rl.begin(),rl.end(),sp_repr_compare_position);
+ sort(rl.begin(),rl.end(),sp_repr_compare_position_bool);
for (std::vector<Inkscape::XML::Node*>::const_reverse_iterator l=rl.rbegin();l!=rl.rend();l++) {
gint minpos;
@@ -2549,7 +2549,7 @@ void sp_selection_clone(SPDesktop *desktop)
selection->clear();
// sorting items from different parents sorts each parent's subset without possibly mixing them, just what we need
- sort(reprs.begin(),reprs.end(),sp_repr_compare_position);
+ sort(reprs.begin(),reprs.end(),sp_repr_compare_position_bool);
std::vector<Inkscape::XML::Node*> newsel;
@@ -3709,7 +3709,7 @@ void sp_selection_set_clipgroup(SPDesktop *desktop)
std::vector<Inkscape::XML::Node*> p(selection->reprList());
- sort(p.begin(),p.end(),sp_repr_compare_position);
+ sort(p.begin(),p.end(),sp_repr_compare_position_bool);
selection->clear();
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index f61a30462..bec300936 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -688,7 +688,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool
// find out the bottom object
std::vector<Inkscape::XML::Node*> sorted(selection->reprList());
- sort(sorted.begin(),sorted.end(),sp_repr_compare_position);
+ sort(sorted.begin(),sorted.end(),sp_repr_compare_position_bool);
source = doc->getObjectByRepr(sorted.front());
}
diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp
index 3858f08a7..305f1b292 100644
--- a/src/xml/repr-util.cpp
+++ b/src/xml/repr-util.cpp
@@ -260,7 +260,7 @@ gchar const *sp_xml_ns_prefix_uri(gchar const *prefix)
* -1 first object's position is less than the second
* @todo Rewrite this function's description to be understandable
*/
-bool sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second)
+int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second)
{
int p1, p2;
if (first->parent() == second->parent()) {
@@ -277,9 +277,9 @@ bool sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::N
g_assert(ancestor != NULL);
if (ancestor == first) {
- return false;
+ return 1;
} else if (ancestor == second) {
- return true;
+ return -1;
} else {
Inkscape::XML::Node const *to_first = AncetreFils(first, ancestor);
Inkscape::XML::Node const *to_second = AncetreFils(second, ancestor);
@@ -289,9 +289,9 @@ bool sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::N
}
}
- if (p1 > p2) return false;
- if (p1 < p2) return true;
- return false;
+ if (p1 > p2) return 1;
+ if (p1 < p2) return -1;
+ return 0;
/* effic: Assuming that the parent--child relationship is consistent
(i.e. that the parent really does contain first and second among
@@ -310,6 +310,11 @@ bool sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::N
pjrm */
}
+bool sp_repr_compare_position_bool(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second){
+ return sp_repr_compare_position_bool(first, second)<0;
+}
+
+
/**
* Find an element node using an unique attribute.
*
diff --git a/src/xml/repr.h b/src/xml/repr.h
index fbe25ec12..17763195a 100644
--- a/src/xml/repr.h
+++ b/src/xml/repr.h
@@ -121,7 +121,8 @@ unsigned sp_repr_set_point(Inkscape::XML::Node *repr, char const *key, Geom::Poi
unsigned sp_repr_get_point(Inkscape::XML::Node *repr, char const *key, Geom::Point *val);
//c++-style comparison : returns (bool)(a<b)
-bool sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second);
+int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second);
+bool sp_repr_compare_position_bool(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second);
// Searching
/**