summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2014-12-31 14:36:09 +0000
committer~suv <suv-sf@users.sourceforge.net>2014-12-31 14:36:09 +0000
commit02cb649c0ceebd254dde302eeba71406fb25a24c (patch)
tree4ccb52d7f06a7160adb2aaf1428d3a5a2acef9a5 /src
parentpackaging/macosx: update local python ports (MacPorts drops support for Pytho... (diff)
parentFix for bug #758718 (Color Picker/Dropper: Color selection area not lined up ... (diff)
downloadinkscape-02cb649c0ceebd254dde302eeba71406fb25a24c.tar.gz
inkscape-02cb649c0ceebd254dde302eeba71406fb25a24c.zip
update to trunk (r13829)
(bzr r13798.1.2)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile_insert1
-rw-r--r--src/box3d.cpp28
-rw-r--r--src/conn-avoid-ref.cpp6
-rw-r--r--src/desktop-events.cpp20
-rw-r--r--src/desktop-handles.cpp122
-rw-r--r--src/desktop-handles.h73
-rw-r--r--src/desktop-style.cpp9
-rw-r--r--src/desktop.cpp10
-rw-r--r--src/desktop.h3
-rw-r--r--src/display/canvas-axonomgrid.cpp2
-rw-r--r--src/display/canvas-grid.cpp6
-rw-r--r--src/display/drawing-group.cpp9
-rw-r--r--src/display/drawing-group.h4
-rw-r--r--src/display/drawing-image.cpp11
-rw-r--r--src/display/drawing-image.h2
-rw-r--r--src/display/drawing-item.cpp145
-rw-r--r--src/display/drawing-item.h13
-rw-r--r--src/display/drawing-pattern.h1
-rw-r--r--src/display/drawing-shape.cpp17
-rw-r--r--src/display/drawing-shape.h4
-rw-r--r--src/display/drawing-text.cpp20
-rw-r--r--src/display/drawing-text.h5
-rw-r--r--src/display/nr-filter-primitive.cpp10
-rw-r--r--src/display/nr-style.cpp82
-rw-r--r--src/display/nr-style.h3
-rw-r--r--src/display/snap-indicator.cpp12
-rw-r--r--src/extension/dbus/application-interface.cpp2
-rw-r--r--src/extension/dbus/document-interface.cpp2
-rw-r--r--src/extension/effect.cpp2
-rw-r--r--src/extension/execution-env.cpp6
-rw-r--r--src/extension/implementation/implementation.cpp6
-rw-r--r--src/extension/implementation/script.cpp4
-rw-r--r--src/extension/internal/bitmap/imagemagick.cpp6
-rw-r--r--src/extension/internal/grid.cpp6
-rw-r--r--src/extension/internal/pdfinput/svg-builder.cpp6
-rw-r--r--src/file.cpp14
-rw-r--r--src/gradient-chemistry.cpp13
-rw-r--r--src/gradient-drag.cpp21
-rw-r--r--src/helper/stock-items.cpp6
-rw-r--r--src/inkscape.cpp20
-rw-r--r--src/knot.cpp6
-rw-r--r--src/layer-manager.cpp4
-rw-r--r--src/libnrtype/Layout-TNG-Input.cpp2
-rw-r--r--src/libnrtype/font-lister.cpp19
-rw-r--r--src/line-geometry.cpp6
-rw-r--r--src/live_effects/parameter/originalpath.cpp4
-rw-r--r--src/live_effects/parameter/path.cpp4
-rw-r--r--src/live_effects/parameter/text.cpp3
-rw-r--r--src/main-cmdlineact.cpp1
-rw-r--r--src/path-chemistry.cpp64
-rw-r--r--src/persp3d.cpp9
-rw-r--r--src/rubberband.cpp6
-rw-r--r--src/satisfied-guide-cns.cpp4
-rw-r--r--src/selcue.cpp11
-rw-r--r--src/selection-chemistry.cpp185
-rw-r--r--src/seltrans.cpp34
-rw-r--r--src/sp-clippath.cpp2
-rw-r--r--src/sp-flowtext.cpp12
-rw-r--r--src/sp-guide.cpp6
-rw-r--r--src/sp-hatch-path.cpp2
-rw-r--r--src/sp-hatch.cpp2
-rw-r--r--src/sp-item-group.cpp22
-rw-r--r--src/sp-item.cpp4
-rw-r--r--src/sp-marker.cpp212
-rw-r--r--src/sp-marker.h13
-rw-r--r--src/sp-namedview.cpp18
-rw-r--r--src/sp-object.cpp57
-rw-r--r--src/sp-object.h7
-rw-r--r--src/sp-path.cpp2
-rw-r--r--src/sp-root.cpp9
-rw-r--r--src/sp-shape.cpp47
-rw-r--r--src/sp-solid-color.cpp2
-rw-r--r--src/sp-stop.cpp6
-rw-r--r--src/sp-style-elem.cpp13
-rw-r--r--src/sp-text.cpp10
-rw-r--r--src/sp-tref.cpp8
-rw-r--r--src/sp-use.cpp26
-rw-r--r--src/splivarot.cpp30
-rw-r--r--src/style-internal.cpp38
-rw-r--r--src/style-internal.h20
-rw-r--r--src/style-test.h123
-rw-r--r--src/style.cpp313
-rw-r--r--src/style.h31
-rw-r--r--src/text-chemistry.cpp60
-rw-r--r--src/text-editing.cpp39
-rw-r--r--src/trace/potrace/inkscape-potrace.cpp6
-rw-r--r--src/trace/trace.cpp14
-rw-r--r--src/ui/clipboard.cpp16
-rw-r--r--src/ui/dialog/align-and-distribute.cpp45
-rw-r--r--src/ui/dialog/clonetiler.cpp42
-rw-r--r--src/ui/dialog/color-item.cpp6
-rw-r--r--src/ui/dialog/dialog.cpp4
-rw-r--r--src/ui/dialog/document-metadata.cpp12
-rw-r--r--src/ui/dialog/document-properties.cpp52
-rw-r--r--src/ui/dialog/export.cpp55
-rw-r--r--src/ui/dialog/fill-and-stroke.cpp2
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp18
-rw-r--r--src/ui/dialog/find.cpp12
-rw-r--r--src/ui/dialog/font-substitution.cpp4
-rw-r--r--src/ui/dialog/glyphs.cpp9
-rw-r--r--src/ui/dialog/grid-arrange-tab.cpp8
-rw-r--r--src/ui/dialog/guides.cpp2
-rw-r--r--src/ui/dialog/icon-preview.cpp4
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp8
-rw-r--r--src/ui/dialog/layer-properties.cpp8
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp12
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.cpp2
-rw-r--r--src/ui/dialog/lpe-powerstroke-properties.cpp2
-rw-r--r--src/ui/dialog/object-attributes.cpp4
-rw-r--r--src/ui/dialog/object-properties.cpp12
-rw-r--r--src/ui/dialog/polar-arrange-tab.cpp6
-rw-r--r--src/ui/dialog/spellcheck.cpp8
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp39
-rw-r--r--src/ui/dialog/swatches.cpp28
-rw-r--r--src/ui/dialog/symbols.cpp4
-rw-r--r--src/ui/dialog/template-widget.cpp6
-rw-r--r--src/ui/dialog/text-edit.cpp47
-rw-r--r--src/ui/dialog/transformation.cpp31
-rw-r--r--src/ui/dialog/undo-history.cpp2
-rw-r--r--src/ui/dialog/xml-tree.cpp14
-rw-r--r--src/ui/draw-anchor.cpp3
-rw-r--r--src/ui/interface.cpp6
-rw-r--r--src/ui/object-edit.cpp2
-rw-r--r--src/ui/shape-editor.cpp4
-rw-r--r--src/ui/tool/control-point.cpp6
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp8
-rw-r--r--src/ui/tool/node.cpp2
-rw-r--r--src/ui/tool/path-manipulator.cpp10
-rw-r--r--src/ui/tool/selector.cpp6
-rw-r--r--src/ui/tool/transform-handle-set.cpp4
-rw-r--r--src/ui/tools-switch.cpp2
-rw-r--r--src/ui/tools/arc-tool.cpp16
-rw-r--r--src/ui/tools/box3d-tool.cpp20
-rw-r--r--src/ui/tools/calligraphic-tool.cpp24
-rw-r--r--src/ui/tools/connector-tool.cpp20
-rw-r--r--src/ui/tools/dropper-tool.cpp30
-rw-r--r--src/ui/tools/eraser-tool.cpp16
-rw-r--r--src/ui/tools/flood-tool.cpp22
-rw-r--r--src/ui/tools/freehand-base.cpp37
-rw-r--r--src/ui/tools/gradient-tool.cpp20
-rw-r--r--src/ui/tools/lpe-tool.cpp20
-rw-r--r--src/ui/tools/measure-tool.cpp34
-rw-r--r--src/ui/tools/mesh-tool.cpp20
-rw-r--r--src/ui/tools/node-tool.cpp14
-rw-r--r--src/ui/tools/node-tool.h2
-rw-r--r--src/ui/tools/pen-tool.cpp22
-rw-r--r--src/ui/tools/pencil-tool.cpp6
-rw-r--r--src/ui/tools/rect-tool.cpp16
-rw-r--r--src/ui/tools/select-tool.cpp64
-rw-r--r--src/ui/tools/spiral-tool.cpp16
-rw-r--r--src/ui/tools/spray-tool.cpp12
-rw-r--r--src/ui/tools/star-tool.cpp16
-rw-r--r--src/ui/tools/text-tool.cpp76
-rw-r--r--src/ui/tools/tool-base.cpp20
-rw-r--r--src/ui/tools/tweak-tool.cpp32
-rw-r--r--src/ui/widget/color-picker.cpp4
-rw-r--r--src/ui/widget/filter-effect-chooser.cpp2
-rw-r--r--src/ui/widget/layer-selector.cpp6
-rw-r--r--src/ui/widget/object-composite-settings.cpp30
-rw-r--r--src/ui/widget/page-sizer.cpp8
-rw-r--r--src/ui/widget/panel.cpp5
-rw-r--r--src/ui/widget/preferences-widget.cpp2
-rw-r--r--src/ui/widget/registered-widget.cpp7
-rw-r--r--src/ui/widget/registered-widget.h6
-rw-r--r--src/ui/widget/selected-style.cpp103
-rw-r--r--src/ui/widget/style-subject.cpp6
-rw-r--r--src/ui/widget/style-swatch.cpp9
-rw-r--r--src/ui/widget/tolerance-slider.cpp7
-rw-r--r--src/vanishing-point.cpp14
-rw-r--r--src/verbs.cpp46
-rw-r--r--src/widgets/arc-toolbar.cpp20
-rw-r--r--src/widgets/box3d-toolbar.cpp14
-rw-r--r--src/widgets/connector-toolbar.cpp18
-rw-r--r--src/widgets/dash-selector.cpp12
-rw-r--r--src/widgets/desktop-widget.cpp2
-rw-r--r--src/widgets/eraser-toolbar.cpp4
-rw-r--r--src/widgets/fill-style.cpp35
-rw-r--r--src/widgets/gradient-toolbar.cpp22
-rw-r--r--src/widgets/lpe-toolbar.cpp12
-rw-r--r--src/widgets/measure-toolbar.cpp4
-rw-r--r--src/widgets/mesh-toolbar.cpp8
-rw-r--r--src/widgets/node-toolbar.cpp14
-rw-r--r--src/widgets/rect-toolbar.cpp28
-rw-r--r--src/widgets/select-toolbar.cpp20
-rw-r--r--src/widgets/sp-xmlview-content.cpp4
-rw-r--r--src/widgets/spiral-toolbar.cpp10
-rw-r--r--src/widgets/star-toolbar.cpp36
-rw-r--r--src/widgets/stroke-marker-selector.cpp14
-rw-r--r--src/widgets/stroke-style.cpp47
-rw-r--r--src/widgets/stroke-style.h1
-rw-r--r--src/widgets/text-toolbar.cpp187
-rw-r--r--src/widgets/toolbox.cpp5
-rw-r--r--src/xml/node.h2
-rw-r--r--src/xml/simple-node.cpp20
-rw-r--r--src/xml/simple-node.h3
196 files changed, 2030 insertions, 2169 deletions
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..86f99049b 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);
@@ -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;
+ }
}
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 a45823380..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;
@@ -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
deleted file mode 100644
index 8fa7ad986..000000000
--- a/src/desktop-handles.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Frontends
- *
- * Author:
- * Lauris Kaplinski <lauris@kaplinski.com>
- *
- * 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"
-
-Inkscape::Selection *
-sp_desktop_selection (SPDesktop const * desktop)
-{
- g_assert(desktop != NULL);
-
- return desktop->selection;
-}
-
-SPDocument *
-sp_desktop_document (SPDesktop const * desktop)
-{
- g_return_val_if_fail (desktop != NULL, NULL);
-
- 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)
-{
- g_return_val_if_fail (desktop != NULL, NULL);
-
- return desktop->acetate;
-}
-
-SPCanvasGroup *
-sp_desktop_main (SPDesktop const * desktop)
-{
- g_return_val_if_fail (desktop != NULL, NULL);
-
- 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)
-{
- g_return_val_if_fail (desktop != NULL, NULL);
-
- 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)
-{
- g_return_val_if_fail (desktop != NULL, NULL);
-
- return desktop->sketch;
-}
-
-SPCanvasGroup *
-sp_desktop_controls (SPDesktop const * desktop)
-{
- g_return_val_if_fail (desktop != NULL, NULL);
-
- 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)
-{
- g_return_val_if_fail (desktop != NULL, NULL);
-
- 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
deleted file mode 100644
index 70a8c8b5f..000000000
--- a/src/desktop-handles.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef SEEN_SP_DESKTOP_HANDLES_H
-#define SEEN_SP_DESKTOP_HANDLES_H
-
-/*
- * Frontends
- *
- * Authors:
- * Lauris Kaplinski <lauris@kaplinski.com>
- *
- * 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)
-
-//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);
-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);
-Inkscape::MessageStack * sp_desktop_message_stack (SPDesktop const * desktop);
-SPNamedView * sp_desktop_namedview (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-style.cpp b/src/desktop-style.cpp
index 30869d87d..ee9fa39ec 100644
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
@@ -428,10 +428,9 @@ sp_desktop_get_font_size_tool(SPDesktop *desktop)
double ret = 12;
if (!style_str.empty()) {
- SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
- sp_style_merge_from_style_string(style, style_str.data());
- ret = style->font_size.computed;
- sp_style_unref(style);
+ SPStyle style(SP_ACTIVE_DOCUMENT);
+ style.mergeString(style_str.data());
+ ret = style.font_size.computed;
}
return ret;
}
@@ -626,7 +625,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/desktop.cpp b/src/desktop.cpp
index 288ca1fbf..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() {
@@ -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
@@ -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 0bcb6c375..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"
@@ -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));
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
}
@@ -45,12 +40,6 @@ DrawingImage::setPixbuf(Inkscape::Pixbuf *pb)
}
void
-DrawingImage::setStyle(SPStyle *style)
-{
- _setStyleCommon(_style, style);
-}
-
-void
DrawingImage::setScale(double sx, double sy)
{
_scale = Geom::Scale(sx, 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 8ed74b550..89ca66dc4 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -109,6 +109,8 @@ DrawingItem::DrawingItem(Drawing &drawing)
: _drawing(drawing)
, _parent(NULL)
, _key(0)
+ , _style(NULL)
+ , _context_style(NULL)
, _opacity(1.0)
, _transform(NULL)
, _clip(NULL)
@@ -188,6 +190,8 @@ DrawingItem::~DrawingItem()
delete _clip;
delete _mask;
delete _filter;
+ if(_style)
+ sp_style_unref(_style);
}
DrawingItem *
@@ -351,6 +355,72 @@ 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, SPStyle *context_style)
+{
+ // std::cout << "DrawingItem::setStyle: " << name() << " " << style
+ // << " " << context_style << std::endl;
+
+ if( style != _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);
+ }
+ }
+
+ 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)
{
@@ -908,6 +978,39 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags)
return NULL;
}
+// For debugging
+Glib::ustring
+DrawingItem::name()
+{
+ SPObject *object = static_cast<SPObject *>(_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
+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 << " ";
+ }
+ std::cout << name() << 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.
@@ -998,48 +1101,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.
*
* Higher scores mean the item is more aggresively prioritized for automatic
diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h
index 9b399e6e3..3c593ceaa 100644
--- a/src/display/drawing-item.h
+++ b/src/display/drawing-item.h
@@ -20,6 +20,10 @@
#include <exception>
#include <list>
+namespace Glib {
+class ustring;
+}
+
class SPStyle;
namespace Inkscape {
@@ -108,6 +112,8 @@ public:
bool cached() const { return _cached; }
void setCached(bool c, bool persistent = false);
+ 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
@@ -131,6 +137,9 @@ 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:
enum ChildType {
CHILD_ORPHAN = 0, // no parent - implies _parent == NULL
@@ -149,7 +158,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*/,
@@ -176,6 +184,9 @@ 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 66160638f..63efb3c0d 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();
}
@@ -65,10 +62,17 @@ DrawingShape::setPath(SPCurve *curve)
}
void
-DrawingShape::setStyle(SPStyle *style)
+DrawingShape::setStyle(SPStyle *style, SPStyle *context_style)
{
- _setStyleCommon(_style, style);
- _nrstyle.set(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
@@ -145,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 9d93a642f..1cdbc636e 100644
--- a/src/display/drawing-shape.h
+++ b/src/display/drawing-shape.h
@@ -28,7 +28,8 @@ public:
~DrawingShape();
void setPath(SPCurve *curve);
- 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,
@@ -45,7 +46,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..e20a7ff2a 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*/, SPStyle * /*context_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<DrawingText *>(_parent);
@@ -216,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)
+{
+ DrawingGroup::setStyle(style, context_style); // Must be first
+ _nrstyle.set(_style, _context_style);
+}
+
+void
+DrawingText::setChildrenStyle(SPStyle* context_style)
{
- _nrstyle.set(style);
- DrawingGroup::setStyle(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 4453a3db4..3d248df9b 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);
+ virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); // Not to be used
protected:
unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx,
@@ -56,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-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp
index b065ac445..c8b569036 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"
@@ -171,9 +171,11 @@ Geom::Rect FilterPrimitive::filter_primitive_area(FilterUnits const &units)
void FilterPrimitive::setStyle(SPStyle *style)
{
- if (style) sp_style_ref(style);
- if (_style) sp_style_unref(_style);
- _style = style;
+ if( style != _style ) {
+ if (style) sp_style_ref(style);
+ if (_style) sp_style_unref(_style);
+ _style = style;
+ }
}
diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp
index 96d16bf06..1740785e2 100644
--- a/src/display/nr-style.cpp
+++ b/src/display/nr-style.cpp
@@ -93,24 +93,47 @@ NRStyle::~NRStyle()
text_decoration_stroke.clear();
}
-void NRStyle::set(SPStyle *style)
+void NRStyle::set(SPStyle *style, SPStyle *context_style)
{
- if ( style->fill.isPaintserver() ) {
+ // Handle 'context-fill' and 'context-stroke': Work in progress
+ 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 {
+ // 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;
+ }
+ }
+
+ 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 ) {
+ // 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;
} else {
g_assert_not_reached();
}
+
fill.opacity = SP_SCALE24_TO_FLOAT(style->fill_opacity.value);
switch (style->fill_rule.computed) {
@@ -124,22 +147,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::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) {
@@ -266,7 +309,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 +319,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();
}
}
@@ -310,13 +353,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 <tweenk.pl@gmail.com>
@@ -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/display/snap-indicator.cpp b/src/display/snap-indicator.cpp
index 2632d69db..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"
@@ -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/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 <string.h>
#include <dbus/dbus-glib.h>
#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 d4b5fd187..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"
@@ -65,7 +65,7 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp
if (desktop != NULL) {
Inkscape::Util::GSListConstIterator<SPItem *> 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<Glib::ustring>::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..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"
@@ -48,8 +48,8 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I
SPDocument * current_document = view->doc();
using Inkscape::Util::GSListConstIterator;
- GSListConstIterator<SPItem *> selected =
- sp_desktop_selection((SPDesktop *)view)->itemList();
+ // FIXME very unsafe cast
+ GSListConstIterator<SPItem *> 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..bbc567f75 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -24,7 +24,7 @@
#include <errno.h>
#include <glib/gstdio.h>
-#include "desktop-handles.h"
+
#include "desktop.h"
#include "ui/dialog-events.h"
#include "extension/effect.h"
@@ -690,7 +690,7 @@ void Script::effect(Inkscape::Extension::Effect *module,
}
Inkscape::Util::GSListConstIterator<SPItem *> 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..76f35415e 100644
--- a/src/extension/internal/bitmap/imagemagick.cpp
+++ b/src/extension/internal/bitmap/imagemagick.cpp
@@ -25,7 +25,7 @@
#include <glib/gstdio.h>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "selection.h"
#include "sp-object.h"
#include "util/glib-list-iterators.h"
@@ -242,7 +242,9 @@ ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::Vie
SPDocument * current_document = view->doc();
using Inkscape::Util::GSListConstIterator;
- GSListConstIterator<SPItem *> selected = sp_desktop_selection((SPDesktop *)view)->itemList();
+
+ // FIXME very unsafe cast
+ GSListConstIterator<SPItem *> 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..270edfe44 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -24,7 +24,7 @@
#include <gtkmm/spinbutton.h>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "document.h"
#include "selection.h"
#include "sp-object.h"
@@ -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<SPItem *> selected = sp_desktop_selection((SPDesktop *)view)->itemList();
+
+ // FIXME very unsafe cast
+ GSListConstIterator<SPItem *> selected = ((SPDesktop *)view)->getSelection()->itemList();
Inkscape::XML::Node * first_select = NULL;
if (selected != NULL) {
first_select = (*selected)->getRepr();
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) {
diff --git a/src/file.cpp b/src/file.cpp
index a933a9611..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();
@@ -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
@@ -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 27f4d7a98..cf75f6cf0 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"
@@ -868,9 +868,8 @@ void sp_item_gradient_stop_set_style(SPItem *item, GrPointType point_type, guint
gchar const* color_str = sp_repr_css_property( stop, "stop-color", NULL );
if( color_str ) {
SPColor color( 0 );
- SPStyle* style = sp_style_new(0);
SPIPaint paint;
- paint.read( color_str, *style );
+ paint.read( color_str );
if( paint.isColor() ) {
color = paint.value.color;
}
@@ -1569,20 +1568,20 @@ 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);
}
// 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"));
}
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) {
@@ -1602,7 +1601,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 d945231fc..154b7339b 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -22,11 +22,11 @@
#include <cstring>
#include <string>
-#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
@@ -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(),
@@ -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"));
}
/**
@@ -1869,7 +1868,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 +1884,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;
@@ -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 94c3722cb..6a0e0f35a 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -54,7 +54,7 @@
#include <string>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "device-manager.h"
#include "document.h"
#include "extension/db.h"
@@ -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());
}
@@ -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 4118873c1..b3813ab53 100644
--- a/src/knot.cpp
+++ b/src/knot.cpp
@@ -19,7 +19,7 @@
#include <glibmm/i18n.h>
#include "display/sodipodi-ctrl.h"
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "knot.h"
#include "knot-ptr.h"
#include "document.h"
@@ -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,
@@ -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 c02d75d16..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"
@@ -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/libnrtype/Layout-TNG-Input.cpp b/src/libnrtype/Layout-TNG-Input.cpp
index fa1e8c11b..cd9179c5f 100644
--- a/src/libnrtype/Layout-TNG-Input.cpp
+++ b/src/libnrtype/Layout-TNG-Input.cpp
@@ -325,7 +325,7 @@ PangoFontDescription *Layout::InputStreamTextSource::styleGetFontDescription() c
Layout::InputStreamTextSource::~InputStreamTextSource()
{
- sp_style_unref(style);
+ sp_style_unref(style);
}
}//namespace Text
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<Glib::ustring, Glib::ustring> 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<Glib::ustring, Glib::ustring> 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/line-geometry.cpp b/src/line-geometry.cpp
index 1f6329be0..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"
@@ -202,7 +202,7 @@ boost::optional<Geom::Point> 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/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..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"
@@ -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/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index a88ac7d75..234a6174d 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 <2geom/sbasis-geometric.h>
namespace Inkscape {
@@ -33,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/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 <ui/view/view.h>
#include <desktop.h>
-#include <desktop-handles.h>
#include <helper/action.h>
#include <helper/action-context.h>
#include <selection.h>
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 0c3f9cde7..5f6e1495b 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"
@@ -47,11 +47,11 @@ using Inkscape::DocumentUndo;
void
sp_selected_path_combine(SPDesktop *desktop)
{
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
- SPDocument *doc = sp_desktop_document(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
+ SPDocument *doc = desktop->getDocument();
if (g_slist_length((GSList *) selection->itemList()) < 1) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to combine."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to combine."));
return;
}
@@ -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);
@@ -178,7 +178,7 @@ sp_selected_path_combine(SPDesktop *desktop)
Inkscape::GC::release(repr);
} else {
- sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to combine in the selection."));
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to combine in the selection."));
}
desktop->clearWaitingCursor();
@@ -187,10 +187,10 @@ 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 <b>path(s)</b> to break apart."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>path(s)</b> to break apart."));
return;
}
@@ -283,10 +283,10 @@ 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 {
- sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to break apart in the selection."));
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> 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 <b>object(s)</b> to convert to path."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to path."));
return;
}
@@ -323,10 +323,10 @@ 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 {
- sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No objects</b> to convert to path in the selection."));
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No objects</b> to convert to path in the selection."));
return;
}
}
@@ -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;
@@ -500,11 +500,12 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
/* Rotation center */
g_repr->setAttribute("inkscape:transform-center-x", item->getRepr()->attribute("inkscape:transform-center-x"), false);
g_repr->setAttribute("inkscape:transform-center-y", item->getRepr()->attribute("inkscape:transform-center-y"), false);
+
/* Whole text's style */
- gchar *style_str = sp_style_write_difference(item->style,
- item->parent ? item->parent->style : NULL); // TODO investigate posibility
- g_repr->setAttribute("style", style_str);
- g_free(style_str);
+ Glib::ustring style_str =
+ item->style->write( SP_STYLE_FLAG_IFDIFF, item->parent ? item->parent->style : NULL); // TODO investigate posibility
+ g_repr->setAttribute("style", style_str.c_str());
+
Inkscape::Text::Layout::iterator iter = te_get_layout(item)->begin();
do {
Inkscape::Text::Layout::iterator iter_next = iter;
@@ -522,19 +523,17 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
while (dynamic_cast<SPString const *>(pos_obj) && pos_obj->parent) {
pos_obj = pos_obj->parent; // SPStrings don't have style
}
- gchar *style_str = sp_style_write_difference(pos_obj->style,
- pos_obj->parent ? pos_obj->parent->style : NULL); // TODO investigate posibility
+ Glib::ustring style_str =
+ pos_obj->style->write( SP_STYLE_FLAG_IFDIFF, pos_obj->parent ? pos_obj->parent->style : NULL); // TODO investigate posibility
// get path from iter to iter_next:
SPCurve *curve = te_get_layout(item)->convertToCurves(iter, iter_next);
iter = iter_next; // shift to next glyph
if (!curve) { // error converting this glyph
- g_free (style_str);
continue;
}
if (curve->is_empty()) { // whitespace glyph?
curve->unref();
- g_free (style_str);
continue;
}
@@ -545,8 +544,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
g_free(def_str);
curve->unref();
- p_repr->setAttribute("style", style_str);
- g_free(style_str);
+ p_repr->setAttribute("style", style_str.c_str());
g_repr->appendChild(p_repr);
Inkscape::GC::release(p_repr);
@@ -565,7 +563,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
if (shape) {
curve = shape->getCurve();
}
- }
+ }
if (!curve)
return NULL;
@@ -581,11 +579,11 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
/* Transformation */
repr->setAttribute("transform", item->getRepr()->attribute("transform"));
+
/* Style */
- gchar *style_str = sp_style_write_difference(item->style,
- item->parent ? item->parent->style : NULL); // TODO investigate posibility
- repr->setAttribute("style", style_str);
- g_free(style_str);
+ Glib::ustring style_str =
+ item->style->write( SP_STYLE_FLAG_IFDIFF, item->parent ? item->parent->style : NULL); // TODO investigate posibility
+ repr->setAttribute("style", style_str.c_str());
/* Mask */
gchar *mask_str = (gchar *) item->getRepr()->attribute("mask");
@@ -613,11 +611,11 @@ 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) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>path(s)</b> to reverse."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>path(s)</b> to reverse."));
return;
}
@@ -660,10 +658,10 @@ 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 {
- sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to reverse in the selection."));
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to reverse in the selection."));
}
}
diff --git a/src/persp3d.cpp b/src/persp3d.cpp
index b21fd6cab..c761947ad 100644
--- a/src/persp3d.cpp
+++ b/src/persp3d.cpp
@@ -22,7 +22,8 @@
#include "svg/stringstream.h"
#include "xml/document.h"
#include "xml/node-event-vector.h"
-#include "desktop-handles.h"
+#include "desktop.h"
+
#include <glibmm/i18n.h>
#include "verbs.h"
#include "util/units.h"
@@ -328,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"));
}
}
@@ -339,7 +340,7 @@ persp3d_toggle_VPs (std::list<Persp3D *> p, Proj::Axis axis) {
for (std::list<Persp3D *>::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"));
}
@@ -555,7 +556,7 @@ persp3d_print_all_selected() {
g_print ("\n======================================\n");
g_print ("Selected perspectives and their boxes:\n");
- std::list<Persp3D *> sel_persps = sp_desktop_selection(SP_ACTIVE_DESKTOP)->perspList();
+ std::list<Persp3D *> sel_persps = SP_ACTIVE_DESKTOP->getSelection()->perspList();
for (std::list<Persp3D *>::iterator j = sel_persps.begin(); j != sel_persps.end(); ++j) {
Persp3D *persp = SP_PERSP3D(*j);
diff --git a/src/rubberband.cpp b/src/rubberband.cpp
index 6ec4b3e45..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"
@@ -98,7 +98,7 @@ void Inkscape::Rubberband::move(Geom::Point const &p)
if (_mode == RUBBERBAND_MODE_RECT) {
if (_rect == NULL) {
- _rect = static_cast<CtrlRect *>(sp_canvas_item_new(sp_desktop_controls(_desktop), SP_TYPE_CTRLRECT, NULL));
+ _rect = static_cast<CtrlRect *>(sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRLRECT, NULL));
_rect->setShadow(1, 0xffffffff);
}
_rect->setRectangle(Geom::Rect(_start, _end));
@@ -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/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<Inkscape::SnapCandidatePoint> const &snappoints,
std::vector<SPGuideConstraint> &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/selcue.cpp b/src/selcue.cpp
index 805629636..d2fa0970a 100644
--- a/src/selcue.cpp
+++ b/src/selcue.cpp
@@ -13,7 +13,8 @@
#include <string.h>
-#include "desktop-handles.h"
+#include "desktop.h"
+
#include "selection.h"
#include "display/sp-canvas-util.h"
#include "display/sodipodi-ctrl.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))
@@ -154,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,
@@ -170,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);
@@ -207,7 +208,7 @@ void Inkscape::SelCue::_newTextBaselines()
if (layout != NULL && layout->outputExists()) {
boost::optional<Geom::Point> 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/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 83a943f53..c9837aabe 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"
@@ -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;
@@ -402,12 +402,12 @@ 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;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -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"));
}
@@ -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()) {
@@ -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"));
}
@@ -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<SPGroup *>(dt->currentLayer()));
@@ -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"));
}
}
@@ -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()) {
@@ -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"));
}
@@ -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()) {
@@ -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,14 +1316,14 @@ 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"));
}
}
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()) {
@@ -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 {
@@ -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()) {
@@ -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 {
@@ -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()) {
@@ -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"));
}
}
@@ -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<GSList *>(selection->reprList());
while (l != NULL) {
@@ -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"));
}
@@ -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;
@@ -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" ),
@@ -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<SPItem *>(static_cast<SPObject *>(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<SPItem *>(static_cast<SPObject *>(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<SPItem *>(static_cast<SPObject *>(sel_iter->data));
@@ -2110,7 +2110,7 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy
SPStyle *sel_style_for_width = NULL;
if (type == SP_STROKE_STYLE_WIDTH) {
objects = g_slist_prepend(objects, sel);
- sel_style_for_width = sp_style_new (SP_ACTIVE_DOCUMENT);
+ sel_style_for_width = new SPStyle(SP_ACTIVE_DOCUMENT);
objects_query_strokewidth (objects, sel_style_for_width);
}
@@ -2125,11 +2125,11 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy
if (sel_style->stroke_width.set && iter_style->stroke_width.set) {
GSList *objects = NULL;
objects = g_slist_prepend(objects, iter);
- SPStyle *iter_style_for_width = sp_style_new (SP_ACTIVE_DOCUMENT);
- objects_query_strokewidth (objects, iter_style_for_width);
+ SPStyle tmp_style(SP_ACTIVE_DOCUMENT);
+ objects_query_strokewidth (objects, &tmp_style);
if (sel_style_for_width) {
- match = (sel_style_for_width->stroke_width.computed == iter_style_for_width->stroke_width.computed);
+ match = (sel_style_for_width->stroke_width.computed == tmp_style.stroke_width.computed);
}
g_slist_free(objects);
}
@@ -2161,6 +2161,7 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy
}
}
+ if( sel_style_for_width != NULL ) delete sel_style_for_width;
g_slist_free(objects);
return matches;
@@ -2205,7 +2206,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 +2236,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 +2265,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"));
}
@@ -2376,7 +2377,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);
@@ -2403,10 +2404,10 @@ 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 = 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 +2435,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<SPLPEItem*>(item) ) {
@@ -2467,7 +2468,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 +2608,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();
@@ -2648,7 +2649,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);
@@ -2662,7 +2663,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 <b>clones</b> to relink."));
@@ -2697,7 +2698,7 @@ sp_selection_relink(SPDesktop *desktop)
if (!relinked) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No clones to relink</b> 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"));
}
}
@@ -2709,7 +2710,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 <b>clones</b> to unlink."));
@@ -2771,7 +2772,7 @@ sp_selection_unlink(SPDesktop *desktop)
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No clones to unlink</b> 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"));
}
@@ -2781,7 +2782,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();
@@ -2856,7 +2857,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();
@@ -2881,7 +2882,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;
@@ -2922,7 +2923,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,10 +2940,10 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -3040,8 +3041,8 @@ void sp_selection_to_guides(SPDesktop *desktop)
if (desktop == NULL)
return;
- SPDocument *doc = sp_desktop_document(desktop);
- Inkscape::Selection *selection = sp_desktop_selection(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<GSList *>(selection->itemList()));
@@ -3098,10 +3099,10 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// Check if something is selected.
if (selection->isEmpty()) {
@@ -3220,10 +3221,10 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// Check if something is selected.
if (selection->isEmpty()) {
@@ -3287,7 +3288,7 @@ void sp_selection_unsymbol(SPDesktop *desktop)
symbol->deleteObject(true);
// Change selection to new <g> element.
- SPItem *group_item = static_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(group));
+ SPItem *group_item = static_cast<SPItem *>(desktop->getDocument()->getObjectByRepr(group));
selection->set(group_item);
// Clean up
@@ -3305,10 +3306,10 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -3400,7 +3401,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<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(rect));
+ SPItem *rectangle = static_cast<SPItem *>(desktop->getDocument()->getObjectByRepr(rect));
Inkscape::GC::release(rect);
@@ -3420,10 +3421,10 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -3490,7 +3491,7 @@ void sp_selection_untile(SPDesktop *desktop)
if (!did) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No pattern fills</b> 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,10 +3576,10 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -3793,10 +3794,10 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty()) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to create clippath or mask from."));
return;
@@ -3909,10 +3910,10 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
bool is_empty = selection->isEmpty();
@@ -4112,9 +4113,9 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -4205,7 +4206,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<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr));
+ SPItem *mask_item = static_cast<SPItem *>(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 +4254,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 +4279,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 +4307,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 +4320,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 +4329,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 a9ae9e465..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"
@@ -131,9 +131,9 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) :
_makeHandles();
_updateHandles();
- _selection = sp_desktop_selection(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]);
}
@@ -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++) {
@@ -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"));
}
@@ -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 ) {
@@ -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"));
}
@@ -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) {
@@ -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-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-flowtext.cpp b/src/sp-flowtext.cpp
index 766026980..6d2385aff 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"
@@ -525,10 +525,10 @@ Inkscape::XML::Node *SPFlowtext::getAsText()
Glib::ustring::iterator span_text_start_iter;
this->layout.getSourceOfCharacter(it, &rawptr, &span_text_start_iter);
SPObject *source_obj = reinterpret_cast<SPObject *>(rawptr);
- gchar *style_text = sp_style_write_difference((dynamic_cast<SPString *>(source_obj) ? source_obj->parent : source_obj)->style, this->style);
- if (style_text && *style_text) {
- span_tspan->setAttribute("style", style_text);
- g_free(style_text);
+
+ Glib::ustring style_text = (dynamic_cast<SPString *>(source_obj) ? source_obj->parent : source_obj)->style->write( SP_STYLE_FLAG_IFDIFF, this->style);
+ if (!style_text.empty()) {
+ span_tspan->setAttribute("style", style_text.c_str());
}
SPString *str = dynamic_cast<SPString *>(source_obj);
@@ -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 <algorithm>
#include <cstring>
#include <string>
-#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::list<std::pair<Geom::Poin
void sp_guide_create_guides_around_page(SPDesktop *dt)
{
- SPDocument *doc=sp_desktop_document(dt);
+ SPDocument *doc=dt->getDocument();
std::list<std::pair<Geom::Point, Geom::Point> > 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-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-group.cpp b/src/sp-item-group.cpp
index 992bca631..acf8b2012 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"
@@ -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;
@@ -199,12 +200,16 @@ 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<Inkscape::DrawingGroup *>(v->arenaitem);
- group->setStyle(this->style);
+ if( this->parent ) {
+ 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;
@@ -352,11 +357,15 @@ 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);
- ai->setStyle(this->style);
+ if( this->parent ) {
+ this->context_style = this->parent->context_style;
+ }
+ ai->setStyle(this->style, this->context_style);
this->_showChildren(drawing, ai, key, flags);
return ai;
@@ -435,7 +444,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done)
// it here _before_ the new transform is set, so as to use the pre-transform bbox
citem->adjust_paint_recursive (Geom::identity(), Geom::identity(), false);
- sp_style_merge_from_dying_parent(child->style, group->style);
+ child->style->merge( group->style );
/*
* fixme: We currently make no allowance for the case where child is cloned
* and the group has any style settings.
@@ -444,9 +453,8 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done)
* version of inkscape without using the XML editor: we usually apply group
* style changes to children rather than to the group itself.)
*
- * If the group has no style settings, then
- * sp_style_merge_from_dying_parent should be a no-op. Otherwise (i.e. if
- * we change the child's style to compensate for its parent going away)
+ * If the group has no style settings, then style->merge() should be a no-op. Otherwise
+ * (i.e. if we change the child's style to compensate for its parent going away)
* then those changes will typically be reflected in any clones of child,
* whereas we'd prefer for Ungroup not to affect the visual appearance.
*
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index b6dee67e4..fbb76e971 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 <glibmm/i18n.h>
@@ -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-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<Inkscape::DrawingItem *> 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<Inkscape::DrawingItem *> 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<SPItemClass *>(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<unsigned int, SPMarkerView>::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<Inkscape::DrawingGroup *>(v->items[i]);
+ std::map<unsigned int, SPMarkerView>::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<Inkscape::DrawingGroup *>(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<unsigned int, SPMarkerView>::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<Inkscape::DrawingGroup *>(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<unsigned int, SPMarkerView>::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<Inkscape::DrawingGroup *>(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..e804fd7dc 100644
--- a/src/sp-marker.h
+++ b/src/sp-marker.h
@@ -21,7 +21,9 @@
#define SP_MARKER(obj) (dynamic_cast<SPMarker*>((SPObject*)obj))
#define SP_IS_MARKER(obj) (dynamic_cast<const SPMarker*>((SPObject*)obj) != NULL)
-struct SPMarkerView;
+class SPMarkerView;
+
+#include <map>
#include <2geom/rect.h>
#include <2geom/affine.h>
@@ -61,8 +63,13 @@ public:
markerOrient orient_mode : 2;
SVGAngle orient;
- /* Private views */
- SPMarkerView *views;
+ /* 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<unsigned int, SPMarkerView> views_map;
virtual void build(SPDocument *document, Inkscape::XML::Node *repr);
virtual void release();
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 1817e74e0..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"
@@ -676,7 +676,7 @@ void SPNamedView::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *r
g->SPGuide::showSPGuide(static_cast<SPDesktop*>(l->data)->guides, (GCallback) sp_dt_guide_event);
if (static_cast<SPDesktop*>(l->data)->guides_active) {
- g->sensitize(sp_desktop_canvas(static_cast<SPDesktop*> (l->data)), TRUE);
+ g->sensitize((static_cast<SPDesktop*> (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);
}
@@ -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)
@@ -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<SPDesktop*>(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/sp-object.cpp b/src/sp-object.cpp
index 4e45eb824..059fa8093 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -130,7 +130,8 @@ 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;
}
SPObject::~SPObject() {
@@ -144,6 +145,19 @@ SPObject::~SPObject() {
sp_object_unref(this->_successor, NULL);
this->_successor = NULL;
}
+
+ if( style == NULL ) {
+ // style pointer could be NULL if unreffed too many times.
+ // Conjecture: style pointer is never NULL.
+ std::cerr << "SPObject::~SPObject(): style pointer is NULL" << std::endl;
+ } else if( style->refCount() > 1 ) {
+ // Several classes ref style.
+ // Conjecture: style pointer should be unreffed by other classes before reaching here.
+ std::cerr << "SPObject::~SPObject(): someone else still holding ref to style" << std::endl;
+ sp_style_unref( this->style );
+ } else {
+ delete this->style;
+ }
}
// CPPIFY: make pure virtual
@@ -795,9 +809,10 @@ void SPObject::releaseReferences() {
g_assert(!this->id);
}
- if (this->style) {
- this->style = sp_style_unref(this->style);
- }
+ // style belongs to SPObject, we should not need to unref here.
+ // if (this->style) {
+ // this->style = sp_style_unref(this->style);
+ // }
this->document = NULL;
this->repr = NULL;
@@ -914,7 +929,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:
@@ -1006,9 +1021,8 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML
repr->setAttribute("inkscape:collect", NULL);
}
- SPStyle const *const obj_style = this->style;
- if (obj_style) {
- gchar *s = sp_style_write_string(obj_style, SP_STYLE_FLAG_IFSET);
+ if (style) {
+ Glib::ustring s = style->write(SP_STYLE_FLAG_IFSET);
// Check for valid attributes. This may be time consuming.
// It is useful, though, for debugging Inkscape code.
@@ -1016,17 +1030,14 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML
if( prefs->getBool("/options/svgoutput/check_on_editing") ) {
unsigned int flags = sp_attribute_clean_get_prefs();
- Glib::ustring s_cleaned = sp_attribute_clean_style( repr, s, flags );
- g_free( s );
- s = (s_cleaned.empty() ? NULL : g_strdup (s_cleaned.c_str()));
+ Glib::ustring s_cleaned = sp_attribute_clean_style( repr, s.c_str(), flags );
}
- if( s == NULL || strcmp(s,"") == 0 ) {
+ if( s.empty() ) {
repr->setAttribute("style", NULL);
} else {
- repr->setAttribute("style", s);
+ repr->setAttribute("style", s.c_str());
}
- g_free(s);
} else {
/** \todo I'm not sure what to do in this case. Bug #1165868
@@ -1148,7 +1159,7 @@ void SPObject::updateDisplay(SPCtx *ctx, unsigned int flags)
*/
if ((flags & SP_OBJECT_STYLE_MODIFIED_FLAG) && (flags & SP_OBJECT_PARENT_MODIFIED_FLAG)) {
if (this->style && this->parent) {
- sp_style_merge_from_parent(this->style, this->parent->style);
+ style->cascade( this->parent->style );
}
}
@@ -1523,6 +1534,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..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) {
@@ -854,6 +859,8 @@ protected:
public:
virtual void read_content();
+
+ void recursivePrintTree(unsigned level = 0); // For debugging
};
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/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/sp-shape.cpp b/src/sp-shape.cpp
index 6d240fbf5..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
@@ -145,7 +146,15 @@ void SPShape::update(SPCtx* ctx, guint flags) {
for (SPItemView *v = ((SPItem *) (this))->display; v != NULL; v = v->next) {
Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem);
- sh->setStyle(this->style);
+ if (hasMarkers()) {
+ 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);
+ }
}
}
}
@@ -163,6 +172,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()) {
@@ -182,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<Inkscape::DrawingShape *>(v->arenaitem);
+
+ sh->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children.
+ }
}
}
@@ -382,12 +399,23 @@ 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<Inkscape::DrawingShape *>(v->arenaitem);
- sh->setStyle(this->style);
+ if (hasMarkers()) {
+ 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);
+ }
}
}
}
@@ -718,8 +746,11 @@ 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);
- 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 +762,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 +778,14 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*
/* Update marker views */
sp_shape_update_marker_view (this, s);
- }
+ 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-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-stop.cpp b/src/sp-stop.cpp
index d644a9b4b..3ee467322 100644
--- a/src/sp-stop.cpp
+++ b/src/sp-stop.cpp
@@ -210,16 +210,14 @@ SPStop* SPStop::getPrevStop() {
SPColor SPStop::readStopColor(Glib::ustring const &styleStr, guint32 dfl) {
SPColor color(dfl);
- SPStyle* style = sp_style_new(0);
SPIPaint paint;
- paint.read( styleStr.c_str(), *style );
+
+ paint.read( styleStr.c_str() );
if ( paint.isColor() ) {
color = paint.value.color;
}
- sp_style_unref(style);
-
return color;
}
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 <style> is a child of the object
- // that uses a style from it. It just forces the parent of <style> to reread its style as soon as the stylesheet
- // is fully loaded. Naturally, this won't work if the user of the stylesheet is its grandparent or precedent.
+ // 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 <style> is a child of the object that uses a style from it. It just forces the parent of
+ // <style> to reread its style as soon as the stylesheet is fully loaded. Naturally, this won't
+ // work if the user of the stylesheet is its grandparent or precedent.
if ( parent ) {
- sp_style_read_from_object(parent->style, parent);
+ parent->style->readFromObject( parent );
}
}
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 8922d3c73..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"
@@ -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<Inkscape::DrawingGroup *>(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<Inkscape::DrawingGroup *>(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());
@@ -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/sp-tref.cpp b/src/sp-tref.cpp
index 0f6eb106f..6a229e170 100644
--- a/src/sp-tref.cpp
+++ b/src/sp-tref.cpp
@@ -492,12 +492,8 @@ sp_tref_convert_to_tspan(SPObject *obj)
//SPObject * new_string_child = document->getObjectByRepr(new_string_repr);
// Merge style from the tref
- SPStyle *new_tspan_sty = new_tspan->style;
- SPStyle const *tref_sty = tref->style;
- sp_style_merge_from_dying_parent(new_tspan_sty, tref_sty);
- sp_style_merge_from_parent(new_tspan_sty, new_tspan->parent->style);
-
-
+ new_tspan->style->merge( tref->style );
+ new_tspan->style->cascade( new_tspan->parent->style );
new_tspan->updateRepr();
// Hold onto our SPObject and repr for now.
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index 2bd6757ff..9b38a91c5 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,10 +280,13 @@ 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->context_style = this->style;
+ ai->setStyle(this->style, this->context_style);
+
if (this->child) {
Inkscape::DrawingItem *ac = this->child->invoke_show(drawing, key, flags);
@@ -529,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;
@@ -579,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<Inkscape::DrawingGroup *>(v->arenaitem);
- g->setStyle(this->style);
+ this->context_style = this->style;
+ g->setStyle(this->style, this->context_style);
}
}
@@ -592,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;
}
@@ -601,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<Inkscape::DrawingGroup *>(v->arenaitem);
- g->setStyle(this->style);
+ this->context_style = this->style;
+ g->setStyle(this->style, this->context_style);
}
}
@@ -657,11 +664,8 @@ SPItem *SPUse::unlink() {
SPObject *unlinked = document->getObjectByRepr(copy);
// Merge style from the use.
- SPStyle *unli_sty = unlinked->style;
- SPStyle const *use_sty = this->style;
- sp_style_merge_from_dying_parent(unli_sty, use_sty);
- sp_style_merge_from_parent(unli_sty, unlinked->parent->style);
-
+ unlinked->style->merge( this->style );
+ unlinked->style->cascade( unlinked->parent->style );
unlinked->updateRepr();
// Hold onto our SPObject and repr for now.
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 1a75a6f29..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"
@@ -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 <b>stroked path(s)</b> to convert stroke to path."));
@@ -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"
@@ -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) ) ) {
@@ -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<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr));
+ SPItem *nitem = reinterpret_cast<SPItem *>(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")
@@ -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 <b>path(s)</b> to inset/outset."));
@@ -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);
@@ -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,
@@ -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, _("<b>No paths</b> to simplify in the selection."));
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<SPStyle *> (s))->getFillPaintServer())
#define SP_STYLE_STROKE_SERVER(s) ((const_cast<SPStyle *> (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 {
diff --git a/src/style-test.h b/src/style-test.h
index e14ed4db7..cd6769b24 100644
--- a/src/style-test.h
+++ b/src/style-test.h
@@ -214,32 +214,25 @@ public:
for ( gint i = 0; cases[i].src; i++ ) {
// std::cout << "Test one: " << i << std::endl;
- SPStyle *style = sp_style_new(_doc);
- TS_ASSERT(style);
- if ( style ) {
- sp_style_merge_from_style_string( style, cases[i].src );
-
- if ( cases[i].uri ) {
- TSM_ASSERT( cases[i].src, style->fill.value.href );
- if ( style->fill.value.href ) {
- TS_ASSERT_EQUALS( style->fill.value.href->getURI()->toString(), std::string(cases[i].uri) );
- }
- } else {
- TS_ASSERT( !style->fill.value.href || !style->fill.value.href->getObject() );
+ SPStyle style(_doc);
+ style.mergeString( cases[i].src );
+ if ( cases[i].uri ) {
+ TSM_ASSERT( cases[i].src, style.fill.value.href );
+ if ( style.fill.value.href ) {
+ TS_ASSERT_EQUALS( style.fill.value.href->getURI()->toString(), std::string(cases[i].uri) );
}
+ } else {
+ TS_ASSERT( !style.fill.value.href || !style.fill.value.href->getObject() );
+ }
- gchar *str0_set = sp_style_write_string( style, SP_STYLE_FLAG_IFSET );
- //printf("<<%s>>\n", str0_set);
- if ( cases[i].dst ) {
- // std::cout << " " << std::string(str0_set) << " " << std::string(cases[i].dst) << std::endl;
- TS_ASSERT_EQUALS( std::string(str0_set), std::string(cases[i].dst) );
- } else {
- // std::cout << " " << std::string(str0_set) << " " << std::string(cases[i].src) << std::endl;
- TS_ASSERT_EQUALS( std::string(str0_set), std::string(cases[i].src) );
- }
+ std::string str0_set = style.write(SP_STYLE_FLAG_IFSET );
- g_free(str0_set);
- sp_style_unref(style);
+ if ( cases[i].dst ) {
+ // std::cout << " " << str0_set << " " << std::string(cases[i].dst) << std::endl;
+ TS_ASSERT_EQUALS( str0_set, std::string(cases[i].dst) );
+ } else {
+ // std::cout << " " << str0_set << " " << std::string(cases[i].src) << std::endl;
+ TS_ASSERT_EQUALS( str0_set, std::string(cases[i].src) );
}
}
}
@@ -366,26 +359,22 @@ public:
};
for ( gint i = 0; cases[i].src; i++ ) {
// std::cout << "Test two: " << i << std::endl;
- SPStyle *style_src = sp_style_new(_doc);
- TS_ASSERT(style_src);
- SPStyle *style_dst = sp_style_new(_doc);
- TS_ASSERT(style_dst);
-
- if ( style_src && style_dst ) {
- sp_style_merge_from_style_string( style_src, cases[i].src );
- sp_style_merge_from_style_string( style_dst, cases[i].dst );
- // std::cout << "Test:" << std::endl;
- // std::cout << " C: |" << cases[i].src << "| |" << cases[i].dst << "|" << std::endl;
- // std::cout << " S: |" << style_src->write( SP_STYLE_FLAG_IFSET, NULL ) << "| |"
- // << style_dst->write( SP_STYLE_FLAG_IFSET, NULL ) << "|" <<std::endl;
- TS_ASSERT( (*style_src == *style_dst) == cases[i].match );
- sp_style_unref(style_src);
- sp_style_unref(style_dst);
- // std::cout << "End Test\n" << std::endl;
- }
+ SPStyle style_src(_doc);
+ SPStyle style_dst(_doc);
+
+ style_src.mergeString( cases[i].src );
+ style_dst.mergeString( cases[i].dst );
+
+ // std::cout << "Test:" << std::endl;
+ // std::cout << " C: |" << cases[i].src << "| |" << cases[i].dst << "|" << std::endl;
+ // std::cout << " S: |" << style_src.write( SP_STYLE_FLAG_IFSET, NULL ) << "| |"
+ // << style_dst.write( SP_STYLE_FLAG_IFSET, NULL ) << "|" <<std::endl;
+ TS_ASSERT( (style_src == style_dst) == cases[i].match );
+ // std::cout << "End Test\n" << std::endl;
}
}
+
// Test of cascade
void testThree()
{
@@ -477,37 +466,29 @@ public:
};
for ( gint i = 0; cases[i].parent; i++ ) {
// std::cout << "Test three: " << i << std::endl;
- SPStyle *style_parent = sp_style_new(_doc);
- TS_ASSERT(style_parent);
- SPStyle *style_child = sp_style_new(_doc);
- TS_ASSERT(style_child);
- SPStyle *style_result = sp_style_new(_doc);
- TS_ASSERT(style_result);
-
- if ( style_parent && style_child && style_result ) {
- sp_style_merge_from_style_string( style_parent, cases[i].parent );
- sp_style_merge_from_style_string( style_child, cases[i].child );
- sp_style_merge_from_style_string( style_result, cases[i].result );
- // std::cout << "Test:" << std::endl;
- // std::cout << " Input: ";
- // std::cout << " Parent: " << cases[i].parent
- // << " Child: " << cases[i].child
- // << " Result: " << cases[i].result << std::endl;
- // std::cout << " Write: ";
- // std::cout << " Parent: " << style_parent->write( SP_STYLE_FLAG_IFSET )
- // << " Child: " << style_child->write( SP_STYLE_FLAG_IFSET )
- // << " Result: " << style_result->write( SP_STYLE_FLAG_IFSET ) << std::endl;
-
- //sp_style_merge_from_parent( style_child, style_parent );
- style_child->cascade( style_parent );
-
- TS_ASSERT(*style_child == *style_result );
-
- sp_style_unref(style_child);
- sp_style_unref(style_parent);
- sp_style_unref(style_result);
- // std::cout << "End Test: *************\n" << std::endl;
- }
+ SPStyle style_parent(_doc);
+ SPStyle style_child( _doc);
+ SPStyle style_result(_doc);
+
+ style_parent.mergeString( cases[i].parent );
+ style_child.mergeString( cases[i].child );
+ style_result.mergeString( cases[i].result );
+
+ // std::cout << "Test:" << std::endl;
+ // std::cout << " Input: ";
+ // std::cout << " Parent: " << cases[i].parent
+ // << " Child: " << cases[i].child
+ // << " Result: " << cases[i].result << std::endl;
+ // std::cout << " Write: ";
+ // std::cout << " Parent: " << style_parent.write( SP_STYLE_FLAG_IFSET )
+ // << " Child: " << style_child.write( SP_STYLE_FLAG_IFSET )
+ // << " Result: " << style_result.write( SP_STYLE_FLAG_IFSET ) << std::endl;
+
+ style_child.cascade( &style_parent );
+
+ TS_ASSERT(style_child == style_result );
+
+ // std::cout << "End Test: *************\n" << std::endl;
}
}
diff --git a/src/style.cpp b/src/style.cpp
index a7e50b17a..0772a4bce 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -458,7 +458,14 @@ SPStyle::~SPStyle() {
_properties.clear();
- // std::cout << "SPStyle::~SPstyle(): Exit\n" << std::endl;
+ // Conjecture: all this SPStyle ref counting is not needed. SPObject creates an instance of
+ // SPStyle when it is constructed and deletes it when it is destructed. The refcount is
+ // incremented and decremented only in the files: display/drawing-item.cpp,
+ // display/nr-filter-primitive.cpp, and libnrtype/Layout-TNG-Input.cpp.
+ if( _refcount > 1 ) {
+ std::cerr << "SPStyle::~SPStyle: ref count greater than 1! " << _refcount << std::endl;
+ }
+ // std::cout << "SPStyle::~SPStyle(): Exit\n" << std::endl;
}
// Used in SPStyle::clear()
@@ -476,7 +483,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()...
@@ -576,7 +583,13 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) {
}
}
-// Matches void sp_style_read_from_object(SPStyle *style, SPObject *object);
+/**
+ * Read style properties from object's repr.
+ *
+ * 1. Reset existing object style
+ * 2. Load current effective object style
+ * 3. Load i attributes from immediate parent (which has to be up-to-date)
+ */
void
SPStyle::readFromObject( SPObject *object ) {
@@ -591,6 +604,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<Inkscape::Preferences::Entry> attrs = prefs->getAllEntries(path);
+ for (std::vector<Inkscape::Preferences::Entry>::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 ) {
@@ -868,6 +909,19 @@ SPStyle::readIfUnset( gint id, gchar const *val ) {
}
}
+/**
+ * Outputs the style to a CSS string.
+ *
+ * Use with SP_STYLE_FLAG_ALWAYS for copying an object's complete cascaded style to
+ * style_clipboard.
+ *
+ * Use with SP_STYLE_FLAG_IFDIFF and a pointer to the parent class when you need a CSS string for
+ * an object in the document tree.
+ *
+ * \pre flags in {IFSET, ALWAYS, IFDIFF}.
+ * \pre base.
+ * \post ret != NULL.
+ */
Glib::ustring
SPStyle::write( guint const flags, SPStyle const *const base ) const {
@@ -897,9 +951,20 @@ SPStyle::write( guint const flags, SPStyle const *const base ) const {
}
// Corresponds to sp_style_merge_from_parent()
+/**
+ * Sets computed values in \a style, which may involve inheriting from (or in some other way
+ * calculating from) corresponding computed values of \a parent.
+ *
+ * References: http://www.w3.org/TR/SVG11/propidx.html shows what properties inherit by default.
+ * http://www.w3.org/TR/SVG11/styling.html#Inheritance gives general rules as to what it means to
+ * inherit a value. http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value is more precise
+ * about what the computed value is (not obvious for lengths).
+ *
+ * \pre \a parent's computed values are already up-to-date.
+ */
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<SPIBase*>::size_type i = 0; i != _properties.size(); ++i) {
_properties[i]->cascade( parent->_properties[i] );
}
@@ -909,6 +974,23 @@ SPStyle::cascade( SPStyle const *const parent ) {
}
// Corresponds to sp_style_merge_from_dying_parent()
+/**
+ * Combine \a style and \a parent style specifications into a single style specification that
+ * preserves (as much as possible) the effect of the existing \a style being a child of \a parent.
+ *
+ * Called when the parent repr is to be removed (e.g. the parent is a \<use\> element that is being
+ * unlinked), in which case we copy/adapt property values that are explicitly set in \a parent,
+ * trying to retain the same visual appearance once the parent is removed. Interesting cases are
+ * when there is unusual interaction with the parent's value (opacity, display) or when the value
+ * can be specified as relative to the parent computed value (font-size, font-weight etc.).
+ *
+ * Doesn't update computed values of \a style. For correctness, you should subsequently call
+ * sp_style_merge_from_parent against the new parent (presumably \a parent's parent) even if \a
+ * style was previously up-to-date wrt \a parent.
+ *
+ * \pre \a parent's computed values are already up-to-date.
+ * (\a style's computed values needn't be up-to-date.)
+ */
void
SPStyle::merge( SPStyle const *const parent ) {
// std::cout << "SPStyle::merge" << std::endl;
@@ -920,6 +1002,14 @@ SPStyle::merge( SPStyle const *const parent ) {
// }
}
+/**
+ * Parses a style="..." string and merges it with an existing SPStyle.
+ */
+void
+SPStyle::mergeString( gchar const *const p ) {
+ _mergeString( p );
+}
+
// Mostly for unit testing
bool
SPStyle::operator==(const SPStyle& rhs) {
@@ -1142,35 +1232,6 @@ sp_style_stroke_paint_server_ref_changed(SPObject *old_ref, SPObject *ref, SPSty
sp_style_paint_server_ref_modified(ref, 0, style);
}
-// Called in: desktop-style.cpp, gradient-chemistry.cpp, sp-object.cpp, sp-stop.cpp, style.cpp
-// text-editing.cpp, libnrtype/font-lister.cpp, widgets/dash-selector.cpp, widgets/fill-style.cpp,
-// widgets/stroke-style.cpp, widgets/text-toolbar.cpp, ui/dialog/glyphs.cpp, ui/dialog/swatches.cpp,
-// ui/dialog/swatches.cpp, ui/dialog/text-edit.cpp. ui/tools/freehand-base.cpp,
-// ui/widget/object-composite-settings.cpp, ui/widget/selected-style.cpp, ui/widget/style-swatch.cpp
-/**
- * Returns a new SPStyle object with default settings.
- */
-SPStyle *
-sp_style_new(SPDocument *document)
-{
- SPStyle *const style = new SPStyle( 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.
@@ -1180,13 +1241,12 @@ sp_style_ref(SPStyle *style)
{
g_return_val_if_fail(style != NULL, NULL);
- style->ref(); // Increase ref count
+ style->style_ref(); // Increase ref count
return style;
}
-// Called in style.cpp, desktop-style.cpp, sp-object.cpp, sp-stop.cpp, text-editing.cpp
-// display/drawing-group.cpp, ...
+// Called in display/drawing-item.cpp, display/nr-filter-primitive.cpp, libnrtype/Layout-TNG-Input.cpp
/**
* Decrease refcount of style with possible destruction.
*/
@@ -1194,71 +1254,13 @@ SPStyle *
sp_style_unref(SPStyle *style)
{
g_return_val_if_fail(style != NULL, NULL);
- if (style->unref() < 1) {
+ if (style->style_unref() < 1) {
delete style;
return NULL;
}
return style;
}
-
-
-// Called in: sp-clippath.cpp, sp-item.cpp (suspicious), sp-object.cpp, sp-style-elem.cpp
-/**
- * Read style properties from object's repr.
- *
- * 1. Reset existing object style
- * 2. Load current effective object style
- * 3. Load i attributes from immediate parent (which has to be up-to-date)
- */
-void
-sp_style_read_from_object(SPStyle *style, SPObject *object)
-{
- // std::cout << "sp_style_read_from_object: " << (object->getId()?object->getId():"null") << std::endl;
- g_return_if_fail(style != NULL);
- g_return_if_fail(object != NULL);
- g_return_if_fail(SP_IS_OBJECT(object));
-
- Inkscape::XML::Node *repr = object->getRepr();
- g_return_if_fail(repr != NULL);
-
- 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<Inkscape::Preferences::Entry> attrs = prefs->getAllEntries(path);
- for (std::vector<Inkscape::Preferences::Entry>::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()
{
@@ -1282,81 +1284,9 @@ sp_repr_sel_eng()
return ret;
}
-
-// Called in text-editting.cpp, ui/tools/frehand-base.cpp, ui/widget/style-swatch.cpp
-/**
- * Parses a style="..." string and merges it with an existing SPStyle.
- */
-void
-sp_style_merge_from_style_string(SPStyle *const style, gchar const *const p)
-{
- // std::cout << "sp_style_merge_from_style_string: " << (p?p:"null") <<std::endl;
- /*
- * Reference: http://www.w3.org/TR/SVG11/styling.html#StyleAttribute:
- * ``When CSS styling is used, CSS inline style is specified by including
- * semicolon-separated property declarations of the form "name : value"
- * within the style attribute''.
- *
- * That's fairly ambiguous. Is a `value' allowed to contain semicolons?
- * Why does it say "including", what else is allowed in the style
- * attribute value?
- */
- style->_mergeString( p );
-}
-
/** Indexed by SP_CSS_FONT_SIZE_blah. These seem a bit small */
static float const font_size_table[] = {6.0, 8.0, 10.0, 12.0, 14.0, 18.0, 24.0};
-// Called in sp-object.cpp, sp-tref.cpp, sp-use.cpp
-/**
- * Sets computed values in \a style, which may involve inheriting from (or in some other way
- * calculating from) corresponding computed values of \a parent.
- *
- * References: http://www.w3.org/TR/SVG11/propidx.html shows what properties inherit by default.
- * http://www.w3.org/TR/SVG11/styling.html#Inheritance gives general rules as to what it means to
- * inherit a value. http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value is more precise
- * about what the computed value is (not obvious for lengths).
- *
- * \pre \a parent's computed values are already up-to-date.
- */
-void
-sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent)
-{
- // std::cout << "sp_style_merge_from_parent" << std::endl;
- g_return_if_fail(style != NULL);
-
- if (!parent)
- return;
-
- style->cascade( parent );
- return;
-}
-
-// Called in: sp-use.cpp, sp-tref.cpp, sp-item.cpp
-/**
- * Combine \a style and \a parent style specifications into a single style specification that
- * preserves (as much as possible) the effect of the existing \a style being a child of \a parent.
- *
- * Called when the parent repr is to be removed (e.g. the parent is a \<use\> element that is being
- * unlinked), in which case we copy/adapt property values that are explicitly set in \a parent,
- * trying to retain the same visual appearance once the parent is removed. Interesting cases are
- * when there is unusual interaction with the parent's value (opacity, display) or when the value
- * can be specified as relative to the parent computed value (font-size, font-weight etc.).
- *
- * Doesn't update computed values of \a style. For correctness, you should subsequently call
- * sp_style_merge_from_parent against the new parent (presumably \a parent's parent) even if \a
- * style was previously up-to-date wrt \a parent.
- *
- * \pre \a parent's computed values are already up-to-date.
- * (\a style's computed values needn't be up-to-date.)
- */
-void
-sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const parent)
-{
- // std::cout << "sp_style_merge_from_dying_parent" << std::endl;
- style->merge( parent );
-}
-
// The following functions should be incorporated into SPIPaint. FIXME
// Called in: style.cpp, style-internal.cpp
void
@@ -1473,50 +1403,6 @@ sp_style_css_size_units_to_px(double size, int unit)
return size * (size / sp_style_css_size_px_to_units(size, unit));;
}
-// Called in style.cpp, text-editing.cpp
-/**
- * Dumps the style to a CSS string, with either SP_STYLE_FLAG_IFSET or
- * SP_STYLE_FLAG_ALWAYS flags. Used with Always for copying an object's
- * complete cascaded style to style_clipboard. When you need a CSS string
- * for an object in the document tree, you normally call
- * sp_style_write_difference instead to take into account the object's parent.
- *
- * \pre style != NULL.
- * \pre flags in {IFSET, ALWAYS}.
- * \post ret != NULL.
- */
-gchar *
-sp_style_write_string(SPStyle const *const style, guint const flags)
-{
- /** \todo
- * Merge with write_difference, much duplicate code!
- */
- g_return_val_if_fail(style != NULL, NULL);
- g_return_val_if_fail(((flags == SP_STYLE_FLAG_IFSET) ||
- (flags == SP_STYLE_FLAG_ALWAYS) ),
- NULL);
-
- return g_strdup( style->write( flags ).c_str() );
-}
-
-
-// Called in style.cpp, path-chemistry, NOT in text-editting.cpp (because of bug)
-/**
- * Dumps style to CSS string, see sp_style_write_string()
- *
- * \pre from != NULL.
- * \pre to != NULL.
- * \post ret != NULL.
- */
-gchar *
-sp_style_write_difference(SPStyle const *const from, SPStyle const *const to)
-{
- g_return_val_if_fail(from != NULL, NULL);
- g_return_val_if_fail(to != NULL, NULL);
-
- return g_strdup( from->write( SP_STYLE_FLAG_IFDIFF, to ).c_str() );
-}
-
// FIXME: Everything below this line belongs in a different file - css-chemistry?
@@ -1677,10 +1563,9 @@ sp_css_attr_from_style(SPStyle const *const style, guint const flags)
g_return_val_if_fail(((flags == SP_STYLE_FLAG_IFSET) ||
(flags == SP_STYLE_FLAG_ALWAYS) ),
NULL);
- gchar *style_str = sp_style_write_string(style, flags);
+ Glib::ustring style_str = style->write(flags);
SPCSSAttr *css = sp_repr_css_attr_new();
- sp_repr_css_attr_add_from_string(css, style_str);
- g_free(style_str);
+ sp_repr_css_attr_add_from_string(css, style_str.c_str());
return css;
}
diff --git a/src/style.h b/src/style.h
index 1b1596458..3f21f37db 100644
--- a/src/style.h
+++ b/src/style.h
@@ -51,18 +51,19 @@ public:
void readFromObject(SPObject *object);
void readFromPrefs(Glib::ustring const &path);
void readIfUnset( int id, char const *val );
- Glib::ustring write( unsigned int const flags, SPStyle const *const base = NULL ) const;
+ Glib::ustring write( unsigned int const flags = SP_STYLE_FLAG_IFSET,
+ SPStyle const *const base = NULL ) const;
void cascade( SPStyle const *const parent );
void merge( SPStyle const *const parent );
+ void mergeString( char const *const p );
bool operator==(const SPStyle& rhs);
- int ref() { ++_refcount; return _refcount; }
- int unref() { --_refcount; return _refcount; }
+ int style_ref() { ++_refcount; return _refcount; }
+ int style_unref() { --_refcount; return _refcount; }
+ int refCount() { return _refcount; }
-//FIXME: Make private
-public:
- void _mergeString( char const *const p ); // Rename to readFromString?
private:
+ void _mergeString( char const *const p );
void _mergeDeclList( CRDeclaration const *const decl_list );
void _mergeDecl( CRDeclaration const *const decl );
void _mergeProps( CRPropList *const props );
@@ -282,28 +283,10 @@ public:
char const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : NULL; }
};
-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();
-void sp_style_read_from_object(SPStyle *style, SPObject *object); //SPStyle::read( SPObject * object);
-
-void sp_style_read_from_prefs(SPStyle *style, Glib::ustring const &path); // SPStyle::read( ... );
-
-void sp_style_merge_from_style_string(SPStyle *style, char const *p); // SPStyle::merge( ... );?
-
-void sp_style_merge_from_parent(SPStyle *style, SPStyle const *parent); // SPStyle::cascade( ... );
-
-void sp_style_merge_from_dying_parent(SPStyle *style, SPStyle const *parent); // SPStyle::merge( ... )
-
-char *sp_style_write_string(SPStyle const *style, unsigned int flags = SP_STYLE_FLAG_IFSET);//SPStyle::write
-
-char *sp_style_write_difference(SPStyle const *from, SPStyle const *to); // SPStyle::write
-
void sp_style_set_to_uri_string (SPStyle *style, bool isfill, const char *uri); // ?
char const *sp_style_get_css_unit_string(int unit); // No change?
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index aa2d81427..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"
@@ -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);
@@ -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 <b>a text and a path</b> to put text on path."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text and a path</b> 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 <b>already put on a path</b>. Remove it from the path first. Use <b>Shift+D</b> to look up its path."));
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("This text object is <b>already put on a path</b>. Remove it from the path first. Use <b>Shift+D</b> to look up its path."));
return;
}
if (SP_IS_RECT(shape)) {
// rect is the only SPShape which is not <path> 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 <b>visible</b> in order to be put on a path."));
}
@@ -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);
}
@@ -191,10 +191,10 @@ 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 <b>a text on path</b> to remove it from path."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text on path</b> to remove it from path."));
return;
}
@@ -215,9 +215,9 @@ text_remove_from_path()
}
if (!did) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No texts-on-paths</b> in the selection."));
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No texts-on-paths</b> 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
}
@@ -256,10 +256,10 @@ 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 <b>text(s)</b> to remove kerns from."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>text(s)</b> to remove kerns from."));
return;
}
@@ -280,9 +280,9 @@ text_remove_all_kerns()
}
if (!did) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("Select <b>text(s)</b> to remove kerns from."));
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("Select <b>text(s)</b> 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,16 +294,16 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
SPItem *text = text_or_flowtext_in_selection(selection);
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 <b>a text</b> and one or more <b>paths or shapes</b> to flow text into frame."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text</b> and one or more <b>paths or shapes</b> to flow text into frame."));
return;
}
@@ -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);
@@ -388,14 +388,14 @@ 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 = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (!flowtext_in_selection(selection) || g_slist_length((GSList *) selection->itemList()) < 1) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a flowed text</b> to unflow it."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a flowed text</b> to unflow it."));
return;
}
@@ -477,10 +477,10 @@ 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,
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE,
_("Select <b>flowed text(s)</b> 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 <b>visible</b> in order to be converted."));
return;
@@ -512,7 +512,7 @@ flowtext_to_text()
Inkscape::XML::Node *parent = item->getRepr()->parent();
parent->addChild(repr, item->getRepr());
- SPItem *new_item = reinterpret_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr));
+ SPItem *new_item = reinterpret_cast<SPItem *>(desktop->getDocument()->getObjectByRepr(repr));
new_item->doWriteTransform(repr, item->transform);
new_item->updateRepr();
@@ -525,12 +525,12 @@ 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);
} else {
- sp_desktop_message_stack(desktop)->
+ desktop->getMessageStack()->
flash(Inkscape::ERROR_MESSAGE,
_("<b>No flowed text(s)</b> to convert in the selection."));
}
diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index 47964880c..4a962ab4c 100644
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
@@ -1321,23 +1321,23 @@ static unsigned char_index_of_iterator(Glib::ustring const &string, Glib::ustrin
return n;
}
+// Move to style.h?
/** applies the given style string on top of the existing styles for \a item,
as opposed to sp_style_merge_from_style_string which merges its parameter
underneath the existing styles (ie ignoring already set properties). */
static void overwrite_style_with_string(SPObject *item, gchar const *style_string)
{
- SPStyle *new_style = sp_style_new(item->document);
- sp_style_merge_from_style_string(new_style, style_string);
+ SPStyle style(item->document);
+ style.mergeString(style_string);
gchar const *item_style_string = item->getRepr()->attribute("style");
if (item_style_string && *item_style_string) {
- sp_style_merge_from_style_string(new_style, item_style_string);
+ style.mergeString(item_style_string);
}
- gchar *new_style_string = sp_style_write_string(new_style);
- sp_style_unref(new_style);
- item->getRepr()->setAttribute("style", new_style_string && *new_style_string ? new_style_string : NULL);
- g_free(new_style_string);
+ Glib::ustring new_style_string = style.write();
+ item->getRepr()->setAttribute("style", new_style_string.empty() ? NULL : new_style_string.c_str());
}
+// Move to style.h?
/** Returns true if the style of \a parent and the style of \a child are
equivalent (and hence the children of both will appear the same). It is a
limitation of the current implementation that \a parent must be a (not
@@ -1349,14 +1349,14 @@ static bool objects_have_equal_style(SPObject const *parent, SPObject const *chi
// implications too large for me to feel safe fixing, but mainly because the css spec
// requires that the computed value is inherited, not the specified value.
g_assert(parent->isAncestorOf(child));
- gchar *parent_style = sp_style_write_string(parent->style, SP_STYLE_FLAG_ALWAYS);
+
+ Glib::ustring parent_style = parent->style->write( SP_STYLE_FLAG_ALWAYS );
+
// we have to write parent_style then read it again, because some properties format their values
// differently depending on whether they're set or not (*cough*dash-offset*cough*)
- SPStyle *parent_spstyle = sp_style_new(parent->document);
- sp_style_merge_from_style_string(parent_spstyle, parent_style);
- g_free(parent_style);
- parent_style = sp_style_write_string(parent_spstyle, SP_STYLE_FLAG_ALWAYS);
- sp_style_unref(parent_spstyle);
+ SPStyle parent_spstyle(parent->document);
+ parent_spstyle.mergeString(parent_style.c_str());
+ parent_style = parent_spstyle.write(SP_STYLE_FLAG_ALWAYS);
Glib::ustring child_style_construction;
while (child != parent) {
@@ -1369,13 +1369,12 @@ static bool objects_have_equal_style(SPObject const *parent, SPObject const *chi
child = child->parent;
}
child_style_construction.insert(0, parent_style);
- SPStyle *child_spstyle = sp_style_new(parent->document);
- sp_style_merge_from_style_string(child_spstyle, child_style_construction.c_str());
- gchar *child_style = sp_style_write_string(child_spstyle, SP_STYLE_FLAG_ALWAYS);
- sp_style_unref(child_spstyle);
- bool equal = !strcmp(child_style, parent_style);
- g_free(child_style);
- g_free(parent_style);
+
+ SPStyle child_spstyle(parent->document);
+ child_spstyle.mergeString(child_style_construction.c_str());
+ Glib::ustring child_style = child_spstyle.write(SP_STYLE_FLAG_ALWAYS);
+
+ bool equal = (child_style == parent_style); // Glib::ustring overloads == operator
return equal;
}
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 <inkscape.h>
-#include <desktop-handles.h>
+#include "desktop.h"
#include "message-stack.h"
#include <sp-path.h>
#include <svg/path-string.h>
@@ -510,7 +510,7 @@ std::vector<TracingEngineResult> 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<TracingEngineResult> 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 cb83541e3..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"
@@ -51,9 +51,9 @@ SPImage *Tracer::getSelectedSPImage()
return NULL;
}
- Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop);
+ Inkscape::MessageStack *msgStack = desktop->getMessageStack();
- Inkscape::Selection *sel = sp_desktop_selection(desktop);
+ Inkscape::Selection *sel = desktop->getSelection();
if (!sel)
{
char *msg = _("Select an <b>image</b> to trace");
@@ -217,9 +217,9 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::sioxProcessImage(SPImage *img, Glib::RefPtr<Gd
return Glib::RefPtr<Gdk::Pixbuf>(NULL);
}
- Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop);
+ Inkscape::MessageStack *msgStack = desktop->getMessageStack();
- Inkscape::Selection *sel = sp_desktop_selection(desktop);
+ Inkscape::Selection *sel = desktop->getSelection();
if (!sel)
{
char *msg = _("Select an <b>image</b> to trace");
@@ -397,9 +397,9 @@ void Tracer::traceThread()
return;
}
- Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop);
+ Inkscape::MessageStack *msgStack = desktop->getMessageStack();
- 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 7c82fb230..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"
@@ -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()) {
@@ -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 <use> rather than <symbol> so it can be changed.
use->setAttribute("style", style );
-
- Inkscape::XML::Node *nv_repr = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getRepr();
+/* disable rev 13709 in rev 13806, following Bug 1365451, comments 13-16
+ 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);
g_free(transform_str);
-
+*/
_root->appendChild(use);
// This min and max sets offsets, we don't have any so set to zero.
@@ -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 <b>object(s)</b> 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 <b>object(s)</b> 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 <b>object(s)</b> 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..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"
@@ -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();
@@ -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<SPItem *>::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"));
}
}
@@ -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;
@@ -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"));
}
}
@@ -458,13 +458,12 @@ 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);
- DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Remove overlaps"));
}
};
@@ -490,12 +489,12 @@ 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);
- 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"));
}
};
@@ -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;
@@ -588,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"));
}
};
@@ -617,12 +616,12 @@ 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);
- DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+ DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Unclump"));
}
};
@@ -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;
@@ -677,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
@@ -694,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"));
}
};
@@ -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;
@@ -797,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"));
}
@@ -820,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 37881d4ae..fede30b26 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -27,7 +27,7 @@
#include <gtkmm/adjustment.h>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "display/cairo-utils.h"
#include "display/drawing.h"
#include "display/drawing-context.h"
@@ -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));
{
@@ -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,11 +2093,11 @@ 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) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to unclump."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to unclump."));
return;
}
@@ -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"));
}
@@ -2144,11 +2144,11 @@ 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) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to remove."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to remove."));
return;
}
@@ -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"));
}
}
@@ -2216,17 +2216,17 @@ 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()) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select an <b>object</b> to clone."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select an <b>object</b> 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, <b>group</b> them and <b>clone the group</b>."));
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("If you want to clone several objects, <b>group</b> them and <b>clone the group</b>."));
return;
}
@@ -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<SPItem *>(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<SPItem *>(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 6dabcfb6b..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"
@@ -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/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp
index 820d5a8bb..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"
@@ -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..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"
@@ -186,9 +186,9 @@ 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();
+ Inkscape::XML::Node *root = getDesktop()->getDocument()->getRoot()->getRepr();
root->addListener (&_repr_events, this);
show_all_children();
@@ -197,9 +197,9 @@ 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();
+ Inkscape::XML::Node *root = getDesktop()->getDocument()->getRoot()->getRepr();
root->removeListenerByData (this);
for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it)
@@ -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(_("<b>Creation</b>"));
@@ -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);
@@ -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());
@@ -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,18 +1601,18 @@ 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();
+ Inkscape::XML::Node *root = desktop->getDocument()->getRoot()->getRepr();
root->addListener(&_repr_events, this);
update();
}
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();
+ Inkscape::XML::Node *root = desktop->getDocument()->getRoot()->getRepr();
root->removeListenerByData(this);
}
@@ -1647,8 +1647,8 @@ 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();
- SPDocument *doc = sp_desktop_document(dt);
+ Inkscape::XML::Node *repr = dt->getNamedView()->getRepr();
+ SPDocument *doc = dt->getDocument();
Glib::ustring typestring = _grids_combo_gridtype.get_active_text();
CanvasGrid::writeNewGridToRepr(repr, doc, CanvasGrid::getGridTypeFromName(typestring.c_str()));
@@ -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.
@@ -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"));
}
}
@@ -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 1ebd1fc7c..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"
@@ -206,7 +205,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);
@@ -606,7 +605,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 +621,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 +659,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) {
@@ -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(),
@@ -696,7 +695,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)
@@ -736,16 +735,16 @@ 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
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 +809,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")) {
@@ -1002,8 +1001,8 @@ void Export::onExport ()
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (!desktop) return;
- SPNamedView *nv = sp_desktop_namedview(desktop);
- SPDocument *doc = sp_desktop_document (desktop);
+ SPNamedView *nv = desktop->getNamedView();
+ SPDocument *doc = desktop->getDocument();
bool exportSuccessful = false;
@@ -1011,7 +1010,7 @@ void Export::onExport ()
if (batch_export.get_active ()) {
// Batch export of selected objects
- gint num = g_slist_length(const_cast<GSList *>(sp_desktop_selection(desktop)->itemList()));
+ gint num = g_slist_length(const_cast<GSList *>(desktop->getSelection()->itemList()));
gint n = 0;
if (num < 1) {
@@ -1025,7 +1024,7 @@ void Export::onExport ()
gint export_count = 0;
- for (GSList *i = const_cast<GSList *>(sp_desktop_selection(desktop)->itemList()); i && !interrupted; i = i->next) {
+ for (GSList *i = const_cast<GSList *>(desktop->getSelection()->itemList()); i && !interrupted; i = i->next) {
SPItem *item = reinterpret_cast<SPItem *>(i->data);
prog_dlg->set_data("current", GINT_TO_POINTER(n));
@@ -1070,7 +1069,7 @@ void Export::onExport ()
nv->pagecolor,
onProgressCallback, (void*)prog_dlg,
TRUE, // overwrite without asking
- hide ? const_cast<GSList *>(sp_desktop_selection(desktop)->itemList()) : NULL
+ hide ? const_cast<GSList *>(desktop->getSelection()->itemList()) : NULL
)) {
gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
@@ -1154,12 +1153,12 @@ 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,
FALSE,
- hide ? const_cast<GSList *>(sp_desktop_selection(desktop)->itemList()) : NULL
+ hide ? const_cast<GSList *>(desktop->getSelection()->itemList()) : NULL
);
if (status == EXPORT_ERROR) {
gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str());
@@ -1231,7 +1230,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<Inkscape::XML::Node *>(reprlst->data);
@@ -1463,8 +1462,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;
@@ -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 bd44846a3..3da0e0043 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -33,7 +33,7 @@
#include <glibmm/stringutils.h>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "dir-util.h"
#include "document.h"
#include "document-undo.h"
@@ -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;
@@ -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();
@@ -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);
}
@@ -1537,9 +1537,9 @@ 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 = 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)
@@ -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 1a7832688..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"
@@ -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<SPText *>(item) || dynamic_cast<SPFlowtext *>(item)) {
@@ -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);
@@ -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<SPObject *>(n->data);
@@ -859,13 +859,13 @@ 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 {
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..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"
@@ -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/glyphs.cpp b/src/ui/dialog/glyphs.cpp
index 9bad90e7c..2b9053da9 100644
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
@@ -709,13 +709,12 @@ void GlyphsPanel::readSelection( bool updateStyle, bool /*updateContent*/ )
calcCanInsert();
if (targetDesktop && updateStyle) {
- //SPStyle *query = sp_style_new(SP_ACTIVE_DOCUMENT);
+ //SPStyle query(SP_ACTIVE_DOCUMENT);
- //int result_family = sp_desktop_query_style(targetDesktop, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
- //int result_style = sp_desktop_query_style(targetDesktop, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
- //int result_numbers = sp_desktop_query_style(targetDesktop, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ //int result_family = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTFAMILY);
+ //int result_style = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTSTYLE);
+ //int result_numbers = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
- //sp_style_unref(query);
}
}
diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp
index 2ff647a74..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,9 +165,9 @@ void GridArrangeTab::arrange()
grid_top = 99999;
SPDesktop *desktop = Parent->getDesktop();
- sp_desktop_document(desktop)->ensureUpToDate();
+ desktop->getDocument()->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) {
@@ -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 <glibmm/i18n.h>
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 468e85d36..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"
@@ -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..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 <iostream>
#include "enums.h"
-#include "desktop-handles.h"
+
#include "extension/internal/gdkpixbuf-input.h"
#include "message-stack.h"
#include "style.h"
@@ -213,10 +213,10 @@ 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,
+ desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE,
_("<b>No objects selected</b> 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,
_("<b>More than one object selected.</b> Cannot take style from multiple objects."));
return;
}
diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index d5540b88a..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"));
@@ -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..3b87597c8 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -23,7 +23,7 @@
#include <vector>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "document.h"
#include "document-undo.h"
#include "gtkmm/widget.h"
@@ -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(
@@ -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 cfa5c6182..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"
@@ -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..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"
@@ -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..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"
@@ -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
@@ -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 9faa8a2cb..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);
@@ -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();
@@ -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 56ecfdecc..bc228633d 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -29,7 +29,8 @@
#include "xml/node.h"
#include "xml/repr.h"
#include "sp-font-face.h"
-#include "desktop-handles.h"
+#include "desktop.h"
+
#include "display/nr-svgfonts.h"
#include "verbs.h"
#include "sp-glyph.h"
@@ -181,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:";
@@ -264,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();
@@ -481,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"));
@@ -514,9 +515,9 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){
return;
}
- Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop);
- SPDocument* doc = sp_desktop_document(desktop);
- Inkscape::Selection* sel = sp_desktop_selection(desktop);
+ Inkscape::MessageStack *msgStack = desktop->getMessageStack();
+ SPDocument* doc = desktop->getDocument();
+ Inkscape::Selection* sel = desktop->getSelection();
if (sel->isEmpty()){
char *msg = _("Select a <b>path</b> to define the curves of a glyph");
msgStack->flash(Inkscape::ERROR_MESSAGE, msg);
@@ -556,9 +557,9 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){
return;
}
- Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop);
- SPDocument* doc = sp_desktop_document(desktop);
- Inkscape::Selection* sel = sp_desktop_selection(desktop);
+ Inkscape::MessageStack *msgStack = desktop->getMessageStack();
+ SPDocument* doc = desktop->getDocument();
+ Inkscape::Selection* sel = desktop->getSelection();
if (sel->isEmpty()){
char *msg = _("Select a <b>path</b> to define the curves of a glyph");
msgStack->flash(Inkscape::ERROR_MESSAGE, msg);
@@ -597,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)){
@@ -618,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();
@@ -632,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();
@@ -644,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();
@@ -661,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();
@@ -678,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();
@@ -749,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
@@ -863,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();
@@ -937,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 187e31233..8759039c3 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"
@@ -122,15 +122,15 @@ 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() );
- int result = objects_query_fillstroke(const_cast<GSList *>(items), query, true);
+ SPStyle query( desktop->doc() );
+ int result = objects_query_fillstroke(const_cast<GSList *>(items), &query, true);
if ( (result == QUERY_STYLE_MULTIPLE_SAME) || (result == QUERY_STYLE_SINGLE) ) {
// could be pertinent
- if (query->fill.isPaintserver()) {
- SPPaintServer* server = query->getFillPaintServer();
+ if (query.fill.isPaintserver()) {
+ SPPaintServer* server = query.getFillPaintServer();
if ( SP_IS_GRADIENT(server) ) {
SPGradient* grad = SP_GRADIENT(server);
if ( grad->isSwatch() && grad->getId() == gr->getId()) {
@@ -140,7 +140,6 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr )
}
}
}
- sp_style_unref(query);
}
}
@@ -1061,15 +1060,15 @@ void SwatchesPanel::_updateFromSelection()
Glib::ustring fillId;
Glib::ustring strokeId;
- SPStyle *tmpStyle = sp_style_new( sp_desktop_document(_currentDesktop) );
- int result = sp_desktop_query_style( _currentDesktop, tmpStyle, QUERY_STYLE_PROPERTY_FILL );
+ SPStyle tmpStyle(_currentDesktop->getDocument());
+ int result = sp_desktop_query_style( _currentDesktop, &tmpStyle, QUERY_STYLE_PROPERTY_FILL );
switch (result) {
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_AVERAGED:
case QUERY_STYLE_MULTIPLE_SAME:
{
- if (tmpStyle->fill.set && tmpStyle->fill.isPaintserver()) {
- SPPaintServer* server = tmpStyle->getFillPaintServer();
+ if (tmpStyle.fill.set && tmpStyle.fill.isPaintserver()) {
+ SPPaintServer* server = tmpStyle.getFillPaintServer();
if ( SP_IS_GRADIENT(server) ) {
SPGradient* target = 0;
SPGradient* grad = SP_GRADIENT(server);
@@ -1095,14 +1094,14 @@ void SwatchesPanel::_updateFromSelection()
}
}
- result = sp_desktop_query_style( _currentDesktop, tmpStyle, QUERY_STYLE_PROPERTY_STROKE );
+ result = sp_desktop_query_style( _currentDesktop, &tmpStyle, QUERY_STYLE_PROPERTY_STROKE );
switch (result) {
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_AVERAGED:
case QUERY_STYLE_MULTIPLE_SAME:
{
- if (tmpStyle->stroke.set && tmpStyle->stroke.isPaintserver()) {
- SPPaintServer* server = tmpStyle->getStrokePaintServer();
+ if (tmpStyle.stroke.set && tmpStyle.stroke.isPaintserver()) {
+ SPPaintServer* server = tmpStyle.getStrokePaintServer();
if ( SP_IS_GRADIENT(server) ) {
SPGradient* target = 0;
SPGradient* grad = SP_GRADIENT(server);
@@ -1126,7 +1125,6 @@ void SwatchesPanel::_updateFromSelection()
break;
}
}
- sp_style_unref(tmpStyle);
for ( boost::ptr_vector<ColorItem>::iterator it = docPalette->_colors.begin(); it != docPalette->_colors.end(); ++it ) {
ColorItem* item = &*it;
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 0f4a6f7f1..a8be8b543 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"
@@ -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
@@ -344,47 +344,46 @@ 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();
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;
}
@@ -419,7 +418,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 +437,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 +542,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 +568,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);
}
@@ -583,7 +582,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 +657,7 @@ void TextEdit::onStartOffsetChange(GtkTextBuffer * /*text_buffer*/, TextEdit *se
const gchar *sstr = gtk_combo_box_text_get_active_text(reinterpret_cast<GtkComboBoxText *>(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 2c6692777..233d99750 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -25,7 +25,8 @@
#include "document.h"
#include "document-undo.h"
-#include "desktop-handles.h"
+#include "desktop.h"
+
#include "transformation.h"
#include "align-and-distribute.h"
#include "inkscape.h"
@@ -205,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);
}
@@ -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());
}
@@ -801,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"));
}
@@ -863,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"));
}
@@ -888,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"));
}
@@ -903,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, <b>not used</b>."));
+ getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
sp_item_skew_rel (item, 0.01*skewX, 0.01*skewY);
@@ -914,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, <b>not used</b>."));
+ getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
double skewX = tan(-angleX);
@@ -928,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, <b>not used</b>."));
+ getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
sp_item_skew_rel (item, skewX/height, skewY/width);
@@ -947,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, <b>not used</b>."));
+ getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
sp_selection_skew_relative(selection, *center, 0.01*skewX, 0.01*skewY);
@@ -958,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, <b>not used</b>."));
+ getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
double skewX = tan(-angleX);
@@ -968,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, <b>not used</b>."));
+ getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
sp_selection_skew_relative(selection, *center, skewX/height, skewY/width);
@@ -976,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"));
}
@@ -992,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, <b>not used</b>."));
+ getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
@@ -1006,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 7ab6c78ba..c02520218 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -23,7 +23,7 @@
#include <gtkmm/stock.h>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "ui/dialog-events.h"
#include "document.h"
#include "document-undo.h"
@@ -360,10 +360,10 @@ 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));
+ set_tree_document(desktop->getDocument());
} else {
set_tree_document(NULL);
}
@@ -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) {
@@ -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;
}
@@ -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/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/interface.cpp b/src/ui/interface.cpp
index 6bc94ab7a..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"
@@ -1232,12 +1232,12 @@ 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
{
- 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 <string.h>
#include <glibmm/i18n.h>
-#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 e98c7b2a2..bcf5c9fce 100644
--- a/src/ui/tool/control-point.cpp
+++ b/src/ui/tool/control-point.cpp
@@ -11,7 +11,7 @@
#include <gdkmm.h>
#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"
@@ -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/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 <glibmm/i18n.h>
#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 8b99c33b8..c8b986824 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -23,7 +23,7 @@
#include <glibmm/i18n.h>
#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"
@@ -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,
@@ -1617,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 bdeacadc9..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"
@@ -37,7 +37,7 @@ public:
_cancel(false)
{
setVisible(false);
- _rubber = static_cast<CtrlRect*>(sp_canvas_item_new(sp_desktop_controls(_desktop),
+ _rubber = static_cast<CtrlRect*>(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..da2a54989 100644
--- a/src/ui/tool/transform-handle-set.cpp
+++ b/src/ui/tool/transform-handle-set.cpp
@@ -15,7 +15,7 @@
#include <glib/gi18n.h>
#include <2geom/transforms.h>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "display/sodipodi-ctrlrect.h"
#include "preferences.h"
#include "snap.h"
@@ -686,7 +686,7 @@ TransformHandleSet::TransformHandleSet(SPDesktop *d, SPCanvasGroup *th_group)
, _in_transform(false)
, _visible(true)
{
- _trans_outline = static_cast<CtrlRect*>(sp_canvas_item_new(sp_desktop_controls(_desktop),
+ _trans_outline = static_cast<CtrlRect*>(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-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 <glibmm/i18n.h>
#include <xml/repr.h>
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp
index 9c3195a42..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"
@@ -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,16 +442,16 @@ 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"));
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ARC, _("Create ellipse"));
this->arc = NULL;
}
}
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) {
@@ -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 0a20a0842..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"
@@ -145,17 +145,17 @@ 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)
);
- 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,8 +195,8 @@ bool Box3dTool::item_handler(SPItem* item, GdkEvent* event) {
bool Box3dTool::root_handler(GdkEvent* event) {
static bool dragging;
- SPDocument *document = sp_desktop_document (desktop);
- Inkscape::Selection *selection = sp_desktop_selection (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);
@@ -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;
@@ -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;
@@ -604,8 +604,8 @@ void Box3dTool::finishItem() {
desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(desktop)->set(this->box3d);
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX,
+ desktop->getSelection()->set(this->box3d);
+ 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 d297fe5e1..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"
@@ -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);
@@ -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();
@@ -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);
@@ -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);
}
}
@@ -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"));
}
@@ -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 23450fcbd..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"
@@ -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(
@@ -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,
@@ -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,9 +1309,9 @@ void cc_selection_set_avoid(bool const set_avoid)
return;
}
- SPDocument *document = sp_desktop_document(desktop);
+ SPDocument *document = desktop->getDocument();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
GSList *l = const_cast<GSList *>(selection->itemList());
diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp
index 6c55f7484..9038628ee 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"
@@ -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() {
@@ -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();
@@ -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);
}
@@ -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,14 +238,14 @@ 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);
}
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);
@@ -324,12 +324,12 @@ 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);
}
- if (!(sp_desktop_selection(desktop)->isEmpty())) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER,
+ if (!(desktop->getSelection()->isEmpty())) {
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_DROPPER,
_("Set picked color"));
}
@@ -359,11 +359,11 @@ 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)) {
- 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/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index bf4015b4c..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"
@@ -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);
@@ -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;
@@ -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());
}
}
@@ -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/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index 5745fc9cc..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"
@@ -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)
);
@@ -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;
@@ -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 <b>%d</b> node created and unioned with selection.","Area filled, path with <b>%d</b> 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 <b>%d</b> node created.","Area filled, path with <b>%d</b> nodes created.",
@@ -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();
@@ -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);
@@ -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;
}
@@ -1229,9 +1229,9 @@ 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"));
+ 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 32702a17e..0f14d7534 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -27,7 +27,7 @@
#include <glibmm/i18n.h>
#include "display/curve.h"
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "desktop-style.h"
#include "document.h"
#include "ui/draw-anchor.h"
@@ -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(
@@ -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
@@ -247,11 +247,9 @@ static void spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points
char const *style_str = NULL;
style_str = repr->attribute("style");
if (style_str) {
- SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
- sp_style_merge_from_style_string(style, style_str);
- stroke_width = style->stroke_width.computed;
- style->stroke_width.computed = 0;
- sp_style_unref(style);
+ SPStyle style(SP_ACTIVE_DOCUMENT);
+ style.mergeString(style_str);
+ stroke_width = style.stroke_width.computed;
}
std::ostringstream s;
@@ -500,7 +498,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
@@ -667,7 +665,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() ) {
@@ -715,7 +713,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();
@@ -821,14 +819,11 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too
// find out stroke width (TODO: is there an easier way??)
double stroke_width = 3.0;
- gchar const *style_str = NULL;
- style_str = repr->attribute("style");
+ gchar const *style_str = repr->attribute("style");
if (style_str) {
- SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
- sp_style_merge_from_style_string(style, style_str);
- stroke_width = style->stroke_width.computed;
- style->stroke_width.computed = 0;
- sp_style_unref(style);
+ SPStyle style(SP_ACTIVE_DOCUMENT);
+ style.mergeString(style_str);
+ stroke_width = style.stroke_width.computed;
}
// unset stroke and set fill color to former stroke color
@@ -862,10 +857,10 @@ 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"));
+ 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 9c853917e..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"
@@ -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)
@@ -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();
@@ -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);
@@ -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;
@@ -892,8 +892,8 @@ 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);
- SPDocument *document = sp_desktop_document(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
+ SPDocument *document = desktop->getDocument();
ToolBase *ec = SP_EVENT_CONTEXT(&rc);
if (!selection->isEmpty()) {
@@ -957,7 +957,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta
"<b>Gradient</b> for %d objects; with <b>Ctrl</b> to snap angle", n_objects),
n_objects);
} else {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>objects</b> on which to create gradient."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>objects</b> on which to create gradient."));
}
}
diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp
index 1fd1ebf8c..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"
@@ -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,12 +305,12 @@ 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?
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);
@@ -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);
}
@@ -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);
@@ -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..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"
@@ -228,7 +228,7 @@ void createAngleDisplayCurve(SPDesktop *desktop, Geom::Point const &center, 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));
}
@@ -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<double> intersection_times;
for (GSList *l = items; l != NULL; l = l->next) {
SPItem *item = static_cast<SPItem*>(l->data);
@@ -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/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp
index 8a1fb7c72..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"
@@ -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)
@@ -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();
@@ -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);
@@ -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"));
}
@@ -933,8 +933,8 @@ 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);
- SPDocument *document = sp_desktop_document(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
+ SPDocument *document = desktop->getDocument();
ToolBase *ec = SP_EVENT_CONTEXT(&rc);
if (!selection->isEmpty()) {
@@ -994,7 +994,7 @@ static void sp_mesh_drag(MeshTool &rc, Geom::Point const /*pt*/, guint /*state*/
"<b>Gradient</b> for %d objects; with <b>Ctrl</b> to snap angle", n_objects),
n_objects);
} else {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>objects</b> on which to create gradient."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>objects</b> on which to create gradient."));
}
}
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index 838c2a884..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 <glib/gi18n.h>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "display/sp-canvas-group.h"
#include "display/canvas-bpath.h"
#include "display/curve.h"
@@ -155,7 +155,7 @@ NodeTool::NodeTool()
SPCanvasGroup *create_control_group(SPDesktop *d)
{
return reinterpret_cast<SPCanvasGroup*>(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)
@@ -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);
@@ -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,
@@ -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::NodeTool*>((Inkscape::UI::Tools::ToolBase*)obj))
#define INK_IS_NODE_TOOL(obj) (dynamic_cast<const Inkscape::UI::Tools::NodeTool*>((const Inkscape::UI::Tools::ToolBase*)obj))
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index 6b38020a4..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"
@@ -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);
@@ -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
@@ -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);
@@ -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..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"
@@ -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;
@@ -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();
diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp
index 67df0d9a5..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"
@@ -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,16 +476,16 @@ 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"));
+ DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_RECT, _("Create rectangle"));
this->rect = NULL;
}
}
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) {
@@ -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 a8267ea1d..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;
@@ -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);
}
}
}
@@ -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);
}
@@ -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<SPGroup *>(clicked_item) && !dynamic_cast<SPBox3D *>(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);
@@ -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);
@@ -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();
@@ -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);
}
@@ -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<SPGroup *>(clicked_item);
if ( (clickedGroup && (clickedGroup->layerMode() != SPGroup::LAYER)) || dynamic_cast<SPBox3D *>(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."));
}
@@ -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/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp
index 31c4e8829..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"
@@ -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,15 +417,15 @@ void SpiralTool::finishItem() {
this->desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(this->desktop)->set(this->spiral);
- DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_SPIRAL, _("Create spiral"));
+ this->desktop->getSelection()->set(this->spiral);
+ DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPIRAL, _("Create spiral"));
this->spiral = NULL;
}
}
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) {
@@ -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 cdc608558..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 <boost/optional.hpp>
@@ -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);
@@ -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;
@@ -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 b5544d263..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"
@@ -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,8 +441,8 @@ void StarTool::finishItem() {
desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(desktop)->set(this->star);
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
+ desktop->getSelection()->set(this->star);
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR,
_("Create star"));
this->star = NULL;
@@ -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) {
@@ -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 578add843..df0583d67 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -26,7 +26,7 @@
#include <sstream>
#include "context-fns.h"
-#include "desktop-handles.h"
+
#include "desktop-style.h"
#include "desktop.h"
#include "document.h"
@@ -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);
@@ -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.
@@ -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")) {
@@ -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);
@@ -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,13 +425,13 @@ 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();
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"));
}
}
@@ -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,9 +660,9 @@ 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"));
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Create flowed text"));
} else {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The frame is <b>too small</b> 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();
@@ -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;
@@ -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);
@@ -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);
@@ -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 37ca5eeea..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"
@@ -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);
}
@@ -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..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"
@@ -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);
@@ -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()) {
@@ -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 <glibmm/i18n.h>
#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 <glibmm/i18n.h>
#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 a377bf118..00a74c4fe 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -17,7 +17,7 @@
#include <glibmm/i18n.h>
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "desktop-style.h"
#include "document.h"
#include "document-undo.h"
@@ -104,14 +104,14 @@ ObjectCompositeSettings::_blendBlurValueChanged()
if (!desktop) {
return;
}
- SPDocument *document = sp_desktop_document (desktop);
+ SPDocument *document = desktop->getDocument();
if (_blocked)
return;
_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 ();
@@ -195,11 +195,11 @@ 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
- //sp_canvas_end_forced_full_redraws(sp_desktop_canvas(desktop));
+ //sp_canvas_end_forced_full_redraws(desktop->getCanvas());
_blocked = false;
}
@@ -219,8 +219,8 @@ ObjectCompositeSettings::_subjectChanged() {
return;
_blocked = true;
- SPStyle *query = sp_style_new (sp_desktop_document(desktop));
- int result = _subject->queryStyle(query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
+ SPStyle query(desktop->getDocument());
+ int result = _subject->queryStyle(&query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
switch (result) {
case QUERY_STYLE_NOTHING:
@@ -231,19 +231,19 @@ ObjectCompositeSettings::_subjectChanged() {
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently
case QUERY_STYLE_MULTIPLE_SAME:
_opacity_vbox.set_sensitive(true);
- _opacity_scale.get_adjustment()->set_value(100 * SP_SCALE24_TO_FLOAT(query->opacity.value));
+ _opacity_scale.get_adjustment()->set_value(100 * SP_SCALE24_TO_FLOAT(query.opacity.value));
break;
}
//query now for current filter mode and average blurring of selection
- const int blend_result = _subject->queryStyle(query, QUERY_STYLE_PROPERTY_BLEND);
+ const int blend_result = _subject->queryStyle(&query, QUERY_STYLE_PROPERTY_BLEND);
switch(blend_result) {
case QUERY_STYLE_NOTHING:
_fe_cb.set_sensitive(false);
break;
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_SAME:
- _fe_cb.set_blend_mode(query->filter_blend_mode.value);
+ _fe_cb.set_blend_mode(query.filter_blend_mode.value);
_fe_cb.set_sensitive(true);
break;
case QUERY_STYLE_MULTIPLE_DIFFERENT:
@@ -253,7 +253,7 @@ ObjectCompositeSettings::_subjectChanged() {
}
if(blend_result == QUERY_STYLE_SINGLE || blend_result == QUERY_STYLE_MULTIPLE_SAME) {
- int blur_result = _subject->queryStyle(query, QUERY_STYLE_PROPERTY_BLUR);
+ int blur_result = _subject->queryStyle(&query, QUERY_STYLE_PROPERTY_BLUR);
switch (blur_result) {
case QUERY_STYLE_NOTHING: //no blurring
_fe_cb.set_blur_sensitive(false);
@@ -266,7 +266,7 @@ ObjectCompositeSettings::_subjectChanged() {
double perimeter = bbox->dimensions()[Geom::X] + bbox->dimensions()[Geom::Y]; // fixme: this is only half the perimeter, is that correct?
_fe_cb.set_blur_sensitive(true);
//update blur widget value
- float radius = query->filter_gaussianBlur_deviation.value;
+ float radius = query.filter_gaussianBlur_deviation.value;
float percent = radius * 400 / perimeter; // so that for a square, 100% == half side
_fe_cb.set_blur_value(percent);
}
@@ -274,8 +274,6 @@ ObjectCompositeSettings::_subjectChanged() {
}
}
- sp_style_unref(query);
-
_blocked = false;
}
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index a18c3de9d..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"
@@ -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);
@@ -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 c96eac838..0cff25d88 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -33,7 +33,8 @@
#include "panel.h"
#include "icon-size.h"
#include "preferences.h"
-#include "desktop-handles.h"
+#include "desktop.h"
+
#include "inkscape.h"
#include "widgets/eek-preview.h"
#include "ui/previewfillable.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/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 4065bd550..bbf542987 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 "sp-root.h"
namespace Inkscape {
@@ -416,8 +419,8 @@ RegisteredColorPicker::on_changed (guint32 rgba)
SPDesktop *dt = SP_ACTIVE_DESKTOP;
if (!dt)
return;
- local_repr = sp_desktop_namedview(dt)->getRepr();
- local_doc = sp_desktop_document(dt);
+ local_repr = dt->getNamedView()->getRepr();
+ local_doc = dt->getDocument();
}
gchar c[32];
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 <gtkmm/checkbutton.h>
@@ -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<SPObject *>(sp_desktop_namedview(dt))->getRepr();
- local_doc = sp_desktop_document(dt);
+ local_repr = reinterpret_cast<SPObject *>(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 aebef2c4e..1fc67dcef 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"
@@ -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 (
@@ -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);
@@ -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(_desktop->getDocument());
for (int i = SS_FILL; i <= SS_STROKE; i++) {
Gtk::EventBox *place = (i == SS_FILL)? &_fill_place : &_stroke_place;
@@ -996,7 +995,7 @@ SelectedStyle::update()
_popup_copy[i].set_sensitive(false);
// query style from desktop. This returns a result flag and fills query with the style of subselection, if any, or selection
- int result = sp_desktop_query_style (_desktop, query,
+ int result = sp_desktop_query_style (_desktop, &query,
(i == SS_FILL)? QUERY_STYLE_PROPERTY_FILL : QUERY_STYLE_PROPERTY_STROKE);
switch (result) {
case QUERY_STYLE_NOTHING:
@@ -1021,12 +1020,12 @@ SelectedStyle::update()
}
SPIPaint *paint;
if (i == SS_FILL) {
- paint = &(query->fill);
+ paint = &(query.fill);
} else {
- paint = &(query->stroke);
+ paint = &(query.stroke);
}
if (paint->set && paint->isPaintserver()) {
- SPPaintServer *server = (i == SS_FILL)? SP_STYLE_FILL_SERVER (query) : SP_STYLE_STROKE_SERVER (query);
+ SPPaintServer *server = (i == SS_FILL)? SP_STYLE_FILL_SERVER (&query) : SP_STYLE_STROKE_SERVER (&query);
if ( server ) {
Inkscape::XML::Node *srepr = server->getRepr();
_paintserver_id[i] += "url(#";
@@ -1063,7 +1062,7 @@ SelectedStyle::update()
}
} else if (paint->set && paint->isColor()) {
guint32 color = paint->value.color.toRGBA32(
- SP_SCALE24_TO_FLOAT ((i == SS_FILL)? query->fill_opacity.value : query->stroke_opacity.value));
+ SP_SCALE24_TO_FLOAT ((i == SS_FILL)? query.fill_opacity.value : query.stroke_opacity.value));
_lastselected[i] = _thisselected[i];
_thisselected[i] = color; // include opacity
((Inkscape::UI::Widget::ColorPreview*)_color_preview[i])->setRgba32 (color);
@@ -1106,7 +1105,7 @@ SelectedStyle::update()
clearTooltip(_opacity_place);
clearTooltip(_opacity_sb);
- int result = sp_desktop_query_style (_desktop, query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
+ int result = sp_desktop_query_style (_desktop, &query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
switch (result) {
case QUERY_STYLE_NOTHING:
@@ -1123,16 +1122,16 @@ SelectedStyle::update()
_opacity_blocked = true;
_opacity_sb.set_sensitive(true);
#if WITH_GTKMM_3_0
- _opacity_adjustment->set_value(SP_SCALE24_TO_FLOAT(query->opacity.value) * 100);
+ _opacity_adjustment->set_value(SP_SCALE24_TO_FLOAT(query.opacity.value) * 100);
#else
- _opacity_adjustment.set_value(SP_SCALE24_TO_FLOAT(query->opacity.value) * 100);
+ _opacity_adjustment.set_value(SP_SCALE24_TO_FLOAT(query.opacity.value) * 100);
#endif
_opacity_blocked = false;
break;
}
// Now query stroke_width
- int result_sw = sp_desktop_query_style (_desktop, query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
+ int result_sw = sp_desktop_query_style (_desktop, &query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
switch (result_sw) {
case QUERY_STYLE_NOTHING:
_stroke_width.set_markup("");
@@ -1144,9 +1143,9 @@ SelectedStyle::update()
{
double w;
if (_sw_unit) {
- w = Inkscape::Util::Quantity::convert(query->stroke_width.computed, "px", _sw_unit);
+ w = Inkscape::Util::Quantity::convert(query.stroke_width.computed, "px", _sw_unit);
} else {
- w = query->stroke_width.computed;
+ w = query.stroke_width.computed;
}
current_stroke_width = w;
@@ -1169,8 +1168,6 @@ SelectedStyle::update()
default:
break;
}
-
- sp_style_unref(query);
}
void SelectedStyle::opacity_0(void) {_opacity_sb.set_value(0);}
@@ -1241,13 +1238,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,
+ DocumentUndo::maybeDone(_desktop->getDocument(), "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;
}
@@ -1385,25 +1382,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 <b>alpha</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Ctrl</b> to adjust lightness, with <b>Shift</b> 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 <b>saturation</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Ctrl</b> to adjust lightness, with <b>Alt</b> 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 <b>lightness</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Shift</b> to adjust saturation, with <b>Alt</b> 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 <b>hue</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Shift</b> to adjust saturation, with <b>Alt</b> to adjust alpha, with <b>Ctrl</b> to adjust lightness"), ch - diff, ch, diff);
@@ -1440,18 +1437,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 +1520,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 <b>stroke width</b>: was %.3g, now <b>%.3g</b> (diff %.3g)"), startvalue, startvalue + diff, diff);
}
@@ -1537,7 +1534,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 d9bf7e2aa..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"
@@ -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/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp
index 157fd2ad9..fa8543c46 100644
--- a/src/ui/widget/style-swatch.cpp
+++ b/src/ui/widget/style-swatch.cpp
@@ -260,13 +260,12 @@ void StyleSwatch::setStyle(SPCSSAttr *css)
Glib::ustring css_string;
sp_repr_css_write_string (_css, css_string);
- SPStyle *temp_spstyle = sp_style_new(SP_ACTIVE_DOCUMENT);
+
+ SPStyle style(SP_ACTIVE_DOCUMENT);
if (!css_string.empty()) {
- sp_style_merge_from_style_string (temp_spstyle, css_string.c_str());
+ style.mergeString(css_string.c_str());
}
-
- setStyle (temp_spstyle);
- sp_style_unref (temp_spstyle);
+ setStyle (&style);
}
void StyleSwatch::setStyle(SPStyle *query)
diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp
index aac7451f4..ff525c679 100644
--- a/src/ui/widget/tolerance-slider.cpp
+++ b/src/ui/widget/tolerance-slider.cpp
@@ -28,7 +28,8 @@
#include "inkscape.h"
#include "document.h"
#include "document-undo.h"
-#include "desktop-handles.h"
+#include "desktop.h"
+
#include "sp-namedview.h"
#include "registry.h"
@@ -195,10 +196,10 @@ 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 = 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/vanishing-point.cpp b/src/vanishing-point.cpp
index 1ddba7bdb..b62aacbc5 100644
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
@@ -16,7 +16,7 @@
#include <glibmm/i18n.h>
#include "vanishing-point.h"
-#include "desktop-handles.h"
+
#include "desktop.h"
#include "display/sp-canvas-item.h"
#include "display/sp-ctrlline.h"
@@ -110,7 +110,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g
for (std::set<VanishingPoint*, less_ptr>::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);
@@ -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;
@@ -394,7 +394,7 @@ VPDragger::VPsOfSelectedBoxes() {
std::set<VanishingPoint*, less_ptr> 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<SPItem *>(i->data);
SPBox3D *box = dynamic_cast<SPBox3D *>(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;
@@ -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);
}
diff --git a/src/verbs.cpp b/src/verbs.cpp
index bafb6f89b..231e258d6 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -41,7 +41,7 @@
#include <gtkmm/stock.h>
#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<std::size_t>(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."
@@ -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);
@@ -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:
@@ -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;
@@ -1835,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;
@@ -1850,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();
@@ -2330,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<std::size_t>(data)) {
@@ -2396,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<std::size_t>(data)) {
diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp
index ca582924b..8a64854be 100644
--- a/src/widgets/arc-toolbar.cpp
+++ b/src/widgets/arc-toolbar.cpp
@@ -31,7 +31,7 @@
#include <glibmm/i18n.h>
#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<SPDesktop *>(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));
}
@@ -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)
{
@@ -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<SPDesktop *>(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);
}
@@ -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)
{
@@ -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"));
}
@@ -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..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<SPDesktop *>(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" )) {
@@ -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<Persp3D *> sel_persps = sp_desktop_selection(desktop)->perspList();
+ std::list<Persp3D *> 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<Persp3D *> sel_persps = sp_desktop_selection(SP_ACTIVE_DESKTOP)->perspList();
+ std::list<Persp3D *> sel_persps = SP_ACTIVE_DESKTOP->getSelection()->perspList();
if (sel_persps.empty()) {
// this can happen when the document is created; we silently ignore it
return;
@@ -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;
@@ -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..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"
@@ -76,8 +76,8 @@ static void sp_connector_path_set_ignore(void)
static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl )
{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- Inkscape::Selection * selection = sp_desktop_selection(desktop);
- SPDocument *doc = sp_desktop_document(desktop);
+ Inkscape::Selection * selection = desktop->getSelection();
+ SPDocument *doc = desktop->getDocument();
if (!DocumentUndo::getUndoSensitive(doc)) {
return;
@@ -126,8 +126,8 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl
static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl)
{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- Inkscape::Selection * selection = sp_desktop_selection(desktop);
- SPDocument *doc = sp_desktop_document(desktop);
+ Inkscape::Selection * selection = desktop->getSelection();
+ 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<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
if (!DocumentUndo::getUndoSensitive(doc)) {
return;
@@ -233,11 +233,11 @@ 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);
- 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*/ )
@@ -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/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<Glib::ustring>::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/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<SPDesktop *>(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 d1d318abe..d60a92b8b 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"
@@ -252,13 +252,13 @@ void FillNStroke::performUpdate()
update = true;
// create temporary style
- SPStyle *query = sp_style_new(desktop->doc());
+ SPStyle query(desktop->doc());
// 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 = sp_desktop_query_style(desktop, query, (kind == FILL) ? QUERY_STYLE_PROPERTY_FILL : QUERY_STYLE_PROPERTY_STROKE);
+ int result = sp_desktop_query_style(desktop, &query, (kind == FILL) ? QUERY_STYLE_PROPERTY_FILL : QUERY_STYLE_PROPERTY_STROKE);
- SPIPaint &targPaint = (kind == FILL) ? query->fill : query->stroke;
- SPIScale24 &targOpacity = (kind == FILL) ? query->fill_opacity : query->stroke_opacity;
+ SPIPaint &targPaint = (kind == FILL) ? query.fill : query.stroke;
+ SPIScale24 &targOpacity = (kind == FILL) ? query.fill_opacity : query.stroke_opacity;
switch (result) {
case QUERY_STYLE_NOTHING:
@@ -272,11 +272,11 @@ void FillNStroke::performUpdate()
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently, e.g. display "averaged" somewhere in paint selector
case QUERY_STYLE_MULTIPLE_SAME:
{
- SPPaintSelector::Mode pselmode = SPPaintSelector::getModeForStyle(*query, kind);
+ SPPaintSelector::Mode pselmode = SPPaintSelector::getModeForStyle(query, kind);
psel->setMode(pselmode);
if (kind == FILL) {
- psel->setFillrule(query->fill_rule.computed == ART_WIND_RULE_NONZERO?
+ psel->setFillrule(query.fill_rule.computed == ART_WIND_RULE_NONZERO?
SPPaintSelector::FILLRULE_NONZERO : SPPaintSelector::FILLRULE_EVENODD);
}
@@ -284,7 +284,7 @@ void FillNStroke::performUpdate()
psel->setColorAlpha(targPaint.value.color, SP_SCALE24_TO_FLOAT(targOpacity.value));
} else if (targPaint.set && targPaint.isPaintserver()) {
- SPPaintServer *server = (kind == FILL) ? query->getFillPaintServer() : query->getStrokePaintServer();
+ SPPaintServer *server = (kind == FILL) ? query.getFillPaintServer() : query.getStrokePaintServer();
if (server && SP_IS_GRADIENT(server) && SP_GRADIENT(server)->getVector()->isSwatch()) {
SPGradient *vector = SP_GRADIENT(server)->getVector();
@@ -318,8 +318,6 @@ void FillNStroke::performUpdate()
}
}
- sp_style_unref(query);
-
update = false;
}
@@ -480,8 +478,8 @@ void FillNStroke::updateFromPaint()
}
update = true;
- SPDocument *document = sp_desktop_document(desktop);
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ SPDocument *document = desktop->getDocument();
+ Inkscape::Selection *selection = desktop->getSelection();
GSList const *items = selection->itemList();
@@ -516,18 +514,18 @@ 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,
(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) {
// 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
@@ -562,10 +560,10 @@ void FillNStroke::updateFromPaint()
if (!vector) {
/* No vector in paint selector should mean that we just changed mode */
- SPStyle *query = sp_style_new(desktop->doc());
- int result = objects_query_fillstroke(const_cast<GSList *>(items), query, kind == FILL);
+ SPStyle query(desktop->doc());
+ int result = objects_query_fillstroke(const_cast<GSList *>(items), &query, kind == FILL);
if (result == QUERY_STYLE_MULTIPLE_SAME) {
- SPIPaint &targPaint = (kind == FILL) ? query->fill : query->stroke;
+ SPIPaint &targPaint = (kind == FILL) ? query.fill : query.stroke;
SPColor common;
if (!targPaint.isColor()) {
common = sp_desktop_get_color(desktop, kind == FILL);
@@ -577,7 +575,6 @@ void FillNStroke::updateFromPaint()
vector->setSwatch();
}
}
- sp_style_unref(query);
for (GSList const *i = items; i != NULL; i = i->next) {
//FIXME: see above
diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp
index b6378b251..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 <glibmm/i18n.h>
-#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));
@@ -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,12 +918,12 @@ static void gr_gradient_combo_changed(EgeSelectOneAction *act, gpointer data)
gr = sp_gradient_ensure_vector_normalized(gr);
SPDesktop *desktop = static_cast<SPDesktop *>(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);
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT,
_("Assign gradient to object"));
}
@@ -936,7 +936,7 @@ static void gr_spread_change(EgeSelectOneAction *act, GtkWidget *widget)
}
SPDesktop *desktop = static_cast<SPDesktop *>(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);
@@ -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"));
}
}
@@ -1246,8 +1246,8 @@ 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);
- SPDocument *document = sp_desktop_document(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
+ 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 c6da46956..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 );
}
@@ -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);
@@ -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/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 <glibmm/i18n.h>
#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<SPDesktop *>(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 897d84278..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 <glibmm/i18n.h>
#include "ui/tools/gradient-tool.h"
@@ -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,8 +334,8 @@ 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);
- SPDocument *document = sp_desktop_document (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
+ 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 1224ab355..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 <glibmm/i18n.h>
#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"));
}
@@ -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 );
@@ -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..016aa4987 100644
--- a/src/widgets/rect-toolbar.cpp
+++ b/src/widgets/rect-toolbar.cpp
@@ -31,7 +31,7 @@
#include <glibmm/i18n.h>
#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"));
@@ -105,11 +105,11 @@ 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) {
- (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);
}
@@ -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"));
}
@@ -181,7 +181,7 @@ static void rect_tb_event_attr_changed(Inkscape::XML::Node * /*repr*/, gchar con
UnitTracker* tracker = reinterpret_cast<UnitTracker*>( 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 */
@@ -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<Inkscape::UI::Tools::RectTool *>(ec)) {
- changed = sp_desktop_selection(desktop)->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);
+ }
}
}
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index e59d459b9..e49c4c00a 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -21,7 +21,7 @@
#include "ui/widget/spinbutton.h"
#include <glibmm/i18n.h>
#include "select-toolbar.h"
-#include "desktop-handles.h"
+
#include "desktop.h"
#include "display/sp-canvas.h"
#include "document-undo.h"
@@ -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<SPDesktop *>(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<SPDesktop *>(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<GtkAction*> *contextActions = reinterpret_cast<std::vector<GtkAction*> *>(g_object_get_data(G_OBJECT(spw), "contextActions"));
if ( contextActions ) {
@@ -153,8 +153,8 @@ 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);
- SPDocument *document = sp_desktop_document(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
+ SPDocument *document = desktop->getDocument();
document->ensureUpToDate ();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -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)
@@ -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 );
@@ -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<GtkAction*>::iterator iter = contextActions->begin();
iter != contextActions->end(); ++iter) {
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 e85b024ed..3fb0015c1 100644
--- a/src/widgets/spiral-toolbar.cpp
+++ b/src/widgets/spiral-toolbar.cpp
@@ -31,7 +31,7 @@
#include <glibmm/i18n.h>
#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<SPDesktop *>(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));
@@ -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)
{
@@ -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"));
}
@@ -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..cf12391c1 100644
--- a/src/widgets/star-toolbar.cpp
+++ b/src/widgets/star-toolbar.cpp
@@ -31,7 +31,7 @@
#include <glibmm/i18n.h>
#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<SPDesktop *>(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();
@@ -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<SPItem*>(items->data);
@@ -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<SPDesktop *>(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",
@@ -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<SPItem *>(items->data);
@@ -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<SPDesktop *>(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);
}
@@ -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;
@@ -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<SPDesktop *>(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));
}
@@ -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<SPItem*>(items->data);
@@ -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<SPDesktop *>(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));
@@ -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<SPItem *>(items->data);
@@ -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"));
}
@@ -582,8 +582,8 @@ static void star_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB
static sigc::connection changed;
if (dynamic_cast<Inkscape::UI::Tools::StarTool const*>(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-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp
index c62262e81..e273faad7 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))) );
@@ -578,25 +578,25 @@ gboolean MarkerComboBox::separator_cb (GtkTreeModel *model, GtkTreeIter *iter, g
*/
SPDocument *MarkerComboBox::ink_markers_preview_doc ()
{
-gchar const *buffer = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">"
+gchar const *buffer = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" id=\"MarkerSample\">"
" <defs id=\"defs\" />"
" <g id=\"marker-start\">"
-" <path style=\"fill:none;stroke:black;stroke-width:1.7;marker-start:url(#sample);marker-mid:none;marker-end:none\""
+" <path style=\"fill:gray;stroke:darkgray;stroke-width:1.7;marker-start:url(#sample);marker-mid:none;marker-end:none\""
" d=\"M 12.5,13 L 25,13\" id=\"path1\" />"
" <rect style=\"fill:none;stroke:none\" id=\"rect2\""
" width=\"25\" height=\"25\" x=\"0\" y=\"0\" />"
" </g>"
" <g id=\"marker-mid\">"
-" <path style=\"fill:none;stroke:black;stroke-width:1.7;marker-start:none;marker-mid:url(#sample);marker-end:none\""
+" <path style=\"fill:gray;stroke:darkgray;stroke-width:1.7;marker-start:none;marker-mid:url(#sample);marker-end:none\""
" d=\"M 0,113 L 12.5,113 L 25,113\" id=\"path11\" />"
" <rect style=\"fill:none;stroke:none\" id=\"rect22\""
" width=\"25\" height=\"25\" x=\"0\" y=\"100\" />"
" </g>"
" <g id=\"marker-end\">"
-" <path style=\"fill:none;stroke:black;stroke-width:1.7;marker-start:none;marker-mid:none;marker-end:url(#sample)\""
+" <path style=\"fill:gray;stroke:darkgray;stroke-width:1.7;marker-start:none;marker-mid:none;marker-end:url(#sample)\""
" d=\"M 0,213 L 12.5,213\" id=\"path111\" />"
" <rect style=\"fill:none;stroke:none\" id=\"rect222\""
" width=\"25\" height=\"25\" x=\"0\" y=\"200\" />"
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 51880ba85..5ca06a795 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));
@@ -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;
}
@@ -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<SPItem *>(items->data);
@@ -810,18 +810,18 @@ 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;
// create temporary style
- SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
+ SPStyle query(SP_ACTIVE_DOCUMENT);
// query into it
- int result_sw = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
- int result_ml = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEMITERLIMIT);
- int result_cap = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKECAP);
- int result_join = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_STROKEJOIN);
- SPIPaint &targPaint = (kind == FILL) ? query->fill : query->stroke;
+ int result_sw = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
+ int result_ml = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_STROKEMITERLIMIT);
+ int result_cap = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_STROKECAP);
+ int result_join = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_STROKEJOIN);
+ SPIPaint &targPaint = (kind == FILL) ? query.fill : query.stroke;
if (!sel || sel->isEmpty()) {
// Nothing selected, grey-out all controls in the stroke-style dialog
@@ -839,14 +839,14 @@ 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);
}
}
Inkscape::Util::Unit const *unit = unitSelector->getUnit();
if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) {
- double avgwidth = Inkscape::Util::Quantity::convert(query->stroke_width.computed, "px", unit);
+ double avgwidth = Inkscape::Util::Quantity::convert(query.stroke_width.computed, "px", unit);
#if WITH_GTKMM_3_0
(*widthAdj)->set_value(avgwidth);
#else
@@ -879,27 +879,25 @@ StrokeStyle::updateLine()
if (result_ml != QUERY_STYLE_NOTHING)
#if WITH_GTKMM_3_0
- (*miterLimitAdj)->set_value(query->stroke_miterlimit.value); // TODO: reflect averagedness?
+ (*miterLimitAdj)->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness?
#else
- miterLimitAdj->set_value(query->stroke_miterlimit.value); // TODO: reflect averagedness?
+ miterLimitAdj->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness?
#endif
if (result_join != QUERY_STYLE_MULTIPLE_DIFFERENT &&
result_join != QUERY_STYLE_NOTHING ) {
- setJoinType(query->stroke_linejoin.value);
+ setJoinType(query.stroke_linejoin.value);
} else {
setJoinButtons(NULL);
}
if (result_cap != QUERY_STYLE_MULTIPLE_DIFFERENT &&
result_cap != QUERY_STYLE_NOTHING ) {
- setCapType (query->stroke_linecap.value);
+ setCapType (query.stroke_linecap.value);
} else {
setCapButtons(NULL);
}
- sp_style_unref(query);
-
if (!sel || sel->isEmpty())
return;
@@ -957,8 +955,8 @@ StrokeStyle::scaleLine()
update = true;
- SPDocument *document = sp_desktop_document (desktop);
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ SPDocument *document = desktop->getDocument();
+ Inkscape::Selection *selection = desktop->getSelection();
GSList const *items = selection->itemList();
@@ -1113,8 +1111,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 +1197,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 <glibmm/i18n.h>
#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 d62bb8027..3d2e6eef8 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -31,7 +31,7 @@
#include "libnrtype/font-lister.h"
#include <glibmm/i18n.h>
#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"));
}
@@ -220,21 +220,19 @@ 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();
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"));
}
- sp_style_unref(query);
-
sp_repr_css_attr_unref (css);
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
@@ -267,7 +265,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"));
}
@@ -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;
@@ -345,7 +343,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) );
@@ -367,7 +365,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);
@@ -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,12 +482,10 @@ 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)
{
- 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);
@@ -521,7 +516,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) {
@@ -533,20 +528,19 @@ 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"));
}
// 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,19 +567,18 @@ 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();
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);
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();
@@ -623,12 +616,10 @@ 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"));
}
- sp_style_unref(query);
-
sp_repr_css_attr_unref (css);
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
@@ -663,7 +654,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 +688,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 +723,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"));
}
@@ -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)
@@ -780,7 +770,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);
@@ -829,7 +819,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)
{
@@ -860,7 +850,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();
@@ -873,7 +863,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<SPItem *>(items->data)->getId();
@@ -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);
@@ -1169,7 +1156,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) {
@@ -1196,7 +1183,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);
@@ -1214,7 +1201,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<Gtk::ListStore> store = fontlister->get_font_list();
GtkListStore* model = store->gobj();
@@ -1623,7 +1610,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 +1629,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)
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 9e55d1cf6..4f5682f7a 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -40,7 +40,6 @@
#include <glibmm/i18n.h>
#include "../desktop.h"
-#include "../desktop-handles.h"
#include "../desktop-style.h"
#include "document-undo.h"
#include "widgets/ege-adjustment-action.h"
@@ -1511,7 +1510,7 @@ static void toggle_snap_callback(GtkToggleAction *act, gpointer data) //data poi
g_assert(ptr != NULL);
SPDesktop *dt = reinterpret_cast<SPDesktop*>(ptr);
- SPNamedView *nv = sp_desktop_namedview(dt);
+ SPNamedView *nv = dt->getNamedView();
SPDocument *doc = nv->document;
if (dt == NULL || nv == NULL) {
@@ -1871,7 +1870,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;
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 <cassert>
+#include <iostream>
#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);