summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2017-10-01 15:49:26 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2017-10-01 15:49:26 +0000
commite0957537cd0938313803c290a2f3922a3889e6f1 (patch)
tree7f158d00a7655ee91ac094f676f6b3bd624a78b7 /src/display
parentMerge branch 'master' of gitlab.com:inkscape/inkscape (diff)
downloadinkscape-e0957537cd0938313803c290a2f3922a3889e6f1.tar.gz
inkscape-e0957537cd0938313803c290a2f3922a3889e6f1.zip
Removed all GSList occurences in .h files
Diffstat (limited to 'src/display')
-rw-r--r--src/display/canvas-axonomgrid.cpp4
-rw-r--r--src/display/canvas-grid.cpp19
-rw-r--r--src/display/canvas-grid.h2
-rw-r--r--src/display/curve.cpp29
-rw-r--r--src/display/curve.h8
5 files changed, 30 insertions, 32 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index 589cc849d..187597794 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -294,8 +294,8 @@ CanvasAxonomGrid::readRepr()
gridunit = unit_table.getUnit(value); // Display unit identifier in grid menu
}
- for (GSList *l = canvasitems; l != NULL; l = l->next) {
- sp_canvas_item_request_update ( SP_CANVAS_ITEM(l->data) );
+ for (auto i:canvasitems) {
+ sp_canvas_item_request_update(i);
}
return;
}
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 4243d3365..01bfc2fc0 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -149,7 +149,6 @@ CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocume
}
namedview = nv;
- canvasitems = NULL;
}
CanvasGrid::~CanvasGrid()
@@ -157,11 +156,9 @@ CanvasGrid::~CanvasGrid()
if (repr) {
repr->removeListenerByData (this);
}
-
- while (canvasitems) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(canvasitems->data));
- canvasitems = g_slist_remove(canvasitems, canvasitems->data);
- }
+ for (auto i:canvasitems)
+ sp_canvas_item_destroy(i);
+ canvasitems.clear();
}
const char *
@@ -276,8 +273,8 @@ CanvasGrid::createCanvasItem(SPDesktop * desktop)
// but share the same CanvasGrid object; that is what this function is for.
// check if there is already a canvasitem on this desktop linking to this grid
- for (GSList *l = canvasitems; l != NULL; l = l->next) {
- if ( desktop->getGridGroup() == SP_CANVAS_GROUP(SP_CANVAS_ITEM(l->data)->parent) ) {
+ for (auto i:canvasitems) {
+ if ( desktop->getGridGroup() == SP_CANVAS_GROUP(i->parent) ) {
return NULL;
}
}
@@ -287,7 +284,7 @@ CanvasGrid::createCanvasItem(SPDesktop * desktop)
sp_canvas_item_show(SP_CANVAS_ITEM(item));
g_object_ref(item); // since we're keeping a link to this item, we need to bump up the ref count
- canvasitems = g_slist_prepend(canvasitems, item);
+ canvasitems.push_back(item);
return item;
}
@@ -650,8 +647,8 @@ CanvasXYGrid::readRepr()
gridunit = unit_table.getUnit(value); // Display unit identifier in grid menu
}
- for (GSList *l = canvasitems; l != NULL; l = l->next) {
- sp_canvas_item_request_update ( SP_CANVAS_ITEM(l->data) );
+ for (auto i:canvasitems) {
+ sp_canvas_item_request_update(i);
}
return;
diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h
index 91fa43e69..6b36390c8 100644
--- a/src/display/canvas-grid.h
+++ b/src/display/canvas-grid.h
@@ -112,7 +112,7 @@ protected:
virtual Gtk::Widget * newSpecificWidget() = 0;
- GSList * canvasitems; // list of created canvasitems
+ std::vector<SPCanvasItem*> canvasitems; // list of created canvasitems
SPNamedView * namedview;
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 6e662b17b..1115978e9 100644
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
@@ -38,6 +38,15 @@ SPCurve::SPCurve(Geom::PathVector const& pathv)
_pathv(pathv)
{}
+//concat constructor
+SPCurve::SPCurve(std::list<SPCurve *> const& l) : _refcount(1)
+{
+ for (auto c:l) {
+ _pathv.insert( _pathv.end(), c->get_pathvector().begin(), c->get_pathvector().end() );
+ }
+}
+
+
SPCurve *
SPCurve::new_from_rect(Geom::Rect const &rect, bool all_four_sides)
{
@@ -134,32 +143,24 @@ SPCurve::copy() const
* Return new curve that is the concatenation of all curves in list.
*/
SPCurve *
-SPCurve::concat(GSList const *list)
-{
- SPCurve *new_curve = new SPCurve();
-
- for (GSList const *l = list; l != NULL; l = l->next) {
- SPCurve *c = static_cast<SPCurve *>(l->data);
- new_curve->_pathv.insert( new_curve->_pathv.end(), c->get_pathvector().begin(), c->get_pathvector().end() );
- }
-
- return new_curve;
-}
+SPCurve::concat(std::list<SPCurve *> l){
+ return new SPCurve(l);
+};
/**
* Returns a list of new curves corresponding to the subpaths in \a curve.
* 2geomified
*/
-GSList *
+std::list<SPCurve *>
SPCurve::split() const
{
- GSList *l = NULL;
+ std::list<SPCurve *> l;
for (Geom::PathVector::const_iterator path_it = _pathv.begin(); path_it != _pathv.end(); ++path_it) {
Geom::PathVector newpathv;
newpathv.push_back(*path_it);
SPCurve * newcurve = new SPCurve(newpathv);
- l = g_slist_prepend(l, newcurve);
+ l.push_back(newcurve);
}
return l;
diff --git a/src/display/curve.h b/src/display/curve.h
index 8375e1105..87b9984a8 100644
--- a/src/display/curve.h
+++ b/src/display/curve.h
@@ -16,8 +16,7 @@
#include <2geom/pathvector.h>
#include <cstddef>
#include <boost/optional.hpp>
-
-extern "C" { typedef struct _GSList GSList; }
+#include <list>
/**
* Wrapper around a Geom::PathVector object.
@@ -27,6 +26,7 @@ public:
/* Constructors */
explicit SPCurve();
explicit SPCurve(Geom::PathVector const& pathv);
+ explicit SPCurve(std::list<SPCurve *> const& pathv);
static SPCurve * new_from_rect(Geom::Rect const &rect, bool all_four_sides = false);
virtual ~SPCurve();
@@ -78,8 +78,8 @@ public:
SPCurve * append_continuous(SPCurve const *c1, double tolerance);
SPCurve * create_reverse() const;
- GSList * split() const;
- static SPCurve * concat(GSList const *list);
+ std::list<SPCurve *> split() const;
+ static SPCurve * concat(std::list<SPCurve *> l);
protected:
size_t _refcount;