From a7f2b2ba3f13ceb60376802f4a31e104153839e8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Feb 2015 03:00:37 +0100 Subject: At first, I was thinking "I just have to go to the selection file, and change that GSList* with a std::list, then resolve the few problems" So, i tried that. And I will continue tomorrow, and the days after, on and on. (bzr r13922.1.1) --- src/selection.h | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'src/selection.h') diff --git a/src/selection.h b/src/selection.h index 5964b20e8..7171b8742 100644 --- a/src/selection.h +++ b/src/selection.h @@ -19,6 +19,11 @@ #include #include +#include +#include +#include +#include + #include "gc-managed.h" #include "gc-finalized.h" #include "gc-anchored.h" @@ -26,11 +31,13 @@ #include "sp-item.h" + class SPDesktop; class SPItem; class SPBox3D; class Persp3D; -typedef struct _GSList GSList; + +typedef std::list SelContainer; namespace Inkscape { class LayerModel; @@ -39,6 +46,15 @@ class Node; } } +/*template +const GSList* std_list_to_GS_list(const std::list list) const +{ + gpointer l=NULL; + for(auto x:list){ + + } +}*/ + namespace Inkscape { /** @@ -154,21 +170,21 @@ public: * * @param objs the objects to select */ - void setList(GSList const *objs); + void setList(SelContainer const &objs); /** * Adds the specified objects to selection, without deselecting first. * * @param objs the objects to select */ - void addList(GSList const *objs); + void addList(SelContainer const &objs); /** * Clears the selection and selects the specified objects. * * @param repr a list of xml nodes for the items to select */ - void setReprList(GSList const *reprs); + void setReprList(std::list const &reprs); /** Add items from an STL iterator range to the selection. * \param from the begin iterator @@ -192,7 +208,7 @@ public: /** * Returns true if no items are selected. */ - bool isEmpty() const { return _objs == NULL; } + bool isEmpty() const { return _objs.empty(); } /** * Returns true if the given object is selected. @@ -238,13 +254,13 @@ public: XML::Node *singleRepr(); /** Returns the list of selected objects. */ - GSList const *list(); + std::list const &list(); /** Returns the list of selected SPItems. */ - GSList const *itemList(); + std::list const &itemList(); /** Returns a list of the xml nodes of all selected objects. */ /// \todo only returns reprs of SPItems currently; need a separate /// method for that - GSList const *reprList(); + std::list const &reprList(); /** Returns a list of all perspectives which have a 3D box in the current selection. (these may also be nested in groups) */ @@ -360,9 +376,9 @@ private: /** Releases an active layer object that is being removed. */ void _releaseContext(SPObject *obj); - mutable GSList *_objs; - mutable GSList *_reprs; - mutable GSList *_items; + mutable std::list _objs; + mutable std::list _reprs; + mutable std::list _items; void add_box_perspective(SPBox3D *box); void add_3D_boxes_recursively(SPObject *obj); -- cgit v1.2.3 From 9e21d00fb1053897420f80d05a9815c5b2bbf312 Mon Sep 17 00:00:00 2001 From: mc <> Date: Wed, 18 Feb 2015 11:25:23 +0100 Subject: I can't really understand why, but i can now launch inkscape without it segfaulting. That's an improvement. Next thing: code cleaning, replacing containers with vectors (bzr r13922.1.4) --- src/selection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/selection.h') diff --git a/src/selection.h b/src/selection.h index 7171b8742..f85c6346b 100644 --- a/src/selection.h +++ b/src/selection.h @@ -260,7 +260,7 @@ public: /** Returns a list of the xml nodes of all selected objects. */ /// \todo only returns reprs of SPItems currently; need a separate /// method for that - std::list const &reprList(); + std::vector const &reprList(); /** Returns a list of all perspectives which have a 3D box in the current selection. (these may also be nested in groups) */ @@ -377,7 +377,7 @@ private: void _releaseContext(SPObject *obj); mutable std::list _objs; - mutable std::list _reprs; + mutable std::vector _reprs; mutable std::list _items; void add_box_perspective(SPBox3D *box); -- cgit v1.2.3 From 5fd00cab14d48beaf2279a2b8f3ad5b02b76c87b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 04:25:21 +0100 Subject: Put a few std::vector (bzr r13922.1.5) --- src/selection.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/selection.h') diff --git a/src/selection.h b/src/selection.h index f85c6346b..2d5e7c34a 100644 --- a/src/selection.h +++ b/src/selection.h @@ -170,21 +170,21 @@ public: * * @param objs the objects to select */ - void setList(SelContainer const &objs); + void setList(std::vector const &objs); /** * Adds the specified objects to selection, without deselecting first. * * @param objs the objects to select */ - void addList(SelContainer const &objs); + void addList(std::vector const &objs); /** * Clears the selection and selects the specified objects. * * @param repr a list of xml nodes for the items to select */ - void setReprList(std::list const &reprs); + void setReprList(std::vector const &reprs); /** Add items from an STL iterator range to the selection. * \param from the begin iterator @@ -256,7 +256,7 @@ public: /** Returns the list of selected objects. */ std::list const &list(); /** Returns the list of selected SPItems. */ - std::list const &itemList(); + std::vector const &itemList(); /** Returns a list of the xml nodes of all selected objects. */ /// \todo only returns reprs of SPItems currently; need a separate /// method for that @@ -378,7 +378,7 @@ private: mutable std::list _objs; mutable std::vector _reprs; - mutable std::list _items; + mutable std::vector _items; void add_box_perspective(SPBox3D *box); void add_3D_boxes_recursively(SPObject *obj); -- cgit v1.2.3 From 7e4b6f793d31d3245bd8afbf6f10aa255ac3e7ae Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 20:20:09 +0100 Subject: added a set to the Selection (bzr r13922.1.6) --- src/selection.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/selection.h') diff --git a/src/selection.h b/src/selection.h index 2d5e7c34a..e40810ded 100644 --- a/src/selection.h +++ b/src/selection.h @@ -16,14 +16,10 @@ #include #include #include +#include #include #include -#include -#include -#include -#include - #include "gc-managed.h" #include "gc-finalized.h" #include "gc-anchored.h" @@ -254,7 +250,7 @@ public: XML::Node *singleRepr(); /** Returns the list of selected objects. */ - std::list const &list(); + std::vector const &list(); /** Returns the list of selected SPItems. */ std::vector const &itemList(); /** Returns a list of the xml nodes of all selected objects. */ @@ -376,7 +372,9 @@ private: /** Releases an active layer object that is being removed. */ void _releaseContext(SPObject *obj); - mutable std::list _objs; + mutable std::list _objs; //to more efficiently remove arbitrary elements + mutable std::vector _objs_vector; // to be returned by list(); + mutable std::set _objs_set; //to efficiently test if object is selected mutable std::vector _reprs; mutable std::vector _items; -- cgit v1.2.3 From 9dbabead3d9565e1fd666f1ca8a7b6ddd2e167ff Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Mon, 23 Feb 2015 22:41:06 +0100 Subject: Removed eclipse files, added removed pot file (bzr r13922.1.7) --- src/selection.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/selection.h') diff --git a/src/selection.h b/src/selection.h index e40810ded..71be6dd6b 100644 --- a/src/selection.h +++ b/src/selection.h @@ -33,8 +33,6 @@ class SPItem; class SPBox3D; class Persp3D; -typedef std::list SelContainer; - namespace Inkscape { class LayerModel; namespace XML { -- cgit v1.2.3 From 9a7fa4d1899d30ec745107823f307b2a0bf3172f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 03:10:36 +0100 Subject: corrected the casts (hopefully) (bzr r13922.1.10) --- src/selection.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/selection.h') diff --git a/src/selection.h b/src/selection.h index 71be6dd6b..9eada3eed 100644 --- a/src/selection.h +++ b/src/selection.h @@ -40,14 +40,6 @@ class Node; } } -/*template -const GSList* std_list_to_GS_list(const std::list list) const -{ - gpointer l=NULL; - for(auto x:list){ - - } -}*/ namespace Inkscape { -- cgit v1.2.3 From c848ff33a5f3fd7eabfe83604bb42bb5e705c0b4 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 30 Apr 2015 00:29:17 +0200 Subject: unsigned int -> size_t (bzr r14076) --- src/selection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/selection.h') diff --git a/src/selection.h b/src/selection.h index 7ac0f40f3..952dde51d 100644 --- a/src/selection.h +++ b/src/selection.h @@ -259,10 +259,10 @@ public: std::list const box3DList(Persp3D *persp = NULL); /** Returns the number of layers in which there are selected objects. */ - unsigned int numberOfLayers(); + size_t numberOfLayers(); /** Returns the number of parents to which the selected objects belong. */ - unsigned int numberOfParents(); + size_t numberOfParents(); /** Returns the bounding rectangle of the selection. */ Geom::OptRect bounds(SPItem::BBoxType type) const; -- cgit v1.2.3