summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-02-02 20:08:49 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-02-02 20:08:49 +0000
commit1d3b98e5f5311479cd87f20e3656b0133bff73bd (patch)
tree95eea2fcac18f236b31053e4d1493aa644760df0 /src/ui
parentupdate to trunk (diff)
parentTranslations. Arabic translation update. (diff)
downloadinkscape-1d3b98e5f5311479cd87f20e3656b0133bff73bd.tar.gz
inkscape-1d3b98e5f5311479cd87f20e3656b0133bff73bd.zip
update to trunk
(bzr r13645.1.4)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/CMakeLists.txt4
-rw-r--r--src/ui/clipboard.cpp39
-rw-r--r--src/ui/clipboard.h2
-rw-r--r--src/ui/dialog-events.cpp9
-rw-r--r--src/ui/dialog-events.h12
-rw-r--r--src/ui/dialog/Makefile_insert2
-rw-r--r--src/ui/dialog/aboutbox.cpp6
-rw-r--r--src/ui/dialog/align-and-distribute.cpp61
-rw-r--r--src/ui/dialog/align-and-distribute.h3
-rw-r--r--src/ui/dialog/clonetiler.cpp96
-rw-r--r--src/ui/dialog/clonetiler.h5
-rw-r--r--src/ui/dialog/color-item.cpp6
-rw-r--r--src/ui/dialog/desktop-tracker.cpp17
-rw-r--r--src/ui/dialog/desktop-tracker.h4
-rw-r--r--src/ui/dialog/dialog.cpp42
-rw-r--r--src/ui/dialog/dialog.h1
-rw-r--r--src/ui/dialog/document-metadata.cpp16
-rw-r--r--src/ui/dialog/document-metadata.h5
-rw-r--r--src/ui/dialog/document-properties.cpp89
-rw-r--r--src/ui/dialog/document-properties.h4
-rw-r--r--src/ui/dialog/export.cpp61
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp7
-rw-r--r--src/ui/dialog/fill-and-stroke.cpp2
-rw-r--r--src/ui/dialog/fill-and-stroke.h3
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp18
-rw-r--r--src/ui/dialog/find.cpp105
-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.cpp21
-rw-r--r--src/ui/dialog/guides.cpp6
-rw-r--r--src/ui/dialog/icon-preview.cpp4
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp27
-rw-r--r--src/ui/dialog/layer-properties.cpp8
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp143
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.cpp82
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.h17
-rw-r--r--src/ui/dialog/lpe-powerstroke-properties.cpp4
-rw-r--r--src/ui/dialog/object-attributes.cpp4
-rw-r--r--src/ui/dialog/object-properties.cpp12
-rw-r--r--src/ui/dialog/objects.cpp2
-rw-r--r--src/ui/dialog/panel-dialog.h33
-rw-r--r--src/ui/dialog/polar-arrange-tab.cpp22
-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.cpp30
-rw-r--r--src/ui/dialog/symbols.cpp38
-rw-r--r--src/ui/dialog/tags.cpp7
-rw-r--r--src/ui/dialog/template-load-tab.cpp2
-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.cpp49
-rw-r--r--src/ui/dialog/transformation.h3
-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.cpp20
-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/curve-drag-point.cpp18
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp8
-rw-r--r--src/ui/tool/node.cpp16
-rw-r--r--src/ui/tool/path-manipulator.cpp15
-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.cpp6
-rw-r--r--src/ui/tools/arc-tool.cpp20
-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.cpp22
-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.cpp24
-rw-r--r--src/ui/tools/freehand-base.cpp41
-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.cpp24
-rw-r--r--src/ui/tools/node-tool.h2
-rw-r--r--src/ui/tools/pen-tool.cpp226
-rw-r--r--src/ui/tools/pen-tool.h1
-rw-r--r--src/ui/tools/pencil-tool.cpp6
-rw-r--r--src/ui/tools/rect-tool.cpp20
-rw-r--r--src/ui/tools/rect-tool.h4
-rw-r--r--src/ui/tools/select-tool.cpp66
-rw-r--r--src/ui/tools/spiral-tool.cpp18
-rw-r--r--src/ui/tools/spray-tool.cpp12
-rw-r--r--src/ui/tools/star-tool.cpp18
-rw-r--r--src/ui/tools/text-tool.cpp80
-rw-r--r--src/ui/tools/tool-base.cpp20
-rw-r--r--src/ui/tools/tweak-tool.cpp32
-rw-r--r--src/ui/view/view.cpp8
-rw-r--r--src/ui/widget/addtoicon.cpp13
-rw-r--r--src/ui/widget/clipmaskicon.cpp13
-rw-r--r--src/ui/widget/color-picker.cpp4
-rw-r--r--src/ui/widget/dock.cpp5
-rw-r--r--src/ui/widget/filter-effect-chooser.cpp2
-rw-r--r--src/ui/widget/highlight-picker.cpp13
-rw-r--r--src/ui/widget/imageicon.cpp5
-rw-r--r--src/ui/widget/insertordericon.cpp13
-rw-r--r--src/ui/widget/layer-selector.cpp6
-rw-r--r--src/ui/widget/object-composite-settings.cpp51
-rw-r--r--src/ui/widget/object-composite-settings.h4
-rw-r--r--src/ui/widget/page-sizer.cpp30
-rw-r--r--src/ui/widget/page-sizer.h2
-rw-r--r--src/ui/widget/panel.cpp11
-rw-r--r--src/ui/widget/panel.h9
-rw-r--r--src/ui/widget/preferences-widget.cpp2
-rw-r--r--src/ui/widget/registered-widget.cpp41
-rw-r--r--src/ui/widget/registered-widget.h18
-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
115 files changed, 1344 insertions, 1221 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index e5c605889..98a5a224c 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -4,8 +4,8 @@ set(ui_SRC
control-manager.cpp
dialog-events.cpp
draw-anchor.cpp
- interface.cpp
- object-edit.cpp
+ interface.cpp
+ object-edit.cpp
previewholder.cpp
shape-editor.cpp
tools-switch.cpp
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 931a295d8..94a1eb2dc 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"
@@ -107,7 +107,7 @@ class ClipboardManagerImpl : public ClipboardManager {
public:
virtual void copy(SPDesktop *desktop);
virtual void copyPathParameter(Inkscape::LivePathEffect::PathParam *);
- virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style);
+ virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol);
virtual bool paste(SPDesktop *desktop, bool in_place);
virtual bool pasteStyle(SPDesktop *desktop);
virtual bool pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y);
@@ -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()) {
@@ -303,7 +303,7 @@ void ClipboardManagerImpl::copyPathParameter(Inkscape::LivePathEffect::PathParam
* Copy a symbol from the symbol dialog.
* @param symbol The Inkscape::XML::Node for the symbol.
*/
-void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* style)
+void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol)
{
//std::cout << "ClipboardManagerImpl::copySymbol" << std::endl;
if ( symbol == NULL ) {
@@ -326,10 +326,28 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const*
Glib::ustring id("#");
id += symbol->attribute("id");
+ gdouble scale_units = 1; // scale from "px" to "document-units"
+ Inkscape::XML::Node *nv_repr = SP_ACTIVE_DESKTOP->getNamedView()->getRepr();
+ if (nv_repr->attribute("inkscape:document-units"))
+ scale_units = Inkscape::Util::Quantity::convert(1, "px", nv_repr->attribute("inkscape:document-units"));
+ SPObject *cmobj = _clipboardSPDoc->getObjectByRepr(repr);
+ if (cmobj && !user_symbol) { // convert only stock symbols
+ if (!Geom::are_near(scale_units, 1.0, Geom::EPSILON)) {
+ dynamic_cast<SPGroup *>(cmobj)->scaleChildItemsRec(Geom::Scale(scale_units),
+ Geom::Point(0, SP_ACTIVE_DESKTOP->getDocument()->getHeight().value("px")),
+ false);
+ }
+ }
+
Inkscape::XML::Node *use = _doc->createElement("svg:use");
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 );
+ if (!Geom::are_near(scale_units, 1.0, Geom::EPSILON)) {
+ gchar *transform_str = sp_svg_transform_write(Geom::Scale(1.0/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.
@@ -428,7 +446,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;
@@ -481,7 +499,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;
@@ -544,7 +562,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;
@@ -918,15 +936,18 @@ bool ClipboardManagerImpl::_pasteImage(SPDocument *doc)
}
Inkscape::Extension::Extension *png = *i;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- Glib::ustring attr = prefs->getString("/dialogs/import/link");
+ Glib::ustring attr_saved = prefs->getString("/dialogs/import/link");
+ bool ask_saved = prefs->getBool("/dialogs/import/ask");
prefs->setString("/dialogs/import/link", "embed");
+ prefs->setBool("/dialogs/import/ask", false);
png->set_gui(false);
gchar *filename = g_build_filename( g_get_tmp_dir(), "inkscape-clipboard-import", NULL );
img->save(filename, "png");
file_import(doc, filename, png);
g_free(filename);
- prefs->setString("/dialogs/import/link", attr);
+ prefs->setString("/dialogs/import/link", attr_saved);
+ prefs->setBool("/dialogs/import/ask", ask_saved);
png->set_gui(true);
return true;
diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h
index b565740c3..9f3b6cbdb 100644
--- a/src/ui/clipboard.h
+++ b/src/ui/clipboard.h
@@ -44,7 +44,7 @@ class ClipboardManager {
public:
virtual void copy(SPDesktop *desktop) = 0;
virtual void copyPathParameter(Inkscape::LivePathEffect::PathParam *) = 0;
- virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style) = 0;
+ virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol = true) = 0;
virtual bool paste(SPDesktop *desktop, bool in_place = false) = 0;
virtual bool pasteStyle(SPDesktop *desktop) = 0;
virtual bool pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y) = 0;
diff --git a/src/ui/dialog-events.cpp b/src/ui/dialog-events.cpp
index 6bd93bbc3..5bc8088a1 100644
--- a/src/ui/dialog-events.cpp
+++ b/src/ui/dialog-events.cpp
@@ -6,7 +6,7 @@
* bulia byak <bulia@dr.com>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
- * Copyright (C) 2003-2007 Authors
+ * Copyright (C) 2003-2014 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -25,7 +25,7 @@
#include "macros.h"
#include <gtk/gtk.h>
#include "desktop.h"
-#include "inkscape-private.h"
+#include "inkscape.h"
#include "preferences.h"
#include "ui/tools/tool-base.h"
@@ -183,12 +183,11 @@ void sp_transientize(GtkWidget *dialog)
void on_transientize (SPDesktop *desktop, win_data *wd )
{
- sp_transientize_callback (0, desktop, wd);
+ sp_transientize_callback (desktop, wd);
}
void
-sp_transientize_callback ( InkscapeApplication * /*inkscape*/,
- SPDesktop *desktop, win_data *wd )
+sp_transientize_callback ( SPDesktop *desktop, win_data *wd )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint transient_policy = prefs->getIntLimited( "/options/transientpolicy/value", 1, 0, 2);
diff --git a/src/ui/dialog-events.h b/src/ui/dialog-events.h
index b33eb3f38..b4a5d7c35 100644
--- a/src/ui/dialog-events.h
+++ b/src/ui/dialog-events.h
@@ -4,7 +4,7 @@
/* Authors:
* bulia byak <bulia@dr.com>
*
- * Copyright (C) 2003 authors
+ * Copyright (C) 2003-2014 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -28,8 +28,6 @@ class Entry;
}
class SPDesktop;
-
-struct InkscapeApplication;
typedef struct {
GtkWidget *win;
@@ -53,14 +51,14 @@ void sp_transientize ( GtkWidget *win );
void on_transientize ( SPDesktop *desktop,
win_data *wd );
-void sp_transientize_callback ( InkscapeApplication *inkscape,
- SPDesktop *desktop,
+void sp_transientize_callback ( SPDesktop *desktop,
win_data *wd );
void on_dialog_hide (GtkWidget *w);
void on_dialog_unhide (GtkWidget *w);
-gboolean sp_dialog_hide (GObject *object, gpointer data);
-gboolean sp_dialog_unhide (GObject *object, gpointer data);
+
+//gboolean sp_dialog_hide (GObject *object, gpointer data);
+//gboolean sp_dialog_unhide (GObject *object, gpointer data);
#endif
diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert
index 26a59ce2c..cbdae1cb0 100644
--- a/src/ui/dialog/Makefile_insert
+++ b/src/ui/dialog/Makefile_insert
@@ -101,7 +101,7 @@ ink_common_sources += \
ui/dialog/template-widget.cpp \
ui/dialog/template-widget.h \
ui/dialog/tags.cpp \
- ui/dialpg/tags.h \
+ ui/dialog/tags.h \
ui/dialog/text-edit.cpp \
ui/dialog/text-edit.h \
ui/dialog/tile.cpp \
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index 50b35ca2f..81f48e6ef 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -470,6 +470,7 @@ void AboutBox::initStrings() {
"Arman Aksoy <armish@linux-sevenler.de>, 2003.\n"
"Arpad Biro <biro_arpad@yahoo.com>, 2004, 2005.\n"
"Benedikt Roth <Benedikt.Roth@gmx.net>, 2000.\n"
+"Benjamin Weis <benjamin.weis@gmx.com>, 2014.\n"
"Benno Schulenberg <benno@vertaalt.nl>, 2008.\n"
"Boštjan Špetič <igzebedze@cyberpipe.org>, 2004, 2005.\n"
"Brisa Francesco <fbrisa@yahoo.it>, 2000.\n"
@@ -492,7 +493,7 @@ void AboutBox::initStrings() {
"Elias Norberg <elno0959 at student.su.se>, 2009.\n"
"Equipe de Tradução Inkscape Brasil <www.inkscapebrasil.org>, 2007.\n"
"Fatih Demir <kabalak@gtranslator.org>, 2000.\n"
-"Firas Hanife <FirasHanife@gmail.com>, 2014.\n"
+"Firas Hanife <FirasHanife@gmail.com>, 2014-2015.\n"
"Foppe Benedictus <foppe.benedictus@gmail.com>, 2007-2009.\n"
"Francesc Dorca <f.dorca@filnet.es>, 2003. Traducció sodipodi.\n"
"Francisco Javier F. Serrador <serrador@arrakis.es>, 2003.\n"
@@ -500,6 +501,7 @@ void AboutBox::initStrings() {
"Frederic Rodrigo <f.rodrigo free.fr>, 2004-2005.\n"
"Ge'ez Frontier Foundation <locales@geez.org>, 2002.\n"
"George Boukeas <boukeas@gmail.com>, 2011.\n"
+"Heiko Wöhrle <mail@heikowoehrle.de>, 2014.\n"
"Hleb Valoshka <375gnu@gmail.com>, 2008-2009.\n"
"Hizkuntza Politikarako Sailburuordetza <hizkpol@ej-gv.es>, 2005.\n"
"Ilia Penev <lichopicho@gmail.com>, 2006.\n"
@@ -564,7 +566,7 @@ void AboutBox::initStrings() {
"Stefan Graubner <pflaumenmus92@gmx.net>, 2005.\n"
"Supranee Thirawatthanasuk <supranee@opentle.org>, 2006.\n"
"Takeshi Aihana <aihana@muc.biglobe.ne.jp>, 2000, 2001.\n"
-"Tim Sheridan <tim.sheridan@gmail.com>, 2007-2011.\n"
+"Tim Sheridan <tghs@tghs.net>, 2007-2014.\n"
"Theppitak Karoonboonyanan <thep@linux.thai.net>, 2006.\n"
"Thiago Pimentel <thiago.merces@gmail.com>, 2006.\n"
"Toshifumi Sato <sato@centrosystem.com>, 2005.\n"
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 431da7ad1..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"));
}
}
@@ -829,14 +828,14 @@ private :
-static void on_tool_changed(InkscapeApplication */*inkscape*/, Inkscape::UI::Tools::ToolBase */*context*/, AlignAndDistribute *daad)
+static void on_tool_changed(AlignAndDistribute *daad)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop && desktop->getEventContext())
daad->setMode(tools_active(desktop) == TOOLS_NODES);
}
-static void on_selection_changed(InkscapeApplication */*inkscape*/, Inkscape::Selection */*selection*/, AlignAndDistribute *daad)
+static void on_selection_changed(AlignAndDistribute *daad)
{
daad->randomize_bbox = Geom::OptRect();
}
@@ -1044,10 +1043,10 @@ AlignAndDistribute::AlignAndDistribute()
contents->pack_start(_nodesFrame, true, true);
//Connect to the global tool change signal
- g_signal_connect (G_OBJECT (INKSCAPE), "set_eventcontext", G_CALLBACK (on_tool_changed), this);
+ _toolChangeConn = INKSCAPE.signal_eventcontext_set.connect(sigc::hide<0>(sigc::bind(sigc::ptr_fun(&on_tool_changed), this)));
// Connect to the global selection change, to invalidate cached randomize_bbox
- g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this);
+ _selChangeConn = INKSCAPE.signal_selection_changed.connect(sigc::hide<0>(sigc::bind(sigc::ptr_fun(&on_selection_changed), this)));
randomize_bbox = Geom::OptRect();
_desktopChangeConn = _deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &AlignAndDistribute::setDesktop) );
@@ -1055,18 +1054,18 @@ AlignAndDistribute::AlignAndDistribute()
show_all_children();
- on_tool_changed (NULL, NULL, this); // set current mode
+ on_tool_changed (this); // set current mode
}
AlignAndDistribute::~AlignAndDistribute()
{
- sp_signal_disconnect_by_data (G_OBJECT (INKSCAPE), this);
-
for (std::list<Action *>::iterator it = _actionList.begin();
it != _actionList.end(); ++it) {
delete *it;
}
+ _toolChangeConn.disconnect();
+ _selChangeConn.disconnect();
_desktopChangeConn.disconnect();
_deskTrack.disconnect();
}
@@ -1075,7 +1074,7 @@ void AlignAndDistribute::setTargetDesktop(SPDesktop *desktop)
{
if (_desktop != desktop) {
_desktop = desktop;
- on_tool_changed (NULL, NULL, this);
+ on_tool_changed (this);
}
}
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index dfd84535b..eecc30ff8 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -127,7 +127,8 @@ protected:
SPDesktop *_desktop;
DesktopTracker _deskTrack;
sigc::connection _desktopChangeConn;
-
+ sigc::connection _toolChangeConn;
+ sigc::connection _selChangeConn;
private:
AlignAndDistribute(AlignAndDistribute const &d);
AlignAndDistribute& operator=(AlignAndDistribute const &d);
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index 5ef885ab2..fede30b26 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -1,5 +1,6 @@
-/** @file
+/**
+ * @file
* Clone tiling dialog
*/
/* Authors:
@@ -26,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"
@@ -75,15 +76,12 @@ static gdouble trace_zoom;
static SPDocument *trace_doc = NULL;
-CloneTiler::CloneTiler (void) :
+CloneTiler::CloneTiler () :
UI::Widget::Panel ("", "/dialogs/clonetiler/", SP_VERB_DIALOG_CLONETILER),
dlg(NULL),
desktop(NULL),
deskTrack(),
- table_row_labels(NULL),
- selectChangedConn(),
- subselChangedConn(),
- selectModifiedConn()
+ table_row_labels(NULL)
{
Gtk::Box *contents = _getContents();
contents->set_spacing(0);
@@ -1095,7 +1093,7 @@ CloneTiler::CloneTiler (void) :
// 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)->doc_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));
{
@@ -1272,12 +1270,13 @@ CloneTiler::CloneTiler (void) :
// connect to global selection changed signal (so we can change desktops) and
// external_change (so we're not fooled by undo)
- g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (clonetiler_change_selection), dlg);
- g_signal_connect (G_OBJECT (INKSCAPE), "external_change", G_CALLBACK (clonetiler_external_change), dlg);
- g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(clonetiler_disconnect_gsignal), G_OBJECT (INKSCAPE));
+ selectChangedConn = INKSCAPE.signal_selection_changed.connect(sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_change_selection), dlg));
+ externChangedConn = INKSCAPE.signal_external_change.connect (sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_external_change), dlg));
+
+ g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(clonetiler_disconnect_gsignal), this);
// update now
- clonetiler_change_selection (NULL, sp_desktop_selection(SP_ACTIVE_DESKTOP), dlg);
+ clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg);
}
{
@@ -1349,7 +1348,7 @@ void CloneTiler::on_picker_color_changed(guint rgba)
is_updating = false;
}
-void CloneTiler::clonetiler_change_selection(InkscapeApplication * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg)
+void CloneTiler::clonetiler_change_selection(Inkscape::Selection *selection, GtkWidget *dlg)
{
GtkWidget *buttons = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "buttons_on_tiles"));
GtkWidget *status = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "status"));
@@ -1378,16 +1377,18 @@ void CloneTiler::clonetiler_change_selection(InkscapeApplication * /*inkscape*/,
}
}
-void CloneTiler::clonetiler_external_change(InkscapeApplication * /*inkscape*/, GtkWidget *dlg)
+void CloneTiler::clonetiler_external_change(GtkWidget *dlg)
{
- clonetiler_change_selection (NULL, sp_desktop_selection(SP_ACTIVE_DESKTOP), dlg);
+ clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg);
}
-void CloneTiler::clonetiler_disconnect_gsignal(GObject *widget, gpointer source)
+void CloneTiler::clonetiler_disconnect_gsignal(GObject *, gpointer source)
{
- if (source && G_IS_OBJECT(source)) {
- sp_signal_disconnect_by_data (source, widget);
- }
+ g_return_if_fail(source != NULL);
+
+ CloneTiler* dlg = reinterpret_cast<CloneTiler*>(source);
+ dlg->selectChangedConn.disconnect();
+ dlg->externChangedConn.disconnect();
}
Geom::Affine CloneTiler::clonetiler_get_transform(
@@ -2002,7 +2003,7 @@ bool CloneTiler::clonetiler_is_a_clone_of(SPObject *tile, SPObject *obj)
id_href = g_strdup_printf("#%s", obj_repr->attribute("id"));
}
- if (SP_IS_USE(tile) &&
+ if (dynamic_cast<SPUse *>(tile) &&
tile->getRepr()->attribute("xlink:href") &&
(!id_href || !strcmp(id_href, tile->getRepr()->attribute("xlink:href"))) &&
tile->getRepr()->attribute("inkscape:tiled-clone-of") &&
@@ -2025,8 +2026,10 @@ void CloneTiler::clonetiler_trace_hide_tiled_clones_recursively(SPObject *from)
return;
for (SPObject *o = from->firstChild(); o != NULL; o = o->next) {
- if (SP_IS_ITEM(o) && clonetiler_is_a_clone_of (o, NULL))
- SP_ITEM(o)->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too!
+ SPItem *item = dynamic_cast<SPItem *>(o);
+ if (item && clonetiler_is_a_clone_of(o, NULL)) {
+ item->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too!
+ }
clonetiler_trace_hide_tiled_clones_recursively (o);
}
}
@@ -2090,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;
}
@@ -2109,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"));
}
@@ -2141,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;
}
@@ -2160,14 +2163,16 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d
}
}
for (GSList *i = to_delete; i; i = i->next) {
- SP_OBJECT(i->data)->deleteObject();
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ g_assert(obj != NULL);
+ obj->deleteObject();
}
g_slist_free (to_delete);
- clonetiler_change_selection (NULL, selection, dlg);
+ 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"));
}
}
@@ -2211,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;
}
@@ -2246,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)->getDefaultUnit());
+ 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);
@@ -2330,9 +2335,9 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
bool invert_picked = prefs->getBool(prefs_path + "invert_picked");
double gamma_picked = prefs->getDoubleLimited(prefs_path + "gamma_picked", 0, -10, 10);
- SPItem *item = SP_IS_ITEM(obj) ? SP_ITEM(obj) : 0;
+ 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;
@@ -2606,24 +2611,25 @@ 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);
- if (clone_object && SP_IS_ITEM(clone_object)) {
+ 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);
- SP_ITEM(clone_object)->setCenter(desktop->doc2dt(new_center));
+ item->setCenter(desktop->doc2dt(new_center));
clone_object->updateRepr();
}
}
@@ -2637,11 +2643,11 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
clonetiler_trace_finish ();
}
- clonetiler_change_selection (NULL, selection, dlg);
+ clonetiler_change_selection (selection, 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/clonetiler.h b/src/ui/dialog/clonetiler.h
index 70da86338..e5f5638b2 100644
--- a/src/ui/dialog/clonetiler.h
+++ b/src/ui/dialog/clonetiler.h
@@ -57,8 +57,8 @@ protected:
static void clonetiler_keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/);
static void clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg);
static void clonetiler_unclump(GtkWidget */*widget*/, void *);
- static void clonetiler_change_selection(InkscapeApplication * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg);
- static void clonetiler_external_change(InkscapeApplication * /*inkscape*/, GtkWidget *dlg);
+ static void clonetiler_change_selection(Inkscape::Selection *selection, GtkWidget *dlg);
+ static void clonetiler_external_change(GtkWidget *dlg);
static void clonetiler_disconnect_gsignal(GObject *widget, gpointer source);
static void clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg);
static guint clonetiler_number_of_clones(SPObject *obj);
@@ -129,6 +129,7 @@ private:
sigc::connection desktopChangeConn;
sigc::connection selectChangedConn;
+ sigc::connection externChangedConn;
sigc::connection subselChangedConn;
sigc::connection selectModifiedConn;
sigc::connection color_changed_connection;
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/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp
index 3ed998252..0659de67b 100644
--- a/src/ui/dialog/desktop-tracker.cpp
+++ b/src/ui/dialog/desktop-tracker.cpp
@@ -22,7 +22,6 @@ DesktopTracker::DesktopTracker() :
desktop(0),
widget(0),
hierID(0),
- inkID(0),
trackActive(false),
desktopChangedSig()
{
@@ -41,7 +40,10 @@ void DesktopTracker::connect(GtkWidget *widget)
// Use C/gobject callbacks to avoid gtkmm rewrap-during-destruct issues:
hierID = g_signal_connect( G_OBJECT(widget), "hierarchy-changed", G_CALLBACK(hierarchyChangeCB), this );
- inkID = g_signal_connect( G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(activateDesktopCB), this );
+ inkID = INKSCAPE.signal_activate_desktop.connect(
+ sigc::bind(
+ sigc::ptr_fun(&DesktopTracker::activateDesktopCB), this)
+ );
GtkWidget *wdgt = gtk_widget_get_ancestor(widget, SP_TYPE_DESKTOP_WIDGET);
if (wdgt && !base) {
@@ -60,11 +62,8 @@ void DesktopTracker::disconnect()
}
hierID = 0;
}
- if (inkID) {
- if (INKSCAPE) {
- g_signal_handler_disconnect(G_OBJECT(INKSCAPE), inkID);
- }
- inkID = 0;
+ if (inkID.connected()) {
+ inkID.disconnect();
}
}
@@ -94,12 +93,12 @@ sigc::connection DesktopTracker::connectDesktopChanged( const sigc::slot<void, S
return desktopChangedSig.connect(slot);
}
-gboolean DesktopTracker::activateDesktopCB(InkscapeApplication */*inkscape*/, SPDesktop *desktop, DesktopTracker *self )
+void DesktopTracker::activateDesktopCB(SPDesktop *desktop, DesktopTracker *self )
{
if (self && self->trackActive) {
self->setDesktop(desktop);
}
- return FALSE;
+ //return FALSE;
}
bool DesktopTracker::hierarchyChangeCB(GtkWidget * /*widget*/, GtkWidget* /*prev*/, DesktopTracker *self)
diff --git a/src/ui/dialog/desktop-tracker.h b/src/ui/dialog/desktop-tracker.h
index 7b944ddfa..8cb205a35 100644
--- a/src/ui/dialog/desktop-tracker.h
+++ b/src/ui/dialog/desktop-tracker.h
@@ -36,7 +36,7 @@ public:
sigc::connection connectDesktopChanged( const sigc::slot<void, SPDesktop*> & slot );
private:
- static gboolean activateDesktopCB(InkscapeApplication *inkscape, SPDesktop *desktop, DesktopTracker *self );
+ static void activateDesktopCB(SPDesktop *desktop, DesktopTracker *self );
static bool hierarchyChangeCB(GtkWidget *widget, GtkWidget* prev, DesktopTracker *self);
void handleHierarchyChange();
@@ -46,7 +46,7 @@ private:
SPDesktop *desktop;
GtkWidget *widget;
gulong hierID;
- gulong inkID;
+ sigc::connection inkID;
bool trackActive;
sigc::signal<void, SPDesktop*> desktopChangedSig;
};
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 213965a18..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"
@@ -41,12 +41,6 @@ namespace Inkscape {
namespace UI {
namespace Dialog {
-void sp_retransientize(InkscapeApplication */*inkscape*/, SPDesktop *desktop, gpointer dlgPtr)
-{
- Dialog *dlg = static_cast<Dialog *>(dlgPtr);
- dlg->onDesktopActivated (desktop);
-}
-
gboolean sp_retransientize_again(gpointer dlgPtr)
{
Dialog *dlg = static_cast<Dialog *>(dlgPtr);
@@ -54,30 +48,6 @@ gboolean sp_retransientize_again(gpointer dlgPtr)
return FALSE; // so that it is only called once
}
-void sp_dialog_shutdown(GObject * /*object*/, gpointer dlgPtr)
-{
- Dialog *dlg = static_cast<Dialog *>(dlgPtr);
- dlg->onShutdown();
-}
-
-
-static void hideCallback(GObject * /*object*/, gpointer dlgPtr)
-{
- g_return_if_fail( dlgPtr != NULL );
-
- Dialog *dlg = static_cast<Dialog *>(dlgPtr);
- dlg->onHideF12();
-}
-
-static void unhideCallback(GObject * /*object*/, gpointer dlgPtr)
-{
- g_return_if_fail( dlgPtr != NULL );
-
- Dialog *dlg = static_cast<Dialog *>(dlgPtr);
- dlg->onShowF12();
-}
-
-
//=====================================================================
Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path, int verb_num,
@@ -103,10 +73,10 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat
_behavior = behavior_factory(*this);
_desktop = SP_ACTIVE_DESKTOP;
- g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(sp_retransientize), (void *)this);
- g_signal_connect(G_OBJECT(INKSCAPE), "dialogs_hide", G_CALLBACK(hideCallback), (void *)this);
- g_signal_connect(G_OBJECT(INKSCAPE), "dialogs_unhide", G_CALLBACK(unhideCallback), (void *)this);
- g_signal_connect(G_OBJECT(INKSCAPE), "shut_down", G_CALLBACK(sp_dialog_shutdown), (void *)this);
+ INKSCAPE.signal_activate_desktop.connect(sigc::mem_fun(*this, &Dialog::onDesktopActivated));
+ INKSCAPE.signal_dialogs_hide.connect(sigc::mem_fun(*this, &Dialog::onHideF12));
+ INKSCAPE.signal_dialogs_unhide.connect(sigc::mem_fun(*this, &Dialog::onShowF12));
+ INKSCAPE.signal_shut_down.connect(sigc::mem_fun(*this, &Dialog::onShutdown));
Glib::wrap(gobj())->signal_event().connect(sigc::mem_fun(*this, &Dialog::_onEvent));
Glib::wrap(gobj())->signal_key_press_event().connect(sigc::mem_fun(*this, &Dialog::_onKeyPress));
@@ -340,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/dialog.h b/src/ui/dialog/dialog.h
index ccff43a56..9c7efd47b 100644
--- a/src/ui/dialog/dialog.h
+++ b/src/ui/dialog/dialog.h
@@ -30,7 +30,6 @@ namespace Dialog {
enum BehaviorType { FLOATING, DOCK };
-void sp_retransientize(InkscapeApplication *inkscape, SPDesktop *desktop, gpointer dlgPtr);
gboolean sp_retransientize_again(gpointer dlgPtr);
void sp_dialog_shutdown(GObject *object, gpointer dlgPtr);
diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp
index 77ea175d9..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,23 +217,23 @@ 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();
}
void
-DocumentMetadata::_handleActivateDesktop(InkscapeApplication *, SPDesktop *desktop)
+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();
}
void
-DocumentMetadata::_handleDeactivateDesktop(InkscapeApplication *, SPDesktop *desktop)
+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-metadata.h b/src/ui/dialog/document-metadata.h
index 77084bc3d..cde5d92fd 100644
--- a/src/ui/dialog/document-metadata.h
+++ b/src/ui/dialog/document-metadata.h
@@ -28,6 +28,7 @@
# include <gtkmm/table.h>
#endif
+#include "inkscape.h"
#include "ui/widget/licensor.h"
#include "ui/widget/registry.h"
@@ -56,8 +57,8 @@ protected:
void init();
void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document);
- void _handleActivateDesktop(InkscapeApplication *application, SPDesktop *desktop);
- void _handleDeactivateDesktop(InkscapeApplication *application, SPDesktop *desktop);
+ void _handleActivateDesktop(SPDesktop *desktop);
+ void _handleDeactivateDesktop(SPDesktop *desktop);
Gtk::Notebook _notebook;
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index dc8a0fee2..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"
@@ -114,7 +114,7 @@ DocumentProperties::DocumentProperties()
_rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false),
_rcp_bg(_("Back_ground color:"), _("Background color"), _("Color of the page background. Note: transparency setting ignored while editing but used when exporting to bitmap."), "pagecolor", "inkscape:pageopacity", _wr),
_rcp_bord(_("Border _color:"), _("Page border color"), _("Color of the page border"), "bordercolor", "borderopacity", _wr),
- _rum_deflt(_("Default _units:"), "inkscape:document-units", _wr),
+ _rum_deflt(_("Display _units:"), "inkscape:document-units", _wr),
_page_sizer(_wr),
//---------------------------------------------------------------
//General snap options
@@ -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)
@@ -1205,10 +1205,10 @@ void DocumentProperties::removeExternalScript(){
const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
while ( current ) {
- if (current->data && SP_IS_OBJECT(current->data)) {
- SPObject* obj = SP_OBJECT(current->data);
- SPScript* script = SP_SCRIPT(obj);
- if (name == script->xlinkhref){
+ SPObject* obj = reinterpret_cast<SPObject *>(current->data);
+ if (obj) {
+ SPScript* script = dynamic_cast<SPScript *>(obj);
+ if (script && (name == script->xlinkhref)) {
//XML Tree being used directly here while it shouldn't be.
Inkscape::XML::Node *repr = obj->getRepr();
@@ -1354,10 +1354,15 @@ void DocumentProperties::populate_script_lists(){
_ExternalScriptsListStore->clear();
_EmbeddedScriptsListStore->clear();
const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
- if (current) _scripts_observer.set(SP_OBJECT(current->data)->parent);
+ if (current) {
+ SPObject *obj = reinterpret_cast<SPObject *>(current->data);
+ g_assert(obj != NULL);
+ _scripts_observer.set(obj->parent);
+ }
while ( current ) {
- SPObject* obj = SP_OBJECT(current->data);
- SPScript* script = SP_SCRIPT(obj);
+ SPObject* obj = reinterpret_cast<SPObject *>(current->data);
+ SPScript* script = dynamic_cast<SPScript *>(obj);
+ g_assert(script != NULL);
if (script->xlinkhref)
{
Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append());
@@ -1379,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) {
@@ -1423,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>"));
@@ -1459,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);
@@ -1475,25 +1480,25 @@ void DocumentProperties::update()
_rcb_antialias.set_xml_target(root->getRepr(), dt->getDocument());
_rcb_antialias.setActive(root->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES);
- if (nv->doc_units) {
- _rum_deflt.setUnit (nv->doc_units->abbr);
+ if (nv->display_units) {
+ _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());
@@ -1587,27 +1592,27 @@ 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);
update();
}
-void DocumentProperties::_handleActivateDesktop(InkscapeApplication *, SPDesktop *desktop)
+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(InkscapeApplication *, SPDesktop *desktop)
+void DocumentProperties::_handleDeactivateDesktop(SPDesktop *desktop)
{
- Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
+ Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr();
repr->removeListenerByData(this);
- Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr();
+ Inkscape::XML::Node *root = desktop->getDocument()->getRoot()->getRepr();
root->removeListenerByData(this);
}
@@ -1642,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()));
@@ -1660,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.
@@ -1674,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"));
}
}
@@ -1692,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"));
@@ -1703,7 +1708,10 @@ void DocumentProperties::onDocUnitChange()
Inkscape::SVGOStringStream os;
os << doc_unit->abbr;
repr->setAttribute("inkscape:document-units", os.str().c_str());
-
+
+ // Disable changing of SVG Units. The intent here is to change the units in the UI, not the units in SVG.
+ // This code should be moved (and fixed) once we have an "SVG Units" setting that sets what units are used in SVG data.
+#if 0
// Set viewBox
if (doc->getRoot()->viewBox_set) {
gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit);
@@ -1755,10 +1763,11 @@ void DocumentProperties::onDocUnitChange()
prefs->setBool("/options/transform/rectcorners", transform_rectcorners);
prefs->setBool("/options/transform/pattern", transform_pattern);
prefs->setBool("/options/transform/gradient", transform_gradient);
+#endif
doc->setModifiedSinceSave();
- DocumentUndo::done(doc, SP_VERB_NONE, _("Changed document unit"));
+ DocumentUndo::done(doc, SP_VERB_NONE, _("Changed default display unit"));
}
} // namespace Dialog
diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h
index ee7e88b18..b1f90b4b7 100644
--- a/src/ui/dialog/document-properties.h
+++ b/src/ui/dialog/document-properties.h
@@ -94,8 +94,8 @@ protected:
void save_default_metadata();
void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document);
- void _handleActivateDesktop(InkscapeApplication *application, SPDesktop *desktop);
- void _handleDeactivateDesktop(InkscapeApplication *application, SPDesktop *desktop);
+ void _handleActivateDesktop(SPDesktop *desktop);
+ void _handleDeactivateDesktop(SPDesktop *desktop);
Inkscape::XML::SignalObserver _emb_profiles_observer, _scripts_observer;
Gtk::Notebook _notebook;
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index a4d8801f7..6d90c792e 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -51,10 +51,10 @@
#include "ui/widget/unit-menu.h"
#include "util/units.h"
#include "helper/window.h"
-#include "inkscape-private.h"
+#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)->doc_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);
@@ -537,7 +536,7 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl
sb->set_sensitive (sensitive);
pos++;
- if (!ll.empty()) {
+ if (l) {
l->set_mnemonic_widget(*sb);
}
@@ -588,7 +587,7 @@ Glib::ustring Export::create_filepath_from_id (Glib::ustring id, const Glib::ust
}
if (directory.empty()) {
- directory = homedir_path(NULL);
+ directory = INKSCAPE.homedir_path(NULL);
}
Glib::ustring filename = Glib::build_filename(directory, id+".png");
@@ -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/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 5d330f7f0..17cf835cd 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -577,8 +577,9 @@ bool SVGPreview::set(Glib::ustring &fileName, int dialogType)
SVGPreview::SVGPreview()
{
- if (!INKSCAPE)
- inkscape_application_init("", false);
+ // \FIXME Why?!!??
+ if (!Inkscape::Application::exists())
+ Inkscape::Application::create("", false);
document = NULL;
viewerGtk = NULL;
set_size_request(150, 150);
@@ -1083,7 +1084,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk(Gtk::Window &parentWindow, const Gl
}
// allow easy access to the user's own templates folder
- gchar *templates = profile_path("templates");
+ gchar *templates = Inkscape::Application::profile_path("templates");
if (Inkscape::IO::file_test(templates, G_FILE_TEST_EXISTS) &&
Inkscape::IO::file_test(templates, G_FILE_TEST_IS_DIR) && g_path_is_absolute(templates)) {
add_shortcut_folder(templates);
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/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h
index 35c98ef9c..f2a6bf39d 100644
--- a/src/ui/dialog/fill-and-stroke.h
+++ b/src/ui/dialog/fill-and-stroke.h
@@ -41,8 +41,7 @@ public:
virtual void setDesktop(SPDesktop *desktop);
- void selectionChanged(InkscapeApplication *inkscape,
- Inkscape::Selection *selection);
+ //void selectionChanged(Inkscape::Selection *selection);
void showPageFill();
void showPageStrokePaint();
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 1a4823e4a..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,10 +238,10 @@ 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 (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) {
+ if (dynamic_cast<SPText *>(item) || dynamic_cast<SPFlowtext *>(item)) {
gchar *str;
str = sp_te_get_string_multiline (item);
entry_find.getEntry()->set_text(str);
@@ -343,7 +343,7 @@ bool Find::item_text_match (SPItem *item, const gchar *find, bool exact, bool ca
return false;
}
- if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) {
+ if (dynamic_cast<SPText *>(item) || dynamic_cast<SPFlowtext *>(item)) {
const gchar *item_text = sp_te_get_string_multiline (item);
if (item_text == NULL) {
return false;
@@ -388,7 +388,7 @@ bool Find::item_id_match (SPItem *item, const gchar *id, bool exact, bool casema
return false;
}
- if (SP_IS_STRING(item)) { // SPStrings have "on demand" ids which are useless for searching
+ if (dynamic_cast<SPString *>(item)) { // SPStrings have "on demand" ids which are useless for searching
return false;
}
@@ -561,11 +561,14 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch)
if (check_searchin_text.get_active()) {
for (GSList *i = in; i != NULL; i = i->next) {
- if (item_text_match (SP_ITEM(i->data), text, exact, casematch)) {
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ g_assert(item != NULL);
+ if (item_text_match(item, text, exact, casematch)) {
if (!g_slist_find(out, i->data)) {
out = g_slist_prepend (out, i->data);
if (_action_replace) {
- item_text_match (SP_ITEM(i->data), text, exact, casematch, _action_replace);
+ item_text_match(item, text, exact, casematch, _action_replace);
}
}
}
@@ -581,11 +584,13 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch)
if (ids) {
for (GSList *i = in; i != NULL; i = i->next) {
- if (item_id_match (SP_ITEM(i->data), text, exact, casematch)) {
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ if (item_id_match(item, text, exact, casematch)) {
if (!g_slist_find(out, i->data)) {
out = g_slist_prepend (out, i->data);
if (_action_replace) {
- item_id_match (SP_ITEM(i->data), text, exact, casematch, _action_replace);
+ item_id_match(item, text, exact, casematch, _action_replace);
}
}
}
@@ -595,12 +600,15 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch)
if (style) {
for (GSList *i = in; i != NULL; i = i->next) {
- if (item_style_match (SP_ITEM(i->data), text, exact, casematch)) {
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ g_assert(item != NULL);
+ if (item_style_match(item, text, exact, casematch)) {
if (!g_slist_find(out, i->data))
if (!g_slist_find(out, i->data)) {
out = g_slist_prepend (out, i->data);
if (_action_replace) {
- item_style_match (SP_ITEM(i->data), text, exact, casematch, _action_replace);
+ item_style_match(item, text, exact, casematch, _action_replace);
}
}
}
@@ -610,11 +618,14 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch)
if (attrname) {
for (GSList *i = in; i != NULL; i = i->next) {
- if (item_attr_match (SP_ITEM(i->data), text, exact, casematch)) {
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ g_assert(item != NULL);
+ if (item_attr_match(item, text, exact, casematch)) {
if (!g_slist_find(out, i->data)) {
out = g_slist_prepend (out, i->data);
if (_action_replace) {
- item_attr_match (SP_ITEM(i->data), text, exact, casematch, _action_replace);
+ item_attr_match(item, text, exact, casematch, _action_replace);
}
}
}
@@ -624,11 +635,14 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch)
if (attrvalue) {
for (GSList *i = in; i != NULL; i = i->next) {
- if (item_attrvalue_match (SP_ITEM(i->data), text, exact, casematch)) {
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ g_assert(item != NULL);
+ if (item_attrvalue_match(item, text, exact, casematch)) {
if (!g_slist_find(out, i->data)) {
out = g_slist_prepend (out, i->data);
if (_action_replace) {
- item_attrvalue_match (SP_ITEM(i->data), text, exact, casematch, _action_replace);
+ item_attrvalue_match(item, text, exact, casematch, _action_replace);
}
}
}
@@ -638,11 +652,14 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch)
if (font) {
for (GSList *i = in; i != NULL; i = i->next) {
- if (item_font_match (SP_ITEM(i->data), text, exact, casematch)) {
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ g_assert(item != NULL);
+ if (item_font_match(item, text, exact, casematch)) {
if (!g_slist_find(out, i->data)) {
out = g_slist_prepend (out, i->data);
if (_action_replace) {
- item_font_match (SP_ITEM(i->data), text, exact, casematch, _action_replace);
+ item_font_match(item, text, exact, casematch, _action_replace);
}
}
}
@@ -661,34 +678,34 @@ bool Find::item_type_match (SPItem *item)
{
bool all =check_alltypes.get_active();
- if ( SP_IS_RECT(item)) {
+ if ( dynamic_cast<SPRect *>(item)) {
return ( all ||check_rects.get_active());
- } else if (SP_IS_GENERICELLIPSE(item)) {
+ } else if (dynamic_cast<SPGenericEllipse *>(item)) {
return ( all || check_ellipses.get_active());
- } else if (SP_IS_STAR(item) || SP_IS_POLYGON(item)) {
+ } else if (dynamic_cast<SPStar *>(item) || dynamic_cast<SPPolygon *>(item)) {
return ( all || check_stars.get_active());
- } else if (SP_IS_SPIRAL(item)) {
+ } else if (dynamic_cast<SPSpiral *>(item)) {
return ( all || check_spirals.get_active());
- } else if (SP_IS_PATH(item) || SP_IS_LINE(item) || SP_IS_POLYLINE(item)) {
+ } else if (dynamic_cast<SPPath *>(item) || dynamic_cast<SPLine *>(item) || dynamic_cast<SPPolyLine *>(item)) {
return (all || check_paths.get_active());
- } else if (SP_IS_TEXT(item) || SP_IS_TSPAN(item) || SP_IS_TREF(item) || SP_IS_STRING(item)) {
+ } else if (dynamic_cast<SPText *>(item) || dynamic_cast<SPTSpan *>(item) || dynamic_cast<SPTRef *>(item) || dynamic_cast<SPString *>(item)) {
return (all || check_texts.get_active());
- } else if (SP_IS_GROUP(item) && !desktop->isLayer(item) ) { // never select layers!
+ } else if (dynamic_cast<SPGroup *>(item) && !desktop->isLayer(item) ) { // never select layers!
return (all || check_groups.get_active());
- } else if (SP_IS_USE(item)) {
+ } else if (dynamic_cast<SPUse *>(item)) {
return (all || check_clones.get_active());
- } else if (SP_IS_IMAGE(item)) {
+ } else if (dynamic_cast<SPImage *>(item)) {
return (all || check_images.get_active());
- } else if (SP_IS_OFFSET(item)) {
+ } else if (dynamic_cast<SPOffset *>(item)) {
return (all || check_offsets.get_active());
}
@@ -699,7 +716,10 @@ GSList *Find::filter_types (GSList *l)
{
GSList *n = NULL;
for (GSList *i = l; i != NULL; i = i->next) {
- if (item_type_match (SP_ITEM(i->data))) {
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ g_assert(item != NULL);
+ if (item_type_match(item)) {
n = g_slist_prepend (n, i->data);
}
}
@@ -716,7 +736,7 @@ GSList *Find::filter_list (GSList *l, bool exact, bool casematch)
GSList *Find::all_items (SPObject *r, GSList *l, bool hidden, bool locked)
{
- if (SP_IS_DEFS(r)) {
+ if (dynamic_cast<SPDefs *>(r)) {
return l; // we're not interested in items in defs
}
@@ -725,8 +745,8 @@ GSList *Find::all_items (SPObject *r, GSList *l, bool hidden, bool locked)
}
for (SPObject *child = r->firstChild(); child; child = child->getNext()) {
- if (SP_IS_ITEM(child) && !child->cloned && !desktop->isLayer(SP_ITEM(child))) {
- SPItem *item = reinterpret_cast<SPItem *>(child);
+ SPItem *item = dynamic_cast<SPItem *>(child);
+ if (item && !child->cloned && !desktop->isLayer(item)) {
if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) {
l = g_slist_prepend (l, child);
}
@@ -739,16 +759,18 @@ GSList *Find::all_items (SPObject *r, GSList *l, bool hidden, bool locked)
GSList *Find::all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool hidden, bool locked)
{
for (GSList *i = (GSList *) s->itemList(); i != NULL; i = i->next) {
- if (SP_IS_ITEM (i->data) && !reinterpret_cast<SPItem *>(i->data)->cloned && !desktop->isLayer(SP_ITEM(i->data))) {
- SPItem *item = reinterpret_cast<SPItem *>(i->data);
+ SPObject *obj = reinterpret_cast<SPObject *>(i->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ g_assert(item != NULL);
+ if (item && !item->cloned && !desktop->isLayer(item)) {
if (!ancestor || ancestor->isAncestorOf(item)) {
if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) {
l = g_slist_prepend (l, i->data);
}
}
}
- if (!ancestor || ancestor->isAncestorOf(SP_OBJECT (i->data))) {
- l = all_items (SP_OBJECT (i->data), l, hidden, locked);
+ if (!ancestor || ancestor->isAncestorOf(item)) {
+ l = all_items(item, l, hidden, locked);
}
}
return l;
@@ -802,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);
@@ -828,19 +850,22 @@ 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);
- scroll_to_show_item (desktop, SP_ITEM(n->data));
+ SPObject *obj = reinterpret_cast<SPObject *>(n->data);
+ SPItem *item = dynamic_cast<SPItem *>(obj);
+ g_assert(item != NULL);
+ 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 1417b39fa..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"));
}
@@ -567,17 +567,6 @@ void GridArrangeTab::updateSelection()
}
-
-/*##########################
-## Experimental
-##########################*/
-
-static void updateSelectionCallback(InkscapeApplication */*inkscape*/, Inkscape::Selection */*selection*/, GridArrangeTab *dlg)
-{
- dlg->updateSelection();
-}
-
-
//#########################################################################
//## C O N S T R U C T O R / D E S T R U C T O R
//#########################################################################
@@ -605,7 +594,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent)
{
// Selection Change signal
- g_signal_connect ( G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (updateSelectionCallback), this);
+ INKSCAPE.signal_selection_changed.connect(sigc::hide<0>(sigc::mem_fun(*this, &GridArrangeTab::updateSelection)));
}
Gtk::Box *contents = this;
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index 4519a905f..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>
@@ -216,8 +216,8 @@ void GuidelinePropertiesDialog::_setup() {
/* fixme: We should allow percents here too, as percents of the canvas size */
_unit_menu.setUnitType(UNIT_TYPE_LINEAR);
_unit_menu.setUnit("px");
- if (_desktop->namedview->doc_units) {
- _unit_menu.setUnit( _desktop->namedview->doc_units->abbr );
+ if (_desktop->namedview->display_units) {
+ _unit_menu.setUnit( _desktop->namedview->display_units->abbr );
}
_spin_angle.setUnit(_angle_unit_status);
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 c2da12058..0ea6cf082 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;
}
@@ -234,6 +234,9 @@ static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatc
if (!css) return;
+ // remove black-listed properties
+ css = sp_css_attr_unset_blacklist (css);
+
// only store text style for the text tool
if (prefs_path != "/tools/text") {
css = sp_css_attr_unset_text (css);
@@ -276,10 +279,14 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const
p.add_line( true, "", *hb, "", "");
// style swatch
- Gtk::Button* button = Gtk::manage( new Gtk::Button(_("Take from selection"),true));
+ Gtk::Button* button = Gtk::manage( new Gtk::Button(_("Take from selection"), true));
StyleSwatch *swatch = 0;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ if (prefs->getInt(prefs_path + "/usecurrent")) {
+ button->set_sensitive(false);
+ }
+
SPCSSAttr *css = prefs->getStyle(prefs_path + "/style");
swatch = new StyleSwatch(css, _("This tool's style of new objects"));
hb->add(*swatch);
@@ -458,7 +465,7 @@ void InkscapePreferences::initPageTools()
_page_text.add_line( false, _("Text size unit type:"), _font_unit_type, "",
_("Set the type of unit used in the text toolbar and text dialogs"), false);
_font_output_px.init ( _("Always output text size in pixels (px)"), "/options/font/textOutputPx", true);
- _page_text.add_line( false, "", _font_output_px, "", _("Always convert the text size units above into pixels (px) before saving to file"));
+// _page_text.add_line( false, "", _font_output_px, "", _("Always convert the text size units above into pixels (px) before saving to file"));
this->AddNewObjectsStyle(_page_text, "/tools/text");
@@ -838,7 +845,7 @@ void InkscapePreferences::initPageIO()
_save_use_current_dir.init( _("Use current directory for \"Save As ...\""), "/dialogs/save_as/use_current_dir", true);
_page_io.add_line( false, "", _save_use_current_dir, "",
- _("When this option is on, the \"Save as...\" and \"Save a Copy\" dialogs will always open in the directory where the currently open document is; when it's off, each will open in the directory where you last saved a file using it"), true);
+ _("When this option is on, the \"Save as...\" and \"Save a Copy...\" dialogs will always open in the directory where the currently open document is; when it's off, each will open in the directory where you last saved a file using it"), true);
_misc_comment.init( _("Add label comments to printing output"), "/printing/debug/show-label-comments", false);
_page_io.add_line( false, "", _misc_comment, "",
@@ -1739,6 +1746,10 @@ void InkscapePreferences::onKBListKeyboardShortcuts()
// Find this group in the tree
Glib::ustring group = verb->get_group() ? _(verb->get_group()) : _("Misc");
+ Glib::ustring verb_id = verb->get_id();
+ if (verb_id .compare(0,26,"org.inkscape.effect.filter") == 0) {
+ group = _("Filters");
+ }
Gtk::TreeStore::iterator iter_group;
bool found = false;
while (path) {
@@ -1910,7 +1921,7 @@ void InkscapePreferences::initPageSystem()
_page_system.add_group_header( _("System info"));
- _sys_user_config.set_text((char const *)profile_path(""));
+ _sys_user_config.set_text((char const *)Inkscape::Application::profile_path(""));
_sys_user_config.set_editable(false);
_page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true);
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 9a569725c..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"
@@ -295,9 +295,8 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
if ( item ) {
- if ( SP_IS_LPE_ITEM(item) ) {
- SPLPEItem *lpeitem = SP_LPE_ITEM(item);
-
+ SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
+ if ( lpeitem ) {
effect_list_reload(lpeitem);
current_lpeitem = lpeitem;
@@ -318,25 +317,28 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
button_up.set_sensitive(false);
button_down.set_sensitive(false);
}
- } else if ( SP_IS_USE(item) ) {
- // test whether linked object is supported by the CLONE_ORIGINAL LPE
- SPItem *orig = SP_USE(item)->get_original();
- if ( SP_IS_SHAPE(orig) ||
- SP_IS_TEXT(orig) )
- {
- // Note that an SP_USE cannot have an LPE applied, so we only need to worry about the "add effect" case.
- set_sensitize_all(true);
- showText(_("Click add button to convert clone"));
- button_remove.set_sensitive(false);
- button_up.set_sensitive(false);
- button_down.set_sensitive(false);
+ } else {
+ SPUse *use = dynamic_cast<SPUse *>(item);
+ if ( use ) {
+ // test whether linked object is supported by the CLONE_ORIGINAL LPE
+ SPItem *orig = use->get_original();
+ if ( dynamic_cast<SPShape *>(orig) ||
+ dynamic_cast<SPText *>(orig) )
+ {
+ // Note that an SP_USE cannot have an LPE applied, so we only need to worry about the "add effect" case.
+ set_sensitize_all(true);
+ showText(_("Click add button to convert clone"));
+ button_remove.set_sensitive(false);
+ button_up.set_sensitive(false);
+ button_down.set_sensitive(false);
+ } else {
+ showText(_("Select a path or shape"));
+ set_sensitize_all(false);
+ }
} else {
showText(_("Select a path or shape"));
set_sensitize_all(false);
}
- } else {
- showText(_("Select a path or shape"));
- set_sensitize_all(false);
}
} else {
showText(_("Only one item can be selected"));
@@ -396,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(
@@ -423,7 +425,7 @@ LivePathEffectEditor::onAdd()
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
if (item) {
- if ( SP_IS_LPE_ITEM(item) ) {
+ if ( dynamic_cast<SPLPEItem *>(item) ) {
// show effectlist dialog
using Inkscape::UI::Dialog::LivePathEffectAdd;
LivePathEffectAdd::show(current_desktop);
@@ -439,7 +441,7 @@ LivePathEffectEditor::onAdd()
}
// If item is a SPRect, convert it to path first:
- if ( SP_IS_RECT(item) ) {
+ if ( dynamic_cast<SPRect *>(item) ) {
sp_selected_path_to_curves(sel, current_desktop, false);
item = sel->singleItem(); // get new item
}
@@ -451,41 +453,47 @@ LivePathEffectEditor::onAdd()
lpe_list_locked = false;
onSelectionChanged(sel);
- }
- else if ( SP_IS_USE(item) ) {
- // item is a clone. do not show effectlist dialog.
- // convert to path, apply CLONE_ORIGINAL LPE, link it to the cloned path
-
- // test whether linked object is supported by the CLONE_ORIGINAL LPE
- SPItem *orig = SP_USE(item)->get_original();
- if ( SP_IS_SHAPE(orig) ||
- SP_IS_TEXT(orig) )
- {
- // select original
- sel->set(orig);
-
- // delete clone but remember its id and transform
- gchar *id = g_strdup(item->getRepr()->attribute("id"));
- gchar *transform = g_strdup(item->getRepr()->attribute("transform"));
- item->deleteObject(false);
- item = NULL;
-
- // run sp_selection_clone_original_path_lpe
- sp_selection_clone_original_path_lpe(current_desktop);
- SPItem *new_item = sel->singleItem();
- new_item->getRepr()->setAttribute("id", id);
- new_item->getRepr()->setAttribute("transform", transform);
- g_free(id);
- g_free(transform);
-
- /// \todo Add the LPE stack of the original path?
-
- SPDocument *doc = current_desktop->doc();
- DocumentUndo::done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- _("Create and apply Clone original path effect"));
-
- lpe_list_locked = false;
- onSelectionChanged(sel);
+ } else {
+ SPUse *use = dynamic_cast<SPUse *>(item);
+ if ( use ) {
+ // item is a clone. do not show effectlist dialog.
+ // convert to path, apply CLONE_ORIGINAL LPE, link it to the cloned path
+
+ // test whether linked object is supported by the CLONE_ORIGINAL LPE
+ SPItem *orig = use->get_original();
+ if ( dynamic_cast<SPShape *>(orig) ||
+ dynamic_cast<SPText *>(orig) )
+ {
+ // select original
+ sel->set(orig);
+
+ // delete clone but remember its id and transform
+ gchar *id = g_strdup(item->getRepr()->attribute("id"));
+ gchar *transform = g_strdup(item->getRepr()->attribute("transform"));
+ item->deleteObject(false);
+ item = NULL;
+
+ // run sp_selection_clone_original_path_lpe
+ sp_selection_clone_original_path_lpe(current_desktop);
+
+ SPItem *new_item = sel->singleItem();
+ // Check that the cloning was successful. We don't want to change the ID of the original referenced path!
+ if (new_item && (new_item != orig)) {
+ new_item->getRepr()->setAttribute("id", id);
+ new_item->getRepr()->setAttribute("transform", transform);
+ }
+ g_free(id);
+ g_free(transform);
+
+ /// \todo Add the LPE stack of the original path?
+
+ SPDocument *doc = current_desktop->doc();
+ DocumentUndo::done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+ _("Create and apply Clone original path effect"));
+
+ lpe_list_locked = false;
+ onSelectionChanged(sel);
+ }
}
}
}
@@ -498,13 +506,14 @@ LivePathEffectEditor::onRemove()
Inkscape::Selection *sel = _getSelection();
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
- if ( item && SP_IS_LPE_ITEM(item) ) {
- SP_LPE_ITEM(item)->removeCurrentPathEffect(false);
+ SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
+ 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(SP_LPE_ITEM(item));
+ effect_list_reload(lpeitem);
}
}
@@ -515,10 +524,11 @@ void LivePathEffectEditor::onUp()
Inkscape::Selection *sel = _getSelection();
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
- if ( SPLPEItem *lpeitem = SP_LPE_ITEM(item) ) {
+ SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
+ 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);
@@ -531,10 +541,11 @@ void LivePathEffectEditor::onDown()
Inkscape::Selection *sel = _getSelection();
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
- if ( SPLPEItem *lpeitem = SP_LPE_ITEM(item) ) {
+ SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
+ 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);
@@ -573,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 ad8b66b8c..b318933a7 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"
@@ -46,7 +46,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
Gtk::Box *mainVBox = get_vbox();
mainVBox->set_homogeneous(false);
_layout_table.set_spacings(4);
- _layout_table.resize(2, 2);
+ _layout_table.resize(3, 3);
// Layer name widgets
_fillet_chamfer_position_numeric.set_digits(4);
@@ -61,20 +61,33 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
Gtk::FILL);
_layout_table.attach(_fillet_chamfer_position_numeric, 1, 2, 0, 1,
Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
+ _fillet_chamfer_chamfer_subdivisions.set_digits(0);
+ _fillet_chamfer_chamfer_subdivisions.set_increments(1,1);
+ //todo: get tha max aloable infinity freeze the widget
+ _fillet_chamfer_chamfer_subdivisions.set_range(0, 999999999999999999.0);
+
+ _fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:"));
+ _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5);
+
+ _layout_table.attach(_fillet_chamfer_chamfer_subdivisions_label, 0, 1, 1, 2, Gtk::FILL,
+ Gtk::FILL);
+ _layout_table.attach(_fillet_chamfer_chamfer_subdivisions, 1, 2, 1, 2,
+ Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
_fillet_chamfer_type_fillet.set_label(_("Fillet"));
_fillet_chamfer_type_fillet.set_group(_fillet_chamfer_type_group);
_fillet_chamfer_type_inverse_fillet.set_label(_("Inverse fillet"));
_fillet_chamfer_type_inverse_fillet.set_group(_fillet_chamfer_type_group);
_fillet_chamfer_type_chamfer.set_label(_("Chamfer"));
_fillet_chamfer_type_chamfer.set_group(_fillet_chamfer_type_group);
- _fillet_chamfer_type_double_chamfer.set_label(_("Double chamfer"));
- _fillet_chamfer_type_double_chamfer.set_group(_fillet_chamfer_type_group);
+ _fillet_chamfer_type_inverse_chamfer.set_label(_("Inverse chamfer"));
+ _fillet_chamfer_type_inverse_chamfer.set_group(_fillet_chamfer_type_group);
+
mainVBox->pack_start(_layout_table, true, true, 4);
mainVBox->pack_start(_fillet_chamfer_type_fillet, true, true, 4);
mainVBox->pack_start(_fillet_chamfer_type_inverse_fillet, true, true, 4);
mainVBox->pack_start(_fillet_chamfer_type_chamfer, true, true, 4);
- mainVBox->pack_start(_fillet_chamfer_type_double_chamfer, true, true, 4);
+ mainVBox->pack_start(_fillet_chamfer_type_inverse_chamfer, true, true, 4);
// Buttons
_close_button.set_use_stock(true);
@@ -106,7 +119,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog()
{
- _setDesktop(NULL);
+ _set_desktop(NULL);
}
void FilletChamferPropertiesDialog::showDialog(
@@ -115,16 +128,18 @@ void FilletChamferPropertiesDialog::showDialog(
FilletChamferPointArrayParamKnotHolderEntity *pt,
const gchar *unit,
bool use_distance,
- bool aprox_radius)
+ bool aprox_radius,
+ Glib::ustring const * documentUnit)
{
FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog();
- dialog->_setDesktop(desktop);
- dialog->_setUnit(unit);
+ dialog->_set_desktop(desktop);
+ dialog->_set_unit(unit);
dialog->_set_use_distance(use_distance);
dialog->_set_aprox(aprox_radius);
- dialog->_setKnotPoint(knotpoint);
- dialog->_setPt(pt);
+ dialog->_set_document_unit(documentUnit);
+ dialog->_set_knot_point(knotpoint);
+ dialog->_set_pt(pt);
dialog->set_title(_("Modify Fillet-Chamfer"));
dialog->_apply_button.set_label(_("_Modify"));
@@ -146,10 +161,10 @@ void FilletChamferPropertiesDialog::_apply()
d_width = 1;
} else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) {
d_width = 2;
- } else if (_fillet_chamfer_type_chamfer.get_active() == true) {
- d_width = 3;
+ } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) {
+ d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 4000;
} else {
- d_width = 4;
+ d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 3000;
}
if (_flexible) {
if (d_pos > 99.99999 || d_pos < 0) {
@@ -157,7 +172,7 @@ void FilletChamferPropertiesDialog::_apply()
}
d_pos = _index + (d_pos / 100);
} else {
- d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, "px");
+ d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit);
d_pos = d_pos * -1;
}
_knotpoint->knot_set_offset(Geom::Point(d_pos, d_width));
@@ -167,7 +182,7 @@ void FilletChamferPropertiesDialog::_apply()
void FilletChamferPropertiesDialog::_close()
{
- _setDesktop(NULL);
+ _set_desktop(NULL);
destroy_();
Glib::signal_idle().connect(
sigc::bind_return(
@@ -177,7 +192,7 @@ void FilletChamferPropertiesDialog::_close()
);
}
-bool FilletChamferPropertiesDialog::_handleKeyEvent(GdkEventKey *event)
+bool FilletChamferPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/)
{
return false;
}
@@ -189,15 +204,15 @@ void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event)
}
}
-void FilletChamferPropertiesDialog::_setKnotPoint(Geom::Point knotpoint)
+void FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint)
{
double position;
- std::string distance_or_radius = std::string(_("Radius "));
+ std::string distance_or_radius = std::string(_("Radius"));
if(aprox){
- distance_or_radius = std::string(_("Radius aproximated "));
+ distance_or_radius = std::string(_("Radius approximated"));
}
if(use_distance){
- distance_or_radius = std::string(_("Knot distance "));
+ distance_or_radius = std::string(_("Knot distance"));
}
if (knotpoint.x() > 0) {
double intpart;
@@ -207,25 +222,27 @@ void FilletChamferPropertiesDialog::_setKnotPoint(Geom::Point knotpoint)
_fillet_chamfer_position_label.set_label(_("Position (%):"));
} else {
_flexible = false;
- std::string posConcat = distance_or_radius +
- std::string(_("(")) + std::string(unit) + std::string(")");
+ std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit);
_fillet_chamfer_position_label.set_label(_(posConcat.c_str()));
position = knotpoint[Geom::X] * -1;
- position = Inkscape::Util::Quantity::convert(position, "px", unit);
+
+ position = Inkscape::Util::Quantity::convert(position, *document_unit, unit);
}
_fillet_chamfer_position_numeric.set_value(position);
if (knotpoint.y() == 1) {
_fillet_chamfer_type_fillet.set_active(true);
} else if (knotpoint.y() == 2) {
_fillet_chamfer_type_inverse_fillet.set_active(true);
- } else if (knotpoint.y() == 3) {
+ } else if (knotpoint.y() >= 3000 && knotpoint.y() < 4000) {
+ _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 3000);
_fillet_chamfer_type_chamfer.set_active(true);
- } else if (knotpoint.y() == 1) {
- _fillet_chamfer_type_double_chamfer.set_active(true);
+ } else if (knotpoint.y() >= 4000 && knotpoint.y() < 5000) {
+ _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 4000);
+ _fillet_chamfer_type_inverse_chamfer.set_active(true);
}
}
-void FilletChamferPropertiesDialog::_setPt(
+void FilletChamferPropertiesDialog::_set_pt(
const Inkscape::LivePathEffect::
FilletChamferPointArrayParamKnotHolderEntity *pt)
{
@@ -234,11 +251,16 @@ void FilletChamferPropertiesDialog::_setPt(
pt);
}
-void FilletChamferPropertiesDialog::_setUnit(const gchar *abbr)
+void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr)
{
unit = abbr;
}
+void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring const *abbr)
+{
+ document_unit = abbr;
+}
+
void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance)
{
use_distance = use_knot_distance;
@@ -249,7 +271,7 @@ void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius)
aprox = aprox_radius;
}
-void FilletChamferPropertiesDialog::_setDesktop(SPDesktop *desktop)
+void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop)
{
if (desktop) {
Inkscape::GC::anchor(desktop);
diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h
index 47ff97b00..3807e98c8 100644
--- a/src/ui/dialog/lpe-fillet-chamfer-properties.h
+++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h
@@ -32,7 +32,8 @@ public:
FilletChamferPointArrayParamKnotHolderEntity *pt,
const gchar *unit,
bool use_distance,
- bool aprox_radius);
+ bool aprox_radius,
+ Glib::ustring const * documentUnit);
protected:
@@ -46,7 +47,9 @@ protected:
Gtk::RadioButton _fillet_chamfer_type_fillet;
Gtk::RadioButton _fillet_chamfer_type_inverse_fillet;
Gtk::RadioButton _fillet_chamfer_type_chamfer;
- Gtk::RadioButton _fillet_chamfer_type_double_chamfer;
+ Gtk::RadioButton _fillet_chamfer_type_inverse_chamfer;
+ Gtk::Label _fillet_chamfer_chamfer_subdivisions_label;
+ Gtk::SpinButton _fillet_chamfer_chamfer_subdivisions;
Gtk::Table _layout_table;
bool _position_visible;
@@ -62,19 +65,21 @@ protected:
return instance;
}
- void _setDesktop(SPDesktop *desktop);
- void _setPt(const Inkscape::LivePathEffect::
+ void _set_desktop(SPDesktop *desktop);
+ void _set_pt(const Inkscape::LivePathEffect::
FilletChamferPointArrayParamKnotHolderEntity *pt);
- void _setUnit(const gchar *abbr);
+ void _set_unit(const gchar *abbr);
+ void _set_document_unit(Glib::ustring const * abbr);
void _set_use_distance(bool use_knot_distance);
void _set_aprox(bool aprox_radius);
void _apply();
void _close();
bool _flexible;
const gchar *unit;
+ Glib::ustring const * document_unit;
bool use_distance;
bool aprox;
- void _setKnotPoint(Geom::Point knotpoint);
+ void _set_knot_point(Geom::Point knotpoint);
void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row);
bool _handleKeyEvent(GdkEventKey *event);
diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp
index c34351511..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"
@@ -152,7 +152,7 @@ PowerstrokePropertiesDialog::_close()
);
}
-bool PowerstrokePropertiesDialog::_handleKeyEvent(GdkEventKey *event)
+bool PowerstrokePropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/)
{
/*switch (get_group0_keyval(event)) {
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/objects.cpp b/src/ui/dialog/objects.cpp
index 93d5dfbd5..c95529a56 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -988,7 +988,7 @@ void ObjectsPanel::_storeHighlightTarget(const Gtk::TreeModel::iterator& iter)
/*
* Drap and drop within the tree
*/
-bool ObjectsPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time)
+bool ObjectsPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*context*/, int x, int y, guint /*time*/)
{
int cell_x = 0, cell_y = 0;
Gtk::TreeModel::Path target_path;
diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h
index b4a355083..39110f47a 100644
--- a/src/ui/dialog/panel-dialog.h
+++ b/src/ui/dialog/panel-dialog.h
@@ -49,19 +49,10 @@ public:
virtual UI::Widget::Panel &getPanel() { return _panel; }
protected:
- static void handle_deactivate_desktop(InkscapeApplication *application, SPDesktop *desktop, void *data) {
- g_return_if_fail(data != NULL);
- static_cast<PanelDialogBase *>(data)->_propagateDesktopDeactivated(application, desktop);
- }
-
- static void _handle_activate_desktop(InkscapeApplication *application, SPDesktop *desktop, void *data) {
- g_return_if_fail(data != NULL);
- static_cast<PanelDialogBase *>(data)->_propagateDesktopActivated(application, desktop);
- }
inline virtual void _propagateDocumentReplaced(SPDesktop* desktop, SPDocument *document);
- inline virtual void _propagateDesktopActivated(InkscapeApplication *, SPDesktop *);
- inline virtual void _propagateDesktopDeactivated(InkscapeApplication *, SPDesktop *);
+ inline virtual void _propagateDesktopActivated(SPDesktop *);
+ inline virtual void _propagateDesktopDeactivated(SPDesktop *);
UI::Widget::Panel &_panel;
sigc::connection _document_replaced_connection;
@@ -134,17 +125,17 @@ void PanelDialogBase::_propagateDocumentReplaced(SPDesktop *desktop, SPDocument
_panel.signalDocumentReplaced().emit(desktop, document);
}
-void PanelDialogBase::_propagateDesktopActivated(InkscapeApplication *application, SPDesktop *desktop)
+void PanelDialogBase::_propagateDesktopActivated(SPDesktop *desktop)
{
_document_replaced_connection =
desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialogBase::_propagateDocumentReplaced));
- _panel.signalActivateDesktop().emit(application, desktop);
+ _panel.signalActivateDesktop().emit(desktop);
}
-void PanelDialogBase::_propagateDesktopDeactivated(InkscapeApplication *application, SPDesktop *desktop)
+void PanelDialogBase::_propagateDesktopDeactivated(SPDesktop *desktop)
{
_document_replaced_connection.disconnect();
- _panel.signalDeactiveDesktop().emit(application, desktop);
+ _panel.signalDeactiveDesktop().emit(desktop);
}
@@ -162,7 +153,7 @@ PanelDialog<B>::PanelDialog(Widget::Panel &panel, char const *prefs_path, int co
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- _propagateDesktopActivated(INKSCAPE, desktop);
+ _propagateDesktopActivated(desktop);
_document_replaced_connection =
desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialog::_propagateDocumentReplaced));
@@ -211,7 +202,7 @@ PanelDialog<Behavior::FloatingBehavior>::PanelDialog(UI::Widget::Panel &panel, c
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- _propagateDesktopActivated(INKSCAPE, desktop);
+ _propagateDesktopActivated(desktop);
_document_replaced_connection =
desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialog::_propagateDocumentReplaced));
@@ -247,8 +238,12 @@ PanelDialog<Behavior::FloatingBehavior> *PanelDialog<Behavior::FloatingBehavior>
new PanelDialog<Behavior::FloatingBehavior>(panel, panel.getPrefsPath(),
panel.getVerb(), panel.getApplyLabel());
- g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(_handle_activate_desktop), instance);
- g_signal_connect(G_OBJECT(INKSCAPE), "deactivate_desktop", G_CALLBACK(handle_deactivate_desktop), instance);
+ INKSCAPE.signal_activate_desktop.connect(
+ sigc::mem_fun(*instance, &PanelDialog<Behavior::FloatingBehavior>::_propagateDesktopActivated)
+ );
+ INKSCAPE.signal_deactivate_desktop.connect(
+ sigc::mem_fun(*instance, &PanelDialog<Behavior::FloatingBehavior>::_propagateDesktopDeactivated)
+ );
return instance;
}
diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp
index 80579c9d3..281958998 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"
@@ -38,12 +38,12 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_)
#else
parametersTable(3, 3, false),
#endif
- centerY("", "Y coordinate of the center", UNIT_TYPE_LINEAR),
- centerX("", "X coordinate of the center", centerY),
- radiusY("", "Y coordinate of the radius", UNIT_TYPE_LINEAR),
- radiusX("", "X coordinate of the radius", radiusY),
- angleY("", "Starting angle", UNIT_TYPE_RADIAL),
- angleX("", "End angle", angleY)
+ centerY("", C_("Polar arrange tab", "Y coordinate of the center"), UNIT_TYPE_LINEAR),
+ centerX("", C_("Polar arrange tab", "X coordinate of the center"), centerY),
+ radiusY("", C_("Polar arrange tab", "Y coordinate of the radius"), UNIT_TYPE_LINEAR),
+ radiusX("", C_("Polar arrange tab", "X coordinate of the radius"), radiusY),
+ angleY("", C_("Polar arrange tab", "Starting angle"), UNIT_TYPE_RADIAL),
+ angleX("", C_("Polar arrange tab", "End angle"), angleY)
{
anchorPointLabel.set_text(C_("Polar arrange tab", "Anchor point:"));
anchorPointLabel.set_alignment(Gtk::ALIGN_START);
@@ -80,7 +80,7 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_)
arrangeOnParametersRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_arrange_radio_changed));
pack_start(arrangeOnParametersRadio, false, false);
- centerLabel.set_text(_("Center X/Y:"));
+ centerLabel.set_text(C_("Polar arrange tab", "Center X/Y:"));
#if WITH_GTKMM_3_0
parametersTable.attach(centerLabel, 0, 0, 1, 1);
#else
@@ -102,7 +102,7 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_)
parametersTable.attach(centerY, 2, 3, 0, 1, Gtk::FILL);
#endif
- radiusLabel.set_text(_("Radius X/Y:"));
+ radiusLabel.set_text(C_("Polar arrange tab", "Radius X/Y:"));
#if WITH_GTKMM_3_0
parametersTable.attach(radiusLabel, 0, 1, 1, 1);
#else
@@ -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 a3cfeeba8..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);
}
}
@@ -527,7 +526,7 @@ static void loadEmUp()
beenHere = true;
std::list<gchar *> sources;
- sources.push_back( profile_path("palettes") );
+ sources.push_back( Inkscape::Application::profile_path("palettes") );
sources.push_back( g_strdup(INKSCAPE_PALETTESDIR) );
sources.push_back( g_strdup(CREATE_PALETTESDIR) );
@@ -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 a9cf8d068..eeb4d6cbe 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"
@@ -287,8 +287,8 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
++row;
/**********************************************************/
- currentDesktop = inkscape_active_desktop();
- currentDocument = sp_desktop_document(currentDesktop);
+ currentDesktop = SP_ACTIVE_DESKTOP;
+ currentDocument = currentDesktop->getDocument();
previewDocument = symbols_preview_doc(); /* Template to render symbols in */
previewDocument->ensureUpToDate(); /* Necessary? */
@@ -298,8 +298,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
// This might need to be a global variable so setTargetDesktop can modify it
SPDefs *defs = currentDocument->getDefs();
- sigc::connection defsModifiedConn = (SP_OBJECT(defs))->connectModified(
- sigc::mem_fun(*this, &SymbolsDialog::defsModified));
+ sigc::connection defsModifiedConn = defs->connectModified(sigc::mem_fun(*this, &SymbolsDialog::defsModified));
instanceConns.push_back(defsModifiedConn);
sigc::connection selectionChangedConn = currentDesktop->selection->connectChanged(
@@ -499,7 +498,7 @@ void SymbolsDialog::iconChanged() {
}
ClipboardManager *cm = ClipboardManager::get();
- cm->copySymbol(symbol->getRepr(), style);
+ cm->copySymbol(symbol->getRepr(), style, symbolDocument == currentDocument);
}
}
@@ -586,13 +585,15 @@ void SymbolsDialog::get_symbols() {
std::list<Glib::ustring> directories;
+// \TODO optimize this
+
if( Inkscape::IO::file_test( INKSCAPE_SYMBOLSDIR, G_FILE_TEST_EXISTS ) &&
Inkscape::IO::file_test( INKSCAPE_SYMBOLSDIR, G_FILE_TEST_IS_DIR ) ) {
directories.push_back( INKSCAPE_SYMBOLSDIR );
}
- if( Inkscape::IO::file_test( profile_path("symbols"), G_FILE_TEST_EXISTS ) &&
- Inkscape::IO::file_test( profile_path("symbols"), G_FILE_TEST_IS_DIR ) ) {
- directories.push_back( profile_path("symbols") );
+ if( Inkscape::IO::file_test( Inkscape::Application::profile_path("symbols"), G_FILE_TEST_EXISTS ) &&
+ Inkscape::IO::file_test( Inkscape::Application::profile_path("symbols"), G_FILE_TEST_IS_DIR ) ) {
+ directories.push_back( Inkscape::Application::profile_path("symbols") );
}
std::list<Glib::ustring>::iterator it;
@@ -658,11 +659,11 @@ GSList* SymbolsDialog::symbols_in_doc_recursive (SPObject *r, GSList *l)
g_return_val_if_fail(r != NULL, l);
// Stop multiple counting of same symbol
- if( SP_IS_USE(r) ) {
+ if ( dynamic_cast<SPUse *>(r) ) {
return l;
}
- if( SP_IS_SYMBOL(r) ) {
+ if ( dynamic_cast<SPSymbol *>(r) ) {
l = g_slist_prepend (l, r);
}
@@ -684,7 +685,7 @@ GSList* SymbolsDialog::symbols_in_doc( SPDocument* symbolDocument ) {
GSList* SymbolsDialog::use_in_doc_recursive (SPObject *r, GSList *l)
{
- if( SP_IS_USE(r) ) {
+ if ( dynamic_cast<SPUse *>(r) ) {
l = g_slist_prepend (l, r);
}
@@ -709,8 +710,9 @@ gchar const* SymbolsDialog::style_from_use( gchar const* id, SPDocument* documen
gchar const* style = 0;
GSList* l = use_in_doc( document );
for( ; l != NULL; l = l->next ) {
- SPObject* use = SP_OBJECT(l->data);
- if( SP_IS_USE( use ) ) {
+ SPObject *obj = reinterpret_cast<SPObject *>(l->data);
+ SPUse *use = dynamic_cast<SPUse *>(obj);
+ if ( use ) {
gchar const *href = use->getRepr()->attribute("xlink:href");
if( href ) {
Glib::ustring href2(href);
@@ -730,8 +732,9 @@ void SymbolsDialog::add_symbols( SPDocument* symbolDocument ) {
GSList* l = symbols_in_doc( symbolDocument );
for( ; l != NULL; l = l->next ) {
- SPObject* symbol = SP_OBJECT(l->data);
- if (SP_IS_SYMBOL(symbol)) {
+ SPObject *obj = reinterpret_cast<SPObject *>(l->data);
+ SPSymbol *symbol = dynamic_cast<SPSymbol *>(obj);
+ if (symbol) {
add_symbol( symbol );
}
}
@@ -820,7 +823,8 @@ SymbolsDialog::draw_symbol(SPObject *symbol)
previewDocument->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
previewDocument->ensureUpToDate();
- SPItem *item = SP_ITEM(object_temp);
+ SPItem *item = dynamic_cast<SPItem *>(object_temp);
+ g_assert(item != NULL);
unsigned psize = SYMBOL_ICON_SIZES[pack_size];
Glib::RefPtr<Gdk::Pixbuf> pixbuf(NULL);
diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp
index 127e4d95e..8a104d137 100644
--- a/src/ui/dialog/tags.cpp
+++ b/src/ui/dialog/tags.cpp
@@ -380,7 +380,7 @@ void TagsPanel::_objectsSelected( Selection *sel ) {
_checkTreeSelection();
}
-bool TagsPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* obj)
+bool TagsPanel::_checkForSelected(const Gtk::TreePath &/*path*/, const Gtk::TreeIter& iter, SPObject* obj)
{
Gtk::TreeModel::Row row = *iter;
SPObject * it = row[_model->_colObject];
@@ -393,6 +393,7 @@ bool TagsPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIter
return false;
}
+// TODO does not look good that we're ignoring the passed in root. Investigate.
void TagsPanel::_objectsChanged(SPObject* root)
{
while (!_objectWatchers.empty())
@@ -754,7 +755,7 @@ void TagsPanel::_storeDragSource(const Gtk::TreeModel::iterator& iter)
* Drap and drop within the tree
* Save the drag source and drop target SPObjects and if its a drag between layers or into (sublayer) a layer
*/
-bool TagsPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time)
+bool TagsPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*context*/, int x, int y, guint /*time*/)
{
int cell_x = 0, cell_y = 0;
Gtk::TreeModel::Path target_path;
@@ -885,7 +886,7 @@ void TagsPanel::_renameObject(Gtk::TreeModel::Row row, const Glib::ustring& name
}
}
-bool TagsPanel::_noSelection( Glib::RefPtr<Gtk::TreeModel> const & /*model*/, Gtk::TreeModel::Path const & /*path*/, bool currentlySelected )
+bool TagsPanel::_noSelection( Glib::RefPtr<Gtk::TreeModel> const & /*model*/, Gtk::TreeModel::Path const & /*path*/, bool /*currentlySelected*/ )
{
return false;
}
diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp
index 13cb01eef..fca1f7b30 100644
--- a/src/ui/dialog/template-load-tab.cpp
+++ b/src/ui/dialog/template-load-tab.cpp
@@ -194,7 +194,7 @@ void TemplateLoadTab::_refreshTemplatesList()
void TemplateLoadTab::_loadTemplates()
{
// user's local dir
- _getTemplatesFromDir(profile_path("templates") + _loading_path);
+ _getTemplatesFromDir(Inkscape::Application::profile_path("templates") + _loading_path);
// system templates dir
_getTemplatesFromDir(INKSCAPE_TEMPLATESDIR + _loading_path);
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 3e135b9b2..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"
@@ -47,16 +48,13 @@ namespace Inkscape {
namespace UI {
namespace Dialog {
-static void on_selection_changed(InkscapeApplication */*inkscape*/, Inkscape::Selection *selection, Transformation *daad)
+static void on_selection_changed(Inkscape::Selection *selection, Transformation *daad)
{
int page = daad->getCurrentPage();
daad->updateSelection((Inkscape::UI::Dialog::Transformation::PageType)page, selection);
}
-static void on_selection_modified( InkscapeApplication */*inkscape*/,
- Inkscape::Selection *selection,
- guint /*flags*/,
- Transformation *daad )
+static void on_selection_modified(Inkscape::Selection *selection, Transformation *daad)
{
int page = daad->getCurrentPage();
daad->updateSelection((Inkscape::UI::Dialog::Transformation::PageType)page, selection);
@@ -159,8 +157,8 @@ Transformation::Transformation()
}
// Connect to the global selection changed & modified signals
- g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this);
- g_signal_connect (G_OBJECT (INKSCAPE), "modify_selection", G_CALLBACK (on_selection_modified), this);
+ _selChangeConn = INKSCAPE.signal_selection_changed.connect(sigc::bind(sigc::ptr_fun(&on_selection_changed), this));
+ _selModifyConn = INKSCAPE.signal_selection_modified.connect(sigc::hide<1>(sigc::bind(sigc::ptr_fun(&on_selection_modified), this)));
_desktopChangeConn = _deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &Transformation::setDesktop) );
_deskTrack.connect(GTK_WIDGET(gobj()));
@@ -170,7 +168,8 @@ Transformation::Transformation()
Transformation::~Transformation()
{
- sp_signal_disconnect_by_data (G_OBJECT (INKSCAPE), this);
+ _selModifyConn.disconnect();
+ _selChangeConn.disconnect();
_desktopChangeConn.disconnect();
_deskTrack.disconnect();
}
@@ -207,9 +206,9 @@ void Transformation::layoutPageMove()
// Setting default unit to document unit
SPDesktop *dt = getDesktop();
- SPNamedView *nv = sp_desktop_namedview(dt);
- if (nv->doc_units) {
- _units_move.setUnit(nv->doc_units->abbr);
+ SPNamedView *nv = dt->getNamedView();
+ if (nv->display_units) {
+ _units_move.setUnit(nv->display_units->abbr);
}
_scalar_move_horizontal.initScalar(-1e6, 1e6);
@@ -580,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());
}
@@ -803,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"));
}
@@ -865,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"));
}
@@ -890,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"));
}
@@ -905,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);
@@ -916,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);
@@ -930,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);
@@ -949,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);
@@ -960,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);
@@ -970,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);
@@ -978,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"));
}
@@ -994,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;
}
@@ -1008,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/transformation.h b/src/ui/dialog/transformation.h
index 1d24a0c94..89aa95d90 100644
--- a/src/ui/dialog/transformation.h
+++ b/src/ui/dialog/transformation.h
@@ -232,6 +232,9 @@ private:
Gtk::Button *applyButton;
Gtk::Button *resetButton;
Gtk::Button *cancelButton;
+
+ sigc::connection _selChangeConn;
+ sigc::connection _selModifyConn;
};
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 7830a8de1..28a65e0b4 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -29,7 +29,7 @@
#include <gtkmm/imagemenuitem.h>
#include <gtkmm/separatormenuitem.h>
-#include "inkscape-private.h"
+#include "inkscape.h"
#include "extension/db.h"
#include "extension/effect.h"
#include "extension/input.h"
@@ -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"
@@ -270,7 +270,7 @@ sp_create_window(SPViewWidget *vw, bool editable)
// needed because the first ACTIVATE_DESKTOP was sent when there was no window yet
if ( SP_IS_DESKTOP_WIDGET(vw) ) {
- inkscape_reactivate_desktop(SP_DESKTOP_WIDGET(vw)->desktop);
+ INKSCAPE.reactivate_desktop(SP_DESKTOP_WIDGET(vw)->desktop);
}
}
@@ -318,13 +318,13 @@ sp_ui_close_view(GtkWidget */*widget*/)
// If closing the last document, open a new document so Inkscape doesn't quit.
std::list<SPDesktop *> desktops;
- inkscape_get_all_desktops(desktops);
+ INKSCAPE.get_all_desktops(desktops);
if (desktops.size() == 1) {
Glib::ustring templateUri = sp_file_default_template_uri();
SPDocument *doc = SPDocument::createNewDoc( templateUri.c_str() , TRUE, true );
// Set viewBox if it doesn't exist
if (!doc->getRoot()->viewBox_set) {
- doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit())));
+ doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDisplayUnit()), doc->getHeight().value(doc->getDisplayUnit())));
}
dt->change_document(doc);
sp_namedview_window_from_document(dt);
@@ -921,7 +921,7 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I
GtkWidget *sp_ui_main_menubar(Inkscape::UI::View::View *view)
{
GtkWidget *mbar = gtk_menu_bar_new();
- sp_ui_build_dyn_menus(inkscape_get_menus(INKSCAPE), mbar, view);
+ sp_ui_build_dyn_menus(INKSCAPE.get_menus(), mbar, view);
return mbar;
}
@@ -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() );
@@ -2117,13 +2117,13 @@ void ContextMenu::ImageEdit(void)
void ContextMenu::ImageTraceBitmap(void)
{
- inkscape_dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
_desktop->_dlg_mgr->showDialog("Trace");
}
void ContextMenu::ImageTracePixelArt(void)
{
- inkscape_dialogs_unhide();
+ INKSCAPE.dialogs_unhide();
_desktop->_dlg_mgr->showDialog("PixelArt");
}
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/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp
index 013553410..49c949107 100644
--- a/src/ui/tool/curve-drag-point.cpp
+++ b/src/ui/tool/curve-drag-point.cpp
@@ -94,8 +94,22 @@ void CurveDragPoint::dragged(Geom::Point &new_pos, GdkEventMotion *event)
if(!_pm.isBSpline(false)){
first->front()->move(first->front()->position() + offset0);
second->back()->move(second->back()->position() + offset1);
- }else if(weight>=0.8 && held_shift(*event))second->back()->move(new_pos);
- else if(weight<=0.2 && held_shift(*event))first->front()->move(new_pos);
+ }else if(weight>=0.8){
+ if(held_shift(*event)){
+ second->back()->move(new_pos);
+ } else {
+ second->move(second->position() + delta);
+ }
+ }else if(weight<=0.2){
+ if(held_shift(*event)){
+ first->back()->move(new_pos);
+ } else {
+ first->move(first->position() + delta);
+ }
+ }else{
+ first->move(first->position() + delta);
+ second->move(second->position() + delta);
+ }
_pm.update();
}
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 4abc901d2..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"
@@ -60,10 +60,10 @@ Inkscape::ControlType nodeTypeToCtrlType(Inkscape::UI::NodeType type)
namespace Inkscape {
namespace UI {
-const double handleCubicGap = 0.01;
+/*const double handleCubicGap = 0.01;*/
const double noPower = 0.0;
const double defaultStartPower = 0.3334;
-const double defaultEndPower = 0.6667;
+/*const double defaultEndPower = 0.6667;*/
ControlPoint::ColorSet Node::node_colors = {
{0xbfbfbf00, 0x000000ff}, // normal fill, stroke
@@ -566,9 +566,9 @@ Glib::ustring Handle::_getDragTip(GdkEventMotion */*event*/) const
Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dist[Geom::X], "px");
Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dist[Geom::Y], "px");
Inkscape::Util::Quantity len_q = Inkscape::Util::Quantity(length(), "px");
- GString *x = g_string_new(x_q.string(_desktop->namedview->doc_units).c_str());
- GString *y = g_string_new(y_q.string(_desktop->namedview->doc_units).c_str());
- GString *len = g_string_new(len_q.string(_desktop->namedview->doc_units).c_str());
+ GString *x = g_string_new(x_q.string(_desktop->namedview->display_units).c_str());
+ GString *y = g_string_new(y_q.string(_desktop->namedview->display_units).c_str());
+ GString *len = g_string_new(len_q.string(_desktop->namedview->display_units).c_str());
Glib::ustring ret = format_tip(C_("Path handle tip",
"Move handle by %s, %s; angle %.2f°, length %s"), x->str, y->str, angle, len->str);
g_string_free(x, TRUE);
@@ -1490,8 +1490,8 @@ Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/) const
Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dist[Geom::X], "px");
Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dist[Geom::Y], "px");
- GString *x = g_string_new(x_q.string(_desktop->namedview->doc_units).c_str());
- GString *y = g_string_new(y_q.string(_desktop->namedview->doc_units).c_str());
+ GString *x = g_string_new(x_q.string(_desktop->namedview->display_units).c_str());
+ GString *y = g_string_new(y_q.string(_desktop->namedview->display_units).c_str());
Glib::ustring ret = format_tip(C_("Path node tip", "Move node by %s, %s"), x->str, y->str);
g_string_free(x, TRUE);
g_string_free(y, TRUE);
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 52ff5d42c..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"
@@ -59,7 +59,7 @@ enum PathChange {
const double handleCubicGap = 0.01;
const double noPower = 0.0;
const double defaultStartPower = 0.3334;
-const double defaultEndPower = 0.6667;
+
/**
* Notifies the path manipulator when something changes the path being edited
@@ -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,
@@ -1000,7 +1004,6 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d
n->front()->setPosition(seg2[1]);
n->setType(NODE_SMOOTH, false);
} else {
- const double handleCubicGap = 0.01;
Geom::D2< Geom::SBasis > SBasisInsideNodes;
SPCurve *lineInsideNodes = new SPCurve();
if(second->back()->isDegenerate()){
@@ -1251,7 +1254,6 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){
h = h2;
}
double pos = noPower;
- const double handleCubicGap = 0.01;
Node *n = h->parent();
Node * nextNode = NULL;
nextNode = n->nodeToward(h);
@@ -1279,7 +1281,6 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2){
Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){
using Geom::X;
using Geom::Y;
- const double handleCubicGap = 0.01;
Geom::Point ret = h->position();
Node *n = h->parent();
Geom::D2< Geom::SBasis > SBasisInsideNodes;
@@ -1620,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 47b9d2832..11313f550 100644
--- a/src/ui/tools-switch.cpp
+++ b/src/ui/tools-switch.cpp
@@ -16,9 +16,9 @@
#include <cstring>
#include <string>
-#include "inkscape-private.h"
+#include "inkscape.h"
#include "desktop.h"
-#include "desktop-handles.h"
+
#include <glibmm/i18n.h>
#include <xml/repr.h>
@@ -159,7 +159,7 @@ tools_switch(SPDesktop *dt, int num)
/* fixme: This is really ugly hack. We should bind and unbind class methods */
/* First 4 tools use guides, first is undefined but we don't care */
dt->activate_guides(num < 5);
- inkscape_eventcontext_set(dt->getEventContext());
+ INKSCAPE.eventcontext_set(dt->getEventContext());
}
void tools_switch_by_item(SPDesktop *dt, SPItem *item, Geom::Point const p)
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp
index 4f64ade25..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);
@@ -405,8 +405,8 @@ void ArcTool::drag(Geom::Point pt, guint state) {
Inkscape::Util::Quantity rdimx_q = Inkscape::Util::Quantity(rdimx, "px");
Inkscape::Util::Quantity rdimy_q = Inkscape::Util::Quantity(rdimy, "px");
- GString *xs = g_string_new(rdimx_q.string(desktop->namedview->doc_units).c_str());
- GString *ys = g_string_new(rdimy_q.string(desktop->namedview->doc_units).c_str());
+ GString *xs = g_string_new(rdimx_q.string(desktop->namedview->display_units).c_str());
+ GString *ys = g_string_new(rdimy_q.string(desktop->namedview->display_units).c_str());
if (state & GDK_CONTROL_MASK) {
int ratio_x, ratio_y;
@@ -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 7b5c84c16..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() ) {
@@ -1304,14 +1304,14 @@ bool cc_item_is_connector(SPItem *item)
void cc_selection_set_avoid(bool const set_avoid)
{
- SPDesktop *desktop = inkscape_active_desktop();
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop == NULL) {
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..e4c4e855d 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.",
@@ -621,7 +621,7 @@ static ScanlineCheckResult perform_bitmap_scanline_check(std::deque<Geom::Point>
bool currently_painting_top = false;
bool currently_painting_bottom = false;
- unsigned int top_ty = bci.y - 1;
+ unsigned int top_ty = (bci.y > 0) ? bci.y - 1 : 0;
unsigned int bottom_ty = bci.y + 1;
bool can_paint_top = (top_ty > 0);
@@ -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 6434c30d2..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,16 +247,14 @@ 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;
s.imbue(std::locale::classic());
- s << "0," << stroke_width / 2.;
+ s << points[0][Geom::X] << "," << stroke_width / 2.;
// write powerstroke parameters:
lpe->getRepr()->setAttribute("start_linecap_type", "zerowidth");
@@ -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() ) {
@@ -703,8 +701,8 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc)
dc->selection->set(repr);
Inkscape::GC::release(repr);
item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
- item->doWriteTransform(item->getRepr(), item->transform, NULL, true);
item->updateRepr();
+ item->doWriteTransform(item->getRepr(), item->transform, NULL, true);
}
DocumentUndo::done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL,
@@ -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 e2bb85d11..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);
@@ -305,6 +305,16 @@ void NodeTool::update_helperpath () {
if (SP_IS_LPE_ITEM(selection->singleItem())) {
Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE();
if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) {
+ Inkscape::UI::ControlPointSelection::Set &selectionNodes = _selected_nodes->allPoints();
+ std::vector<Geom::Point> selectedNodesPositions;
+ for (Inkscape::UI::ControlPointSelection::Set::iterator i = selectionNodes.begin(); i != selectionNodes.end(); ++i) {
+ if ((*i)->selected()) {
+ Inkscape::UI::Node *n = dynamic_cast<Inkscape::UI::Node *>(*i);
+ selectedNodesPositions.push_back(n->position());
+ }
+ }
+ lpe->setSelectedNodePoints(selectedNodesPositions);
+ lpe->setCurrentZoom(this->desktop->current_zoom());
SPCurve *c = new SPCurve();
SPCurve *cc = new SPCurve();
std::vector<Geom::PathVector> cs = lpe->getCanvasIndicators(SP_LPE_ITEM(selection->singleItem()));
@@ -314,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());
@@ -517,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,
@@ -658,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 92937a135..5174775c9 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -20,10 +20,13 @@
#include <cstring>
#include <string>
+#include "shortcuts.h"
+#include "verbs.h"
+
#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 +195,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 +471,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
@@ -614,7 +617,12 @@ bool PenTool::_handleMotionNotify(GdkEventMotion const &mevent) {
ret = true;
break;
case PenTool::STOP:
- // This is perfectly valid
+ if (!this->sp_event_context_knot_mouseover()) {
+ SnapManager &m = desktop->namedview->snap_manager;
+ m.setup(desktop);
+ m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
+ }
break;
default:
break;
@@ -685,8 +693,7 @@ bool PenTool::_handleMotionNotify(GdkEventMotion const &mevent) {
ret = true;
break;
case PenTool::STOP:
- // This is perfectly valid
- break;
+ // Don't break; fall through to default to do preSnapping
default:
if (!this->sp_event_context_knot_mouseover()) {
SnapManager &m = desktop->namedview->snap_manager;
@@ -846,7 +853,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
@@ -881,7 +888,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);
@@ -1064,6 +1071,23 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gdouble const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000, "px"); // in px
+ // Check for undo if we have started drawing a path.
+ if (this->npoints > 0) {
+ unsigned int shortcut = Inkscape::UI::Tools::get_group0_keyval (&event->key) |
+ ( event->key.state & GDK_SHIFT_MASK ?
+ SP_SHORTCUT_SHIFT_MASK : 0 ) |
+ ( event->key.state & GDK_CONTROL_MASK ?
+ SP_SHORTCUT_CONTROL_MASK : 0 ) |
+ ( event->key.state & GDK_MOD1_MASK ?
+ SP_SHORTCUT_ALT_MASK : 0 );
+ Inkscape::Verb* verb = sp_shortcut_get_verb(shortcut);
+ if (verb) {
+ unsigned int vcode = verb->get_code();
+ if (vcode == SP_VERB_EDIT_UNDO)
+ return _undoLastPoint();
+ }
+ }
+
switch (get_group0_keyval (&event->key)) {
case GDK_KEY_Left: // move last point left
case GDK_KEY_KP_Left:
@@ -1218,14 +1242,6 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
ret = true;
}
break;
- case GDK_KEY_z:
- case GDK_KEY_Z:
- if (MOD__CTRL_ONLY(event) && this->npoints != 0) {
- // if drawing, cancel, otherwise pass it up for undo
- this->_cancel ();
- ret = true;
- }
- break;
case GDK_KEY_g:
case GDK_KEY_G:
if (MOD__SHIFT_ONLY(event)) {
@@ -1236,83 +1252,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
case GDK_KEY_BackSpace:
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
- if ( this->green_curve->is_empty() || (this->green_curve->last_segment() == NULL) ) {
- if (!this->red_curve->is_empty()) {
- this->_cancel ();
- ret = true;
- } else {
- // do nothing; this event should be handled upstream
- }
- } else {
- // Reset red curve
- this->red_curve->reset();
- // Destroy topmost green bpath
- if (this->green_bpaths) {
- if (this->green_bpaths->data) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- }
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
- }
- // Get last segment
- if ( this->green_curve->is_empty() ) {
- g_warning("pen_handle_key_press, case GDK_KP_Delete: Green curve is empty");
- break;
- }
- // The code below assumes that this->green_curve has only ONE path !
- Geom::Curve const * crv = this->green_curve->last_segment();
- this->p[0] = crv->initialPoint();
- if ( Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>(crv)) {
- this->p[1] = (*cubic)[1];
-
- } else {
- this->p[1] = this->p[0];
- }
-
- // asign the value in a third of the distance of the last segment.
- if (this->bspline){
- this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]);
- }
-
- Geom::Point const pt( (this->npoints < 4) ? crv->finalPoint() : this->p[3] );
-
- this->npoints = 2;
- // delete the last segment of the green curve
- if (this->green_curve->get_segment_count() == 1) {
- this->npoints = 5;
- if (this->green_bpaths) {
- if (this->green_bpaths->data) {
- sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
- }
- this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
- }
- this->green_curve->reset();
- } else {
- this->green_curve->backspace();
- }
-
- // assign the value of this->p[1] to the oposite of the green line last segment
- if (this->spiro){
- Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(this->green_curve->last_segment());
- if ( cubic ) {
- this->p[1] = (*cubic)[3] + (*cubic)[3] - (*cubic)[2];
- SP_CTRL(this->c1)->moveto(this->p[0]);
- } else {
- this->p[1] = this->p[0];
- }
- }
-
- sp_canvas_item_hide(this->c0);
- sp_canvas_item_hide(this->c1);
- sp_canvas_item_hide(this->cl0);
- sp_canvas_item_hide(this->cl1);
- this->state = PenTool::POINT;
- this->_setSubsequentPoint(pt, true);
- pen_last_paraxial_dir = !pen_last_paraxial_dir;
-
- //redraw
- this->_bspline_spiro_build();
- ret = true;
- }
+ ret = _undoLastPoint();
break;
default:
break;
@@ -1366,7 +1306,7 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t
Geom::Point rel = p - this->p[pc_point_to_compare];
Inkscape::Util::Quantity q = Inkscape::Util::Quantity(Geom::L2(rel), "px");
- GString *dist = g_string_new(q.string(desktop->namedview->doc_units).c_str());
+ GString *dist = g_string_new(q.string(desktop->namedview->display_units).c_str());
double angle = atan2(rel[Geom::Y], rel[Geom::X]) * 180 / M_PI;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/options/compassangledisplay/value", 0) != 0) {
@@ -1415,7 +1355,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);
@@ -2161,7 +2101,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);
@@ -2175,6 +2115,92 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) {
}
}
+// Partial fix for https://bugs.launchpad.net/inkscape/+bug/171990
+// TODO: implement the redo feature
+bool PenTool::_undoLastPoint() {
+ bool ret = false;
+
+ if ( this->green_curve->is_empty() || (this->green_curve->last_segment() == NULL) ) {
+ if (!this->red_curve->is_empty()) {
+ this->_cancel ();
+ ret = true;
+ } else {
+ // do nothing; this event should be handled upstream
+ }
+ } else {
+ // Reset red curve
+ this->red_curve->reset();
+ // Destroy topmost green bpath
+ if (this->green_bpaths) {
+ if (this->green_bpaths->data) {
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
+ }
+ this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ }
+ // Get last segment
+ if ( this->green_curve->is_empty() ) {
+ g_warning("pen_handle_key_press, case GDK_KP_Delete: Green curve is empty");
+ return false;
+ }
+ // The code below assumes that this->green_curve has only ONE path !
+ Geom::Curve const * crv = this->green_curve->last_segment();
+ this->p[0] = crv->initialPoint();
+ if ( Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>(crv)) {
+ this->p[1] = (*cubic)[1];
+
+ } else {
+ this->p[1] = this->p[0];
+ }
+
+ // asign the value in a third of the distance of the last segment.
+ if (this->bspline){
+ this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]);
+ }
+
+ Geom::Point const pt( (this->npoints < 4) ? crv->finalPoint() : this->p[3] );
+
+ this->npoints = 2;
+ // delete the last segment of the green curve
+ if (this->green_curve->get_segment_count() == 1) {
+ this->npoints = 5;
+ if (this->green_bpaths) {
+ if (this->green_bpaths->data) {
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data));
+ }
+ this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data);
+ }
+ this->green_curve->reset();
+ } else {
+ this->green_curve->backspace();
+ }
+
+ // assign the value of this->p[1] to the oposite of the green line last segment
+ if (this->spiro){
+ Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(this->green_curve->last_segment());
+ if ( cubic ) {
+ this->p[1] = (*cubic)[3] + (*cubic)[3] - (*cubic)[2];
+ SP_CTRL(this->c1)->moveto(this->p[0]);
+ } else {
+ this->p[1] = this->p[0];
+ }
+ }
+
+ sp_canvas_item_hide(this->c0);
+ sp_canvas_item_hide(this->c1);
+ sp_canvas_item_hide(this->cl0);
+ sp_canvas_item_hide(this->cl1);
+ this->state = PenTool::POINT;
+ this->_setSubsequentPoint(pt, true);
+ pen_last_paraxial_dir = !pen_last_paraxial_dir;
+
+ //redraw
+ this->_bspline_spiro_build();
+ ret = true;
+ }
+
+ return ret;
+}
+
void PenTool::_finish(gboolean const closed) {
if (this->expecting_clicks_for_LPE > 1) {
// don't let the path be finished before we have collected the required number of mouse clicks
@@ -2277,7 +2303,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/pen-tool.h b/src/ui/tools/pen-tool.h
index 98fd0a43e..2208005c5 100644
--- a/src/ui/tools/pen-tool.h
+++ b/src/ui/tools/pen-tool.h
@@ -121,6 +121,7 @@ private:
void _setSubsequentPoint(Geom::Point const p, bool statusbar, guint status = 0);
void _setCtrl(Geom::Point const p, guint state);
void _finishSegment(Geom::Point p, guint state);
+ bool _undoLastPoint();
void _finish(gboolean closed);
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 de91dcff4..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();
@@ -422,8 +422,8 @@ void RectTool::drag(Geom::Point const pt, guint state) {
Inkscape::Util::Quantity rdimx_q = Inkscape::Util::Quantity(rdimx, "px");
Inkscape::Util::Quantity rdimy_q = Inkscape::Util::Quantity(rdimy, "px");
- GString *xs = g_string_new(rdimx_q.string(desktop->namedview->doc_units).c_str());
- GString *ys = g_string_new(rdimy_q.string(desktop->namedview->doc_units).c_str());
+ GString *xs = g_string_new(rdimx_q.string(desktop->namedview->display_units).c_str());
+ GString *ys = g_string_new(rdimy_q.string(desktop->namedview->display_units).c_str());
if (state & GDK_CONTROL_MASK) {
int ratio_x, ratio_y;
@@ -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/rect-tool.h b/src/ui/tools/rect-tool.h
index a50fd7b24..a22f1caa8 100644
--- a/src/ui/tools/rect-tool.h
+++ b/src/ui/tools/rect-tool.h
@@ -6,6 +6,7 @@
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2000 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
@@ -21,9 +22,6 @@
#include "sp-rect.h"
-#define SP_RECT_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::RectTool*>((Inkscape::UI::Tools::ToolBase*)obj))
-#define SP_IS_RECT_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::RectTool*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL)
-
namespace Inkscape {
namespace UI {
namespace Tools {
diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp
index 21459e5d0..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
}
}
@@ -1153,9 +1153,9 @@ bool SelectTool::root_handler(GdkEvent* event) {
if (selection->singleItem()) {
SPItem *clicked_item = selection->singleItem();
SPGroup *clickedGroup = dynamic_cast<SPGroup *>(clicked_item);
- if ( (clickedGroup && (clickedGroup->layerMode() == SPGroup::LAYER)) || dynamic_cast<SPBox3D *>(clicked_item)) { // enter group or a 3D box
+ 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 18c3e4e2d..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);
@@ -395,7 +395,7 @@ void SpiralTool::drag(Geom::Point const &p, guint state) {
/* status text */
Inkscape::Util::Quantity q = Inkscape::Util::Quantity(rad, "px");
- GString *rads = g_string_new(q.string(desktop->namedview->doc_units).c_str());
+ GString *rads = g_string_new(q.string(desktop->namedview->display_units).c_str());
this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
_("<b>Spiral</b>: radius %s, angle %5g&#176;; with <b>Ctrl</b> to snap angle"),
rads->str, sp_round((arg + 2.0*M_PI*this->spiral->revo)*180/M_PI, 0.0001));
@@ -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 7604ba04e..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);
@@ -411,7 +411,7 @@ void StarTool::drag(Geom::Point p, guint state)
/* status text */
Inkscape::Util::Quantity q = Inkscape::Util::Quantity(r1, "px");
- GString *rads = g_string_new(q.string(desktop->namedview->doc_units).c_str());
+ GString *rads = g_string_new(q.string(desktop->namedview->display_units).c_str());
this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
( this->isflatsided?
_("<b>Polygon</b>: radius %s, angle %5g&#176;; with <b>Ctrl</b> to snap angle")
@@ -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 a72748733..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"));
}
}
@@ -590,8 +590,8 @@ bool TextTool::root_handler(GdkEvent* event) {
// status text
Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(fabs((p - this->p0)[Geom::X]), "px");
Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(fabs((p - this->p0)[Geom::Y]), "px");
- GString *xs = g_string_new(x_q.string(desktop->namedview->doc_units).c_str());
- GString *ys = g_string_new(y_q.string(desktop->namedview->doc_units).c_str());
+ GString *xs = g_string_new(x_q.string(desktop->namedview->display_units).c_str());
+ GString *ys = g_string_new(y_q.string(desktop->namedview->display_units).c_str());
this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Flowed text frame</b>: %s &#215; %s"), xs->str, ys->str);
g_string_free(xs, FALSE);
@@ -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/view/view.cpp b/src/ui/view/view.cpp
index 72548e213..47e2a1e0d 100644
--- a/src/ui/view/view.cpp
+++ b/src/ui/view/view.cpp
@@ -20,7 +20,7 @@
#include "message-stack.h"
#include "message-context.h"
#include "verbs.h"
-#include "inkscape-private.h"
+#include "inkscape.h"
namespace Inkscape {
namespace UI {
@@ -85,7 +85,7 @@ void View::_close() {
if (_doc) {
_document_uri_set_connection.disconnect();
_document_resized_connection.disconnect();
- if (inkscape_remove_document(_doc)) {
+ if (INKSCAPE.remove_document(_doc)) {
// this was the last view of this document, so delete it
delete _doc;
}
@@ -111,13 +111,13 @@ void View::setDocument(SPDocument *doc) {
if (_doc) {
_document_uri_set_connection.disconnect();
_document_resized_connection.disconnect();
- if (inkscape_remove_document(_doc)) {
+ if (INKSCAPE.remove_document(_doc)) {
// this was the last view of this document, so delete it
delete _doc;
}
}
- inkscape_add_document(doc);
+ INKSCAPE.add_document(doc);
_doc = doc;
_document_uri_set_connection =
diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp
index ce665295b..0798d1c98 100644
--- a/src/ui/widget/addtoicon.cpp
+++ b/src/ui/widget/addtoicon.cpp
@@ -127,13 +127,12 @@ void AddToIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
#endif
}
-bool
-AddToIcon::activate_vfunc(GdkEvent* event,
- Gtk::Widget& /*widget*/,
- const Glib::ustring& path,
- const Gdk::Rectangle& /*background_area*/,
- const Gdk::Rectangle& /*cell_area*/,
- Gtk::CellRendererState /*flags*/)
+bool AddToIcon::activate_vfunc(GdkEvent* /*event*/,
+ Gtk::Widget& /*widget*/,
+ const Glib::ustring& /*path*/,
+ const Gdk::Rectangle& /*background_area*/,
+ const Gdk::Rectangle& /*cell_area*/,
+ Gtk::CellRendererState /*flags*/)
{
return false;
}
diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp
index 6331d70d8..943b1bebc 100644
--- a/src/ui/widget/clipmaskicon.cpp
+++ b/src/ui/widget/clipmaskicon.cpp
@@ -154,13 +154,12 @@ void ClipMaskIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
#endif
}
-bool
-ClipMaskIcon::activate_vfunc(GdkEvent* event,
- Gtk::Widget& /*widget*/,
- const Glib::ustring& path,
- const Gdk::Rectangle& /*background_area*/,
- const Gdk::Rectangle& /*cell_area*/,
- Gtk::CellRendererState /*flags*/)
+bool ClipMaskIcon::activate_vfunc(GdkEvent* /*event*/,
+ Gtk::Widget& /*widget*/,
+ const Glib::ustring& /*path*/,
+ const Gdk::Rectangle& /*background_area*/,
+ const Gdk::Rectangle& /*cell_area*/,
+ Gtk::CellRendererState /*flags*/)
{
return false;
}
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/dock.cpp b/src/ui/widget/dock.cpp
index 52e9ea605..c5e14d4f0 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -119,8 +119,9 @@ Dock::Dock(Gtk::Orientation orientation)
gdl_dock_bar_set_style(_gdl_dock_bar, gdl_dock_bar_style);
- g_signal_connect(G_OBJECT(INKSCAPE), "dialogs_hide", G_CALLBACK(hideCallback), (void *)this);
- g_signal_connect(G_OBJECT(INKSCAPE), "dialogs_unhide", G_CALLBACK(unhideCallback), (void *)this);
+
+ INKSCAPE.signal_dialogs_hide.connect(sigc::mem_fun(*this, &Dock::hide));
+ INKSCAPE.signal_dialogs_unhide.connect(sigc::mem_fun(*this, &Dock::show));
g_signal_connect(_paned->gobj(), "button-press-event", G_CALLBACK(_on_paned_button_event), (void *)this);
g_signal_connect(_paned->gobj(), "button-release-event", G_CALLBACK(_on_paned_button_event), (void *)this);
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/highlight-picker.cpp b/src/ui/widget/highlight-picker.cpp
index 8593f0bdf..09999b52d 100644
--- a/src/ui/widget/highlight-picker.cpp
+++ b/src/ui/widget/highlight-picker.cpp
@@ -147,13 +147,12 @@ void HighlightPicker::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
#endif
}
-bool
-HighlightPicker::activate_vfunc(GdkEvent* event,
- Gtk::Widget& /*widget*/,
- const Glib::ustring& path,
- const Gdk::Rectangle& /*background_area*/,
- const Gdk::Rectangle& /*cell_area*/,
- Gtk::CellRendererState /*flags*/)
+bool HighlightPicker::activate_vfunc(GdkEvent* /*event*/,
+ Gtk::Widget& /*widget*/,
+ const Glib::ustring& /*path*/,
+ const Gdk::Rectangle& /*background_area*/,
+ const Gdk::Rectangle& /*cell_area*/,
+ Gtk::CellRendererState /*flags*/)
{
return false;
}
diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp
index 22abd04ba..df261b69a 100644
--- a/src/ui/widget/imageicon.cpp
+++ b/src/ui/widget/imageicon.cpp
@@ -88,8 +88,9 @@ ImageIcon::~ImageIcon()
*/
void ImageIcon::init()
{
- if (!INKSCAPE)
- inkscape_application_init("",false);
+ // \FIXME Why?
+ if (!Inkscape::Application::exists())
+ Inkscape::Application::create("", false);
document = NULL;
viewerGtkmm = NULL;
//set_size_request(150,150);
diff --git a/src/ui/widget/insertordericon.cpp b/src/ui/widget/insertordericon.cpp
index a28b0f834..9aec7d135 100644
--- a/src/ui/widget/insertordericon.cpp
+++ b/src/ui/widget/insertordericon.cpp
@@ -135,13 +135,12 @@ void InsertOrderIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
#endif
}
-bool
-InsertOrderIcon::activate_vfunc(GdkEvent* event,
- Gtk::Widget& /*widget*/,
- const Glib::ustring& path,
- const Gdk::Rectangle& /*background_area*/,
- const Gdk::Rectangle& /*cell_area*/,
- Gtk::CellRendererState /*flags*/)
+bool InsertOrderIcon::activate_vfunc(GdkEvent* /*event*/,
+ Gtk::Widget& /*widget*/,
+ const Glib::ustring& /*path*/,
+ const Gdk::Rectangle& /*background_area*/,
+ const Gdk::Rectangle& /*cell_area*/,
+ Gtk::CellRendererState /*flags*/)
{
return false;
}
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 e4cd76345..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"
@@ -39,26 +39,6 @@ namespace Inkscape {
namespace UI {
namespace Widget {
-/*void ObjectCompositeSettings::_on_desktop_activate(
- InkscapeApplication *application,
- SPDesktop *desktop,
- ObjectCompositeSettings *w
-) {
- if (w->_subject) {
- w->_subject->setDesktop(desktop);
- }
-}
-
-void ObjectCompositeSettings::_on_desktop_deactivate(
- InkscapeApplication *application,
- SPDesktop *desktop,
- ObjectCompositeSettings *w
-) {
- if (w->_subject) {
- w->_subject->setDesktop(NULL);
- }
-}*/
-
ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char const *history_prefix, int flags)
: _verb_code(verb_code),
_blur_tag(Glib::ustring(history_prefix) + ":blur"),
@@ -102,7 +82,6 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co
ObjectCompositeSettings::~ObjectCompositeSettings() {
setSubject(NULL);
- g_signal_handler_disconnect(G_OBJECT(INKSCAPE), _desktop_activated);
}
void ObjectCompositeSettings::setSubject(StyleSubject *subject) {
@@ -125,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;
@@ -180,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;
}
@@ -204,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 ();
@@ -216,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;
}
@@ -240,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:
@@ -252,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:
@@ -274,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);
@@ -287,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);
}
@@ -295,8 +274,6 @@ ObjectCompositeSettings::_subjectChanged() {
}
}
- sp_style_unref(query);
-
_blocked = false;
}
diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h
index e375bf24a..5a723a2fd 100644
--- a/src/ui/widget/object-composite-settings.h
+++ b/src/ui/widget/object-composite-settings.h
@@ -66,8 +66,8 @@ private:
gulong _desktop_activated;
sigc::connection _subject_changed;
- static void _on_desktop_activate(InkscapeApplication *application, SPDesktop *desktop, ObjectCompositeSettings *w);
- static void _on_desktop_deactivate(InkscapeApplication *application, SPDesktop *desktop, ObjectCompositeSettings *w);
+ static void _on_desktop_activate(SPDesktop *desktop, ObjectCompositeSettings *w);
+ static void _on_desktop_deactivate(SPDesktop *desktop, ObjectCompositeSettings *w);
void _subjectChanged();
void _blendBlurValueChanged();
void _opacityValueChanged();
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index 89b0b8f7e..8c3b44bf5 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,12 +309,12 @@ 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->units) {
- _dimensionUnits.setUnit(nv->units->abbr);
- } else if (nv->doc_units) {
- _dimensionUnits.setUnit(nv->doc_units->abbr);
+ if (nv->page_size_units) {
+ _dimensionUnits.setUnit(nv->page_size_units->abbr);
+ } else if (nv->display_units) {
+ _dimensionUnits.setUnit(nv->display_units->abbr);
}
_wr.setUpdating (false);
@@ -459,7 +459,7 @@ PageSizer::init ()
* \param changeList whether to modify the paper size list
*/
void
-PageSizer::setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool changeList)
+PageSizer::setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool changeList, bool changeSize)
{
static bool _called = false;
if (_called) {
@@ -477,14 +477,15 @@ 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);
- doc->setHeight (h);
+ doc->setWidthAndHeight (w, h, changeSize);
// The origin for the user is in the lower left corner; this point should remain stationary when
// changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this
- Geom::Translate const vert_offset(Geom::Point(0, (old_height.value("px") - h.value("px"))));
- doc->getRoot()->translateChildItems(vert_offset);
+ if (changeSize) {
+ Geom::Translate const vert_offset(Geom::Point(0, (old_height.value("px") - h.value("px"))));
+ doc->getRoot()->translateChildItems(vert_offset);
+ }
DocumentUndo::done(doc, SP_VERB_NONE, _("Set page size"));
}
@@ -606,7 +607,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;
@@ -717,7 +718,8 @@ PageSizer::on_units_changed()
if (_widgetRegistry->isUpdating()) return;
_unit = _dimensionUnits.getUnit()->abbr;
setDim (Inkscape::Util::Quantity(_dimensionWidth.getValue(""), _dimensionUnits.getUnit()),
- Inkscape::Util::Quantity(_dimensionHeight.getValue(""), _dimensionUnits.getUnit()));
+ Inkscape::Util::Quantity(_dimensionHeight.getValue(""), _dimensionUnits.getUnit()),
+ true, false);
}
} // namespace Widget
diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h
index f4bcae4b6..bed117e5a 100644
--- a/src/ui/widget/page-sizer.h
+++ b/src/ui/widget/page-sizer.h
@@ -161,7 +161,7 @@ public:
* Set the page size to the given dimensions. If 'changeList' is
* true, then reset the paper size list to the closest match
*/
- void setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool changeList=true);
+ void setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool changeList=true, bool changeSize=true);
/**
* Updates the scalar widgets for the fit margins. (Just changes the value
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index 0abd81b16..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"
@@ -293,7 +294,7 @@ void Panel::_init()
signalResponse().connect(sigc::mem_fun(*this, &Panel::_handleResponse));
- signalActivateDesktop().connect(sigc::hide<0>(sigc::mem_fun(*this, &Panel::setDesktop)));
+ signalActivateDesktop().connect(sigc::mem_fun(*this, &Panel::setDesktop));
show_all_children();
@@ -643,13 +644,13 @@ Panel::signalDocumentReplaced()
return _signal_document_replaced;
}
-sigc::signal<void, InkscapeApplication *, SPDesktop *> &
+sigc::signal<void, SPDesktop *> &
Panel::signalActivateDesktop()
{
return _signal_activate_desktop;
}
-sigc::signal<void, InkscapeApplication *, SPDesktop *> &
+sigc::signal<void, SPDesktop *> &
Panel::signalDeactiveDesktop()
{
return _signal_deactive_desktop;
@@ -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/panel.h b/src/ui/widget/panel.h
index 177314797..5680cac30 100644
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
@@ -48,6 +48,7 @@ namespace Gtk {
struct InkscapeApplication;
namespace Inkscape {
+
class Selection;
namespace UI {
@@ -116,8 +117,8 @@ public:
void setResponseSensitive(int response_id, bool setting);
virtual sigc::signal<void, SPDesktop *, SPDocument *> &signalDocumentReplaced();
- virtual sigc::signal<void, InkscapeApplication *, SPDesktop *> &signalActivateDesktop();
- virtual sigc::signal<void, InkscapeApplication *, SPDesktop *> &signalDeactiveDesktop();
+ virtual sigc::signal<void, SPDesktop *> &signalActivateDesktop();
+ virtual sigc::signal<void, SPDesktop *> &signalDeactiveDesktop();
protected:
/**
@@ -147,8 +148,8 @@ protected:
sigc::signal<void, int> _signal_response;
sigc::signal<void> _signal_present;
sigc::signal<void, SPDesktop *, SPDocument *> _signal_document_replaced;
- sigc::signal<void, InkscapeApplication *, SPDesktop *> _signal_activate_desktop;
- sigc::signal<void, InkscapeApplication *, SPDesktop *> _signal_deactive_desktop;
+ sigc::signal<void, SPDesktop *> _signal_activate_desktop;
+ sigc::signal<void, SPDesktop *> _signal_deactive_desktop;
private:
void _init();
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 44d8dcbf3..298377af3 100644
--- a/src/ui/widget/registered-widget.cpp
+++ b/src/ui/widget/registered-widget.cpp
@@ -36,6 +36,11 @@
// for interruptability bug:
#include "display/sp-canvas.h"
+#include "desktop.h"
+
+
+#include "sp-root.h"
+
namespace Inkscape {
namespace UI {
namespace Widget {
@@ -108,7 +113,7 @@ RegisteredToggleButton::~RegisteredToggleButton()
_toggled_connection.disconnect();
}
-RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *active_str, char const *inactive_str)
+RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& /*label*/, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *active_str, char const *inactive_str)
: RegisteredWidget<Gtk::ToggleButton>()
, _active_str(active_str)
, _inactive_str(inactive_str)
@@ -203,7 +208,7 @@ RegisteredScalarUnit::~RegisteredScalarUnit()
_value_changed_connection.disconnect();
}
-RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in)
+RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in, RSU_UserUnits user_units)
: RegisteredWidget<ScalarUnit>(label, tip, UNIT_TYPE_LINEAR, "", "", rum.getUnitMenu()),
_um(0)
{
@@ -215,6 +220,7 @@ RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Gl
setUnit (rum.getUnitMenu()->getUnitAbbr());
setDigits (2);
_um = rum.getUnitMenu();
+ _user_units = user_units;
_value_changed_connection = signal_value_changed().connect (sigc::mem_fun (*this, &RegisteredScalarUnit::on_value_changed));
}
@@ -233,12 +239,31 @@ RegisteredScalarUnit::on_value_changed()
_wr->setUpdating (true);
Inkscape::SVGOStringStream os;
- os << getValue("");
- if (_um)
- os << _um->getUnitAbbr();
+ if (_user_units != RSU_none) {
+ // Output length in 'user units', taking into account scale in 'x' or 'y'.
+ double scale = 1.0;
+ if (doc) {
+ SPRoot *root = doc->getRoot();
+ if (root->viewBox_set) {
+ // check to see if scaling is uniform
+ if(Geom::are_near((root->viewBox.width() * root->height.computed) / (root->width.computed * root->viewBox.height()), 1.0, Geom::EPSILON)) {
+ scale = (root->viewBox.width() / root->width.computed + root->viewBox.height() / root->height.computed)/2.0;
+ } else if (_user_units == RSU_x) {
+ scale = root->viewBox.width() / root->width.computed;
+ } else {
+ scale = root->viewBox.height() / root->height.computed;
+ }
+ }
+ }
+ os << getValue("px") * scale;
+ } else {
+ // Output using unit identifiers.
+ os << getValue("");
+ if (_um)
+ os << _um->getUnitAbbr();
+ }
write_to_xml(os.str().c_str());
-
_wr->setUpdating (false);
}
@@ -397,8 +422,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 1f505a3cd..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);
@@ -206,6 +206,14 @@ protected:
void on_changed();
};
+// Allow RegisteredScalarUnit to output lengths in 'user units' (which may have direction dependent
+// scale factors).
+enum RSU_UserUnits {
+ RSU_none,
+ RSU_x,
+ RSU_y
+};
+
class RegisteredScalarUnit : public RegisteredWidget<ScalarUnit> {
public:
~RegisteredScalarUnit();
@@ -215,12 +223,14 @@ public:
const RegisteredUnitMenu &rum,
Registry& wr,
Inkscape::XML::Node* repr_in = NULL,
- SPDocument *doc_in = NULL );
+ SPDocument *doc_in = NULL,
+ RSU_UserUnits _user_units = RSU_none );
protected:
sigc::connection _value_changed_connection;
UnitMenu *_um;
void on_value_changed();
+ RSU_UserUnits _user_units;
};
class RegisteredScalar : public RegisteredWidget<Scalar> {
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index d22c59aa4..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)->doc_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);