summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
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/dialog
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/dialog')
-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
49 files changed, 622 insertions, 574 deletions
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);
}