summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-12-21 15:39:39 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-12-21 15:39:39 +0000
commit30b6a43219b66aba1a9ebade8aca50910f2c25cc (patch)
treea34e3ffe54acd7ea8ff80b808c5995d71e255dae /src/ui
parentAdd arrow that demonstates 'auto-start-reverse' and 'context-stroke'/'context... (diff)
downloadinkscape-30b6a43219b66aba1a9ebade8aca50910f2c25cc.tar.gz
inkscape-30b6a43219b66aba1a9ebade8aca50910f2c25cc.zip
Deprecate and remove sp_desktop_selection in favor of SPDesktop::getSelection
(bzr r13809)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp8
-rw-r--r--src/ui/dialog/align-and-distribute.cpp17
-rw-r--r--src/ui/dialog/clonetiler.cpp10
-rw-r--r--src/ui/dialog/dialog.cpp2
-rw-r--r--src/ui/dialog/export.cpp36
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp6
-rw-r--r--src/ui/dialog/find.cpp6
-rw-r--r--src/ui/dialog/font-substitution.cpp2
-rw-r--r--src/ui/dialog/grid-arrange-tab.cpp2
-rw-r--r--src/ui/dialog/icon-preview.cpp2
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp2
-rw-r--r--src/ui/dialog/layer-properties.cpp2
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp2
-rw-r--r--src/ui/dialog/object-attributes.cpp2
-rw-r--r--src/ui/dialog/object-properties.cpp10
-rw-r--r--src/ui/dialog/polar-arrange-tab.cpp2
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp5
-rw-r--r--src/ui/dialog/swatches.cpp2
-rw-r--r--src/ui/dialog/text-edit.cpp8
-rw-r--r--src/ui/dialog/transformation.cpp3
-rw-r--r--src/ui/dialog/xml-tree.cpp8
-rw-r--r--src/ui/interface.cpp2
-rw-r--r--src/ui/tools/arc-tool.cpp10
-rw-r--r--src/ui/tools/box3d-tool.cpp10
-rw-r--r--src/ui/tools/calligraphic-tool.cpp12
-rw-r--r--src/ui/tools/connector-tool.cpp4
-rw-r--r--src/ui/tools/dropper-tool.cpp4
-rw-r--r--src/ui/tools/eraser-tool.cpp2
-rw-r--r--src/ui/tools/flood-tool.cpp10
-rw-r--r--src/ui/tools/freehand-base.cpp8
-rw-r--r--src/ui/tools/gradient-tool.cpp8
-rw-r--r--src/ui/tools/lpe-tool.cpp10
-rw-r--r--src/ui/tools/mesh-tool.cpp8
-rw-r--r--src/ui/tools/node-tool.cpp4
-rw-r--r--src/ui/tools/pen-tool.cpp6
-rw-r--r--src/ui/tools/pencil-tool.cpp2
-rw-r--r--src/ui/tools/rect-tool.cpp10
-rw-r--r--src/ui/tools/select-tool.cpp40
-rw-r--r--src/ui/tools/spiral-tool.cpp10
-rw-r--r--src/ui/tools/spray-tool.cpp2
-rw-r--r--src/ui/tools/star-tool.cpp10
-rw-r--r--src/ui/tools/text-tool.cpp18
-rw-r--r--src/ui/tools/tool-base.cpp2
-rw-r--r--src/ui/tools/tweak-tool.cpp2
-rw-r--r--src/ui/widget/panel.cpp3
-rw-r--r--src/ui/widget/selected-style.cpp2
-rw-r--r--src/ui/widget/style-subject.cpp4
47 files changed, 171 insertions, 169 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 7661f466d..9275d3bde 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -201,7 +201,7 @@ void ClipboardManagerImpl::copy(SPDesktop *desktop)
if ( desktop == NULL ) {
return;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// Special case for when the gradient dragger is active - copies gradient color
if (desktop->event_context->get_drag()) {
@@ -435,7 +435,7 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop)
}
// check whether something is selected
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty()) {
_userWarn(desktop, _("Select <b>object(s)</b> to paste style to."));
return false;
@@ -488,7 +488,7 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a
if ( desktop == NULL ) {
return false;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty()) {
_userWarn(desktop, _("Select <b>object(s)</b> to paste size to."));
return false;
@@ -551,7 +551,7 @@ bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop)
return false;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection && selection->isEmpty()) {
_userWarn(desktop, _("Select <b>object(s)</b> to paste live path effect to."));
return false;
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index c538968d6..94e524157 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -91,7 +91,7 @@ Action::Action(const Glib::ustring &id,
void ActionAlign::do_action(SPDesktop *desktop, int index)
{
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -247,7 +247,7 @@ private :
SPDesktop *desktop = _dialog.getDesktop();
if (!desktop) return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
using Inkscape::Util::GSListConstIterator;
@@ -458,8 +458,7 @@ private :
// xGap and yGap are the minimum space required between bounding rectangles.
double const xGap = removeOverlapXGap.get_value();
double const yGap = removeOverlapYGap.get_value();
- removeoverlap(sp_desktop_selection(_dialog.getDesktop())->itemList(),
- xGap, yGap);
+ removeoverlap(_dialog.getDesktop()->getSelection()->itemList(), xGap, yGap);
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
@@ -490,7 +489,7 @@ private :
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
- graphlayout(sp_desktop_selection(_dialog.getDesktop())->itemList());
+ graphlayout(_dialog.getDesktop()->getSelection()->itemList());
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
@@ -547,7 +546,7 @@ private :
SPDesktop *desktop = _dialog.getDesktop();
if (!desktop) return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
using Inkscape::Util::GSListConstIterator;
@@ -617,7 +616,7 @@ private :
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
- unclump ((GSList *) sp_desktop_selection(_dialog.getDesktop())->itemList());
+ unclump ((GSList *) _dialog.getDesktop()->getSelection()->itemList());
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
@@ -644,7 +643,7 @@ private :
SPDesktop *desktop = _dialog.getDesktop();
if (!desktop) return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
using Inkscape::Util::GSListConstIterator;
@@ -743,7 +742,7 @@ private :
SPDesktop *desktop = _dialog.getDesktop();
if (!desktop) return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
using Inkscape::Util::GSListConstIterator;
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index 37881d4ae..f8f220b0a 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -1276,7 +1276,7 @@ CloneTiler::CloneTiler () :
g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(clonetiler_disconnect_gsignal), this);
// update now
- clonetiler_change_selection (sp_desktop_selection(SP_ACTIVE_DESKTOP), dlg);
+ clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg);
}
{
@@ -1379,7 +1379,7 @@ void CloneTiler::clonetiler_change_selection(Inkscape::Selection *selection, Gtk
void CloneTiler::clonetiler_external_change(GtkWidget *dlg)
{
- clonetiler_change_selection (sp_desktop_selection(SP_ACTIVE_DESKTOP), dlg);
+ clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg);
}
void CloneTiler::clonetiler_disconnect_gsignal(GObject *, gpointer source)
@@ -2093,7 +2093,7 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *)
return;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty() || g_slist_length((GSList *) selection->itemList()) > 1) {
@@ -2144,7 +2144,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d
return;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty() || g_slist_length((GSList *) selection->itemList()) > 1) {
@@ -2216,7 +2216,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
return;
}
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 6dabcfb6b..6d8fe4b12 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -310,7 +310,7 @@ void Dialog::_defocus()
Inkscape::Selection*
Dialog::_getSelection()
{
- return sp_desktop_selection(SP_ACTIVE_DESKTOP);
+ return SP_ACTIVE_DESKTOP->getSelection();
}
} // namespace Dialog
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 1ebd1fc7c..d7151fa81 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -606,7 +606,7 @@ void Export::onBatchClicked ()
void Export::updateCheckbuttons ()
{
- gint num = g_slist_length((GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList());
+ gint num = g_slist_length((GSList *) SP_ACTIVE_DESKTOP->getSelection()->itemList());
if (num >= 2) {
batch_export.set_sensitive(true);
batch_export.set_label(g_strdup_printf (ngettext("B_atch export %d selected object","B_atch export %d selected objects",num), num));
@@ -622,7 +622,7 @@ inline void Export::findDefaultSelection()
{
selection_type key = SELECTION_NUMBER_OF;
- if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
+ if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) {
key = SELECTION_SELECTION;
}
@@ -660,15 +660,15 @@ inline void Export::findDefaultSelection()
*/
void Export::onSelectionChanged()
{
- Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP);
+ Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection();
if ((current_key == SELECTION_DRAWING || current_key == SELECTION_PAGE) &&
- (sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false &&
+ (SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false &&
was_empty) {
current_key = SELECTION_SELECTION;
selectiontype_buttons[current_key]->set_active(true);
}
- was_empty = (sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty();
+ was_empty = (SP_ACTIVE_DESKTOP->getSelection())->isEmpty();
if ( selection &&
SELECTION_CUSTOM != current_key) {
@@ -696,7 +696,7 @@ void Export::onSelectionModified ( guint /*flags*/ )
}
break;
case SELECTION_SELECTION:
- Sel = sp_desktop_selection(SP_ACTIVE_DESKTOP);
+ Sel = SP_ACTIVE_DESKTOP->getSelection();
if (Sel->isEmpty() == false) {
Geom::OptRect bbox = Sel->visualBounds();
if (bbox)
@@ -743,9 +743,9 @@ void Export::onAreaToggled ()
probabaly screw something up. */
switch (key) {
case SELECTION_SELECTION:
- if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false)
+ if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false)
{
- bbox = sp_desktop_selection (SP_ACTIVE_DESKTOP)->visualBounds();
+ bbox = SP_ACTIVE_DESKTOP->getSelection()->visualBounds();
/* Only if there is a selection that we can set
do we break, otherwise we fall through to the
drawing */
@@ -810,15 +810,15 @@ void Export::onAreaToggled ()
break;
}
case SELECTION_SELECTION:
- if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
+ if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) {
- sp_selection_get_export_hints (sp_desktop_selection(SP_ACTIVE_DESKTOP), filename, &xdpi, &ydpi);
+ sp_selection_get_export_hints (SP_ACTIVE_DESKTOP->getSelection(), filename, &xdpi, &ydpi);
/* If we still don't have a filename -- let's build
one that's nice */
if (filename.empty()) {
const gchar * id = "object";
- const GSList * reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
+ const GSList * reprlst = SP_ACTIVE_DESKTOP->getSelection()->reprList();
for(; reprlst != NULL; reprlst = reprlst->next) {
Inkscape::XML::Node * repr = (Inkscape::XML::Node *)reprlst->data;
if (repr->attribute("id")) {
@@ -1011,7 +1011,7 @@ void Export::onExport ()
if (batch_export.get_active ()) {
// Batch export of selected objects
- gint num = g_slist_length(const_cast<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 +1025,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 +1070,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);
@@ -1159,7 +1159,7 @@ void Export::onExport ()
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 +1231,7 @@ void Export::onExport ()
bool saved = DocumentUndo::getUndoSensitive(doc);
DocumentUndo::setUndoSensitive(doc, false);
- reprlst = sp_desktop_selection(desktop)->reprList();
+ reprlst = desktop->getSelection()->reprList();
for(; reprlst != NULL; reprlst = reprlst->next) {
Inkscape::XML::Node * repr = static_cast<Inkscape::XML::Node *>(reprlst->data);
@@ -1463,8 +1463,8 @@ void Export::detectSize() {
i++) {
switch (this_test[i]) {
case SELECTION_SELECTION:
- if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
- Geom::OptRect bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds(SPItem::VISUAL_BBOX);
+ if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) {
+ Geom::OptRect bbox = (SP_ACTIVE_DESKTOP->getSelection())->bounds(SPItem::VISUAL_BBOX);
if ( bbox && bbox_equal(*bbox,current_bbox)) {
key = SELECTION_SELECTION;
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index bd44846a3..228570c88 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -688,7 +688,7 @@ public:
private:
void select_svg_element(){
- Inkscape::Selection* sel = sp_desktop_selection(_desktop);
+ Inkscape::Selection* sel = _desktop->getSelection();
if (sel->isEmpty()) return;
Inkscape::XML::Node* node = (Inkscape::XML::Node*) g_slist_nth_data((GSList *)sel->reprList(), 0);
if (!node || !node->matchAttributeName("id")) return;
@@ -1441,7 +1441,7 @@ void FilterEffectsDialog::FilterModifier::on_document_replaced(SPDesktop * /*des
// When the selection changes, show the active filter(s) in the dialog
void FilterEffectsDialog::FilterModifier::on_change_selection()
{
- Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP);
+ Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection();
update_selection(selection);
}
@@ -1539,7 +1539,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri
SPDesktop *desktop = _dialog.getDesktop();
SPDocument *doc = sp_desktop_document(desktop);
SPFilter* filter = (*iter)[_columns.filter];
- Inkscape::Selection *sel = sp_desktop_selection(desktop);
+ Inkscape::Selection *sel = desktop->getSelection();
/* If this filter is the only one used in the selection, unset it */
if((*iter)[_columns.sel] == 1)
diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp
index 1a7832688..be8250f88 100644
--- a/src/ui/dialog/find.cpp
+++ b/src/ui/dialog/find.cpp
@@ -238,7 +238,7 @@ Find::Find()
show_all_children();
- Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP);
+ Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection();
SPItem *item = selection->singleItem();
if (item) {
if (dynamic_cast<SPText *>(item) || dynamic_cast<SPFlowtext *>(item)) {
@@ -850,7 +850,7 @@ void Find::onAction()
button_replace.set_sensitive(attributenameyok);
}
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
selection->clear();
selection->setList(n);
SPObject *obj = reinterpret_cast<SPObject *>(n->data);
@@ -865,7 +865,7 @@ void Find::onAction()
} else {
status.set_text(_("Nothing found"));
if (!check_scope_selection.get_active()) {
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
selection->clear();
}
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No objects found"));
diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp
index db7bdf222..82253417a 100644
--- a/src/ui/dialog/font-substitution.cpp
+++ b/src/ui/dialog/font-substitution.cpp
@@ -134,7 +134,7 @@ FontSubstitution::show(Glib::ustring out, GSList *l)
if (cbSelect->get_active()) {
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
selection->clear();
selection->setList(l);
}
diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp
index 2ff647a74..d60778bd0 100644
--- a/src/ui/dialog/grid-arrange-tab.cpp
+++ b/src/ui/dialog/grid-arrange-tab.cpp
@@ -167,7 +167,7 @@ void GridArrangeTab::arrange()
SPDesktop *desktop = Parent->getDesktop();
sp_desktop_document(desktop)->ensureUpToDate();
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
const GSList *items = selection ? selection->itemList() : 0;
cnt=0;
for (; items != NULL; items = items->next) {
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 468e85d36..25520ba8b 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -362,7 +362,7 @@ void IconPreviewPanel::refreshPreview()
target = (hold && !targetId.empty()) ? desktop->doc()->getObjectById( targetId.c_str() ) : 0;
if ( !target ) {
targetId.clear();
- Inkscape::Selection * sel = sp_desktop_selection(desktop);
+ Inkscape::Selection * sel = desktop->getSelection();
if ( sel ) {
//g_message("found a selection to play with");
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index f00463a84..cea489f50 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -213,7 +213,7 @@ static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatc
if (desktop == NULL)
return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty()) {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE,
diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index d5540b88a..779aa47fe 100644
--- a/src/ui/dialog/layer-properties.cpp
+++ b/src/ui/dialog/layer-properties.cpp
@@ -399,7 +399,7 @@ void LayerPropertiesDialog::Create::perform(LayerPropertiesDialog &dialog) {
if (!name.empty()) {
desktop->layer_manager->renameLayer( new_layer, (gchar *)name.c_str(), TRUE );
}
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
desktop->setCurrentLayer(new_layer);
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("New layer created."));
}
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index 178c32c38..2e96193b9 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -398,7 +398,7 @@ LivePathEffectEditor::setDesktop(SPDesktop *desktop)
lpe_list_locked = false;
current_desktop = desktop;
if (desktop) {
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
selection_changed_connection = selection->connectChanged(
sigc::bind (sigc::ptr_fun(&lpeeditor_selection_changed), this ) );
selection_modified_connection = selection->connectModified(
diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp
index cfa5c6182..118a66097 100644
--- a/src/ui/dialog/object-attributes.cpp
+++ b/src/ui/dialog/object-attributes.cpp
@@ -113,7 +113,7 @@ void ObjectAttributes::widget_setup (void)
return;
}
- Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP);
+ Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection();
SPItem *item = selection->singleItem();
if (!item)
{
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index 28e9b360b..ecfd057de 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -353,7 +353,7 @@ void ObjectProperties::update()
return;
}
- Inkscape::Selection *selection = sp_desktop_selection(SP_ACTIVE_DESKTOP);
+ Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection();
Gtk::Box *contents = _getContents();
if (!selection->singleItem()) {
@@ -458,7 +458,7 @@ void ObjectProperties::_labelChanged()
return;
}
- SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem();
+ SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem();
g_return_if_fail (item != NULL);
_blocked = true;
@@ -518,7 +518,7 @@ void ObjectProperties::_imageRenderingChanged()
return;
}
- SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem();
+ SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem();
g_return_if_fail (item != NULL);
_blocked = true;
@@ -543,7 +543,7 @@ void ObjectProperties::_sensitivityToggled()
return;
}
- SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem();
+ SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem();
g_return_if_fail(item != NULL);
_blocked = true;
@@ -559,7 +559,7 @@ void ObjectProperties::_hiddenToggled()
return;
}
- SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem();
+ SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem();
g_return_if_fail(item != NULL);
_blocked = true;
diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp
index 80579c9d3..08cfba839 100644
--- a/src/ui/dialog/polar-arrange-tab.cpp
+++ b/src/ui/dialog/polar-arrange-tab.cpp
@@ -296,7 +296,7 @@ static void moveToPoint(int anchor, SPItem *item, Geom::Point p)
void PolarArrangeTab::arrange()
{
- Inkscape::Selection *selection = sp_desktop_selection(parent->getDesktop());
+ Inkscape::Selection *selection = parent->getDesktop()->getSelection();
const GSList *items, *tmp;
tmp = items = selection->itemList();
SPGenericEllipse *referenceEllipse = NULL; // Last ellipse in selection
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 56ecfdecc..901cfc40a 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -29,6 +29,7 @@
#include "xml/node.h"
#include "xml/repr.h"
#include "sp-font-face.h"
+#include "desktop.h"
#include "desktop-handles.h"
#include "display/nr-svgfonts.h"
#include "verbs.h"
@@ -516,7 +517,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){
Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop);
SPDocument* doc = sp_desktop_document(desktop);
- Inkscape::Selection* sel = sp_desktop_selection(desktop);
+ Inkscape::Selection* sel = desktop->getSelection();
if (sel->isEmpty()){
char *msg = _("Select a <b>path</b> to define the curves of a glyph");
msgStack->flash(Inkscape::ERROR_MESSAGE, msg);
@@ -558,7 +559,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){
Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop);
SPDocument* doc = sp_desktop_document(desktop);
- Inkscape::Selection* sel = sp_desktop_selection(desktop);
+ Inkscape::Selection* sel = desktop->getSelection();
if (sel->isEmpty()){
char *msg = _("Select a <b>path</b> to define the curves of a glyph");
msgStack->flash(Inkscape::ERROR_MESSAGE, msg);
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 187e31233..df20adc61 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -122,7 +122,7 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr )
if ( gr ) {
bool shown = false;
if ( desktop && desktop->doc() ) {
- Inkscape::Selection *selection = sp_desktop_selection( desktop );
+ Inkscape::Selection *selection = desktop->getSelection();
GSList const *items = selection->itemList();
if (items) {
SPStyle *query = sp_style_new( desktop->doc() );
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index 0f4a6f7f1..0cbe41f78 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -419,7 +419,7 @@ SPItem *TextEdit::getSelectedTextItem (void)
if (!SP_ACTIVE_DESKTOP)
return NULL;
- for (const GSList *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList();
+ for (const GSList *item = SP_ACTIVE_DESKTOP->getSelection()->itemList();
item != NULL;
item = item->next)
{
@@ -438,7 +438,7 @@ unsigned TextEdit::getSelectedTextCount (void)
unsigned int items = 0;
- for (const GSList *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList();
+ for (const GSList *item = SP_ACTIVE_DESKTOP->getSelection()->itemList();
item != NULL;
item = item->next)
{
@@ -543,7 +543,7 @@ void TextEdit::onApply()
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
unsigned items = 0;
- const GSList *item_list = sp_desktop_selection(desktop)->itemList();
+ const GSList *item_list = desktop->getSelection()->itemList();
SPCSSAttr *css = fillTextStyle ();
sp_desktop_set_style(desktop, css, true);
@@ -569,7 +569,7 @@ void TextEdit::onApply()
} else if (items == 1) {
// exactly one text object; now set its text, too
- SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem();
+ SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem();
if (SP_IS_TEXT (item) || SP_IS_FLOWTEXT(item)) {
updateObjectText (item);
}
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 2c6692777..1dba31e5a 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -25,6 +25,7 @@
#include "document.h"
#include "document-undo.h"
+#include "desktop.h"
#include "desktop-handles.h"
#include "transformation.h"
#include "align-and-distribute.h"
@@ -578,7 +579,7 @@ void Transformation::onSwitchPage(Gtk::Widget * /*page*/, guint pagenum)
void Transformation::onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum)
#endif
{
- updateSelection((PageType)pagenum, sp_desktop_selection(getDesktop()));
+ updateSelection((PageType)pagenum, getDesktop()->getSelection());
}
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index 7ab6c78ba..7105e2cda 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -360,7 +360,7 @@ void XmlTree::set_tree_desktop(SPDesktop *desktop)
}
current_desktop = desktop;
if (desktop) {
- sel_changed_connection = sp_desktop_selection(desktop)->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed)));
+ sel_changed_connection = desktop->getSelection()->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed)));
document_replaced_connection = desktop->connectDocumentReplaced(sigc::mem_fun(this, &XmlTree::on_document_replaced));
set_tree_document(sp_desktop_document(desktop));
@@ -472,7 +472,7 @@ Inkscape::XML::Node *XmlTree::get_dt_select()
if (!current_desktop) {
return NULL;
}
- return sp_desktop_selection(current_desktop)->singleRepr();
+ return current_desktop->getSelection()->singleRepr();
}
@@ -483,7 +483,7 @@ void XmlTree::set_dt_select(Inkscape::XML::Node *repr)
return;
}
- Inkscape::Selection *selection = sp_desktop_selection(current_desktop);
+ Inkscape::Selection *selection = current_desktop->getSelection();
SPObject *object;
if (repr) {
@@ -827,7 +827,7 @@ void XmlTree::on_document_replaced(SPDesktop *dt, SPDocument *doc)
if (current_desktop)
sel_changed_connection.disconnect();
- sel_changed_connection = sp_desktop_selection(dt)->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed)));
+ sel_changed_connection = dt->getSelection()->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed)));
set_tree_document(doc);
}
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 6bc94ab7a..0649da3df 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -1232,7 +1232,7 @@ sp_ui_drag_data_received(GtkWidget *widget,
SPObject *new_obj = NULL;
new_obj = desktop->currentLayer()->appendChildRepr(newgroup);
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
selection->set(SP_ITEM(new_obj));
// move to mouse pointer
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp
index 9c3195a42..5fe03cf8e 100644
--- a/src/ui/tools/arc-tool.cpp
+++ b/src/ui/tools/arc-tool.cpp
@@ -109,11 +109,11 @@ void ArcTool::selection_changed(Inkscape::Selection* selection) {
void ArcTool::setup() {
ToolBase::setup();
- Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
this->shape_editor = new ShapeEditor(this->desktop);
- SPItem *item = sp_desktop_selection(this->desktop)->singleItem();
+ SPItem *item = this->desktop->getSelection()->singleItem();
if (item) {
this->shape_editor->set_item(item);
}
@@ -151,7 +151,7 @@ bool ArcTool::item_handler(SPItem* item, GdkEvent* event) {
bool ArcTool::root_handler(GdkEvent* event) {
static bool dragging;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
@@ -442,7 +442,7 @@ void ArcTool::finishItem() {
desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(desktop)->set(this->arc);
+ desktop->getSelection()->set(this->arc);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, _("Create ellipse"));
@@ -451,7 +451,7 @@ void ArcTool::finishItem() {
}
void ArcTool::cancel() {
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
if (this->arc != NULL) {
diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp
index 0a20a0842..20751381d 100644
--- a/src/ui/tools/box3d-tool.cpp
+++ b/src/ui/tools/box3d-tool.cpp
@@ -145,13 +145,13 @@ void Box3dTool::setup() {
this->shape_editor = new ShapeEditor(this->desktop);
- SPItem *item = sp_desktop_selection(this->desktop)->singleItem();
+ SPItem *item = this->desktop->getSelection()->singleItem();
if (item) {
this->shape_editor->set_item(item);
}
this->sel_changed_connection.disconnect();
- this->sel_changed_connection = sp_desktop_selection(this->desktop)->connectChanged(
+ this->sel_changed_connection = this->desktop->getSelection()->connectChanged(
sigc::mem_fun(this, &Box3dTool::selection_changed)
);
@@ -196,7 +196,7 @@ bool Box3dTool::root_handler(GdkEvent* event) {
static bool dragging;
SPDocument *document = sp_desktop_document (desktop);
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12);
@@ -466,7 +466,7 @@ bool Box3dTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_Escape:
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
//TODO: make dragging escapable by Esc
break;
@@ -604,7 +604,7 @@ void Box3dTool::finishItem() {
desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(desktop)->set(this->box3d);
+ desktop->getSelection()->set(this->box3d);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX,
_("Create 3D box"));
diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp
index d297fe5e1..97ac3d112 100644
--- a/src/ui/tools/calligraphic-tool.cpp
+++ b/src/ui/tools/calligraphic-tool.cpp
@@ -506,7 +506,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) {
if (event->motion.state & GDK_CONTROL_MASK) { // hatching - sense the item
- SPItem *selected = sp_desktop_selection(desktop)->singleItem();
+ SPItem *selected = desktop->getSelection()->singleItem();
if (selected && (SP_IS_SHAPE(selected) || SP_IS_TEXT(selected))) {
// One item selected, and it's a path;
// let's try to track it as a guide
@@ -940,14 +940,14 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) {
g_free(str);
if (unionize) {
- sp_desktop_selection(desktop)->add(this->repr);
- sp_selected_path_union_skip_undo(sp_desktop_selection(desktop), desktop);
+ desktop->getSelection()->add(this->repr);
+ sp_selected_path_union_skip_undo(desktop->getSelection(), desktop);
} else if (subtract) {
- sp_desktop_selection(desktop)->add(this->repr);
- sp_selected_path_diff_skip_undo(sp_desktop_selection(desktop), desktop);
+ desktop->getSelection()->add(this->repr);
+ sp_selected_path_diff_skip_undo(desktop->getSelection(), desktop);
} else {
if (this->keep_selected) {
- sp_desktop_selection(desktop)->set(this->repr);
+ desktop->getSelection()->set(this->repr);
}
}
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index 23450fcbd..38a9017d1 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -223,7 +223,7 @@ ConnectorTool::~ConnectorTool() {
void ConnectorTool::setup() {
ToolBase::setup();
- this->selection = sp_desktop_selection(this->desktop);
+ this->selection = this->desktop->getSelection();
this->sel_changed_connection.disconnect();
this->sel_changed_connection = this->selection->connectChanged(
@@ -1311,7 +1311,7 @@ void cc_selection_set_avoid(bool const set_avoid)
SPDocument *document = sp_desktop_document(desktop);
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
GSList *l = const_cast<GSList *>(selection->itemList());
diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp
index 6c55f7484..56bd1598b 100644
--- a/src/ui/tools/dropper-tool.cpp
+++ b/src/ui/tools/dropper-tool.cpp
@@ -328,7 +328,7 @@ bool DropperTool::root_handler(GdkEvent* event) {
gdk_window_set_cursor(window, cursor_dropper_stroke);
}
- if (!(sp_desktop_selection(desktop)->isEmpty())) {
+ if (!(desktop->getSelection()->isEmpty())) {
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER,
_("Set picked color"));
}
@@ -359,7 +359,7 @@ bool DropperTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_Escape:
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
if (!desktop->isWaitingCursor() && !prefs->getBool("/tools/dropper/onetimepick", false)) {
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index bf4015b4c..b8d008421 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -666,7 +666,7 @@ void EraserTool::set_to_accumulated() {
if ( this->repr ) {
bool wasSelection = false;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0;
diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index 5745fc9cc..339ff1c72 100644
--- a/src/ui/tools/flood-tool.cpp
+++ b/src/ui/tools/flood-tool.cpp
@@ -128,13 +128,13 @@ void FloodTool::setup() {
this->shape_editor = new ShapeEditor(this->desktop);
- SPItem *item = sp_desktop_selection(this->desktop)->singleItem();
+ SPItem *item = this->desktop->getSelection()->singleItem();
if (item) {
this->shape_editor->set_item(item);
}
this->sel_changed_connection.disconnect();
- this->sel_changed_connection = sp_desktop_selection(this->desktop)->connectChanged(
+ this->sel_changed_connection = this->desktop->getSelection()->connectChanged(
sigc::mem_fun(this, &FloodTool::selection_changed)
);
@@ -467,7 +467,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto
g_free(affinestr);
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
pathRepr->setPosition(-1);
@@ -476,7 +476,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto
ngettext("Area filled, path with <b>%d</b> node created and unioned with selection.","Area filled, path with <b>%d</b> nodes created and unioned with selection.",
SP_PATH(reprobj)->nodesInPath()), SP_PATH(reprobj)->nodesInPath() );
selection->add(reprobj);
- sp_selected_path_union_skip_undo(sp_desktop_selection(desktop), desktop);
+ sp_selected_path_union_skip_undo(desktop->getSelection(), desktop);
} else {
desktop->messageStack()->flashF( Inkscape::WARNING_MESSAGE,
ngettext("Area filled, path with <b>%d</b> node created.","Area filled, path with <b>%d</b> nodes created.",
@@ -1229,7 +1229,7 @@ void FloodTool::finishItem() {
desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(desktop)->set(this->item);
+ desktop->getSelection()->set(this->item);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area"));
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp
index 32702a17e..95cb112fb 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -117,7 +117,7 @@ FreehandBase::~FreehandBase() {
void FreehandBase::setup() {
ToolBase::setup();
- this->selection = sp_desktop_selection(desktop);
+ this->selection = desktop->getSelection();
// Connect signals to track selection changes
this->sel_changed_connection = this->selection->connectChanged(
@@ -500,7 +500,7 @@ void spdc_endpoint_snap_free(ToolBase const * const ec, Geom::Point& p, boost::o
{
SPDesktop *dt = ec->desktop;
SnapManager &m = dt->namedview->snap_manager;
- Inkscape::Selection *selection = sp_desktop_selection (dt);
+ Inkscape::Selection *selection = dt->getSelection();
// selection->singleItem() is the item that is currently being drawn. This item will not be snapped to (to avoid self-snapping)
// TODO: Allow snapping to the stationary parts of the item, and only ignore the last segment
@@ -715,7 +715,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc)
// results in the tool losing all of the selected path's curve except that last subpath. To
// fix this, we force the selection_modified callback now, to make sure the tool's curve is
// in sync immediately.
- spdc_selection_modified(sp_desktop_selection(desktop), 0, dc);
+ spdc_selection_modified(desktop->getSelection(), 0, dc);
}
c->unref();
@@ -862,7 +862,7 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too
sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width);
item->updateRepr();
- sp_desktop_selection(desktop)->set(item);
+ desktop->getSelection()->set(item);
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot"));
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot"));
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index 9c853917e..fe8774ace 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -112,7 +112,7 @@ void GradientTool::selection_changed(Inkscape::Selection*) {
GradientTool *rc = (GradientTool *) this;
GrDrag *drag = rc->_grdrag;
- Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(rc)->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
if (selection == NULL) {
return;
}
@@ -167,7 +167,7 @@ void GradientTool::setup() {
}
this->enableGrDrag();
- Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
this->selcon = new sigc::connection(selection->connectChanged(
sigc::mem_fun(this, &GradientTool::selection_changed)
@@ -475,7 +475,7 @@ sp_gradient_context_add_stop_near_point (GradientTool *rc, SPItem *item, Geom::
bool GradientTool::root_handler(GdkEvent* event) {
static bool dragging;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
@@ -892,7 +892,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*state*/, guint32 etime)
{
SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
SPDocument *document = sp_desktop_document(desktop);
ToolBase *ec = SP_EVENT_CONTEXT(&rc);
diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp
index 1fd1ebf8c..408116389 100644
--- a/src/ui/tools/lpe-tool.cpp
+++ b/src/ui/tools/lpe-tool.cpp
@@ -110,7 +110,7 @@ LpeTool::~LpeTool() {
void LpeTool::setup() {
PenTool::setup();
- Inkscape::Selection *selection = sp_desktop_selection (this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
SPItem *item = selection->singleItem();
this->sel_changed_connection.disconnect();
@@ -164,7 +164,7 @@ bool LpeTool::item_handler(SPItem* item, GdkEvent* event) {
case GDK_BUTTON_PRESS:
{
// select the clicked item but do nothing else
- Inkscape::Selection * const selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection * const selection = this->desktop->getSelection();
selection->clear();
selection->add(item);
ret = TRUE;
@@ -186,7 +186,7 @@ bool LpeTool::item_handler(SPItem* item, GdkEvent* event) {
}
bool LpeTool::root_handler(GdkEvent* event) {
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
bool ret = false;
@@ -305,7 +305,7 @@ int lpetool_item_has_construction(LpeTool */*lc*/, SPItem *item)
bool
lpetool_try_construction(LpeTool *lc, Inkscape::LivePathEffect::EffectType const type)
{
- Inkscape::Selection *selection = sp_desktop_selection(lc->desktop);
+ Inkscape::Selection *selection = lc->desktop->getSelection();
SPItem *item = selection->singleItem();
// TODO: should we check whether type represents a valid geometric construction?
@@ -396,7 +396,7 @@ void
lpetool_create_measuring_items(LpeTool *lc, Inkscape::Selection *selection)
{
if (!selection) {
- selection = sp_desktop_selection(lc->desktop);
+ selection = lc->desktop->getSelection();
}
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool show = prefs->getBool("/tools/lpetool/show_measuring_info", true);
diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp
index 8a1fb7c72..79a0bb8f2 100644
--- a/src/ui/tools/mesh-tool.cpp
+++ b/src/ui/tools/mesh-tool.cpp
@@ -107,7 +107,7 @@ const gchar *ms_handle_descr [] = {
void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) {
GrDrag *drag = this->_grdrag;
- Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
if (selection == NULL) {
return;
@@ -234,7 +234,7 @@ void MeshTool::setup() {
}
this->enableGrDrag();
- Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
this->selcon = new sigc::connection(selection->connectChanged(
sigc::mem_fun(this, &MeshTool::selection_changed)
@@ -440,7 +440,7 @@ Handles all keyboard and mouse input for meshs.
bool MeshTool::root_handler(GdkEvent* event) {
static bool dragging;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
@@ -933,7 +933,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
static void sp_mesh_drag(MeshTool &rc, Geom::Point const /*pt*/, guint /*state*/, guint32 /*etime*/) {
SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
SPDocument *document = sp_desktop_document(desktop);
ToolBase *ec = SP_EVENT_CONTEXT(&rc);
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index 838c2a884..6a2a780f1 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -215,7 +215,7 @@ void NodeTool::setup() {
data.node_data.node_group = create_control_group(this->desktop);
data.node_data.handle_group = create_control_group(this->desktop);
- Inkscape::Selection *selection = sp_desktop_selection (this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
this->_selection_changed_connection.disconnect();
this->_selection_changed_connection =
@@ -295,7 +295,7 @@ void NodeTool::setup() {
// show helper paths of the applied LPE, if any
void NodeTool::update_helperpath () {
- Inkscape::Selection *selection = sp_desktop_selection (this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
if (this->helperpath_tmpitem) {
this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem);
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index 6b38020a4..7a403eef7 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -468,7 +468,7 @@ bool PenTool::_handleButtonPress(GdkEventButton const &bevent) {
// This is the first click of a new curve; deselect item so that
// this curve is not combined with it (unless it is drawn from its
// anchor, which is handled by the sibling branch above)
- Inkscape::Selection * const selection = sp_desktop_selection(desktop);
+ Inkscape::Selection * const selection = desktop->getSelection();
if (!(bevent.state & GDK_SHIFT_MASK) || this->hasWaitingLPE()) {
// if we have a waiting LPE, we need a fresh path to be created
// so don't append to an existing one
@@ -850,7 +850,7 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) {
if (this->expecting_clicks_for_LPE == 0 && this->hasWaitingLPE()) {
this->setPolylineMode();
- Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
if (this->waiting_LPE) {
// we have an already created LPE waiting for a path
@@ -2281,7 +2281,7 @@ void PenTool::_setToNearestHorizVert(Geom::Point &pt, guint const state, bool sn
// Snap along the constraint line; if we didn't snap then still the constraint will be applied
SnapManager &m = this->desktop->namedview->snap_manager;
- Inkscape::Selection *selection = sp_desktop_selection (this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
// selection->singleItem() is the item that is currently being drawn. This item will not be snapped to (to avoid self-snapping)
// TODO: Allow snapping to the stationary parts of the item, and only ignore the last segment
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 3ea2ae843..d938105ef 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -153,7 +153,7 @@ bool PencilTool::_handleButtonPress(GdkEventButton const &bevent) {
bool ret = false;
if ( bevent.button == 1 && !this->space_panning) {
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (Inkscape::have_viable_layer(desktop, this->message_context) == false) {
return true;
diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp
index 67df0d9a5..69dfad025 100644
--- a/src/ui/tools/rect-tool.cpp
+++ b/src/ui/tools/rect-tool.cpp
@@ -111,13 +111,13 @@ void RectTool::setup() {
this->shape_editor = new ShapeEditor(this->desktop);
- SPItem *item = sp_desktop_selection(this->desktop)->singleItem();
+ SPItem *item = this->desktop->getSelection()->singleItem();
if (item) {
this->shape_editor->set_item(item);
}
this->sel_changed_connection.disconnect();
- this->sel_changed_connection = sp_desktop_selection(this->desktop)->connectChanged(
+ this->sel_changed_connection = this->desktop->getSelection()->connectChanged(
sigc::mem_fun(this, &RectTool::selection_changed)
);
@@ -170,7 +170,7 @@ bool RectTool::root_handler(GdkEvent* event) {
static bool dragging;
SPDesktop *desktop = this->desktop;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -476,7 +476,7 @@ void RectTool::finishItem() {
this->desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(this->desktop)->set(this->rect);
+ this->desktop->getSelection()->set(this->rect);
DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_RECT, _("Create rectangle"));
@@ -485,7 +485,7 @@ void RectTool::finishItem() {
}
void RectTool::cancel(){
- sp_desktop_selection(this->desktop)->clear();
+ this->desktop->getSelection()->clear();
sp_canvas_item_ungrab(SP_CANVAS_ITEM(this->desktop->acetate), 0);
if (this->rect != NULL) {
diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp
index a8267ea1d..6501ec3cc 100644
--- a/src/ui/tools/select-tool.cpp
+++ b/src/ui/tools/select-tool.cpp
@@ -272,7 +272,7 @@ sp_select_context_up_one_layer(SPDesktop *desktop)
{
desktop->setCurrentLayer(parent);
if (current_group && (SPGroup::LAYER != current_group->layerMode())) {
- sp_desktop_selection(desktop)->set(current_layer);
+ desktop->getSelection()->set(current_layer);
}
}
}
@@ -469,7 +469,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
SPItem *item_at_point = NULL, *group_at_point = NULL, *item_in_group = NULL;
gint ret = FALSE;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
// make sure we still have valid objects to move around
@@ -485,7 +485,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
if (dynamic_cast<SPGroup *>(clicked_item) && !dynamic_cast<SPBox3D *>(clicked_item)) { // enter group if it's not a 3D box
desktop->setCurrentLayer(clicked_item);
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
this->dragging = false;
sp_event_context_discard_delayed_snap_event(this);
@@ -974,15 +974,15 @@ bool SelectTool::root_handler(GdkEvent* event) {
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
- sp_selection_move_screen(sp_desktop_selection(desktop), mul*-10, 0); // shift
+ sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift
} else {
- sp_selection_move_screen(sp_desktop_selection(desktop), mul*-1, 0); // no shift
+ sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift
}
} else { // no alt
if (MOD__SHIFT(event)) {
- sp_selection_move(sp_desktop_selection(desktop), mul*-10*nudge, 0); // shift
+ sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift
} else {
- sp_selection_move(sp_desktop_selection(desktop), mul*-nudge, 0); // no shift
+ sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift
}
}
@@ -997,15 +997,15 @@ bool SelectTool::root_handler(GdkEvent* event) {
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
- sp_selection_move_screen(sp_desktop_selection(desktop), 0, mul*10); // shift
+ sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift
} else {
- sp_selection_move_screen(sp_desktop_selection(desktop), 0, mul*1); // no shift
+ sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift
}
} else { // no alt
if (MOD__SHIFT(event)) {
- sp_selection_move(sp_desktop_selection(desktop), 0, mul*10*nudge); // shift
+ sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift
} else {
- sp_selection_move(sp_desktop_selection(desktop), 0, mul*nudge); // no shift
+ sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift
}
}
@@ -1020,15 +1020,15 @@ bool SelectTool::root_handler(GdkEvent* event) {
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
- sp_selection_move_screen(sp_desktop_selection(desktop), mul*10, 0); // shift
+ sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift
} else {
- sp_selection_move_screen(sp_desktop_selection(desktop), mul*1, 0); // no shift
+ sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift
}
} else { // no alt
if (MOD__SHIFT(event)) {
- sp_selection_move(sp_desktop_selection(desktop), mul*10*nudge, 0); // shift
+ sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift
} else {
- sp_selection_move(sp_desktop_selection(desktop), mul*nudge, 0); // no shift
+ sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift
}
}
@@ -1043,15 +1043,15 @@ bool SelectTool::root_handler(GdkEvent* event) {
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
- sp_selection_move_screen(sp_desktop_selection(desktop), 0, mul*-10); // shift
+ sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift
} else {
- sp_selection_move_screen(sp_desktop_selection(desktop), 0, mul*-1); // no shift
+ sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift
}
} else { // no alt
if (MOD__SHIFT(event)) {
- sp_selection_move(sp_desktop_selection(desktop), 0, mul*-10*nudge); // shift
+ sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift
} else {
- sp_selection_move(sp_desktop_selection(desktop), 0, mul*-nudge); // no shift
+ sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift
}
}
@@ -1155,7 +1155,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
SPGroup *clickedGroup = dynamic_cast<SPGroup *>(clicked_item);
if ( (clickedGroup && (clickedGroup->layerMode() != SPGroup::LAYER)) || dynamic_cast<SPBox3D *>(clicked_item)) { // enter group or a 3D box
desktop->setCurrentLayer(clicked_item);
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
} else {
this->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Selected object is not a group. Cannot enter."));
}
diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp
index 31c4e8829..7b11b8469 100644
--- a/src/ui/tools/spiral-tool.cpp
+++ b/src/ui/tools/spiral-tool.cpp
@@ -117,12 +117,12 @@ void SpiralTool::setup() {
this->shape_editor = new ShapeEditor(this->desktop);
- SPItem *item = sp_desktop_selection(this->desktop)->singleItem();
+ SPItem *item = this->desktop->getSelection()->singleItem();
if (item) {
this->shape_editor->set_item(item);
}
- Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
this->sel_changed_connection.disconnect();
this->sel_changed_connection = selection->connectChanged(sigc::mem_fun(this, &SpiralTool::selection_changed));
@@ -154,7 +154,7 @@ bool SpiralTool::root_handler(GdkEvent* event) {
static gboolean dragging;
SPDesktop *desktop = this->desktop;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
@@ -417,7 +417,7 @@ void SpiralTool::finishItem() {
this->desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(this->desktop)->set(this->spiral);
+ this->desktop->getSelection()->set(this->spiral);
DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_SPIRAL, _("Create spiral"));
this->spiral = NULL;
@@ -425,7 +425,7 @@ void SpiralTool::finishItem() {
}
void SpiralTool::cancel() {
- sp_desktop_selection(this->desktop)->clear();
+ this->desktop->getSelection()->clear();
sp_canvas_item_ungrab(SP_CANVAS_ITEM(this->desktop->acetate), 0);
if (this->spiral != NULL) {
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index cdc608558..c36b77fb7 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -527,7 +527,7 @@ static bool sp_spray_recursive(SPDesktop *desktop,
static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point p, Geom::Point vector, bool reverse)
{
SPDesktop *desktop = tc->desktop;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty()) {
return false;
diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp
index b5544d263..a5e46e5b7 100644
--- a/src/ui/tools/star-tool.cpp
+++ b/src/ui/tools/star-tool.cpp
@@ -127,12 +127,12 @@ void StarTool::setup() {
this->shape_editor = new ShapeEditor(this->desktop);
- SPItem *item = sp_desktop_selection(this->desktop)->singleItem();
+ SPItem *item = this->desktop->getSelection()->singleItem();
if (item) {
this->shape_editor->set_item(item);
}
- Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
this->sel_changed_connection.disconnect();
@@ -168,7 +168,7 @@ bool StarTool::root_handler(GdkEvent* event) {
static bool dragging;
SPDesktop *desktop = this->desktop;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
@@ -441,7 +441,7 @@ void StarTool::finishItem() {
desktop->canvas->endForcedFullRedraws();
- sp_desktop_selection(desktop)->set(this->star);
+ desktop->getSelection()->set(this->star);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
_("Create star"));
@@ -450,7 +450,7 @@ void StarTool::finishItem() {
}
void StarTool::cancel() {
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
if (this->star != NULL) {
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index 578add843..e9fe45165 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -175,15 +175,15 @@ void TextTool::setup() {
this->shape_editor = new ShapeEditor(this->desktop);
- SPItem *item = sp_desktop_selection(this->desktop)->singleItem();
+ SPItem *item = this->desktop->getSelection()->singleItem();
if (item && SP_IS_FLOWTEXT(item) && SP_FLOWTEXT(item)->has_internal_frame()) {
this->shape_editor->set_item(item);
}
- this->sel_changed_connection = sp_desktop_selection(desktop)->connectChangedFirst(
+ this->sel_changed_connection = desktop->getSelection()->connectChangedFirst(
sigc::mem_fun(*this, &TextTool::_selectionChanged)
);
- this->sel_modified_connection = sp_desktop_selection(desktop)->connectModifiedFirst(
+ this->sel_modified_connection = desktop->getSelection()->connectModifiedFirst(
sigc::mem_fun(*this, &TextTool::_selectionModified)
);
this->style_set_connection = desktop->connectSetStyle(
@@ -193,7 +193,7 @@ void TextTool::setup() {
sigc::mem_fun(*this, &TextTool::_styleQueried)
);
- _selectionChanged(sp_desktop_selection(desktop));
+ _selectionChanged(desktop->getSelection());
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/tools/text/selcue")) {
@@ -268,7 +268,7 @@ bool TextTool::item_handler(SPItem* item, GdkEvent* event) {
// find out clicked item, disregarding groups
item_ungrouped = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE);
if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) {
- sp_desktop_selection(desktop)->set(item_ungrouped);
+ desktop->getSelection()->set(item_ungrouped);
if (this->text) {
// find out click point in document coordinates
Geom::Point p = desktop->w2d(Geom::Point(event->button.x, event->button.y));
@@ -425,7 +425,7 @@ static void sp_text_context_setup_text(TextTool *tc)
SPItem *text_item = SP_ITEM(ec->desktop->currentLayer()->appendChildRepr(rtext));
/* fixme: Is selection::changed really immediate? */
/* yes, it's immediate .. why does it matter? */
- sp_desktop_selection(ec->desktop)->set(text_item);
+ ec->desktop->getSelection()->set(text_item);
Inkscape::GC::release(rtext);
text_item->transform = SP_ITEM(ec->desktop->currentLayer())->i2doc_affine().inverse();
@@ -627,7 +627,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->creating && this->within_tolerance) {
/* Button 1, set X & Y & new item */
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
this->pdoc = desktop->dt2doc(p1);
this->show = TRUE;
this->phase = 1;
@@ -660,7 +660,7 @@ bool TextTool::root_handler(GdkEvent* event) {
SPItem *ft = create_flowtext_with_internal_frame (desktop, this->p0, p1);
/* Set style */
sp_desktop_apply_style_tool(desktop, ft->getRepr(), "/tools/text", true);
- sp_desktop_selection(desktop)->set(ft);
+ desktop->getSelection()->set(ft);
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Flowed text is created."));
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Create flowed text"));
} else {
@@ -1117,7 +1117,7 @@ bool TextTool::root_handler(GdkEvent* event) {
}
Inkscape::Rubberband::get(desktop)->stop();
} else {
- sp_desktop_selection(desktop)->clear();
+ desktop->getSelection()->clear();
}
this->nascent_object = FALSE;
return TRUE;
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 37ca5eeea..d0ce18ee3 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -1083,7 +1083,7 @@ void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event)
/* fixme: This is not what I want but works for now (Lauris) */
if (event->type == GDK_KEY_PRESS) {
- item = sp_desktop_selection(desktop)->singleItem();
+ item = desktop->getSelection()->singleItem();
}
ContextMenu* CM = new ContextMenu(desktop, item);
diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp
index f56975de2..c3601138d 100644
--- a/src/ui/tools/tweak-tool.cpp
+++ b/src/ui/tools/tweak-tool.cpp
@@ -1032,7 +1032,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point,
static bool
sp_tweak_dilate (TweakTool *tc, Geom::Point event_p, Geom::Point p, Geom::Point vector, bool reverse)
{
- Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(tc)->desktop);
+ Inkscape::Selection *selection = tc->desktop->getSelection();
SPDesktop *desktop = SP_EVENT_CONTEXT(tc)->desktop;
if (selection->isEmpty()) {
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index c96eac838..39aa6c584 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -33,6 +33,7 @@
#include "panel.h"
#include "icon-size.h"
#include "preferences.h"
+#include "desktop.h"
#include "desktop-handles.h"
#include "inkscape.h"
#include "widgets/eek-preview.h"
@@ -667,7 +668,7 @@ void Panel::_handleResponse(int response_id)
Inkscape::Selection *Panel::_getSelection()
{
- return sp_desktop_selection(_desktop);
+ return _desktop->getSelection();
}
} // namespace Widget
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index aebef2c4e..ec3194478 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -480,7 +480,7 @@ SelectedStyle::setDesktop(SPDesktop *desktop)
_desktop = desktop;
g_object_set_data (G_OBJECT(_opacity_sb.gobj()), "dtw", _desktop->canvas);
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
selection_changed_connection = new sigc::connection (selection->connectChanged(
sigc::bind (
diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp
index d9bf7e2aa..1646b0fed 100644
--- a/src/ui/widget/style-subject.cpp
+++ b/src/ui/widget/style-subject.cpp
@@ -49,7 +49,7 @@ StyleSubject::Selection::~Selection() {
Inkscape::Selection *StyleSubject::Selection::_getSelection() const {
SPDesktop *desktop = getDesktop();
if (desktop) {
- return sp_desktop_selection(desktop);
+ return desktop->getSelection();
} else {
return NULL;
}
@@ -88,7 +88,7 @@ void StyleSubject::Selection::_afterDesktopSwitch(SPDesktop *desktop) {
_sel_modified.disconnect();
if (desktop) {
_subsel_changed = desktop->connectToolSubselectionChanged(sigc::hide(sigc::mem_fun(*this, &Selection::_emitChanged)));
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection) {
_sel_changed = selection->connectChanged(sigc::hide(sigc::mem_fun(*this, &Selection::_emitChanged)));
_sel_modified = selection->connectModified(sigc::hide(sigc::hide(sigc::mem_fun(*this, &Selection::_emitChanged))));