From e0e0fe2303cc3d7dbed72b2d4e64f8890f9d8043 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 15 Dec 2014 15:19:55 +0100 Subject: C++ify SPMarkerView (bzr r13799) --- src/sp-marker.cpp | 212 +++++++++++++++++++++++------------------------------- src/sp-marker.h | 8 ++- 2 files changed, 95 insertions(+), 125 deletions(-) diff --git a/src/sp-marker.cpp b/src/sp-marker.cpp index 1c13a54e6..371a6c35c 100644 --- a/src/sp-marker.cpp +++ b/src/sp-marker.cpp @@ -29,13 +29,19 @@ #include "document-private.h" #include "preferences.h" -struct SPMarkerView { - SPMarkerView *next; - unsigned int key; - std::vector items; -}; +class SPMarkerView { -static void sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destroyitems); +public: + + SPMarkerView() {}; + ~SPMarkerView() { + for (unsigned int i = 0; i < items.size(); ++i) { + delete items[i]; + } + items.clear(); + } + std::vector items; +}; #include "sp-factory.h" @@ -55,8 +61,6 @@ SPMarker::SPMarker() : SPGroup(), SPViewBox() { this->orient_mode = MARKER_ORIENT_ANGLE; this->orient_set = 0; this->orient = 0; - - this->views = NULL; } /** @@ -90,20 +94,6 @@ void SPMarker::build(SPDocument *document, Inkscape::XML::Node *repr) { SPGroup::build(document, repr); } -void SPMarker::release() { - while (this->views) { - // Destroy all DrawingItems etc. - // Parent class ::hide method - //reinterpret_cast(parent_class)->hide(marker, marker->views->key); - // CPPIFY: correct one? - SPGroup::hide(this->views->key); - - - sp_marker_view_remove (this, this->views, TRUE); - } - - SPGroup::release(); -} /** * Removes, releases and unrefs all children of object @@ -117,6 +107,17 @@ void SPMarker::release() { * * \see SPObject::release() */ +void SPMarker::release() { + + std::map::iterator it; + for (it = views_map.begin(); it != views_map.end(); ++it) { + SPGroup::hide( it->first ); + } + views_map.clear(); + + SPGroup::release(); +} + void SPMarker::set(unsigned int key, const gchar* value) { switch (key) { @@ -221,10 +222,11 @@ void SPMarker::update(SPCtx *ctx, guint flags) { SPGroup::update((SPCtx *) &rctx, flags); // As last step set additional transform of drawing group - for (SPMarkerView *v = this->views; v != NULL; v = v->next) { - for (unsigned i = 0 ; i < v->items.size() ; i++) { - if (v->items[i]) { - Inkscape::DrawingGroup *g = dynamic_cast(v->items[i]); + std::map::iterator it; + for (it = views_map.begin(); it != views_map.end(); ++it) { + for (unsigned i = 0 ; i < it->second.items.size() ; ++i) { + if (it->second.items[i]) { + Inkscape::DrawingGroup *g = dynamic_cast(it->second.items[i]); g->setChildTransform(this->c2p); } } @@ -328,31 +330,26 @@ void SPMarker::print(SPPrintContext* /*ctx*/) { * \param key Key to give each SPMarkerView. * \param size Number of DrawingItems to put in the SPMarkerView. */ +// If marker views are always created in order, then this function could be eliminated +// by doing the push_back in sp_marker_show_instance. void sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size) { - SPMarkerView *view; - - for (view = marker->views; view != NULL; view = view->next) { - if (view->key == key) break; - } - if (view && (view->items.size() != size)) { - /* Free old view and allocate new */ - /* Parent class ::hide method */ - marker->hide(key); - - sp_marker_view_remove (marker, view, TRUE); - view = NULL; - } - if (!view) { - view = new SPMarkerView(); - view->items.clear(); - for (unsigned int i = 0; i < size; i++) { - view->items.push_back(NULL); + std::map::iterator it = marker->views_map.find(key); + if (it != marker->views_map.end()) { + if (it->second.items.size() != size ) { + // Need to change size of vector! (We should not really need to do this.) + marker->hide(key); + it->second.items.clear(); + for (unsigned int i = 0; i < size; ++i) { + it->second.items.push_back(NULL); + } + } + } else { + marker->views_map[key] = SPMarkerView(); + for (unsigned int i = 0; i < size; ++i) { + marker->views_map[key].items.push_back(NULL); } - view->next = marker->views; - marker->views = view; - view->key = key; } } @@ -365,51 +362,58 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent, unsigned int key, unsigned int pos, Geom::Affine const &base, float linewidth) { - // do not show marker if linewidth == 0 and markerUnits == strokeWidth + // Do not show marker if linewidth == 0 and markerUnits == strokeWidth // otherwise Cairo will fail to render anything on the tile - // that contains the "degenerate" marker + // that contains the "degenerate" marker. if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH && linewidth == 0) { return NULL; } - for (SPMarkerView *v = marker->views; v != NULL; v = v->next) { - if (v->key == key) { - if (pos >= v->items.size()) { - return NULL; - } - if (!v->items[pos]) { - /* Parent class ::show method */ - v->items[pos] = marker->private_show(parent->drawing(), key, SP_ITEM_REFERENCE_FLAGS); - - if (v->items[pos]) { - /* fixme: Position (Lauris) */ - parent->prependChild(v->items[pos]); - Inkscape::DrawingGroup *g = dynamic_cast(v->items[pos]); - if (g) g->setChildTransform(marker->c2p); - } - } - if (v->items[pos]) { - Geom::Affine m; - if (marker->orient_mode == MARKER_ORIENT_AUTO) { - m = base; - } else if (marker->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) { - m = Geom::Rotate::from_degrees( 180.0 ) * base; - m = base; - } else { - /* fixme: Orient units (Lauris) */ - m = Geom::Rotate::from_degrees(marker->orient.computed); - m *= Geom::Translate(base.translation()); - } - if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - m = Geom::Scale(linewidth) * m; - } - v->items[pos]->setTransform(m); - } - return v->items[pos]; + std::map::iterator it = marker->views_map.find(key); + if (it == marker->views_map.end()) { + // Key not found + return NULL; + } + + SPMarkerView *view = &(it->second); + if (pos >= view->items.size() ) { + // Position index too large, doesn't exist. + return NULL; + } + + // If not already created + if (view->items[pos] == NULL) { + + /* Parent class ::show method */ + view->items[pos] = marker->private_show(parent->drawing(), key, SP_ITEM_REFERENCE_FLAGS); + + if (view->items[pos]) { + /* fixme: Position (Lauris) */ + parent->prependChild(view->items[pos]); + Inkscape::DrawingGroup *g = dynamic_cast(view->items[pos]); + if (g) g->setChildTransform(marker->c2p); } } - return NULL; + if (view->items[pos]) { + Geom::Affine m; + if (marker->orient_mode == MARKER_ORIENT_AUTO) { + m = base; + } else if (marker->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) { + m = Geom::Rotate::from_degrees( 180.0 ) * base; + m = base; + } else { + /* fixme: Orient units (Lauris) */ + m = Geom::Rotate::from_degrees(marker->orient.computed); + m *= Geom::Translate(base.translation()); + } + if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { + m = Geom::Scale(linewidth) * m; + } + view->items[pos]->setTransform(m); + } + + return view->items[pos]; } /** @@ -420,46 +424,10 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent, void sp_marker_hide (SPMarker *marker, unsigned int key) { - SPMarkerView *v; - - v = marker->views; - while (v != NULL) { - SPMarkerView *next; - next = v->next; - if (v->key == key) { - /* Parent class ::hide method */ - marker->hide(key); - - sp_marker_view_remove (marker, v, TRUE); - return; - } - v = next; - } + marker->hide(key); + marker->views_map.erase(key); } -/** - * Removes a given view. Also will destroy sub-items in the view if destroyitems - * is set to a non-zero value. - */ -static void -sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destroyitems) -{ - if (view == marker->views) { - marker->views = view->next; - } else { - SPMarkerView *v; - for (v = marker->views; v->next != view; v = v->next) if (!v->next) return; - v->next = view->next; - } - if (destroyitems) { - for (unsigned int i = 0; i < view->items.size(); i++) { - /* We have to walk through the whole array because there may be hidden items */ - delete view->items[i]; - } - } - view->items.clear(); - delete view; -} const gchar *generate_marker(GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Point center, Geom::Affine move) { diff --git a/src/sp-marker.h b/src/sp-marker.h index 548a6f6f0..54f37487a 100644 --- a/src/sp-marker.h +++ b/src/sp-marker.h @@ -21,7 +21,9 @@ #define SP_MARKER(obj) (dynamic_cast((SPObject*)obj)) #define SP_IS_MARKER(obj) (dynamic_cast((SPObject*)obj) != NULL) -struct SPMarkerView; +class SPMarkerView; + +#include #include <2geom/rect.h> #include <2geom/affine.h> @@ -61,8 +63,8 @@ public: markerOrient orient_mode : 2; SVGAngle orient; - /* Private views */ - SPMarkerView *views; + /* Private views indexed by key */ + std::map views_map; virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); -- cgit v1.2.3 From 4c1b90b91ba818395843ad56331c5343ebe9018a Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Mon, 15 Dec 2014 14:58:43 -0500 Subject: when inserting a node, the endpoints cannot be symmetric nodes. (Bug 1367443) Fixed bugs: - https://launchpad.net/bugs/1367443 (bzr r13800) --- src/ui/tool/path-manipulator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 8b99c33b8..9108dff29 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -972,6 +972,10 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d NodeList &list = NodeList::get(first); NodeList::iterator second = first.next(); if (!second) throw std::invalid_argument("Subdivide after last node in open path"); + if (first->type() == NODE_SYMMETRIC) + first->setType(NODE_SMOOTH, false); + if (second->type() == NODE_SYMMETRIC) + second->setType(NODE_SMOOTH, false); // We need to insert the segment after 'first'. We can't simply use 'second' // as the point of insertion, because when 'first' is the last node of closed path, -- cgit v1.2.3 From 98e1dc69d91ecb2deb2ae66980b2398b30f33c7e Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 16 Dec 2014 12:28:09 +0100 Subject: Read 'context-fill' and 'context-stroke' keywords. (bzr r13801) --- src/desktop-style.cpp | 2 +- src/display/nr-style.cpp | 35 +++++++++++++++++++++++++++-------- src/style-internal.cpp | 38 +++++++++++++++++++++++++++++--------- src/style-internal.h | 20 ++++++++++++++------ 4 files changed, 71 insertions(+), 24 deletions(-) diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 30869d87d..3eb11bea6 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -626,7 +626,7 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill paintImpossible = false; paint_res->colorSet = paint->colorSet; - paint_res->currentcolor = paint->currentcolor; + paint_res->paintOrigin = paint->paintOrigin; if (paint_res->set && paint_effectively_set && paint->isPaintserver()) { // copy the server gchar const *string = NULL; // memory leak results if style->get* called inside sp_style_set_to_uri_string. if (isfill) { diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 96d16bf06..70382ef50 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -95,22 +95,37 @@ NRStyle::~NRStyle() void NRStyle::set(SPStyle *style) { - if ( style->fill.isPaintserver() ) { + // Handle 'context-fill' and 'context-stroke': Work in progress + SPIPaint &style_fill = style->fill; + if( style_fill.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + // std::cout << "NRStyle::set: fill: context-fill" << std::endl; + // style_fill = context_fill; + } else if ( style_fill.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + //std::cout << "NRStyle::set: fill: context-stroke" << std::endl; + // style_fill = context_stroke; + } + + if ( style_fill.isPaintserver() ) { SPPaintServer* server = style->getFillPaintServer(); if ( server && server->isValid() ) { fill.set(server); - } else if ( style->fill.colorSet ) { - fill.set(style->fill.value.color); + } else if ( style_fill.colorSet ) { + fill.set(style_fill.value.color); } else { fill.clear(); } - } else if ( style->fill.isColor() ) { - fill.set(style->fill.value.color); - } else if ( style->fill.isNone() ) { + } else if ( style_fill.isColor() ) { + fill.set(style_fill.value.color); + } else if ( style_fill.isNone() ) { fill.clear(); + } else if ( style_fill.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + // std::cout << "NRStyle::set: fill: context-fill DOUBLE" << std::endl; + } else if ( style_fill.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + // std::cout << "NRStyle::set: fill: context-stroke DOUBLE" << std::endl; } else { g_assert_not_reached(); } + fill.opacity = SP_SCALE24_TO_FLOAT(style->fill_opacity.value); switch (style->fill_rule.computed) { @@ -137,6 +152,10 @@ void NRStyle::set(SPStyle *style) stroke.set(style->stroke.value.color); } else if ( style->stroke.isNone() ) { stroke.clear(); + } else if ( style->stroke.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + // std::cout << "NRStyle::set: stroke: context-fill" << std::endl; + } else if ( style->stroke.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + // std::cout << "NRStyle::set: stroke: context-stroke" << std::endl; } else { g_assert_not_reached(); } @@ -266,7 +285,7 @@ void NRStyle::set(SPStyle *style) } else if ( style_td->fill.isNone() ) { text_decoration_fill.clear(); } else { - g_assert_not_reached(); + //g_assert_not_reached(); } if ( style_td->stroke.isPaintserver() ) { @@ -276,7 +295,7 @@ void NRStyle::set(SPStyle *style) } else if ( style_td->stroke.isNone() ) { text_decoration_stroke.clear(); } else { - g_assert_not_reached(); + //g_assert_not_reached(); } } diff --git a/src/style-internal.cpp b/src/style-internal.cpp index b858e5cb6..915282301 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -984,7 +984,7 @@ SPIPaint::read( gchar const *str ) { if (streq(str, "currentColor")) { set = true; - currentcolor = true; + paintOrigin = SP_CSS_PAINT_ORIGIN_CURRENT_COLOR; if (style) { setColor( style->color.value.color ); } else { @@ -995,6 +995,12 @@ SPIPaint::read( gchar const *str ) { std::cerr << "SPIPaint::read(): value is 'currentColor' but 'color' not available." << std::endl; setColor( 0 ); } + } else if (streq(str, "context-fill")) { + set = true; + paintOrigin = SP_CSS_PAINT_ORIGIN_CONTEXT_FILL; + } else if (streq(str, "context-stroke")) { + set = true; + paintOrigin = SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE; } else if (streq(str, "none")) { set = true; noneSet = true; @@ -1058,14 +1064,28 @@ SPIPaint::write( guint const flags, SPIBase const *const base) const { css << "none"; } - if ( this->currentcolor ) { + if ( this->paintOrigin == SP_CSS_PAINT_ORIGIN_CURRENT_COLOR ) { if ( !css.str().empty() ) { css << " "; } css << "currentColor"; } - if ( this->colorSet && !this->currentcolor ) { + if ( this->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + if ( !css.str().empty() ) { + css << " "; + } + css << "context-fill"; + } + + if ( this->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + if ( !css.str().empty() ) { + css << " "; + } + css << "context-stroke"; + } + + if ( this->colorSet && this->paintOrigin == SP_CSS_PAINT_ORIGIN_NORMAL ) { if ( !css.str().empty() ) { css << " "; } @@ -1074,7 +1094,7 @@ SPIPaint::write( guint const flags, SPIBase const *const base) const { css << color_buf; } - if (this->value.color.icc && !this->currentcolor) { + if ( this->value.color.icc && this->paintOrigin == SP_CSS_PAINT_ORIGIN_NORMAL ) { if ( !css.str().empty() ) { css << " "; } @@ -1107,7 +1127,7 @@ SPIPaint::reset( bool init ) { // std::cout << "SPIPaint::reset(): " << name << " " << init << std::endl; SPIBase::clear(); - currentcolor = false; + paintOrigin = SP_CSS_PAINT_ORIGIN_NORMAL; colorSet = false; noneSet = false; value.color.set( false ); @@ -1147,8 +1167,8 @@ SPIPaint::cascade( const SPIBase* const parent ) { setColor( p->value.color ); } else if( p->isNoneSet() ) { noneSet = true; - } else if( p->currentcolor ) { - currentcolor = true; + } else if( p->paintOrigin == SP_CSS_PAINT_ORIGIN_CURRENT_COLOR ) { + paintOrigin = SP_CSS_PAINT_ORIGIN_CURRENT_COLOR; setColor( style->color.value.color ); } else if( isNone() ) { // @@ -1156,7 +1176,7 @@ SPIPaint::cascade( const SPIBase* const parent ) { g_assert_not_reached(); } } else { - if( currentcolor ) { + if( paintOrigin == SP_CSS_PAINT_ORIGIN_CURRENT_COLOR ) { // Update in case color value changed. setColor( style->color.value.color ); } @@ -1187,7 +1207,7 @@ SPIPaint::operator==(const SPIBase& rhs) { if ( (this->isColor() != r->isColor() ) || (this->isPaintserver() != r->isPaintserver() ) || - (this->currentcolor != r->currentcolor ) ) { + (this->paintOrigin != r->paintOrigin ) ) { return false; } diff --git a/src/style-internal.h b/src/style-internal.h index faae76ac5..a8f0c5096 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -628,6 +628,15 @@ public: #define SP_STYLE_FILL_SERVER(s) ((const_cast (s))->getFillPaintServer()) #define SP_STYLE_STROKE_SERVER(s) ((const_cast (s))->getStrokePaintServer()) +// SVG 2 +enum SPPaintOrigin { + SP_CSS_PAINT_ORIGIN_NORMAL, + SP_CSS_PAINT_ORIGIN_CURRENT_COLOR, + SP_CSS_PAINT_ORIGIN_CONTEXT_FILL, + SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE +}; + + /// Paint type internal to SPStyle. class SPIPaint : public SPIBase { @@ -635,7 +644,7 @@ class SPIPaint : public SPIBase public: SPIPaint() : SPIBase( "anonymous_paint" ), - currentcolor(false), + paintOrigin( SP_CSS_PAINT_ORIGIN_NORMAL ), colorSet(false), noneSet(false) { value.href = NULL; @@ -644,7 +653,6 @@ public: SPIPaint( Glib::ustring const &name ) : SPIBase( name ), - currentcolor(false), colorSet(false), noneSet(false) { value.href = NULL; @@ -663,7 +671,7 @@ public: SPIPaint& operator=(const SPIPaint& rhs) { SPIBase::operator=(rhs); - currentcolor = rhs.currentcolor; + paintOrigin = rhs.paintOrigin; colorSet = rhs.colorSet; noneSet = rhs.noneSet; value.color = rhs.value.color; @@ -677,7 +685,7 @@ public: } bool isSameType( SPIPaint const & other ) const { - return (isPaintserver() == other.isPaintserver()) && (colorSet == other.colorSet) && (currentcolor == other.currentcolor); + return (isPaintserver() == other.isPaintserver()) && (colorSet == other.colorSet) && (paintOrigin == other.paintOrigin); } bool isNoneSet() const { @@ -685,7 +693,7 @@ public: } bool isNone() const { - return !currentcolor && !colorSet && !isPaintserver(); + return (paintOrigin == SP_CSS_PAINT_ORIGIN_NORMAL) && !colorSet && !isPaintserver(); } // TODO refine bool isColor() const { @@ -712,7 +720,7 @@ public: // To do: make private public: - bool currentcolor : 1; + SPPaintOrigin paintOrigin : 2; bool colorSet : 1; bool noneSet : 1; struct { -- cgit v1.2.3 From 0533bf991e946b09053753566f209940f500d368 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 16 Dec 2014 15:05:47 +0100 Subject: Debugging routines to print out XML, SP Object, and Display Item trees. (bzr r13802) --- src/display/drawing-item.cpp | 24 ++++++++++++++++++++++++ src/display/drawing-item.h | 2 ++ src/sp-object.cpp | 16 ++++++++++++++++ src/sp-object.h | 2 ++ src/sp-root.cpp | 9 +++++++++ src/xml/node.h | 2 ++ src/xml/simple-node.cpp | 20 ++++++++++++++++++++ src/xml/simple-node.h | 3 +++ 8 files changed, 78 insertions(+) diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 8ed74b550..8a438e1c2 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -908,6 +908,30 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags) return NULL; } + +// For debugging: Print drawing tree structure. +void +DrawingItem::recursivePrintTree( unsigned level ) +{ + if (level == 0) { + std::cout << "Display Item Tree" << std::endl; + } + std::cout << "DI: "; + for (unsigned i = 0; i < level; ++i) { + std::cout << " "; + } + SPObject *object = static_cast(_user_data); + if (object) { + std::cout << (object->getId()?object->getId():"No object id") << std::endl; + } else { + std::cout << "No associated object" << std::endl; + } + for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { + i->recursivePrintTree( level+1 ); + } +} + + /** * Marks the current visual bounding box of the item for redrawing. * This is called whenever the object changes its visible appearance. diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 9b399e6e3..585f3811f 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -131,6 +131,8 @@ public: void clip(DrawingContext &dc, Geom::IntRect const &area); DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags = 0); + void recursivePrintTree(unsigned level = 0); // For debugging + protected: enum ChildType { CHILD_ORPHAN = 0, // no parent - implies _parent == NULL diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 4e45eb824..3b09d80e8 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -1523,6 +1523,22 @@ char* SPObject::textualContent() const return g_string_free(text, FALSE); } +// For debugging: Print SP tree structure. +void SPObject::recursivePrintTree( unsigned level ) +{ + if (level == 0) { + std::cout << "SP Object Tree" << std::endl; + } + std::cout << "SP: "; + for (unsigned i = 0; i < level; ++i) { + std::cout << " "; + } + std::cout << (getId()?getId():"No object id") << std::endl; + for (SPObject *child = children; child; child = child->next) { + child->recursivePrintTree( level+1 ); + } +} + /* Local Variables: mode:c++ diff --git a/src/sp-object.h b/src/sp-object.h index d08add0bf..669dfc713 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -854,6 +854,8 @@ protected: public: virtual void read_content(); + + void recursivePrintTree(unsigned level = 0); // For debugging }; diff --git a/src/sp-root.cpp b/src/sp-root.cpp index 12570e03e..85582e209 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -375,6 +375,15 @@ Inkscape::DrawingItem *SPRoot::show(Inkscape::Drawing &drawing, unsigned int key g->setChildTransform(this->c2p); } + // Uncomment to print out XML tree + // getRepr()->recursivePrintTree(0); + + // Uncomment to print out SP Object tree + // recursivePrintTree(0); + + // Uncomment to print out Display Item tree + // ai->recursivePrintTree(0); + return ai; } diff --git a/src/xml/node.h b/src/xml/node.h index 8bb70acc0..29cfdab46 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -469,6 +469,8 @@ public: * @deprecated Use synthesizeEvents(NodeObserver &) instead */ virtual void synthesizeEvents(NodeEventVector const *vector, void *data)=0; + + virtual void recursivePrintTree(unsigned level)=0; /*@}*/ diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index 4965f81c8..3cbedc80b 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -606,6 +606,26 @@ void SimpleNode::synthesizeEvents(NodeObserver &observer) { synthesizeEvents(&OBSERVER_EVENT_VECTOR, &observer); } +void SimpleNode::recursivePrintTree(unsigned level) { + + if (level == 0) { + std::cout << "XML Node Tree" << std::endl; + } + std::cout << "XML: "; + for (unsigned i = 0; i < level; ++i) { + std::cout << " "; + } + char const *id=attribute("id"); + if (id) { + std::cout << id << std::endl; + } else { + std::cout << name() << std::endl; + } + for (SimpleNode *child = _first_child; child != NULL; child = child->_next) { + child->recursivePrintTree( level+1 ); + } +} + Node *SimpleNode::root() { Node *parent=this; while (parent->parent()) { diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h index 1fcb9193b..d09392249 100644 --- a/src/xml/simple-node.h +++ b/src/xml/simple-node.h @@ -19,6 +19,7 @@ #define SEEN_INKSCAPE_XML_SIMPLE_NODE_H #include +#include #include "xml/node.h" #include "xml/attribute-record.h" @@ -120,6 +121,8 @@ public: _subtree_observers.remove(observer); } + void recursivePrintTree(unsigned level = 0); + protected: SimpleNode(int code, Document *document); SimpleNode(SimpleNode const &repr, Document *document); -- cgit v1.2.3 From 61f4ad6f7569805e50488d4af92756b310c51246 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 16 Dec 2014 17:45:03 +0100 Subject: Code rearrangement to make it clearer what is happening. (bzr r13803) --- src/display/drawing-group.cpp | 9 ----- src/display/drawing-group.h | 4 -- src/display/drawing-image.cpp | 11 ------ src/display/drawing-image.h | 2 - src/display/drawing-item.cpp | 91 +++++++++++++++++++++++-------------------- src/display/drawing-item.h | 3 +- src/display/drawing-shape.cpp | 5 +-- src/display/drawing-shape.h | 3 +- src/display/drawing-text.cpp | 7 ++++ src/display/drawing-text.h | 1 + 10 files changed, 61 insertions(+), 75 deletions(-) diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp index bce89d70e..1a9cbfdcc 100644 --- a/src/display/drawing-group.cpp +++ b/src/display/drawing-group.cpp @@ -21,14 +21,11 @@ namespace Inkscape { DrawingGroup::DrawingGroup(Drawing &drawing) : DrawingItem(drawing) - , _style(NULL) , _child_transform(NULL) {} DrawingGroup::~DrawingGroup() { - if (_style) - sp_style_unref(_style); delete _child_transform; // delete NULL; is safe } @@ -42,12 +39,6 @@ DrawingGroup::setPickChildren(bool p) _pick_children = p; } -void -DrawingGroup::setStyle(SPStyle *style) -{ - _setStyleCommon(_style, style); -} - /** * Set additional transform for the group. * This is applied after the normal transform and mainly useful for diff --git a/src/display/drawing-group.h b/src/display/drawing-group.h index ab1f9895d..0c985b43f 100644 --- a/src/display/drawing-group.h +++ b/src/display/drawing-group.h @@ -14,8 +14,6 @@ #include "display/drawing-item.h" -class SPStyle; - namespace Inkscape { class DrawingGroup @@ -28,7 +26,6 @@ public: bool pickChildren() { return _pick_children; } void setPickChildren(bool p); - void setStyle(SPStyle *style); void setChildTransform(Geom::Affine const &new_trans); protected: @@ -40,7 +37,6 @@ protected: virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags); virtual bool _canClip(); - SPStyle *_style; Geom::Affine *_child_transform; }; diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp index e56f3e58b..8fe337959 100644 --- a/src/display/drawing-image.cpp +++ b/src/display/drawing-image.cpp @@ -24,15 +24,10 @@ namespace Inkscape { DrawingImage::DrawingImage(Drawing &drawing) : DrawingItem(drawing) , _pixbuf(NULL) - , _style(NULL) {} DrawingImage::~DrawingImage() { - if (_style) { - sp_style_unref(_style); - } - // _pixbuf is owned by SPImage - do not delete it } @@ -44,12 +39,6 @@ DrawingImage::setPixbuf(Inkscape::Pixbuf *pb) _markForUpdate(STATE_ALL, false); } -void -DrawingImage::setStyle(SPStyle *style) -{ - _setStyleCommon(_style, style); -} - void DrawingImage::setScale(double sx, double sy) { diff --git a/src/display/drawing-image.h b/src/display/drawing-image.h index 64e4517b0..7511768c9 100644 --- a/src/display/drawing-image.h +++ b/src/display/drawing-image.h @@ -29,7 +29,6 @@ public: ~DrawingImage(); void setPixbuf(Inkscape::Pixbuf *pb); - void setStyle(SPStyle *style); void setScale(double sx, double sy); void setOrigin(Geom::Point const &o); void setClipbox(Geom::Rect const &box); @@ -43,7 +42,6 @@ protected: virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags); Inkscape::Pixbuf *_pixbuf; - SPStyle *_style; // TODO: the following three should probably be merged into a new Geom::Viewbox object Geom::Rect _clipbox; ///< for preserveAspectRatio diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 8a438e1c2..407adc255 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -109,6 +109,7 @@ DrawingItem::DrawingItem(Drawing &drawing) : _drawing(drawing) , _parent(NULL) , _key(0) + , _style(NULL) , _opacity(1.0) , _transform(NULL) , _clip(NULL) @@ -188,6 +189,8 @@ DrawingItem::~DrawingItem() delete _clip; delete _mask; delete _filter; + if(_style) + sp_style_unref(_style); } DrawingItem * @@ -351,6 +354,52 @@ DrawingItem::setCached(bool cached, bool persistent) } } +/** + * Process information related to the new style. + * + * Note: _style is not used by DrawingGlyphs which uses its parent style. + */ +void +DrawingItem::setStyle(SPStyle *style) +{ + // std::cout << "DrawingItem::setStyle: "; + // SPObject *item = static_cast(_user_data); + // if( item ) { + // std::cout << (item->getId()?item->getId():"null") << std::endl; + // } else { + // std::cout << "No item" << std::endl; + // } + + if (style) sp_style_ref(style); + if (_style) sp_style_unref(_style); + _style = style; + + if (style && style->filter.set && style->getFilter()) { + if (!_filter) { + int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); + _filter = new Inkscape::Filters::Filter(primitives); + } + sp_filter_build_renderer(SP_FILTER(style->getFilter()), _filter); + } else { + // no filter set for this group + delete _filter; + _filter = NULL; + } + + if (style && style->enable_background.set) { + if (style->enable_background.value == SP_CSS_BACKGROUND_NEW && !_background_new) { + _background_new = true; + _markForUpdate(STATE_BACKGROUND, true); + } else if (style->enable_background.value == SP_CSS_BACKGROUND_ACCUMULATE && _background_new) { + _background_new = false; + _markForUpdate(STATE_BACKGROUND, true); + } + } + + _markForUpdate(STATE_ALL, false); +} + + void DrawingItem::setClip(DrawingItem *item) { @@ -1021,48 +1070,6 @@ DrawingItem::_markForUpdate(unsigned flags, bool propagate) } } -/** - * Process information related to the new style. - * - * This function is something of a hack to avoid creating an extra class in the hierarchy - * which would differ from DrawingItem only by having a _style member. - * This is mainly to the benefit of DrawingGlyphs, which use the style of their parent. - * This should probably be refactored some day, possibly by creating the relevant class - * or creating a more complex data model in DrawingText and removing DrawingGlyphs, - * which would cause every item to have a style. - */ -void -DrawingItem::_setStyleCommon(SPStyle *&_style, SPStyle *style) -{ - if (style) sp_style_ref(style); - if (_style) sp_style_unref(_style); - _style = style; - - if (style && style->filter.set && style->getFilter()) { - if (!_filter) { - int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); - _filter = new Inkscape::Filters::Filter(primitives); - } - sp_filter_build_renderer(SP_FILTER(style->getFilter()), _filter); - } else { - // no filter set for this group - delete _filter; - _filter = NULL; - } - - if (style && style->enable_background.set) { - if (style->enable_background.value == SP_CSS_BACKGROUND_NEW && !_background_new) { - _background_new = true; - _markForUpdate(STATE_BACKGROUND, true); - } else if (style->enable_background.value == SP_CSS_BACKGROUND_ACCUMULATE && _background_new) { - _background_new = false; - _markForUpdate(STATE_BACKGROUND, true); - } - } - - _markForUpdate(STATE_ALL, false); -} - /** * Compute the caching score. * diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 585f3811f..89331c13d 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -108,6 +108,7 @@ public: bool cached() const { return _cached; } void setCached(bool c, bool persistent = false); + virtual void setStyle(SPStyle *style); void setOpacity(float opacity); void setAntialiasing(bool a); void setIsolation(unsigned isolation); // CSS Compositing and Blending @@ -151,7 +152,6 @@ protected: void _markForUpdate(unsigned state, bool propagate); void _markForRendering(); void _invalidateFilterBackground(Geom::IntRect const &area); - void _setStyleCommon(SPStyle *&_style, SPStyle *style); double _cacheScore(); Geom::OptIntRect _cacheRect(); virtual unsigned _updateItem(Geom::IntRect const &/*area*/, UpdateContext const &/*ctx*/, @@ -178,6 +178,7 @@ protected: unsigned _key; ///< Some SPItems can have more than one DrawingItem; /// this value is a hack used to distinguish between them + SPStyle *_style; // Not used by DrawingGlyphs float _opacity; Geom::Affine *_transform; ///< Incremental transform from parent to this item's coords diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index 66160638f..5bdc7a323 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -34,15 +34,12 @@ namespace Inkscape { DrawingShape::DrawingShape(Drawing &drawing) : DrawingItem(drawing) , _curve(NULL) - , _style(NULL) , _last_pick(NULL) , _repick_after(0) {} DrawingShape::~DrawingShape() { - if (_style) - sp_style_unref(_style); if (_curve) _curve->unref(); } @@ -67,8 +64,8 @@ DrawingShape::setPath(SPCurve *curve) void DrawingShape::setStyle(SPStyle *style) { - _setStyleCommon(_style, style); _nrstyle.set(style); + DrawingItem::setStyle(style); } unsigned diff --git a/src/display/drawing-shape.h b/src/display/drawing-shape.h index 9d93a642f..1c921b21f 100644 --- a/src/display/drawing-shape.h +++ b/src/display/drawing-shape.h @@ -28,7 +28,7 @@ public: ~DrawingShape(); void setPath(SPCurve *curve); - void setStyle(SPStyle *style); + virtual void setStyle(SPStyle *style); protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, @@ -45,7 +45,6 @@ protected: DrawingItem *stop_at); SPCurve *_curve; - SPStyle *_style; NRStyle _nrstyle; DrawingItem *_last_pick; diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index afe661b2e..58305477b 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -55,6 +55,13 @@ DrawingGlyphs::setGlyph(font_instance *font, int glyph, Geom::Affine const &tran _markForUpdate(STATE_ALL, false); } +void +DrawingGlyphs::setStyle(SPStyle *style) +{ + std::cerr << "DrawingGlyphs: Use parent style" << std::endl; +} + + unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext const &ctx, unsigned /*flags*/, unsigned /*reset*/) { DrawingText *ggroup = dynamic_cast(_parent); diff --git a/src/display/drawing-text.h b/src/display/drawing-text.h index 4453a3db4..37c1e81c7 100644 --- a/src/display/drawing-text.h +++ b/src/display/drawing-text.h @@ -28,6 +28,7 @@ public: ~DrawingGlyphs(); void setGlyph(font_instance *font, int glyph, Geom::Affine const &trans); + void setStyle(SPStyle *style); // Not to be used, prints error message. protected: unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, -- cgit v1.2.3 From 8422f227bed1f6d38a05c8b86020afc833c06bc9 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Wed, 17 Dec 2014 22:09:37 +0100 Subject: Dutch translation update (bzr r13804) --- po/nl.po | 78 ++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/po/nl.po b/po/nl.po index 14940b34f..b59ffa2a9 100644 --- a/po/nl.po +++ b/po/nl.po @@ -1087,7 +1087,7 @@ msgstr "Tijgervachtpatroon met vouwen en verhoging langs de randen" #: ../share/filters/filters.svg.h:410 msgid "Black Light" -msgstr "" +msgstr "Zwart licht" #: ../share/filters/filters.svg.h:411 ../share/filters/filters.svg.h:575 #: ../share/filters/filters.svg.h:587 ../share/filters/filters.svg.h:627 @@ -1173,7 +1173,7 @@ msgstr "Gekleurd gipsreliëf" #: ../share/filters/filters.svg.h:422 msgid "Velvet Bumps" -msgstr "Fluwelen verhogin" +msgstr "Fluwelen verhoging" #: ../share/filters/filters.svg.h:424 msgid "Gives Smooth Bumps velvet like" @@ -1737,7 +1737,7 @@ msgstr "Lokaal een kleine schermachtige ruis toevoegen" #: ../share/filters/filters.svg.h:674 msgid "Poster Color Fun" -msgstr "Poster met kleur, gun" +msgstr "Poster met kleur, fun" #: ../share/filters/filters.svg.h:678 msgid "Poster Rough" @@ -1967,7 +1967,7 @@ msgstr "Weggesneden reliëf" #: ../share/filters/filters.svg.h:802 msgid "Chromolitho Alternate" -msgstr "Kleurenlithografiealternatief" +msgstr "Kleurenlithografie B" #: ../share/filters/filters.svg.h:804 msgid "Old chromolithographic effect" @@ -2003,15 +2003,15 @@ msgstr "Kanalen kleuren" #: ../share/filters/filters.svg.h:820 msgid "Colorize separately the three color channels" -msgstr "" +msgstr "De drie kleurkanalen afzonderlijk verkleuren" #: ../share/filters/filters.svg.h:822 msgid "Posterized Light Eraser" -msgstr "" +msgstr "Verzadigde lichtgom" #: ../share/filters/filters.svg.h:824 msgid "Create a semi transparent posterized image" -msgstr "" +msgstr "Een semi transparante verzadigde afbeelding maken" #: ../share/filters/filters.svg.h:826 msgid "Trichrome" @@ -2030,32 +2030,28 @@ msgid "Render Cyan, Magenta and Yellow channels with a colorizable background" msgstr "Cyaan-, magenta en geelkanaal renderen met een gekleurde achtergrond" #: ../share/filters/filters.svg.h:834 -#, fuzzy msgid "Contouring table" -msgstr "Contactdriehoek" +msgstr "Contourtabel" #: ../share/filters/filters.svg.h:836 msgid "Blurred multiple contours for objects" -msgstr "" +msgstr "Meervoudige vage contouren voor objecten" #: ../share/filters/filters.svg.h:838 -#, fuzzy msgid "Posterized Blur" -msgstr "Posteriseren, basis" +msgstr "Verzadigde vervaging" #: ../share/filters/filters.svg.h:840 msgid "Converts blurred contour to posterized steps" -msgstr "" +msgstr "Vage contouren omzetten in verzadigde banden" #: ../share/filters/filters.svg.h:842 -#, fuzzy msgid "Contouring discrete" -msgstr "Aansturend paneelitem" +msgstr "Discrete contouren" #: ../share/filters/filters.svg.h:844 -#, fuzzy msgid "Sharp multiple contour for objects" -msgstr "Middelpunten van objecten kleven" +msgstr "Meervoudige scherpe contouren voor objecten" #. Palette: ./inkscape.gpl #: ../share/palettes/palettes.h:2 @@ -4983,7 +4979,7 @@ msgstr "" #: ../src/extension/extension.cpp:281 msgid "the extension is designed for Windows only." -msgstr "" +msgstr "de uitbreiding is alleen voor Windows ontworpen." #: ../src/extension/extension.cpp:286 msgid "an ID was not defined for it." @@ -6839,7 +6835,7 @@ msgstr "Tint inverteren" #: ../src/extension/internal/filter/color.h:915 msgid "Invert lightness" -msgstr "Helderheid inverteren" +msgstr "Lichtheid inverteren" #: ../src/extension/internal/filter/color.h:916 msgid "Invert transparency" @@ -6871,11 +6867,11 @@ msgstr "Lichte delen en schaduwen afzonderlijk aanpassen" #: ../src/extension/internal/filter/color.h:1111 msgid "Lightness-Contrast" -msgstr "Helderheid-contrast" +msgstr "Lichtheid-contrast" #: ../src/extension/internal/filter/color.h:1122 msgid "Modify lightness and contrast separately" -msgstr "Helderheid en contrast afzonderlijk aanpassen" +msgstr "Lichtheid en contrast afzonderlijk aanpassen" #: ../src/extension/internal/filter/color.h:1190 msgid "Nudge RGB" @@ -7530,7 +7526,7 @@ msgstr "Mengen ruis:" #: ../src/extension/internal/filter/paint.h:708 msgid "Grain lightness" -msgstr "Helderheid korrel" +msgstr "Lichtheid korrel" #: ../src/extension/internal/filter/paint.h:716 msgid "Points color" @@ -8012,7 +8008,7 @@ msgstr "" #: ../src/extension/internal/pdfinput/pdf-input.cpp:128 msgid "import via Poppler" -msgstr "" +msgstr "via Poppler importeren" #: ../src/extension/internal/pdfinput/pdf-input.cpp:138 msgid "rough" @@ -8453,15 +8449,15 @@ msgstr "Lijnkleur" #. New in Compositing and Blending Level 1 #: ../src/filter-enums.cpp:58 msgid "Overlay" -msgstr "" +msgstr "Bedekken" #: ../src/filter-enums.cpp:59 msgid "Color Dodge" -msgstr "" +msgstr "Kleur ontwijken" #: ../src/filter-enums.cpp:60 msgid "Color Burn" -msgstr "" +msgstr "Kleur branden" #: ../src/filter-enums.cpp:61 msgid "Hard Light" @@ -8490,7 +8486,7 @@ msgstr "Tint" #: ../src/filter-enums.cpp:68 msgid "Luminosity" -msgstr "" +msgstr "Helderheid" #: ../src/filter-enums.cpp:78 msgid "Matrix" @@ -8530,19 +8526,19 @@ msgstr "Doel" #: ../src/filter-enums.cpp:98 msgid "Destination Over" -msgstr "" +msgstr "Doel over" #: ../src/filter-enums.cpp:99 msgid "Destination In" -msgstr "" +msgstr "Doel in" #: ../src/filter-enums.cpp:100 msgid "Destination Out" -msgstr "" +msgstr "Doel uit" #: ../src/filter-enums.cpp:101 msgid "Destination Atop" -msgstr "Do" +msgstr "Doel boven" #: ../src/filter-enums.cpp:102 msgid "Lighter" @@ -14198,19 +14194,19 @@ msgstr "De verzadiging binnen dit percentage willekeurig aanpassen" #: ../src/ui/dialog/clonetiler.cpp:735 msgid "L:" -msgstr "Helderheid:" +msgstr "Lichtheid:" #: ../src/ui/dialog/clonetiler.cpp:741 msgid "Change the color lightness by this percentage for each row" -msgstr "De helderheid elke volgende rij met dit percentage aanpassen" +msgstr "De lichtheid elke volgende rij met dit percentage aanpassen" #: ../src/ui/dialog/clonetiler.cpp:747 msgid "Change the color lightness by this percentage for each column" -msgstr "De helderheid elke volgende kolom met dit percentage aanpassen" +msgstr "De lichtheid elke volgende kolom met dit percentage aanpassen" #: ../src/ui/dialog/clonetiler.cpp:753 msgid "Randomize the color lightness by this percentage" -msgstr "De helderheid binnen dit percentage willekeurig aanpassen" +msgstr "De lichtheid binnen dit percentage willekeurig aanpassen" #: ../src/ui/dialog/clonetiler.cpp:767 msgid "Alternate the sign of color changes for each row" @@ -14297,7 +14293,7 @@ msgstr "L" #: ../src/ui/dialog/clonetiler.cpp:889 msgid "Pick the lightness of the color" -msgstr "De helderheid van de kleur kiezen" +msgstr "De lichtheid van de kleur kiezen" #: ../src/ui/dialog/clonetiler.cpp:899 msgid "2. Tweak the picked value:" @@ -31570,6 +31566,14 @@ msgid "" " * Random Hue/Saturation/Lightness: randomize the parameter's value.\n" " " msgstr "" +"Past tint, verzadiging en lichtheid in de TVL-vertegenwoordiging van de kleur van de geselecteerde objecten.\n" +"Opties:\n" +" * Tint: draaien met ... graden (telt door).\n" +" * Verzadiging: % toevoegen/aftrekken (min=-100, max=100).\n" +" * Lichtheid: % toevoegen/aftrekken (min=-100, max=100).\n" +" * Random tint/verzadiging/lichtheid: de parameterwaarde randomiseren.\n" +" " + #: ../share/extensions/color_blackandwhite.inx.h:1 msgid "Black and White" @@ -31577,7 +31581,7 @@ msgstr "Zwart en wit" #: ../share/extensions/color_blackandwhite.inx.h:2 msgid "Threshold Color (1-255):" -msgstr "" +msgstr "Grenswaarde kleur (1-255):" #: ../share/extensions/color_brighter.inx.h:1 msgid "Brighter" -- cgit v1.2.3 From 6e8e84429fb5d77b27d9bfee81da55cff2149afc Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Thu, 18 Dec 2014 22:23:48 +0100 Subject: Dutch translation update (bzr r13805) --- po/nl.po | 172 ++++++++++++++++++++++++++------------------------------------- 1 file changed, 72 insertions(+), 100 deletions(-) diff --git a/po/nl.po b/po/nl.po index b59ffa2a9..18cf6978d 100644 --- a/po/nl.po +++ b/po/nl.po @@ -1177,7 +1177,7 @@ msgstr "Fluwelen verhoging" #: ../share/filters/filters.svg.h:424 msgid "Gives Smooth Bumps velvet like" -msgstr "Geeft zachte verhogingen" +msgstr "Geeft afgeronde verhogingen" #: ../share/filters/filters.svg.h:426 msgid "Comics Cream" @@ -1227,7 +1227,7 @@ msgstr "Gedeformeerde regenboog" #: ../share/filters/filters.svg.h:440 msgid "Smooth rainbow colors warped along the edges and colorizable" -msgstr "Licht gedeformeerde regenboogkleuren langs randen, kleur aanpasbaar" +msgstr "Afgevlakte regenboogkleuren langs randen met aanpasbare kleur" #: ../share/filters/filters.svg.h:442 msgid "Rough and Dilate" @@ -3338,9 +3338,8 @@ msgid "Checkerboard white" msgstr "Dambord wit" #: ../share/patterns/patterns.svg.h:1 -#, fuzzy msgid "Packed circles" -msgstr "Aangeschreven driehoeken" +msgstr "Gepakte cirkels" #: ../share/patterns/patterns.svg.h:1 msgid "Polka dots, small" @@ -3371,9 +3370,8 @@ msgid "Wavy" msgstr "Golvend" #: ../share/patterns/patterns.svg.h:1 -#, fuzzy msgid "Wavy white" -msgstr "Wit" +msgstr "Golvend wit" #: ../share/patterns/patterns.svg.h:1 msgid "Camouflage" @@ -3384,19 +3382,16 @@ msgid "Ermine" msgstr "Hermelijn" #: ../share/patterns/patterns.svg.h:1 -#, fuzzy msgid "Sand (bitmap)" -msgstr "Bitmap overtrekken" +msgstr "Zand (bitmap)" #: ../share/patterns/patterns.svg.h:1 -#, fuzzy msgid "Cloth (bitmap)" -msgstr "Bitmap maken" +msgstr "Textiel (bitmap)" #: ../share/patterns/patterns.svg.h:1 -#, fuzzy msgid "Old paint (bitmap)" -msgstr "Olieverfschilderij" +msgstr "Oud schilderij (bitmap)" #. Symbols: ./AigaSymbols.svg #: ../share/symbols/symbols.h:2 @@ -5346,9 +5341,8 @@ msgstr "Rechts (px):" # hier wel een punt in vertaling in verband met overeenkomst met de andere tips in de toolbar voor andere uitbreidingen #: ../src/extension/internal/bitmap/crop.cpp:77 -#, fuzzy msgid "Crop selected bitmap(s)" -msgstr "Geselecteerde bitmap(s) afsnijden." +msgstr "Geselecteerde bitmap(s) afsnijden" #: ../src/extension/internal/bitmap/cycleColormap.cpp:37 msgid "Cycle Colormap" @@ -5557,9 +5551,8 @@ msgid "Opacity:" msgstr "Ondoorzichtigheid:" #: ../src/extension/internal/bitmap/opacity.cpp:46 -#, fuzzy msgid "Modify opacity channel(s) of selected bitmap(s)" -msgstr "De ondoorzichtigheidskanalen van geselecteerde bitmap(s) aanpassen." +msgstr "De ondoorzichtigheidskanalen van geselecteerde bitmap(s) aanpassen" #: ../src/extension/internal/bitmap/raise.cpp:40 msgid "Raise" @@ -7204,7 +7197,7 @@ msgstr "Inhoud vervagen" #: ../src/extension/internal/filter/morphology.h:79 msgid "Smooth edges and angles of shapes" -msgstr "Randen en hoeken van vormen vervagen" +msgstr "Randen en hoeken van vormen afvlakken" #: ../src/extension/internal/filter/morphology.h:166 msgid "Outline" @@ -11416,9 +11409,8 @@ msgid "Paste path" msgstr "Pad plakken" #: ../src/live_effects/parameter/path.cpp:200 -#, fuzzy msgid "Link to path on clipboard" -msgstr "Er staat niets op het klembord." +msgstr "Aan pad op het klembord linken" #: ../src/live_effects/parameter/path.cpp:443 msgid "Paste path parameter" @@ -12251,10 +12243,9 @@ msgid "Select some objects to group." msgstr "Selecteer twee objecten of meer objecten om te groeperen." #: ../src/selection-chemistry.cpp:782 -#, fuzzy msgctxt "Verb" msgid "Group" -msgstr "Groep" +msgstr "Groeperen" #: ../src/selection-chemistry.cpp:805 msgid "Select a group to ungroup." @@ -12725,11 +12716,11 @@ msgid "Use Shift+D to look up frame" msgstr "Gebruik Shift+D om het kaderobject te vinden" #: ../src/selection-describer.cpp:215 -#, fuzzy, c-format +#, c-format msgid "%i objects selected of type %s" msgid_plural "%i objects selected of types %s" -msgstr[0] "%i object geselecteerd" -msgstr[1] "%i objecten geselecteerd" +msgstr[0] "%i objecten geselecteerd van het type %s" +msgstr[1] "%i objecten geselecteerd van de typen %s" #: ../src/selection-describer.cpp:225 #, c-format @@ -14595,9 +14586,8 @@ msgid "Use antialiasing" msgstr "Anti-aliasing gebruiken" #: ../src/ui/dialog/document-properties.cpp:111 -#, fuzzy msgid "If unset, no antialiasing will be done on the drawing" -msgstr "Indien aangevinkt, wordt de rand altijd boven de tekening getoond" +msgstr "Indien aangevinkt, wordt geen anti-aliasing op de tekening toegepast" #: ../src/ui/dialog/document-properties.cpp:112 msgid "Show page _border" @@ -17934,9 +17924,8 @@ msgstr "" #. LPETool #. disabled, because the LPETool is not finished yet. #: ../src/ui/dialog/inkscape-preferences.cpp:508 -#, fuzzy msgid "LPE Tool" -msgstr "Padeffecten" +msgstr "Padeffectengereedschap" #: ../src/ui/dialog/inkscape-preferences.cpp:515 msgid "Interface" @@ -18195,9 +18184,8 @@ msgid "Swedish (sv)" msgstr "Zweeds (sv)" #: ../src/ui/dialog/inkscape-preferences.cpp:529 -#, fuzzy msgid "Telugu (te)" -msgstr "Telugu (te_IN)" +msgstr "Telugu (te)" #: ../src/ui/dialog/inkscape-preferences.cpp:529 msgid "Thai (th)" @@ -21006,7 +20994,7 @@ msgstr "Trapvormige artefacten behouden" #: ../src/ui/dialog/pixelartdialog.cpp:281 msgid "_Smooth curves" -msgstr "_Gladde paden" +msgstr "_Afgevlakte paden" #: ../src/ui/dialog/pixelartdialog.cpp:282 msgid "The Kopf-Lischinski algorithm" @@ -21054,69 +21042,58 @@ msgid "Anchor point:" msgstr "Ankerpunt:" #: ../src/ui/dialog/polar-arrange-tab.cpp:52 -#, fuzzy msgctxt "Polar arrange tab" msgid "Object's bounding box:" -msgstr "Visueel omvattend vak" +msgstr "Omvattend vak:" #: ../src/ui/dialog/polar-arrange-tab.cpp:59 -#, fuzzy msgctxt "Polar arrange tab" msgid "Object's rotational center" msgstr "Rotatiemiddelpunt" #: ../src/ui/dialog/polar-arrange-tab.cpp:64 -#, fuzzy msgctxt "Polar arrange tab" msgid "Arrange on:" -msgstr "Ordenen" +msgstr "Ordenen op:" #: ../src/ui/dialog/polar-arrange-tab.cpp:68 -#, fuzzy msgctxt "Polar arrange tab" msgid "First selected circle/ellipse/arc" -msgstr "Cirkels, ellipsen of bogen maken" +msgstr "Eerst geselecteerde cirkel/ellips/boog" #: ../src/ui/dialog/polar-arrange-tab.cpp:73 -#, fuzzy msgctxt "Polar arrange tab" msgid "Last selected circle/ellipse/arc" -msgstr "Laatst geselecteerde kleur" +msgstr "Laatst geselecteerde cirkel/ellips/boog" #: ../src/ui/dialog/polar-arrange-tab.cpp:78 -#, fuzzy msgctxt "Polar arrange tab" msgid "Parameterized:" -msgstr "Gcode parametriseren" +msgstr "Geparametriseerd:" #: ../src/ui/dialog/polar-arrange-tab.cpp:83 msgid "Center X/Y:" -msgstr "" +msgstr "X/Y middelpunt:" #: ../src/ui/dialog/polar-arrange-tab.cpp:105 -#, fuzzy msgid "Radius X/Y:" -msgstr "Straal:" +msgstr "X/Y straal:" #: ../src/ui/dialog/polar-arrange-tab.cpp:127 -#, fuzzy msgid "Angle X/Y:" -msgstr "X-hoek:" +msgstr "X/Y-hoek:" #: ../src/ui/dialog/polar-arrange-tab.cpp:150 -#, fuzzy msgid "Rotate objects" -msgstr "Knooppunten roteren" +msgstr "Objecten roteren" #: ../src/ui/dialog/polar-arrange-tab.cpp:338 -#, fuzzy msgid "Couldn't find an ellipse in selection" -msgstr "Geen lettertypen gevonden in dit document/selectie." +msgstr "Kon geen ellips in selectie vinden" #: ../src/ui/dialog/polar-arrange-tab.cpp:403 -#, fuzzy msgid "Arrange on ellipse" -msgstr "Ellips maken" +msgstr "Ordenen op ellips" #: ../src/ui/dialog/print.cpp:111 msgid "Could not open temporary PNG for bitmap printing" @@ -21417,25 +21394,23 @@ msgstr "Huidig document" #: ../src/ui/dialog/symbols.cpp:216 msgid "Add Symbol from the current document." -msgstr "Symbool aan huidige document toevoegen." +msgstr "Symbool aan huidig document toevoegen." #: ../src/ui/dialog/symbols.cpp:225 msgid "Remove Symbol from the current document." msgstr "Symbool uit huidig document verwijderen." #: ../src/ui/dialog/symbols.cpp:239 -#, fuzzy msgid "Display more icons in row." -msgstr "Meetinfo weergeven" +msgstr "Meer iconen in een rij weergeven." #: ../src/ui/dialog/symbols.cpp:248 -#, fuzzy msgid "Display fewer icons in row." -msgstr "Meetinfo weergeven" +msgstr "Minder iconen in een rij weergeven." #: ../src/ui/dialog/symbols.cpp:258 msgid "Toggle 'fit' symbols in icon space." -msgstr "" +msgstr "Symbolen laten 'passen' in hun ruimte." #: ../src/ui/dialog/symbols.cpp:270 msgid "Make symbols smaller by zooming out." @@ -21739,11 +21714,11 @@ msgstr "G_rootte:" #: ../src/ui/dialog/tracedialog.cpp:708 msgid "Smooth _corners" -msgstr "_Hoeken afronden" +msgstr "_Hoeken afvlakken" #: ../src/ui/dialog/tracedialog.cpp:710 msgid "Smooth out sharp corners of the trace" -msgstr "Scherpe hoeken uit de overtrokken afbeelding afronden" +msgstr "Scherpe hoeken uit de overtrokken afbeelding afvlakken" #: ../src/ui/dialog/tracedialog.cpp:719 msgid "Increase this to smooth corners more" @@ -22600,7 +22575,7 @@ msgstr "Handvat hoekig knooppunt" #: ../src/ui/tool/node.cpp:272 msgid "Smooth node handle" -msgstr "Handvat glad knooppunt" +msgstr "Handvat afgevlakt knooppunt" #: ../src/ui/tool/node.cpp:273 msgid "Symmetric node handle" @@ -22608,7 +22583,7 @@ msgstr "Handvat symmetrisch knooppunt" #: ../src/ui/tool/node.cpp:274 msgid "Auto-smooth node handle" -msgstr "Handvat automatisch glad knooppunt" +msgstr "Knooppunthandvat automatisch afvlakken" #: ../src/ui/tool/node.cpp:493 msgctxt "Path handle tip" @@ -22692,7 +22667,7 @@ msgstr "Knooppunthandvatten verschuiven" msgctxt "Path handle tip" msgid "Auto node handle: drag to convert to smooth node (%s)" msgstr "" -"Automatischknooppunthandvat: sleep om om te zetten naar een glad " +"Automatischknooppunthandvat: sleep om om te zetten naar een afgevlakt " "knooppunt (%s)" #: ../src/ui/tool/node.cpp:553 @@ -22795,7 +22770,7 @@ msgstr "Symmetrisch knooppunt" #: ../src/ui/tool/node.cpp:1507 msgid "Auto-smooth node" -msgstr "Automatisch glad knooppunt" +msgstr "Automatisch afgevlakt knooppunt" #: ../src/ui/tool/path-manipulator.cpp:836 msgid "Scale handle" @@ -28047,9 +28022,8 @@ msgid "Style" msgstr "Stijl" #: ../src/widgets/font-selector.cpp:211 -#, fuzzy msgid "Face" -msgstr "Zijden" +msgstr "Zijde" #: ../src/widgets/font-selector.cpp:240 ../share/extensions/dots.inx.h:3 msgid "Font size:" @@ -28452,51 +28426,51 @@ msgstr "Invoegen" #: ../src/widgets/node-toolbar.cpp:356 msgid "Insert node at min X" -msgstr "" +msgstr "Knooppunt bij min X toevoegen" #: ../src/widgets/node-toolbar.cpp:357 msgid "Insert new nodes at min X into selected segments" -msgstr "" +msgstr "Nieuwe knooppunten bij min X toevoegen in geselecteerde segmenten" #: ../src/widgets/node-toolbar.cpp:360 msgid "Insert min X" -msgstr "" +msgstr "Bij min X toevoegen" #: ../src/widgets/node-toolbar.cpp:366 msgid "Insert node at max X" -msgstr "" +msgstr "Knooppunt bij max X toevoegen" #: ../src/widgets/node-toolbar.cpp:367 msgid "Insert new nodes at max X into selected segments" -msgstr "" +msgstr "Nieuwe knooppunten bij max X toevoegen in geselecteerde segmenten" #: ../src/widgets/node-toolbar.cpp:370 msgid "Insert max X" -msgstr "" +msgstr "Bij max X toevoegen" #: ../src/widgets/node-toolbar.cpp:376 msgid "Insert node at min Y" -msgstr "" +msgstr "Knooppunt bij min Y toevoegen" #: ../src/widgets/node-toolbar.cpp:377 msgid "Insert new nodes at min Y into selected segments" -msgstr "" +msgstr "Nieuwe knooppunten bij min Y toevoegen in geselecteerde segmenten" #: ../src/widgets/node-toolbar.cpp:380 msgid "Insert min Y" -msgstr "" +msgstr "Bij min Y toevoegen" #: ../src/widgets/node-toolbar.cpp:386 msgid "Insert node at max Y" -msgstr "" +msgstr "Knooppunt bij max Y toevoegen" #: ../src/widgets/node-toolbar.cpp:387 msgid "Insert new nodes at max Y into selected segments" -msgstr "" +msgstr "Nieuwe knooppunten bij max Y toevoegen in geselecteerde segmenten" #: ../src/widgets/node-toolbar.cpp:390 msgid "Insert max Y" -msgstr "" +msgstr "Bij max Y toevoegen" #: ../src/widgets/node-toolbar.cpp:398 msgid "Delete selected nodes" @@ -30874,9 +30848,9 @@ msgid "Unable to open specified file: %s" msgstr "Kan opgegeven bestand niet openen: %s" #: ../share/extensions/inkex.py:171 -#, fuzzy, python-format +#, python-format msgid "Unable to open object member file: %s" -msgstr "Kan opgegeven bestand niet openen: %s" +msgstr "Kan opgegeven deelobjectbestand niet openen: %s" #: ../share/extensions/inkex.py:276 #, python-format @@ -31086,20 +31060,19 @@ msgid "unable to locate marker: %s" msgstr "onmogelijk om plaats markering te bepalen: %s" #: ../share/extensions/measure.py:50 -#, fuzzy msgid "" "Failed to import the numpy modules. These modules are required by this " "extension. Please install them and try again. On a Debian-like system this " "can be done with the command, sudo apt-get install python-numpy." msgstr "" -"Laden van de numpy of numpy.linalg modules mislukt. Deze modules zijn nodig " +"Laden van de numpy modules mislukt. Deze modules zijn nodig " "voor deze uitbreiding. Installeer deze alstublief en probeer opnieuw. Op een " "Debian-gebaseerd systeem kan dit gedaan worden met het commando, sudo apt-" "get install python-numpy." #: ../share/extensions/measure.py:112 msgid "Area is zero, cannot calculate Center of Mass" -msgstr "" +msgstr "Oppervlak is gelijk aan nul, kan massacentrum niet berekenen" #: ../share/extensions/pathalongpath.py:208 #: ../share/extensions/pathscatter.py:228 @@ -33719,9 +33692,8 @@ msgid "Margins" msgstr "Marges" #: ../share/extensions/guides_creator.inx.h:17 -#, fuzzy msgid "Margins preset:" -msgstr "Marges" +msgstr "Margevoorkeur:" #: ../share/extensions/guides_creator.inx.h:18 msgid "Header margin:" @@ -35157,7 +35129,7 @@ msgstr "Tekstoriëntatie: " #: ../share/extensions/measure.inx.h:5 msgid "Angle [with Fixed Angle option only] (°):" -msgstr "" +msgstr "Hoek [bij optie Vaste hoek] (°):" #: ../share/extensions/measure.inx.h:6 msgid "Font size (px):" @@ -35187,7 +35159,7 @@ msgstr "Oppervlakte" #: ../share/extensions/measure.inx.h:13 msgctxt "measure extension" msgid "Center of Mass" -msgstr "" +msgstr "Massacentrum" #: ../share/extensions/measure.inx.h:14 msgctxt "measure extension" @@ -35200,7 +35172,7 @@ msgid "Fixed Angle" msgstr "Vaste hoek" #: ../share/extensions/measure.inx.h:18 -#, fuzzy, no-c-format +#, no-c-format msgid "" "This effect measures the length, area, or center-of-mass of the selected " "paths. Length and area are added as a text object with the selected units. " @@ -35218,10 +35190,10 @@ msgid "" "Bezier curves. If a circle is used, the area may be too high by as much as " "0.03%." msgstr "" -"Dit effect meet de lengte of oppervlak van het geselecteerde pad en voegt " -"het toe als tekstobject.\n" -" \n" -" * Weergave kan als tekst-op-pad of alleenstaande tekst in een specifieke " +"Dit effect meet de lengte, oppervlakte of middelpunt van de geselecteerde paden. " +"Lengte en oppervlak worden toegevoegd als tekstobject in de geselecteerde eenheid. Middelpunt wordt toegevoegd als een kruis.\n" +"\n" +" * Tekstweergave kan als tekst-op-pad of alleenstaande tekst in een specifieke " "hoek.\n" " * Het aantal significante cijfers kan ingesteld worden met het " "Precisieveld.\n" @@ -36030,11 +36002,11 @@ msgstr "Puntgrootte (px):" #: ../share/extensions/render_gear_rack.inx.h:1 msgid "Rack Gear" -msgstr "" +msgstr "Rupsband" #: ../share/extensions/render_gear_rack.inx.h:2 msgid "Rack Length:" -msgstr "" +msgstr "Tandlengte:" #: ../share/extensions/render_gear_rack.inx.h:3 msgid "Tooth Spacing:" @@ -36055,7 +36027,7 @@ msgstr "Aantal tanden:" #: ../share/extensions/render_gears.inx.h:3 msgid "Circular pitch (tooth size):" -msgstr "" +msgstr "Tandhoogte:" #: ../share/extensions/render_gears.inx.h:4 msgid "Pressure angle (degrees):" @@ -36063,11 +36035,11 @@ msgstr "Drukhoek (graden):" #: ../share/extensions/render_gears.inx.h:5 msgid "Diameter of center hole (0 for none):" -msgstr "Diameter van het centraal gat (0 voro geen):" +msgstr "Diameter van het centraal gat (0 voor geen):" #: ../share/extensions/render_gears.inx.h:10 msgid "Unit of measurement for both circular pitch and center diameter." -msgstr "" +msgstr "Eenheid voor tandhoogte en diameter midden." #: ../share/extensions/replace_font.inx.h:1 msgid "Replace font" @@ -36588,7 +36560,7 @@ msgstr "XAML-uitvoer" #: ../share/extensions/svg2xaml.inx.h:2 msgid "Silverlight compatible XAML" -msgstr "" +msgstr "Silverlight compatibele XAML" #: ../share/extensions/svg2xaml.inx.h:3 ../share/extensions/xaml2svg.inx.h:2 msgid "Microsoft XAML (*.xaml)" @@ -36790,7 +36762,7 @@ msgstr "Synfig animatie geschreven met de sif-export extensie" #: ../share/extensions/tar_layers.inx.h:1 msgid "Collection of SVG files One per root layer" -msgstr "" +msgstr "Collectie van een SVG-bestand per laag" #: ../share/extensions/tar_layers.inx.h:2 msgid "Layers as Separate SVG (*.tar)" -- cgit v1.2.3 From 9be96bd4e854c60dfdcb0009ec6b160a95a82570 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Fri, 19 Dec 2014 09:25:59 -0500 Subject: disable rev 13709, following Bug 1365451, comments 13-16 Fixed bugs: - https://launchpad.net/bugs/1365451 (bzr r13806) --- src/ui/clipboard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 7c82fb230..7661f466d 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -330,13 +330,13 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* use->setAttribute("xlink:href", id.c_str() ); // Set a default style in rather than so it can be changed. use->setAttribute("style", style ); - +/* disable rev 13709 in rev 13806, following Bug 1365451, comments 13-16 Inkscape::XML::Node *nv_repr = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getRepr(); gdouble scale_units = Inkscape::Util::Quantity::convert(1, nv_repr->attribute("inkscape:document-units"), "px"); gchar *transform_str = sp_svg_transform_write(Geom::Scale(scale_units, scale_units)); use->setAttribute("transform", transform_str); g_free(transform_str); - +*/ _root->appendChild(use); // This min and max sets offsets, we don't have any so set to zero. -- cgit v1.2.3 From b6d303d11e572d8888d29c44e11d06d256821a03 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 21 Dec 2014 15:29:02 +0100 Subject: Implement rendering for 'context-fill' and 'context-stroke' (text not handled yet). (bzr r13807) --- src/display/drawing-item.cpp | 56 ++++++++++++++++++++------- src/display/drawing-item.h | 10 ++++- src/display/drawing-pattern.h | 1 - src/display/drawing-shape.cpp | 14 +++++-- src/display/drawing-shape.h | 3 +- src/display/drawing-text.cpp | 15 ++++++-- src/display/drawing-text.h | 6 +-- src/display/nr-style.cpp | 89 +++++++++++++++++++++++++++---------------- src/display/nr-style.h | 3 +- src/sp-item-group.cpp | 13 +++++-- src/sp-marker.h | 7 +++- src/sp-shape.cpp | 27 ++++++++++--- src/sp-text.cpp | 6 +-- src/sp-use.cpp | 11 +++--- 14 files changed, 183 insertions(+), 78 deletions(-) diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 407adc255..83d4744c9 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -110,6 +110,7 @@ DrawingItem::DrawingItem(Drawing &drawing) , _parent(NULL) , _key(0) , _style(NULL) + , _context_style(NULL) , _opacity(1.0) , _transform(NULL) , _clip(NULL) @@ -360,15 +361,10 @@ DrawingItem::setCached(bool cached, bool persistent) * Note: _style is not used by DrawingGlyphs which uses its parent style. */ void -DrawingItem::setStyle(SPStyle *style) +DrawingItem::setStyle(SPStyle *style, SPStyle *context_style) { - // std::cout << "DrawingItem::setStyle: "; - // SPObject *item = static_cast(_user_data); - // if( item ) { - // std::cout << (item->getId()?item->getId():"null") << std::endl; - // } else { - // std::cout << "No item" << std::endl; - // } + // std::cout << "DrawingItem::setStyle: " << name() << " " << style + // << " " << context_style << std::endl; if (style) sp_style_ref(style); if (_style) sp_style_unref(_style); @@ -396,10 +392,33 @@ DrawingItem::setStyle(SPStyle *style) } } + if (context_style != NULL) { + _context_style = context_style; + } else if (_parent != NULL) { + _context_style = _parent->_context_style; + } + _markForUpdate(STATE_ALL, false); } +/** + * Recursively update children style. + * The purpose of this call is to update fill and stroke for markers that have elements with + * fill/stroke property values of 'context-fill' or 'context-stroke'. Marker styling is not + * updated like other 'clones' as marker instances are not included the SP object tree. + * Note: this is a virtual function. + */ +void +DrawingItem::setChildrenStyle(SPStyle* context_style) +{ + _context_style = context_style; + for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { + i->setChildrenStyle( context_style ); + } +} + + void DrawingItem::setClip(DrawingItem *item) { @@ -957,6 +976,20 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags) return NULL; } +// For debugging +Glib::ustring +DrawingItem::name() +{ + SPObject *object = static_cast(_user_data); + if (object) { + if(object->getId()) + return object->getId(); + else + return "No object id"; + } else { + return "No associated object"; + } +} // For debugging: Print drawing tree structure. void @@ -969,12 +1002,7 @@ DrawingItem::recursivePrintTree( unsigned level ) for (unsigned i = 0; i < level; ++i) { std::cout << " "; } - SPObject *object = static_cast(_user_data); - if (object) { - std::cout << (object->getId()?object->getId():"No object id") << std::endl; - } else { - std::cout << "No associated object" << std::endl; - } + std::cout << name() << std::endl; for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { i->recursivePrintTree( level+1 ); } diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 89331c13d..3c593ceaa 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -20,6 +20,10 @@ #include #include +namespace Glib { +class ustring; +} + class SPStyle; namespace Inkscape { @@ -108,7 +112,8 @@ public: bool cached() const { return _cached; } void setCached(bool c, bool persistent = false); - virtual void setStyle(SPStyle *style); + virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); + virtual void setChildrenStyle(SPStyle *context_style); void setOpacity(float opacity); void setAntialiasing(bool a); void setIsolation(unsigned isolation); // CSS Compositing and Blending @@ -132,6 +137,7 @@ public: void clip(DrawingContext &dc, Geom::IntRect const &area); DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags = 0); + virtual Glib::ustring name(); // For debugging void recursivePrintTree(unsigned level = 0); // For debugging protected: @@ -179,6 +185,8 @@ protected: unsigned _key; ///< Some SPItems can have more than one DrawingItem; /// this value is a hack used to distinguish between them SPStyle *_style; // Not used by DrawingGlyphs + SPStyle *_context_style; // Used for 'context-fill', 'context-stroke' + float _opacity; Geom::Affine *_transform; ///< Incremental transform from parent to this item's coords diff --git a/src/display/drawing-pattern.h b/src/display/drawing-pattern.h index 7483ba067..dc1f93ed1 100644 --- a/src/display/drawing-pattern.h +++ b/src/display/drawing-pattern.h @@ -15,7 +15,6 @@ #include "display/drawing-group.h" typedef struct _cairo_pattern cairo_pattern_t; -class SPStyle; namespace Inkscape { diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index 5bdc7a323..63efb3c0d 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -62,10 +62,17 @@ DrawingShape::setPath(SPCurve *curve) } void -DrawingShape::setStyle(SPStyle *style) +DrawingShape::setStyle(SPStyle *style, SPStyle *context_style) { - _nrstyle.set(style); - DrawingItem::setStyle(style); + DrawingItem::setStyle(style, context_style); // Must be first + _nrstyle.set(_style, _context_style); +} + +void +DrawingShape::setChildrenStyle(SPStyle* context_style) +{ + DrawingItem::setChildrenStyle( context_style ); + _nrstyle.set(_style, _context_style); } unsigned @@ -142,7 +149,6 @@ DrawingShape::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u _bbox.unionWith(i->geometricBounds()); } } - return STATE_ALL; } diff --git a/src/display/drawing-shape.h b/src/display/drawing-shape.h index 1c921b21f..1cdbc636e 100644 --- a/src/display/drawing-shape.h +++ b/src/display/drawing-shape.h @@ -28,7 +28,8 @@ public: ~DrawingShape(); void setPath(SPCurve *curve); - virtual void setStyle(SPStyle *style); + virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); + virtual void setChildrenStyle(SPStyle *context_style); protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index 58305477b..e20a7ff2a 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -56,7 +56,7 @@ DrawingGlyphs::setGlyph(font_instance *font, int glyph, Geom::Affine const &tran } void -DrawingGlyphs::setStyle(SPStyle *style) +DrawingGlyphs::setStyle(SPStyle * /*style*/, SPStyle * /*context_style*/) { std::cerr << "DrawingGlyphs: Use parent style" << std::endl; } @@ -223,10 +223,17 @@ DrawingText::addComponent(font_instance *font, int glyph, Geom::Affine const &tr } void -DrawingText::setStyle(SPStyle *style) +DrawingText::setStyle(SPStyle *style, SPStyle *context_style) { - _nrstyle.set(style); - DrawingGroup::setStyle(style); + DrawingGroup::setStyle(style, context_style); // Must be first + _nrstyle.set(_style, _context_style); +} + +void +DrawingText::setChildrenStyle(SPStyle* context_style) +{ + DrawingGroup::setChildrenStyle( context_style ); + _nrstyle.set(_style, _context_style); } unsigned diff --git a/src/display/drawing-text.h b/src/display/drawing-text.h index 37c1e81c7..3d248df9b 100644 --- a/src/display/drawing-text.h +++ b/src/display/drawing-text.h @@ -28,7 +28,7 @@ public: ~DrawingGlyphs(); void setGlyph(font_instance *font, int glyph, Geom::Affine const &trans); - void setStyle(SPStyle *style); // Not to be used, prints error message. + virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); // Not to be used protected: unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, @@ -57,8 +57,8 @@ public: void clear(); bool addComponent(font_instance *font, int glyph, Geom::Affine const &trans, float width, float ascent, float descent, float phase_length); - void setStyle(SPStyle *style); - + virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); + virtual void setChildrenStyle(SPStyle *context_style); protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 70382ef50..9dadaf3f1 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -93,35 +93,41 @@ NRStyle::~NRStyle() text_decoration_stroke.clear(); } -void NRStyle::set(SPStyle *style) +void NRStyle::set(SPStyle *style, SPStyle *context_style) { // Handle 'context-fill' and 'context-stroke': Work in progress - SPIPaint &style_fill = style->fill; - if( style_fill.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { - // std::cout << "NRStyle::set: fill: context-fill" << std::endl; - // style_fill = context_fill; - } else if ( style_fill.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { - //std::cout << "NRStyle::set: fill: context-stroke" << std::endl; - // style_fill = context_stroke; + const SPIPaint *style_fill = &(style->fill); + if( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + if( context_style != NULL ) { + style_fill = &(context_style->fill); + } else { + std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; + } + } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + if( context_style != NULL ) { + style_fill = &(context_style->stroke); + } else { + std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; + } } - - if ( style_fill.isPaintserver() ) { + + if ( style_fill->isPaintserver() ) { SPPaintServer* server = style->getFillPaintServer(); if ( server && server->isValid() ) { fill.set(server); - } else if ( style_fill.colorSet ) { - fill.set(style_fill.value.color); + } else if ( style_fill->colorSet ) { + fill.set(style_fill->value.color); } else { fill.clear(); } - } else if ( style_fill.isColor() ) { - fill.set(style_fill.value.color); - } else if ( style_fill.isNone() ) { + } else if ( style_fill->isColor() ) { + fill.set(style_fill->value.color); + } else if ( style_fill->isNone() ) { fill.clear(); - } else if ( style_fill.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { - // std::cout << "NRStyle::set: fill: context-fill DOUBLE" << std::endl; - } else if ( style_fill.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { - // std::cout << "NRStyle::set: fill: context-stroke DOUBLE" << std::endl; + } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + std::cerr << "NRStyle::set: fill: context-fill: Double" << std::endl; + } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + std::cerr << "NRStyle::set: fill: context-stroke: Double" << std::endl; } else { g_assert_not_reached(); } @@ -139,26 +145,42 @@ void NRStyle::set(SPStyle *style) g_assert_not_reached(); } - if ( style->stroke.isPaintserver() ) { + const SPIPaint *style_stroke = &(style->stroke); + if( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + if( context_style != NULL ) { + style_stroke = &(context_style->fill); + } else { + std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; + } + } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + if( context_style != NULL ) { + style_stroke = &(context_style->stroke); + } else { + std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; + } + } + + if ( style_stroke->isPaintserver() ) { SPPaintServer* server = style->getStrokePaintServer(); if ( server && server->isValid() ) { stroke.set(server); - } else if ( style->stroke.isColor() ) { - stroke.set(style->stroke.colorSet); + } else if ( style_stroke->isColor() ) { + stroke.set(style_stroke->colorSet); } else { stroke.clear(); } - } else if ( style->stroke.isColor() ) { - stroke.set(style->stroke.value.color); - } else if ( style->stroke.isNone() ) { + } else if ( style_stroke->isColor() ) { + stroke.set(style_stroke->value.color); + } else if ( style_stroke->isNone() ) { stroke.clear(); - } else if ( style->stroke.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { - // std::cout << "NRStyle::set: stroke: context-fill" << std::endl; - } else if ( style->stroke.paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { - // std::cout << "NRStyle::set: stroke: context-stroke" << std::endl; + } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + std::cerr << "NRStyle::set: stroke: context-fill: Double" << std::endl; + } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + std::cerr << "NRStyle::set: stroke: context-stroke: Double" << std::endl; } else { g_assert_not_reached(); } + stroke.opacity = SP_SCALE24_TO_FLOAT(style->stroke_opacity.value); stroke_width = style->stroke_width.computed; switch (style->stroke_linecap.computed) { @@ -329,13 +351,16 @@ bool NRStyle::prepareFill(Inkscape::DrawingContext &dc, Geom::OptRect const &pai fill_pattern = pattern->renderPattern(fill.opacity); } else { fill_pattern = fill.server->pattern_new(dc.raw(), paintbox, fill.opacity); - } break; + } + break; case PAINT_COLOR: { SPColor const &c = fill.color; fill_pattern = cairo_pattern_create_rgba( c.v.c[0], c.v.c[1], c.v.c[2], fill.opacity); - } break; - default: break; + } + break; + default: + break; } } if (!fill_pattern) return false; diff --git a/src/display/nr-style.h b/src/display/nr-style.h index f324fdb56..5f78795d3 100644 --- a/src/display/nr-style.h +++ b/src/display/nr-style.h @@ -1,6 +1,7 @@ /** * @file * Style information for rendering. + * Only used by classes DrawingShape and DrawingText *//* * Authors: * Krzysztof KosiÅ„ski @@ -28,7 +29,7 @@ struct NRStyle { NRStyle(); ~NRStyle(); - void set(SPStyle *); + void set(SPStyle *style, SPStyle *context_style = NULL); bool prepareFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); bool prepareStroke(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); bool prepareTextDecorationFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 992bca631..796caa88b 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -199,7 +199,11 @@ void SPGroup::update(SPCtx *ctx, unsigned int flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *group = dynamic_cast(v->arenaitem); - group->setStyle(this->style); + if( this->parent ) { + group->setStyle(this->style, this->parent->style); + } else { + group->setStyle(this->style); + } } } } @@ -356,8 +360,11 @@ Inkscape::DrawingItem *SPGroup::show (Inkscape::Drawing &drawing, unsigned int k ai = new Inkscape::DrawingGroup(drawing); ai->setPickChildren(this->effectiveLayerMode(key) == SPGroup::LAYER); - ai->setStyle(this->style); - + if( this->parent ) { + ai->setStyle(this->style, this->parent->style); + } else { + ai->setStyle(this->style); + } this->_showChildren(drawing, ai, key, flags); return ai; } diff --git a/src/sp-marker.h b/src/sp-marker.h index 54f37487a..e804fd7dc 100644 --- a/src/sp-marker.h +++ b/src/sp-marker.h @@ -63,7 +63,12 @@ public: markerOrient orient_mode : 2; SVGAngle orient; - /* Private views indexed by key */ + /* Private views indexed by key that corresponds to a + * particular marker type (start, mid, end) on a particular + * path. SPMarkerView is a wrapper for a vector of pointers to + * Inkscape::DrawingItem instances, one pointer for each + * rendered marker. + */ std::map views_map; virtual void build(SPDocument *document, Inkscape::XML::Node *repr); diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 6d240fbf5..02b9969b3 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -145,7 +145,12 @@ void SPShape::update(SPCtx* ctx, guint flags) { for (SPItemView *v = ((SPItem *) (this))->display; v != NULL; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast(v->arenaitem); - sh->setStyle(this->style); + if (hasMarkers()) { + sh->setStyle(this->style, this->style); + sh->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. + } else { + sh->setStyle(this->style, this->parent->style); + } } } } @@ -163,6 +168,7 @@ void SPShape::update(SPCtx* ctx, guint flags) { } if (this->hasMarkers ()) { + /* Dimension marker views */ for (SPItemView *v = this->display; v != NULL; v = v->next) { if (!v->arenaitem->key()) { @@ -387,7 +393,12 @@ void SPShape::modified(unsigned int flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast(v->arenaitem); - sh->setStyle(this->style); + if (hasMarkers()) { + sh->setStyle(this->style, this->style); + sh->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. + } else { + sh->setStyle(this->style, this->parent->style); + } } } } @@ -719,7 +730,9 @@ void SPShape::print(SPPrintContext* ctx) { Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/) { Inkscape::DrawingShape *s = new Inkscape::DrawingShape(drawing); - s->setStyle(this->style); + + bool has_markers = this->hasMarkers(); + s->setPath(this->_curve); /* This stanza checks that an object's marker style agrees with @@ -731,7 +744,7 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /* sp_shape_set_marker (this, i, this->style->marker_ptrs[i]->value); } - if (this->hasMarkers ()) { + if (has_markers) { /* provide key and dimension the marker views */ if (!s->key()) { s->setKey(SPItem::display_key_new (SP_MARKER_LOC_QTY)); @@ -747,8 +760,12 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /* /* Update marker views */ sp_shape_update_marker_view (this, s); - } + s->setStyle(this->style,this->style); + s->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. + } else { + s->setStyle(this->style, this->parent->style); + } return s; } diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 8922d3c73..a35a58bd9 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -195,7 +195,7 @@ void SPText::update(SPCtx *ctx, guint flags) { for (SPItemView* v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); this->_clearFlow(g); - g->setStyle(this->style); + g->setStyle(this->style, this->parent->style); // pass the bbox of the this this as paintbox (used for paintserver fills) this->layout.show(g, paintbox); } @@ -221,7 +221,7 @@ void SPText::modified(guint flags) { for (SPItemView* v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); this->_clearFlow(g); - g->setStyle(this->style); + g->setStyle(this->style, this->parent->style); this->layout.show(g, paintbox); } } @@ -333,7 +333,7 @@ Geom::OptRect SPText::bbox(Geom::Affine const &transform, SPItem::BBoxType type) Inkscape::DrawingItem* SPText::show(Inkscape::Drawing &drawing, unsigned /*key*/, unsigned /*flags*/) { Inkscape::DrawingGroup *flowed = new Inkscape::DrawingGroup(drawing); flowed->setPickChildren(false); - flowed->setStyle(this->style); + flowed->setStyle(this->style, this->parent->style); // pass the bbox of the text object as paintbox (used for paintserver fills) this->layout.show(flowed, this->geometricBounds()); diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 2bd6757ff..cadd6a16c 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -94,7 +94,7 @@ void SPUse::build(SPDocument *document, Inkscape::XML::Node *repr) { // We don't need to create child here: // reading xlink:href will attach ref, and that will cause the changed signal to be emitted, - // which will call sp_use_href_changed, and that will take care of the child + // which will call SPUse::href_changed, and that will take care of the child } void SPUse::release() { @@ -145,7 +145,7 @@ void SPUse::set(unsigned int key, const gchar* value) { this->href = NULL; if (value) { - // First, set the href field, because sp_use_href_changed will need it. + // First, set the href field, because SPUse::href_changed will need it. this->href = g_strdup(value); // Now do the attaching, which emits the changed signal. @@ -280,9 +280,10 @@ gchar* SPUse::description() const { } Inkscape::DrawingItem* SPUse::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { + Inkscape::DrawingGroup *ai = new Inkscape::DrawingGroup(drawing); ai->setPickChildren(false); - ai->setStyle(this->style); + ai->setStyle(this->style, this->style); if (this->child) { Inkscape::DrawingItem *ac = this->child->invoke_show(drawing, key, flags); @@ -579,7 +580,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); - g->setStyle(this->style); + g->setStyle(this->style, this->style); } } @@ -601,7 +602,7 @@ void SPUse::modified(unsigned int flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); - g->setStyle(this->style); + g->setStyle(this->style, this->style); } } -- cgit v1.2.3 From 4962b8bf299c08209f62426a18ff24bb83216234 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 21 Dec 2014 15:30:29 +0100 Subject: Add arrow that demonstates 'auto-start-reverse' and 'context-stroke'/'context-fill'. (bzr r13808) --- share/markers/markers.svg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/markers/markers.svg b/share/markers/markers.svg index de877a287..825059fb0 100644 --- a/share/markers/markers.svg +++ b/share/markers/markers.svg @@ -300,5 +300,9 @@ Insert the new markers into the . + + + + -- cgit v1.2.3 From 30b6a43219b66aba1a9ebade8aca50910f2c25cc Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 10:39:39 -0500 Subject: Deprecate and remove sp_desktop_selection in favor of SPDesktop::getSelection (bzr r13809) --- src/desktop-handles.cpp | 8 --- src/desktop-handles.h | 2 - src/extension/execution-env.cpp | 4 +- src/extension/implementation/implementation.cpp | 4 +- src/extension/implementation/script.cpp | 2 +- src/extension/internal/bitmap/imagemagick.cpp | 4 +- src/extension/internal/grid.cpp | 4 +- src/file.cpp | 4 +- src/gradient-chemistry.cpp | 4 +- src/gradient-drag.cpp | 2 +- src/inkscape.cpp | 16 +++--- src/layer-manager.cpp | 2 +- src/live_effects/parameter/originalpath.cpp | 4 +- src/live_effects/parameter/path.cpp | 2 +- src/path-chemistry.cpp | 8 +-- src/persp3d.cpp | 3 +- src/selcue.cpp | 3 +- src/selection-chemistry.cpp | 70 ++++++++++++------------- src/seltrans.cpp | 10 ++-- src/splivarot.cpp | 8 +-- src/text-chemistry.cpp | 14 ++--- src/trace/trace.cpp | 6 +-- src/ui/clipboard.cpp | 8 +-- src/ui/dialog/align-and-distribute.cpp | 17 +++--- src/ui/dialog/clonetiler.cpp | 10 ++-- src/ui/dialog/dialog.cpp | 2 +- src/ui/dialog/export.cpp | 36 ++++++------- src/ui/dialog/filter-effects-dialog.cpp | 6 +-- src/ui/dialog/find.cpp | 6 +-- src/ui/dialog/font-substitution.cpp | 2 +- src/ui/dialog/grid-arrange-tab.cpp | 2 +- src/ui/dialog/icon-preview.cpp | 2 +- src/ui/dialog/inkscape-preferences.cpp | 2 +- src/ui/dialog/layer-properties.cpp | 2 +- src/ui/dialog/livepatheffect-editor.cpp | 2 +- src/ui/dialog/object-attributes.cpp | 2 +- src/ui/dialog/object-properties.cpp | 10 ++-- src/ui/dialog/polar-arrange-tab.cpp | 2 +- src/ui/dialog/svg-fonts-dialog.cpp | 5 +- src/ui/dialog/swatches.cpp | 2 +- src/ui/dialog/text-edit.cpp | 8 +-- src/ui/dialog/transformation.cpp | 3 +- src/ui/dialog/xml-tree.cpp | 8 +-- src/ui/interface.cpp | 2 +- src/ui/tools/arc-tool.cpp | 10 ++-- src/ui/tools/box3d-tool.cpp | 10 ++-- src/ui/tools/calligraphic-tool.cpp | 12 ++--- src/ui/tools/connector-tool.cpp | 4 +- src/ui/tools/dropper-tool.cpp | 4 +- src/ui/tools/eraser-tool.cpp | 2 +- src/ui/tools/flood-tool.cpp | 10 ++-- src/ui/tools/freehand-base.cpp | 8 +-- src/ui/tools/gradient-tool.cpp | 8 +-- src/ui/tools/lpe-tool.cpp | 10 ++-- src/ui/tools/mesh-tool.cpp | 8 +-- src/ui/tools/node-tool.cpp | 4 +- src/ui/tools/pen-tool.cpp | 6 +-- src/ui/tools/pencil-tool.cpp | 2 +- src/ui/tools/rect-tool.cpp | 10 ++-- src/ui/tools/select-tool.cpp | 40 +++++++------- src/ui/tools/spiral-tool.cpp | 10 ++-- src/ui/tools/spray-tool.cpp | 2 +- src/ui/tools/star-tool.cpp | 10 ++-- src/ui/tools/text-tool.cpp | 18 +++---- src/ui/tools/tool-base.cpp | 2 +- src/ui/tools/tweak-tool.cpp | 2 +- src/ui/widget/panel.cpp | 3 +- src/ui/widget/selected-style.cpp | 2 +- src/ui/widget/style-subject.cpp | 4 +- src/vanishing-point.cpp | 6 +-- src/verbs.cpp | 6 +-- src/widgets/arc-toolbar.cpp | 10 ++-- src/widgets/box3d-toolbar.cpp | 8 +-- src/widgets/connector-toolbar.cpp | 8 +-- src/widgets/fill-style.cpp | 2 +- src/widgets/gradient-toolbar.cpp | 12 ++--- src/widgets/lpe-toolbar.cpp | 6 +-- src/widgets/mesh-toolbar.cpp | 4 +- src/widgets/node-toolbar.cpp | 8 +-- src/widgets/rect-toolbar.cpp | 4 +- src/widgets/select-toolbar.cpp | 8 +-- src/widgets/spiral-toolbar.cpp | 4 +- src/widgets/star-toolbar.cpp | 14 ++--- src/widgets/stroke-style.cpp | 8 +-- src/widgets/text-toolbar.cpp | 16 +++--- 85 files changed, 321 insertions(+), 327 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index 8fa7ad986..980e6c0e9 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -15,14 +15,6 @@ #include "desktop.h" #include "desktop-handles.h" -Inkscape::Selection * -sp_desktop_selection (SPDesktop const * desktop) -{ - g_assert(desktop != NULL); - - return desktop->selection; -} - SPDocument * sp_desktop_document (SPDesktop const * desktop) { diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 70a8c8b5f..481b9ed1f 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -44,8 +44,6 @@ namespace Inkscape { #define SP_COORDINATES_UNDERLINE_X (1 << Geom::X) #define SP_COORDINATES_UNDERLINE_Y (1 << Geom::Y) -//ToolBase * sp_desktop_event_context (SPDesktop const * desktop); -Inkscape::Selection * sp_desktop_selection (SPDesktop const * desktop); SPDocument * sp_desktop_document (SPDesktop const * desktop); SPCanvas * sp_desktop_canvas (SPDesktop const * desktop); SPCanvasItem * sp_desktop_acetate (SPDesktop const * desktop); diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index d4b5fd187..1495b7603 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -65,7 +65,7 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp if (desktop != NULL) { Inkscape::Util::GSListConstIterator selected = - sp_desktop_selection(desktop)->itemList(); + desktop->getSelection()->itemList(); while ( selected != NULL ) { Glib::ustring selected_id; selected_id = (*selected)->getId(); @@ -200,7 +200,7 @@ ExecutionEnv::reselect (void) { if (desktop == NULL) { return; } - Inkscape::Selection * selection = sp_desktop_selection(desktop); + Inkscape::Selection * selection = desktop->getSelection(); for (std::list::iterator i = _selected.begin(); i != _selected.end(); ++i) { SPObject * obj = doc->getObjectById(i->c_str()); diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 6f6bddb93..e29aed308 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -48,8 +48,8 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; - GSListConstIterator selected = - sp_desktop_selection((SPDesktop *)view)->itemList(); + // FIXME very unsafe cast + GSListConstIterator selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node const* first_select = NULL; if (selected != NULL) { const SPItem * item = *selected; diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index e6ac13cdc..6b1abe04c 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -690,7 +690,7 @@ void Script::effect(Inkscape::Extension::Effect *module, } Inkscape::Util::GSListConstIterator selected = - sp_desktop_selection(desktop)->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer + desktop->getSelection()->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer while ( selected != NULL ) { Glib::ustring selected_id; selected_id += "--id="; diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 0d47240d4..c92264858 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -242,7 +242,9 @@ ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::Vie SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; - GSListConstIterator selected = sp_desktop_selection((SPDesktop *)view)->itemList(); + + // FIXME very unsafe cast + GSListConstIterator selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; if (selected != NULL) { first_select = (*selected)->getRepr(); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index f4e0e5843..2ce86c245 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -191,7 +191,9 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; - GSListConstIterator selected = sp_desktop_selection((SPDesktop *)view)->itemList(); + + // FIXME very unsafe cast + GSListConstIterator selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; if (selected != NULL) { first_select = (*selected)->getRepr(); diff --git a/src/file.cpp b/src/file.cpp index a933a9611..d237e06c3 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1086,7 +1086,7 @@ void sp_import_document(SPDesktop *desktop, SPDocument *clipdoc, bool in_place) } // Change the selection to the freshly pasted objects - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection->setReprList(pasted_objects); // Apply inverse of parent transform @@ -1221,7 +1221,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // select and move the imported item if (new_obj && SP_IS_ITEM(new_obj)) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection->set(SP_ITEM(new_obj)); // preserve parent and viewBox transformations diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 27f4d7a98..7b6427a88 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -1569,7 +1569,7 @@ SPGradient *sp_gradient_vector_for_object( SPDocument *const doc, SPDesktop *con void sp_gradient_invert_selected_gradients(SPDesktop *desktop, Inkscape::PaintTarget fill_or_stroke) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); for (GSList const* i = selection->itemList(); i != NULL; i = i->next) { sp_item_gradient_invert_vector_color(SP_ITEM(i->data), fill_or_stroke); @@ -1582,7 +1582,7 @@ void sp_gradient_invert_selected_gradients(SPDesktop *desktop, Inkscape::PaintTa void sp_gradient_reverse_selected_gradients(SPDesktop *desktop) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::UI::Tools::ToolBase *ev = desktop->getEventContext(); if (!ev) { diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index d945231fc..71a43164d 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -631,7 +631,7 @@ GrDrag::GrDrag(SPDesktop *desktop) : vert_levels(), draggers(0), lines(0), - selection(sp_desktop_selection(desktop)), + selection(desktop->getSelection()), sel_changed_connection(), sel_modified_connection(), style_set_connection(), diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 94c3722cb..6d20c54f8 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -815,8 +815,8 @@ Application::add_desktop (SPDesktop * desktop) signal_activate_desktop.emit(desktop); signal_eventcontext_set.emit(desktop->getEventContext()); - signal_selection_set.emit(sp_desktop_selection(desktop)); - signal_selection_changed.emit(sp_desktop_selection(desktop)); + signal_selection_set.emit(desktop->getSelection()); + signal_selection_changed.emit(desktop->getSelection()); } @@ -839,12 +839,12 @@ Application::remove_desktop (SPDesktop * desktop) signal_activate_desktop.emit(new_desktop); signal_eventcontext_set.emit(new_desktop->getEventContext()); - signal_selection_set.emit(sp_desktop_selection(new_desktop)); - signal_selection_changed.emit(sp_desktop_selection(new_desktop)); + signal_selection_set.emit(new_desktop->getSelection()); + signal_selection_changed.emit(new_desktop->getSelection()); } else { signal_eventcontext_set.emit(NULL); - if (sp_desktop_selection(desktop)) - sp_desktop_selection(desktop)->clear(); + if (desktop->getSelection()) + desktop->getSelection()->clear(); } } @@ -884,8 +884,8 @@ Application::activate_desktop (SPDesktop * desktop) signal_activate_desktop.emit(desktop); signal_eventcontext_set.emit(desktop->getEventContext()); - signal_selection_set(sp_desktop_selection(desktop)); - signal_selection_changed(sp_desktop_selection(desktop)); + signal_selection_set(desktop->getSelection()); + signal_selection_changed(desktop->getSelection()); } diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index c02d75d16..99e2004da 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -154,7 +154,7 @@ void LayerManager::setCurrentLayer( SPObject* obj ) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/options/selection/layerdeselect", true)) { - sp_desktop_selection( _desktop )->clear(); + _desktop->getSelection()->clear(); } } } diff --git a/src/live_effects/parameter/originalpath.cpp b/src/live_effects/parameter/originalpath.cpp index 6c4f2a100..0884c4c9c 100644 --- a/src/live_effects/parameter/originalpath.cpp +++ b/src/live_effects/parameter/originalpath.cpp @@ -27,7 +27,7 @@ #include "live_effects/effect.h" #include "inkscape.h" -#include "desktop-handles.h" +#include "desktop.h" #include "selection.h" #include "ui/icon-names.h" @@ -128,7 +128,7 @@ OriginalPathParam::on_select_original_button_click() if (desktop == NULL || original == NULL) { return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection->clear(); selection->set(original); } diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 2a14d4208..a6d2f1ea5 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -414,7 +414,7 @@ PathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/) void PathParam::on_edit_button_click() { - SPItem * item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); if (item != NULL) { param_editOncanvas(item, SP_ACTIVE_DESKTOP); } diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 0c3f9cde7..c63a4fc35 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -47,7 +47,7 @@ using Inkscape::DocumentUndo; void sp_selected_path_combine(SPDesktop *desktop) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPDocument *doc = sp_desktop_document(desktop); if (g_slist_length((GSList *) selection->itemList()) < 1) { @@ -187,7 +187,7 @@ sp_selected_path_combine(SPDesktop *desktop) void sp_selected_path_break_apart(SPDesktop *desktop) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select path(s) to break apart.")); @@ -335,7 +335,7 @@ sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, b /** Converts the selected items to LPEItems if they are not already so; e.g. SPRects) */ void sp_selected_to_lpeitems(SPDesktop *desktop) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { return; @@ -613,7 +613,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) void sp_selected_path_reverse(SPDesktop *desktop) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList *items = (GSList *) selection->itemList(); if (!items) { diff --git a/src/persp3d.cpp b/src/persp3d.cpp index b21fd6cab..797e439c0 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -22,6 +22,7 @@ #include "svg/stringstream.h" #include "xml/document.h" #include "xml/node-event-vector.h" +#include "desktop.h" #include "desktop-handles.h" #include #include "verbs.h" @@ -555,7 +556,7 @@ persp3d_print_all_selected() { g_print ("\n======================================\n"); g_print ("Selected perspectives and their boxes:\n"); - std::list sel_persps = sp_desktop_selection(SP_ACTIVE_DESKTOP)->perspList(); + std::list sel_persps = SP_ACTIVE_DESKTOP->getSelection()->perspList(); for (std::list::iterator j = sel_persps.begin(); j != sel_persps.end(); ++j) { Persp3D *persp = SP_PERSP3D(*j); diff --git a/src/selcue.cpp b/src/selcue.cpp index 805629636..84c131dde 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -13,6 +13,7 @@ #include +#include "desktop.h" #include "desktop-handles.h" #include "selection.h" #include "display/sp-canvas-util.h" @@ -40,7 +41,7 @@ Inkscape::SelCue::SelCue(SPDesktop *desktop) : _desktop(desktop), _bounding_box_prefs_observer(*this) { - _selection = sp_desktop_selection(_desktop); + _selection = _desktop->getSelection(); _sel_changed_connection = _selection->connectChanged( sigc::hide(sigc::mem_fun(*this, &Inkscape::SelCue::_newItemBboxes)) diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 83a943f53..91200bacb 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -177,8 +177,8 @@ void SelectionHelper::selectNone(SPDesktop *dt) if (nt && !nt->_selected_nodes->empty()) { nt->_selected_nodes->clear(); - } else if (!sp_desktop_selection(dt)->isEmpty()) { - sp_desktop_selection(dt)->clear(); + } else if (!dt->getSelection()->isEmpty()) { + dt->getSelection()->clear(); } else { // If nothing selected switch to selection tool tools_switch(dt, TOOLS_SELECT); @@ -277,7 +277,7 @@ void SelectionHelper::fixSelection(SPDesktop *dt) if(!dt) return; - Inkscape::Selection *selection = sp_desktop_selection(dt); + Inkscape::Selection *selection = dt->getSelection(); GSList *items = NULL; @@ -407,7 +407,7 @@ void sp_selection_delete(SPDesktop *desktop) return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -454,7 +454,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone) SPDocument *doc = desktop->doc(); Inkscape::XML::Document* xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -609,7 +609,7 @@ static void sp_edit_select_all_full(SPDesktop *dt, bool force_all_layers, bool i if (!dt) return; - Inkscape::Selection *selection = sp_desktop_selection(dt); + Inkscape::Selection *selection = dt->getSelection(); g_return_if_fail(dynamic_cast(dt->currentLayer())); @@ -1262,7 +1262,7 @@ void sp_selection_remove_livepatheffect(SPDesktop *desktop) { if (desktop == NULL) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -1285,7 +1285,7 @@ void sp_selection_remove_filter(SPDesktop *desktop) { if (desktop == NULL) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -1323,7 +1323,7 @@ void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool a void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) { - Inkscape::Selection *selection = sp_desktop_selection(dt); + Inkscape::Selection *selection = dt->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -1368,7 +1368,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) { - Inkscape::Selection *selection = sp_desktop_selection(dt); + Inkscape::Selection *selection = dt->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -1413,7 +1413,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone) { - Inkscape::Selection *selection = sp_desktop_selection(dt); + Inkscape::Selection *selection = dt->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -1686,7 +1686,7 @@ void sp_selection_remove_transform(SPDesktop *desktop) if (desktop == NULL) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *l = const_cast(selection->reprList()); while (l != NULL) { @@ -1784,7 +1784,7 @@ void sp_selection_move_relative(Inkscape::Selection *selection, double dx, doubl */ void sp_selection_rotate_90(SPDesktop *desktop, bool ccw) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) return; @@ -1852,7 +1852,7 @@ void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolea GSList *all_list = get_all_items(NULL, desktop->currentRoot(), desktop, onlyvisible, onlysensitive, ingroups, NULL); GSList *all_matches = NULL; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); for (GSList const* sel_iter = selection->itemList(); sel_iter; sel_iter = sel_iter->next) { SPItem *sel = dynamic_cast(static_cast(sel_iter->data)); @@ -1905,7 +1905,7 @@ void sp_select_same_object_type(SPDesktop *desktop) GSList *all_list = get_all_items(NULL, desktop->currentRoot(), desktop, onlyvisible, onlysensitive, ingroups, NULL); GSList *matches = all_list; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); for (GSList const* sel_iter = selection->itemList(); sel_iter; sel_iter = sel_iter->next) { SPItem *sel = dynamic_cast(static_cast(sel_iter->data)); @@ -1947,7 +1947,7 @@ void sp_select_same_stroke_style(SPDesktop *desktop) GSList *all_list = get_all_items(NULL, desktop->currentRoot(), desktop, onlyvisible, onlysensitive, ingroups, NULL); GSList *matches = all_list; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); for (GSList const* sel_iter = selection->itemList(); sel_iter; sel_iter = sel_iter->next) { SPItem *sel = dynamic_cast(static_cast(sel_iter->data)); @@ -2376,7 +2376,7 @@ void sp_selection_item_next(SPDesktop *desktop) { g_return_if_fail(desktop != NULL); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); PrefsSelectionContext inlayer = (PrefsSelectionContext)prefs->getInt("/options/kbselection/inlayer", PREFS_SELECTION_LAYER); @@ -2406,7 +2406,7 @@ sp_selection_item_prev(SPDesktop *desktop) SPDocument *document = sp_desktop_document(desktop); g_return_if_fail(document != NULL); g_return_if_fail(desktop != NULL); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); PrefsSelectionContext inlayer = (PrefsSelectionContext) prefs->getInt("/options/kbselection/inlayer", PREFS_SELECTION_LAYER); @@ -2434,7 +2434,7 @@ void sp_selection_next_patheffect_param(SPDesktop * dt) { if (!dt) return; - Inkscape::Selection *selection = sp_desktop_selection(dt); + Inkscape::Selection *selection = dt->getSelection(); if ( selection && !selection->isEmpty() ) { SPItem *item = selection->singleItem(); if ( SPLPEItem *lpeitem = dynamic_cast(item) ) { @@ -2467,7 +2467,7 @@ void sp_selection_edit_clip_or_mask(SPDesktop * /*dt*/, bool /*clip*/) /*if (!dt) return; using namespace Inkscape::UI; - Inkscape::Selection *selection = sp_desktop_selection(dt); + Inkscape::Selection *selection = dt->getSelection(); if (!selection || selection->isEmpty()) return; GSList const *items = selection->itemList(); @@ -2607,7 +2607,7 @@ void sp_selection_clone(SPDesktop *desktop) return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); @@ -2662,7 +2662,7 @@ sp_selection_relink(SPDesktop *desktop) if (!desktop) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select clones to relink.")); @@ -2709,7 +2709,7 @@ sp_selection_unlink(SPDesktop *desktop) if (!desktop) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select clones to unlink.")); @@ -2781,7 +2781,7 @@ sp_select_clone_original(SPDesktop *desktop) if (desktop == NULL) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPItem *item = selection->singleItem(); @@ -2881,7 +2881,7 @@ void sp_selection_clone_original_path_lpe(SPDesktop *desktop) return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::SVGOStringStream os; SPObject * firstItem = NULL; @@ -2942,7 +2942,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -3041,7 +3041,7 @@ void sp_selection_to_guides(SPDesktop *desktop) return; SPDocument *doc = sp_desktop_document(desktop); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // we need to copy the list because it gets reset when objects are deleted GSList *items = g_slist_copy(const_cast(selection->itemList())); @@ -3101,7 +3101,7 @@ void sp_selection_symbol(SPDesktop *desktop, bool /*apply*/ ) SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // Check if something is selected. if (selection->isEmpty()) { @@ -3223,7 +3223,7 @@ void sp_selection_unsymbol(SPDesktop *desktop) SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // Check if something is selected. if (selection->isEmpty()) { @@ -3308,7 +3308,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -3423,7 +3423,7 @@ void sp_selection_untile(SPDesktop *desktop) SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -3578,7 +3578,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop) SPDocument *document = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = document->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { @@ -3796,7 +3796,7 @@ void sp_selection_set_clipgroup(SPDesktop *desktop) SPDocument* doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to create clippath or mask from.")); return; @@ -3912,7 +3912,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected bool is_empty = selection->isEmpty(); @@ -4114,7 +4114,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { diff --git a/src/seltrans.cpp b/src/seltrans.cpp index a9ae9e465..965b531a7 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -131,7 +131,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _makeHandles(); _updateHandles(); - _selection = sp_desktop_selection(desktop); + _selection = desktop->getSelection(); _norm = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRL, @@ -252,7 +252,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s { // While dragging a handle, we will either scale, skew, or rotate and the "translating" parameter will be false // When dragging the selected item itself however, we will translate the selection and that parameter will be true - Inkscape::Selection *selection = sp_desktop_selection(_desktop); + Inkscape::Selection *selection = _desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); g_return_if_fail(!_grabbed); @@ -418,7 +418,7 @@ void Inkscape::SelTrans::ungrab() _desktop->snapindicator->remove_snapsource(); - Inkscape::Selection *selection = sp_desktop_selection(_desktop); + Inkscape::Selection *selection = _desktop->getSelection(); _updateVolatileState(); for (unsigned i = 0; i < _items.size(); i++) { @@ -512,7 +512,7 @@ void Inkscape::SelTrans::ungrab() void Inkscape::SelTrans::stamp() { - Inkscape::Selection *selection = sp_desktop_selection(_desktop); + Inkscape::Selection *selection = _desktop->getSelection(); bool fixup = !_grabbed; if ( fixup && _stamp_cache ) { @@ -606,7 +606,7 @@ void Inkscape::SelTrans::_updateHandles() void Inkscape::SelTrans::_updateVolatileState() { - Inkscape::Selection *selection = sp_desktop_selection(_desktop); + Inkscape::Selection *selection = _desktop->getSelection(); _empty = selection->isEmpty(); if (_empty) { diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 1a75a6f29..70c8f37d5 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -1151,7 +1151,7 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only) void sp_selected_path_outline(SPDesktop *desktop) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select stroked path(s) to convert stroke to path.")); @@ -1583,7 +1583,7 @@ void sp_selected_path_create_updating_inset(SPDesktop *desktop) void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updating) { SPCurve *curve = NULL; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPItem *item = selection->singleItem(); if (item == NULL || ( !SP_IS_SHAPE(item) && !SP_IS_TEXT(item) ) ) { @@ -1766,7 +1766,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool void sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select path(s) to inset/outset.")); @@ -2191,7 +2191,7 @@ static void sp_selected_path_simplify_selection(SPDesktop *desktop, float threshold, bool justCoalesce, float angleLimit, bool breakableAngles) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index aa2d81427..b90145f8e 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -83,7 +83,7 @@ text_put_on_path() if (!desktop) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPItem *text = text_or_flowtext_in_selection(selection); SPItem *shape = shape_in_selection(selection); @@ -191,7 +191,7 @@ text_remove_from_path() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select a text on path to remove it from path.")); @@ -256,7 +256,7 @@ text_remove_all_kerns() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select text(s) to remove kerns from.")); @@ -297,7 +297,7 @@ text_flow_into_shape() SPDocument *doc = sp_desktop_document (desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPItem *text = text_or_flowtext_in_selection(selection); SPItem *shape = shape_in_selection(selection); @@ -375,7 +375,7 @@ text_flow_into_shape() DocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT, _("Flow text into shape")); - sp_desktop_selection(desktop)->set(SP_ITEM(root_object)); + desktop->getSelection()->set(SP_ITEM(root_object)); Inkscape::GC::release(root_repr); Inkscape::GC::release(region_repr); @@ -391,7 +391,7 @@ text_unflow () SPDocument *doc = sp_desktop_document (desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (!flowtext_in_selection(selection) || g_slist_length((GSList *) selection->itemList()) < 1) { @@ -477,7 +477,7 @@ flowtext_to_text() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index cb83541e3..11a54dcc2 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -53,7 +53,7 @@ SPImage *Tracer::getSelectedSPImage() Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); - Inkscape::Selection *sel = sp_desktop_selection(desktop); + Inkscape::Selection *sel = desktop->getSelection(); if (!sel) { char *msg = _("Select an image to trace"); @@ -219,7 +219,7 @@ Glib::RefPtr Tracer::sioxProcessImage(SPImage *img, Glib::RefPtrgetSelection(); if (!sel) { char *msg = _("Select an image to trace"); @@ -399,7 +399,7 @@ void Tracer::traceThread() Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (!SP_ACTIVE_DOCUMENT) { diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 7661f466d..9275d3bde 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -201,7 +201,7 @@ void ClipboardManagerImpl::copy(SPDesktop *desktop) if ( desktop == NULL ) { return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // Special case for when the gradient dragger is active - copies gradient color if (desktop->event_context->get_drag()) { @@ -435,7 +435,7 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) } // check whether something is selected - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { _userWarn(desktop, _("Select object(s) to paste style to.")); return false; @@ -488,7 +488,7 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a if ( desktop == NULL ) { return false; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { _userWarn(desktop, _("Select object(s) to paste size to.")); return false; @@ -551,7 +551,7 @@ bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) return false; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection && selection->isEmpty()) { _userWarn(desktop, _("Select object(s) to paste live path effect to.")); return false; diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index c538968d6..94e524157 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -91,7 +91,7 @@ Action::Action(const Glib::ustring &id, void ActionAlign::do_action(SPDesktop *desktop, int index) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -247,7 +247,7 @@ private : SPDesktop *desktop = _dialog.getDesktop(); if (!desktop) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; using Inkscape::Util::GSListConstIterator; @@ -458,8 +458,7 @@ private : // xGap and yGap are the minimum space required between bounding rectangles. double const xGap = removeOverlapXGap.get_value(); double const yGap = removeOverlapYGap.get_value(); - removeoverlap(sp_desktop_selection(_dialog.getDesktop())->itemList(), - xGap, yGap); + removeoverlap(_dialog.getDesktop()->getSelection()->itemList(), xGap, yGap); // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); @@ -490,7 +489,7 @@ private : int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); - graphlayout(sp_desktop_selection(_dialog.getDesktop())->itemList()); + graphlayout(_dialog.getDesktop()->getSelection()->itemList()); // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); @@ -547,7 +546,7 @@ private : SPDesktop *desktop = _dialog.getDesktop(); if (!desktop) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; using Inkscape::Util::GSListConstIterator; @@ -617,7 +616,7 @@ private : int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); - unclump ((GSList *) sp_desktop_selection(_dialog.getDesktop())->itemList()); + unclump ((GSList *) _dialog.getDesktop()->getSelection()->itemList()); // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); @@ -644,7 +643,7 @@ private : SPDesktop *desktop = _dialog.getDesktop(); if (!desktop) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; using Inkscape::Util::GSListConstIterator; @@ -743,7 +742,7 @@ private : SPDesktop *desktop = _dialog.getDesktop(); if (!desktop) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; using Inkscape::Util::GSListConstIterator; diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 37881d4ae..f8f220b0a 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -1276,7 +1276,7 @@ CloneTiler::CloneTiler () : g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(clonetiler_disconnect_gsignal), this); // update now - clonetiler_change_selection (sp_desktop_selection(SP_ACTIVE_DESKTOP), dlg); + clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg); } { @@ -1379,7 +1379,7 @@ void CloneTiler::clonetiler_change_selection(Inkscape::Selection *selection, Gtk void CloneTiler::clonetiler_external_change(GtkWidget *dlg) { - clonetiler_change_selection (sp_desktop_selection(SP_ACTIVE_DESKTOP), dlg); + clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg); } void CloneTiler::clonetiler_disconnect_gsignal(GObject *, gpointer source) @@ -2093,7 +2093,7 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty() || g_slist_length((GSList *) selection->itemList()) > 1) { @@ -2144,7 +2144,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty() || g_slist_length((GSList *) selection->itemList()) > 1) { @@ -2216,7 +2216,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) return; } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty()) { diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 6dabcfb6b..6d8fe4b12 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -310,7 +310,7 @@ void Dialog::_defocus() Inkscape::Selection* Dialog::_getSelection() { - return sp_desktop_selection(SP_ACTIVE_DESKTOP); + return SP_ACTIVE_DESKTOP->getSelection(); } } // namespace Dialog diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 1ebd1fc7c..d7151fa81 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -606,7 +606,7 @@ void Export::onBatchClicked () void Export::updateCheckbuttons () { - gint num = g_slist_length((GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList()); + gint num = g_slist_length((GSList *) SP_ACTIVE_DESKTOP->getSelection()->itemList()); if (num >= 2) { batch_export.set_sensitive(true); batch_export.set_label(g_strdup_printf (ngettext("B_atch export %d selected object","B_atch export %d selected objects",num), num)); @@ -622,7 +622,7 @@ inline void Export::findDefaultSelection() { selection_type key = SELECTION_NUMBER_OF; - if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) { + if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) { key = SELECTION_SELECTION; } @@ -660,15 +660,15 @@ inline void Export::findDefaultSelection() */ void Export::onSelectionChanged() { - Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP); + Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection(); if ((current_key == SELECTION_DRAWING || current_key == SELECTION_PAGE) && - (sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false && + (SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false && was_empty) { current_key = SELECTION_SELECTION; selectiontype_buttons[current_key]->set_active(true); } - was_empty = (sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty(); + was_empty = (SP_ACTIVE_DESKTOP->getSelection())->isEmpty(); if ( selection && SELECTION_CUSTOM != current_key) { @@ -696,7 +696,7 @@ void Export::onSelectionModified ( guint /*flags*/ ) } break; case SELECTION_SELECTION: - Sel = sp_desktop_selection(SP_ACTIVE_DESKTOP); + Sel = SP_ACTIVE_DESKTOP->getSelection(); if (Sel->isEmpty() == false) { Geom::OptRect bbox = Sel->visualBounds(); if (bbox) @@ -743,9 +743,9 @@ void Export::onAreaToggled () probabaly screw something up. */ switch (key) { case SELECTION_SELECTION: - if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) + if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) { - bbox = sp_desktop_selection (SP_ACTIVE_DESKTOP)->visualBounds(); + bbox = SP_ACTIVE_DESKTOP->getSelection()->visualBounds(); /* Only if there is a selection that we can set do we break, otherwise we fall through to the drawing */ @@ -810,15 +810,15 @@ void Export::onAreaToggled () break; } case SELECTION_SELECTION: - if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) { + if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) { - sp_selection_get_export_hints (sp_desktop_selection(SP_ACTIVE_DESKTOP), filename, &xdpi, &ydpi); + sp_selection_get_export_hints (SP_ACTIVE_DESKTOP->getSelection(), filename, &xdpi, &ydpi); /* If we still don't have a filename -- let's build one that's nice */ if (filename.empty()) { const gchar * id = "object"; - const GSList * reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList(); + const GSList * reprlst = SP_ACTIVE_DESKTOP->getSelection()->reprList(); for(; reprlst != NULL; reprlst = reprlst->next) { Inkscape::XML::Node * repr = (Inkscape::XML::Node *)reprlst->data; if (repr->attribute("id")) { @@ -1011,7 +1011,7 @@ void Export::onExport () if (batch_export.get_active ()) { // Batch export of selected objects - gint num = g_slist_length(const_cast(sp_desktop_selection(desktop)->itemList())); + gint num = g_slist_length(const_cast(desktop->getSelection()->itemList())); gint n = 0; if (num < 1) { @@ -1025,7 +1025,7 @@ void Export::onExport () gint export_count = 0; - for (GSList *i = const_cast(sp_desktop_selection(desktop)->itemList()); i && !interrupted; i = i->next) { + for (GSList *i = const_cast(desktop->getSelection()->itemList()); i && !interrupted; i = i->next) { SPItem *item = reinterpret_cast(i->data); prog_dlg->set_data("current", GINT_TO_POINTER(n)); @@ -1070,7 +1070,7 @@ void Export::onExport () nv->pagecolor, onProgressCallback, (void*)prog_dlg, TRUE, // overwrite without asking - hide ? const_cast(sp_desktop_selection(desktop)->itemList()) : NULL + hide ? const_cast(desktop->getSelection()->itemList()) : NULL )) { gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile); @@ -1159,7 +1159,7 @@ void Export::onExport () nv->pagecolor, onProgressCallback, (void*)prog_dlg, FALSE, - hide ? const_cast(sp_desktop_selection(desktop)->itemList()) : NULL + hide ? const_cast(desktop->getSelection()->itemList()) : NULL ); if (status == EXPORT_ERROR) { gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str()); @@ -1231,7 +1231,7 @@ void Export::onExport () bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); - reprlst = sp_desktop_selection(desktop)->reprList(); + reprlst = desktop->getSelection()->reprList(); for(; reprlst != NULL; reprlst = reprlst->next) { Inkscape::XML::Node * repr = static_cast(reprlst->data); @@ -1463,8 +1463,8 @@ void Export::detectSize() { i++) { switch (this_test[i]) { case SELECTION_SELECTION: - if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) { - Geom::OptRect bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds(SPItem::VISUAL_BBOX); + if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) { + Geom::OptRect bbox = (SP_ACTIVE_DESKTOP->getSelection())->bounds(SPItem::VISUAL_BBOX); if ( bbox && bbox_equal(*bbox,current_bbox)) { key = SELECTION_SELECTION; diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index bd44846a3..228570c88 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -688,7 +688,7 @@ public: private: void select_svg_element(){ - Inkscape::Selection* sel = sp_desktop_selection(_desktop); + Inkscape::Selection* sel = _desktop->getSelection(); if (sel->isEmpty()) return; Inkscape::XML::Node* node = (Inkscape::XML::Node*) g_slist_nth_data((GSList *)sel->reprList(), 0); if (!node || !node->matchAttributeName("id")) return; @@ -1441,7 +1441,7 @@ void FilterEffectsDialog::FilterModifier::on_document_replaced(SPDesktop * /*des // When the selection changes, show the active filter(s) in the dialog void FilterEffectsDialog::FilterModifier::on_change_selection() { - Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP); + Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection(); update_selection(selection); } @@ -1539,7 +1539,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri SPDesktop *desktop = _dialog.getDesktop(); SPDocument *doc = sp_desktop_document(desktop); SPFilter* filter = (*iter)[_columns.filter]; - Inkscape::Selection *sel = sp_desktop_selection(desktop); + Inkscape::Selection *sel = desktop->getSelection(); /* If this filter is the only one used in the selection, unset it */ if((*iter)[_columns.sel] == 1) diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 1a7832688..be8250f88 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -238,7 +238,7 @@ Find::Find() show_all_children(); - Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP); + Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection(); SPItem *item = selection->singleItem(); if (item) { if (dynamic_cast(item) || dynamic_cast(item)) { @@ -850,7 +850,7 @@ void Find::onAction() button_replace.set_sensitive(attributenameyok); } - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection->clear(); selection->setList(n); SPObject *obj = reinterpret_cast(n->data); @@ -865,7 +865,7 @@ void Find::onAction() } else { status.set_text(_("Nothing found")); if (!check_scope_selection.get_active()) { - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection->clear(); } desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No objects found")); diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index db7bdf222..82253417a 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -134,7 +134,7 @@ FontSubstitution::show(Glib::ustring out, GSList *l) if (cbSelect->get_active()) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection->clear(); selection->setList(l); } diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 2ff647a74..d60778bd0 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -167,7 +167,7 @@ void GridArrangeTab::arrange() SPDesktop *desktop = Parent->getDesktop(); sp_desktop_document(desktop)->ensureUpToDate(); - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); const GSList *items = selection ? selection->itemList() : 0; cnt=0; for (; items != NULL; items = items->next) { diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 468e85d36..25520ba8b 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -362,7 +362,7 @@ void IconPreviewPanel::refreshPreview() target = (hold && !targetId.empty()) ? desktop->doc()->getObjectById( targetId.c_str() ) : 0; if ( !target ) { targetId.clear(); - Inkscape::Selection * sel = sp_desktop_selection(desktop); + Inkscape::Selection * sel = desktop->getSelection(); if ( sel ) { //g_message("found a selection to play with"); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index f00463a84..cea489f50 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -213,7 +213,7 @@ static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatc if (desktop == NULL) return; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index d5540b88a..779aa47fe 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -399,7 +399,7 @@ void LayerPropertiesDialog::Create::perform(LayerPropertiesDialog &dialog) { if (!name.empty()) { desktop->layer_manager->renameLayer( new_layer, (gchar *)name.c_str(), TRUE ); } - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); desktop->setCurrentLayer(new_layer); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("New layer created.")); } diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 178c32c38..2e96193b9 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -398,7 +398,7 @@ LivePathEffectEditor::setDesktop(SPDesktop *desktop) lpe_list_locked = false; current_desktop = desktop; if (desktop) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection_changed_connection = selection->connectChanged( sigc::bind (sigc::ptr_fun(&lpeeditor_selection_changed), this ) ); selection_modified_connection = selection->connectModified( diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index cfa5c6182..118a66097 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -113,7 +113,7 @@ void ObjectAttributes::widget_setup (void) return; } - Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP); + Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection(); SPItem *item = selection->singleItem(); if (!item) { diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index 28e9b360b..ecfd057de 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -353,7 +353,7 @@ void ObjectProperties::update() return; } - Inkscape::Selection *selection = sp_desktop_selection(SP_ACTIVE_DESKTOP); + Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection(); Gtk::Box *contents = _getContents(); if (!selection->singleItem()) { @@ -458,7 +458,7 @@ void ObjectProperties::_labelChanged() return; } - SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); g_return_if_fail (item != NULL); _blocked = true; @@ -518,7 +518,7 @@ void ObjectProperties::_imageRenderingChanged() return; } - SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); g_return_if_fail (item != NULL); _blocked = true; @@ -543,7 +543,7 @@ void ObjectProperties::_sensitivityToggled() return; } - SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); g_return_if_fail(item != NULL); _blocked = true; @@ -559,7 +559,7 @@ void ObjectProperties::_hiddenToggled() return; } - SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); g_return_if_fail(item != NULL); _blocked = true; diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 80579c9d3..08cfba839 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -296,7 +296,7 @@ static void moveToPoint(int anchor, SPItem *item, Geom::Point p) void PolarArrangeTab::arrange() { - Inkscape::Selection *selection = sp_desktop_selection(parent->getDesktop()); + Inkscape::Selection *selection = parent->getDesktop()->getSelection(); const GSList *items, *tmp; tmp = items = selection->itemList(); SPGenericEllipse *referenceEllipse = NULL; // Last ellipse in selection diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 56ecfdecc..901cfc40a 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -29,6 +29,7 @@ #include "xml/node.h" #include "xml/repr.h" #include "sp-font-face.h" +#include "desktop.h" #include "desktop-handles.h" #include "display/nr-svgfonts.h" #include "verbs.h" @@ -516,7 +517,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); SPDocument* doc = sp_desktop_document(desktop); - Inkscape::Selection* sel = sp_desktop_selection(desktop); + Inkscape::Selection* sel = desktop->getSelection(); if (sel->isEmpty()){ char *msg = _("Select a path to define the curves of a glyph"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); @@ -558,7 +559,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); SPDocument* doc = sp_desktop_document(desktop); - Inkscape::Selection* sel = sp_desktop_selection(desktop); + Inkscape::Selection* sel = desktop->getSelection(); if (sel->isEmpty()){ char *msg = _("Select a path to define the curves of a glyph"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 187e31233..df20adc61 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -122,7 +122,7 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr ) if ( gr ) { bool shown = false; if ( desktop && desktop->doc() ) { - Inkscape::Selection *selection = sp_desktop_selection( desktop ); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); if (items) { SPStyle *query = sp_style_new( desktop->doc() ); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 0f4a6f7f1..0cbe41f78 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -419,7 +419,7 @@ SPItem *TextEdit::getSelectedTextItem (void) if (!SP_ACTIVE_DESKTOP) return NULL; - for (const GSList *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList(); + for (const GSList *item = SP_ACTIVE_DESKTOP->getSelection()->itemList(); item != NULL; item = item->next) { @@ -438,7 +438,7 @@ unsigned TextEdit::getSelectedTextCount (void) unsigned int items = 0; - for (const GSList *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList(); + for (const GSList *item = SP_ACTIVE_DESKTOP->getSelection()->itemList(); item != NULL; item = item->next) { @@ -543,7 +543,7 @@ void TextEdit::onApply() SPDesktop *desktop = SP_ACTIVE_DESKTOP; unsigned items = 0; - const GSList *item_list = sp_desktop_selection(desktop)->itemList(); + const GSList *item_list = desktop->getSelection()->itemList(); SPCSSAttr *css = fillTextStyle (); sp_desktop_set_style(desktop, css, true); @@ -569,7 +569,7 @@ void TextEdit::onApply() } else if (items == 1) { // exactly one text object; now set its text, too - SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); if (SP_IS_TEXT (item) || SP_IS_FLOWTEXT(item)) { updateObjectText (item); } diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 2c6692777..1dba31e5a 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -25,6 +25,7 @@ #include "document.h" #include "document-undo.h" +#include "desktop.h" #include "desktop-handles.h" #include "transformation.h" #include "align-and-distribute.h" @@ -578,7 +579,7 @@ void Transformation::onSwitchPage(Gtk::Widget * /*page*/, guint pagenum) void Transformation::onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum) #endif { - updateSelection((PageType)pagenum, sp_desktop_selection(getDesktop())); + updateSelection((PageType)pagenum, getDesktop()->getSelection()); } diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index 7ab6c78ba..7105e2cda 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -360,7 +360,7 @@ void XmlTree::set_tree_desktop(SPDesktop *desktop) } current_desktop = desktop; if (desktop) { - sel_changed_connection = sp_desktop_selection(desktop)->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed))); + sel_changed_connection = desktop->getSelection()->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed))); document_replaced_connection = desktop->connectDocumentReplaced(sigc::mem_fun(this, &XmlTree::on_document_replaced)); set_tree_document(sp_desktop_document(desktop)); @@ -472,7 +472,7 @@ Inkscape::XML::Node *XmlTree::get_dt_select() if (!current_desktop) { return NULL; } - return sp_desktop_selection(current_desktop)->singleRepr(); + return current_desktop->getSelection()->singleRepr(); } @@ -483,7 +483,7 @@ void XmlTree::set_dt_select(Inkscape::XML::Node *repr) return; } - Inkscape::Selection *selection = sp_desktop_selection(current_desktop); + Inkscape::Selection *selection = current_desktop->getSelection(); SPObject *object; if (repr) { @@ -827,7 +827,7 @@ void XmlTree::on_document_replaced(SPDesktop *dt, SPDocument *doc) if (current_desktop) sel_changed_connection.disconnect(); - sel_changed_connection = sp_desktop_selection(dt)->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed))); + sel_changed_connection = dt->getSelection()->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed))); set_tree_document(doc); } diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 6bc94ab7a..0649da3df 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1232,7 +1232,7 @@ sp_ui_drag_data_received(GtkWidget *widget, SPObject *new_obj = NULL; new_obj = desktop->currentLayer()->appendChildRepr(newgroup); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection->set(SP_ITEM(new_obj)); // move to mouse pointer diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index 9c3195a42..5fe03cf8e 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -109,11 +109,11 @@ void ArcTool::selection_changed(Inkscape::Selection* selection) { void ArcTool::setup() { ToolBase::setup(); - Inkscape::Selection *selection = sp_desktop_selection(this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); this->shape_editor = new ShapeEditor(this->desktop); - SPItem *item = sp_desktop_selection(this->desktop)->singleItem(); + SPItem *item = this->desktop->getSelection()->singleItem(); if (item) { this->shape_editor->set_item(item); } @@ -151,7 +151,7 @@ bool ArcTool::item_handler(SPItem* item, GdkEvent* event) { bool ArcTool::root_handler(GdkEvent* event) { static bool dragging; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -442,7 +442,7 @@ void ArcTool::finishItem() { desktop->canvas->endForcedFullRedraws(); - sp_desktop_selection(desktop)->set(this->arc); + desktop->getSelection()->set(this->arc); DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, _("Create ellipse")); @@ -451,7 +451,7 @@ void ArcTool::finishItem() { } void ArcTool::cancel() { - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0); if (this->arc != NULL) { diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 0a20a0842..20751381d 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -145,13 +145,13 @@ void Box3dTool::setup() { this->shape_editor = new ShapeEditor(this->desktop); - SPItem *item = sp_desktop_selection(this->desktop)->singleItem(); + SPItem *item = this->desktop->getSelection()->singleItem(); if (item) { this->shape_editor->set_item(item); } this->sel_changed_connection.disconnect(); - this->sel_changed_connection = sp_desktop_selection(this->desktop)->connectChanged( + this->sel_changed_connection = this->desktop->getSelection()->connectChanged( sigc::mem_fun(this, &Box3dTool::selection_changed) ); @@ -196,7 +196,7 @@ bool Box3dTool::root_handler(GdkEvent* event) { static bool dragging; SPDocument *document = sp_desktop_document (desktop); - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); @@ -466,7 +466,7 @@ bool Box3dTool::root_handler(GdkEvent* event) { break; case GDK_KEY_Escape: - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); //TODO: make dragging escapable by Esc break; @@ -604,7 +604,7 @@ void Box3dTool::finishItem() { desktop->canvas->endForcedFullRedraws(); - sp_desktop_selection(desktop)->set(this->box3d); + desktop->getSelection()->set(this->box3d); DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX, _("Create 3D box")); diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index d297fe5e1..97ac3d112 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -506,7 +506,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) { if (event->motion.state & GDK_CONTROL_MASK) { // hatching - sense the item - SPItem *selected = sp_desktop_selection(desktop)->singleItem(); + SPItem *selected = desktop->getSelection()->singleItem(); if (selected && (SP_IS_SHAPE(selected) || SP_IS_TEXT(selected))) { // One item selected, and it's a path; // let's try to track it as a guide @@ -940,14 +940,14 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) { g_free(str); if (unionize) { - sp_desktop_selection(desktop)->add(this->repr); - sp_selected_path_union_skip_undo(sp_desktop_selection(desktop), desktop); + desktop->getSelection()->add(this->repr); + sp_selected_path_union_skip_undo(desktop->getSelection(), desktop); } else if (subtract) { - sp_desktop_selection(desktop)->add(this->repr); - sp_selected_path_diff_skip_undo(sp_desktop_selection(desktop), desktop); + desktop->getSelection()->add(this->repr); + sp_selected_path_diff_skip_undo(desktop->getSelection(), desktop); } else { if (this->keep_selected) { - sp_desktop_selection(desktop)->set(this->repr); + desktop->getSelection()->set(this->repr); } } diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 23450fcbd..38a9017d1 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -223,7 +223,7 @@ ConnectorTool::~ConnectorTool() { void ConnectorTool::setup() { ToolBase::setup(); - this->selection = sp_desktop_selection(this->desktop); + this->selection = this->desktop->getSelection(); this->sel_changed_connection.disconnect(); this->sel_changed_connection = this->selection->connectChanged( @@ -1311,7 +1311,7 @@ void cc_selection_set_avoid(bool const set_avoid) SPDocument *document = sp_desktop_document(desktop); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList *l = const_cast(selection->itemList()); diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index 6c55f7484..56bd1598b 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -328,7 +328,7 @@ bool DropperTool::root_handler(GdkEvent* event) { gdk_window_set_cursor(window, cursor_dropper_stroke); } - if (!(sp_desktop_selection(desktop)->isEmpty())) { + if (!(desktop->getSelection()->isEmpty())) { DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER, _("Set picked color")); } @@ -359,7 +359,7 @@ bool DropperTool::root_handler(GdkEvent* event) { break; case GDK_KEY_Escape: - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); case GDK_KEY_Shift_L: case GDK_KEY_Shift_R: if (!desktop->isWaitingCursor() && !prefs->getBool("/tools/dropper/onetimepick", false)) { diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index bf4015b4c..b8d008421 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -666,7 +666,7 @@ void EraserTool::set_to_accumulated() { if ( this->repr ) { bool wasSelection = false; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0; diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 5745fc9cc..339ff1c72 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -128,13 +128,13 @@ void FloodTool::setup() { this->shape_editor = new ShapeEditor(this->desktop); - SPItem *item = sp_desktop_selection(this->desktop)->singleItem(); + SPItem *item = this->desktop->getSelection()->singleItem(); if (item) { this->shape_editor->set_item(item); } this->sel_changed_connection.disconnect(); - this->sel_changed_connection = sp_desktop_selection(this->desktop)->connectChanged( + this->sel_changed_connection = this->desktop->getSelection()->connectChanged( sigc::mem_fun(this, &FloodTool::selection_changed) ); @@ -467,7 +467,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto g_free(affinestr); } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); pathRepr->setPosition(-1); @@ -476,7 +476,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto ngettext("Area filled, path with %d node created and unioned with selection.","Area filled, path with %d nodes created and unioned with selection.", SP_PATH(reprobj)->nodesInPath()), SP_PATH(reprobj)->nodesInPath() ); selection->add(reprobj); - sp_selected_path_union_skip_undo(sp_desktop_selection(desktop), desktop); + sp_selected_path_union_skip_undo(desktop->getSelection(), desktop); } else { desktop->messageStack()->flashF( Inkscape::WARNING_MESSAGE, ngettext("Area filled, path with %d node created.","Area filled, path with %d nodes created.", @@ -1229,7 +1229,7 @@ void FloodTool::finishItem() { desktop->canvas->endForcedFullRedraws(); - sp_desktop_selection(desktop)->set(this->item); + desktop->getSelection()->set(this->item); DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 32702a17e..95cb112fb 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -117,7 +117,7 @@ FreehandBase::~FreehandBase() { void FreehandBase::setup() { ToolBase::setup(); - this->selection = sp_desktop_selection(desktop); + this->selection = desktop->getSelection(); // Connect signals to track selection changes this->sel_changed_connection = this->selection->connectChanged( @@ -500,7 +500,7 @@ void spdc_endpoint_snap_free(ToolBase const * const ec, Geom::Point& p, boost::o { SPDesktop *dt = ec->desktop; SnapManager &m = dt->namedview->snap_manager; - Inkscape::Selection *selection = sp_desktop_selection (dt); + Inkscape::Selection *selection = dt->getSelection(); // selection->singleItem() is the item that is currently being drawn. This item will not be snapped to (to avoid self-snapping) // TODO: Allow snapping to the stationary parts of the item, and only ignore the last segment @@ -715,7 +715,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) // results in the tool losing all of the selected path's curve except that last subpath. To // fix this, we force the selection_modified callback now, to make sure the tool's curve is // in sync immediately. - spdc_selection_modified(sp_desktop_selection(desktop), 0, dc); + spdc_selection_modified(desktop->getSelection(), 0, dc); } c->unref(); @@ -862,7 +862,7 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width); item->updateRepr(); - sp_desktop_selection(desktop)->set(item); + desktop->getSelection()->set(item); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot")); DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot")); diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index 9c853917e..fe8774ace 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -112,7 +112,7 @@ void GradientTool::selection_changed(Inkscape::Selection*) { GradientTool *rc = (GradientTool *) this; GrDrag *drag = rc->_grdrag; - Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(rc)->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); if (selection == NULL) { return; } @@ -167,7 +167,7 @@ void GradientTool::setup() { } this->enableGrDrag(); - Inkscape::Selection *selection = sp_desktop_selection(this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); this->selcon = new sigc::connection(selection->connectChanged( sigc::mem_fun(this, &GradientTool::selection_changed) @@ -475,7 +475,7 @@ sp_gradient_context_add_stop_near_point (GradientTool *rc, SPItem *item, Geom:: bool GradientTool::root_handler(GdkEvent* event) { static bool dragging; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -892,7 +892,7 @@ bool GradientTool::root_handler(GdkEvent* event) { static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*state*/, guint32 etime) { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPDocument *document = sp_desktop_document(desktop); ToolBase *ec = SP_EVENT_CONTEXT(&rc); diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 1fd1ebf8c..408116389 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -110,7 +110,7 @@ LpeTool::~LpeTool() { void LpeTool::setup() { PenTool::setup(); - Inkscape::Selection *selection = sp_desktop_selection (this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); SPItem *item = selection->singleItem(); this->sel_changed_connection.disconnect(); @@ -164,7 +164,7 @@ bool LpeTool::item_handler(SPItem* item, GdkEvent* event) { case GDK_BUTTON_PRESS: { // select the clicked item but do nothing else - Inkscape::Selection * const selection = sp_desktop_selection(this->desktop); + Inkscape::Selection * const selection = this->desktop->getSelection(); selection->clear(); selection->add(item); ret = TRUE; @@ -186,7 +186,7 @@ bool LpeTool::item_handler(SPItem* item, GdkEvent* event) { } bool LpeTool::root_handler(GdkEvent* event) { - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); bool ret = false; @@ -305,7 +305,7 @@ int lpetool_item_has_construction(LpeTool */*lc*/, SPItem *item) bool lpetool_try_construction(LpeTool *lc, Inkscape::LivePathEffect::EffectType const type) { - Inkscape::Selection *selection = sp_desktop_selection(lc->desktop); + Inkscape::Selection *selection = lc->desktop->getSelection(); SPItem *item = selection->singleItem(); // TODO: should we check whether type represents a valid geometric construction? @@ -396,7 +396,7 @@ void lpetool_create_measuring_items(LpeTool *lc, Inkscape::Selection *selection) { if (!selection) { - selection = sp_desktop_selection(lc->desktop); + selection = lc->desktop->getSelection(); } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool show = prefs->getBool("/tools/lpetool/show_measuring_info", true); diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 8a1fb7c72..79a0bb8f2 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -107,7 +107,7 @@ const gchar *ms_handle_descr [] = { void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) { GrDrag *drag = this->_grdrag; - Inkscape::Selection *selection = sp_desktop_selection(this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); if (selection == NULL) { return; @@ -234,7 +234,7 @@ void MeshTool::setup() { } this->enableGrDrag(); - Inkscape::Selection *selection = sp_desktop_selection(this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); this->selcon = new sigc::connection(selection->connectChanged( sigc::mem_fun(this, &MeshTool::selection_changed) @@ -440,7 +440,7 @@ Handles all keyboard and mouse input for meshs. bool MeshTool::root_handler(GdkEvent* event) { static bool dragging; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -933,7 +933,7 @@ bool MeshTool::root_handler(GdkEvent* event) { static void sp_mesh_drag(MeshTool &rc, Geom::Point const /*pt*/, guint /*state*/, guint32 /*etime*/) { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPDocument *document = sp_desktop_document(desktop); ToolBase *ec = SP_EVENT_CONTEXT(&rc); diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 838c2a884..6a2a780f1 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -215,7 +215,7 @@ void NodeTool::setup() { data.node_data.node_group = create_control_group(this->desktop); data.node_data.handle_group = create_control_group(this->desktop); - Inkscape::Selection *selection = sp_desktop_selection (this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); this->_selection_changed_connection.disconnect(); this->_selection_changed_connection = @@ -295,7 +295,7 @@ void NodeTool::setup() { // show helper paths of the applied LPE, if any void NodeTool::update_helperpath () { - Inkscape::Selection *selection = sp_desktop_selection (this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); if (this->helperpath_tmpitem) { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 6b38020a4..7a403eef7 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -468,7 +468,7 @@ bool PenTool::_handleButtonPress(GdkEventButton const &bevent) { // This is the first click of a new curve; deselect item so that // this curve is not combined with it (unless it is drawn from its // anchor, which is handled by the sibling branch above) - Inkscape::Selection * const selection = sp_desktop_selection(desktop); + Inkscape::Selection * const selection = desktop->getSelection(); if (!(bevent.state & GDK_SHIFT_MASK) || this->hasWaitingLPE()) { // if we have a waiting LPE, we need a fresh path to be created // so don't append to an existing one @@ -850,7 +850,7 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) { if (this->expecting_clicks_for_LPE == 0 && this->hasWaitingLPE()) { this->setPolylineMode(); - Inkscape::Selection *selection = sp_desktop_selection(this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); if (this->waiting_LPE) { // we have an already created LPE waiting for a path @@ -2281,7 +2281,7 @@ void PenTool::_setToNearestHorizVert(Geom::Point &pt, guint const state, bool sn // Snap along the constraint line; if we didn't snap then still the constraint will be applied SnapManager &m = this->desktop->namedview->snap_manager; - Inkscape::Selection *selection = sp_desktop_selection (this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); // selection->singleItem() is the item that is currently being drawn. This item will not be snapped to (to avoid self-snapping) // TODO: Allow snapping to the stationary parts of the item, and only ignore the last segment diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 3ea2ae843..d938105ef 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -153,7 +153,7 @@ bool PencilTool::_handleButtonPress(GdkEventButton const &bevent) { bool ret = false; if ( bevent.button == 1 && !this->space_panning) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (Inkscape::have_viable_layer(desktop, this->message_context) == false) { return true; diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 67df0d9a5..69dfad025 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -111,13 +111,13 @@ void RectTool::setup() { this->shape_editor = new ShapeEditor(this->desktop); - SPItem *item = sp_desktop_selection(this->desktop)->singleItem(); + SPItem *item = this->desktop->getSelection()->singleItem(); if (item) { this->shape_editor->set_item(item); } this->sel_changed_connection.disconnect(); - this->sel_changed_connection = sp_desktop_selection(this->desktop)->connectChanged( + this->sel_changed_connection = this->desktop->getSelection()->connectChanged( sigc::mem_fun(this, &RectTool::selection_changed) ); @@ -170,7 +170,7 @@ bool RectTool::root_handler(GdkEvent* event) { static bool dragging; SPDesktop *desktop = this->desktop; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -476,7 +476,7 @@ void RectTool::finishItem() { this->desktop->canvas->endForcedFullRedraws(); - sp_desktop_selection(this->desktop)->set(this->rect); + this->desktop->getSelection()->set(this->rect); DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_RECT, _("Create rectangle")); @@ -485,7 +485,7 @@ void RectTool::finishItem() { } void RectTool::cancel(){ - sp_desktop_selection(this->desktop)->clear(); + this->desktop->getSelection()->clear(); sp_canvas_item_ungrab(SP_CANVAS_ITEM(this->desktop->acetate), 0); if (this->rect != NULL) { diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index a8267ea1d..6501ec3cc 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -272,7 +272,7 @@ sp_select_context_up_one_layer(SPDesktop *desktop) { desktop->setCurrentLayer(parent); if (current_group && (SPGroup::LAYER != current_group->layerMode())) { - sp_desktop_selection(desktop)->set(current_layer); + desktop->getSelection()->set(current_layer); } } } @@ -469,7 +469,7 @@ bool SelectTool::root_handler(GdkEvent* event) { SPItem *item_at_point = NULL, *group_at_point = NULL, *item_in_group = NULL; gint ret = FALSE; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // make sure we still have valid objects to move around @@ -485,7 +485,7 @@ bool SelectTool::root_handler(GdkEvent* event) { if (dynamic_cast(clicked_item) && !dynamic_cast(clicked_item)) { // enter group if it's not a 3D box desktop->setCurrentLayer(clicked_item); - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); this->dragging = false; sp_event_context_discard_delayed_snap_event(this); @@ -974,15 +974,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(sp_desktop_selection(desktop), mul*-10, 0); // shift + sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift } else { - sp_selection_move_screen(sp_desktop_selection(desktop), mul*-1, 0); // no shift + sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(sp_desktop_selection(desktop), mul*-10*nudge, 0); // shift + sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift } else { - sp_selection_move(sp_desktop_selection(desktop), mul*-nudge, 0); // no shift + sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift } } @@ -997,15 +997,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(sp_desktop_selection(desktop), 0, mul*10); // shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift } else { - sp_selection_move_screen(sp_desktop_selection(desktop), 0, mul*1); // no shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(sp_desktop_selection(desktop), 0, mul*10*nudge); // shift + sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift } else { - sp_selection_move(sp_desktop_selection(desktop), 0, mul*nudge); // no shift + sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift } } @@ -1020,15 +1020,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(sp_desktop_selection(desktop), mul*10, 0); // shift + sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift } else { - sp_selection_move_screen(sp_desktop_selection(desktop), mul*1, 0); // no shift + sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(sp_desktop_selection(desktop), mul*10*nudge, 0); // shift + sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift } else { - sp_selection_move(sp_desktop_selection(desktop), mul*nudge, 0); // no shift + sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift } } @@ -1043,15 +1043,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(sp_desktop_selection(desktop), 0, mul*-10); // shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift } else { - sp_selection_move_screen(sp_desktop_selection(desktop), 0, mul*-1); // no shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(sp_desktop_selection(desktop), 0, mul*-10*nudge); // shift + sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift } else { - sp_selection_move(sp_desktop_selection(desktop), 0, mul*-nudge); // no shift + sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift } } @@ -1155,7 +1155,7 @@ bool SelectTool::root_handler(GdkEvent* event) { SPGroup *clickedGroup = dynamic_cast(clicked_item); if ( (clickedGroup && (clickedGroup->layerMode() != SPGroup::LAYER)) || dynamic_cast(clicked_item)) { // enter group or a 3D box desktop->setCurrentLayer(clicked_item); - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); } else { this->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Selected object is not a group. Cannot enter.")); } diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp index 31c4e8829..7b11b8469 100644 --- a/src/ui/tools/spiral-tool.cpp +++ b/src/ui/tools/spiral-tool.cpp @@ -117,12 +117,12 @@ void SpiralTool::setup() { this->shape_editor = new ShapeEditor(this->desktop); - SPItem *item = sp_desktop_selection(this->desktop)->singleItem(); + SPItem *item = this->desktop->getSelection()->singleItem(); if (item) { this->shape_editor->set_item(item); } - Inkscape::Selection *selection = sp_desktop_selection(this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); this->sel_changed_connection.disconnect(); this->sel_changed_connection = selection->connectChanged(sigc::mem_fun(this, &SpiralTool::selection_changed)); @@ -154,7 +154,7 @@ bool SpiralTool::root_handler(GdkEvent* event) { static gboolean dragging; SPDesktop *desktop = this->desktop; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -417,7 +417,7 @@ void SpiralTool::finishItem() { this->desktop->canvas->endForcedFullRedraws(); - sp_desktop_selection(this->desktop)->set(this->spiral); + this->desktop->getSelection()->set(this->spiral); DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_SPIRAL, _("Create spiral")); this->spiral = NULL; @@ -425,7 +425,7 @@ void SpiralTool::finishItem() { } void SpiralTool::cancel() { - sp_desktop_selection(this->desktop)->clear(); + this->desktop->getSelection()->clear(); sp_canvas_item_ungrab(SP_CANVAS_ITEM(this->desktop->acetate), 0); if (this->spiral != NULL) { diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index cdc608558..c36b77fb7 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -527,7 +527,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point p, Geom::Point vector, bool reverse) { SPDesktop *desktop = tc->desktop; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { return false; diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp index b5544d263..a5e46e5b7 100644 --- a/src/ui/tools/star-tool.cpp +++ b/src/ui/tools/star-tool.cpp @@ -127,12 +127,12 @@ void StarTool::setup() { this->shape_editor = new ShapeEditor(this->desktop); - SPItem *item = sp_desktop_selection(this->desktop)->singleItem(); + SPItem *item = this->desktop->getSelection()->singleItem(); if (item) { this->shape_editor->set_item(item); } - Inkscape::Selection *selection = sp_desktop_selection(this->desktop); + Inkscape::Selection *selection = this->desktop->getSelection(); this->sel_changed_connection.disconnect(); @@ -168,7 +168,7 @@ bool StarTool::root_handler(GdkEvent* event) { static bool dragging; SPDesktop *desktop = this->desktop; - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -441,7 +441,7 @@ void StarTool::finishItem() { desktop->canvas->endForcedFullRedraws(); - sp_desktop_selection(desktop)->set(this->star); + desktop->getSelection()->set(this->star); DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, _("Create star")); @@ -450,7 +450,7 @@ void StarTool::finishItem() { } void StarTool::cancel() { - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0); if (this->star != NULL) { diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 578add843..e9fe45165 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -175,15 +175,15 @@ void TextTool::setup() { this->shape_editor = new ShapeEditor(this->desktop); - SPItem *item = sp_desktop_selection(this->desktop)->singleItem(); + SPItem *item = this->desktop->getSelection()->singleItem(); if (item && SP_IS_FLOWTEXT(item) && SP_FLOWTEXT(item)->has_internal_frame()) { this->shape_editor->set_item(item); } - this->sel_changed_connection = sp_desktop_selection(desktop)->connectChangedFirst( + this->sel_changed_connection = desktop->getSelection()->connectChangedFirst( sigc::mem_fun(*this, &TextTool::_selectionChanged) ); - this->sel_modified_connection = sp_desktop_selection(desktop)->connectModifiedFirst( + this->sel_modified_connection = desktop->getSelection()->connectModifiedFirst( sigc::mem_fun(*this, &TextTool::_selectionModified) ); this->style_set_connection = desktop->connectSetStyle( @@ -193,7 +193,7 @@ void TextTool::setup() { sigc::mem_fun(*this, &TextTool::_styleQueried) ); - _selectionChanged(sp_desktop_selection(desktop)); + _selectionChanged(desktop->getSelection()); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/tools/text/selcue")) { @@ -268,7 +268,7 @@ bool TextTool::item_handler(SPItem* item, GdkEvent* event) { // find out clicked item, disregarding groups item_ungrouped = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE); if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) { - sp_desktop_selection(desktop)->set(item_ungrouped); + desktop->getSelection()->set(item_ungrouped); if (this->text) { // find out click point in document coordinates Geom::Point p = desktop->w2d(Geom::Point(event->button.x, event->button.y)); @@ -425,7 +425,7 @@ static void sp_text_context_setup_text(TextTool *tc) SPItem *text_item = SP_ITEM(ec->desktop->currentLayer()->appendChildRepr(rtext)); /* fixme: Is selection::changed really immediate? */ /* yes, it's immediate .. why does it matter? */ - sp_desktop_selection(ec->desktop)->set(text_item); + ec->desktop->getSelection()->set(text_item); Inkscape::GC::release(rtext); text_item->transform = SP_ITEM(ec->desktop->currentLayer())->i2doc_affine().inverse(); @@ -627,7 +627,7 @@ bool TextTool::root_handler(GdkEvent* event) { if (this->creating && this->within_tolerance) { /* Button 1, set X & Y & new item */ - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); this->pdoc = desktop->dt2doc(p1); this->show = TRUE; this->phase = 1; @@ -660,7 +660,7 @@ bool TextTool::root_handler(GdkEvent* event) { SPItem *ft = create_flowtext_with_internal_frame (desktop, this->p0, p1); /* Set style */ sp_desktop_apply_style_tool(desktop, ft->getRepr(), "/tools/text", true); - sp_desktop_selection(desktop)->set(ft); + desktop->getSelection()->set(ft); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Flowed text is created.")); DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Create flowed text")); } else { @@ -1117,7 +1117,7 @@ bool TextTool::root_handler(GdkEvent* event) { } Inkscape::Rubberband::get(desktop)->stop(); } else { - sp_desktop_selection(desktop)->clear(); + desktop->getSelection()->clear(); } this->nascent_object = FALSE; return TRUE; diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 37ca5eeea..d0ce18ee3 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -1083,7 +1083,7 @@ void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event) /* fixme: This is not what I want but works for now (Lauris) */ if (event->type == GDK_KEY_PRESS) { - item = sp_desktop_selection(desktop)->singleItem(); + item = desktop->getSelection()->singleItem(); } ContextMenu* CM = new ContextMenu(desktop, item); diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index f56975de2..c3601138d 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -1032,7 +1032,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, static bool sp_tweak_dilate (TweakTool *tc, Geom::Point event_p, Geom::Point p, Geom::Point vector, bool reverse) { - Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(tc)->desktop); + Inkscape::Selection *selection = tc->desktop->getSelection(); SPDesktop *desktop = SP_EVENT_CONTEXT(tc)->desktop; if (selection->isEmpty()) { diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index c96eac838..39aa6c584 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -33,6 +33,7 @@ #include "panel.h" #include "icon-size.h" #include "preferences.h" +#include "desktop.h" #include "desktop-handles.h" #include "inkscape.h" #include "widgets/eek-preview.h" @@ -667,7 +668,7 @@ void Panel::_handleResponse(int response_id) Inkscape::Selection *Panel::_getSelection() { - return sp_desktop_selection(_desktop); + return _desktop->getSelection(); } } // namespace Widget diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index aebef2c4e..ec3194478 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -480,7 +480,7 @@ SelectedStyle::setDesktop(SPDesktop *desktop) _desktop = desktop; g_object_set_data (G_OBJECT(_opacity_sb.gobj()), "dtw", _desktop->canvas); - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); selection_changed_connection = new sigc::connection (selection->connectChanged( sigc::bind ( diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index d9bf7e2aa..1646b0fed 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -49,7 +49,7 @@ StyleSubject::Selection::~Selection() { Inkscape::Selection *StyleSubject::Selection::_getSelection() const { SPDesktop *desktop = getDesktop(); if (desktop) { - return sp_desktop_selection(desktop); + return desktop->getSelection(); } else { return NULL; } @@ -88,7 +88,7 @@ void StyleSubject::Selection::_afterDesktopSwitch(SPDesktop *desktop) { _sel_modified.disconnect(); if (desktop) { _subsel_changed = desktop->connectToolSubselectionChanged(sigc::hide(sigc::mem_fun(*this, &Selection::_emitChanged))); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (selection) { _sel_changed = selection->connectChanged(sigc::hide(sigc::mem_fun(*this, &Selection::_emitChanged))); _sel_modified = selection->connectModified(sigc::hide(sigc::hide(sigc::mem_fun(*this, &Selection::_emitChanged)))); diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index 1ddba7bdb..d041973a3 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -110,7 +110,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g for (std::set::iterator vp = sel_vps.begin(); vp != sel_vps.end(); ++vp) { // for each VP that has selected boxes: Persp3D *old_persp = (*vp)->get_perspective(); - sel_boxes = (*vp)->selectedBoxes(sp_desktop_selection(SP_ACTIVE_DESKTOP)); + sel_boxes = (*vp)->selectedBoxes(SP_ACTIVE_DESKTOP->getSelection()); // we create a new perspective ... Persp3D *new_persp = persp3d_create_xml_element (dragger->parent->document, old_persp->perspective_impl); @@ -394,7 +394,7 @@ VPDragger::VPsOfSelectedBoxes() { std::set sel_vps; VanishingPoint *vp; // FIXME: Should we take the selection from the parent VPDrag? I guess it shouldn't make a difference. - Inkscape::Selection *sel = sp_desktop_selection(SP_ACTIVE_DESKTOP); + Inkscape::Selection *sel = SP_ACTIVE_DESKTOP->getSelection(); for (GSList const* i = sel->itemList(); i != NULL; i = i->next) { SPItem *item = static_cast(i->data); SPBox3D *box = dynamic_cast(item); @@ -488,7 +488,7 @@ VPDragger::printVPs() { VPDrag::VPDrag (SPDocument *document) { this->document = document; - this->selection = sp_desktop_selection(SP_ACTIVE_DESKTOP); + this->selection = SP_ACTIVE_DESKTOP->getSelection(); this->draggers = NULL; this->lines = NULL; diff --git a/src/verbs.cpp b/src/verbs.cpp index bafb6f89b..4d212f0fc 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1396,7 +1396,7 @@ void LayerVerb::perform(SPAction *action, void *data) } case SP_VERB_LAYER_DELETE: { if ( dt->currentLayer() != dt->currentRoot() ) { - sp_desktop_selection(dt)->clear(); + dt->getSelection()->clear(); SPObject *old_layer=dt->currentLayer(); sp_object_ref(old_layer, NULL); @@ -1592,10 +1592,6 @@ void TagVerb::perform( SPAction *action, void *data) if (!dt) return; - //Inkscape::UI::Tools::ToolBase *ec = dt->event_context; - - Inkscape::Selection *sel = sp_desktop_selection(dt); - Inkscape::XML::Document * doc; Inkscape::XML::Node * repr; gchar *id; diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index ca582924b..6dba44add 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -97,7 +97,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v gchar* namespaced_name = g_strconcat("sodipodi:", value_name, NULL); bool modmade = false; - for (GSList const *items = sp_desktop_selection(desktop)->itemList(); + for (GSList const *items = desktop->getSelection()->itemList(); items != NULL; items = items->next) { @@ -166,7 +166,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) bool modmade = false; if ( ege_select_one_action_get_active(act) != 0 ) { - for (GSList const *items = sp_desktop_selection(desktop)->itemList(); + for (GSList const *items = desktop->getSelection()->itemList(); items != NULL; items = items->next) { @@ -179,7 +179,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) } } } else { - for (GSList const *items = sp_desktop_selection(desktop)->itemList(); + for (GSList const *items = desktop->getSelection()->itemList(); items != NULL; items = items->next) { @@ -413,8 +413,8 @@ static void arc_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBa static sigc::connection changed; if (SP_IS_ARC_CONTEXT(ec)) { - changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_arc_toolbox_selection_changed), holder)); - sp_arc_toolbox_selection_changed(sp_desktop_selection(desktop), holder); + changed = desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_arc_toolbox_selection_changed), holder)); + sp_arc_toolbox_selection_changed(desktop->getSelection(), holder); } else { if (changed) changed.disconnect(); diff --git a/src/widgets/box3d-toolbar.cpp b/src/widgets/box3d-toolbar.cpp index 4cc2976f8..3181e345b 100644 --- a/src/widgets/box3d-toolbar.cpp +++ b/src/widgets/box3d-toolbar.cpp @@ -218,7 +218,7 @@ static void box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, P // in turn, prevent listener from responding g_object_set_data(dataKludge, "freeze", GINT_TO_POINTER(TRUE)); - std::list sel_persps = sp_desktop_selection(desktop)->perspList(); + std::list sel_persps = desktop->getSelection()->perspList(); if (sel_persps.empty()) { // this can happen when the document is created; we silently ignore it return; @@ -255,7 +255,7 @@ static void box3d_angle_z_value_changed(GtkAdjustment *adj, GObject *dataKludge) static void box3d_vp_state_changed( GtkToggleAction *act, GtkAction * /*box3d_angle*/, Proj::Axis axis ) { // TODO: Take all selected perspectives into account - std::list sel_persps = sp_desktop_selection(SP_ACTIVE_DESKTOP)->perspList(); + std::list sel_persps = SP_ACTIVE_DESKTOP->getSelection()->perspList(); if (sel_persps.empty()) { // this can happen when the document is created; we silently ignore it return; @@ -420,8 +420,8 @@ static void box3d_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::Tool { static sigc::connection changed; if (SP_IS_BOX3D_CONTEXT(ec)) { - changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), holder)); - box3d_toolbox_selection_changed(sp_desktop_selection(desktop), holder); + changed = desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), holder)); + box3d_toolbox_selection_changed(desktop->getSelection(), holder); } else { if (changed) changed.disconnect(); diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp index 6ce926dc1..915d1e629 100644 --- a/src/widgets/connector-toolbar.cpp +++ b/src/widgets/connector-toolbar.cpp @@ -76,7 +76,7 @@ static void sp_connector_path_set_ignore(void) static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl ) { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); - Inkscape::Selection * selection = sp_desktop_selection(desktop); + Inkscape::Selection * selection = desktop->getSelection(); SPDocument *doc = sp_desktop_document(desktop); if (!DocumentUndo::getUndoSensitive(doc)) { @@ -126,7 +126,7 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); - Inkscape::Selection * selection = sp_desktop_selection(desktop); + Inkscape::Selection * selection = desktop->getSelection(); SPDocument *doc = sp_desktop_document(desktop); if (!DocumentUndo::getUndoSensitive(doc)) { @@ -233,7 +233,7 @@ static void sp_connector_graph_layout(void) int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); - graphlayout(sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList()); + graphlayout(SP_ACTIVE_DESKTOP->getSelection()->itemList()); prefs->setInt("/options/clonecompensation/value", saved_compensation); @@ -402,7 +402,7 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act), ( tbuttonstate ? TRUE : FALSE )); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_directed_graph_layout_toggled), holder ); - sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_connector_toolbox_selection_changed), holder)); + desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_connector_toolbox_selection_changed), holder)); } // Avoid overlaps toggle button diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index d1d318abe..ead88ddf6 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -481,7 +481,7 @@ void FillNStroke::updateFromPaint() update = true; SPDocument *document = sp_desktop_document(desktop); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index b6378b251..1968f87da 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -356,7 +356,7 @@ static void gr_tb_selection_changed(Inkscape::Selection * /*selection*/, gpointe return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); // take from desktop, not from args + Inkscape::Selection *selection = desktop->getSelection(); // take from desktop, not from args if (selection) { ToolBase *ev = desktop->getEventContext(); GrDrag *drag = NULL; @@ -560,7 +560,7 @@ static void gr_add_stop(GtkWidget * /*button*/, GtkWidget *vb) return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); if (!selection) { return; } @@ -582,7 +582,7 @@ static void gr_remove_stop(GtkWidget * /*button*/, GtkWidget *vb) return; } - Inkscape::Selection *selection = sp_desktop_selection(desktop); // take from desktop, not from args + Inkscape::Selection *selection = desktop->getSelection(); // take from desktop, not from args if (!selection) { return; } @@ -918,7 +918,7 @@ static void gr_gradient_combo_changed(EgeSelectOneAction *act, gpointer data) gr = sp_gradient_ensure_vector_normalized(gr); SPDesktop *desktop = static_cast(data); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); ToolBase *ev = desktop->getEventContext(); gr_apply_gradient(selection, ev? ev->get_drag() : NULL, gr); @@ -936,7 +936,7 @@ static void gr_spread_change(EgeSelectOneAction *act, GtkWidget *widget) } SPDesktop *desktop = static_cast(g_object_get_data(G_OBJECT(widget), "desktop")); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPGradient *gradient = 0; gr_get_dt_selected_gradient(selection, gradient); @@ -1246,7 +1246,7 @@ static void gradient_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::T static sigc::connection connDefsModified; if (SP_IS_GRADIENT_CONTEXT(ec)) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPDocument *document = sp_desktop_document(desktop); // connect to selection modified and changed signals diff --git a/src/widgets/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp index c6da46956..5a7613dcc 100644 --- a/src/widgets/lpe-toolbar.cpp +++ b/src/widgets/lpe-toolbar.cpp @@ -413,9 +413,9 @@ static void lpetool_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::To if (SP_IS_LPETOOL_CONTEXT(ec)) { // Watch selection - c_selection_modified = sp_desktop_selection(desktop)->connectModified(sigc::bind(sigc::ptr_fun(sp_lpetool_toolbox_sel_modified), holder)); - c_selection_changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_lpetool_toolbox_sel_changed), holder)); - sp_lpetool_toolbox_sel_changed(sp_desktop_selection(desktop), holder); + c_selection_modified = desktop->getSelection()->connectModified(sigc::bind(sigc::ptr_fun(sp_lpetool_toolbox_sel_modified), holder)); + c_selection_changed = desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_lpetool_toolbox_sel_changed), holder)); + sp_lpetool_toolbox_sel_changed(desktop->getSelection(), holder); } else { if (c_selection_modified) c_selection_modified.disconnect(); diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp index 897d84278..8c7ec33a8 100644 --- a/src/widgets/mesh-toolbar.cpp +++ b/src/widgets/mesh-toolbar.cpp @@ -92,7 +92,7 @@ static void ms_tb_selection_changed(Inkscape::Selection * /*selection*/, gpointe // return; // } - // Inkscape::Selection *selection = sp_desktop_selection(desktop); // take from desktop, not from args + // Inkscape::Selection *selection = desktop->getSelection(); // take from desktop, not from args // if (selection) { // ToolBase *ev = sp_desktop_event_context(desktop); // GrDrag *drag = NULL; @@ -334,7 +334,7 @@ static void mesh_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB if (SP_IS_MESH_CONTEXT(ec)) { // connect to selection modified and changed signals - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPDocument *document = sp_desktop_document (desktop); c_selection_changed = selection->connectChanged(sigc::bind(sigc::ptr_fun(&ms_tb_selection_changed), holder)); diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp index 1224ab355..7bbbaf37d 100644 --- a/src/widgets/node-toolbar.cpp +++ b/src/widgets/node-toolbar.cpp @@ -614,7 +614,7 @@ void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje gtk_action_group_add_action( mainActions, act ); } - sp_node_toolbox_sel_changed(sp_desktop_selection(desktop), holder); + sp_node_toolbox_sel_changed(desktop->getSelection(), holder); desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(node_toolbox_watch_ec), holder)); } // end of sp_node_toolbox_prep() @@ -627,11 +627,11 @@ static void node_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB if (INK_IS_NODE_TOOL(ec)) { // watch selection - c_selection_changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_node_toolbox_sel_changed), holder)); - c_selection_modified = sp_desktop_selection(desktop)->connectModified(sigc::bind(sigc::ptr_fun(sp_node_toolbox_sel_modified), holder)); + c_selection_changed = desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_node_toolbox_sel_changed), holder)); + c_selection_modified = desktop->getSelection()->connectModified(sigc::bind(sigc::ptr_fun(sp_node_toolbox_sel_modified), holder)); c_subselection_changed = desktop->connectToolSubselectionChanged(sigc::bind(sigc::ptr_fun(sp_node_toolbox_coord_changed), holder)); - sp_node_toolbox_sel_changed(sp_desktop_selection(desktop), holder); + sp_node_toolbox_sel_changed(desktop->getSelection(), holder); } else { if (c_selection_changed) c_selection_changed.disconnect(); diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index 5356ebb0d..467fed4e6 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -105,7 +105,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE)); bool modmade = false; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); for (GSList const *items = selection->itemList(); items != NULL; items = items->next) { if (SP_IS_RECT(items->data)) { if (gtk_adjustment_get_value(adj) != 0) { @@ -406,7 +406,7 @@ static void rect_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB // TODO fixme: use of dynamic_cast<> seems wrong here. if (dynamic_cast(ec)) { - changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_rect_toolbox_selection_changed), holder)); + changed = desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_rect_toolbox_selection_changed), holder)); } else { if (changed) changed.disconnect(); diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index e59d459b9..985f7c22d 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -106,7 +106,7 @@ static void sp_selection_layout_widget_modify_selection(SPWidget *spw, Inkscape::Selection *selection, guint flags, gpointer data) { SPDesktop *desktop = static_cast(data); - if ((sp_desktop_selection(desktop) == selection) // only respond to changes in our desktop + if ((desktop->getSelection() == selection) // only respond to changes in our desktop && (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG ))) @@ -119,7 +119,7 @@ static void sp_selection_layout_widget_change_selection(SPWidget *spw, Inkscape::Selection *selection, gpointer data) { SPDesktop *desktop = static_cast(data); - if (sp_desktop_selection(desktop) == selection) { // only respond to changes in our desktop + if (desktop->getSelection() == selection) { // only respond to changes in our desktop gboolean setActive = (selection && !selection->isEmpty()); std::vector *contextActions = reinterpret_cast *>(g_object_get_data(G_OBJECT(spw), "contextActions")); if ( contextActions ) { @@ -153,7 +153,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(TRUE)); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); SPDocument *document = sp_desktop_document(desktop); document->ensureUpToDate (); @@ -546,7 +546,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb g_signal_connect(G_OBJECT(spw), "change_selection", G_CALLBACK(sp_selection_layout_widget_change_selection), desktop); // Update now. - sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? sp_desktop_selection(SP_ACTIVE_DESKTOP) : NULL); + sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? SP_ACTIVE_DESKTOP->getSelection() : NULL); for ( std::vector::iterator iter = contextActions->begin(); iter != contextActions->end(); ++iter) { diff --git a/src/widgets/spiral-toolbar.cpp b/src/widgets/spiral-toolbar.cpp index e85b024ed..aa9c32c1a 100644 --- a/src/widgets/spiral-toolbar.cpp +++ b/src/widgets/spiral-toolbar.cpp @@ -79,7 +79,7 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr gchar* namespaced_name = g_strconcat("sodipodi:", value_name.data(), NULL); bool modmade = false; - for (GSList const *items = sp_desktop_selection(desktop)->itemList(); + for (GSList const *items = desktop->getSelection()->itemList(); items != NULL; items = items->next) { @@ -296,7 +296,7 @@ void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb sigc::connection *connection = new sigc::connection( - sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_spiral_toolbox_selection_changed), holder)) + desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_spiral_toolbox_selection_changed), holder)) ); g_signal_connect( holder, "destroy", G_CALLBACK(delete_connection), connection ); g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder ); diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp index 6213263fc..31c67bd6f 100644 --- a/src/widgets/star-toolbar.cpp +++ b/src/widgets/star-toolbar.cpp @@ -82,7 +82,7 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu bool modmade = false; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); for (; items != NULL; items = items->next) { SPItem *item = reinterpret_cast(items->data); @@ -127,7 +127,7 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(TRUE) ); bool modmade = false; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); for (; items != NULL; items = items->next) { SPItem *item = reinterpret_cast(items->data); @@ -177,7 +177,7 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d // in turn, prevent listener from responding g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(TRUE) ); - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); GtkAction* prop_action = GTK_ACTION( g_object_get_data( dataKludge, "prop_action" ) ); bool modmade = false; @@ -223,7 +223,7 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg bool modmade = false; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); for (; items != NULL; items = items->next) { SPItem *item = reinterpret_cast(items->data); @@ -263,7 +263,7 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl bool modmade = false; - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); for (; items != NULL; items = items->next) { SPItem *item = reinterpret_cast(items->data); @@ -582,8 +582,8 @@ static void star_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB static sigc::connection changed; if (dynamic_cast(ec) != NULL) { - changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_star_toolbox_selection_changed), holder)); - sp_star_toolbox_selection_changed(sp_desktop_selection(desktop), holder); + changed = desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_star_toolbox_selection_changed), holder)); + sp_star_toolbox_selection_changed(desktop->getSelection(), holder); } else { if (changed) changed.disconnect(); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 51880ba85..ae2615fce 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -471,10 +471,10 @@ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, // Also update the marker combobox, so the document's markers // show up at the top of the combobox -// sp_stroke_style_line_update( SP_WIDGET(spw), desktop ? sp_desktop_selection(desktop) : NULL); +// sp_stroke_style_line_update( SP_WIDGET(spw), desktop ? desktop->getSelection() : NULL); //spw->updateMarkerHist(which); - Inkscape::Selection *selection = sp_desktop_selection(spw->desktop); + Inkscape::Selection *selection = spw->desktop->getSelection(); GSList const *items = selection->itemList(); for (; items != NULL; items = items->next) { SPItem *item = reinterpret_cast(items->data); @@ -810,7 +810,7 @@ StrokeStyle::updateLine() update = true; - Inkscape::Selection *sel = desktop ? sp_desktop_selection(desktop) : NULL; + Inkscape::Selection *sel = desktop ? desktop->getSelection() : NULL; FillOrStroke kind = GPOINTER_TO_INT(get_data("kind")) ? FILL : STROKE; @@ -958,7 +958,7 @@ StrokeStyle::scaleLine() update = true; SPDocument *document = sp_desktop_document (desktop); - Inkscape::Selection *selection = sp_desktop_selection (desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index d62bb8027..60ea75916 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -367,7 +367,7 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl ) SPDesktop *desktop = SP_ACTIVE_DESKTOP; // move the x of all texts to preserve the same bbox - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); for (GSList const *items = selection->itemList(); items != NULL; items = items->next) { if (SP_IS_TEXT(SP_ITEM(items->data))) { SPItem *item = SP_ITEM(items->data); @@ -521,7 +521,7 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) // Until deprecated sodipodi:linespacing purged: - Inkscape::Selection *selection = sp_desktop_selection(desktop); + Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); bool modmade = false; for (; items != NULL; items = items->next) { @@ -829,7 +829,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ std::cout << "sp_text_toolbox_selection_changed: start " << count << std::endl; std::cout << " Selected items:" << std::endl; - for (GSList const *items = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList(); + for (GSList const *items = SP_ACTIVE_DESKTOP->getSelection()->itemList(); items != NULL; items = items->next) { @@ -873,7 +873,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Only flowed text can be justified, only normal text can be kerned... // Find out if we have flowed text now so we can use it several places gboolean isFlow = false; - for (GSList const *items = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList(); + for (GSList const *items = SP_ACTIVE_DESKTOP->getSelection()->itemList(); items != NULL; items = items->next) { // const gchar* id = reinterpret_cast(items->data)->getId(); @@ -1196,7 +1196,7 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p } // Update selection - Inkscape::Selection *selection = sp_desktop_selection (desktop ); + Inkscape::Selection *selection = desktop->getSelection(); selection->clear(); //std::cout << " list length: " << g_slist_length ( selectList ) << std::endl; selection->setList(selectList); @@ -1623,7 +1623,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje } // Is this necessary to call? Shouldn't hurt. - sp_text_toolbox_selection_changed(sp_desktop_selection(desktop), holder); + sp_text_toolbox_selection_changed(desktop->getSelection(), holder); desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(text_toolbox_watch_ec), holder)); @@ -1642,8 +1642,8 @@ static void text_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB if (SP_IS_TEXT_CONTEXT(ec)) { // Watch selection - c_selection_changed = sp_desktop_selection(desktop)->connectChanged(bind(ptr_fun(sp_text_toolbox_selection_changed), holder, false)); - c_selection_modified = sp_desktop_selection (desktop)->connectModified(bind(ptr_fun(sp_text_toolbox_selection_modified), holder)); + c_selection_changed = desktop->getSelection()->connectChanged(bind(ptr_fun(sp_text_toolbox_selection_changed), holder, false)); + c_selection_modified = desktop->getSelection()->connectModified(bind(ptr_fun(sp_text_toolbox_selection_modified), holder)); c_subselection_changed = desktop->connectToolSubselectionChanged(bind(ptr_fun(sp_text_toolbox_subselection_changed), holder)); } else { if (c_selection_changed) -- cgit v1.2.3 From 6c78ab7deeea3b32791437ade35e8911e7c73c8e Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 14:58:38 -0500 Subject: Purge sp_desktop_namedview in favor of SPDesktop::getNamedView (bzr r13810) --- src/desktop-handles.cpp | 10 ---------- src/desktop-handles.h | 1 - src/live_effects/parameter/text.cpp | 1 + src/satisfied-guide-cns.cpp | 4 ++-- src/sp-text.cpp | 4 ++-- src/ui/clipboard.cpp | 2 +- src/ui/dialog/clonetiler.cpp | 2 +- src/ui/dialog/document-metadata.cpp | 10 +++++----- src/ui/dialog/document-properties.cpp | 22 +++++++++++----------- src/ui/dialog/export.cpp | 4 ++-- src/ui/dialog/transformation.cpp | 2 +- src/ui/tools/dropper-tool.cpp | 2 +- src/ui/tools/flood-tool.cpp | 2 +- src/ui/widget/page-sizer.cpp | 2 +- src/ui/widget/registered-widget.cpp | 5 ++++- src/ui/widget/registered-widget.h | 6 +++--- src/ui/widget/selected-style.cpp | 2 +- src/ui/widget/tolerance-slider.cpp | 3 ++- src/widgets/lpe-toolbar.cpp | 2 +- src/widgets/node-toolbar.cpp | 2 +- src/widgets/rect-toolbar.cpp | 6 +++--- src/widgets/select-toolbar.cpp | 2 +- src/widgets/stroke-style.cpp | 6 +++--- src/widgets/toolbox.cpp | 4 ++-- 24 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index 980e6c0e9..b0d12855a 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -102,13 +102,3 @@ sp_desktop_message_stack (SPDesktop const * desktop) return desktop->messageStack(); } - -SPNamedView * -sp_desktop_namedview (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->namedview; -} - - diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 481b9ed1f..3b14f2e92 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -55,7 +55,6 @@ SPCanvasGroup * sp_desktop_sketch (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_tempgroup (SPDesktop const * desktop); Inkscape::MessageStack * sp_desktop_message_stack (SPDesktop const * desktop); -SPNamedView * sp_desktop_namedview (SPDesktop const * desktop); #endif // SEEN_SP_DESKTOP_HANDLES_H diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index a88ac7d75..3b58a4c67 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -19,6 +19,7 @@ #include "inkscape.h" #include "verbs.h" #include "display/canvas-text.h" +#include "desktop-handles.h" #include <2geom/sbasis-geometric.h> namespace Inkscape { diff --git a/src/satisfied-guide-cns.cpp b/src/satisfied-guide-cns.cpp index 588c78ce0..028a22405 100644 --- a/src/satisfied-guide-cns.cpp +++ b/src/satisfied-guide-cns.cpp @@ -1,5 +1,5 @@ #include <2geom/coord.h> -#include "desktop-handles.h" +#include "desktop.h" #include "sp-guide.h" #include "sp-guide-constraint.h" #include "sp-namedview.h" @@ -9,7 +9,7 @@ void satisfied_guide_cns(SPDesktop const &desktop, std::vector const &snappoints, std::vector &cns) { - SPNamedView const &nv = *sp_desktop_namedview(&desktop); + SPNamedView const &nv = *desktop.getNamedView(); for (GSList const *l = nv.guides; l != NULL; l = l->next) { SPGuide &g = *SP_GUIDE(l->data); for (unsigned int i = 0; i < snappoints.size(); ++i) { diff --git a/src/sp-text.cpp b/src/sp-text.cpp index a35a58bd9..1cd690729 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -38,7 +38,7 @@ #include "attributes.h" #include "document.h" #include "preferences.h" -#include "desktop-handles.h" +#include "desktop.h" #include "sp-namedview.h" #include "style.h" #include "inkscape.h" @@ -362,7 +362,7 @@ gchar* SPText::description() const { char *n = xml_quote_strdup( style->font_family.value ); Inkscape::Util::Quantity q = Inkscape::Util::Quantity(style->font_size.computed, "px"); - GString *xs = g_string_new(q.string(sp_desktop_namedview(SP_ACTIVE_DESKTOP)->display_units).c_str()); + GString *xs = g_string_new(q.string(SP_ACTIVE_DESKTOP->getNamedView()->display_units).c_str()); char const *trunc = ""; Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) this); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 9275d3bde..310df419e 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -331,7 +331,7 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* // Set a default style in rather than so it can be changed. use->setAttribute("style", style ); /* disable rev 13709 in rev 13806, following Bug 1365451, comments 13-16 - Inkscape::XML::Node *nv_repr = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getRepr(); + Inkscape::XML::Node *nv_repr = SP_ACTIVE_DESKTOP->getNamedView()->getRepr(); gdouble scale_units = Inkscape::Util::Quantity::convert(1, nv_repr->attribute("inkscape:document-units"), "px"); gchar *transform_str = sp_svg_transform_write(Geom::Scale(scale_units, scale_units)); use->setAttribute("transform", transform_str); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index f8f220b0a..2adb6598c 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -1093,7 +1093,7 @@ CloneTiler::CloneTiler () : // unitmenu unit_menu = new Inkscape::UI::Widget::UnitMenu(); unit_menu->setUnitType(Inkscape::Util::UNIT_TYPE_LINEAR); - unit_menu->setUnit(sp_desktop_namedview(SP_ACTIVE_DESKTOP)->display_units->abbr); + unit_menu->setUnit(SP_ACTIVE_DESKTOP->getNamedView()->display_units->abbr); unitChangedConn = unit_menu->signal_changed().connect(sigc::mem_fun(*this, &CloneTiler::clonetiler_unit_changed)); { diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index 820d5a8bb..dc7f8158e 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -100,7 +100,7 @@ DocumentMetadata::init() { update(); - Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); + Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); repr->addListener (&_repr_events, this); show_all_children(); @@ -108,7 +108,7 @@ DocumentMetadata::init() DocumentMetadata::~DocumentMetadata() { - Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); + Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); repr->removeListenerByData (this); for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) @@ -217,7 +217,7 @@ void DocumentMetadata::update() void DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *) { - Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); + Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->addListener (&_repr_events, this); update(); } @@ -225,7 +225,7 @@ DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *) void DocumentMetadata::_handleActivateDesktop(SPDesktop *desktop) { - Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); + Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->addListener(&_repr_events, this); update(); } @@ -233,7 +233,7 @@ DocumentMetadata::_handleActivateDesktop(SPDesktop *desktop) void DocumentMetadata::_handleDeactivateDesktop(SPDesktop *desktop) { - Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); + Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->removeListenerByData(this); } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 13ee8a6c6..1d15ad32b 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -186,7 +186,7 @@ void DocumentProperties::init() { update(); - Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); + Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); repr->addListener (&_repr_events, this); Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); root->addListener (&_repr_events, this); @@ -197,7 +197,7 @@ void DocumentProperties::init() DocumentProperties::~DocumentProperties() { - Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); + Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); repr->removeListenerByData (this); Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); root->removeListenerByData (this); @@ -1384,7 +1384,7 @@ void DocumentProperties::populate_script_lists(){ void DocumentProperties::update_gridspage() { SPDesktop *dt = getDesktop(); - SPNamedView *nv = sp_desktop_namedview(dt); + SPNamedView *nv = dt->getNamedView(); //remove all tabs while (_grids_notebook.get_n_pages() != 0) { @@ -1428,7 +1428,7 @@ void DocumentProperties::build_gridspage() /// Dissenting view: you want snapping without grid. SPDesktop *dt = getDesktop(); - SPNamedView *nv = sp_desktop_namedview(dt); + SPNamedView *nv = dt->getNamedView(); (void)nv; _grids_label_crea.set_markup(_("Creation")); @@ -1464,7 +1464,7 @@ void DocumentProperties::update() if (_wr.isUpdating()) return; SPDesktop *dt = getDesktop(); - SPNamedView *nv = sp_desktop_namedview(dt); + SPNamedView *nv = dt->getNamedView(); _wr.setUpdating (true); set_sensitive (true); @@ -1592,7 +1592,7 @@ void DocumentProperties::save_default_metadata() void DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document) { - Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); + Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->addListener(&_repr_events, this); Inkscape::XML::Node *root = document->getRoot()->getRepr(); root->addListener(&_repr_events, this); @@ -1601,7 +1601,7 @@ void DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument void DocumentProperties::_handleActivateDesktop(SPDesktop *desktop) { - Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); + Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->addListener(&_repr_events, this); Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr(); root->addListener(&_repr_events, this); @@ -1610,7 +1610,7 @@ void DocumentProperties::_handleActivateDesktop(SPDesktop *desktop) void DocumentProperties::_handleDeactivateDesktop(SPDesktop *desktop) { - Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); + Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->removeListenerByData(this); Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr(); root->removeListenerByData(this); @@ -1647,7 +1647,7 @@ static void on_repr_attr_changed(Inkscape::XML::Node *, gchar const *, gchar con void DocumentProperties::onNewGrid() { SPDesktop *dt = getDesktop(); - Inkscape::XML::Node *repr = sp_desktop_namedview(dt)->getRepr(); + Inkscape::XML::Node *repr = dt->getNamedView()->getRepr(); SPDocument *doc = sp_desktop_document(dt); Glib::ustring typestring = _grids_combo_gridtype.get_active_text(); @@ -1665,7 +1665,7 @@ void DocumentProperties::onRemoveGrid() return; SPDesktop *dt = getDesktop(); - SPNamedView *nv = sp_desktop_namedview(dt); + SPNamedView *nv = dt->getNamedView(); Inkscape::CanvasGrid * found_grid = NULL; int i = 0; for (GSList const * l = nv->grids; l != NULL; l = l->next, i++) { // not a very nice fix, but works. @@ -1697,7 +1697,7 @@ void DocumentProperties::onDocUnitChange() } - Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); + Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px"); if(repr->attribute("inkscape:document-units")) { old_doc_unit = unit_table.getUnit(repr->attribute("inkscape:document-units")); diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index d7151fa81..11dfa2db5 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -206,7 +206,7 @@ Export::Export (void) : SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) { - unit_selector.setUnit(sp_desktop_namedview(desktop)->display_units->abbr); + unit_selector.setUnit(desktop->getNamedView()->display_units->abbr); } unitChangedConn = unit_selector.signal_changed().connect(sigc::mem_fun(*this, &Export::onUnitChanged)); unitbox.pack_end(unit_selector, false, false, 0); @@ -1002,7 +1002,7 @@ void Export::onExport () SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (!desktop) return; - SPNamedView *nv = sp_desktop_namedview(desktop); + SPNamedView *nv = desktop->getNamedView(); SPDocument *doc = sp_desktop_document (desktop); bool exportSuccessful = false; diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 1dba31e5a..924aa129b 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -206,7 +206,7 @@ void Transformation::layoutPageMove() // Setting default unit to document unit SPDesktop *dt = getDesktop(); - SPNamedView *nv = sp_desktop_namedview(dt); + SPNamedView *nv = dt->getNamedView(); if (nv->display_units) { _units_move.setUnit(nv->display_units->abbr); } diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index 56bd1598b..3c0b9f60b 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -245,7 +245,7 @@ bool DropperTool::root_handler(GdkEvent* event) { if (pick == SP_DROPPER_PICK_VISIBLE) { // compose with page color - guint32 bg = sp_desktop_namedview(desktop)->pagecolor; + guint32 bg = desktop->getNamedView()->pagecolor; R = R + (SP_RGBA32_R_F(bg)) * (1 - A); G = G + (SP_RGBA32_G_F(bg)) * (1 - A); B = B + (SP_RGBA32_B_F(bg)) * (1 - A); diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 339ff1c72..b6808fbc2 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -792,7 +792,7 @@ static void sp_flood_do_flood_fill(ToolBase *event_context, GdkEvent *event, boo Inkscape::DrawingContext dc(s, Geom::Point(0,0)); // cairo_translate not necessary here - surface origin is at 0,0 - SPNamedView *nv = sp_desktop_namedview(desktop); + SPNamedView *nv = desktop->getNamedView(); bgcolor = nv->pagecolor; // bgcolor is 0xrrggbbaa, we need 0xaarrggbb dtc = (bgcolor >> 8) | (bgcolor << 24); diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index a18c3de9d..fb7f5abd7 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -309,7 +309,7 @@ PageSizer::PageSizer(Registry & _wr) // Setting default custom unit to document unit SPDesktop *dt = SP_ACTIVE_DESKTOP; - SPNamedView *nv = sp_desktop_namedview(dt); + SPNamedView *nv = dt->getNamedView(); _wr.setUpdating (true); if (nv->page_size_units) { _dimensionUnits.setUnit(nv->page_size_units->abbr); diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 4065bd550..02ab88418 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -36,6 +36,9 @@ // for interruptability bug: #include "display/sp-canvas.h" +#include "desktop.h" +#include "desktop-handles.h" + #include "sp-root.h" namespace Inkscape { @@ -416,7 +419,7 @@ RegisteredColorPicker::on_changed (guint32 rgba) SPDesktop *dt = SP_ACTIVE_DESKTOP; if (!dt) return; - local_repr = sp_desktop_namedview(dt)->getRepr(); + local_repr = dt->getNamedView()->getRepr(); local_doc = sp_desktop_document(dt); } diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 15302a165..9d2489712 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -27,7 +27,7 @@ #include "document.h" #include "document-undo.h" -#include "desktop-handles.h" +#include "desktop.h" #include "sp-namedview.h" #include @@ -99,8 +99,8 @@ protected: if (!local_repr) { // no repr specified, use active desktop's namedview's repr SPDesktop* dt = SP_ACTIVE_DESKTOP; - local_repr = reinterpret_cast(sp_desktop_namedview(dt))->getRepr(); - local_doc = sp_desktop_document(dt); + local_repr = reinterpret_cast(dt->getNamedView())->getRepr(); + local_doc = dt->getDocument(); } bool saved = DocumentUndo::getUndoSensitive(local_doc); diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index ec3194478..dc329c3ce 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -498,7 +498,7 @@ SelectedStyle::setDesktop(SPDesktop *desktop) this ) )); - _sw_unit = sp_desktop_namedview(desktop)->display_units; + _sw_unit = desktop->getNamedView()->display_units; // Set the doc default unit active in the units list gint length = g_slist_length(_unit_mis); diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index aac7451f4..e798379f2 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -28,6 +28,7 @@ #include "inkscape.h" #include "document.h" #include "document-undo.h" +#include "desktop.h" #include "desktop-handles.h" #include "sp-namedview.h" @@ -198,7 +199,7 @@ void ToleranceSlider::update (double val) SPDocument *doc = sp_desktop_document(dt); bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); - Inkscape::XML::Node *repr = sp_desktop_namedview(dt)->getRepr(); + Inkscape::XML::Node *repr = dt->getNamedView()->getRepr(); repr->setAttribute(_key.c_str(), os.str().c_str()); DocumentUndo::setUndoSensitive(doc, saved); diff --git a/src/widgets/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp index 5a7613dcc..c3a83be70 100644 --- a/src/widgets/lpe-toolbar.cpp +++ b/src/widgets/lpe-toolbar.cpp @@ -280,7 +280,7 @@ static void lpetool_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBas void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) { UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); - tracker->setActiveUnit(sp_desktop_namedview(desktop)->display_units); + tracker->setActiveUnit(desktop->getNamedView()->display_units); g_object_set_data(holder, "tracker", tracker); Unit const *unit = tracker->getActiveUnit(); g_return_if_fail(unit != NULL); diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp index 7bbbaf37d..52be03abe 100644 --- a/src/widgets/node-toolbar.cpp +++ b/src/widgets/node-toolbar.cpp @@ -330,7 +330,7 @@ static void node_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) { UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); - Unit doc_units = *sp_desktop_namedview(desktop)->display_units; + Unit doc_units = *desktop->getNamedView()->display_units; tracker->setActiveUnit(&doc_units); g_object_set_data( holder, "tracker", tracker ); diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index 467fed4e6..2dc2bbb07 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -109,7 +109,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * for (GSList const *items = selection->itemList(); items != NULL; items = items->next) { if (SP_IS_RECT(items->data)) { if (gtk_adjustment_get_value(adj) != 0) { - (SP_RECT(items->data)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, sp_desktop_namedview(desktop)->svg_units)); + (SP_RECT(items->data)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, desktop->getNamedView()->svg_units)); } else { SP_OBJECT(items->data)->getRepr()->setAttribute(value_name, NULL); } @@ -181,7 +181,7 @@ static void rect_tb_event_attr_changed(Inkscape::XML::Node * /*repr*/, gchar con UnitTracker* tracker = reinterpret_cast( g_object_get_data( tbl, "tracker" ) ); Unit const *unit = tracker->getActiveUnit(); - Unit const *svg_unit = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->svg_units; + Unit const *svg_unit = SP_ACTIVE_DESKTOP->getNamedView()->svg_units; g_return_if_fail(unit != NULL); gpointer item = g_object_get_data( tbl, "item" ); @@ -307,7 +307,7 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); //tracker->addUnit( SP_UNIT_PERCENT, 0 ); // fixme: add % meaning per cent of the width/height - tracker->setActiveUnit( sp_desktop_namedview(desktop)->display_units ); + tracker->setActiveUnit( desktop->getNamedView()->display_units ); g_object_set_data( holder, "tracker", tracker ); /* W */ diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 985f7c22d..efc205f6d 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -488,7 +488,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb // Create the units menu. UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); tracker->addUnit(unit_table.getUnit("%")); - tracker->setActiveUnit( sp_desktop_namedview(desktop)->display_units ); + tracker->setActiveUnit( desktop->getNamedView()->display_units ); g_object_set_data( G_OBJECT(spw), "tracker", tracker ); g_signal_connect( G_OBJECT(spw), "destroy", G_CALLBACK(destroy_tracker), spw ); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index ae2615fce..830c0580d 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -204,8 +204,8 @@ StrokeStyle::StrokeStyle() : unitSelector->addUnit(*unit_table.getUnit("%")); _old_unit = unitSelector->getUnit(); if (desktop) { - unitSelector->setUnit(sp_desktop_namedview(desktop)->display_units->abbr); - _old_unit = sp_desktop_namedview(desktop)->display_units; + unitSelector->setUnit(desktop->getNamedView()->display_units->abbr); + _old_unit = desktop->getNamedView()->display_units; } widthSpin->setUnitMenu(unitSelector); unitChangedConn = unitSelector->signal_changed().connect(sigc::mem_fun(*this, &StrokeStyle::unitChangedCB)); @@ -839,7 +839,7 @@ StrokeStyle::updateLine() // same width, or only one object; no sense to keep percent, switch to absolute Inkscape::Util::Unit const *tempunit = unitSelector->getUnit(); if (tempunit->type != Inkscape::Util::UNIT_TYPE_LINEAR) { - unitSelector->setUnit(sp_desktop_namedview(SP_ACTIVE_DESKTOP)->display_units->abbr); + unitSelector->setUnit(SP_ACTIVE_DESKTOP->getNamedView()->display_units->abbr); } } diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 9e55d1cf6..555bb780f 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1511,7 +1511,7 @@ static void toggle_snap_callback(GtkToggleAction *act, gpointer data) //data poi g_assert(ptr != NULL); SPDesktop *dt = reinterpret_cast(ptr); - SPNamedView *nv = sp_desktop_namedview(dt); + SPNamedView *nv = dt->getNamedView(); SPDocument *doc = nv->document; if (dt == NULL || nv == NULL) { @@ -1871,7 +1871,7 @@ void ToolboxFactory::updateSnapToolbox(SPDesktop *desktop, ToolBase * /*eventcon g_assert(desktop != NULL); g_assert(toolbox != NULL); - SPNamedView *nv = sp_desktop_namedview(desktop); + SPNamedView *nv = desktop->getNamedView(); if (nv == NULL) { g_warning("Namedview cannot be retrieved (in updateSnapToolbox)!"); return; -- cgit v1.2.3 From 3e5209fe7e0dbeb9e7d8908141788c9fab22e948 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 15:11:39 -0500 Subject: Purge sp_desktop_canvas (bzr r13811) --- src/desktop-events.cpp | 10 +++++----- src/desktop-handles.cpp | 8 -------- src/desktop-handles.h | 1 - src/desktop.cpp | 2 +- src/sp-namedview.cpp | 8 ++++---- src/ui/tools/dropper-tool.cpp | 8 ++++---- src/ui/tools/select-tool.cpp | 14 +++++++------- src/ui/tools/text-tool.cpp | 4 ++-- src/ui/tools/tool-base.cpp | 16 ++++++++-------- src/ui/widget/object-composite-settings.cpp | 8 ++++---- src/ui/widget/selected-style.cpp | 4 ++-- src/widgets/fill-style.cpp | 4 ++-- src/widgets/select-toolbar.cpp | 6 +++--- 13 files changed, 42 insertions(+), 51 deletions(-) diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index a45823380..a5eb3de18 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -516,7 +516,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) if ((event->crossing.state & GDK_SHIFT_MASK) && (drag_type != SP_DRAG_MOVE_ORIGIN)) { GdkCursor *guide_cursor; guide_cursor = gdk_cursor_new (GDK_EXCHANGE); - gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(sp_desktop_canvas(desktop))), guide_cursor); + gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(desktop->getCanvas())), guide_cursor); #if GTK_CHECK_VERSION(3,0,0) g_object_unref(guide_cursor); #else @@ -525,7 +525,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) } else { GdkCursor *guide_cursor; guide_cursor = gdk_cursor_new (GDK_HAND1); - gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(sp_desktop_canvas(desktop))), guide_cursor); + gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(desktop->getCanvas())), guide_cursor); #if GTK_CHECK_VERSION(3,0,0) g_object_unref(guide_cursor); #else @@ -542,7 +542,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) sp_guideline_set_color(SP_GUIDELINE(item), guide->getColor()); // restore event context's cursor - gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(sp_desktop_canvas(desktop))), desktop->event_context->cursor); + gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(desktop->getCanvas())), desktop->event_context->cursor); desktop->guidesMessageContext()->clear(); break; @@ -564,7 +564,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) if (drag_type != SP_DRAG_MOVE_ORIGIN) { GdkCursor *guide_cursor; guide_cursor = gdk_cursor_new (GDK_EXCHANGE); - gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(sp_desktop_canvas(desktop))), guide_cursor); + gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(desktop->getCanvas())), guide_cursor); #if GTK_CHECK_VERSION(3,0,0) g_object_unref(guide_cursor); #else @@ -585,7 +585,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) case GDK_KEY_Shift_R: GdkCursor *guide_cursor; guide_cursor = gdk_cursor_new (GDK_EXCHANGE); - gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(sp_desktop_canvas(desktop))), guide_cursor); + gdk_window_set_cursor(gtk_widget_get_window (GTK_WIDGET(desktop->getCanvas())), guide_cursor); #if GTK_CHECK_VERSION(3,0,0) g_object_unref(guide_cursor); #else diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index b0d12855a..02dd0493a 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -23,14 +23,6 @@ sp_desktop_document (SPDesktop const * desktop) return desktop->doc(); } -SPCanvas * -sp_desktop_canvas (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return (SP_CANVAS_ITEM(desktop->main))->canvas; -} - SPCanvasItem * sp_desktop_acetate (SPDesktop const * desktop) { diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 3b14f2e92..191dd6f39 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -45,7 +45,6 @@ namespace Inkscape { #define SP_COORDINATES_UNDERLINE_Y (1 << Geom::Y) SPDocument * sp_desktop_document (SPDesktop const * desktop); -SPCanvas * sp_desktop_canvas (SPDesktop const * desktop); SPCanvasItem * sp_desktop_acetate (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_main (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_gridgroup (SPDesktop const * desktop); diff --git a/src/desktop.cpp b/src/desktop.cpp index 288ca1fbf..ad6809ea5 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1446,7 +1446,7 @@ void SPDesktop::disableInteraction() void SPDesktop::setWaitingCursor() { GdkCursor *waiting = gdk_cursor_new(GDK_WATCH); - gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(this))), waiting); + gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(getCanvas())), waiting); #if GTK_CHECK_VERSION(3,0,0) g_object_unref(waiting); #else diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 1817e74e0..5b410e5c0 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -676,7 +676,7 @@ void SPNamedView::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *r g->SPGuide::showSPGuide(static_cast(l->data)->guides, (GCallback) sp_dt_guide_event); if (static_cast(l->data)->guides_active) { - g->sensitize(sp_desktop_canvas(static_cast (l->data)), TRUE); + g->sensitize((static_cast (l->data))->getCanvas(), TRUE); } sp_namedview_show_single_guide(SP_GUIDE(g), this->showguides); @@ -734,7 +734,7 @@ void SPNamedView::show(SPDesktop *desktop) for (GSList *l = guides; l != NULL; l = l->next) { SP_GUIDE(l->data)->showSPGuide( desktop->guides, (GCallback) sp_dt_guide_event); if (desktop->guides_active) { - SP_GUIDE(l->data)->sensitize(sp_desktop_canvas(desktop), TRUE); + SP_GUIDE(l->data)->sensitize(desktop->getCanvas(), TRUE); } sp_namedview_show_single_guide(SP_GUIDE(l->data), showguides); } @@ -931,7 +931,7 @@ void SPNamedView::hide(SPDesktop const *desktop) g_assert(g_slist_find(views, desktop)); for (GSList *l = guides; l != NULL; l = l->next) { - SP_GUIDE(l->data)->hideSPGuide(sp_desktop_canvas(desktop)); + SP_GUIDE(l->data)->hideSPGuide(desktop->getCanvas()); } views = g_slist_remove(views, desktop); @@ -945,7 +945,7 @@ void SPNamedView::activateGuides(void* desktop, bool active) SPDesktop *dt = static_cast(desktop); for (GSList *l = guides; l != NULL; l = l->next) { - SP_GUIDE(l->data)->sensitize( sp_desktop_canvas(dt), active); + SP_GUIDE(l->data)->sensitize(dt->getCanvas(), active); } } diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index 3c0b9f60b..a1f0b482b 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -200,7 +200,7 @@ bool DropperTool::root_handler(GdkEvent* event) { // If one time pick with stroke set the pixmap if (prefs->getBool("/tools/dropper/onetimepick", false) && prefs->getInt("/dialogs/fillstroke/page", 0) == 1) { //TODO Only set when not set already - GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(desktop->getCanvas())); gdk_window_set_cursor(window, cursor_dropper_stroke); } @@ -324,7 +324,7 @@ bool DropperTool::root_handler(GdkEvent* event) { // REJON: set aux. toolbar input to hex color! if (event->button.state & GDK_SHIFT_MASK) { - GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(desktop->getCanvas())); gdk_window_set_cursor(window, cursor_dropper_stroke); } @@ -363,7 +363,7 @@ bool DropperTool::root_handler(GdkEvent* event) { case GDK_KEY_Shift_L: case GDK_KEY_Shift_R: if (!desktop->isWaitingCursor() && !prefs->getBool("/tools/dropper/onetimepick", false)) { - GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(desktop->getCanvas())); gdk_window_set_cursor(window, cursor_dropper_stroke); } @@ -378,7 +378,7 @@ bool DropperTool::root_handler(GdkEvent* event) { case GDK_KEY_Shift_L: case GDK_KEY_Shift_R: if (!desktop->isWaitingCursor() && !prefs->getBool("/tools/dropper/onetimepick", false)) { - GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(desktop->getCanvas())); gdk_window_set_cursor(window, cursor_dropper_fill); } break; diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 6501ec3cc..bdde76c31 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -308,7 +308,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { // if shift or ctrl was pressed, do not move objects; // pass the event to root handler which will perform rubberband, shift-click, ctrl-click, ctrl-drag } else { - GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); this->dragging = TRUE; this->moved = FALSE; @@ -353,7 +353,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { case GDK_ENTER_NOTIFY: { if (!desktop->isWaitingCursor() && !this->dragging) { - GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, CursorSelectMouseover); } @@ -361,7 +361,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } case GDK_LEAVE_NOTIFY: if (!desktop->isWaitingCursor() && !this->dragging) { - GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, this->cursor); } @@ -573,7 +573,7 @@ bool SelectTool::root_handler(GdkEvent* event) { // but not with shift) we want to drag rather than rubberband this->dragging = TRUE; - GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, CursorSelectDragging); @@ -702,7 +702,7 @@ bool SelectTool::root_handler(GdkEvent* event) { } this->dragging = FALSE; - window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop))); + window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, CursorSelectMouseover); sp_event_context_discard_delayed_snap_event(this); @@ -953,7 +953,7 @@ bool SelectTool::root_handler(GdkEvent* event) { // if Alt and nonempty selection, show moving cursor ("move selected"): if (alt && !selection->isEmpty() && !desktop->isWaitingCursor()) { - GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop))); + GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, CursorSelectDragging); } @@ -1226,7 +1226,7 @@ bool SelectTool::root_handler(GdkEvent* event) { // set cursor to default. if (!desktop->isWaitingCursor()) { // Do we need to reset the cursor here on key release ? - //GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop))); + //GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); //gdk_window_set_cursor(window, event_context->cursor); } break; diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index e9fe45165..674ba6a72 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -150,7 +150,7 @@ void TextTool::setup() { this->imc = gtk_im_multicontext_new(); if (this->imc) { - GtkWidget *canvas = GTK_WIDGET(sp_desktop_canvas(desktop)); + GtkWidget *canvas = GTK_WIDGET(desktop->getCanvas()); /* im preedit handling is very broken in inkscape for * multi-byte characters. See bug 1086769. @@ -206,7 +206,7 @@ void TextTool::setup() { void TextTool::finish() { if (this->desktop) { - sp_signal_disconnect_by_data(sp_desktop_canvas(this->desktop), this); + sp_signal_disconnect_by_data(this->desktop->getCanvas(), this); } this->enableGrDrag(false); diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index d0ce18ee3..8ce78b2d9 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -149,7 +149,7 @@ ToolBase::~ToolBase() { */ void ToolBase::sp_event_context_set_cursor(GdkCursorType cursor_type) { - GtkWidget *w = GTK_WIDGET(sp_desktop_canvas(this->desktop)); + GtkWidget *w = GTK_WIDGET(this->desktop->getCanvas()); GdkDisplay *display = gdk_display_get_default(); GdkCursor *cursor = gdk_cursor_new_for_display(display, cursor_type); @@ -169,7 +169,7 @@ void ToolBase::sp_event_context_set_cursor(GdkCursorType cursor_type) { * Recreates and draws cursor on desktop related to ToolBase. */ void ToolBase::sp_event_context_update_cursor() { - GtkWidget *w = GTK_WIDGET(sp_desktop_canvas(this->desktop)); + GtkWidget *w = GTK_WIDGET(this->desktop->getCanvas()); if (gtk_widget_get_window (w)) { GtkStyle *style = gtk_widget_get_style(w); @@ -530,7 +530,7 @@ bool ToolBase::root_handler(GdkEvent* event) { if (panning_cursor == 1) { panning_cursor = 0; - GtkWidget *w = GTK_WIDGET(sp_desktop_canvas(this->desktop)); + GtkWidget *w = GTK_WIDGET(this->desktop->getCanvas()); gdk_window_set_cursor(gtk_widget_get_window (w), this->cursor); } @@ -641,7 +641,7 @@ bool ToolBase::root_handler(GdkEvent* event) { case GDK_KEY_KP_4: if (MOD__CTRL_ONLY(event)) { int i = (int) floor(key_scroll * accelerate_scroll(event, - acceleration, sp_desktop_canvas(desktop))); + acceleration, desktop->getCanvas())); gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK); this->desktop->scroll_world(i, 0); @@ -654,7 +654,7 @@ bool ToolBase::root_handler(GdkEvent* event) { case GDK_KEY_KP_8: if (MOD__CTRL_ONLY(event)) { int i = (int) floor(key_scroll * accelerate_scroll(event, - acceleration, sp_desktop_canvas(desktop))); + acceleration, desktop->getCanvas())); gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK); this->desktop->scroll_world(0, i); @@ -667,7 +667,7 @@ bool ToolBase::root_handler(GdkEvent* event) { case GDK_KEY_KP_6: if (MOD__CTRL_ONLY(event)) { int i = (int) floor(key_scroll * accelerate_scroll(event, - acceleration, sp_desktop_canvas(desktop))); + acceleration, desktop->getCanvas())); gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK); this->desktop->scroll_world(-i, 0); @@ -680,7 +680,7 @@ bool ToolBase::root_handler(GdkEvent* event) { case GDK_KEY_KP_2: if (MOD__CTRL_ONLY(event)) { int i = (int) floor(key_scroll * accelerate_scroll(event, - acceleration, sp_desktop_canvas(desktop))); + acceleration, desktop->getCanvas())); gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK); this->desktop->scroll_world(0, -i); @@ -740,7 +740,7 @@ bool ToolBase::root_handler(GdkEvent* event) { if (panning_cursor == 1) { panning_cursor = 0; - GtkWidget *w = GTK_WIDGET(sp_desktop_canvas(this->desktop)); + GtkWidget *w = GTK_WIDGET(this->desktop->getCanvas()); gdk_window_set_cursor(gtk_widget_get_window (w), this->cursor); } diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index a377bf118..b4cfa3231 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -111,7 +111,7 @@ ObjectCompositeSettings::_blendBlurValueChanged() _blocked = true; // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in crash 1580903 - //sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0); + //sp_canvas_force_full_redraw_after_interruptions(desktop->getCanvas(), 0); Geom::OptRect bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX); double radius; @@ -159,7 +159,7 @@ ObjectCompositeSettings::_blendBlurValueChanged() _("Change blur")); // resume interruptibility - //sp_canvas_end_forced_full_redraws(sp_desktop_canvas(desktop)); + //sp_canvas_end_forced_full_redraws(desktop->getCanvas()); _blocked = false; } @@ -183,7 +183,7 @@ ObjectCompositeSettings::_opacityValueChanged() // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in crash 1580903 // UPDATE: crash fixed in GTK+ 2.10.7 (bug 374378), remove this as soon as it's reasonably common // (though this only fixes the crash, not the multiple change events) - //sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0); + //sp_canvas_force_full_redraw_after_interruptions(desktop->getCanvas(), 0); SPCSSAttr *css = sp_repr_css_attr_new (); @@ -199,7 +199,7 @@ ObjectCompositeSettings::_opacityValueChanged() _("Change opacity")); // resume interruptibility - //sp_canvas_end_forced_full_redraws(sp_desktop_canvas(desktop)); + //sp_canvas_end_forced_full_redraws(desktop->getCanvas()); _blocked = false; } diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index dc329c3ce..38944250c 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -1241,13 +1241,13 @@ void SelectedStyle::on_opacity_changed () // me. As a result, scrolling the spinbutton once results in runaway change until it hits 1.0 // or 0.0. (And no, this is not a race with ::update, I checked that.) // Sigh. So we disable interruptibility while we're setting the new value. - sp_desktop_canvas(_desktop)->forceFullRedrawAfterInterruptions(0); + _desktop->getCanvas()->forceFullRedrawAfterInterruptions(0); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); DocumentUndo::maybeDone(sp_desktop_document(_desktop), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE, _("Change opacity")); // resume interruptibility - sp_desktop_canvas(_desktop)->endForcedFullRedraws(); + _desktop->getCanvas()->endForcedFullRedraws(); spinbutton_defocus(GTK_WIDGET(_opacity_sb.gobj())); _opacity_blocked = false; } diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index ead88ddf6..820a20126 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -516,7 +516,7 @@ void FillNStroke::updateFromPaint() { if (kind == FILL) { // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in losing release events - sp_desktop_canvas(desktop)->forceFullRedrawAfterInterruptions(0); + desktop->getCanvas()->forceFullRedrawAfterInterruptions(0); } psel->setFlatColor( desktop, @@ -527,7 +527,7 @@ void FillNStroke::updateFromPaint() if (kind == FILL) { // resume interruptibility - sp_desktop_canvas(desktop)->endForcedFullRedraws(); + desktop->getCanvas()->endForcedFullRedraws(); } // on release, toggle undo_label so that the next drag will not be lumped with this one diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index efc205f6d..881de2e36 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -241,7 +241,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) if (actionkey != NULL) { // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed - sp_desktop_canvas(desktop)->forceFullRedrawAfterInterruptions(0); + desktop->getCanvas()->forceFullRedrawAfterInterruptions(0); bool transform_stroke = prefs->getBool("/options/transform/stroke", true); bool preserve = prefs->getBool("/options/preservetransform/value", false); @@ -262,7 +262,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) _("Transform by toolbar")); // resume interruptibility - sp_desktop_canvas(desktop)->endForcedFullRedraws(); + desktop->getCanvas()->endForcedFullRedraws(); } g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE)); @@ -473,7 +473,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb GtkWidget *spw = sp_widget_new_global(); // Remember the desktop's canvas widget, to be used for defocusing. - g_object_set_data(G_OBJECT(spw), "dtw", sp_desktop_canvas(desktop)); + g_object_set_data(G_OBJECT(spw), "dtw", desktop->getCanvas()); // The vb frame holds all other widgets and is used to set sensitivity depending on selection state. #if GTK_CHECK_VERSION(3,0,0) -- cgit v1.2.3 From 53eb571d863a52712aa23656f2118020fa3dff5d Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 15:12:41 -0500 Subject: Purge sp_desktop_acetate (bzr r13812) --- src/desktop-handles.cpp | 8 -------- src/desktop-handles.h | 1 - 2 files changed, 9 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index 02dd0493a..b0283537f 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -23,14 +23,6 @@ sp_desktop_document (SPDesktop const * desktop) return desktop->doc(); } -SPCanvasItem * -sp_desktop_acetate (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->acetate; -} - SPCanvasGroup * sp_desktop_main (SPDesktop const * desktop) { diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 191dd6f39..7c315020c 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -45,7 +45,6 @@ namespace Inkscape { #define SP_COORDINATES_UNDERLINE_Y (1 << Geom::Y) SPDocument * sp_desktop_document (SPDesktop const * desktop); -SPCanvasItem * sp_desktop_acetate (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_main (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_gridgroup (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop); -- cgit v1.2.3 From ea791c4ddb154cf306d236feeb4805b46ec560ac Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 15:22:53 -0500 Subject: Purge sp_desktop_drawing (bzr r13813) --- src/desktop-handles.cpp | 8 -------- src/desktop-handles.h | 1 - src/ui/tools/calligraphic-tool.cpp | 2 +- src/ui/tools/dropper-tool.cpp | 4 ++-- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index b0283537f..3a9bc757e 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -47,14 +47,6 @@ sp_desktop_guides (SPDesktop const * desktop) return desktop->guides; } -SPCanvasItem * -sp_desktop_drawing (SPDesktop const *desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->drawing; -} - SPCanvasGroup * sp_desktop_sketch (SPDesktop const * desktop) { diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 7c315020c..4f561bbd9 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -48,7 +48,6 @@ SPDocument * sp_desktop_document (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_main (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_gridgroup (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop); -SPCanvasItem *sp_desktop_drawing (SPDesktop const *desktop); SPCanvasGroup * sp_desktop_sketch (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_tempgroup (SPDesktop const * desktop); diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 97ac3d112..821756a55 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -373,7 +373,7 @@ void CalligraphicTool::brush() { double R, G, B, A; Geom::IntRect area = Geom::IntRect::from_xywh(brush_w.floor(), Geom::IntPoint(1, 1)); cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1); - sp_canvas_arena_render_surface(SP_CANVAS_ARENA(sp_desktop_drawing(SP_EVENT_CONTEXT(this)->desktop)), s, area); + sp_canvas_arena_render_surface(SP_CANVAS_ARENA(this->desktop->getDrawing()), s, area); ink_cairo_surface_average_color_premul(s, R, G, B, A); cairo_surface_destroy(s); double max = MAX (MAX (R, G), B); diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index a1f0b482b..24dd7d0bf 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -230,7 +230,7 @@ bool DropperTool::root_handler(GdkEvent* event) { if (!r.hasZeroArea()) { Geom::IntRect area = r.roundOutwards(); cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, area.width(), area.height()); - sp_canvas_arena_render_surface(SP_CANVAS_ARENA(sp_desktop_drawing(desktop)), s, area); + sp_canvas_arena_render_surface(SP_CANVAS_ARENA(desktop->getDrawing()), s, area); ink_cairo_surface_average_color_premul(s, R, G, B, A); cairo_surface_destroy(s); } @@ -238,7 +238,7 @@ bool DropperTool::root_handler(GdkEvent* event) { // pick single pixel Geom::IntRect area = Geom::IntRect::from_xywh(floor(event->button.x), floor(event->button.y), 1, 1); cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1); - sp_canvas_arena_render_surface(SP_CANVAS_ARENA(sp_desktop_drawing(desktop)), s, area); + sp_canvas_arena_render_surface(SP_CANVAS_ARENA(desktop->getDrawing()), s, area); ink_cairo_surface_average_color_premul(s, R, G, B, A); cairo_surface_destroy(s); } -- cgit v1.2.3 From cd6c365d228dedc64989b0e943f15a04cf3ef128 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 15:30:50 -0500 Subject: Purge sp_desktop_gridgroup (bzr r13814) --- src/desktop-handles.cpp | 8 -------- src/desktop-handles.h | 1 - src/display/canvas-grid.cpp | 4 ++-- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index 3a9bc757e..588d54f53 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -31,14 +31,6 @@ sp_desktop_main (SPDesktop const * desktop) return desktop->main; } -SPCanvasGroup * -sp_desktop_gridgroup (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->gridgroup; -} - SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop) { diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 4f561bbd9..57689b3a0 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -46,7 +46,6 @@ namespace Inkscape { SPDocument * sp_desktop_document (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_main (SPDesktop const * desktop); -SPCanvasGroup * sp_desktop_gridgroup (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_sketch (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop); diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 0bcb6c375..fe8d2d98c 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -285,12 +285,12 @@ CanvasGrid::createCanvasItem(SPDesktop * desktop) // check if there is already a canvasitem on this desktop linking to this grid for (GSList *l = canvasitems; l != NULL; l = l->next) { - if ( sp_desktop_gridgroup(desktop) == SP_CANVAS_GROUP(SP_CANVAS_ITEM(l->data)->parent) ) { + if ( desktop->getGridGroup() == SP_CANVAS_GROUP(SP_CANVAS_ITEM(l->data)->parent) ) { return NULL; } } - GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(sp_desktop_gridgroup(desktop), INKSCAPE_TYPE_GRID_CANVASITEM, NULL) ); + GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(desktop->getGridGroup(), INKSCAPE_TYPE_GRID_CANVASITEM, NULL) ); item->grid = this; sp_canvas_item_show(SP_CANVAS_ITEM(item)); -- cgit v1.2.3 From 3fe641e7a50befb8ed9da2f122826f819cbd7009 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 15:31:48 -0500 Subject: Purge sp_desktop_main (bzr r13815) --- src/desktop-handles.cpp | 8 -------- src/desktop-handles.h | 1 - 2 files changed, 9 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index 588d54f53..deab560d3 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -23,14 +23,6 @@ sp_desktop_document (SPDesktop const * desktop) return desktop->doc(); } -SPCanvasGroup * -sp_desktop_main (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->main; -} - SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop) { diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 57689b3a0..344e09c30 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -45,7 +45,6 @@ namespace Inkscape { #define SP_COORDINATES_UNDERLINE_Y (1 << Geom::Y) SPDocument * sp_desktop_document (SPDesktop const * desktop); -SPCanvasGroup * sp_desktop_main (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_sketch (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop); -- cgit v1.2.3 From 9ae37e8df1124ebd67e3d6dc24429d03919144ea Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 15:51:24 -0500 Subject: Purge sp_desktop_sketch and sp_desktop_tempgroup (bzr r13816) --- src/desktop-handles.cpp | 16 ---------------- src/desktop-handles.h | 2 -- src/display/snap-indicator.cpp | 10 +++++----- src/live_effects/parameter/text.cpp | 2 +- src/rubberband.cpp | 2 +- src/selection-chemistry.cpp | 2 +- src/ui/dialog/spellcheck.cpp | 2 +- src/ui/tools/calligraphic-tool.cpp | 4 ++-- src/ui/tools/connector-tool.cpp | 2 +- src/ui/tools/eraser-tool.cpp | 4 ++-- src/ui/tools/freehand-base.cpp | 4 ++-- src/ui/tools/lpe-tool.cpp | 2 +- src/ui/tools/measure-tool.cpp | 28 ++++++++++++++-------------- src/ui/tools/node-tool.cpp | 4 ++-- src/ui/tools/pen-tool.cpp | 6 +++--- src/ui/tools/pencil-tool.cpp | 2 +- 16 files changed, 37 insertions(+), 55 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index deab560d3..d80564956 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -31,14 +31,6 @@ sp_desktop_guides (SPDesktop const * desktop) return desktop->guides; } -SPCanvasGroup * -sp_desktop_sketch (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->sketch; -} - SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop) { @@ -47,14 +39,6 @@ sp_desktop_controls (SPDesktop const * desktop) return desktop->controls; } -SPCanvasGroup * -sp_desktop_tempgroup (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->tempgroup; -} - Inkscape::MessageStack * sp_desktop_message_stack (SPDesktop const * desktop) { diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 344e09c30..6515b70d8 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -46,9 +46,7 @@ namespace Inkscape { SPDocument * sp_desktop_document (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop); -SPCanvasGroup * sp_desktop_sketch (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop); -SPCanvasGroup * sp_desktop_tempgroup (SPDesktop const * desktop); Inkscape::MessageStack * sp_desktop_message_stack (SPDesktop const * desktop); #endif // SEEN_SP_DESKTOP_HANDLES_H diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index 2632d69db..9df29b7b0 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -246,7 +246,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap // Display the snap indicator (i.e. the cross) SPCanvasItem * canvasitem = NULL; - canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop), + canvasitem = sp_canvas_item_new(_desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 10.0, @@ -280,7 +280,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap tooltip_pos += _desktop->w2d(Geom::Point(0, -2*fontsize)); } - SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(_desktop), _desktop, tooltip_pos, tooltip_str); + SPCanvasItem *canvas_tooltip = sp_canvastext_new(_desktop->getTempGroup(), _desktop, tooltip_pos, tooltip_str); sp_canvastext_set_fontsize(SP_CANVASTEXT(canvas_tooltip), fontsize); SP_CANVASTEXT(canvas_tooltip)->rgba = 0xffffffff; SP_CANVASTEXT(canvas_tooltip)->outline = false; @@ -299,7 +299,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap // Display the bounding box, if we snapped to one Geom::OptRect const bbox = p.getTargetBBox(); if (bbox) { - SPCanvasItem* box = sp_canvas_item_new(sp_desktop_tempgroup (_desktop), + SPCanvasItem* box = sp_canvas_item_new(_desktop->getTempGroup(), SP_TYPE_CTRLRECT, NULL); @@ -348,7 +348,7 @@ SnapIndicator::set_new_snapsource(Inkscape::SnapCandidatePoint const &p) bool value = prefs->getBool("/options/snapindicator/value", true); if (value) { - SPCanvasItem * canvasitem = sp_canvas_item_new( sp_desktop_tempgroup (_desktop), + SPCanvasItem * canvasitem = sp_canvas_item_new( _desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 6.0, @@ -367,7 +367,7 @@ void SnapIndicator::set_new_debugging_point(Geom::Point const &p) { g_assert(_desktop != NULL); - SPCanvasItem * canvasitem = sp_canvas_item_new( sp_desktop_tempgroup (_desktop), + SPCanvasItem * canvasitem = sp_canvas_item_new( _desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 10.0, diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 3b58a4c67..8a5f50145 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -34,7 +34,7 @@ TextParam::TextParam( const Glib::ustring& label, const Glib::ustring& tip, defvalue(default_value) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; // FIXME: we shouldn't use this! - canvas_text = (SPCanvasText *) sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, Geom::Point(0,0), ""); + canvas_text = (SPCanvasText *) sp_canvastext_new(desktop->getTempGroup(), desktop, Geom::Point(0,0), ""); sp_canvastext_set_text (canvas_text, default_value.c_str()); sp_canvastext_set_coords (canvas_text, 0, 0); } diff --git a/src/rubberband.cpp b/src/rubberband.cpp index 6ec4b3e45..2111a6d50 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -109,7 +109,7 @@ void Inkscape::Rubberband::move(Geom::Point const &p) } else if (_mode == RUBBERBAND_MODE_TOUCHPATH) { if (_touchpath == NULL) { - _touchpath = sp_canvas_bpath_new(sp_desktop_sketch(_desktop), NULL); + _touchpath = sp_canvas_bpath_new(_desktop->getSketch(), NULL); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(_touchpath), 0xff0000ff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(_touchpath), 0, SP_WIND_RULE_NONZERO); } diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 91200bacb..1935cf62f 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2856,7 +2856,7 @@ sp_select_clone_original(SPDesktop *desktop) curve->moveto(a->midpoint()); curve->lineto(b->midpoint()); - SPCanvasItem * canvasitem = sp_canvas_bpath_new(sp_desktop_tempgroup(desktop), curve); + SPCanvasItem * canvasitem = sp_canvas_bpath_new(desktop->getTempGroup(), curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvasitem), 0x0000ddff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT, 5, 3); sp_canvas_item_show(canvasitem); curve->unref(); diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 9faa8a2cb..e42b58966 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -612,7 +612,7 @@ SpellCheck::nextWord() area.expandBy(MAX(0.05 * mindim, 1)); // create canvas path rectangle, red stroke - SPCanvasItem *rect = sp_canvas_bpath_new(sp_desktop_sketch(desktop), NULL); + SPCanvasItem *rect = sp_canvas_bpath_new(desktop->getSketch(), NULL); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(rect), 0xff0000ff, 3.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(rect), 0, SP_WIND_RULE_NONZERO); SPCurve *curve = new SPCurve(); diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 821756a55..0daf9de5e 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -141,7 +141,7 @@ void CalligraphicTool::setup() { this->cal1 = new SPCurve(); this->cal2 = new SPCurve(); - this->currentshape = sp_canvas_item_new(sp_desktop_sketch(this->desktop), SP_TYPE_CANVAS_BPATH, NULL); + this->currentshape = sp_canvas_item_new(this->desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->currentshape), DDC_RED_RGBA, SP_WIND_RULE_EVENODD); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->currentshape), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); @@ -1142,7 +1142,7 @@ void CalligraphicTool::fit_and_split(bool release) { if (!release) { g_assert(!this->currentcurve->is_empty()); - SPCanvasItem *cbp = sp_canvas_item_new(sp_desktop_sketch(desktop), + SPCanvasItem *cbp = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); SPCurve *curve = this->currentcurve->copy(); diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 38a9017d1..3235d2356 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -231,7 +231,7 @@ void ConnectorTool::setup() { ); /* Create red bpath */ - this->red_bpath = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), NULL); + this->red_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), NULL); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->red_bpath), this->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->red_bpath), 0x00000000, diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index b8d008421..2d86915c2 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -121,7 +121,7 @@ void EraserTool::setup() { this->cal1 = new SPCurve(); this->cal2 = new SPCurve(); - this->currentshape = sp_canvas_item_new(sp_desktop_sketch(desktop), SP_TYPE_CANVAS_BPATH, NULL); + this->currentshape = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->currentshape), ERC_RED_RGBA, SP_WIND_RULE_EVENODD); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->currentshape), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); @@ -949,7 +949,7 @@ void EraserTool::fit_and_split(bool release) { gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0; g_assert(!this->currentcurve->is_empty()); - SPCanvasItem *cbp = sp_canvas_item_new(sp_desktop_sketch(desktop), SP_TYPE_CANVAS_BPATH, NULL); + SPCanvasItem *cbp = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); SPCurve *curve = this->currentcurve->copy(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve); curve->unref(); diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 95cb112fb..14d9b8815 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -128,14 +128,14 @@ void FreehandBase::setup() { ); // Create red bpath - this->red_bpath = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), NULL); + this->red_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), NULL); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->red_bpath), this->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); // Create red curve this->red_curve = new SPCurve(); // Create blue bpath - this->blue_bpath = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), NULL); + this->blue_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), NULL); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->blue_bpath), this->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); // Create blue curve diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 408116389..30e663645 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -404,7 +404,7 @@ lpetool_create_measuring_items(LpeTool *lc, Inkscape::Selection *selection) SPPath *path; SPCurve *curve; SPCanvasText *canvas_text; - SPCanvasGroup *tmpgrp = sp_desktop_tempgroup(lc->desktop); + SPCanvasGroup *tmpgrp = lc->desktop->getTempGroup(); gchar *arc_length; double lengthval; diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 6b5cbeccd..6fa409ada 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -228,7 +228,7 @@ void createAngleDisplayCurve(SPDesktop *desktop, Geom::Point const ¢er, Geom yc + ay + (k2 * ax)); Geom::Point p3(xc + bx + (k2 * by), yc + by - (k2 * bx)); - SPCtrlCurve *curve = ControlManager::getManager().createControlCurve(sp_desktop_tempgroup(desktop), p1, p2, p3, p4, CTLINE_SECONDARY); + SPCtrlCurve *curve = ControlManager::getManager().createControlCurve(desktop->getTempGroup(), p1, p2, p3, p4, CTLINE_SECONDARY); measure_tmp_items.push_back(desktop->add_temporary_canvasitem(SP_CANVAS_ITEM(curve), 0, true)); } @@ -525,7 +525,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { // TODO cleanup memory, Glib::ustring, etc.: gchar *measure_str = g_strdup_printf("%.2f %s", place.lengthVal, unit_name.c_str()); - SPCanvasText *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), + SPCanvasText *canvas_tooltip = sp_canvastext_new(desktop->getTempGroup(), desktop, place.end, measure_str); @@ -548,7 +548,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { // TODO cleanup memory, Glib::ustring, etc.: gchar *angle_str = g_strdup_printf("%.2f °", angle * 180/M_PI); - SPCanvasText *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), + SPCanvasText *canvas_tooltip = sp_canvastext_new(desktop->getTempGroup(), desktop, angleDisplayPt, angle_str); @@ -569,7 +569,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { // TODO cleanup memory, Glib::ustring, etc.: gchar *totallength_str = g_strdup_printf("%.2f %s", totallengthval, unit_name.c_str()); - SPCanvasText *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), + SPCanvasText *canvas_tooltip = sp_canvastext_new(desktop->getTempGroup(), desktop, end_point + desktop->w2d(Geom::Point(3*fontsize, -fontsize)), totallength_str); @@ -590,7 +590,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { // TODO cleanup memory, Glib::ustring, etc.: gchar *total_str = g_strdup_printf("%.2f %s", totallengthval, unit_name.c_str()); - SPCanvasText *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), + SPCanvasText *canvas_tooltip = sp_canvastext_new(desktop->getTempGroup(), desktop, desktop->doc2dt((intersections[0] + intersections[intersections.size()-1])/2) + normal * 60, total_str); @@ -609,7 +609,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { for (size_t idx = 0; idx < intersections.size(); ++idx) { // Display the intersection indicator (i.e. the cross) - SPCanvasItem * canvasitem = sp_canvas_item_new(sp_desktop_tempgroup(desktop), + SPCanvasItem * canvasitem = sp_canvas_item_new(desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 8.0, @@ -627,7 +627,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { // draw main control line { - SPCtrlLine *control_line = ControlManager::getManager().createControlLine(sp_desktop_tempgroup(desktop), + SPCtrlLine *control_line = ControlManager::getManager().createControlLine(desktop->getTempGroup(), start_point, end_point); measure_tmp_items.push_back(desktop->add_temporary_canvasitem(control_line, 0)); @@ -642,7 +642,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { * Geom::Affine(Geom::Translate(start_point))); } - SPCtrlLine *control_line = ControlManager::getManager().createControlLine(sp_desktop_tempgroup(desktop), + SPCtrlLine *control_line = ControlManager::getManager().createControlLine(desktop->getTempGroup(), start_point, anchorEnd, CTLINE_SECONDARY); @@ -655,17 +655,17 @@ bool MeasureTool::root_handler(GdkEvent* event) { if (intersections.size() > 2) { ControlManager &mgr = ControlManager::getManager(); SPCtrlLine *control_line = 0; - control_line = mgr.createControlLine(sp_desktop_tempgroup(desktop), + control_line = mgr.createControlLine(desktop->getTempGroup(), desktop->doc2dt(intersections[0]) + normal * 60, desktop->doc2dt(intersections[intersections.size() - 1]) + normal * 60); measure_tmp_items.push_back(desktop->add_temporary_canvasitem(control_line, 0)); - control_line = mgr.createControlLine(sp_desktop_tempgroup(desktop), + control_line = mgr.createControlLine(desktop->getTempGroup(), desktop->doc2dt(intersections[0]), desktop->doc2dt(intersections[0]) + normal * 65); measure_tmp_items.push_back(desktop->add_temporary_canvasitem(control_line, 0)); - control_line = mgr.createControlLine(sp_desktop_tempgroup(desktop), + control_line = mgr.createControlLine(desktop->getTempGroup(), desktop->doc2dt(intersections[intersections.size() - 1]), desktop->doc2dt(intersections[intersections.size() - 1]) + normal * 65); measure_tmp_items.push_back(desktop->add_temporary_canvasitem(control_line, 0)); @@ -677,7 +677,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { LabelPlacement &place = *it; ControlManager &mgr = ControlManager::getManager(); - SPCtrlLine *control_line = mgr.createControlLine(sp_desktop_tempgroup(desktop), + SPCtrlLine *control_line = mgr.createControlLine(desktop->getTempGroup(), place.start, place.end, CTLINE_SECONDARY); @@ -689,7 +689,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { Geom::Point measure_text_pos = (intersections[idx - 1] + intersections[idx]) / 2; ControlManager &mgr = ControlManager::getManager(); - SPCtrlLine *control_line = mgr.createControlLine(sp_desktop_tempgroup(desktop), + SPCtrlLine *control_line = mgr.createControlLine(desktop->getTempGroup(), desktop->doc2dt(measure_text_pos), desktop->doc2dt(measure_text_pos) - (normal * DIMENSION_OFFSET), CTLINE_SECONDARY); @@ -699,7 +699,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { // Initial point { - SPCanvasItem * canvasitem = sp_canvas_item_new(sp_desktop_tempgroup(desktop), + SPCanvasItem * canvasitem = sp_canvas_item_new(desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 8.0, diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 6a2a780f1..598cd1e96 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -324,7 +324,7 @@ void NodeTool::update_helperpath () { cc->reset(); } if (!c->is_empty()) { - SPCanvasItem *helperpath = sp_canvas_bpath_new(sp_desktop_tempgroup(this->desktop), c); + SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); sp_canvas_item_affine_absolute(helperpath, selection->singleItem()->i2dt_affine()); @@ -527,7 +527,7 @@ bool NodeTool::root_handler(GdkEvent* event) { } c->transform(over_item->i2dt_affine()); - SPCanvasItem *flash = sp_canvas_bpath_new(sp_desktop_tempgroup(desktop), c); + SPCanvasItem *flash = sp_canvas_bpath_new(desktop->getTempGroup(), c); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(flash), //prefs->getInt("/tools/nodes/highlight_color", 0xff0000ff), 1.0, diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 7a403eef7..78724b180 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -885,7 +885,7 @@ void PenTool::_redrawAll() { this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data); } // one canvas bpath for all of green_curve - SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), this->green_curve); + SPCanvasItem *cshape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cshape), 0, SP_WIND_RULE_NONZERO); @@ -1419,7 +1419,7 @@ void PenTool::_bspline_spiro_color() this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data); } // one canvas bpath for all of green_curve - SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), this->green_curve); + SPCanvasItem *cshape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cshape), 0, SP_WIND_RULE_NONZERO); this->green_bpaths = g_slist_prepend(this->green_bpaths, cshape); @@ -2165,7 +2165,7 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) { SPCurve *curve = this->red_curve->copy(); /// \todo fixme: - SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), curve); + SPCanvasItem *cshape = sp_canvas_bpath_new(this->desktop->getSketch(), curve); curve->unref(); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index d938105ef..ecb3ca12a 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -853,7 +853,7 @@ void PencilTool::_fitAndSplit() { SPCurve *curve = this->red_curve->copy(); /// \todo fixme: - SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), curve); + SPCanvasItem *cshape = sp_canvas_bpath_new(this->desktop->getSketch(), curve); curve->unref(); this->highlight_color = SP_ITEM(this->desktop->currentLayer())->highlight_color(); -- cgit v1.2.3 From 2135fdee3aeff1dd82d11f191a7295990cd60cb5 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 16:01:01 -0500 Subject: Purge sp_desktop_message_stack (bzr r13817) --- src/desktop-handles.cpp | 8 -------- src/desktop-handles.h | 1 - src/path-chemistry.cpp | 16 ++++++++-------- src/text-chemistry.cpp | 26 +++++++++++++------------- src/trace/potrace/inkscape-potrace.cpp | 6 +++--- src/trace/trace.cpp | 6 +++--- src/ui/dialog/clonetiler.cpp | 8 ++++---- src/ui/dialog/inkscape-preferences.cpp | 4 ++-- src/ui/dialog/svg-fonts-dialog.cpp | 4 ++-- src/ui/dialog/transformation.cpp | 14 +++++++------- src/ui/tools/gradient-tool.cpp | 2 +- src/ui/tools/mesh-tool.cpp | 2 +- 12 files changed, 44 insertions(+), 53 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index d80564956..821f91b54 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -38,11 +38,3 @@ sp_desktop_controls (SPDesktop const * desktop) return desktop->controls; } - -Inkscape::MessageStack * -sp_desktop_message_stack (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->messageStack(); -} diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 6515b70d8..72a8a696a 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -47,7 +47,6 @@ namespace Inkscape { SPDocument * sp_desktop_document (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop); -Inkscape::MessageStack * sp_desktop_message_stack (SPDesktop const * desktop); #endif // SEEN_SP_DESKTOP_HANDLES_H diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index c63a4fc35..37b80f45d 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -51,7 +51,7 @@ sp_selected_path_combine(SPDesktop *desktop) SPDocument *doc = sp_desktop_document(desktop); if (g_slist_length((GSList *) selection->itemList()) < 1) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to combine.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to combine.")); return; } @@ -178,7 +178,7 @@ sp_selected_path_combine(SPDesktop *desktop) Inkscape::GC::release(repr); } else { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No path(s) to combine in the selection.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No path(s) to combine in the selection.")); } desktop->clearWaitingCursor(); @@ -190,7 +190,7 @@ sp_selected_path_break_apart(SPDesktop *desktop) Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select path(s) to break apart.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select path(s) to break apart.")); return; } @@ -286,7 +286,7 @@ sp_selected_path_break_apart(SPDesktop *desktop) DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART, _("Break apart")); } else { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No path(s) to break apart in the selection.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No path(s) to break apart in the selection.")); } } @@ -296,7 +296,7 @@ sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, b { if (selection->isEmpty()) { if (interactive && desktop) - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to convert to path.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to convert to path.")); return; } @@ -326,7 +326,7 @@ sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, b DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE, _("Object to path")); } else { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No objects to convert to path in the selection.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No objects to convert to path in the selection.")); return; } } @@ -617,7 +617,7 @@ sp_selected_path_reverse(SPDesktop *desktop) GSList *items = (GSList *) selection->itemList(); if (!items) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select path(s) to reverse.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select path(s) to reverse.")); return; } @@ -663,7 +663,7 @@ sp_selected_path_reverse(SPDesktop *desktop) DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE, _("Reverse path")); } else { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No paths to reverse in the selection.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No paths to reverse in the selection.")); } } diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index b90145f8e..61ae2466b 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -91,18 +91,18 @@ text_put_on_path() Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); if (!text || !shape || g_slist_length((GSList *) selection->itemList()) != 2) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select a text and a path to put text on path.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select a text and a path to put text on path.")); return; } if (SP_IS_TEXT_TEXTPATH(text)) { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("This text object is already put on a path. Remove it from the path first. Use Shift+D to look up its path.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("This text object is already put on a path. Remove it from the path first. Use Shift+D to look up its path.")); return; } if (SP_IS_RECT(shape)) { // rect is the only SPShape which is not yet, and thus SVG forbids us from putting text on it - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("You cannot put text on a rectangle in this version. Convert rectangle to path first.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("You cannot put text on a rectangle in this version. Convert rectangle to path first.")); return; } @@ -110,7 +110,7 @@ text_put_on_path() if (SP_IS_FLOWTEXT(text)) { if (!SP_FLOWTEXT(text)->layout.outputExists()) { - sp_desktop_message_stack(desktop)-> + desktop->getMessageStack()-> flash(Inkscape::WARNING_MESSAGE, _("The flowed text(s) must be visible in order to be put on a path.")); } @@ -194,7 +194,7 @@ text_remove_from_path() Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select a text on path to remove it from path.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select a text on path to remove it from path.")); return; } @@ -215,7 +215,7 @@ text_remove_from_path() } if (!did) { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No texts-on-paths in the selection.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No texts-on-paths in the selection.")); } else { DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Remove text from path")); @@ -259,7 +259,7 @@ text_remove_all_kerns() Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select text(s) to remove kerns from.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select text(s) to remove kerns from.")); return; } @@ -280,7 +280,7 @@ text_remove_all_kerns() } if (!did) { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("Select text(s) to remove kerns from.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("Select text(s) to remove kerns from.")); } else { DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Remove manual kerns")); @@ -303,7 +303,7 @@ text_flow_into_shape() SPItem *shape = shape_in_selection(selection); if (!text || !shape || g_slist_length((GSList *) selection->itemList()) < 2) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select a text and one or more paths or shapes to flow text into frame.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select a text and one or more paths or shapes to flow text into frame.")); return; } @@ -395,7 +395,7 @@ text_unflow () if (!flowtext_in_selection(selection) || g_slist_length((GSList *) selection->itemList()) < 1) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select a flowed text to unflow it.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select a flowed text to unflow it.")); return; } @@ -480,7 +480,7 @@ flowtext_to_text() Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select flowed text(s) to convert.")); return; } @@ -497,7 +497,7 @@ flowtext_to_text() continue; if (!SP_FLOWTEXT(item)->layout.outputExists()) { - sp_desktop_message_stack(desktop)-> + desktop->getMessageStack()-> flash(Inkscape::WARNING_MESSAGE, _("The flowed text(s) must be visible in order to be converted.")); return; @@ -530,7 +530,7 @@ flowtext_to_text() _("Convert flowed text to text")); selection->setReprList(reprs); } else { - sp_desktop_message_stack(desktop)-> + desktop->getMessageStack()-> flash(Inkscape::ERROR_MESSAGE, _("No flowed text(s) to convert in the selection.")); } diff --git a/src/trace/potrace/inkscape-potrace.cpp b/src/trace/potrace/inkscape-potrace.cpp index 59dd6f254..69138463d 100644 --- a/src/trace/potrace/inkscape-potrace.cpp +++ b/src/trace/potrace/inkscape-potrace.cpp @@ -25,7 +25,7 @@ #include "trace/imagemap-gdk.h" #include -#include +#include "desktop.h" #include "message-stack.h" #include #include @@ -510,7 +510,7 @@ std::vector PotraceTracingEngine::traceBrightnessMulti(GdkP SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) { ustring msg = ustring::compose(_("Trace: %1. %2 nodes"), traceCount++, nodeCount); - sp_desktop_message_stack(desktop)->flash(Inkscape::NORMAL_MESSAGE, msg); + desktop->getMessageStack()->flash(Inkscape::NORMAL_MESSAGE, msg); } } } @@ -573,7 +573,7 @@ std::vector PotraceTracingEngine::traceQuant(GdkPixbuf * th SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) { ustring msg = ustring::compose(_("Trace: %1. %2 nodes"), colorIndex, nodeCount); - sp_desktop_message_stack(desktop)->flash(Inkscape::NORMAL_MESSAGE, msg); + desktop->getMessageStack()->flash(Inkscape::NORMAL_MESSAGE, msg); } } }// for colorIndex diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index 11a54dcc2..d856d37d8 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -51,7 +51,7 @@ SPImage *Tracer::getSelectedSPImage() return NULL; } - Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); + Inkscape::MessageStack *msgStack = desktop->getMessageStack(); Inkscape::Selection *sel = desktop->getSelection(); if (!sel) @@ -217,7 +217,7 @@ Glib::RefPtr Tracer::sioxProcessImage(SPImage *img, Glib::RefPtr(NULL); } - Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); + Inkscape::MessageStack *msgStack = desktop->getMessageStack(); Inkscape::Selection *sel = desktop->getSelection(); if (!sel) @@ -397,7 +397,7 @@ void Tracer::traceThread() return; } - Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); + Inkscape::MessageStack *msgStack = desktop->getMessageStack(); Inkscape::Selection *selection = desktop->getSelection(); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 2adb6598c..aa373e4f7 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -2097,7 +2097,7 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) // check if something is selected if (selection->isEmpty() || g_slist_length((GSList *) selection->itemList()) > 1) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select one object whose tiled clones to unclump.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select one object whose tiled clones to unclump.")); return; } @@ -2148,7 +2148,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d // check if something is selected if (selection->isEmpty() || g_slist_length((GSList *) selection->itemList()) > 1) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select one object whose tiled clones to remove.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select one object whose tiled clones to remove.")); return; } @@ -2220,13 +2220,13 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) // check if something is selected if (selection->isEmpty()) { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select an object to clone.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select an object to clone.")); return; } // Check if more than one object is selected. if (g_slist_length((GSList *) selection->itemList()) > 1) { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("If you want to clone several objects, group them and clone the group.")); + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("If you want to clone several objects, group them and clone the group.")); return; } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index cea489f50..31dddda7c 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -216,7 +216,7 @@ static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatc Inkscape::Selection *selection = desktop->getSelection(); if (selection->isEmpty()) { - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No objects selected to take the style from.")); return; } @@ -225,7 +225,7 @@ static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatc /* TODO: If each item in the selection has the same style then don't consider it an error. * Maybe we should try to handle multiple selections anyway, e.g. the intersection of the * style attributes for the selected items. */ - sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, + desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("More than one object selected. Cannot take style from multiple objects.")); return; } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 901cfc40a..55eed9a99 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -515,7 +515,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ return; } - Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); + Inkscape::MessageStack *msgStack = desktop->getMessageStack(); SPDocument* doc = sp_desktop_document(desktop); Inkscape::Selection* sel = desktop->getSelection(); if (sel->isEmpty()){ @@ -557,7 +557,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ return; } - Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); + Inkscape::MessageStack *msgStack = desktop->getMessageStack(); SPDocument* doc = sp_desktop_document(desktop); Inkscape::Selection* sel = desktop->getSelection(); if (sel->isEmpty()){ diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 924aa129b..d7cca13a8 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -904,7 +904,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) double skewX = _scalar_skew_horizontal.getValue("%"); double skewY = _scalar_skew_vertical.getValue("%"); if (fabs(0.01*skewX*0.01*skewY - 1.0) < Geom::EPSILON) { - sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); + getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } sp_item_skew_rel (item, 0.01*skewX, 0.01*skewY); @@ -915,7 +915,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) || (fabs(angleX - angleY - M_PI/2) < Geom::EPSILON) || (fabs((angleX - angleY)/3 + M_PI/2) < Geom::EPSILON) || (fabs((angleX - angleY)/3 - M_PI/2) < Geom::EPSILON)) { - sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); + getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } double skewX = tan(-angleX); @@ -929,7 +929,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) double width = bbox->dimensions()[Geom::X]; double height = bbox->dimensions()[Geom::Y]; if (fabs(skewX*skewY - width*height) < Geom::EPSILON) { - sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); + getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } sp_item_skew_rel (item, skewX/height, skewY/width); @@ -948,7 +948,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) double skewX = _scalar_skew_horizontal.getValue("%"); double skewY = _scalar_skew_vertical.getValue("%"); if (fabs(0.01*skewX*0.01*skewY - 1.0) < Geom::EPSILON) { - sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); + getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } sp_selection_skew_relative(selection, *center, 0.01*skewX, 0.01*skewY); @@ -959,7 +959,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) || (fabs(angleX - angleY - M_PI/2) < Geom::EPSILON) || (fabs((angleX - angleY)/3 + M_PI/2) < Geom::EPSILON) || (fabs((angleX - angleY)/3 - M_PI/2) < Geom::EPSILON)) { - sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); + getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } double skewX = tan(-angleX); @@ -969,7 +969,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); if (fabs(skewX*skewY - width*height) < Geom::EPSILON) { - sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); + getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } sp_selection_skew_relative(selection, *center, skewX/height, skewY/width); @@ -993,7 +993,7 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) Geom::Affine displayed(a, b, c, d, e, f); if (displayed.isSingular()) { - sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); + getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index fe8774ace..b674b6a8a 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -957,7 +957,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta "Gradient for %d objects; with Ctrl to snap angle", n_objects), n_objects); } else { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select objects on which to create gradient.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select objects on which to create gradient.")); } } diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 79a0bb8f2..d512fadb5 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -994,7 +994,7 @@ static void sp_mesh_drag(MeshTool &rc, Geom::Point const /*pt*/, guint /*state*/ "Gradient for %d objects; with Ctrl to snap angle", n_objects), n_objects); } else { - sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select objects on which to create gradient.")); + desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select objects on which to create gradient.")); } } -- cgit v1.2.3 From e71d9e4cd6c966149476214d55d4cde51aed6ac3 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 16:02:05 -0500 Subject: Purge sp_desktop_guides (bzr r13818) --- src/desktop-handles.cpp | 8 -------- src/desktop-handles.h | 1 - 2 files changed, 9 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index 821f91b54..f3d7e796f 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -23,14 +23,6 @@ sp_desktop_document (SPDesktop const * desktop) return desktop->doc(); } -SPCanvasGroup * -sp_desktop_guides (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->guides; -} - SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop) { diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 72a8a696a..d8e93f995 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -45,7 +45,6 @@ namespace Inkscape { #define SP_COORDINATES_UNDERLINE_Y (1 << Geom::Y) SPDocument * sp_desktop_document (SPDesktop const * desktop); -SPCanvasGroup * sp_desktop_guides (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop); #endif // SEEN_SP_DESKTOP_HANDLES_H -- cgit v1.2.3 From cc7cd3e3f64a8d6c1cc16cb5fa4fa76793d23caf Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 16:12:46 -0500 Subject: Purge sp_desktop_controls (bzr r13819) --- src/desktop-handles.cpp | 8 -------- src/desktop-handles.h | 1 - src/gradient-drag.cpp | 4 ++-- src/knot.cpp | 2 +- src/line-geometry.cpp | 4 ++-- src/rubberband.cpp | 2 +- src/selcue.cpp | 6 +++--- src/seltrans.cpp | 6 +++--- src/ui/draw-anchor.cpp | 3 +-- src/ui/tool/control-point.cpp | 4 ++-- src/ui/tool/selector.cpp | 4 ++-- src/ui/tool/transform-handle-set.cpp | 2 +- src/ui/tools/calligraphic-tool.cpp | 2 +- src/ui/tools/dropper-tool.cpp | 2 +- src/ui/tools/lpe-tool.cpp | 2 +- src/ui/tools/node-tool.cpp | 2 +- src/ui/tools/pen-tool.cpp | 8 ++++---- src/ui/tools/spray-tool.cpp | 2 +- src/ui/tools/text-tool.cpp | 8 ++++---- src/ui/tools/tweak-tool.cpp | 2 +- src/vanishing-point.cpp | 2 +- 21 files changed, 33 insertions(+), 43 deletions(-) diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index f3d7e796f..64f75c6a2 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -22,11 +22,3 @@ sp_desktop_document (SPDesktop const * desktop) return desktop->doc(); } - -SPCanvasGroup * -sp_desktop_controls (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->controls; -} diff --git a/src/desktop-handles.h b/src/desktop-handles.h index d8e93f995..b5891651b 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -45,7 +45,6 @@ namespace Inkscape { #define SP_COORDINATES_UNDERLINE_Y (1 << Geom::Y) SPDocument * sp_desktop_document (SPDesktop const * desktop); -SPCanvasGroup * sp_desktop_controls (SPDesktop const * desktop); #endif // SEEN_SP_DESKTOP_HANDLES_H diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 71a43164d..d38ae666e 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1869,7 +1869,7 @@ void GrDrag::setDeselected(GrDragger *dragger) void GrDrag::addLine(SPItem *item, Geom::Point p1, Geom::Point p2, Inkscape::PaintTarget fill_or_stroke) { CtrlLineType type = (fill_or_stroke == Inkscape::FOR_FILL) ? CTLINE_PRIMARY : CTLINE_SECONDARY; - SPCtrlLine *line = ControlManager::getManager().createControlLine(sp_desktop_controls(this->desktop), p1, p2, type); + SPCtrlLine *line = ControlManager::getManager().createControlLine(this->desktop->getControls(), p1, p2, type); sp_canvas_item_move_to_z(line, 0); line->item = item; @@ -1885,7 +1885,7 @@ void GrDrag::addLine(SPItem *item, Geom::Point p1, Geom::Point p2, Inkscape::Pai void GrDrag::addCurve(SPItem *item, Geom::Point p0, Geom::Point p1, Geom::Point p2, Geom::Point p3, Inkscape::PaintTarget fill_or_stroke) { CtrlLineType type = (fill_or_stroke == Inkscape::FOR_FILL) ? CTLINE_PRIMARY : CTLINE_SECONDARY; - SPCtrlCurve *line = ControlManager::getManager().createControlCurve(sp_desktop_controls(this->desktop), p0, p1, p2, p3, type); + SPCtrlCurve *line = ControlManager::getManager().createControlCurve(this->desktop->getControls(), p0, p1, p2, p3, type); sp_canvas_item_move_to_z(line, 0); line->item = item; diff --git a/src/knot.cpp b/src/knot.cpp index 4118873c1..c35f24a7c 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -109,7 +109,7 @@ SPKnot::SPKnot(SPDesktop *desktop, gchar const *tip) this->tip = g_strdup (tip); } - this->item = sp_canvas_item_new(sp_desktop_controls (desktop), + this->item = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 8.0, diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp index 1f6329be0..a2a2610fd 100644 --- a/src/line-geometry.cpp +++ b/src/line-geometry.cpp @@ -202,7 +202,7 @@ boost::optional Line::intersection_with_viewbox (SPDesktop *desktop void create_canvas_point(Geom::Point const &pos, double size, guint32 rgba) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPCanvasItem * canvas_pt = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRL, + SPCanvasItem * canvas_pt = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRL, "size", size, "filled", 1, "fill_color", rgba, @@ -215,7 +215,7 @@ void create_canvas_point(Geom::Point const &pos, double size, guint32 rgba) void create_canvas_line(Geom::Point const &p1, Geom::Point const &p2, guint32 rgba) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPCtrlLine *line = ControlManager::getManager().createControlLine(sp_desktop_controls(desktop), p1, p2); + SPCtrlLine *line = ControlManager::getManager().createControlLine(desktop->getControls(), p1, p2); line->setRgba32(rgba); sp_canvas_item_show(line); } diff --git a/src/rubberband.cpp b/src/rubberband.cpp index 2111a6d50..4a2b38944 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -98,7 +98,7 @@ void Inkscape::Rubberband::move(Geom::Point const &p) if (_mode == RUBBERBAND_MODE_RECT) { if (_rect == NULL) { - _rect = static_cast(sp_canvas_item_new(sp_desktop_controls(_desktop), SP_TYPE_CTRLRECT, NULL)); + _rect = static_cast(sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRLRECT, NULL)); _rect->setShadow(1, 0xffffffff); } _rect->setRectangle(Geom::Rect(_start, _end)); diff --git a/src/selcue.cpp b/src/selcue.cpp index 84c131dde..67744e1f8 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -155,7 +155,7 @@ void Inkscape::SelCue::_newItemBboxes() if (b) { if (mode == MARK) { - box = sp_canvas_item_new(sp_desktop_controls(_desktop), + box = sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRL, "mode", SP_CTRL_MODE_XOR, "shape", SP_CTRL_SHAPE_DIAMOND, @@ -171,7 +171,7 @@ void Inkscape::SelCue::_newItemBboxes() sp_canvas_item_move_to_z(box, 0); // just low enough to not get in the way of other draggable knots } else if (mode == BBOX) { - box = sp_canvas_item_new(sp_desktop_controls(_desktop), + box = sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRLRECT, NULL); @@ -208,7 +208,7 @@ void Inkscape::SelCue::_newTextBaselines() if (layout != NULL && layout->outputExists()) { boost::optional pt = layout->baselineAnchorPoint(); if (pt) { - baseline_point = sp_canvas_item_new(sp_desktop_controls(_desktop), SP_TYPE_CTRL, + baseline_point = sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRL, "mode", SP_CTRL_MODE_XOR, "size", 4.0, "filled", 0, diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 965b531a7..34b27b257 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -133,7 +133,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _selection = desktop->getSelection(); - _norm = sp_canvas_item_new(sp_desktop_controls(desktop), + _norm = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "mode", SP_CTRL_MODE_COLOR, @@ -146,7 +146,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : "pixbuf", handles[12], NULL); - _grip = sp_canvas_item_new(sp_desktop_controls(desktop), + _grip = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "mode", SP_CTRL_MODE_XOR, @@ -163,7 +163,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : sp_canvas_item_hide(_norm); for (int i = 0; i < 4; i++) { - _l[i] = ControlManager::getManager().createControlLine(sp_desktop_controls(desktop)); + _l[i] = ControlManager::getManager().createControlLine(desktop->getControls()); sp_canvas_item_hide(_l[i]); } diff --git a/src/ui/draw-anchor.cpp b/src/ui/draw-anchor.cpp index 84c919018..6b9a88ed7 100644 --- a/src/ui/draw-anchor.cpp +++ b/src/ui/draw-anchor.cpp @@ -15,7 +15,6 @@ #include "ui/draw-anchor.h" #include "desktop.h" -#include "desktop-handles.h" #include "ui/tools/tool-base.h" #include "ui/tools/lpe-tool.h" #include "display/sodipodi-ctrl.h" @@ -45,7 +44,7 @@ SPDrawAnchor *sp_draw_anchor_new(Inkscape::UI::Tools::FreehandBase *dc, SPCurve a->start = start; a->active = FALSE; a->dp = delta; - a->ctrl = ControlManager::getManager().createControl(sp_desktop_controls(&dc->getDesktop()), Inkscape::CTRL_TYPE_ANCHOR); + a->ctrl = ControlManager::getManager().createControl(dc->getDesktop().getControls(), Inkscape::CTRL_TYPE_ANCHOR); SP_CTRL(a->ctrl)->moveto(delta); diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index e98c7b2a2..c1a76c715 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -74,7 +74,7 @@ ControlPoint::ControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAncho _lurking(false) { _canvas_item = sp_canvas_item_new( - group ? group : sp_desktop_controls(_desktop), SP_TYPE_CTRL, + group ? group : _desktop->getControls(), SP_TYPE_CTRL, "anchor", (SPAnchorType) anchor, "size", (gdouble) pixbuf->get_width(), "shape", SP_CTRL_SHAPE_BITMAP, "pixbuf", pixbuf->gobj(), "filled", TRUE, "fill_color", _cset.normal.fill, @@ -93,7 +93,7 @@ ControlPoint::ControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAncho _position(initial_pos), _lurking(false) { - _canvas_item = ControlManager::getManager().createControl(group ? group : sp_desktop_controls(_desktop), type); + _canvas_item = ControlManager::getManager().createControl(group ? group : _desktop->getControls(), type); g_object_set(_canvas_item, "anchor", anchor, "filled", TRUE, "fill_color", _cset.normal.fill, diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index bdeacadc9..fe541e823 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -37,7 +37,7 @@ public: _cancel(false) { setVisible(false); - _rubber = static_cast(sp_canvas_item_new(sp_desktop_controls(_desktop), + _rubber = static_cast(sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRLRECT, NULL)); sp_canvas_item_hide(_rubber); } @@ -100,7 +100,7 @@ private: Selector::Selector(SPDesktop *d) : Manipulator(d) - , _dragger(new SelectorPoint(d, sp_desktop_controls(d), this)) + , _dragger(new SelectorPoint(d, d->getControls(), this)) { _dragger->setVisible(false); } diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 7d5c9bf0c..4b853d053 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -686,7 +686,7 @@ TransformHandleSet::TransformHandleSet(SPDesktop *d, SPCanvasGroup *th_group) , _in_transform(false) , _visible(true) { - _trans_outline = static_cast(sp_canvas_item_new(sp_desktop_controls(_desktop), + _trans_outline = static_cast(sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRLRECT, NULL)); sp_canvas_item_hide(_trans_outline); _trans_outline->setDashed(true); diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 0daf9de5e..36eccd93c 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -155,7 +155,7 @@ void CalligraphicTool::setup() { SPCurve *c = new SPCurve(path); - this->hatch_area = sp_canvas_bpath_new(sp_desktop_controls(this->desktop), c); + this->hatch_area = sp_canvas_bpath_new(this->desktop->getControls(), c); c->unref(); diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index 24dd7d0bf..d9a906cb8 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -99,7 +99,7 @@ void DropperTool::setup() { SPCurve *c = new SPCurve(path); - this->area = sp_canvas_bpath_new(sp_desktop_controls(this->desktop), c); + this->area = sp_canvas_bpath_new(this->desktop->getControls(), c); c->unref(); diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 30e663645..265c20ec8 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -371,7 +371,7 @@ lpetool_context_reset_limiting_bbox(LpeTool *lc) Geom::Rect rect(A, B); SPCurve *curve = SPCurve::new_from_rect(rect); - lc->canvas_bbox = sp_canvas_bpath_new (sp_desktop_controls(lc->desktop), curve); + lc->canvas_bbox = sp_canvas_bpath_new (lc->desktop->getControls(), curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(lc->canvas_bbox), 0x0000ffff, 0.8, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT, 5, 5); } diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 598cd1e96..a5d0df327 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -155,7 +155,7 @@ NodeTool::NodeTool() SPCanvasGroup *create_control_group(SPDesktop *d) { return reinterpret_cast(sp_canvas_item_new( - sp_desktop_controls(d), SP_TYPE_CANVAS_GROUP, NULL)); + d->getControls(), SP_TYPE_CANVAS_GROUP, NULL)); } void destroy_group(SPCanvasGroup *g) diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 78724b180..adb5c2866 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -192,14 +192,14 @@ void PenTool::setup() { ControlManager &mgr = ControlManager::getManager(); // Pen indicators - this->c0 = mgr.createControl(sp_desktop_controls(this->desktop), Inkscape::CTRL_TYPE_ADJ_HANDLE); + this->c0 = mgr.createControl(this->desktop->getControls(), Inkscape::CTRL_TYPE_ADJ_HANDLE); mgr.track(this->c0); - this->c1 = mgr.createControl(sp_desktop_controls(this->desktop), Inkscape::CTRL_TYPE_ADJ_HANDLE); + this->c1 = mgr.createControl(this->desktop->getControls(), Inkscape::CTRL_TYPE_ADJ_HANDLE); mgr.track(this->c1); - this->cl0 = mgr.createControlLine(sp_desktop_controls(this->desktop)); - this->cl1 = mgr.createControlLine(sp_desktop_controls(this->desktop)); + this->cl0 = mgr.createControlLine(this->desktop->getControls()); + this->cl1 = mgr.createControlLine(this->desktop->getControls()); sp_canvas_item_hide(this->c0); sp_canvas_item_hide(this->c1); diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index c36b77fb7..39c146351 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -222,7 +222,7 @@ void SprayTool::setup() { SPCurve *c = new SPCurve(path); - this->dilate_area = sp_canvas_bpath_new(sp_desktop_controls(this->desktop), c); + this->dilate_area = sp_canvas_bpath_new(this->desktop->getControls(), c); c->unref(); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->dilate_area), 0x00000000,(SPWindRule)0); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->dilate_area), 0xff9900ff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 674ba6a72..e6dde0581 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -131,17 +131,17 @@ void TextTool::setup() { timeout /= 2; } - this->cursor = ControlManager::getManager().createControlLine(sp_desktop_controls(desktop), Geom::Point(100, 0), Geom::Point(100, 100)); + this->cursor = ControlManager::getManager().createControlLine(desktop->getControls(), Geom::Point(100, 0), Geom::Point(100, 100)); this->cursor->setRgba32(0x000000ff); sp_canvas_item_hide(this->cursor); - this->indicator = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL); + this->indicator = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRLRECT, NULL); SP_CTRLRECT(this->indicator)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100))); SP_CTRLRECT(this->indicator)->setColor(0x0000ff7f, false, 0); SP_CTRLRECT(this->indicator)->setShadow(1, 0xffffff7f); sp_canvas_item_hide(this->indicator); - this->frame = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL); + this->frame = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRLRECT, NULL); SP_CTRLRECT(this->frame)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100))); SP_CTRLRECT(this->frame)->setColor(0x0000ff7f, false, 0); sp_canvas_item_hide(this->frame); @@ -1614,7 +1614,7 @@ static void sp_text_context_update_text_selection(TextTool *tc) quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, (tc->text)->i2dt_affine()); for (unsigned i = 0 ; i < quads.size() ; i += 4) { SPCanvasItem *quad_canvasitem; - quad_canvasitem = sp_canvas_item_new(sp_desktop_controls(tc->desktop), SP_TYPE_CTRLQUADR, NULL); + quad_canvasitem = sp_canvas_item_new(tc->desktop->getControls(), SP_TYPE_CTRLQUADR, NULL); // FIXME: make the color settable in prefs // for now, use semitrasparent blue, as cairo cannot do inversion :( sp_ctrlquadr_set_rgba32(SP_CTRLQUADR(quad_canvasitem), 0x00777777); diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index c3601138d..2b77c9d7a 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -274,7 +274,7 @@ void TweakTool::setup() { SPCurve *c = new SPCurve(path); - this->dilate_area = sp_canvas_bpath_new(sp_desktop_controls(this->desktop), c); + this->dilate_area = sp_canvas_bpath_new(this->desktop->getControls(), c); c->unref(); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->dilate_area), 0x00000000,(SPWindRule)0); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->dilate_area), 0xff9900ff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index d041973a3..fa62b8e8c 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -782,7 +782,7 @@ VPDrag::swap_perspectives_of_VPs(Persp3D *persp2, Persp3D *persp1) void VPDrag::addLine(Geom::Point const &p1, Geom::Point const &p2, Inkscape::CtrlLineType type) { - SPCtrlLine *line = ControlManager::getManager().createControlLine(sp_desktop_controls(SP_ACTIVE_DESKTOP), p1, p2, type); + SPCtrlLine *line = ControlManager::getManager().createControlLine(SP_ACTIVE_DESKTOP->getControls(), p1, p2, type); sp_canvas_item_show(line); this->lines = g_slist_append(this->lines, line); } -- cgit v1.2.3 From 3dbf9a08680c6d7252c79397dbf12082ead61bd7 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 16:58:32 -0500 Subject: Remove sp_desktop_document and finish cleanup of desktop-handles.h (bzr r13820) --- src/CMakeLists.txt | 2 - src/Makefile_insert | 1 - src/box3d.cpp | 2 +- src/conn-avoid-ref.cpp | 6 +- src/desktop-events.cpp | 10 +-- src/desktop-handles.cpp | 24 ------ src/desktop-handles.h | 60 -------------- src/desktop.cpp | 8 +- src/desktop.h | 3 + src/display/canvas-axonomgrid.cpp | 2 +- src/display/canvas-grid.cpp | 2 +- src/display/nr-filter-primitive.cpp | 2 +- src/display/snap-indicator.cpp | 2 +- src/extension/dbus/application-interface.cpp | 2 +- src/extension/dbus/document-interface.cpp | 2 +- src/extension/effect.cpp | 2 +- src/extension/execution-env.cpp | 2 +- src/extension/implementation/implementation.cpp | 2 +- src/extension/implementation/script.cpp | 2 +- src/extension/internal/bitmap/imagemagick.cpp | 2 +- src/extension/internal/grid.cpp | 2 +- src/file.cpp | 10 +-- src/gradient-chemistry.cpp | 6 +- src/gradient-drag.cpp | 15 ++-- src/helper/stock-items.cpp | 6 +- src/inkscape.cpp | 4 +- src/knot.cpp | 4 +- src/layer-manager.cpp | 2 +- src/line-geometry.cpp | 2 +- src/live_effects/parameter/path.cpp | 2 +- src/live_effects/parameter/text.cpp | 2 +- src/main-cmdlineact.cpp | 1 - src/path-chemistry.cpp | 12 +-- src/persp3d.cpp | 6 +- src/rubberband.cpp | 2 +- src/selcue.cpp | 2 +- src/selection-chemistry.cpp | 104 ++++++++++++------------ src/seltrans.cpp | 18 ++-- src/sp-flowtext.cpp | 4 +- src/sp-guide.cpp | 6 +- src/sp-item-group.cpp | 2 +- src/sp-item.cpp | 2 +- src/sp-namedview.cpp | 10 +-- src/sp-path.cpp | 2 +- src/splivarot.cpp | 22 ++--- src/text-chemistry.cpp | 20 ++--- src/trace/trace.cpp | 2 +- src/ui/clipboard.cpp | 2 +- src/ui/dialog/align-and-distribute.cpp | 28 +++---- src/ui/dialog/clonetiler.cpp | 22 ++--- src/ui/dialog/color-item.cpp | 6 +- src/ui/dialog/dialog.cpp | 2 +- src/ui/dialog/document-metadata.cpp | 2 +- src/ui/dialog/document-properties.cpp | 30 +++---- src/ui/dialog/export.cpp | 15 ++-- src/ui/dialog/fill-and-stroke.cpp | 2 +- src/ui/dialog/filter-effects-dialog.cpp | 12 +-- src/ui/dialog/find.cpp | 6 +- src/ui/dialog/font-substitution.cpp | 2 +- src/ui/dialog/grid-arrange-tab.cpp | 6 +- src/ui/dialog/guides.cpp | 2 +- src/ui/dialog/icon-preview.cpp | 2 +- src/ui/dialog/inkscape-preferences.cpp | 2 +- src/ui/dialog/layer-properties.cpp | 6 +- src/ui/dialog/livepatheffect-editor.cpp | 10 +-- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 2 +- src/ui/dialog/lpe-powerstroke-properties.cpp | 2 +- src/ui/dialog/object-attributes.cpp | 2 +- src/ui/dialog/object-properties.cpp | 2 +- src/ui/dialog/polar-arrange-tab.cpp | 4 +- src/ui/dialog/spellcheck.cpp | 6 +- src/ui/dialog/svg-fonts-dialog.cpp | 30 +++---- src/ui/dialog/swatches.cpp | 4 +- src/ui/dialog/symbols.cpp | 4 +- src/ui/dialog/template-widget.cpp | 6 +- src/ui/dialog/text-edit.cpp | 8 +- src/ui/dialog/transformation.cpp | 12 +-- src/ui/dialog/undo-history.cpp | 2 +- src/ui/dialog/xml-tree.cpp | 6 +- src/ui/interface.cpp | 4 +- src/ui/object-edit.cpp | 2 +- src/ui/shape-editor.cpp | 4 +- src/ui/tool/control-point.cpp | 2 +- src/ui/tool/multi-path-manipulator.cpp | 8 +- src/ui/tool/node.cpp | 2 +- src/ui/tool/path-manipulator.cpp | 6 +- src/ui/tool/selector.cpp | 2 +- src/ui/tool/transform-handle-set.cpp | 2 +- src/ui/tools-switch.cpp | 2 +- src/ui/tools/arc-tool.cpp | 6 +- src/ui/tools/box3d-tool.cpp | 10 +-- src/ui/tools/calligraphic-tool.cpp | 4 +- src/ui/tools/connector-tool.cpp | 14 ++-- src/ui/tools/dropper-tool.cpp | 4 +- src/ui/tools/eraser-tool.cpp | 10 +-- src/ui/tools/flood-tool.cpp | 10 +-- src/ui/tools/freehand-base.cpp | 6 +- src/ui/tools/gradient-tool.cpp | 10 +-- src/ui/tools/lpe-tool.cpp | 6 +- src/ui/tools/measure-tool.cpp | 6 +- src/ui/tools/mesh-tool.cpp | 10 +-- src/ui/tools/node-tool.cpp | 4 +- src/ui/tools/node-tool.h | 2 + src/ui/tools/pen-tool.cpp | 2 +- src/ui/tools/pencil-tool.cpp | 2 +- src/ui/tools/rect-tool.cpp | 6 +- src/ui/tools/select-tool.cpp | 10 +-- src/ui/tools/spiral-tool.cpp | 6 +- src/ui/tools/spray-tool.cpp | 8 +- src/ui/tools/star-tool.cpp | 6 +- src/ui/tools/text-tool.cpp | 46 +++++------ src/ui/tools/tool-base.cpp | 2 +- src/ui/tools/tweak-tool.cpp | 28 +++---- src/ui/widget/color-picker.cpp | 4 +- src/ui/widget/filter-effect-chooser.cpp | 2 +- src/ui/widget/layer-selector.cpp | 6 +- src/ui/widget/object-composite-settings.cpp | 8 +- src/ui/widget/page-sizer.cpp | 6 +- src/ui/widget/panel.cpp | 2 +- src/ui/widget/preferences-widget.cpp | 2 +- src/ui/widget/registered-widget.cpp | 4 +- src/ui/widget/selected-style.cpp | 71 ++++++++-------- src/ui/widget/style-subject.cpp | 2 +- src/ui/widget/tolerance-slider.cpp | 4 +- src/vanishing-point.cpp | 6 +- src/verbs.cpp | 40 ++++----- src/widgets/arc-toolbar.cpp | 10 +-- src/widgets/box3d-toolbar.cpp | 6 +- src/widgets/connector-toolbar.cpp | 10 +-- src/widgets/desktop-widget.cpp | 2 +- src/widgets/eraser-toolbar.cpp | 4 +- src/widgets/fill-style.cpp | 6 +- src/widgets/gradient-toolbar.cpp | 10 +-- src/widgets/lpe-toolbar.cpp | 4 +- src/widgets/measure-toolbar.cpp | 4 +- src/widgets/mesh-toolbar.cpp | 4 +- src/widgets/node-toolbar.cpp | 4 +- src/widgets/rect-toolbar.cpp | 6 +- src/widgets/select-toolbar.cpp | 4 +- src/widgets/sp-xmlview-content.cpp | 4 +- src/widgets/spiral-toolbar.cpp | 6 +- src/widgets/star-toolbar.cpp | 22 ++--- src/widgets/stroke-marker-selector.cpp | 6 +- src/widgets/stroke-style.cpp | 9 +- src/widgets/stroke-style.h | 1 - src/widgets/text-toolbar.cpp | 32 ++++---- src/widgets/toolbox.cpp | 1 - 147 files changed, 565 insertions(+), 654 deletions(-) delete mode 100644 src/desktop-handles.cpp delete mode 100644 src/desktop-handles.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 680d3bae5..617e9dce1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -187,7 +187,6 @@ set(inkscape_SRC console-output-undo-observer.cpp context-fns.cpp desktop-events.cpp - desktop-handles.cpp desktop-style.cpp desktop.cpp device-manager.cpp @@ -299,7 +298,6 @@ set(inkscape_SRC context-fns.h decimal-round.h desktop-events.h - desktop-handles.h desktop-style.h desktop.h device-manager.h diff --git a/src/Makefile_insert b/src/Makefile_insert index 488ab52c5..b07541109 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -29,7 +29,6 @@ ink_common_sources += \ decimal-round.h \ desktop.cpp desktop.h \ desktop-events.cpp desktop-events.h \ - desktop-handles.cpp desktop-handles.h \ desktop-style.cpp desktop-style.h \ device-manager.cpp device-manager.h \ dir-util.cpp dir-util.h \ diff --git a/src/box3d.cpp b/src/box3d.cpp index 9ccc969bc..6412a299f 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -37,7 +37,7 @@ #include "preferences.h" #include "desktop.h" -#include "desktop-handles.h" + #include "macros.h" static void box3d_ref_changed(SPObject *old_ref, SPObject *ref, SPBox3D *box); diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index afd1bc407..c13b9a5d3 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -32,7 +32,7 @@ #include "xml/node.h" #include "document.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document-undo.h" #include "sp-namedview.h" #include "sp-item-group.h" @@ -91,7 +91,7 @@ void SPAvoidRef::handleSettingChange(void) if (desktop == NULL) { return; } - if (sp_desktop_document(desktop) != item->document) { + if (desktop->getDocument() != item->document) { // We don't want to go any further if the active desktop's document // isn't the same as the document that this item is part of. This // case can happen if a new document is loaded from the file chooser @@ -370,7 +370,7 @@ void init_avoided_shape_geometry(SPDesktop *desktop) { // Don't count this as changes to the document, // it is basically just late initialisation. - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); bool saved = DocumentUndo::getUndoSensitive(document); DocumentUndo::setUndoSensitive(document, false); diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index a5eb3de18..5dbe0f8dc 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -24,7 +24,7 @@ #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "ui/dialog-events.h" #include "display/canvas-axonomgrid.h" #include "display/canvas-grid.h" @@ -232,7 +232,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge sp_repr_set_point(repr, "orientation", normal); desktop->namedview->appendChild(repr); Inkscape::GC::release(repr); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Create guide")); } desktop->set_coordinate_status(event_dt); @@ -240,7 +240,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge if (!dragged) { // Ruler click (without drag) toggle the guide visibility on and off Inkscape::XML::Node *repr = desktop->namedview->getRepr(); - sp_namedview_toggle_guides(sp_desktop_document(desktop), repr); + sp_namedview_toggle_guides(desktop->getDocument(), repr); } @@ -488,14 +488,14 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) assert(false); break; } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Move guide")); } else { /* Undo movement of any attached shapes. */ guide->moveto(guide->getPoint(), false); guide->set_normal(guide->getNormal(), false); sp_guide_remove(guide); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Delete guide")); } moved = false; diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp deleted file mode 100644 index 64f75c6a2..000000000 --- a/src/desktop-handles.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Frontends - * - * Author: - * Lauris Kaplinski - * - * Copyright (C) 2001-2002 Lauris Kaplinski - * Copyright (C) 2001 Ximian, Inc. - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include "display/sp-canvas.h" -#include "display/sp-canvas-item.h" -#include "desktop.h" -#include "desktop-handles.h" - -SPDocument * -sp_desktop_document (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->doc(); -} diff --git a/src/desktop-handles.h b/src/desktop-handles.h deleted file mode 100644 index b5891651b..000000000 --- a/src/desktop-handles.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef SEEN_SP_DESKTOP_HANDLES_H -#define SEEN_SP_DESKTOP_HANDLES_H - -/* - * Frontends - * - * Authors: - * Lauris Kaplinski - * - * Copyright (C) 1999-2002 Lauris Kaplinski - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - - -class SPDesktop; -class SPDocument; - -namespace Inkscape { -namespace UI { -namespace Tools { - -class ToolBase; - -} -} -} - -class SPNamedView; -struct SPCanvas; -struct SPCanvasGroup; -struct SPCanvasItem; - -namespace Inkscape { - class MessageStack; - class Selection; -} - -#define SP_DESKTOP_ZOOM_MAX 256.0 -#define SP_DESKTOP_ZOOM_MIN 0.01 - -#define SP_COORDINATES_UNDERLINE_NONE (0) -#define SP_COORDINATES_UNDERLINE_X (1 << Geom::X) -#define SP_COORDINATES_UNDERLINE_Y (1 << Geom::Y) - -SPDocument * sp_desktop_document (SPDesktop const * desktop); - -#endif // SEEN_SP_DESKTOP_HANDLES_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/desktop.cpp b/src/desktop.cpp index ad6809ea5..cdf8f276c 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -37,7 +37,7 @@ #include "color.h" #include "desktop-events.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "device-manager.h" #include "display/canvas-arena.h" @@ -502,7 +502,7 @@ void SPDesktop::_setDisplayMode(Inkscape::RenderMode mode) { canvas->rendermode = mode; _display_mode = mode; redrawDesktop(); - _widget->setTitle( sp_desktop_document(this)->getName() ); + _widget->setTitle( this->getDocument()->getName() ); } void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) { // reload grayscale matrix from prefs @@ -523,7 +523,7 @@ void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) { canvas->colorrendermode = mode; _display_color_mode = mode; redrawDesktop(); - _widget->setTitle( sp_desktop_document(this)->getName() ); + _widget->setTitle( this->getDocument()->getName() ); } void SPDesktop::displayModeToggle() { @@ -1481,7 +1481,7 @@ void SPDesktop::toggleGrids() } } else { //there is no grid present at the moment. add a rectangular grid and make it visible - namedview->writeNewGrid(sp_desktop_document(this), Inkscape::GRID_RECTANGULAR); + namedview->writeNewGrid(this->getDocument(), Inkscape::GRID_RECTANGULAR); showGrids(true); } } diff --git a/src/desktop.h b/src/desktop.h index 496cc30eb..a0b9592d0 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -103,6 +103,9 @@ namespace Inkscape { } } +#define SP_DESKTOP_ZOOM_MAX 256.0 +#define SP_DESKTOP_ZOOM_MIN 0.01 + /** * SPDesktop is a subclass of View, implementing an editable document * canvas. It is extensively used by many UI controls that need certain diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index b81400266..05ba71a49 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -36,7 +36,7 @@ #include "ui/widget/registered-widget.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/cairo-utils.h" #include "display/canvas-grid.h" #include "display/sp-canvas-util.h" diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index fe8d2d98c..1a284b46e 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -36,7 +36,7 @@ #include "desktop.h" #include "sp-canvas-util.h" #include "util/mathfns.h" -#include "desktop-handles.h" + #include "display/cairo-utils.h" #include "display/canvas-axonomgrid.h" #include "display/canvas-grid.h" diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp index b065ac445..3033118e4 100644 --- a/src/display/nr-filter-primitive.cpp +++ b/src/display/nr-filter-primitive.cpp @@ -17,7 +17,7 @@ #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "sp-root.h" #include "style.h" diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index 9df29b7b0..bcce81f0b 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -14,7 +14,7 @@ #include "display/snap-indicator.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/sodipodi-ctrl.h" #include "display/sodipodi-ctrlrect.h" #include "display/canvas-text.h" diff --git a/src/extension/dbus/application-interface.cpp b/src/extension/dbus/application-interface.cpp index 292832a4b..afaf9aedf 100644 --- a/src/extension/dbus/application-interface.cpp +++ b/src/extension/dbus/application-interface.cpp @@ -196,7 +196,7 @@ application_interface_document_close_all (ApplicationInterface *app_interface, SPDesktop *desktop = SP_ACTIVE_DESKTOP; g_assert(desktop != NULL); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); g_assert(doc != NULL); Inkscape::XML::Node *repr = doc->getReprRoot(); diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index bd5f826d3..4fde6885f 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -21,7 +21,7 @@ #include #include #include "desktop.h" -#include "desktop-handles.h" //sp_desktop_document() + //sp_desktop_document() #include "desktop-style.h" //sp_desktop_get_style #include "display/canvas-text.h" //text #include "display/sp-canvas.h" //text diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index c8f3b2ff9..e7299ba51 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -12,7 +12,7 @@ #include "inkscape.h" #include "helper/action.h" #include "ui/view/view.h" -#include "desktop-handles.h" + #include "selection.h" #include "sp-namedview.h" #include "desktop.h" diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 1495b7603..13b8d60c4 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -31,7 +31,7 @@ #include "desktop.h" #include "ui/view/view.h" #include "sp-namedview.h" -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "util/glib-list-iterators.h" diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index e29aed308..52f63499a 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -21,7 +21,7 @@ #include "selection.h" #include "desktop.h" -#include "desktop-handles.h" + #include "ui/view/view.h" #include "util/glib-list-iterators.h" diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 6b1abe04c..bbc567f75 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -24,7 +24,7 @@ #include #include -#include "desktop-handles.h" + #include "desktop.h" #include "ui/dialog-events.h" #include "extension/effect.h" diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index c92264858..76f35415e 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -25,7 +25,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "sp-object.h" #include "util/glib-list-iterators.h" diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 2ce86c245..270edfe44 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -24,7 +24,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "selection.h" #include "sp-object.h" diff --git a/src/file.cpp b/src/file.cpp index d237e06c3..72516d776 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -32,7 +32,7 @@ #include "ui/dialog/ocaldialogs.h" #include "desktop.h" -#include "desktop-handles.h" + #include "dir-util.h" #include "document-private.h" #include "document-undo.h" @@ -289,7 +289,7 @@ bool sp_file_open(const Glib::ustring &uri, if (doc) { - SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; + SPDocument *existing = desktop ? desktop->getDocument() : NULL; if (existing && existing->virgin && replace_empty) { // If the current desktop is empty, open the document there @@ -348,7 +348,7 @@ void sp_file_revert_dialog() SPDesktop *desktop = SP_ACTIVE_DESKTOP; g_assert(desktop != NULL); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); g_assert(doc != NULL); Inkscape::XML::Node *repr = doc->getReprRoot(); @@ -1055,7 +1055,7 @@ void sp_import_document(SPDesktop *desktop, SPDocument *clipdoc, bool in_place) { //TODO: merge with file_import() - SPDocument *target_document = sp_desktop_document(desktop); + SPDocument *target_document = desktop->getDocument(); Inkscape::XML::Node *root = clipdoc->getReprRoot(); Inkscape::XML::Node *target_parent = desktop->currentLayer()->getRepr(); @@ -1232,7 +1232,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // move to mouse pointer { - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { Geom::Point m( desktop->point() - sel_bbox->midpoint() ); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 7b6427a88..0701a9d49 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -31,7 +31,7 @@ #include "document-undo.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "ui/tools/tool-base.h" #include "selection.h" #include "verbs.h" @@ -1576,7 +1576,7 @@ void sp_gradient_invert_selected_gradients(SPDesktop *desktop, Inkscape::PaintTa } // we did an undoable action - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Invert gradient colors")); } @@ -1602,7 +1602,7 @@ void sp_gradient_reverse_selected_gradients(SPDesktop *desktop) } // we did an undoable action - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Reverse gradient")); } diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index d38ae666e..154b7339b 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -22,11 +22,11 @@ #include #include -#include "desktop-handles.h" + #include "selection.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "display/sp-ctrlline.h" @@ -563,7 +563,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler mg->array.built = false; mg->ensureArray(); // How do we do this? - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_MESH, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Added patch row or column")); } // Mesh @@ -796,7 +796,7 @@ static void gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui d_new->updateKnotShape (); d_new->updateTip (); d_new->updateDependencies(true); - DocumentUndo::done(sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT, _("Merge gradient handles")); + DocumentUndo::done(d_new->parent->desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Merge gradient handles")); return; } } @@ -1102,8 +1102,7 @@ static void gr_knot_ungrabbed_handler(SPKnot *knot, unsigned int state, gpointer dragger->updateDependencies(true); // we did an undoable action - DocumentUndo::done(sp_desktop_document (dragger->parent->desktop), SP_VERB_CONTEXT_GRADIENT, - _("Move gradient handle")); + DocumentUndo::done(dragger->parent->desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Move gradient handle")); } /** @@ -2375,7 +2374,7 @@ void GrDrag::selected_move(double x, double y, bool write_repr, bool scale_radia if (write_repr && did) { // we did an undoable action - DocumentUndo::maybeDone(sp_desktop_document (desktop), "grmoveh", SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::maybeDone(desktop->getDocument(), "grmoveh", SP_VERB_CONTEXT_GRADIENT, _("Move gradient handle(s)")); return; } @@ -2411,7 +2410,7 @@ void GrDrag::selected_move(double x, double y, bool write_repr, bool scale_radia if (write_repr && did) { // we did an undoable action - DocumentUndo::maybeDone(sp_desktop_document (desktop), "grmovem", SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::maybeDone(desktop->getDocument(), "grmovem", SP_VERB_CONTEXT_GRADIENT, _("Move gradient mid stop(s)")); } } diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index 99dc21e58..5a56b89ff 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -29,7 +29,7 @@ #include "document-private.h" #include "sp-pattern.h" #include "sp-marker.h" -#include "desktop-handles.h" +#include "desktop.h" #include "inkscape.h" #include "io/sys.h" @@ -196,7 +196,7 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock) gchar * base = g_strndup(e, a); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); SPDefs *defs = doc->getDefs(); if (!defs) { g_free(base); @@ -266,7 +266,7 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock) else { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); SPObject *object = doc->getObjectById(urn); return object; diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 6d20c54f8..6a0e0f35a 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -54,7 +54,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "device-manager.h" #include "document.h" #include "extension/db.h" @@ -1110,7 +1110,7 @@ SPDocument * Application::active_document() { if (SP_ACTIVE_DESKTOP) { - return sp_desktop_document (SP_ACTIVE_DESKTOP); + return SP_ACTIVE_DESKTOP->getDocument(); } else if (!_document_set.empty()) { // If called from the command line there will be no desktop // So 'fall back' to take the first listed document in the Inkscape instance diff --git a/src/knot.cpp b/src/knot.cpp index c35f24a7c..b3813ab53 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -19,7 +19,7 @@ #include #include "display/sodipodi-ctrl.h" #include "desktop.h" -#include "desktop-handles.h" + #include "knot.h" #include "knot-ptr.h" #include "document.h" @@ -342,7 +342,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot knot->ungrabbed_signal.emit(knot, event->button.state); - DocumentUndo::undo(sp_desktop_document(knot->desktop)); + DocumentUndo::undo(knot->desktop->getDocument()); knot->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Node or handle drag canceled.")); transform_escaped = true; consumed = TRUE; diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 99e2004da..b1e365fe2 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -15,7 +15,7 @@ #include "gc-finalized.h" #include "document.h" #include "desktop.h" -#include "desktop-handles.h" + #include "layer-manager.h" #include "preferences.h" #include "ui/view/view.h" diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp index a2a2610fd..c5357e213 100644 --- a/src/line-geometry.cpp +++ b/src/line-geometry.cpp @@ -13,7 +13,7 @@ #include "inkscape.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "display/sp-ctrlline.h" #include "display/sodipodi-ctrl.h" diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index a6d2f1ea5..ba95affd9 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -30,7 +30,7 @@ // needed for on-canvas editting: #include "ui/tools-switch.h" #include "ui/shape-editor.h" -#include "desktop-handles.h" + #include "selection.h" // clipboard support #include "ui/clipboard.h" diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 8a5f50145..234a6174d 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -19,7 +19,7 @@ #include "inkscape.h" #include "verbs.h" #include "display/canvas-text.h" -#include "desktop-handles.h" + #include <2geom/sbasis-geometric.h> namespace Inkscape { diff --git a/src/main-cmdlineact.cpp b/src/main-cmdlineact.cpp index 216953f4f..ade83dfda 100644 --- a/src/main-cmdlineact.cpp +++ b/src/main-cmdlineact.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 37b80f45d..238527465 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -35,7 +35,7 @@ #include "document-undo.h" #include "message-stack.h" #include "selection.h" -#include "desktop-handles.h" + #include "box3d.h" #include <2geom/pathvector.h> #include "selection-chemistry.h" @@ -48,7 +48,7 @@ void sp_selected_path_combine(SPDesktop *desktop) { Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); if (g_slist_length((GSList *) selection->itemList()) < 1) { desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to combine.")); @@ -170,7 +170,7 @@ sp_selected_path_combine(SPDesktop *desktop) // move to the position of the topmost, reduced by the number of deleted items repr->setPosition(position > 0 ? position : 0); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_COMBINE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_COMBINE, _("Combine")); selection->set(repr); @@ -283,7 +283,7 @@ sp_selected_path_break_apart(SPDesktop *desktop) desktop->clearWaitingCursor(); if (did) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_BREAK_APART, _("Break apart")); } else { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No path(s) to break apart in the selection.")); @@ -323,7 +323,7 @@ sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, b if (interactive && desktop) { desktop->clearWaitingCursor(); if (did) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_OBJECT_TO_CURVE, _("Object to path")); } else { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No objects to convert to path in the selection.")); @@ -660,7 +660,7 @@ sp_selected_path_reverse(SPDesktop *desktop) desktop->clearWaitingCursor(); if (did) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_REVERSE, _("Reverse path")); } else { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No paths to reverse in the selection.")); diff --git a/src/persp3d.cpp b/src/persp3d.cpp index 797e439c0..c761947ad 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -23,7 +23,7 @@ #include "xml/document.h" #include "xml/node-event-vector.h" #include "desktop.h" -#include "desktop-handles.h" + #include #include "verbs.h" #include "util/units.h" @@ -329,7 +329,7 @@ persp3d_toggle_VP (Persp3D *persp, Proj::Axis axis, bool set_undo) { persp3d_update_box_reprs (persp); persp->updateRepr(SP_OBJECT_WRITE_EXT); if (set_undo) { - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Toggle vanishing point")); } } @@ -340,7 +340,7 @@ persp3d_toggle_VPs (std::list p, Proj::Axis axis) { for (std::list::iterator i = p.begin(); i != p.end(); ++i) { persp3d_toggle_VP((*i), axis, false); } - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Toggle multiple vanishing points")); } diff --git a/src/rubberband.cpp b/src/rubberband.cpp index 4a2b38944..4a171f4a1 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -12,7 +12,7 @@ #include "display/sodipodi-ctrlrect.h" #include "desktop.h" -#include "desktop-handles.h" + #include "rubberband.h" #include "display/sp-canvas.h" #include "display/sp-canvas-item.h" diff --git a/src/selcue.cpp b/src/selcue.cpp index 67744e1f8..d2fa0970a 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -14,7 +14,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "display/sp-canvas-util.h" #include "display/sodipodi-ctrl.h" diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 1935cf62f..98ebd1f61 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -38,7 +38,7 @@ SPCycleType SP_CYCLING = SP_CYCLE_FOCUS; #include "layer-model.h" #include "selection.h" #include "ui/tools-switch.h" -#include "desktop-handles.h" + #include "message-stack.h" #include "sp-item-transform.h" #include "sp-marker.h" @@ -402,7 +402,7 @@ void sp_selection_delete(SPDesktop *desktop) if (tools_isactive(desktop, TOOLS_TEXT)) if (Inkscape::UI::Tools::sp_text_delete_selection(desktop->event_context)) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Delete text")); return; } @@ -429,7 +429,7 @@ void sp_selection_delete(SPDesktop *desktop) */ tools_switch( desktop, tools_active( desktop ) ); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DELETE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_DELETE, _("Delete")); } @@ -542,7 +542,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone) if ( !suppressDone ) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_DUPLICATE, _("Duplicate")); } @@ -1142,7 +1142,7 @@ sp_undo(SPDesktop *desktop, SPDocument *) // No re/undo while dragging, too dangerous. if(desktop->getCanvas()->is_dragging) return; - if (!DocumentUndo::undo(sp_desktop_document(desktop))) { + if (!DocumentUndo::undo(desktop->getDocument())) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo.")); } } @@ -1153,7 +1153,7 @@ sp_redo(SPDesktop *desktop, SPDocument *) // No re/undo while dragging, too dangerous. if(desktop->getCanvas()->is_dragging) return; - if (!DocumentUndo::redo(sp_desktop_document(desktop))) { + if (!DocumentUndo::redo(desktop->getDocument())) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo.")); } } @@ -1226,7 +1226,7 @@ void sp_selection_paste(SPDesktop *desktop, bool in_place) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->paste(desktop, in_place)) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE, _("Paste")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE, _("Paste")); } } @@ -1234,7 +1234,7 @@ void sp_selection_paste_style(SPDesktop *desktop) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->pasteStyle(desktop)) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_STYLE, _("Paste style")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE_STYLE, _("Paste style")); } } @@ -1243,7 +1243,7 @@ void sp_selection_paste_livepatheffect(SPDesktop *desktop) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->pastePathEffect(desktop)) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, _("Paste live path effect")); } } @@ -1277,7 +1277,7 @@ void sp_selection_remove_livepatheffect(SPDesktop *desktop) } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, _("Remove live path effect")); } @@ -1298,7 +1298,7 @@ void sp_selection_remove_filter(SPDesktop *desktop) sp_desktop_set_style(desktop, css); sp_repr_css_attr_unref(css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_FILTER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_REMOVE_FILTER, _("Remove filter")); } @@ -1307,7 +1307,7 @@ void sp_selection_paste_size(SPDesktop *desktop, bool apply_x, bool apply_y) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->pasteSize(desktop, false, apply_x, apply_y)) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE_SIZE, _("Paste size")); } } @@ -1316,7 +1316,7 @@ void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool a { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->pasteSize(desktop, true, apply_x, apply_y)) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, _("Paste size separately")); } } @@ -1342,9 +1342,9 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); // Fixes bug 1482973: crash while moving layers GSList *copied; if (next) { - copied = sp_selection_paste_impl(sp_desktop_document(dt), next, &temp_clip); + copied = sp_selection_paste_impl(dt->getDocument(), next, &temp_clip); } else { - copied = sp_selection_paste_impl(sp_desktop_document(dt), dt->currentLayer(), &temp_clip); + copied = sp_selection_paste_impl(dt->getDocument(), dt->currentLayer(), &temp_clip); no_more = true; } selection->setReprList((GSList const *) copied); @@ -1352,7 +1352,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) if (temp_clip) g_slist_free(temp_clip); if (next) dt->setCurrentLayer(next); if ( !suppressDone ) { - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_NEXT, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_MOVE_TO_NEXT, _("Raise to next layer")); } } else { @@ -1387,9 +1387,9 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); // Fixes bug 1482973: crash while moving layers GSList *copied; if (next) { - copied = sp_selection_paste_impl(sp_desktop_document(dt), next, &temp_clip); + copied = sp_selection_paste_impl(dt->getDocument(), next, &temp_clip); } else { - copied = sp_selection_paste_impl(sp_desktop_document(dt), dt->currentLayer(), &temp_clip); + copied = sp_selection_paste_impl(dt->getDocument(), dt->currentLayer(), &temp_clip); no_more = true; } selection->setReprList((GSList const *) copied); @@ -1397,7 +1397,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) if (temp_clip) g_slist_free(temp_clip); if (next) dt->setCurrentLayer(next); if ( !suppressDone ) { - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_PREV, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_MOVE_TO_PREV, _("Lower to previous layer")); } } else { @@ -1427,13 +1427,13 @@ void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone) GSList *temp_clip = NULL; sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs sp_selection_delete_impl(items, false, false); - GSList *copied = sp_selection_paste_impl(sp_desktop_document(dt), moveto, &temp_clip); + GSList *copied = sp_selection_paste_impl(dt->getDocument(), moveto, &temp_clip); selection->setReprList((GSList const *) copied); g_slist_free(copied); if (temp_clip) g_slist_free(temp_clip); if (moveto) dt->setCurrentLayer(moveto); if ( !suppressDone ) { - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_MOVE_TO, _("Move selection to layer")); } } @@ -1694,7 +1694,7 @@ void sp_selection_remove_transform(SPDesktop *desktop) l = l->next; } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLATTEN, + DocumentUndo::done(desktop->getDocument(), SP_VERB_OBJECT_FLATTEN, _("Remove transform")); } @@ -1800,7 +1800,7 @@ void sp_selection_rotate_90(SPDesktop *desktop, bool ccw) } } - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), ccw ? SP_VERB_OBJECT_ROTATE_90_CCW : SP_VERB_OBJECT_ROTATE_90_CW, ccw ? _("Rotate 90\xc2\xb0 CCW") : _("Rotate 90\xc2\xb0 CW")); } @@ -1818,7 +1818,7 @@ sp_selection_rotate(Inkscape::Selection *selection, gdouble const angle_degrees) sp_selection_rotate_relative(selection, *center, angle_degrees); - DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()), + DocumentUndo::maybeDone(selection->desktop()->getDocument(), ( ( angle_degrees > 0 ) ? "selector:rotate:ccw" : "selector:rotate:cw" ), @@ -2205,7 +2205,7 @@ sp_selection_rotate_screen(Inkscape::Selection *selection, gdouble angle) sp_selection_rotate_relative(selection, *center, zangle); - DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()), + DocumentUndo::maybeDone(selection->desktop()->getDocument(), ( (angle > 0) ? "selector:rotate:ccw" : "selector:rotate:cw" ), @@ -2235,7 +2235,7 @@ sp_selection_scale(Inkscape::Selection *selection, gdouble grow) double const times = 1.0 + grow / max_len; sp_selection_scale_relative(selection, center, Geom::Scale(times, times)); - DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()), + DocumentUndo::maybeDone(selection->desktop()->getDocument(), ( (grow > 0) ? "selector:scale:larger" : "selector:scale:smaller" ), @@ -2264,7 +2264,7 @@ sp_selection_scale_times(Inkscape::Selection *selection, gdouble times) Geom::Point const center(sel_bbox->midpoint()); sp_selection_scale_relative(selection, center, Geom::Scale(times, times)); - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_CONTEXT_SELECT, _("Scale by whole factor")); } @@ -2403,7 +2403,7 @@ sp_selection_item_next(SPDesktop *desktop) void sp_selection_item_prev(SPDesktop *desktop) { - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); g_return_if_fail(document != NULL); g_return_if_fail(desktop != NULL); Inkscape::Selection *selection = desktop->getSelection(); @@ -2648,7 +2648,7 @@ void sp_selection_clone(SPDesktop *desktop) Inkscape::GC::release(clone); } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_CLONE, C_("Action", "Clone")); selection->setReprList(newsel); @@ -2697,7 +2697,7 @@ sp_selection_relink(SPDesktop *desktop) if (!relinked) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No clones to relink in the selection.")); } else { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_UNLINK_CLONE, _("Relink clone")); } } @@ -2771,7 +2771,7 @@ sp_selection_unlink(SPDesktop *desktop) desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No clones to unlink in the selection.")); } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_UNLINK_CLONE, _("Unlink clone")); } @@ -2922,7 +2922,7 @@ void sp_selection_clone_original_path_lpe(SPDesktop *desktop) } } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE_ORIGINAL_PATH_LPE, _("Fill between many")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_CLONE_ORIGINAL_PATH_LPE, _("Fill between many")); // select the new object: selection->set(clone); @@ -2939,7 +2939,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) return; } - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -3040,7 +3040,7 @@ void sp_selection_to_guides(SPDesktop *desktop) if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); // we need to copy the list because it gets reset when objects are deleted GSList *items = g_slist_copy(const_cast(selection->itemList())); @@ -3098,7 +3098,7 @@ void sp_selection_symbol(SPDesktop *desktop, bool /*apply*/ ) return; } - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -3220,7 +3220,7 @@ void sp_selection_unsymbol(SPDesktop *desktop) return; } - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -3287,7 +3287,7 @@ void sp_selection_unsymbol(SPDesktop *desktop) symbol->deleteObject(true); // Change selection to new element. - SPItem *group_item = static_cast(sp_desktop_document(desktop)->getObjectByRepr(group)); + SPItem *group_item = static_cast(desktop->getDocument()->getObjectByRepr(group)); selection->set(group_item); // Clean up @@ -3305,7 +3305,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) return; } - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -3400,7 +3400,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) // restore parent and position parent->getRepr()->appendChild(rect); rect->setPosition(pos > 0 ? pos : 0); - SPItem *rectangle = static_cast(sp_desktop_document(desktop)->getObjectByRepr(rect)); + SPItem *rectangle = static_cast(desktop->getDocument()->getObjectByRepr(rect)); Inkscape::GC::release(rect); @@ -3420,7 +3420,7 @@ void sp_selection_untile(SPDesktop *desktop) return; } - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -3490,7 +3490,7 @@ void sp_selection_untile(SPDesktop *desktop) if (!did) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No pattern fills in the selection.")); } else { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNTILE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_UNTILE, _("Pattern to objects")); selection->setList(new_select); } @@ -3575,7 +3575,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop) return; } - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -3793,7 +3793,7 @@ void sp_selection_set_clipgroup(SPDesktop *desktop) if (desktop == NULL) { return; } - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -3909,7 +3909,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ return; } - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -4112,7 +4112,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { return; } - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -4205,7 +4205,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { parent->appendChild(repr); repr->setPosition((pos + 1) > 0 ? (pos + 1) : 0); - SPItem *mask_item = static_cast(sp_desktop_document(desktop)->getObjectByRepr(repr)); + SPItem *mask_item = static_cast(desktop->getDocument()->getObjectByRepr(repr)); items_to_select = g_slist_prepend(items_to_select, mask_item); // transform mask, so it is moved the same spot where mask was applied @@ -4253,7 +4253,7 @@ bool fit_canvas_to_selection(SPDesktop *desktop, bool with_margins) { g_return_val_if_fail(desktop != NULL, false); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); g_return_val_if_fail(doc != NULL, false); g_return_val_if_fail(desktop->selection != NULL, false); @@ -4278,7 +4278,7 @@ void verb_fit_canvas_to_selection(SPDesktop *const desktop) { if (fit_canvas_to_selection(desktop)) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION, + DocumentUndo::done(desktop->getDocument(), SP_VERB_FIT_CANVAS_TO_SELECTION, _("Fit Page to Selection")); } } @@ -4306,8 +4306,8 @@ fit_canvas_to_drawing(SPDocument *doc, bool with_margins) void verb_fit_canvas_to_drawing(SPDesktop *desktop) { - if (fit_canvas_to_drawing(sp_desktop_document(desktop))) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_DRAWING, + if (fit_canvas_to_drawing(desktop->getDocument())) { + DocumentUndo::done(desktop->getDocument(), SP_VERB_FIT_CANVAS_TO_DRAWING, _("Fit Page to Drawing")); } } @@ -4319,7 +4319,7 @@ verb_fit_canvas_to_drawing(SPDesktop *desktop) */ void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) { g_return_if_fail(desktop != NULL); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); g_return_if_fail(doc != NULL); g_return_if_fail(desktop->selection != NULL); @@ -4328,7 +4328,7 @@ void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) { ? fit_canvas_to_drawing(doc, true) : fit_canvas_to_selection(desktop, true) ); if (changed) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, + DocumentUndo::done(desktop->getDocument(), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, _("Fit Page to Selection or Drawing")); } }; diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 34b27b257..5e4c0642e 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -26,7 +26,7 @@ #include "document-undo.h" #include "sp-namedview.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "knot.h" #include "message-stack.h" @@ -473,16 +473,16 @@ void Inkscape::SelTrans::ungrab() // when trying to stretch a perfectly vertical line in horizontal direction, which will not be allowed // by the handles; this would be identified as a (zero) translation by isTranslation() if (_current_relative_affine.isTranslation()) { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Move")); } else if (_current_relative_affine.withoutTranslation().isScale()) { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Scale")); } else if (_current_relative_affine.withoutTranslation().isRotation()) { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Rotate")); } else { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Skew")); } } @@ -495,7 +495,7 @@ void Inkscape::SelTrans::ungrab() SPItem *it = SP_ITEM(l->data); it->updateRepr(); } - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Set center")); } @@ -549,7 +549,7 @@ void Inkscape::SelTrans::stamp() // move to the saved position copy_repr->setPosition(pos > 0 ? pos : 0); - SPItem *copy_item = (SPItem *) sp_desktop_document(_desktop)->getObjectByRepr(copy_repr); + SPItem *copy_item = (SPItem *) _desktop->getDocument()->getObjectByRepr(copy_repr); Geom::Affine const *new_affine; if (_show == SHOW_OUTLINE) { @@ -570,7 +570,7 @@ void Inkscape::SelTrans::stamp() Inkscape::GC::release(copy_repr); l = l->next; } - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Stamp")); } @@ -719,7 +719,7 @@ void Inkscape::SelTrans::handleClick(SPKnot */*knot*/, guint state, SPSelTransHa _center_is_set = false; // center has changed _updateHandles(); } - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Reset center")); } break; diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index 766026980..8d9f87037 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -14,7 +14,7 @@ #include "inkscape.h" #include "document.h" #include "selection.h" -#include "desktop-handles.h" + #include "desktop.h" #include "xml/repr.h" @@ -620,7 +620,7 @@ bool SPFlowtext::has_internal_frame() const SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, Geom::Point p1) { - SPDocument *doc = sp_desktop_document (desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot"); diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index d7d15bac7..3eecb2783 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -22,7 +22,7 @@ #include #include #include -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "display/guideline.h" #include "svg/svg.h" @@ -224,7 +224,7 @@ void sp_guide_pt_pairs_to_guides(SPDocument *doc, std::listgetDocument(); std::list > pts; Geom::Point A(0, 0); @@ -244,7 +244,7 @@ void sp_guide_create_guides_around_page(SPDesktop *dt) void sp_guide_delete_all_guides(SPDesktop *dt) { - SPDocument *doc=sp_desktop_document(dt); + SPDocument *doc=dt->getDocument(); const GSList *current; while ( (current = doc->getResourceList("guide")) ) { SPGuide* guide = SP_GUIDE(current->data); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 796caa88b..026b1a11a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -40,7 +40,7 @@ #include "box3d.h" #include "persp3d.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "selection.h" #include "live_effects/effect.h" #include "live_effects/lpeobject.h" diff --git a/src/sp-item.cpp b/src/sp-item.cpp index b6dee67e4..dbb0380ea 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -25,7 +25,7 @@ #include "uri.h" #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include "style.h" #include diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 5b410e5c0..dc36e68b9 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -29,7 +29,7 @@ #include "document.h" #include "document-undo.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "sp-guide.h" #include "sp-item-group.h" #include "sp-namedview.h" @@ -840,7 +840,7 @@ void sp_namedview_window_from_document(SPDesktop *desktop) && nv->cx != HUGE_VAL && !IS_NAN(nv->cx) && nv->cy != HUGE_VAL && !IS_NAN(nv->cy)) { desktop->zoom_absolute(nv->cx, nv->cy, nv->zoom); - } else if (sp_desktop_document(desktop)) { // document without saved zoom, zoom to its page + } else if (desktop->getDocument()) { // document without saved zoom, zoom to its page desktop->zoom_page(); } @@ -900,8 +900,8 @@ void sp_namedview_document_from_window(SPDesktop *desktop) Geom::Rect const r = desktop->get_display_area(); // saving window geometry is not undoable - bool saved = DocumentUndo::getUndoSensitive(sp_desktop_document(desktop)); - DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), false); + bool saved = DocumentUndo::getUndoSensitive(desktop->getDocument()); + DocumentUndo::setUndoSensitive(desktop->getDocument(), false); if (save_viewport_in_file) { sp_repr_set_svg_double(view, "inkscape:zoom", desktop->current_zoom()); @@ -922,7 +922,7 @@ void sp_namedview_document_from_window(SPDesktop *desktop) view->setAttribute("inkscape:current-layer", desktop->currentLayer()->getId()); // restore undoability - DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), saved); + DocumentUndo::setUndoSensitive(desktop->getDocument(), saved); } void SPNamedView::hide(SPDesktop const *desktop) diff --git a/src/sp-path.cpp b/src/sp-path.cpp index 5c076b7cb..0fef57698 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -41,7 +41,7 @@ #include "document.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "ui/tools/tool-base.h" #include "inkscape.h" diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 70c8f37d5..8bb3e9897 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -37,7 +37,7 @@ #include "layer-model.h" #include "message-stack.h" #include "selection.h" -#include "desktop-handles.h" + #include "desktop.h" #include "display/canvas-bpath.h" #include "display/curve.h" @@ -1343,7 +1343,7 @@ sp_selected_path_outline(SPDesktop *desktop) if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether - SPDocument * doc = sp_desktop_document(desktop); + SPDocument * doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); @@ -1482,7 +1482,7 @@ sp_selected_path_outline(SPDesktop *desktop) // restore title, description, id, transform repr->setAttribute("id", id); - SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *newitem = (SPItem *) desktop->getDocument()->getObjectByRepr(repr); newitem->doWriteTransform(repr, transform); if (title) { newitem->setTitle(title); @@ -1512,7 +1512,7 @@ sp_selected_path_outline(SPDesktop *desktop) } if (did) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_OUTLINE, _("Convert stroke to path")); } else { // TRANSLATORS: "to outline" means "to convert stroke to path" @@ -1675,7 +1675,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool { // pas vraiment de points sur le resultat // donc il ne reste rien - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), (updating ? SP_VERB_SELECTION_LINKED_OFFSET : SP_VERB_SELECTION_DYNAMIC_OFFSET), (updating ? _("Create linked offset") @@ -1723,7 +1723,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool // move to the saved position repr->setPosition(pos > 0 ? pos : 0); - SPItem *nitem = reinterpret_cast(sp_desktop_document(desktop)->getObjectByRepr(repr)); + SPItem *nitem = reinterpret_cast(desktop->getDocument()->getObjectByRepr(repr)); if ( !updating ) { // delete original, apply the transform to the offset @@ -1740,7 +1740,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool selection->set(nitem); } - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), (updating ? SP_VERB_SELECTION_LINKED_OFFSET : SP_VERB_SELECTION_DYNAMIC_OFFSET), (updating ? _("Create linked offset") @@ -1946,7 +1946,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) // move to the saved position repr->setPosition(pos > 0 ? pos : 0); - SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *newitem = (SPItem *) desktop->getDocument()->getObjectByRepr(repr); // reapply the transform newitem->doWriteTransform(repr, transform); @@ -1963,7 +1963,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) } if (did) { - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), (expand ? SP_VERB_SELECTION_OFFSET : SP_VERB_SELECTION_INSET), (expand ? _("Outset path") : _("Inset path"))); } else { @@ -2089,7 +2089,7 @@ sp_selected_path_simplify_item(SPDesktop *desktop, // move to the saved position repr->setPosition(pos > 0 ? pos : 0); - SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *newitem = (SPItem *) desktop->getDocument()->getObjectByRepr(repr); // reapply the transform newitem->doWriteTransform(repr, transform); @@ -2208,7 +2208,7 @@ sp_selected_path_simplify_selection(SPDesktop *desktop, float threshold, bool ju breakableAngles, true); if (didSomething) - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_SIMPLIFY, _("Simplify")); else desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No paths to simplify in the selection.")); diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 61ae2466b..65b59f2ad 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -29,7 +29,7 @@ #include "message-stack.h" #include "selection.h" #include "style.h" -#include "desktop-handles.h" + #include "text-editing.h" #include "text-chemistry.h" #include "sp-flowtext.h" @@ -122,14 +122,14 @@ text_put_on_path() Inkscape::XML::Node *parent = text->getRepr()->parent(); parent->appendChild(repr); - SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *new_item = (SPItem *) desktop->getDocument()->getObjectByRepr(repr); new_item->doWriteTransform(repr, text->transform); new_item->updateRepr(); Inkscape::GC::release(repr); text->deleteObject(); // delete the orignal flowtext - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); selection->clear(); @@ -181,7 +181,7 @@ text_put_on_path() text->getRepr()->setAttribute("x", NULL); text->getRepr()->setAttribute("y", NULL); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Put text on path")); g_slist_free(text_reprs); } @@ -217,7 +217,7 @@ text_remove_from_path() if (!did) { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No texts-on-paths in the selection.")); } else { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Remove text from path")); selection->setList(g_slist_copy((GSList *) selection->itemList())); // reselect to update statusbar description } @@ -282,7 +282,7 @@ text_remove_all_kerns() if (!did) { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("Select text(s) to remove kerns from.")); } else { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Remove manual kerns")); } } @@ -294,7 +294,7 @@ text_flow_into_shape() if (!desktop) return; - SPDocument *doc = sp_desktop_document (desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -388,7 +388,7 @@ text_unflow () if (!desktop) return; - SPDocument *doc = sp_desktop_document (desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -512,7 +512,7 @@ flowtext_to_text() Inkscape::XML::Node *parent = item->getRepr()->parent(); parent->addChild(repr, item->getRepr()); - SPItem *new_item = reinterpret_cast(sp_desktop_document(desktop)->getObjectByRepr(repr)); + SPItem *new_item = reinterpret_cast(desktop->getDocument()->getObjectByRepr(repr)); new_item->doWriteTransform(repr, item->transform); new_item->updateRepr(); @@ -525,7 +525,7 @@ flowtext_to_text() g_slist_free(items); if (did) { - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, _("Convert flowed text to text")); selection->setReprList(reprs); diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index d856d37d8..cc3d000a3 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -16,7 +16,7 @@ #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "message-stack.h" diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 310df419e..c2465932b 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -37,7 +37,7 @@ #include "inkscape.h" #include "io/stringstream.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" // for sp_desktop_set_style, used in _pasteStyle #include "document.h" #include "document-private.h" diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 94e524157..65bc94011 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -24,7 +24,7 @@ #include "align-and-distribute.h" #include <2geom/transforms.h> #include "ui/widget/spinbutton.h" -#include "desktop-handles.h" + #include "unclump.h" #include "document.h" #include "enums.h" @@ -123,10 +123,10 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) focus = selection->smallestItem(horiz); break; case PAGE: - b = sp_desktop_document(desktop)->preferredBounds(); + b = desktop->getDocument()->preferredBounds(); break; case DRAWING: - b = sp_desktop_document(desktop)->getRoot()->desktopPreferredBounds(); + b = desktop->getDocument()->getRoot()->desktopPreferredBounds(); break; case SELECTION: b = selection->preferredBounds(); @@ -152,7 +152,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) for (std::list::iterator it(selected.begin()); it != selected.end(); ++it) { - sp_desktop_document (desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); if (!sel_as_group) b = (*it)->desktopPreferredBounds(); if (b && (!focus || (*it) != focus)) { @@ -167,7 +167,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) } if (changed) { - DocumentUndo::done( sp_desktop_document(desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done( desktop->getDocument() , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Align")); } } @@ -337,7 +337,7 @@ private : prefs->setInt("/options/clonecompensation/value", saved_compensation); if (changed) { - DocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done( desktop->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Distribute")); } } @@ -463,7 +463,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Remove overlaps")); } }; @@ -494,7 +494,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); } }; @@ -587,7 +587,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Exchange Positions")); } }; @@ -621,7 +621,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Unclump")); } }; @@ -676,7 +676,7 @@ private : it != selected.end(); ++it) { - sp_desktop_document (desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); Geom::OptRect item_box = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); if (item_box) { // find new center, staying within bbox @@ -693,7 +693,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Randomize positions")); } }; @@ -796,7 +796,7 @@ private : } if (changed) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Distribute text baselines")); } @@ -819,7 +819,7 @@ private : } if (changed) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Align text baselines")); } } diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index aa373e4f7..fede30b26 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -27,7 +27,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "display/cairo-utils.h" #include "display/drawing.h" #include "display/drawing-context.h" @@ -2112,13 +2112,13 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) } } - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); unclump (to_unclump); g_slist_free (to_unclump); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, _("Unclump tiled clones")); } @@ -2172,7 +2172,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d clonetiler_change_selection (selection, dlg); if (do_undo) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, _("Delete tiled clones")); } } @@ -2251,7 +2251,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) clonetiler_remove (NULL, dlg, false); - double scale_units = Inkscape::Util::Quantity::convert(1, "px", &sp_desktop_document(desktop)->getSVGUnit()); + double scale_units = Inkscape::Util::Quantity::convert(1, "px", &desktop->getDocument()->getSVGUnit()); double shiftx_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_i", 0, -10000, 10000); double shifty_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_i", 0, -10000, 10000); @@ -2337,7 +2337,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) SPItem *item = dynamic_cast(obj); if (dotrace) { - clonetiler_trace_setup (sp_desktop_document(desktop), 1.0, item); + clonetiler_trace_setup (desktop->getDocument(), 1.0, item); } Geom::Point center; @@ -2611,21 +2611,21 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) parent->getRepr()->appendChild(clone); if (blur > 0.0) { - SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone); + SPObject *clone_object = desktop->getDocument()->getObjectByRepr(clone); double perimeter = perimeter_original * t.descrim(); double radius = blur * perimeter; // this is necessary for all newly added clones to have correct bboxes, // otherwise filters won't work: - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); // it's hard to figure out exact width/height of the tile without having an object // that we can take bbox of; however here we only need a lower bound so that blur // margins are not too small, and the perimeter should work - SPFilter *constructed = new_filter_gaussian_blur(sp_desktop_document(desktop), radius, t.descrim(), t.expansionX(), t.expansionY(), perimeter, perimeter); + SPFilter *constructed = new_filter_gaussian_blur(desktop->getDocument(), radius, t.descrim(), t.expansionX(), t.expansionY(), perimeter, perimeter); sp_style_set_property_url (clone_object, "filter", constructed, false); } if (center_set) { - SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone); + SPObject *clone_object = desktop->getDocument()->getObjectByRepr(clone); SPItem *item = dynamic_cast(clone_object); if (clone_object && item) { clone_object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -2647,7 +2647,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) desktop->clearWaitingCursor(); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, _("Create tiled clones")); } diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index bab7e18e1..a49a47d5c 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -29,7 +29,7 @@ #include "color-item.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "display/cairo-utils.h" #include "document.h" @@ -476,7 +476,7 @@ void ColorItem::_updatePreviews() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if ( desktop ) { - SPDocument* document = sp_desktop_document( desktop ); + SPDocument* document = desktop->getDocument(); Inkscape::XML::Node *rroot = document->getReprRoot(); if ( rroot ) { @@ -706,7 +706,7 @@ void ColorItem::buttonClicked(bool secondary) sp_desktop_set_style(desktop, css); sp_repr_css_attr_unref(css); - DocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() ); + DocumentUndo::done( desktop->getDocument(), SP_VERB_DIALOG_SWATCHES, descr.c_str() ); } } diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 6d8fe4b12..27d88bae7 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -25,7 +25,7 @@ #include "inkscape.h" #include "ui/tools/tool-base.h" #include "desktop.h" -#include "desktop-handles.h" + #include "shortcuts.h" #include "preferences.h" #include "ui/interface.h" diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index dc7f8158e..da1facc08 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -20,7 +20,7 @@ #include "document-metadata.h" #include "desktop.h" -#include "desktop-handles.h" + #include "inkscape.h" #include "rdf.h" #include "sp-namedview.h" diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 1d15ad32b..af7ca678a 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -26,7 +26,7 @@ #include "document-properties.h" #include "display/canvas-grid.h" #include "document.h" -#include "desktop-handles.h" + #include "desktop.h" #include "inkscape.h" #include "io/sys.h" @@ -188,7 +188,7 @@ void DocumentProperties::init() Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); repr->addListener (&_repr_events, this); - Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); + Inkscape::XML::Node *root = getDesktop()->getDocument()->getRoot()->getRepr(); root->addListener (&_repr_events, this); show_all_children(); @@ -199,7 +199,7 @@ DocumentProperties::~DocumentProperties() { Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); repr->removeListenerByData (this); - Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); + Inkscape::XML::Node *root = getDesktop()->getDocument()->getRoot()->getRepr(); root->removeListenerByData (this); for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) @@ -1484,21 +1484,21 @@ void DocumentProperties::update() _rum_deflt.setUnit (nv->display_units->abbr); } - double doc_w = sp_desktop_document(dt)->getRoot()->width.value; - Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit)->abbr; + double doc_w = dt->getDocument()->getRoot()->width.value; + Glib::ustring doc_w_unit = unit_table.getUnit(dt->getDocument()->getRoot()->width.unit)->abbr; if (doc_w_unit == "") { doc_w_unit = "px"; - } else if (doc_w_unit == "%" && sp_desktop_document(dt)->getRoot()->viewBox_set) { + } else if (doc_w_unit == "%" && dt->getDocument()->getRoot()->viewBox_set) { doc_w_unit = "px"; - doc_w = sp_desktop_document(dt)->getRoot()->viewBox.width(); + doc_w = dt->getDocument()->getRoot()->viewBox.width(); } - double doc_h = sp_desktop_document(dt)->getRoot()->height.value; - Glib::ustring doc_h_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->height.unit)->abbr; + double doc_h = dt->getDocument()->getRoot()->height.value; + Glib::ustring doc_h_unit = unit_table.getUnit(dt->getDocument()->getRoot()->height.unit)->abbr; if (doc_h_unit == "") { doc_h_unit = "px"; - } else if (doc_h_unit == "%" && sp_desktop_document(dt)->getRoot()->viewBox_set) { + } else if (doc_h_unit == "%" && dt->getDocument()->getRoot()->viewBox_set) { doc_h_unit = "px"; - doc_h = sp_desktop_document(dt)->getRoot()->viewBox.height(); + doc_h = dt->getDocument()->getRoot()->viewBox.height(); } _page_sizer.setDim(Inkscape::Util::Quantity(doc_w, doc_w_unit), Inkscape::Util::Quantity(doc_h, doc_h_unit)); _page_sizer.updateFitMarginsUI(nv->getRepr()); @@ -1603,7 +1603,7 @@ void DocumentProperties::_handleActivateDesktop(SPDesktop *desktop) { Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->addListener(&_repr_events, this); - Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr(); + Inkscape::XML::Node *root = desktop->getDocument()->getRoot()->getRepr(); root->addListener(&_repr_events, this); update(); } @@ -1612,7 +1612,7 @@ void DocumentProperties::_handleDeactivateDesktop(SPDesktop *desktop) { Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->removeListenerByData(this); - Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr(); + Inkscape::XML::Node *root = desktop->getDocument()->getRoot()->getRepr(); root->removeListenerByData(this); } @@ -1648,7 +1648,7 @@ void DocumentProperties::onNewGrid() { SPDesktop *dt = getDesktop(); Inkscape::XML::Node *repr = dt->getNamedView()->getRepr(); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); Glib::ustring typestring = _grids_combo_gridtype.get_active_text(); CanvasGrid::writeNewGridToRepr(repr, doc, CanvasGrid::getGridTypeFromName(typestring.c_str())); @@ -1679,7 +1679,7 @@ void DocumentProperties::onRemoveGrid() // delete the grid that corresponds with the selected tab // when the grid is deleted from SVG, the SPNamedview handler automatically deletes the object, so found_grid becomes an invalid pointer! found_grid->repr->parent()->removeChild(found_grid->repr); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid")); + DocumentUndo::done(dt->getDocument(), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid")); } } diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 11dfa2db5..6d90c792e 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -54,7 +54,7 @@ #include "inkscape.h" #include "document.h" #include "document-undo.h" -#include "desktop-handles.h" + #include "sp-item.h" #include "selection.h" #include "file.h" @@ -101,7 +101,6 @@ #define EXPORT_COORD_PRECISION 3 -#include "../../desktop-handles.h" #include "../../document.h" #include "../../document-undo.h" #include "verbs.h" @@ -685,7 +684,7 @@ void Export::onSelectionModified ( guint /*flags*/ ) case SELECTION_DRAWING: if ( SP_ACTIVE_DESKTOP ) { SPDocument *doc; - doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + doc = SP_ACTIVE_DESKTOP->getDocument(); Geom::OptRect bbox = doc->getRoot()->desktopVisualBounds(); if (bbox) { setArea ( bbox->left(), @@ -736,7 +735,7 @@ void Export::onAreaToggled () SPDocument *doc; Geom::OptRect bbox; bbox = Geom::Rect(Geom::Point(0.0, 0.0),Geom::Point(0.0, 0.0)); - doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + doc = SP_ACTIVE_DESKTOP->getDocument(); /* Notice how the switch is used to 'fall through' here to get various backups. If you modify this without noticing you'll @@ -1003,7 +1002,7 @@ void Export::onExport () if (!desktop) return; SPNamedView *nv = desktop->getNamedView(); - SPDocument *doc = sp_desktop_document (desktop); + SPDocument *doc = desktop->getDocument(); bool exportSuccessful = false; @@ -1154,7 +1153,7 @@ void Export::onExport () prog_dlg->set_data("total", GINT_TO_POINTER(0)); /* Do export */ - ExportResult status = sp_export_png_file(sp_desktop_document(desktop), path.c_str(), + ExportResult status = sp_export_png_file(desktop->getDocument(), path.c_str(), Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, xdpi, ydpi, nv->pagecolor, onProgressCallback, (void*)prog_dlg, @@ -1472,7 +1471,7 @@ void Export::detectSize() { } break; case SELECTION_DRAWING: { - SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + SPDocument *doc = SP_ACTIVE_DESKTOP->getDocument(); Geom::OptRect bbox = doc->getRoot()->desktopVisualBounds(); @@ -1485,7 +1484,7 @@ void Export::detectSize() { case SELECTION_PAGE: { SPDocument *doc; - doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + doc = SP_ACTIVE_DESKTOP->getDocument(); Geom::Point x(0.0, 0.0); Geom::Point y(doc->getWidth().value("px"), diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index c55d55cda..8141f7696 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -16,7 +16,7 @@ */ #include "ui/widget/notebook-page.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "document.h" #include "fill-and-stroke.h" diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 228570c88..3da0e0043 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -33,7 +33,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "dir-util.h" #include "document.h" #include "document-undo.h" @@ -1416,7 +1416,7 @@ void FilterEffectsDialog::FilterModifier::setTargetDesktop(SPDesktop *desktop) _selectModifiedConn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &FilterModifier::on_modified_selection))); } _doc_replaced = desktop->connectDocumentReplaced( sigc::mem_fun(*this, &FilterModifier::on_document_replaced)); - _resource_changed = sp_desktop_document(desktop)->connectResourcesChanged("filter",sigc::mem_fun(*this, &FilterModifier::update_filters)); + _resource_changed = desktop->getDocument()->connectResourcesChanged("filter",sigc::mem_fun(*this, &FilterModifier::update_filters)); _dialog.setDesktop(desktop); update_filters(); @@ -1537,7 +1537,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri if(iter) { SPDesktop *desktop = _dialog.getDesktop(); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); SPFilter* filter = (*iter)[_columns.filter]; Inkscape::Selection *sel = desktop->getSelection(); @@ -1571,7 +1571,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri void FilterEffectsDialog::FilterModifier::update_filters() { SPDesktop* desktop = _dialog.getDesktop(); - SPDocument* document = sp_desktop_document(desktop); + SPDocument* document = desktop->getDocument(); const GSList* filters = document->getResourceList("filter"); _model->clear(); @@ -1627,7 +1627,7 @@ void FilterEffectsDialog::FilterModifier::filter_list_button_release(GdkEventBut void FilterEffectsDialog::FilterModifier::add_filter() { - SPDocument* doc = sp_desktop_document(_dialog.getDesktop()); + SPDocument* doc = _dialog.getDesktop()->getDocument(); SPFilter* filter = new_filter(doc); const int count = _model->children().size(); @@ -1937,7 +1937,7 @@ void FilterEffectsDialog::PrimitiveList::remove_selected() //XML Tree being used directly here while it shouldn't be. sp_repr_unparent(prim->getRepr()); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter primitive")); update(); diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index be8250f88..6d8d64607 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -29,7 +29,7 @@ #include "document.h" #include "document-undo.h" #include "selection.h" -#include "desktop-handles.h" + #include "ui/dialog-events.h" #include "verbs.h" @@ -824,7 +824,7 @@ void Find::onAction() if (check_scope_layer.get_active()) { l = all_items (desktop->currentLayer(), l, hidden, locked); } else { - l = all_items(sp_desktop_document(desktop)->getRoot(), l, hidden, locked); + l = all_items(desktop->getDocument()->getRoot(), l, hidden, locked); } } guint all = g_slist_length (l); @@ -859,7 +859,7 @@ void Find::onAction() scroll_to_show_item(desktop, item); if (_action_replace) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Replace text or property")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Replace text or property")); } } else { diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index 82253417a..ae03bdf0e 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -28,7 +28,7 @@ #include "selection.h" #include "ui/dialog-events.h" -#include "desktop-handles.h" + #include "selection-chemistry.h" #include "preferences.h" diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index d60778bd0..d3ccb9bde 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -31,7 +31,7 @@ #include "verbs.h" #include "preferences.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "selection.h" #include "document.h" #include "document-undo.h" @@ -165,7 +165,7 @@ void GridArrangeTab::arrange() grid_top = 99999; SPDesktop *desktop = Parent->getDesktop(); - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); Inkscape::Selection *selection = desktop->getSelection(); const GSList *items = selection ? selection->itemList() : 0; @@ -347,7 +347,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h g_slist_free (current_row); } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_ARRANGE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_ARRANGE, _("Arrange in a grid")); } diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 221f9a1c0..af8e2cc31 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -24,7 +24,7 @@ #include "document-undo.h" #include "sp-guide.h" #include "sp-namedview.h" -#include "desktop-handles.h" + #include "ui/tools/tool-base.h" #include "widgets/desktop-widget.h" #include diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 25520ba8b..b908a90cb 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -35,7 +35,7 @@ #include "ui/widget/frame.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/drawing.h" #include "document.h" #include "inkscape.h" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 31dddda7c..8d507d037 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -32,7 +32,7 @@ #include "util/units.h" #include #include "enums.h" -#include "desktop-handles.h" + #include "extension/internal/gdkpixbuf-input.h" #include "message-stack.h" #include "style.h" diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 779aa47fe..1b8fbb3f7 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -23,7 +23,7 @@ #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" -#include "desktop-handles.h" + #include "sp-object.h" #include "sp-item.h" #include "verbs.h" @@ -132,7 +132,7 @@ LayerPropertiesDialog::_apply() g_assert(_strategy != NULL); _strategy->perform(*this); - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_NONE, _("Add layer")); _close(); @@ -364,7 +364,7 @@ void LayerPropertiesDialog::Rename::perform(LayerPropertiesDialog &dialog) { (gchar *)name.c_str(), FALSE ); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Rename layer")); // TRANSLATORS: This means "The layer has been renamed" desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Renamed layer")); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 2e96193b9..3b87597c8 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -23,7 +23,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "gtkmm/widget.h" @@ -510,7 +510,7 @@ LivePathEffectEditor::onRemove() if ( lpeitem ) { lpeitem->removeCurrentPathEffect(false); - DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Remove path effect") ); effect_list_reload(lpeitem); @@ -528,7 +528,7 @@ void LivePathEffectEditor::onUp() if ( lpeitem ) { lpeitem->upCurrentPathEffect(); - DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect up") ); effect_list_reload(lpeitem); @@ -545,7 +545,7 @@ void LivePathEffectEditor::onDown() if ( lpeitem ) { lpeitem->downCurrentPathEffect(); - DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect down") ); effect_list_reload(lpeitem); @@ -584,7 +584,7 @@ void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) /* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack. * So one can call: lpe_item->setActive(lpeobjref->lpeobject); */ lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false"); - DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, newValue ? _("Activate path effect") : _("Deactivate path effect")); } } diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 55a19fc51..1ca84e6b3 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -23,7 +23,7 @@ #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" -#include "desktop-handles.h" + #include "sp-object.h" #include "sp-item.h" #include "verbs.h" diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index 55f938a48..a9e57970d 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -32,7 +32,7 @@ #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" -#include "desktop-handles.h" + #include "sp-object.h" #include "sp-item.h" #include "verbs.h" diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index 118a66097..f43a15225 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -22,7 +22,7 @@ #include "ui/dialog/dialog-manager.h" #include "desktop.h" -#include "desktop-handles.h" + #include "macros.h" #include "sp-anchor.h" #include "sp-image.h" diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index ecfd057de..dfe211e94 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -28,7 +28,7 @@ #include "object-properties.h" #include "widgets/sp-attribute-widget.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "verbs.h" diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 08cfba839..cc5decfd7 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -16,7 +16,7 @@ #include "verbs.h" #include "preferences.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "selection.h" #include "document.h" #include "document-undo.h" @@ -399,7 +399,7 @@ void PolarArrangeTab::arrange() tmp = tmp->next; } - DocumentUndo::done(sp_desktop_document(parent->getDesktop()), SP_VERB_SELECTION_ARRANGE, + DocumentUndo::done(parent->getDesktop()->getDocument(), SP_VERB_SELECTION_ARRANGE, _("Arrange on ellipse")); } diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index e42b58966..6da8acb20 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -22,7 +22,7 @@ #include "document.h" #include "selection.h" #include "desktop.h" -#include "desktop-handles.h" + #include "ui/tools-switch.h" #include "ui/tools/text-tool.h" #include "ui/interface.h" @@ -407,7 +407,7 @@ SpellCheck::init(SPDesktop *d) } #endif /* HAVE_ASPELL */ - _root = sp_desktop_document(desktop)->getRoot(); + _root = desktop->getDocument()->getRoot(); // empty the list of objects we've checked g_slist_free (_seen_objects); @@ -792,7 +792,7 @@ void SpellCheck::onAccept () // find the end of the word anew _end_w = _begin_w; _end_w.nextEndOfWord(); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Fix spelling")); } } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 55eed9a99..bc228633d 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -30,7 +30,7 @@ #include "xml/repr.h" #include "sp-font-face.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/nr-svgfonts.h" #include "verbs.h" #include "sp-glyph.h" @@ -182,7 +182,7 @@ void SvgFontsDialog::on_kerning_value_changed(){ return; } - SPDocument* document = sp_desktop_document(this->getDesktop()); + SPDocument* document = this->getDesktop()->getDocument(); //TODO: I am unsure whether this is the correct way of calling SPDocumentUndo::maybe_done Glib::ustring undokey = "svgfonts:hkern:k:"; @@ -265,7 +265,7 @@ void SvgFontsDialog::update_sensitiveness(){ void SvgFontsDialog::update_fonts() { SPDesktop* desktop = this->getDesktop(); - SPDocument* document = sp_desktop_document(desktop); + SPDocument* document = desktop->getDocument(); const GSList* fonts = document->getResourceList("font"); _model->clear(); @@ -482,7 +482,7 @@ void SvgFontsDialog::update_glyphs(){ void SvgFontsDialog::add_glyph(){ const int count = _GlyphsListStore->children().size(); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); /* SPGlyph* glyph =*/ new_glyph(doc, get_selected_spfont(), count+1); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph")); @@ -516,7 +516,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ } Inkscape::MessageStack *msgStack = desktop->getMessageStack(); - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); Inkscape::Selection* sel = desktop->getSelection(); if (sel->isEmpty()){ char *msg = _("Select a path to define the curves of a glyph"); @@ -558,7 +558,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ } Inkscape::MessageStack *msgStack = desktop->getMessageStack(); - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); Inkscape::Selection* sel = desktop->getSelection(); if (sel->isEmpty()){ char *msg = _("Select a path to define the curves of a glyph"); @@ -598,7 +598,7 @@ void SvgFontsDialog::reset_missing_glyph_description(){ return; } - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ @@ -619,7 +619,7 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& //XML Tree being directly used here while it shouldn't be. glyph->getRepr()->setAttribute("glyph-name", str.c_str()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); update_glyphs(); @@ -633,7 +633,7 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin //XML Tree being directly used here while it shouldn't be. glyph->getRepr()->setAttribute("unicode", str.c_str()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); update_glyphs(); @@ -645,7 +645,7 @@ void SvgFontsDialog::remove_selected_font(){ //XML Tree being directly used here while it shouldn't be. sp_repr_unparent(font->getRepr()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); update_fonts(); @@ -662,7 +662,7 @@ void SvgFontsDialog::remove_selected_glyph(){ //XML Tree being directly used here while it shouldn't be. sp_repr_unparent(glyph->getRepr()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); update_glyphs(); @@ -679,7 +679,7 @@ void SvgFontsDialog::remove_selected_kerning_pair(){ //XML Tree being directly used here while it shouldn't be. sp_repr_unparent(pair->getRepr()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); update_glyphs(); @@ -750,7 +750,7 @@ void SvgFontsDialog::add_kerning_pair(){ if (this->kerning_pair) return; //We already have this kerning pair - SPDocument* document = sp_desktop_document(this->getDesktop()); + SPDocument* document = this->getDesktop()->getDocument(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); // create a new hkern node @@ -864,7 +864,7 @@ void set_font_family(SPFont* font, char* str){ } void SvgFontsDialog::add_font(){ - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); SPFont* font = new_font(doc); const int count = _model->children().size(); @@ -938,7 +938,7 @@ SvgFontsDialog::SvgFontsDialog() _FontsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::fonts_list_button_release)); create_fonts_popup_menu(_FontsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_font)); - _defs_observer.set(sp_desktop_document(this->getDesktop())->getDefs()); + _defs_observer.set(this->getDesktop()->getDocument()->getDefs()); _defs_observer.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::update_fonts)); _getContents()->show_all(); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index df20adc61..772217fcd 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -28,7 +28,7 @@ #include "color-item.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "document.h" #include "document-private.h" @@ -1061,7 +1061,7 @@ void SwatchesPanel::_updateFromSelection() Glib::ustring fillId; Glib::ustring strokeId; - SPStyle *tmpStyle = sp_style_new( sp_desktop_document(_currentDesktop) ); + SPStyle *tmpStyle = sp_style_new(_currentDesktop->getDocument()); int result = sp_desktop_query_style( _currentDesktop, tmpStyle, QUERY_STYLE_PROPERTY_FILL ); switch (result) { case QUERY_STYLE_SINGLE: diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 0ec071d06..bdba3e154 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -52,7 +52,7 @@ #include "selection.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "inkscape.h" #include "sp-root.h" @@ -288,7 +288,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : /**********************************************************/ currentDesktop = SP_ACTIVE_DESKTOP; - currentDocument = sp_desktop_document(currentDesktop); + currentDocument = currentDesktop->getDocument(); previewDocument = symbols_preview_doc(); /* Template to render symbols in */ previewDocument->ensureUpToDate(); /* Necessary? */ diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index f79d166f2..eff75b311 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -20,7 +20,7 @@ #include "template-load-tab.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "file.h" @@ -68,8 +68,8 @@ void TemplateWidget::create() SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPDesktop *desc = sp_file_new_default(); _current_template.tpl_effect->effect(desc); - DocumentUndo::clearUndo(sp_desktop_document(desc)); - sp_desktop_document(desc)->setModifiedSinceSave(false); + DocumentUndo::clearUndo(desc->getDocument()); + desc->getDocument()->setModifiedSinceSave(false); // Apply cx,cy etc. from document sp_namedview_window_from_document( desc ); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 0cbe41f78..229e82af4 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -41,7 +41,7 @@ extern "C" { #include "document.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "document-undo.h" #include "selection.h" #include "style.h" @@ -344,7 +344,7 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) Inkscape::FontLister* fontlister = Inkscape::FontLister::get_instance(); // This is normally done for us by text-toolbar but only when we are in text editing context - fontlister->update_font_list(sp_desktop_document(this->desktop)); + fontlister->update_font_list(this->desktop->getDocument()); fontlister->selection_update(); Glib::ustring fontspec = fontlister->get_fontspec(); @@ -583,7 +583,7 @@ void TextEdit::onApply() } // complete the transaction - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_TEXT, _("Set text style")); apply_button.set_sensitive ( false ); @@ -658,7 +658,7 @@ void TextEdit::onStartOffsetChange(GtkTextBuffer * /*text_buffer*/, TextEdit *se const gchar *sstr = gtk_combo_box_text_get_active_text(reinterpret_cast(self->startOffset)); tp->setAttribute("startOffset", sstr); - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "startOffset", SP_VERB_CONTEXT_TEXT, _("Set text style")); + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "startOffset", SP_VERB_CONTEXT_TEXT, _("Set text style")); } } diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index d7cca13a8..233d99750 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -26,7 +26,7 @@ #include "document.h" #include "document-undo.h" #include "desktop.h" -#include "desktop-handles.h" + #include "transformation.h" #include "align-and-distribute.h" #include "inkscape.h" @@ -802,7 +802,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) } } - DocumentUndo::done( sp_desktop_document(selection->desktop()) , SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done( selection->desktop()->getDocument() , SP_VERB_DIALOG_TRANSFORM, _("Move")); } @@ -864,7 +864,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) } } - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Scale")); } @@ -889,7 +889,7 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection) } } - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Rotate")); } @@ -977,7 +977,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) } } - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Skew")); } @@ -1007,7 +1007,7 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform } - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Edit transformation matrix")); } diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index 53691cd37..a50a169eb 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -24,7 +24,7 @@ #include "document-undo.h" #include "inkscape.h" #include "verbs.h" -#include "desktop-handles.h" + #include "util/signal-blocker.h" #include "desktop.h" diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index 7105e2cda..c02520218 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -23,7 +23,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "ui/dialog-events.h" #include "document.h" #include "document-undo.h" @@ -363,7 +363,7 @@ void XmlTree::set_tree_desktop(SPDesktop *desktop) sel_changed_connection = desktop->getSelection()->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed))); document_replaced_connection = desktop->connectDocumentReplaced(sigc::mem_fun(this, &XmlTree::on_document_replaced)); - set_tree_document(sp_desktop_document(desktop)); + set_tree_document(desktop->getDocument()); } else { set_tree_document(NULL); } @@ -493,7 +493,7 @@ void XmlTree::set_dt_select(Inkscape::XML::Node *repr) repr = repr->parent(); } // end of while loop - object = sp_desktop_document(current_desktop)->getObjectByRepr(repr); + object = current_desktop->getDocument()->getObjectByRepr(repr); } else { object = NULL; } diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 0649da3df..28a65e0b4 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -38,7 +38,7 @@ #include "path-prefix.h" #include "shortcuts.h" #include "document.h" -#include "desktop-handles.h" + #include "ui/interface.h" #include "desktop.h" #include "selection.h" @@ -1237,7 +1237,7 @@ sp_ui_drag_data_received(GtkWidget *widget, // move to mouse pointer { - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { Geom::Point m( desktop->point() - sel_bbox->midpoint() ); diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index ca550502d..fb99dfd59 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -28,7 +28,7 @@ #include "preferences.h" #include "style.h" #include "desktop.h" -#include "desktop-handles.h" + #include "sp-namedview.h" #include "live_effects/effect.h" #include "sp-pattern.h" diff --git a/src/ui/shape-editor.cpp b/src/ui/shape-editor.cpp index 0b9fc24c5..aec5cde27 100644 --- a/src/ui/shape-editor.cpp +++ b/src/ui/shape-editor.cpp @@ -14,7 +14,7 @@ #include #include -#include "desktop-handles.h" +#include "desktop.h" #include "document.h" #include "gc-anchored.h" #include "knotholder.h" @@ -146,7 +146,7 @@ void ShapeEditor::set_item(SPItem *item, bool keep_knotholder) { void ShapeEditor::reset_item(bool keep_knotholder) { if (knotholder) { - SPObject *obj = sp_desktop_document(desktop)->getObjectByRepr(knotholder_listener_attached_for); /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. + SPObject *obj = desktop->getDocument()->getObjectByRepr(knotholder_listener_attached_for); /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. set_item(SP_ITEM(obj), keep_knotholder); } } diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index c1a76c715..bcf5c9fce 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -11,7 +11,7 @@ #include #include <2geom/point.h> #include "desktop.h" -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "display/snap-indicator.h" #include "ui/tools/tool-base.h" diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index d7b35c974..f53cef5f4 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -14,7 +14,7 @@ #include "node.h" #include #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "live_effects/lpeobject.h" @@ -820,9 +820,9 @@ void MultiPathManipulator::_commit(CommitEvent cps) _selection.signal_update.emit(); invokeForAll(&PathManipulator::writeXML); if (key) { - DocumentUndo::maybeDone(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::maybeDone(_desktop->getDocument(), key, SP_VERB_CONTEXT_NODE, reason); } else { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_NODE, reason); } signal_coords_changed.emit(); } @@ -831,7 +831,7 @@ void MultiPathManipulator::_commit(CommitEvent cps) void MultiPathManipulator::_done(gchar const *reason, bool alert_LPE) { invokeForAll(&PathManipulator::update, alert_LPE); invokeForAll(&PathManipulator::writeXML); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_NODE, reason); signal_coords_changed.emit(); } diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 8c22f7c6e..eeea47e4d 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -17,7 +17,7 @@ #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "desktop.h" -#include "desktop-handles.h" + #include "preferences.h" #include "snap.h" #include "snap-preferences.h" diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 9108dff29..c8b986824 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -23,7 +23,7 @@ #include #include "ui/tool/path-manipulator.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "display/curve.h" @@ -1621,13 +1621,13 @@ void PathManipulator::_removeNodesFromSelection() void PathManipulator::_commit(Glib::ustring const &annotation) { writeXML(); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, annotation.data()); + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_NODE, annotation.data()); } void PathManipulator::_commit(Glib::ustring const &annotation, gchar const *key) { writeXML(); - DocumentUndo::maybeDone(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, + DocumentUndo::maybeDone(_desktop->getDocument(), key, SP_VERB_CONTEXT_NODE, annotation.data()); } diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index fe541e823..e4e701785 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -11,7 +11,7 @@ #include "control-point.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/sodipodi-ctrlrect.h" #include "ui/tools/tool-base.h" #include "preferences.h" diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 4b853d053..da2a54989 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -15,7 +15,7 @@ #include #include <2geom/transforms.h> #include "desktop.h" -#include "desktop-handles.h" + #include "display/sodipodi-ctrlrect.h" #include "preferences.h" #include "snap.h" diff --git a/src/ui/tools-switch.cpp b/src/ui/tools-switch.cpp index 07d68471f..11313f550 100644 --- a/src/ui/tools-switch.cpp +++ b/src/ui/tools-switch.cpp @@ -18,7 +18,7 @@ #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include #include diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index 5fe03cf8e..b9206407a 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -29,7 +29,7 @@ #include "document-undo.h" #include "sp-namedview.h" #include "selection.h" -#include "desktop-handles.h" + #include "snap.h" #include "pixmaps/cursor-ellipse.xpm" #include "xml/repr.h" @@ -444,7 +444,7 @@ void ArcTool::finishItem() { desktop->getSelection()->set(this->arc); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, _("Create ellipse")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ARC, _("Create ellipse")); this->arc = NULL; } @@ -466,7 +466,7 @@ void ArcTool::cancel() { desktop->canvas->endForcedFullRedraws(); - DocumentUndo::cancel(sp_desktop_document(desktop)); + DocumentUndo::cancel(desktop->getDocument()); } } diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 20751381d..f8ae685c4 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -26,7 +26,7 @@ #include "sp-namedview.h" #include "selection.h" #include "selection-chemistry.h" -#include "desktop-handles.h" + #include "snap.h" #include "display/curve.h" #include "display/sp-canvas-item.h" @@ -155,7 +155,7 @@ void Box3dTool::setup() { sigc::mem_fun(this, &Box3dTool::selection_changed) ); - this->_vpdrag = new Box3D::VPDrag(sp_desktop_document(this->desktop)); + this->_vpdrag = new Box3D::VPDrag(this->desktop->getDocument()); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -195,7 +195,7 @@ bool Box3dTool::item_handler(SPItem* item, GdkEvent* event) { bool Box3dTool::root_handler(GdkEvent* event) { static bool dragging; - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); @@ -589,7 +589,7 @@ void Box3dTool::finishItem() { this->extruded = false; if (this->box3d != NULL) { - SPDocument *doc = sp_desktop_document(this->desktop); + SPDocument *doc = this->desktop->getDocument(); if (!doc || !doc->getCurrentPersp3D()) { return; @@ -605,7 +605,7 @@ void Box3dTool::finishItem() { desktop->canvas->endForcedFullRedraws(); desktop->getSelection()->set(this->box3d); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Create 3D box")); this->box3d = NULL; diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 36eccd93c..151ab5f89 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -47,7 +47,7 @@ #include "selection.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "message-context.h" #include "preferences.h" @@ -973,7 +973,7 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) { this->repr = NULL; } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_CALLIGRAPHIC, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_CALLIGRAPHIC, _("Draw calligraphic stroke")); } diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 3235d2356..26a4eadd5 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -79,7 +79,7 @@ #include "svg/svg.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "message-context.h" @@ -659,7 +659,7 @@ bool ConnectorTool::_handleButtonRelease(GdkEventButton const &revent) { bool ret = false; if ( revent.button == 1 && !this->space_panning ) { - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); SnapManager &m = desktop->namedview->snap_manager; Geom::Point const event_w(revent.x, revent.y); @@ -729,7 +729,7 @@ bool ConnectorTool::_handleKeyPress(guint const keyval) { break; case GDK_KEY_Escape: if (this->state == SP_CONNECTOR_CONTEXT_REROUTING) { - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); this->_reroutingFinish(NULL); @@ -754,7 +754,7 @@ bool ConnectorTool::_handleKeyPress(guint const keyval) { } void ConnectorTool::_reroutingFinish(Geom::Point *const p) { - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); // Clear the temporary path: this->red_curve->reset(); @@ -812,7 +812,7 @@ void ConnectorTool::_setSubsequentPoint(Geom::Point const p) { Avoid::Point dst(d[Geom::X], d[Geom::Y]); if (!this->newConnRef) { - Avoid::Router *router = sp_desktop_document(desktop)->router; + Avoid::Router *router = desktop->getDocument()->router; this->newConnRef = new Avoid::ConnRef(router); this->newConnRef->setEndpoint(Avoid::VertID::src, src); if (this->isOrthogonal) @@ -876,7 +876,7 @@ void ConnectorTool::_flushWhite(SPCurve *gc) { /* Now we have to go back to item coordinates at last */ c->transform(this->desktop->dt2doc()); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); if ( c && !c->is_empty() ) { @@ -1309,7 +1309,7 @@ void cc_selection_set_avoid(bool const set_avoid) return; } - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index d9a906cb8..178e6636e 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -34,7 +34,7 @@ #include "sp-namedview.h" #include "sp-cursor.h" #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "document.h" #include "document-undo.h" @@ -329,7 +329,7 @@ bool DropperTool::root_handler(GdkEvent* event) { } if (!(desktop->getSelection()->isEmpty())) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_DROPPER, _("Set picked color")); } diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 2d86915c2..1b4dcfe25 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -44,7 +44,7 @@ #include "selection.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "message-context.h" #include "preferences.h" @@ -680,10 +680,10 @@ void EraserTool::set_to_accumulated() { if (selection->isEmpty()) { if ( eraserMode ) { - toWorkOn = sp_desktop_document(desktop)->getItemsPartiallyInBox(desktop->dkey, bounds); + toWorkOn = desktop->getDocument()->getItemsPartiallyInBox(desktop->dkey, bounds); } else { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); - toWorkOn = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, r->getPoints()); + toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); } toWorkOn = g_slist_remove( toWorkOn, acid ); @@ -767,9 +767,9 @@ void EraserTool::set_to_accumulated() { if ( workDone ) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); } else { - DocumentUndo::cancel(sp_desktop_document(desktop)); + DocumentUndo::cancel(desktop->getDocument()); } } diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index b6808fbc2..82057f483 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -31,7 +31,7 @@ #include "color.h" #include "context-fns.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "display/cairo-utils.h" #include "display/drawing-context.h" @@ -360,7 +360,7 @@ inline static bool check_if_pixel_is_paintable(guchar *px, unsigned char *trace_ * @param union_with_selection If true, merge the final SVG path with the current selection. */ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *desktop, Geom::Affine transform, unsigned int min_x, unsigned int max_x, unsigned int min_y, unsigned int max_y, bool union_with_selection) { - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); unsigned char *trace_t; @@ -740,7 +740,7 @@ static bool sort_fill_queue_horizontal(Geom::Point a, Geom::Point b) { */ static void sp_flood_do_flood_fill(ToolBase *event_context, GdkEvent *event, bool union_with_selection, bool is_point_fill, bool is_touch_fill) { SPDesktop *desktop = event_context->desktop; - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); document->ensureUpToDate(); @@ -1096,7 +1096,7 @@ bool FloodTool::item_handler(SPItem* item, GdkEvent* event) { // Set style desktop->applyCurrentOrToolStyle(item, "/tools/paintbucket", false); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object")); ret = TRUE; } @@ -1231,7 +1231,7 @@ void FloodTool::finishItem() { desktop->getSelection()->set(this->item); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); this->item = NULL; } diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 14d9b8815..c9fe37135 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -27,7 +27,7 @@ #include #include "display/curve.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "document.h" #include "ui/draw-anchor.h" @@ -667,7 +667,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) : dc->desktop->dt2doc() ); SPDesktop *desktop = dc->desktop; - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); if ( c && !c->is_empty() ) { @@ -865,7 +865,7 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too desktop->getSelection()->set(item); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot")); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Create single dot")); } } diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index b674b6a8a..5da30da7b 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -23,7 +23,7 @@ #include "document.h" #include "selection.h" #include "desktop.h" -#include "desktop-handles.h" + #include "message-context.h" #include "message-stack.h" #include "pixmaps/cursor-gradient.xpm" @@ -464,7 +464,7 @@ sp_gradient_context_add_stop_near_point (GradientTool *rc, SPItem *item, Geom:: SPStop *newstop = ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom()); - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop")); ec->get_drag()->updateDraggers(); @@ -509,13 +509,13 @@ bool GradientTool::root_handler(GdkEvent* event) { SPGradientType new_type = (SPGradientType) prefs->getInt("/tools/gradient/newgradient", SP_GRADIENT_TYPE_LINEAR); Inkscape::PaintTarget fsmode = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE; - SPGradient *vector = sp_gradient_vector_for_object(sp_desktop_document(desktop), desktop, item, fsmode); + SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode); SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode); sp_gradient_reset_to_userspace(priv, item); } - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Create default gradient")); } ret = TRUE; @@ -893,7 +893,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); ToolBase *ec = SP_EVENT_CONTEXT(&rc); if (!selection->isEmpty()) { diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 265c20ec8..c9b656397 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -30,7 +30,7 @@ #include "preferences.h" #include "ui/shape-editor.h" #include "selection.h" -#include "desktop-handles.h" + #include "document.h" #include "display/curve.h" #include "display/canvas-bpath.h" @@ -310,7 +310,7 @@ lpetool_try_construction(LpeTool *lc, Inkscape::LivePathEffect::EffectType const // TODO: should we check whether type represents a valid geometric construction? if (item && SP_IS_LPE_ITEM(item) && Inkscape::LivePathEffect::Effect::acceptsNumClicks(type) == 0) { - Inkscape::LivePathEffect::Effect::createAndApply(type, sp_desktop_document(lc->desktop), item); + Inkscape::LivePathEffect::Effect::createAndApply(type, lc->desktop->getDocument(), item); return true; } return false; @@ -360,7 +360,7 @@ lpetool_context_reset_limiting_bbox(LpeTool *lc) if (!prefs->getBool("/tools/lpetool/show_bbox", true)) return; - SPDocument *document = sp_desktop_document(lc->desktop); + SPDocument *document = lc->desktop->getDocument(); Geom::Point A, B; lpetool_get_limiting_bbox_corners(document, A, B); diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 6fa409ada..b7e54b9c8 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -29,7 +29,7 @@ #include "pixmaps/cursor-measure.xpm" #include "preferences.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "ui/tools/measure-tool.h" #include "ui/tools/freehand-base.h" #include "display/canvas-text.h" @@ -291,7 +291,7 @@ static void calculate_intersections(SPDesktop * /*desktop*/, SPItem* item, Geom: //TODO: consider only visible intersections Geom::Point intersection = lineseg[0].pointAt((*m).ta); double eps = 0.0001; - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); if (((*m).ta > eps && item == doc->getItemAtPoint(desktop->dkey, lineseg[0].pointAt((*m).ta - eps), false, NULL)) || ((*m).ta + eps < 1 && @@ -441,7 +441,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { // TODO switch to a different variable name. The single letter 'l' is easy to misread. //select elements crossed by line segment: - GSList *items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, points); + GSList *items = desktop->getDocument()->getItemsAtPoints(desktop->dkey, points); std::vector intersection_times; for (GSList *l = items; l != NULL; l = l->next) { SPItem *item = static_cast(l->data); diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index d512fadb5..d333b932e 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -27,7 +27,7 @@ // General #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "macros.h" @@ -317,7 +317,7 @@ static void sp_mesh_context_split_near_point(MeshTool *rc, SPItem *item, Geom:: ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom()); - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_MESH, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Split mesh row/column")); ec->get_drag()->updateDraggers(); @@ -488,13 +488,13 @@ bool MeshTool::root_handler(GdkEvent* event) { #ifdef DEBUG_MESH std::cout << "sp_mesh_context_root_handler: creating new mesh on: " << (fsmode == Inkscape::FOR_FILL ? "Fill" : "Stroke") << std::endl; #endif - SPGradient *vector = sp_gradient_vector_for_object(sp_desktop_document(desktop), desktop, item, fsmode); + SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode); SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode); sp_gradient_reset_to_userspace(priv, item); } - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_MESH, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Create default mesh")); } @@ -934,7 +934,7 @@ bool MeshTool::root_handler(GdkEvent* event) { static void sp_mesh_drag(MeshTool &rc, Geom::Point const /*pt*/, guint /*state*/, guint32 /*etime*/) { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); ToolBase *ec = SP_EVENT_CONTEXT(&rc); if (!selection->isEmpty()) { diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index a5d0df327..caec901a6 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -13,7 +13,7 @@ #include "ui/tool/curve-drag-point.h" #include #include "desktop.h" -#include "desktop-handles.h" + #include "display/sp-canvas-group.h" #include "display/canvas-bpath.h" #include "display/curve.h" @@ -668,7 +668,7 @@ void NodeTool::select_area(Geom::Rect const &sel, GdkEventButton *event) { if (this->_multipath->empty()) { // if multipath is empty, select rubberbanded items rather than nodes Inkscape::Selection *selection = this->desktop->selection; - GSList *items = sp_desktop_document(this->desktop)->getItemsInBox(this->desktop->dkey, sel); + GSList *items = this->desktop->getDocument()->getItemsInBox(this->desktop->dkey, sel); selection->setList(items); g_slist_free(items); } else { diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index ab72f3632..20375e869 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -33,6 +33,8 @@ namespace Inkscape { } } +struct SPCanvasGroup; + #define INK_NODE_TOOL(obj) (dynamic_cast((Inkscape::UI::Tools::ToolBase*)obj)) #define INK_IS_NODE_TOOL(obj) (dynamic_cast((const Inkscape::UI::Tools::ToolBase*)obj)) diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index adb5c2866..4587e88c8 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -23,7 +23,7 @@ #include "ui/tools/pen-tool.h" #include "sp-namedview.h" #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "selection-chemistry.h" #include "ui/draw-anchor.h" diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index ecb3ca12a..28fed3a8f 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -20,7 +20,7 @@ #include "ui/tools/pencil-tool.h" #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "selection-chemistry.h" #include "ui/draw-anchor.h" diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 69dfad025..9476ff624 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -28,7 +28,7 @@ #include "sp-namedview.h" #include "selection.h" #include "selection-chemistry.h" -#include "desktop-handles.h" + #include "snap.h" #include "desktop.h" #include "desktop-style.h" @@ -478,7 +478,7 @@ void RectTool::finishItem() { this->desktop->getSelection()->set(this->rect); - DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_RECT, _("Create rectangle")); + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_RECT, _("Create rectangle")); this->rect = NULL; } @@ -500,7 +500,7 @@ void RectTool::cancel(){ this->desktop->canvas->endForcedFullRedraws(); - DocumentUndo::cancel(sp_desktop_document(this->desktop)); + DocumentUndo::cancel(this->desktop->getDocument()); } } diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index bdde76c31..939b1a0b3 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -38,7 +38,7 @@ #include "extension/dbus/document-interface.h" #endif #include "desktop.h" -#include "desktop-handles.h" + #include "sp-root.h" #include "preferences.h" #include "ui/tools-switch.h" @@ -208,7 +208,7 @@ bool SelectTool::sp_select_context_abort() { if (this->item) { // only undo if the item is still valid if (this->item->document) { - DocumentUndo::undo(sp_desktop_document(desktop)); + DocumentUndo::undo(desktop->getDocument()); } sp_object_unref( this->item, NULL); @@ -216,7 +216,7 @@ bool SelectTool::sp_select_context_abort() { // NOTE: This is a workaround to a bug. // When the ctrl key is held, sc->item is not defined // so in this case (only), we skip the object doc check - DocumentUndo::undo(sp_desktop_document(desktop)); + DocumentUndo::undo(desktop->getDocument()); } this->item = NULL; @@ -722,9 +722,9 @@ bool SelectTool::root_handler(GdkEvent* event) { if (r->getMode() == RUBBERBAND_MODE_RECT) { Geom::OptRect const b = r->getRectangle(); - items = sp_desktop_document(desktop)->getItemsInBox(desktop->dkey, *b); + items = desktop->getDocument()->getItemsInBox(desktop->dkey, *b); } else if (r->getMode() == RUBBERBAND_MODE_TOUCHPATH) { - items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, r->getPoints()); + items = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); } _seltrans->resetState(); diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp index 7b11b8469..f208e1c43 100644 --- a/src/ui/tools/spiral-tool.cpp +++ b/src/ui/tools/spiral-tool.cpp @@ -27,7 +27,7 @@ #include "document-undo.h" #include "sp-namedview.h" #include "selection.h" -#include "desktop-handles.h" + #include "snap.h" #include "desktop.h" #include "desktop-style.h" @@ -418,7 +418,7 @@ void SpiralTool::finishItem() { this->desktop->canvas->endForcedFullRedraws(); this->desktop->getSelection()->set(this->spiral); - DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_SPIRAL, _("Create spiral")); + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPIRAL, _("Create spiral")); this->spiral = NULL; } @@ -440,7 +440,7 @@ void SpiralTool::cancel() { this->desktop->canvas->endForcedFullRedraws(); - DocumentUndo::cancel(sp_desktop_document(this->desktop)); + DocumentUndo::cancel(this->desktop->getDocument()); } } diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 39c146351..a01c5c55b 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -33,7 +33,7 @@ #include "selection.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "message-context.h" #include "pixmaps/cursor-spray.xpm" #include @@ -735,15 +735,15 @@ bool SprayTool::root_handler(GdkEvent* event) { this->has_dilated = false; switch (this->mode) { case SPRAY_MODE_COPY: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPRAY, _("Spray with copies")); break; case SPRAY_MODE_CLONE: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPRAY, _("Spray with clones")); break; case SPRAY_MODE_SINGLE_PATH: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPRAY, _("Spray in single path")); break; } diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp index a5e46e5b7..df311f2d8 100644 --- a/src/ui/tools/star-tool.cpp +++ b/src/ui/tools/star-tool.cpp @@ -30,7 +30,7 @@ #include "document-undo.h" #include "sp-namedview.h" #include "selection.h" -#include "desktop-handles.h" + #include "snap.h" #include "desktop.h" #include "desktop-style.h" @@ -442,7 +442,7 @@ void StarTool::finishItem() { desktop->canvas->endForcedFullRedraws(); desktop->getSelection()->set(this->star); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Create star")); this->star = NULL; @@ -465,7 +465,7 @@ void StarTool::cancel() { desktop->canvas->endForcedFullRedraws(); - DocumentUndo::cancel(sp_desktop_document(desktop)); + DocumentUndo::cancel(desktop->getDocument()); } } diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index e6dde0581..df0583d67 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -26,7 +26,7 @@ #include #include "context-fns.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "desktop.h" #include "document.h" @@ -431,7 +431,7 @@ static void sp_text_context_setup_text(TextTool *tc) text_item->updateRepr(); text_item->doWriteTransform(text_item->getRepr(), text_item->transform, NULL, true); - DocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(ec->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Create text")); } @@ -471,7 +471,7 @@ static void insert_uni_char(TextTool *const tc) tc->text_sel_start = tc->text_sel_end = sp_te_replace(tc->text, tc->text_sel_start, tc->text_sel_end, u); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - DocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(tc->desktop->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Insert Unicode character")); } } @@ -662,7 +662,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_desktop_apply_style_tool(desktop, ft->getRepr(), "/tools/text", true); desktop->getSelection()->set(ft); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Flowed text is created.")); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Create flowed text")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Create flowed text")); } else { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The frame is too small for the current font size. Flowed text not created.")); } @@ -801,7 +801,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No-break space")); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Insert no-break space")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Insert no-break space")); return TRUE; } break; @@ -837,7 +837,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_repr_css_set_property(css, "font-weight", "normal"); sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css); sp_repr_css_attr_unref(css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Make bold")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Make bold")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); return TRUE; @@ -854,7 +854,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_repr_css_set_property(css, "font-style", "italic"); sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css); sp_repr_css_attr_unref(css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Make italic")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Make italic")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); return TRUE; @@ -892,7 +892,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("New line")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("New line")); return TRUE; } case GDK_KEY_BackSpace: @@ -933,7 +933,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Backspace")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Backspace")); } return TRUE; case GDK_KEY_Delete: @@ -971,7 +971,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Delete")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Delete")); } return TRUE; case GDK_KEY_Left: @@ -987,7 +987,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*-1, 0)); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT, _("Kern to the left")); + DocumentUndo::maybeDone(desktop->getDocument(), "kern:left", SP_VERB_CONTEXT_TEXT, _("Kern to the left")); } else { if (MOD__CTRL(event)) this->text_sel_end.cursorLeftWithControl(); @@ -1011,7 +1011,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*1, 0)); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT, _("Kern to the right")); + DocumentUndo::maybeDone(desktop->getDocument(), "kern:right", SP_VERB_CONTEXT_TEXT, _("Kern to the right")); } else { if (MOD__CTRL(event)) this->text_sel_end.cursorRightWithControl(); @@ -1035,7 +1035,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*-1)); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT, _("Kern up")); + DocumentUndo::maybeDone(desktop->getDocument(), "kern:up", SP_VERB_CONTEXT_TEXT, _("Kern up")); } else { if (MOD__CTRL(event)) this->text_sel_end.cursorUpWithControl(); @@ -1059,7 +1059,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*1)); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT, _("Kern down")); + DocumentUndo::maybeDone(desktop->getDocument(), "kern:down", SP_VERB_CONTEXT_TEXT, _("Kern down")); } else { if (MOD__CTRL(event)) this->text_sel_end.cursorDownWithControl(); @@ -1134,7 +1134,7 @@ bool TextTool::root_handler(GdkEvent* event) { } else { sp_te_adjust_rotation(this->text, this->text_sel_start, this->text_sel_end, desktop, -90); } - DocumentUndo::maybeDone(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT, _("Rotate counterclockwise")); + DocumentUndo::maybeDone(desktop->getDocument(), "textrot:ccw", SP_VERB_CONTEXT_TEXT, _("Rotate counterclockwise")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); return TRUE; @@ -1154,7 +1154,7 @@ bool TextTool::root_handler(GdkEvent* event) { } else { sp_te_adjust_rotation(this->text, this->text_sel_start, this->text_sel_end, desktop, 90); } - DocumentUndo::maybeDone(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT, _("Rotate clockwise")); + DocumentUndo::maybeDone(desktop->getDocument(), "textrot:cw", SP_VERB_CONTEXT_TEXT, _("Rotate clockwise")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); return TRUE; @@ -1170,13 +1170,13 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -10); else sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -1); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract line spacing")); + DocumentUndo::maybeDone(desktop->getDocument(), "linespacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract line spacing")); } else { if (MOD__SHIFT(event)) sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -10); else sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -1); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract letter spacing")); + DocumentUndo::maybeDone(desktop->getDocument(), "letterspacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract letter spacing")); } sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); @@ -1193,13 +1193,13 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 10); else sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 1); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand line spacing")); + DocumentUndo::maybeDone(desktop->getDocument(), "linespacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand line spacing")); } else { if (MOD__SHIFT(event)) sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 10); else sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 1); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand letter spacing"));\ + DocumentUndo::maybeDone(desktop->getDocument(), "letterspacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand letter spacing"));\ } sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); @@ -1328,7 +1328,7 @@ bool sp_text_paste_inline(ToolBase *ec) tc->text_sel_start = tc->text_sel_end = sp_te_insert_line(tc->text, tc->text_sel_start); begin = end + 1; } - DocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(ec->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Paste text")); return true; @@ -1451,7 +1451,7 @@ bool TextTool::_styleSet(SPCSSAttr const *css) return false; // will get picked up by the parent and applied to the whole text object sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css); - DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Set text style")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); @@ -1661,7 +1661,7 @@ static void sp_text_context_forget_text(TextTool *tc) // the XML editor if ( text_repr && text_repr->parent() ) { sp_repr_unparent(text_repr); - SPDocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(tc->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Remove empty text")); } } diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 8ce78b2d9..a07f2fb86 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -39,7 +39,7 @@ #include "xml/node-event-vector.h" #include "sp-cursor.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-events.h" #include "desktop-style.h" #include "sp-namedview.h" diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 2b77c9d7a..5e53fdb93 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -28,7 +28,7 @@ #include "selection.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-tweak-move.xpm" @@ -1235,55 +1235,55 @@ bool TweakTool::root_handler(GdkEvent* event) { this->has_dilated = false; switch (this->mode) { case TWEAK_MODE_MOVE: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Move tweak")); break; case TWEAK_MODE_MOVE_IN_OUT: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Move in/out tweak")); break; case TWEAK_MODE_MOVE_JITTER: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Move jitter tweak")); break; case TWEAK_MODE_SCALE: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Scale tweak")); break; case TWEAK_MODE_ROTATE: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Rotate tweak")); break; case TWEAK_MODE_MORELESS: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Duplicate/delete tweak")); break; case TWEAK_MODE_PUSH: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Push path tweak")); break; case TWEAK_MODE_SHRINK_GROW: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Shrink/grow path tweak")); break; case TWEAK_MODE_ATTRACT_REPEL: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Attract/repel path tweak")); break; case TWEAK_MODE_ROUGHEN: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Roughen path tweak")); break; case TWEAK_MODE_COLORPAINT: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Color paint tweak")); break; case TWEAK_MODE_COLORJITTER: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Color jitter tweak")); break; case TWEAK_MODE_BLUR: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Blur tweak")); break; } diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index 6b5a351f6..d4c4d394e 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -12,7 +12,7 @@ #include "color-picker.h" #include "inkscape.h" -#include "desktop-handles.h" +#include "desktop.h" #include "document.h" #include "document-undo.h" #include "ui/dialog-events.h" @@ -128,7 +128,7 @@ void sp_color_picker_color_mod(SPColorSelector *csel, GObject *cp) (ptr->_preview).setRgba32 (rgba); if (ptr->_undo && SP_ACTIVE_DESKTOP) - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_NONE, /* TODO: annotate */ "color-picker.cpp:130"); ptr->on_changed (rgba); diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index 4754b9c23..242a99073 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -13,7 +13,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "inkscape.h" diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 7b1a8dbfb..dc89d233f 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -21,7 +21,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "layer-manager.h" @@ -601,7 +601,7 @@ void LayerSelector::_prepareLabelRenderer( void LayerSelector::_lockLayer(bool lock) { if ( _layer && SP_IS_ITEM(_layer) ) { SP_ITEM(_layer)->setLocked(lock); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_NONE, lock? _("Lock layer") : _("Unlock layer")); } } @@ -609,7 +609,7 @@ void LayerSelector::_lockLayer(bool lock) { void LayerSelector::_hideLayer(bool hide) { if ( _layer && SP_IS_ITEM(_layer) ) { SP_ITEM(_layer)->setHidden(hide); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_NONE, hide? _("Hide layer") : _("Unhide layer")); } } diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index b4cfa3231..7439a402c 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -17,7 +17,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "document.h" #include "document-undo.h" @@ -104,7 +104,7 @@ ObjectCompositeSettings::_blendBlurValueChanged() if (!desktop) { return; } - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); if (_blocked) return; @@ -195,7 +195,7 @@ ObjectCompositeSettings::_opacityValueChanged() sp_repr_css_attr_unref (css); - DocumentUndo::maybeDone(sp_desktop_document (desktop), _opacity_tag.c_str(), _verb_code, + DocumentUndo::maybeDone(desktop->getDocument(), _opacity_tag.c_str(), _verb_code, _("Change opacity")); // resume interruptibility @@ -219,7 +219,7 @@ ObjectCompositeSettings::_subjectChanged() { return; _blocked = true; - SPStyle *query = sp_style_new (sp_desktop_document(desktop)); + SPStyle *query = sp_style_new (desktop->getDocument()); int result = _subject->queryStyle(query, QUERY_STYLE_PROPERTY_MASTEROPACITY); switch (result) { diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index fb7f5abd7..d36c11ace 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -32,7 +32,7 @@ #include <2geom/transforms.h> -#include "desktop-handles.h" + #include "document.h" #include "desktop.h" #include "helper/action.h" @@ -477,7 +477,7 @@ PageSizer::setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool _unit = w.unit->abbr; if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { - SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); + SPDocument *doc = SP_ACTIVE_DESKTOP->getDocument(); Inkscape::Util::Quantity const old_height = doc->getHeight(); doc->setWidth (w, changeSize); doc->setHeight (h, changeSize); @@ -608,7 +608,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() SPNamedView *nv; Inkscape::XML::Node *nv_repr; - if ((doc = sp_desktop_document(SP_ACTIVE_DESKTOP)) + if ((doc = SP_ACTIVE_DESKTOP->getDocument()) && (nv = sp_document_namedview(doc, 0)) && (nv_repr = nv->getRepr())) { _lockMarginUpdate = true; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 39aa6c584..0cff25d88 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -34,7 +34,7 @@ #include "icon-size.h" #include "preferences.h" #include "desktop.h" -#include "desktop-handles.h" + #include "inkscape.h" #include "widgets/eek-preview.h" #include "ui/previewfillable.h" diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 7f3e6cd47..98028ed78 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -34,7 +34,7 @@ #include "desktop.h" #include "enums.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "message-stack.h" #include "style.h" #include "selection.h" diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 02ab88418..bbf542987 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -37,7 +37,7 @@ #include "display/sp-canvas.h" #include "desktop.h" -#include "desktop-handles.h" + #include "sp-root.h" @@ -420,7 +420,7 @@ RegisteredColorPicker::on_changed (guint32 rgba) if (!dt) return; local_repr = dt->getNamedView()->getRepr(); - local_doc = sp_desktop_document(dt); + local_doc = dt->getDocument(); } gchar c[32]; diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 38944250c..93b4893f2 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -20,7 +20,7 @@ #include "ui/widget/color-preview.h" #include "selection.h" -#include "desktop-handles.h" + #include "style.h" #include "desktop-style.h" #include "sp-namedview.h" @@ -541,8 +541,7 @@ void SelectedStyle::dragDataReceived( GtkWidget */*widget*/, sp_repr_css_set_property( css, (tracker->item == SS_FILL) ? "fill":"stroke", c ); sp_desktop_set_style( tracker->parent->_desktop, css ); sp_repr_css_attr_unref( css ); - DocumentUndo::done( sp_desktop_document(tracker->parent->_desktop) , SP_VERB_NONE, - _("Drop color")); + DocumentUndo::done( tracker->parent->_desktop->getDocument(), SP_VERB_NONE, _("Drop color")); } } break; @@ -554,7 +553,7 @@ void SelectedStyle::on_fill_remove() { sp_repr_css_set_property (css, "fill", "none"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Remove fill")); } @@ -563,7 +562,7 @@ void SelectedStyle::on_stroke_remove() { sp_repr_css_set_property (css, "stroke", "none"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Remove stroke")); } @@ -572,7 +571,7 @@ void SelectedStyle::on_fill_unset() { sp_repr_css_unset_property (css, "fill"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Unset fill")); } @@ -588,7 +587,7 @@ void SelectedStyle::on_stroke_unset() { sp_repr_css_unset_property (css, "stroke-dasharray"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Unset stroke")); } @@ -597,7 +596,7 @@ void SelectedStyle::on_fill_opaque() { sp_repr_css_set_property (css, "fill-opacity", "1"); sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Make fill opaque")); } @@ -606,7 +605,7 @@ void SelectedStyle::on_stroke_opaque() { sp_repr_css_set_property (css, "stroke-opacity", "1"); sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Make fill opaque")); } @@ -618,7 +617,7 @@ void SelectedStyle::on_fill_lastused() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Apply last set color to fill")); } @@ -630,7 +629,7 @@ void SelectedStyle::on_stroke_lastused() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Apply last set color to stroke")); } @@ -641,7 +640,7 @@ void SelectedStyle::on_fill_lastselected() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Apply last selected color to fill")); } @@ -652,7 +651,7 @@ void SelectedStyle::on_stroke_lastselected() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Apply last selected color to stroke")); } @@ -678,7 +677,7 @@ void SelectedStyle::on_fill_invert() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Invert fill")); } @@ -702,7 +701,7 @@ void SelectedStyle::on_stroke_invert() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Invert stroke")); } @@ -714,7 +713,7 @@ void SelectedStyle::on_fill_white() { sp_repr_css_set_property (css, "fill-opacity", "1"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("White fill")); } @@ -726,7 +725,7 @@ void SelectedStyle::on_stroke_white() { sp_repr_css_set_property (css, "stroke-opacity", "1"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("White stroke")); } @@ -738,7 +737,7 @@ void SelectedStyle::on_fill_black() { sp_repr_css_set_property (css, "fill-opacity", "1.0"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Black fill")); } @@ -750,7 +749,7 @@ void SelectedStyle::on_stroke_black() { sp_repr_css_set_property (css, "stroke-opacity", "1.0"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Black stroke")); } @@ -793,7 +792,7 @@ void SelectedStyle::on_fill_paste() { sp_repr_css_set_property (css, "fill", text.c_str()); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Paste fill")); } } @@ -811,7 +810,7 @@ void SelectedStyle::on_stroke_paste() { sp_repr_css_set_property (css, "stroke", text.c_str()); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Paste stroke")); } } @@ -865,7 +864,7 @@ void SelectedStyle::on_fillstroke_swap() { sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Swap fill and stroke")); } @@ -940,7 +939,7 @@ SelectedStyle::on_opacity_click(GdkEventButton *event) sp_repr_css_set_property (css, "opacity", opacity); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Change opacity")); return true; } @@ -967,7 +966,7 @@ void SelectedStyle::on_popup_preset(int i) { // FIXME: update dash patterns! sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_SWATCHES, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_SWATCHES, _("Change stroke width")); } @@ -978,7 +977,7 @@ SelectedStyle::update() return; // create temporary style - SPStyle *query = sp_style_new (sp_desktop_document(_desktop)); + SPStyle *query = sp_style_new (_desktop->getDocument()); for (int i = SS_FILL; i <= SS_STROKE; i++) { Gtk::EventBox *place = (i == SS_FILL)? &_fill_place : &_stroke_place; @@ -1244,7 +1243,7 @@ void SelectedStyle::on_opacity_changed () _desktop->getCanvas()->forceFullRedrawAfterInterruptions(0); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::maybeDone(sp_desktop_document(_desktop), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::maybeDone(_desktop->getDocument(), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE, _("Change opacity")); // resume interruptibility _desktop->getCanvas()->endForcedFullRedraws(); @@ -1385,25 +1384,25 @@ RotateableSwatch::do_motion(double by, guint modifier) { diff = color_adjust(hsla, by, cc, modifier); if (modifier == 3) { // alpha - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust alpha"))); double ch = hsla[3]; parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting alpha: was %.3g, now %.3g (diff %.3g); with Ctrl to adjust lightness, with Shift to adjust saturation, without modifiers to adjust hue"), ch - diff, ch, diff); } else if (modifier == 2) { // saturation - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust saturation"))); double ch = hsla[1]; parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting saturation: was %.3g, now %.3g (diff %.3g); with Ctrl to adjust lightness, with Alt to adjust alpha, without modifiers to adjust hue"), ch - diff, ch, diff); } else if (modifier == 1) { // lightness - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust lightness"))); double ch = hsla[2]; parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting lightness: was %.3g, now %.3g (diff %.3g); with Shift to adjust saturation, with Alt to adjust alpha, without modifiers to adjust hue"), ch - diff, ch, diff); } else { // hue - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust hue"))); double ch = hsla[0]; parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting hue: was %.3g, now %.3g (diff %.3g); with Shift to adjust saturation, with Alt to adjust alpha, with Ctrl to adjust lightness"), ch - diff, ch, diff); @@ -1440,18 +1439,18 @@ RotateableSwatch::do_release(double by, guint modifier) { } if (modifier == 3) { // alpha - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust alpha")); } else if (modifier == 2) { // saturation - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust saturation")); } else if (modifier == 1) { // lightness - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust lightness")); } else { // hue - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust hue")); } @@ -1523,7 +1522,7 @@ RotateableStrokeWidth::do_motion(double by, guint modifier) { if (modifier == 3) { // Alt, do nothing } else { double diff = value_adjust(startvalue, by, modifier, false); - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width"))); parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting stroke width: was %.3g, now %.3g (diff %.3g)"), startvalue, startvalue + diff, diff); } @@ -1537,7 +1536,7 @@ RotateableStrokeWidth::do_release(double by, guint modifier) { } else { value_adjust(startvalue, by, modifier, true); startvalue_set = false; - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width"))); } diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 1646b0fed..a48370d9b 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -11,7 +11,7 @@ #include "sp-object.h" #include "xml/sp-css-attr.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "selection.h" #include "style.h" diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index e798379f2..ff525c679 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -29,7 +29,7 @@ #include "document.h" #include "document-undo.h" #include "desktop.h" -#include "desktop-handles.h" + #include "sp-namedview.h" #include "registry.h" @@ -196,7 +196,7 @@ void ToleranceSlider::update (double val) _wr->setUpdating (true); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); Inkscape::XML::Node *repr = dt->getNamedView()->getRepr(); diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index fa62b8e8c..b62aacbc5 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -16,7 +16,7 @@ #include #include "vanishing-point.h" -#include "desktop-handles.h" + #include "desktop.h" #include "display/sp-canvas-item.h" #include "display/sp-ctrlline.h" @@ -129,7 +129,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g } // FIXME: Do we need to create a new dragger as well? dragger->updateZOrders (); - DocumentUndo::done(sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Split vanishing points")); return; } @@ -174,7 +174,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g // deleted according to changes in the svg representation, not based on any user input // as is currently the case. - DocumentUndo::done(sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Merge vanishing points")); return; diff --git a/src/verbs.cpp b/src/verbs.cpp index 4d212f0fc..231e258d6 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -41,7 +41,7 @@ #include #include "desktop.h" -#include "desktop-handles.h" + #include "display/curve.h" #include "document.h" #include "ui/tools/freehand-base.h" @@ -948,10 +948,10 @@ void EditVerb::perform(SPAction *action, void *data) switch (reinterpret_cast(data)) { case SP_VERB_EDIT_UNDO: - sp_undo(dt, sp_desktop_document(dt)); + sp_undo(dt, dt->getDocument()); break; case SP_VERB_EDIT_REDO: - sp_redo(dt, sp_desktop_document(dt)); + sp_redo(dt, dt->getDocument()); break; case SP_VERB_EDIT_CUT: sp_selection_cut(dt); @@ -1256,7 +1256,7 @@ void LayerVerb::perform(SPAction *action, void *data) SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); if (next) { dt->setCurrentLayer(next); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_NEXT, _("Switch to next layer")); dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to next layer.")); } else { @@ -1268,7 +1268,7 @@ void LayerVerb::perform(SPAction *action, void *data) SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); if (prev) { dt->setCurrentLayer(prev); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_PREV, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_PREV, _("Switch to previous layer")); dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to previous layer.")); } else { @@ -1338,7 +1338,7 @@ void LayerVerb::perform(SPAction *action, void *data) description = _("Lower layer"); break; }; - DocumentUndo::done(sp_desktop_document(dt), verb, description); + DocumentUndo::done(dt->getDocument(), verb, description); if (message) { dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message); g_free((void *) message); @@ -1384,7 +1384,7 @@ void LayerVerb::perform(SPAction *action, void *data) dt->setCurrentLayer(new_layer); } #endif - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_DUPLICATE, _("Duplicate layer")); // TRANSLATORS: this means "The layer has been duplicated." @@ -1420,7 +1420,7 @@ void LayerVerb::perform(SPAction *action, void *data) dt->setCurrentLayer(survivor); } - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_DELETE, _("Delete layer")); // TRANSLATORS: this means "The layer has been deleted." @@ -1435,23 +1435,23 @@ void LayerVerb::perform(SPAction *action, void *data) dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer.")); } else { dt->toggleLayerSolo( dt->currentLayer() ); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_SOLO, _("Toggle layer solo")); + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_SOLO, _("Toggle layer solo")); } break; } case SP_VERB_LAYER_SHOW_ALL: { dt->toggleHideAllLayers( false ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:showall", SP_VERB_LAYER_SHOW_ALL, _("Show all layers")); + DocumentUndo::maybeDone(dt->getDocument(), "layer:showall", SP_VERB_LAYER_SHOW_ALL, _("Show all layers")); break; } case SP_VERB_LAYER_HIDE_ALL: { dt->toggleHideAllLayers( true ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:hideall", SP_VERB_LAYER_HIDE_ALL, _("Hide all layers")); + DocumentUndo::maybeDone(dt->getDocument(), "layer:hideall", SP_VERB_LAYER_HIDE_ALL, _("Hide all layers")); break; } case SP_VERB_LAYER_LOCK_ALL: { dt->toggleLockAllLayers( true ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:lockall", SP_VERB_LAYER_LOCK_ALL, _("Lock all layers")); + DocumentUndo::maybeDone(dt->getDocument(), "layer:lockall", SP_VERB_LAYER_LOCK_ALL, _("Lock all layers")); break; } case SP_VERB_LAYER_LOCK_OTHERS: { @@ -1459,13 +1459,13 @@ void LayerVerb::perform(SPAction *action, void *data) dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer.")); } else { dt->toggleLockOtherLayers( dt->currentLayer() ); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers")); + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers")); } break; } case SP_VERB_LAYER_UNLOCK_ALL: { dt->toggleLockAllLayers( false ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:unlockall", SP_VERB_LAYER_UNLOCK_ALL, _("Unlock all layers")); + DocumentUndo::maybeDone(dt->getDocument(), "layer:unlockall", SP_VERB_LAYER_UNLOCK_ALL, _("Unlock all layers")); break; } case SP_VERB_LAYER_TOGGLE_LOCK: @@ -1548,12 +1548,12 @@ void ObjectVerb::perform( SPAction *action, void *data) break; case SP_VERB_OBJECT_FLIP_HORIZONTAL: sp_selection_scale_relative(sel, center, Geom::Scale(-1.0, 1.0)); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL, + DocumentUndo::done(dt->getDocument(), SP_VERB_OBJECT_FLIP_HORIZONTAL, _("Flip horizontally")); break; case SP_VERB_OBJECT_FLIP_VERTICAL: sp_selection_scale_relative(sel, center, Geom::Scale(1.0, -1.0)); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL, + DocumentUndo::done(dt->getDocument(), SP_VERB_OBJECT_FLIP_VERTICAL, _("Flip vertically")); break; case SP_VERB_OBJECT_SET_MASK: @@ -1831,7 +1831,7 @@ void TextVerb::perform(SPAction *action, void */*data*/) g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); (void)doc; Inkscape::XML::Node *repr = dt->namedview->getRepr(); (void)repr; @@ -1846,7 +1846,7 @@ void ZoomVerb::perform(SPAction *action, void *data) SPDesktop *dt = sp_action_get_desktop(action); Inkscape::UI::Tools::ToolBase *ec = dt->event_context; - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); Inkscape::XML::Node *repr = dt->namedview->getRepr(); @@ -2326,7 +2326,7 @@ void FitCanvasVerb::perform(SPAction *action, void *data) { g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); if (!doc) return; switch (reinterpret_cast(data)) { @@ -2392,7 +2392,7 @@ void LockAndHideVerb::perform(SPAction *action, void *data) { g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); if (!doc) return; switch (reinterpret_cast(data)) { diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index 6dba44add..8a64854be 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -31,7 +31,7 @@ #include #include "arc-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -81,7 +81,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble(Glib::ustring("/tools/shapes/arc/") + value_name, gtk_adjustment_get_value(adj)); } @@ -128,7 +128,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v sp_arctb_sensitivize( tbl, gtk_adjustment_get_value(adj), gtk_adjustment_get_value(other) ); if (modmade) { - DocumentUndo::maybeDone(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC, + DocumentUndo::maybeDone(desktop->getDocument(), value_name, SP_VERB_CONTEXT_ARC, _("Arc: Change start/end")); } @@ -150,7 +150,7 @@ static void sp_arctb_end_value_changed(GtkAdjustment *adj, GObject *tbl) static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool("/tools/shapes/arc/open", ege_select_one_action_get_active(act) != 0); } @@ -194,7 +194,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ARC, _("Arc: Change open/closed")); } diff --git a/src/widgets/box3d-toolbar.cpp b/src/widgets/box3d-toolbar.cpp index 3181e345b..26e914070 100644 --- a/src/widgets/box3d-toolbar.cpp +++ b/src/widgets/box3d-toolbar.cpp @@ -32,7 +32,7 @@ #include "box3d-toolbar.h" #include "box3d.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "document.h" @@ -208,7 +208,7 @@ static void box3d_toolbox_selection_changed(Inkscape::Selection *selection, GObj static void box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, Proj::Axis axis) { SPDesktop *desktop = static_cast(g_object_get_data( dataKludge, "desktop" )); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); // quit if run by the attr_changed or selection changed listener if (g_object_get_data( dataKludge, "freeze" )) { @@ -287,7 +287,7 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); EgeAdjustmentAction* eact = 0; - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); Persp3DImpl *persp_impl = document->getCurrentPersp3DImpl(); EgeAdjustmentAction* box3d_angle_x = 0; diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp index 915d1e629..c906f7de4 100644 --- a/src/widgets/connector-toolbar.cpp +++ b/src/widgets/connector-toolbar.cpp @@ -32,7 +32,7 @@ #include "connector-toolbar.h" #include "conn-avoid-ref.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -77,7 +77,7 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); Inkscape::Selection * selection = desktop->getSelection(); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); if (!DocumentUndo::getUndoSensitive(doc)) { return; @@ -127,7 +127,7 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); Inkscape::Selection * selection = desktop->getSelection(); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); if (!DocumentUndo::getUndoSensitive(doc)) { return; @@ -176,7 +176,7 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) static void connector_spacing_changed(GtkAdjustment *adj, GObject* tbl) { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); if (!DocumentUndo::getUndoSensitive(doc)) { return; @@ -237,7 +237,7 @@ static void sp_connector_graph_layout(void) prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); } static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GObject * /*tbl*/ ) diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index e117e7f60..fd3756220 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -32,7 +32,7 @@ #include "conn-avoid-ref.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "desktop-widget.h" #include "display/sp-canvas.h" #include "display/canvas-arena.h" diff --git a/src/widgets/eraser-toolbar.cpp b/src/widgets/eraser-toolbar.cpp index f547cbd8b..1f79b50f2 100644 --- a/src/widgets/eraser-toolbar.cpp +++ b/src/widgets/eraser-toolbar.cpp @@ -32,7 +32,7 @@ #include "eraser-toolbar.h" #include "calligraphy-toolbar.h" // TODO: needed for update_presets_list -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -61,7 +61,7 @@ static void sp_erasertb_mode_changed( EgeSelectOneAction *act, GObject *tbl ) { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); bool eraserMode = ege_select_one_action_get_active( act ) != 0; - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool( "/tools/eraser/mode", eraserMode ); } diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 820a20126..fcdc9a36b 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -35,7 +35,7 @@ #include "desktop.h" #include "selection.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "display/sp-canvas.h" #include "document-private.h" @@ -480,7 +480,7 @@ void FillNStroke::updateFromPaint() } update = true; - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); @@ -522,7 +522,7 @@ void FillNStroke::updateFromPaint() psel->setFlatColor( desktop, (kind == FILL) ? "fill" : "stroke", (kind == FILL) ? "fill-opacity" : "stroke-opacity" ); - DocumentUndo::maybeDone(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::maybeDone(desktop->getDocument(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Set fill color") : _("Set stroke color")); if (kind == FILL) { diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index 1968f87da..ea009c048 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -18,7 +18,7 @@ #include "ui/widget/color-preview.h" #include -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "document.h" @@ -128,7 +128,7 @@ gboolean gr_vector_list(GtkWidget *combo_box, SPDesktop *desktop, bool selection return sensitive; } - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); GtkTreeIter iter; GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(combo_box)); @@ -923,7 +923,7 @@ static void gr_gradient_combo_changed(EgeSelectOneAction *act, gpointer data) gr_apply_gradient(selection, ev? ev->get_drag() : NULL, gr); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Assign gradient to object")); } @@ -945,7 +945,7 @@ static void gr_spread_change(EgeSelectOneAction *act, GtkWidget *widget) gradient->setSpread(spread); gradient->updateRepr(); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Set gradient repeat")); } } @@ -1247,7 +1247,7 @@ static void gradient_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::T if (SP_IS_GRADIENT_CONTEXT(ec)) { Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); // connect to selection modified and changed signals connChanged = selection->connectChanged(sigc::bind(sigc::ptr_fun(&gr_tb_selection_changed), holder)); diff --git a/src/widgets/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp index c3a83be70..387bf6dee 100644 --- a/src/widgets/lpe-toolbar.cpp +++ b/src/widgets/lpe-toolbar.cpp @@ -30,7 +30,7 @@ #include "live_effects/lpe-line_segment.h" #include "lpe-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-select-one-action.h" @@ -91,7 +91,7 @@ static void sp_lpetool_mode_changed(EgeSelectOneAction *act, GObject *tbl) SP_LPETOOL_CONTEXT(desktop->event_context)->mode = type; } - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt( "/tools/lpetool/mode", mode ); } diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp index 1a4678332..5a4785b1f 100644 --- a/src/widgets/measure-toolbar.cpp +++ b/src/widgets/measure-toolbar.cpp @@ -31,7 +31,7 @@ #include #include "measure-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -55,7 +55,7 @@ sp_measure_fontsize_value_changed(GtkAdjustment *adj, GObject *tbl) { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt(Glib::ustring("/tools/measure/fontsize"), gtk_adjustment_get_value(adj)); diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp index 8c7ec33a8..e9e9fa344 100644 --- a/src/widgets/mesh-toolbar.cpp +++ b/src/widgets/mesh-toolbar.cpp @@ -38,7 +38,7 @@ #include "document-private.h" #include "document-undo.h" #include "desktop.h" -#include "desktop-handles.h" + #include #include "ui/tools/gradient-tool.h" @@ -335,7 +335,7 @@ static void mesh_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB if (SP_IS_MESH_CONTEXT(ec)) { // connect to selection modified and changed signals Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); c_selection_changed = selection->connectChanged(sigc::bind(sigc::ptr_fun(&ms_tb_selection_changed), holder)); c_selection_modified = selection->connectModified(sigc::bind(sigc::ptr_fun(&ms_tb_selection_modified), holder)); diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp index 52be03abe..113061519 100644 --- a/src/widgets/node-toolbar.cpp +++ b/src/widgets/node-toolbar.cpp @@ -31,7 +31,7 @@ #include "ui/tool/multi-path-manipulator.h" #include #include "node-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -264,7 +264,7 @@ static void sp_node_path_value_changed(GtkAdjustment *adj, GObject *tbl, Geom::D } Unit const *unit = tracker->getActiveUnit(); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { prefs->setDouble(Glib::ustring("/tools/nodes/") + (d == Geom::X ? "x" : "y"), Quantity::convert(gtk_adjustment_get_value(adj), unit, "px")); } diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index 2dc2bbb07..b78f74d94 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -31,7 +31,7 @@ #include #include "rect-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -90,7 +90,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * Unit const *unit = tracker->getActiveUnit(); g_return_if_fail(unit != NULL); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble(Glib::ustring("/tools/shapes/rect/") + value_name, Quantity::convert(gtk_adjustment_get_value(adj), unit, "px")); @@ -120,7 +120,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * sp_rtb_sensitivize( tbl ); if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_RECT, _("Change rectangle")); } diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 881de2e36..e49c4c00a 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -21,7 +21,7 @@ #include "ui/widget/spinbutton.h" #include #include "select-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "display/sp-canvas.h" #include "document-undo.h" @@ -154,7 +154,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); document->ensureUpToDate (); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/widgets/sp-xmlview-content.cpp b/src/widgets/sp-xmlview-content.cpp index 9243760bd..a1d8475ba 100644 --- a/src/widgets/sp-xmlview-content.cpp +++ b/src/widgets/sp-xmlview-content.cpp @@ -15,7 +15,7 @@ #include "xml/node-event-vector.h" #include "sp-xmlview-content.h" -#include "desktop-handles.h" +#include "desktop.h" #include "document-private.h" #include "document-undo.h" #include "inkscape.h" @@ -147,7 +147,7 @@ sp_xmlview_content_changed (GtkTextBuffer *tb, SPXMLViewContent *text) text->repr->setContent(data); g_free (data); text->blocked = FALSE; - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_DIALOG_XML_EDITOR, _("Type text in a text node")); } } diff --git a/src/widgets/spiral-toolbar.cpp b/src/widgets/spiral-toolbar.cpp index aa9c32c1a..3fb0015c1 100644 --- a/src/widgets/spiral-toolbar.cpp +++ b/src/widgets/spiral-toolbar.cpp @@ -31,7 +31,7 @@ #include #include "spiral-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -62,7 +62,7 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr { SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/spiral/" + value_name, gtk_adjustment_get_value(adj)); @@ -96,7 +96,7 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr g_free(namespaced_name); if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_SPIRAL, _("Change spiral")); } diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp index 31c67bd6f..cf12391c1 100644 --- a/src/widgets/star-toolbar.cpp +++ b/src/widgets/star-toolbar.cpp @@ -31,7 +31,7 @@ #include #include "star-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -64,7 +64,7 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu { SPDesktop *desktop = static_cast(g_object_get_data( dataKludge, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { // do not remember prefs if this call is initiated by an undo change, because undoing object // creation sets bogus values to its attributes before it is deleted Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -99,7 +99,7 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu } } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Star: Change number of corners")); } @@ -110,7 +110,7 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl { SPDesktop *desktop = static_cast(g_object_get_data( dataKludge, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { if (!IS_NAN(gtk_adjustment_get_value(adj))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/proportion", @@ -152,7 +152,7 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Star: Change spoke ratio")); } @@ -164,7 +164,7 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d SPDesktop *desktop = static_cast(g_object_get_data( dataKludge, "desktop" )); bool flat = ege_select_one_action_get_active( act ) == 0; - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool( "/tools/shapes/star/isflatsided", flat); } @@ -197,7 +197,7 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, flat ? _("Make polygon") : _("Make star")); } @@ -208,7 +208,7 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg { SPDesktop *desktop = static_cast(g_object_get_data( dataKludge, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/rounded", (gdouble) gtk_adjustment_get_value(adj)); } @@ -236,7 +236,7 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg } } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Star: Change rounding")); } @@ -247,7 +247,7 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl { SPDesktop *desktop = static_cast(g_object_get_data( dataKludge, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/randomized", (gdouble) gtk_adjustment_get_value(adj)); @@ -276,7 +276,7 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl } } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Star: Change randomization")); } diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp index c62262e81..d5b43d132 100644 --- a/src/widgets/stroke-marker-selector.cpp +++ b/src/widgets/stroke-marker-selector.cpp @@ -26,7 +26,7 @@ #include "style.h" #include "ui/dialog-events.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "preferences.h" #include "path-prefix.h" @@ -65,7 +65,7 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) : sandbox = ink_markers_preview_doc (); desktop = SP_ACTIVE_DESKTOP; - doc = sp_desktop_document(desktop); + doc = desktop->getDocument(); modified_connection = doc->getDefs()->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&MarkerComboBox::handleDefsModified), this))) ); @@ -92,7 +92,7 @@ void MarkerComboBox::setDesktop(SPDesktop *desktop) } this->desktop = desktop; - doc = sp_desktop_document(desktop); + doc = desktop->getDocument(); if (doc) { modified_connection = doc->getDefs()->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&MarkerComboBox::handleDefsModified), this))) ); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 830c0580d..755489e12 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -456,7 +456,7 @@ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, spw->update = true; - SPDocument *document = sp_desktop_document(spw->desktop); + SPDocument *document = spw->desktop->getDocument(); if (!document) { return; } @@ -957,7 +957,7 @@ StrokeStyle::scaleLine() update = true; - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); @@ -1113,8 +1113,7 @@ void StrokeStyle::buttonToggledCB(StrokeStyleButton *tb, StrokeStyle *spw) sp_repr_css_attr_unref(css); css = 0; - DocumentUndo::done(sp_desktop_document(spw->desktop), SP_VERB_DIALOG_FILL_STROKE, - _("Set stroke style")); + DocumentUndo::done(spw->desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Set stroke style")); } } @@ -1200,7 +1199,7 @@ StrokeStyle::updateAllMarkers(GSList const *objects) if (update) { setMarkerColor(marker, combo->get_loc(), SP_ITEM(object)); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, _("Set marker color")); } diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h index 15e394097..83048cb76 100644 --- a/src/widgets/stroke-style.h +++ b/src/widgets/stroke-style.h @@ -33,7 +33,6 @@ #include #include "desktop.h" -#include "desktop-handles.h" #include "desktop-style.h" #include "ui/dialog-events.h" #include "display/canvas-bpath.h" // for SP_STROKE_LINEJOIN_* diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 60ea75916..d113d5c28 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -31,7 +31,7 @@ #include "libnrtype/font-lister.h" #include #include "text-toolbar.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "desktop.h" #include "document-undo.h" @@ -165,7 +165,7 @@ static void sp_text_fontfamily_value_changed( Ink_ComboBoxEntry_Action *act, GOb sp_desktop_set_style (desktop, css, true, true); // Results in selection change called twice. sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Text: Change font family")); } @@ -229,7 +229,7 @@ static void sp_text_fontsize_value_changed( Ink_ComboBoxEntry_Action *act, GObje prefs->mergeStyle("/tools/text/style", css); } else { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:size", SP_VERB_NONE, _("Text: Change font size")); } @@ -267,7 +267,7 @@ static void sp_text_fontstyle_value_changed( Ink_ComboBoxEntry_Action *act, GObj sp_desktop_set_style (desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Text: Change font style")); } @@ -345,7 +345,7 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl ) // Save for undo if(result_baseline != QUERY_STYLE_NOTHING) { - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:script", SP_VERB_NONE, _("Text: Change superscript or subscript")); } g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -490,7 +490,7 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl ) sp_desktop_set_style (desktop, css, true, true); if (result_numbers != QUERY_STYLE_NOTHING) { - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_TEXT, _("Text: Change alignment")); } sp_repr_css_attr_unref (css); @@ -533,7 +533,7 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) // Save for undo if(modmade) { - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:line-height", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:line-height", SP_VERB_NONE, _("Text: Change line-height")); } @@ -582,7 +582,7 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl prefs->mergeStyle("/tools/text/style", css); } else { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:word-spacing", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:word-spacing", SP_VERB_NONE, _("Text: Change word-spacing")); } sp_style_unref(query); @@ -623,7 +623,7 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb else { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:letter-spacing", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:letter-spacing", SP_VERB_NONE, _("Text: Change letter-spacing")); } @@ -663,7 +663,7 @@ static void sp_text_dx_value_changed( GtkAdjustment *adj, GObject *tbl ) if(modmade) { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:dx", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:dx", SP_VERB_NONE, _("Text: Change dx (kern)")); } g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -697,7 +697,7 @@ static void sp_text_dy_value_changed( GtkAdjustment *adj, GObject *tbl ) if(modmade) { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:dy", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:dy", SP_VERB_NONE, _("Text: Change dy")); } @@ -732,7 +732,7 @@ static void sp_text_rotation_value_changed( GtkAdjustment *adj, GObject *tbl ) // Save for undo if(modmade) { - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:rotate", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:rotate", SP_VERB_NONE, _("Text: Change rotate")); } @@ -780,7 +780,7 @@ static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject * sp_desktop_set_style (SP_ACTIVE_DESKTOP, css, true, true); if(result_numbers != QUERY_STYLE_NOTHING) { - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_TEXT, _("Text: Change orientation")); } sp_repr_css_attr_unref (css); @@ -860,7 +860,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ Inkscape::FontLister* fontlister = Inkscape::FontLister::get_instance(); if (!subselection) { - fontlister->update_font_list( sp_desktop_document( SP_ACTIVE_DESKTOP )); + fontlister->update_font_list( SP_ACTIVE_DESKTOP->getDocument()); } fontlister->selection_update(); @@ -1169,7 +1169,7 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p GSList *selectList = NULL; SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *document = sp_desktop_document( desktop ); + SPDocument *document = desktop->getDocument(); GSList *allList = get_all_items(NULL, document->getRoot(), desktop, false, false, true, NULL); for (GSList *i = allList; i != NULL; i = i->next) { @@ -1214,7 +1214,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje { // Font list Inkscape::FontLister* fontlister = Inkscape::FontLister::get_instance(); - fontlister->update_font_list( sp_desktop_document( SP_ACTIVE_DESKTOP )); + fontlister->update_font_list( SP_ACTIVE_DESKTOP->getDocument()); Glib::RefPtr store = fontlister->get_font_list(); GtkListStore* model = store->gobj(); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 555bb780f..4f5682f7a 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -40,7 +40,6 @@ #include #include "../desktop.h" -#include "../desktop-handles.h" #include "../desktop-style.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" -- cgit v1.2.3 From 06f8d132963e23bef5d1a1ccb483787eadf31b3a Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 21 Dec 2014 17:53:20 -0500 Subject: Bug #1380413: make sure that the rect toolbar knows when and when not to update (bzr r13821) --- src/widgets/rect-toolbar.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index b78f74d94..016aa4987 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -404,12 +404,20 @@ static void rect_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB { static sigc::connection changed; - // TODO fixme: use of dynamic_cast<> seems wrong here. + // use of dynamic_cast<> seems wrong here -- we just need to check the current tool + if (dynamic_cast(ec)) { - changed = desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_rect_toolbox_selection_changed), holder)); + Inkscape::Selection *sel = desktop->getSelection(); + + changed = sel->connectChanged(sigc::bind(sigc::ptr_fun(sp_rect_toolbox_selection_changed), holder)); + + // Synthesize an emission to trigger the update + sp_rect_toolbox_selection_changed(sel, holder); } else { - if (changed) + if (changed) { changed.disconnect(); + purge_repr_listener(NULL, holder); + } } } -- cgit v1.2.3 From f01a18216e26fd87a53188018e03527c7fdf8a57 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 23 Dec 2014 10:25:08 +0100 Subject: Use gray for 'context-fill' and 'context-stroke' in marker selector. Fix rendering bug when elements with 'context-fill' and 'context-stroke' are inside groups. (bzr r13822) --- share/markers/markers.svg | 3 ++- src/display/nr-style.cpp | 18 +++++++------- src/sp-item-group.cpp | 14 ++++++----- src/sp-object.cpp | 1 + src/sp-object.h | 5 ++++ src/sp-shape.cpp | 44 ++++++++++++++++++++++++---------- src/sp-use.cpp | 14 +++++++---- src/widgets/stroke-marker-selector.cpp | 8 +++---- 8 files changed, 72 insertions(+), 35 deletions(-) diff --git a/share/markers/markers.svg b/share/markers/markers.svg index 825059fb0..91de99ed3 100644 --- a/share/markers/markers.svg +++ b/share/markers/markers.svg @@ -4,7 +4,8 @@ NOTE: this file is currently (0.48+) edited manually. Insert the new markers into the . --> + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + id="InkscapeMarkers"> diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 9dadaf3f1..1740785e2 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -101,13 +101,14 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style) if( context_style != NULL ) { style_fill = &(context_style->fill); } else { - std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; + // A marker in the defs section will result in ending up here. + //std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; } } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { if( context_style != NULL ) { style_fill = &(context_style->stroke); } else { - std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; + //std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; } } @@ -125,9 +126,10 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style) } else if ( style_fill->isNone() ) { fill.clear(); } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { - std::cerr << "NRStyle::set: fill: context-fill: Double" << std::endl; + // A marker in the defs section will result in ending up here. + //std::cerr << "NRStyle::set: fill: context-fill: Double" << std::endl; } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { - std::cerr << "NRStyle::set: fill: context-stroke: Double" << std::endl; + //std::cerr << "NRStyle::set: fill: context-stroke: Double" << std::endl; } else { g_assert_not_reached(); } @@ -150,13 +152,13 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style) if( context_style != NULL ) { style_stroke = &(context_style->fill); } else { - std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; + //std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; } } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { if( context_style != NULL ) { style_stroke = &(context_style->stroke); } else { - std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; + //std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; } } @@ -174,9 +176,9 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style) } else if ( style_stroke->isNone() ) { stroke.clear(); } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { - std::cerr << "NRStyle::set: stroke: context-fill: Double" << std::endl; + //std::cerr << "NRStyle::set: stroke: context-fill: Double" << std::endl; } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { - std::cerr << "NRStyle::set: stroke: context-stroke: Double" << std::endl; + //std::cerr << "NRStyle::set: stroke: context-stroke: Double" << std::endl; } else { g_assert_not_reached(); } diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 026b1a11a..45e5747d6 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -159,6 +159,7 @@ void SPGroup::order_changed (Inkscape::XML::Node *child, Inkscape::XML::Node *ol } void SPGroup::update(SPCtx *ctx, unsigned int flags) { + // std::cout << "SPGroup::update(): " << (getId()?getId():"null") << std::endl; SPItemCtx *ictx, cctx; ictx = (SPItemCtx *) ctx; @@ -200,15 +201,15 @@ void SPGroup::update(SPCtx *ctx, unsigned int flags) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *group = dynamic_cast(v->arenaitem); if( this->parent ) { - group->setStyle(this->style, this->parent->style); - } else { - group->setStyle(this->style); + this->context_style = this->parent->context_style; } + group->setStyle(this->style, this->context_style); } } } void SPGroup::modified(guint flags) { + // std::cout << "SPGroup::modified(): " << (getId()?getId():"null") << std::endl; SPLPEItem::modified(flags); SPObject *child; @@ -356,15 +357,16 @@ void SPGroup::set(unsigned int key, gchar const* value) { } Inkscape::DrawingItem *SPGroup::show (Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { + // std::cout << "SPGroup::show(): " << (getId()?getId():"null") << std::endl; Inkscape::DrawingGroup *ai; ai = new Inkscape::DrawingGroup(drawing); ai->setPickChildren(this->effectiveLayerMode(key) == SPGroup::LAYER); if( this->parent ) { - ai->setStyle(this->style, this->parent->style); - } else { - ai->setStyle(this->style); + this->context_style = this->parent->context_style; } + ai->setStyle(this->style, this->context_style); + this->_showChildren(drawing, ai, key, flags); return ai; } diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 3b09d80e8..776b020d2 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -131,6 +131,7 @@ SPObject::SPObject() // polygon, text, tspan, tref, textPath, altGlyph, glyphRef, marker, linearGradient, radialGradient, // stop, pattern, clipPath, mask, filter, feImage, a, font, glyph, missing-glyph, foreignObject this->style = sp_style_new_from_object(this); + this->context_style = NULL; } SPObject::~SPObject() { diff --git a/src/sp-object.h b/src/sp-object.h index 669dfc713..ff80eaefc 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -267,6 +267,11 @@ public: */ SPStyle *style; + /** + * Represents the style that should be used to resolve 'context-fill' and 'context-stroke' + */ + SPStyle *context_style; + /// Switch containing next() method. struct ParentIteratorStrategy { static SPObject const *next(SPObject const *object) { diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 02b9969b3..16f9ec13b 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -126,6 +126,7 @@ Inkscape::XML::Node* SPShape::write(Inkscape::XML::Document *xml_doc, Inkscape:: } void SPShape::update(SPCtx* ctx, guint flags) { + // std::cout << "SPShape::update(): " << (getId()?getId():"null") << std::endl; SPLPEItem::update(ctx, flags); /* This stanza checks that an object's marker style agrees with @@ -146,10 +147,13 @@ void SPShape::update(SPCtx* ctx, guint flags) { for (SPItemView *v = ((SPItem *) (this))->display; v != NULL; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast(v->arenaitem); if (hasMarkers()) { - sh->setStyle(this->style, this->style); - sh->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. - } else { - sh->setStyle(this->style, this->parent->style); + this->context_style = this->style; + sh->setStyle(this->style, this->context_style); + // Done at end: + // sh->setChildrenStyle(this->context_style); //Resolve 'context-xxx' in children. + } else if (this->parent) { + this->context_style = this->parent->context_style; + sh->setStyle(this->style, this->context_style); } } } @@ -188,6 +192,13 @@ void SPShape::update(SPCtx* ctx, guint flags) { for (SPItemView *v = this->display; v != NULL; v = v->next) { sp_shape_update_marker_view (this, v->arenaitem); } + + // Marker selector needs this here or marker previews are not rendered. + for (SPItemView *v = this->display; v != NULL; v = v->next) { + Inkscape::DrawingShape *sh = dynamic_cast(v->arenaitem); + + sh->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children. + } } } @@ -388,16 +399,22 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) } void SPShape::modified(unsigned int flags) { + // std::cout << "SPShape::modified(): " << (getId()?getId():"null") << std::endl; SPLPEItem::modified(flags); if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast(v->arenaitem); if (hasMarkers()) { - sh->setStyle(this->style, this->style); - sh->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. - } else { - sh->setStyle(this->style, this->parent->style); + this->context_style = this->style; + sh->setStyle(this->style, this->context_style); + // Note: marker selector preview does not trigger SP_OBJECT_STYLE_MODIFIED_FLAG so + // this is not called when marker previews are generated, however there is code in + // SPShape::update() that calls this routine so we don't worry about it here. + sh->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children. + } else if (this->parent) { + this->context_style = this->parent->context_style; + sh->setStyle(this->style, this->context_style); } } } @@ -729,6 +746,7 @@ void SPShape::print(SPPrintContext* ctx) { } Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/) { + // std::cout << "SPShape::show(): " << (getId()?getId():"null") << std::endl; Inkscape::DrawingShape *s = new Inkscape::DrawingShape(drawing); bool has_markers = this->hasMarkers(); @@ -761,10 +779,12 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /* /* Update marker views */ sp_shape_update_marker_view (this, s); - s->setStyle(this->style,this->style); - s->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children. - } else { - s->setStyle(this->style, this->parent->style); + this->context_style = this->style; + s->setStyle(this->style, this->context_style); + s->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children. + } else if (this->parent) { + this->context_style = this->parent->context_style; + s->setStyle(this->style, this->context_style); } return s; } diff --git a/src/sp-use.cpp b/src/sp-use.cpp index cadd6a16c..ba3f4a9d7 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -281,10 +281,12 @@ gchar* SPUse::description() const { Inkscape::DrawingItem* SPUse::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { + // std::cout << "SPUse::show: " << (getId()?getId():"null") << std::endl; Inkscape::DrawingGroup *ai = new Inkscape::DrawingGroup(drawing); ai->setPickChildren(false); - ai->setStyle(this->style, this->style); - + this->context_style = this->style; + ai->setStyle(this->style, this->context_style); + if (this->child) { Inkscape::DrawingItem *ac = this->child->invoke_show(drawing, key, flags); @@ -530,6 +532,7 @@ void SPUse::delete_self() { } void SPUse::update(SPCtx *ctx, unsigned flags) { + // std::cout << "SPUse::update: " << (getId()?getId():"null") << std::endl; SPItemCtx *ictx = (SPItemCtx *) ctx; SPItemCtx cctx = *ictx; @@ -580,7 +583,8 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); - g->setStyle(this->style, this->style); + this->context_style = this->style; + g->setStyle(this->style, this->context_style); } } @@ -593,6 +597,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { } void SPUse::modified(unsigned int flags) { + // std::cout << "SPUse::modified: " << (getId()?getId():"null") << std::endl; if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } @@ -602,7 +607,8 @@ void SPUse::modified(unsigned int flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); - g->setStyle(this->style, this->style); + this->context_style = this->style; + g->setStyle(this->style, this->context_style); } } diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp index d5b43d132..e273faad7 100644 --- a/src/widgets/stroke-marker-selector.cpp +++ b/src/widgets/stroke-marker-selector.cpp @@ -578,25 +578,25 @@ gboolean MarkerComboBox::separator_cb (GtkTreeModel *model, GtkTreeIter *iter, g */ SPDocument *MarkerComboBox::ink_markers_preview_doc () { -gchar const *buffer = "" +gchar const *buffer = "" " " " " -" " " " " " " " -" " " " " " " " -" " " " -- cgit v1.2.3 From 497b9890e0cb85fced32d6958b465d40212db482 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 24 Dec 2014 10:03:50 +0100 Subject: Remove sp_style_new_from_object() (bzr r13822.1.1) --- src/sp-object.cpp | 2 +- src/style.cpp | 18 ++---------------- src/style.h | 2 -- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 776b020d2..b0b482cf2 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -130,7 +130,7 @@ SPObject::SPObject() // vg, g, defs, desc, title, symbol, use, image, switch, path, rect, circle, ellipse, line, polyline, // polygon, text, tspan, tref, textPath, altGlyph, glyphRef, marker, linearGradient, radialGradient, // stop, pattern, clipPath, mask, filter, feImage, a, font, glyph, missing-glyph, foreignObject - this->style = sp_style_new_from_object(this); + this->style = new SPStyle( NULL, this ); // Is it necessary to call with "this"? this->context_style = NULL; } diff --git a/src/style.cpp b/src/style.cpp index a7e50b17a..464c402fa 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -476,7 +476,7 @@ SPStyle::clear() { // (this->*(i->second)).clear(); // } - // Release connection to object, created in sp_style_new_from_object() + // Release connection to object, created in constructor. release_connection.disconnect(); // href->detach() called in fill->clear()... @@ -899,7 +899,7 @@ SPStyle::write( guint const flags, SPStyle const *const base ) const { // Corresponds to sp_style_merge_from_parent() void SPStyle::cascade( SPStyle const *const parent ) { - // std::cout << "SPStyle::cascade" << std::endl; + // std::cout << "SPStyle::cascade: " << (object->getId()?object->getId():"null") << std::endl; for(std::vector::size_type i = 0; i != _properties.size(); ++i) { _properties[i]->cascade( parent->_properties[i] ); } @@ -1157,20 +1157,6 @@ sp_style_new(SPDocument *document) return style; } -// Called in: sp-object.cpp -/** - * Creates a new SPStyle object, and attaches it to the specified SPObject. - */ -SPStyle * -sp_style_new_from_object(SPObject *object) -{ - g_return_val_if_fail(object != NULL, NULL); - g_return_val_if_fail(SP_IS_OBJECT(object), NULL); - - SPStyle *const style = new SPStyle( NULL, object ); - return style; -} - // Called in display/drawing-item.cpp, display/nr-filter-primitive.cpp, libnrtype/Layout-TNG-Input.cpp /** * Increase refcount of style. diff --git a/src/style.h b/src/style.h index 1b1596458..5884f2459 100644 --- a/src/style.h +++ b/src/style.h @@ -284,8 +284,6 @@ public: SPStyle *sp_style_new(SPDocument *document); // SPStyle::SPStyle( SPDocument *document = NULL ); -SPStyle *sp_style_new_from_object(SPObject *object); // SPStyle::SPStyle( SPObject *object ); - SPStyle *sp_style_ref(SPStyle *style); // SPStyle::ref(); SPStyle *sp_style_unref(SPStyle *style); // SPStyle::unref(); -- cgit v1.2.3 From f4cfff3d186fd61221b3f771bf2794725e619ff7 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 24 Dec 2014 11:09:33 +0100 Subject: Add missing SPStyle::readFromPrefs(), remove sp_style_read_from_prefs(). (bzr r13822.1.2) --- src/libnrtype/font-lister.cpp | 19 +++--- src/style.cpp | 62 +++++++++---------- src/ui/dialog/text-edit.cpp | 31 +++++----- src/widgets/dash-selector.cpp | 12 ++-- src/widgets/text-toolbar.cpp | 139 +++++++++++++++++++----------------------- 5 files changed, 121 insertions(+), 142 deletions(-) diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index fad06cd00..a6ab3b239 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -385,27 +385,27 @@ std::pair FontLister::selection_update() #endif // Get fontspec from a selection, preferences, or thin air. Glib::ustring fontspec; - SPStyle *query = sp_style_new(SP_ACTIVE_DOCUMENT); + SPStyle query(SP_ACTIVE_DOCUMENT); // Directly from stored font specification. int result = - sp_desktop_query_style(SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION); + sp_desktop_query_style(SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION); //std::cout << " Attempting selected style" << std::endl; - if (result != QUERY_STYLE_NOTHING && query->font_specification.set) { - fontspec = query->font_specification.value; + if (result != QUERY_STYLE_NOTHING && query.font_specification.set) { + fontspec = query.font_specification.value; //std::cout << " fontspec from query :" << fontspec << ":" << std::endl; } // From style if (fontspec.empty()) { //std::cout << " Attempting desktop style" << std::endl; - int rfamily = sp_desktop_query_style(SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY); - int rstyle = sp_desktop_query_style(SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE); + int rfamily = sp_desktop_query_style(SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTFAMILY); + int rstyle = sp_desktop_query_style(SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTSTYLE); // Must have text in selection if (rfamily != QUERY_STYLE_NOTHING && rstyle != QUERY_STYLE_NOTHING) { - fontspec = fontspec_from_style(query); + fontspec = fontspec_from_style(&query); } //std::cout << " fontspec from style :" << fontspec << ":" << std::endl; } @@ -413,11 +413,10 @@ std::pair FontLister::selection_update() // From preferences if (fontspec.empty()) { //std::cout << " Attempting preferences" << std::endl; - sp_style_read_from_prefs(query, "/tools/text"); - fontspec = fontspec_from_style(query); + query.readFromPrefs("/tools/text"); + fontspec = fontspec_from_style(&query); //std::cout << " fontspec from prefs :" << fontspec << ":" << std::endl; } - sp_style_unref(query); // From thin air if (fontspec.empty()) { diff --git a/src/style.cpp b/src/style.cpp index 464c402fa..f677e4a76 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -591,6 +591,34 @@ SPStyle::readFromObject( SPObject *object ) { read( object, repr ); } +/** + * Read style properties from preferences. + * @param path Preferences directory from which the style should be read + */ +void +SPStyle::readFromPrefs(Glib::ustring const &path) { + + g_return_if_fail(!path.empty()); + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + // not optimal: we reconstruct the node based on the prefs, then pass it to + // sp_style_read for actual processing. + Inkscape::XML::SimpleDocument *tempdoc = new Inkscape::XML::SimpleDocument; + Inkscape::XML::Node *tempnode = tempdoc->createElement("prefs"); + + std::vector attrs = prefs->getAllEntries(path); + for (std::vector::iterator i = attrs.begin(); i != attrs.end(); ++i) { + tempnode->setAttribute(i->getEntryName().data(), i->getString().data()); + } + + read( NULL, tempnode ); + + Inkscape::GC::release(tempnode); + Inkscape::GC::release(tempdoc); + delete tempdoc; +} + // Matches sp_style_merge_property(SPStyle *style, gint id, gchar const *val) void SPStyle::readIfUnset( gint id, gchar const *val ) { @@ -1211,40 +1239,6 @@ sp_style_read_from_object(SPStyle *style, SPObject *object) style->read( object, repr ); } -// Called in: libnrtype/font-lister.cpp, widgets/dash-selector.cpp, widgets/text-toolbar.cpp, -// ui/dialog/text-edit.cpp -// Why is this called when draging a gradient handle? -/** - * Read style properties from preferences. - * @param style The style to write to - * @param path Preferences directory from which the style should be read - */ -void -sp_style_read_from_prefs(SPStyle *style, Glib::ustring const &path) -{ - g_return_if_fail(style != NULL); - g_return_if_fail(path != ""); - - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - - // not optimal: we reconstruct the node based on the prefs, then pass it to - // sp_style_read for actual processing. - Inkscape::XML::SimpleDocument *tempdoc = new Inkscape::XML::SimpleDocument; - Inkscape::XML::Node *tempnode = tempdoc->createElement("prefs"); - - std::vector attrs = prefs->getAllEntries(path); - for (std::vector::iterator i = attrs.begin(); i != attrs.end(); ++i) { - tempnode->setAttribute(i->getEntryName().data(), i->getString().data()); - } - - style->read( NULL, tempnode ); - - Inkscape::GC::release(tempnode); - Inkscape::GC::release(tempdoc); - delete tempdoc; -} - - static CRSelEng * sp_repr_sel_eng() { diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 229e82af4..a8be8b543 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -325,18 +325,18 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) if (dostyle) { // create temporary style - SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT); + SPStyle query(SP_ACTIVE_DOCUMENT); // query style from desktop into it. This returns a result flag and fills query with the style of subselection, if any, or selection - //int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION); - int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY); - int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE); - int result_numbers = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + //int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION); + int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTFAMILY); + int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTSTYLE); + int result_numbers = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS); // If querying returned nothing, read the style from the text tool prefs (default style for new texts) // (Ok to not get a font specification - must just rely on the family and style in that case) if (result_family == QUERY_STYLE_NOTHING || result_style == QUERY_STYLE_NOTHING || result_numbers == QUERY_STYLE_NOTHING) { - sp_style_read_from_prefs(query, "/tools/text"); + query.readFromPrefs("/tools/text"); } // FIXME: process result_family/style == QUERY_STYLE_MULTIPLE_DIFFERENT by showing "Many" in the lists @@ -351,40 +351,39 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT); - double size = sp_style_css_size_px_to_units(query->font_size.computed, unit); + double size = sp_style_css_size_px_to_units(query.font_size.computed, unit); sp_font_selector_set_fontspec(fsel, fontspec, size ); setPreviewText (fontspec, phrase); - if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_START) { - if (query->text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY) { + if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_START) { + if (query.text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY) { align_justify.set_active(); } else { align_left.set_active(); } - } else if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) { + } else if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) { align_center.set_active(); } else { align_right.set_active(); } - if (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB) { + if (query.writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB) { text_horizontal.set_active(); } else { text_vertical.set_active(); } double height; - if (query->line_height.normal) height = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL; - else if (query->line_height.unit == SP_CSS_UNIT_PERCENT) - height = query->line_height.value; - else height = query->line_height.computed; + if (query.line_height.normal) height = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL; + else if (query.line_height.unit == SP_CSS_UNIT_PERCENT) + height = query.line_height.value; + else height = query.line_height.computed; gchar *sstr = g_strdup_printf ("%d%%", (int) floor(height * 100 + 0.5)); gtk_entry_set_text ((GtkEntry *) gtk_bin_get_child ((GtkBin *) spacing_combo), sstr); g_free(sstr); - sp_style_unref(query); } blocked = false; } diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp index 479895022..9d591d33d 100644 --- a/src/widgets/dash-selector.cpp +++ b/src/widgets/dash-selector.cpp @@ -118,18 +118,18 @@ void SPDashSelector::init_dashes() { int pos = 0; if (!dash_prefs.empty()) { - SPStyle *style = sp_style_new (NULL); + SPStyle style; dashes = g_new (double *, dash_prefs.size() + 2); // +1 for custom slot, +1 for terminator slot for (std::vector::iterator i = dash_prefs.begin(); i != dash_prefs.end(); ++i) { - sp_style_read_from_prefs(style, *i); + style.readFromPrefs( *i ); - if (!style->stroke_dasharray.values.empty()) { - dashes[pos] = g_new (double, style->stroke_dasharray.values.size() + 1); + if (!style.stroke_dasharray.values.empty()) { + dashes[pos] = g_new (double, style.stroke_dasharray.values.size() + 1); double *d = dashes[pos]; unsigned i = 0; - for (; i < style->stroke_dasharray.values.size(); i++) { - d[i] = style->stroke_dasharray.values[i]; + for (; i < style.stroke_dasharray.values.size(); i++) { + d[i] = style.stroke_dasharray.values[i]; } d[i] = -1; } else { diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index d113d5c28..3d2e6eef8 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -220,9 +220,9 @@ static void sp_text_fontsize_value_changed( Ink_ComboBoxEntry_Action *act, GObje sp_desktop_set_style (desktop, css, true, true); // If no selected objects, set default. - SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT); + SPStyle query(SP_ACTIVE_DOCUMENT); int result_numbers = - sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS); if (result_numbers == QUERY_STYLE_NOTHING) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -233,8 +233,6 @@ static void sp_text_fontsize_value_changed( Ink_ComboBoxEntry_Action *act, GObje _("Text: Change font size")); } - sp_style_unref(query); - sp_repr_css_attr_unref (css); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -292,8 +290,8 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl ) #endif // Query baseline - SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT); - int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_BASELINES); + SPStyle query(SP_ACTIVE_DOCUMENT); + int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_BASELINES); bool setSuper = false; bool setSub = false; @@ -307,14 +305,14 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl ) } } else { // Superscript - gboolean superscriptSet = (query->baseline_shift.set && - query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && - query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER ); + gboolean superscriptSet = (query.baseline_shift.set && + query.baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && + query.baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER ); // Subscript - gboolean subscriptSet = (query->baseline_shift.set && - query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && - query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB ); + gboolean subscriptSet = (query.baseline_shift.set && + query.baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && + query.baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB ); setSuper = !superscriptSet && prop == 0; setSub = !subscriptSet && prop == 1; @@ -473,10 +471,9 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl ) } } - SPStyle *query = - sp_style_new (SP_ACTIVE_DOCUMENT); + SPStyle query(SP_ACTIVE_DOCUMENT); int result_numbers = - sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS); // If querying returned nothing, update default style. if (result_numbers == QUERY_STYLE_NOTHING) @@ -485,8 +482,6 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl ) prefs->mergeStyle("/tools/text/style", css); } - sp_style_unref(query); - sp_desktop_set_style (desktop, css, true, true); if (result_numbers != QUERY_STYLE_NOTHING) { @@ -538,15 +533,14 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) } // If no selected objects, set default. - SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT); + SPStyle query(SP_ACTIVE_DOCUMENT); int result_numbers = - sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS); if (result_numbers == QUERY_STYLE_NOTHING) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->mergeStyle("/tools/text/style", css); } - sp_style_unref(query); sp_repr_css_attr_unref (css); @@ -573,9 +567,9 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl sp_desktop_set_style (desktop, css, true, false); // If no selected objects, set default. - SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT); + SPStyle query(SP_ACTIVE_DOCUMENT); int result_numbers = - sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS); if (result_numbers == QUERY_STYLE_NOTHING) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -585,7 +579,6 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:word-spacing", SP_VERB_NONE, _("Text: Change word-spacing")); } - sp_style_unref(query); sp_repr_css_attr_unref (css); @@ -612,9 +605,9 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb sp_desktop_set_style (desktop, css, true, false); // If no selected objects, set default. - SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT); + SPStyle query(SP_ACTIVE_DOCUMENT); int result_numbers = - sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS); if (result_numbers == QUERY_STYLE_NOTHING) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -627,8 +620,6 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb _("Text: Change letter-spacing")); } - sp_style_unref(query); - sp_repr_css_attr_unref (css); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -765,10 +756,9 @@ static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject * } } - SPStyle *query = - sp_style_new (SP_ACTIVE_DOCUMENT); + SPStyle query(SP_ACTIVE_DOCUMENT); int result_numbers = - sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS); // If querying returned nothing, update default style. if (result_numbers == QUERY_STYLE_NOTHING) @@ -892,11 +882,11 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ * Numbers (font-size, letter-spacing, word-spacing, line-height, text-anchor, writing-mode) * Font specification (Inkscape private attribute) */ - SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT); - int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY); - int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE); - int result_numbers = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); - int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_BASELINES); + SPStyle query(SP_ACTIVE_DOCUMENT); + int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTFAMILY); + int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTSTYLE); + int result_numbers = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_BASELINES); /* * If no text in selection (querying returned nothing), read the style from @@ -905,14 +895,13 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ */ if (result_family == QUERY_STYLE_NOTHING || result_style == QUERY_STYLE_NOTHING || result_numbers == QUERY_STYLE_NOTHING) { // There are no texts in selection, read from preferences. - sp_style_read_from_prefs(query, "/tools/text"); + query.readFromPrefs("/tools/text"); #ifdef DEBUG_TEXT std::cout << " read style from prefs:" << std::endl; - sp_print_font( query ); + sp_print_font( &query ); #endif if (g_object_get_data(tbl, "text_style_from_prefs")) { // Do not reset the toolbar style from prefs if we already did it last time - sp_style_unref(query); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); #ifdef DEBUG_TEXT std::cout << " text_style_from_prefs: toolbar already set" << std:: endl; @@ -937,7 +926,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Size (average of text selected) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT); - double size = sp_style_css_size_px_to_units(query->font_size.computed, unit); + double size = sp_style_css_size_px_to_units(query.font_size.computed, unit); //gchar size_text[G_ASCII_DTOSTR_BUF_SIZE]; //g_ascii_dtostr (size_text, sizeof (size_text), size); @@ -961,9 +950,9 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Superscript gboolean superscriptSet = ((result_baseline == QUERY_STYLE_SINGLE || result_baseline == QUERY_STYLE_MULTIPLE_SAME ) && - query->baseline_shift.set && - query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && - query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER ); + query.baseline_shift.set && + query.baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && + query.baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER ); InkToggleAction* textSuperscriptAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextSuperscriptAction" ) ); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textSuperscriptAction), superscriptSet ); @@ -972,9 +961,9 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Subscript gboolean subscriptSet = ((result_baseline == QUERY_STYLE_SINGLE || result_baseline == QUERY_STYLE_MULTIPLE_SAME ) && - query->baseline_shift.set && - query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && - query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB ); + query.baseline_shift.set && + query.baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && + query.baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB ); InkToggleAction* textSubscriptAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextSubscriptAction" ) ); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textSubscriptAction), subscriptSet ); @@ -1001,26 +990,26 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // ege_select_one_action_set_sensitive( textAlignAction, 3, isFlow ); int activeButton = 0; - if (query->text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY) + if (query.text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY) { activeButton = 3; } else { - if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_START) activeButton = 0; - if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) activeButton = 1; - if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_END) activeButton = 2; + if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_START) activeButton = 0; + if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) activeButton = 1; + if (query.text_anchor.computed == SP_CSS_TEXT_ANCHOR_END) activeButton = 2; } ege_select_one_action_set_active( textAlignAction, activeButton ); // Line height (spacing) double height; - if (query->line_height.normal) { + if (query.line_height.normal) { height = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL; } else { - if (query->line_height.unit == SP_CSS_UNIT_PERCENT) { - height = query->line_height.value; + if (query.line_height.unit == SP_CSS_UNIT_PERCENT) { + height = query.line_height.value; } else { - height = query->line_height.computed; + height = query.line_height.computed; } } @@ -1032,8 +1021,8 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Word spacing double wordSpacing; - if (query->word_spacing.normal) wordSpacing = 0.0; - else wordSpacing = query->word_spacing.computed; // Assume no units (change in desktop-style.cpp) + if (query.word_spacing.normal) wordSpacing = 0.0; + else wordSpacing = query.word_spacing.computed; // Assume no units (change in desktop-style.cpp) GtkAction* wordSpacingAction = GTK_ACTION( g_object_get_data( tbl, "TextWordSpacingAction" ) ); GtkAdjustment *wordSpacingAdjustment = @@ -1043,8 +1032,8 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Letter spacing double letterSpacing; - if (query->letter_spacing.normal) letterSpacing = 0.0; - else letterSpacing = query->letter_spacing.computed; // Assume no units (change in desktop-style.cpp) + if (query.letter_spacing.normal) letterSpacing = 0.0; + else letterSpacing = query.letter_spacing.computed; // Assume no units (change in desktop-style.cpp) GtkAction* letterSpacingAction = GTK_ACTION( g_object_get_data( tbl, "TextLetterSpacingAction" ) ); GtkAdjustment *letterSpacingAdjustment = @@ -1053,7 +1042,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Orientation - int activeButton2 = (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB ? 0 : 1); + int activeButton2 = (query.writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB ? 0 : 1); EgeSelectOneAction* textOrientationAction = EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextOrientationAction" ) ); @@ -1064,27 +1053,25 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ #ifdef DEBUG_TEXT std::cout << " GUI: fontfamily.value: " - << (query->font_family.value ? query->font_family.value : "No value") + << (query.font_family.value ? query.font_family.value : "No value") << std::endl; - std::cout << " GUI: font_size.computed: " << query->font_size.computed << std::endl; - std::cout << " GUI: font_weight.computed: " << query->font_weight.computed << std::endl; - std::cout << " GUI: font_style.computed: " << query->font_style.computed << std::endl; - std::cout << " GUI: text_anchor.computed: " << query->text_anchor.computed << std::endl; - std::cout << " GUI: text_align.computed: " << query->text_align.computed << std::endl; - std::cout << " GUI: line_height.computed: " << query->line_height.computed - << " line_height.value: " << query->line_height.value - << " line_height.unit: " << query->line_height.unit << std::endl; - std::cout << " GUI: word_spacing.computed: " << query->word_spacing.computed - << " word_spacing.value: " << query->word_spacing.value - << " word_spacing.unit: " << query->word_spacing.unit << std::endl; - std::cout << " GUI: letter_spacing.computed: " << query->letter_spacing.computed - << " letter_spacing.value: " << query->letter_spacing.value - << " letter_spacing.unit: " << query->letter_spacing.unit << std::endl; - std::cout << " GUI: writing_mode.computed: " << query->writing_mode.computed << std::endl; + std::cout << " GUI: font_size.computed: " << query.font_size.computed << std::endl; + std::cout << " GUI: font_weight.computed: " << query.font_weight.computed << std::endl; + std::cout << " GUI: font_style.computed: " << query.font_style.computed << std::endl; + std::cout << " GUI: text_anchor.computed: " << query.text_anchor.computed << std::endl; + std::cout << " GUI: text_align.computed: " << query.text_align.computed << std::endl; + std::cout << " GUI: line_height.computed: " << query.line_height.computed + << " line_height.value: " << query.line_height.value + << " line_height.unit: " << query.line_height.unit << std::endl; + std::cout << " GUI: word_spacing.computed: " << query.word_spacing.computed + << " word_spacing.value: " << query.word_spacing.value + << " word_spacing.unit: " << query.word_spacing.unit << std::endl; + std::cout << " GUI: letter_spacing.computed: " << query.letter_spacing.computed + << " letter_spacing.value: " << query.letter_spacing.value + << " letter_spacing.unit: " << query.letter_spacing.unit << std::endl; + std::cout << " GUI: writing_mode.computed: " << query.writing_mode.computed << std::endl; #endif - sp_style_unref(query); - // Kerning (xshift), yshift, rotation. NB: These are not CSS attributes. if( SP_IS_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context) ) { Inkscape::UI::Tools::TextTool *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); -- cgit v1.2.3 From c10ae6598c095b0273672f764f0fe0e684c94b87 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 24 Dec 2014 11:27:30 +0100 Subject: Remove sp_style_read_from_object() (bzr r13822.1.3) --- src/sp-clippath.cpp | 2 +- src/sp-hatch-path.cpp | 2 +- src/sp-hatch.cpp | 2 +- src/sp-item.cpp | 2 +- src/sp-object.cpp | 2 +- src/sp-solid-color.cpp | 2 +- src/sp-style-elem.cpp | 13 +++++++------ src/style.cpp | 32 +++++++------------------------- 8 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index 8e2e7d7a6..5065f25c3 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -103,7 +103,7 @@ void SPClipPath::set(unsigned int key, const gchar* value) { break; default: if (SP_ATTRIBUTE_IS_CSS(key)) { - sp_style_read_from_object(this->style, this); + this->style->readFromObject( this ); this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPObjectGroup::set(key, value); diff --git a/src/sp-hatch-path.cpp b/src/sp-hatch-path.cpp index 8558b67f2..bc95c246e 100644 --- a/src/sp-hatch-path.cpp +++ b/src/sp-hatch-path.cpp @@ -128,7 +128,7 @@ void SPHatchPath::set(unsigned int key, const gchar* value) default: if (SP_ATTRIBUTE_IS_CSS(key)) { - sp_style_read_from_object(style, this); + style->readFromObject( this ); requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPObject::set(key, value); diff --git a/src/sp-hatch.cpp b/src/sp-hatch.cpp index 4a8707e08..dfecb2250 100644 --- a/src/sp-hatch.cpp +++ b/src/sp-hatch.cpp @@ -238,7 +238,7 @@ void SPHatch::set(unsigned int key, const gchar* value) default: if (SP_ATTRIBUTE_IS_CSS(key)) { - sp_style_read_from_object(style, this); + style->readFromObject( this ); requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPPaintServer::set(key, value); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index dbb0380ea..fbb76e971 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -555,7 +555,7 @@ void SPItem::set(unsigned int key, gchar const* value) { } default: if (SP_ATTRIBUTE_IS_CSS(key)) { - sp_style_read_from_object(object->style, object); + style->readFromObject( this ); object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPObject::set(key, value); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index b0b482cf2..124471545 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -915,7 +915,7 @@ void SPObject::set(unsigned int key, gchar const* value) { object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); break; case SP_ATTR_STYLE: - sp_style_read_from_object(object->style, object); + object->style->readFromObject( object ); object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); break; default: diff --git a/src/sp-solid-color.cpp b/src/sp-solid-color.cpp index 0d6b96b62..72569d8c0 100644 --- a/src/sp-solid-color.cpp +++ b/src/sp-solid-color.cpp @@ -53,7 +53,7 @@ void SPSolidColor::build(SPDocument* doc, Inkscape::XML::Node* repr) { void SPSolidColor::set(unsigned int key, const gchar* value) { if (SP_ATTRIBUTE_IS_CSS(key)) { - sp_style_read_from_object(this->style, this); + style->readFromObject( this ); this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPPaintServer::set(key, value); diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index da17b08d9..668780272 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -319,13 +319,14 @@ void SPStyleElem::read_content() { //requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); // Style references via class= do not, and actually cannot, use autoupdating URIReferences. - // Therefore, if an object refers to a stylesheet which has not yet loaded when the object is being loaded - // (e.g. if the stylesheet is below or inside the object in XML), its class= has no effect (bug 1491639). - // Below is a partial hack that fixes this for a single case: when the not used." -msgstr "" +msgstr "Transformatiematrix is singulair, niet gebruikt." #: ../src/ui/dialog/transformation.cpp:1012 msgid "Edit transformation matrix" @@ -23483,11 +23483,11 @@ msgstr "Standaardmesh maken" #: ../src/ui/tools/mesh-tool.cpp:718 msgid "FIXMECtrl: snap mesh angle" -msgstr "" +msgstr "Ctrl: kleefhoek mesh" #: ../src/ui/tools/mesh-tool.cpp:719 msgid "FIXMEShift: draw mesh around the starting point" -msgstr "" +msgstr "Shift: mesh rond het beginpunt tekenen" #: ../src/ui/tools/node-tool.cpp:612 msgctxt "Node tool tip" @@ -24932,7 +24932,7 @@ msgstr "Tag" #: ../src/verbs.cpp:252 msgid "Context" -msgstr "" +msgstr "Context" #: ../src/verbs.cpp:271 ../src/verbs.cpp:2306 #: ../share/extensions/jessyInk_view.inx.h:1 @@ -27057,8 +27057,7 @@ msgstr "Afdrukkleuren..." msgid "" "Select which color separations to render in Print Colors Preview rendermode" msgstr "" -"Selecteer welke kleuren gerenderd worden in de weergavemodus Afdrukvoorbeeld " -"kleuren" +"Selecteer welke kleuren gerenderd worden in de weergavemodus Afdrukvoorbeeld" #: ../src/verbs.cpp:2956 msgid "_Export PNG Image..." @@ -27835,11 +27834,11 @@ msgstr ", grijstinten" #: ../src/widgets/desktop-widget.cpp:830 msgid "print colors preview" -msgstr "" +msgstr "afdrukvoorbeeld" #: ../src/widgets/desktop-widget.cpp:831 msgid ", print colors preview" -msgstr "" +msgstr ", afdrukvoorbeeld" #: ../src/widgets/desktop-widget.cpp:832 msgid "outline" @@ -29805,7 +29804,7 @@ msgstr "Selecteer lettertypefamilie (Alt+X voor dialoog)" #. Enable entry completion #: ../src/widgets/text-toolbar.cpp:1234 msgid "Select all text with this font-family" -msgstr "" +msgstr "Alle teskt met deze font-family selecteren" #: ../src/widgets/text-toolbar.cpp:1238 msgid "Font not found on system" @@ -30423,6 +30422,8 @@ msgid "" "%d ENTITIES of type POLYLINE encountered and ignored. Please try to convert " "to Release 13 format using QCad." msgstr "" +"%d ENTITIES van het type POLYLINE tegengekomen en genegeerd. Tracht aub. te " +"converteren naar Release 13-formaat met QCad." #: ../share/extensions/dxf_outlines.py:49 msgid "" @@ -30437,6 +30438,8 @@ msgid "" "Error: Field 'Layer match name' must be filled when using 'By name match' " "option" msgstr "" +"Fout: veld 'Naamovereenkomst laag' moet ingevuld worden bij gebruik van de " +"optie 'Overeenkosmt naam'" #: ../share/extensions/dxf_outlines.py:341 #, python-format @@ -30491,10 +30494,13 @@ msgstr "Tenminste twee geselecteerde paden nodig" #: ../share/extensions/funcplot.py:48 msgid "x-interval cannot be zero. Please modify 'Start X' or 'End X'" msgstr "" +"x-interval kan niet nul zijn. Pas aub 'x-beginwaarde' of 'x-eindwaarde' aan" #: ../share/extensions/funcplot.py:60 msgid "y-interval cannot be zero. Please modify 'Y top' or 'Y bottom'" msgstr "" +"y-interval kan niet nul zijn. Pas aub. 'y-waarde onderzijde rechthoek' of 'y-" +"waarde bovenzijde rechthoek' aan" #: ../share/extensions/funcplot.py:315 msgid "Please select a rectangle" @@ -30769,6 +30775,8 @@ msgid "" "Failed to import the subprocess module. Please report this as a bug at: " "https://bugs.launchpad.net/inkscape." msgstr "" +"Importeren van subprocesmodule gefaald. Rapporteer aub. deze bug op: https://" +"bugs.launchpad.net/inkscape." #: ../share/extensions/generate_voronoi.py:36 msgid "Python version is: " @@ -30796,7 +30804,7 @@ msgstr "De versneden bitmaps werden bewaard als:" #: ../share/extensions/hpgl_decoder.py:43 msgid "Movements" -msgstr "" +msgstr "Bewegingen" #: ../share/extensions/hpgl_decoder.py:44 msgid "Pen #" @@ -30878,6 +30886,11 @@ msgid "" "update the JessyInk script.\n" "\n" msgstr "" +"Het JessyInk-script is niet in deze SVG geladen of heeft een andere versie " +"dan de JessyInk-uitbreidingen. Selecteer aub. \"Installeren/updaten\" van " +"het \"JessyInk\"-submenu van het menu \"Uitbreidingen\" om het JessyInk-" +"script te installeren of updaten.\n" +"\n" #: ../share/extensions/jessyInk_autoTexts.py:48 msgid "" @@ -31065,10 +31078,10 @@ msgid "" "extension. Please install them and try again. On a Debian-like system this " "can be done with the command, sudo apt-get install python-numpy." msgstr "" -"Laden van de numpy modules mislukt. Deze modules zijn nodig " -"voor deze uitbreiding. Installeer deze alstublief en probeer opnieuw. Op een " -"Debian-gebaseerd systeem kan dit gedaan worden met het commando, sudo apt-" -"get install python-numpy." +"Laden van de numpy modules mislukt. Deze modules zijn nodig voor deze " +"uitbreiding. Installeer deze alstublief en probeer opnieuw. Op een Debian-" +"gebaseerd systeem kan dit gedaan worden met het commando, sudo apt-get " +"install python-numpy." #: ../share/extensions/measure.py:112 msgid "Area is zero, cannot calculate Center of Mass" @@ -31375,7 +31388,7 @@ msgstr "Je moet ImageMagick installeren voor JPG en GIF." #. lines of longitude are odd : abort #: ../share/extensions/wireframe_sphere.py:116 msgid "Please enter an even number of lines of longitude." -msgstr "" +msgstr "Geef aub. een even aantal lijnen in." #. vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 #: ../share/extensions/addnodes.inx.h:1 @@ -31539,7 +31552,8 @@ msgid "" " * Random Hue/Saturation/Lightness: randomize the parameter's value.\n" " " msgstr "" -"Past tint, verzadiging en lichtheid in de TVL-vertegenwoordiging van de kleur van de geselecteerde objecten.\n" +"Past tint, verzadiging en lichtheid in de TVL-vertegenwoordiging van de " +"kleur van de geselecteerde objecten.\n" "Opties:\n" " * Tint: draaien met ... graden (telt door).\n" " * Verzadiging: % toevoegen/aftrekken (min=-100, max=100).\n" @@ -31547,7 +31561,6 @@ msgstr "" " * Random tint/verzadiging/lichtheid: de parameterwaarde randomiseren.\n" " " - #: ../share/extensions/color_blackandwhite.inx.h:1 msgid "Black and White" msgstr "Zwart en wit" @@ -32084,11 +32097,11 @@ msgstr "Karakterencodering" #: ../share/extensions/dxf_outlines.inx.h:7 msgid "Layer export selection" -msgstr "" +msgstr "Te exporteren lagen" #: ../share/extensions/dxf_outlines.inx.h:8 msgid "Layer match name" -msgstr "" +msgstr "Naamovereenkomst laag" #: ../share/extensions/dxf_outlines.inx.h:9 msgid "pt" @@ -32165,7 +32178,7 @@ msgstr "Alleen zichtbaar" #: ../share/extensions/dxf_outlines.inx.h:23 msgid "By name match" -msgstr "" +msgstr "Overeenkomst naam" #: ../share/extensions/dxf_outlines.inx.h:25 #, fuzzy @@ -32491,11 +32504,11 @@ msgstr "X-interval vermenigvuldigen met 2*pi" #: ../share/extensions/funcplot.inx.h:6 msgid "Y value of rectangle's bottom:" -msgstr "Y-waarde van onderzijde rechthoek:" +msgstr "Y-waarde onderzijde rechthoek:" #: ../share/extensions/funcplot.inx.h:7 msgid "Y value of rectangle's top:" -msgstr "Y-waarde van bovenzijde rechthoek:" +msgstr "Y-waarde bovenzijde rechthoek:" #: ../share/extensions/funcplot.inx.h:8 msgid "Number of samples:" @@ -33221,7 +33234,7 @@ msgstr "Rand object" #: ../share/extensions/gcodetools_lathe.inx.h:10 msgid "Lathe modify path" -msgstr "" +msgstr "Pad aanpassen" #: ../share/extensions/gcodetools_lathe.inx.h:11 msgid "" @@ -33665,7 +33678,7 @@ msgstr "Gouden ratio" #: ../share/extensions/guides_creator.inx.h:10 msgid "Rule-of-third" -msgstr "" +msgstr "Regel van derden" #: ../share/extensions/guides_creator.inx.h:11 msgid "Diagonal guides" @@ -34077,12 +34090,12 @@ msgstr "" #: ../share/extensions/hpgl_output.inx.h:22 #: ../share/extensions/plotter.inx.h:41 msgid "Plot Features " -msgstr "V" +msgstr "Functionaliteit plotter" #: ../share/extensions/hpgl_output.inx.h:23 #: ../share/extensions/plotter.inx.h:42 msgid "Overcut (mm):" -msgstr "" +msgstr "Oversnijden (mm):" #: ../share/extensions/hpgl_output.inx.h:24 #: ../share/extensions/plotter.inx.h:43 @@ -34110,7 +34123,7 @@ msgstr "" #: ../share/extensions/hpgl_output.inx.h:27 #: ../share/extensions/plotter.inx.h:46 msgid "Use precut" -msgstr "" +msgstr "Voorsnijden gebruiken" #: ../share/extensions/hpgl_output.inx.h:28 #: ../share/extensions/plotter.inx.h:47 @@ -34118,6 +34131,8 @@ msgid "" "Check this to cut a small line before the real drawing starts to correctly " "align the tool orientation. (Default: Checked)" msgstr "" +"Selecteer deze om een smalle lijn te snijden voor de echte afbeelding begint " +"om het gereedschap correct te alineëren. (standaard: aangevinkt)" #: ../share/extensions/hpgl_output.inx.h:29 #: ../share/extensions/plotter.inx.h:48 @@ -34145,6 +34160,10 @@ msgid "" "if used). If unchecked you have to make sure that all parts of your drawing " "are within the document border! (Default: Checked)" msgstr "" +"Vink dit aan om de tekening automatisch rond het nulpunt uit te lijnen " +"(inclusief de offset van het gereedschap). Indien uitgevinkt moet je zeker " +"zijn dat alle delen van de tekening zich binnen de documentrand bevinden! " +"(Standaard: aangevinkt)" #: ../share/extensions/hpgl_output.inx.h:33 #: ../share/extensions/plotter.inx.h:54 @@ -34844,7 +34863,7 @@ msgstr "Typografie" #: ../share/extensions/layout_nup.inx.h:1 msgid "N-up layout" -msgstr "" +msgstr "Multikader layout" #: ../share/extensions/layout_nup.inx.h:2 msgid "Page dimensions" @@ -35190,11 +35209,12 @@ msgid "" "Bezier curves. If a circle is used, the area may be too high by as much as " "0.03%." msgstr "" -"Dit effect meet de lengte, oppervlakte of middelpunt van de geselecteerde paden. " -"Lengte en oppervlak worden toegevoegd als tekstobject in de geselecteerde eenheid. Middelpunt wordt toegevoegd als een kruis.\n" +"Dit effect meet de lengte, oppervlakte of middelpunt van de geselecteerde " +"paden. Lengte en oppervlak worden toegevoegd als tekstobject in de " +"geselecteerde eenheid. Middelpunt wordt toegevoegd als een kruis.\n" "\n" -" * Tekstweergave kan als tekst-op-pad of alleenstaande tekst in een specifieke " -"hoek.\n" +" * Tekstweergave kan als tekst-op-pad of alleenstaande tekst in een " +"specifieke hoek.\n" " * Het aantal significante cijfers kan ingesteld worden met het " "Precisieveld.\n" " * Het Afstandsveld bepaalt de afstand van de tekst tot het pad.\n" @@ -35214,7 +35234,11 @@ msgid "" "attributes will create a new class, this class will replace the existing " "inline style attributes. Please use a name which best describes the kinds of " "objects and their common context for best effect." -msgstr "Alle geselecteerde knopen worden gegroepeerd en met hun gemeenschappelijke kenmerken wordt een nieuwe klasse gemaakt die de bestaande inline stijlkenmerken vervangt. Gebruik aub een naam die het beste deze objecten en hun gemeenschappelijke context beschrijft voor het beste effect." +msgstr "" +"Alle geselecteerde knopen worden gegroepeerd en met hun gemeenschappelijke " +"kenmerken wordt een nieuwe klasse gemaakt die de bestaande inline " +"stijlkenmerken vervangt. Gebruik aub een naam die het beste deze objecten en " +"hun gemeenschappelijke context beschrijft voor het beste effect." #: ../share/extensions/merge_styles.inx.h:3 msgid "New Class Name:" @@ -35494,12 +35518,13 @@ msgstr "" #: ../share/extensions/plotter.inx.h:1 msgid "Plot" -msgstr "" +msgstr "Plotten" #: ../share/extensions/plotter.inx.h:2 msgid "" "Please make sure that all objects you want to plot are converted to paths." msgstr "" +"Zorg er aub. voor dat alle objecten die je wil plotten omgezet zijn in paden." #: ../share/extensions/plotter.inx.h:3 msgid "Connection Settings " @@ -35514,6 +35539,8 @@ msgid "" "The port of your serial connection, on Windows something like 'COM1', on " "Linux something like: '/dev/ttyUSB0' (Default: COM1)" msgstr "" +"De poort van je seriële verbinding, op Windows zoals 'COM1', op Linux zoals " +"'/dev/ttyUSB0' (Standaard: COM1)" #: ../share/extensions/plotter.inx.h:6 msgid "Serial baud rate:" @@ -35525,15 +35552,15 @@ msgstr "De Baud rate van je seriële verbinding (Standaard: 9600)" #: ../share/extensions/plotter.inx.h:8 msgid "Flow control:" -msgstr "" +msgstr "Controle gegevensstroom:" #: ../share/extensions/plotter.inx.h:9 msgid "" "The Software / Hardware flow control of your serial connection (Default: " "Software)" msgstr "" -"De software / hardware controle van je seriële verbinding. (Standaard: " -"software)" +"De software / hardware controle de gegevensstroom van je seriële verbinding. " +"(Standaard: software)" #: ../share/extensions/plotter.inx.h:10 msgid "Command language:" @@ -35577,12 +35604,16 @@ msgid "" "Using wrong settings can under certain circumstances cause Inkscape to " "freeze. Always save your work before plotting!" msgstr "" +"Bij het gebruik van verkeerde instellingen kan Inkscape hangen. Bewaar " +"altijd je werk vooraleer te plotten!" #: ../share/extensions/plotter.inx.h:20 msgid "" "This can be a physical serial connection or a USB-to-Serial bridge. Ask your " "plotter manufacturer for drivers if needed." msgstr "" +"Dit kan een fysieke seriële connectie of een USB naar seriëel brug zijn. " +"Vraag de leverancier van de plotter naar drivers indien nodig." #: ../share/extensions/plotter.inx.h:21 msgid "Parallel (LPT) connections are not supported." @@ -35611,6 +35642,8 @@ msgid "" "Check this to get verbose information about the plot without actually " "sending something to the plotter (A.k.a. data dump) (Default: Unchecked)" msgstr "" +"Vink dit aan voor uitgebreide informatie over het plotten zonder iets naar " +"de plotter te sturen (aka data dump) (standaard: uitgevinkt)" #: ../share/extensions/plt_input.inx.h:1 msgid "AutoCAD Plot Input" -- cgit v1.2.3 From c34f45b08a02d74c94ac597aa131fb959f18e237 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sun, 28 Dec 2014 20:30:43 +0100 Subject: prevent possible usage of -1 array index (bzr r13826) --- src/box3d.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/box3d.cpp b/src/box3d.cpp index 6412a299f..86f99049b 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -47,16 +47,16 @@ static gint counter = 0; #include "sp-factory.h" namespace { - SPObject* createBox3D() { - return new SPBox3D(); - } + SPObject* createBox3D() { + return new SPBox3D(); + } - bool box3DRegistered = SPFactory::instance().registerObject("inkscape:box3d", createBox3D); + bool box3DRegistered = SPFactory::instance().registerObject("inkscape:box3d", createBox3D); } SPBox3D::SPBox3D() : SPGroup() { - this->my_counter = 0; - this->swapped = Box3D::NONE; + this->my_counter = 0; + this->swapped = Box3D::NONE; this->persp_href = NULL; this->persp_ref = new Persp3DReference(this); @@ -87,7 +87,7 @@ void SPBox3D::build(SPDocument *document, Inkscape::XML::Node *repr) { } void SPBox3D::release() { - SPBox3D* object = this; + SPBox3D* object = this; SPBox3D *box = object; if (box->persp_href) { @@ -125,7 +125,7 @@ void SPBox3D::release() { } void SPBox3D::set(unsigned int key, const gchar* value) { - SPBox3D* object = this; + SPBox3D* object = this; SPBox3D *box = object; switch (key) { @@ -210,7 +210,7 @@ void SPBox3D::update(SPCtx *ctx, guint flags) { } Inkscape::XML::Node* SPBox3D::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPBox3D* object = this; + SPBox3D* object = this; SPBox3D *box = object; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { @@ -912,9 +912,11 @@ box3d_swap_sides(int z_orders[6], Box3D::Axis axis) { } } - int tmp = z_orders[pos1]; - z_orders[pos1] = z_orders[pos2]; - z_orders[pos2] = tmp; + if (pos1 != -1){ + int tmp = z_orders[pos1]; + z_orders[pos1] = z_orders[pos2]; + z_orders[pos2] = tmp; + } } -- cgit v1.2.3 From bf7240d8d721c31c857819f57fc24be43f198bd9 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sun, 28 Dec 2014 20:38:28 +0100 Subject: static code analysis: initialisation (bzr r13827) --- src/extension/internal/pdfinput/svg-builder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 7a504add0..a3abb4045 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -91,9 +91,6 @@ SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref) _preferences = _xml_doc->createElement("svgbuilder:prefs"); _preferences->setAttribute("embedImages", "1"); _preferences->setAttribute("localFonts", "1"); - - _ttm[0] = 1; _ttm[1] = 0; _ttm[2] = 0; _ttm[3] = 1; _ttm[4] = 0; _ttm[5] = 0; - _ttm_is_set = false; } SvgBuilder::SvgBuilder(SvgBuilder *parent, Inkscape::XML::Node *root) { @@ -136,6 +133,9 @@ void SvgBuilder::_init() { initial_state.group_depth = 0; _state_stack.push_back(initial_state); _node_stack.push_back(_container); + + _ttm[0] = 1; _ttm[1] = 0; _ttm[2] = 0; _ttm[3] = 1; _ttm[4] = 0; _ttm[5] = 0; + _ttm_is_set = false; } void SvgBuilder::setDocumentSize(double width, double height) { -- cgit v1.2.3 From 9987267a71af9f69277ffc64ecae2498d3854bc4 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sun, 28 Dec 2014 20:50:52 +0100 Subject: UI messages typo (bzr r13828) --- share/extensions/seamless_pattern.inx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/extensions/seamless_pattern.inx b/share/extensions/seamless_pattern.inx index fe4098e05..f63872272 100644 --- a/share/extensions/seamless_pattern.inx +++ b/share/extensions/seamless_pattern.inx @@ -4,8 +4,8 @@ org.inkscape.render.seamless_pattern seamless_pattern.py inkex.py - 100 - 100 + 100 + 100 <_param name="help-info" type="description">This extension overwrite current document -- cgit v1.2.3 From 5363af388992d711d81fc695732675e1395407b7 Mon Sep 17 00:00:00 2001 From: mc <> Date: Wed, 31 Dec 2014 07:55:37 +0100 Subject: Fix for bug #758718 (Color Picker/Dropper: Color selection area not lined up with target in cursor) by Mc. Fixed bugs: - https://launchpad.net/bugs/758718 (bzr r13829) --- src/ui/tools/dropper-tool.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index 178e6636e..9038628ee 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -73,7 +73,7 @@ const std::string& DropperTool::getPrefsPath() { const std::string DropperTool::prefsPath = "/tools/dropper"; DropperTool::DropperTool() - : ToolBase(cursor_dropper_f_xpm, 7, 7) + : ToolBase(cursor_dropper_f_xpm, 5, 5) , R(0) , G(0) , B(0) @@ -83,8 +83,8 @@ DropperTool::DropperTool() , area(NULL) , centre(0, 0) { - cursor_dropper_fill = sp_cursor_new_from_xpm(cursor_dropper_f_xpm , 7, 7); - cursor_dropper_stroke = sp_cursor_new_from_xpm(cursor_dropper_s_xpm , 7, 7); + cursor_dropper_fill = sp_cursor_new_from_xpm(cursor_dropper_f_xpm , 5, 5); + cursor_dropper_stroke = sp_cursor_new_from_xpm(cursor_dropper_s_xpm , 5, 5); } DropperTool::~DropperTool() { -- cgit v1.2.3