summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-02-26 23:35:45 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-05-09 19:42:11 +0000
commitcf0e762fa380de08b8f3043b4e9c0b3c33fd817b (patch)
tree0791e9eda32f35a633b0dd7112091556c0eacf8c /src
parentFix https://gitlab.com/inkscape/inkscape/merge_requests/208#note_60693688 (diff)
downloadinkscape-cf0e762fa380de08b8f3043b4e9c0b3c33fd817b.tar.gz
inkscape-cf0e762fa380de08b8f3043b4e9c0b3c33fd817b.zip
fix https://gitlab.com/inkscape/inkscape/merge_requests/208#note_60694271
Diffstat (limited to 'src')
-rw-r--r--src/extension/implementation/implementation.h11
-rw-r--r--src/extension/internal/bitmap/imagemagick.cpp10
-rw-r--r--src/extension/internal/bluredge.cpp12
-rw-r--r--src/extension/internal/filter/filter.cpp14
-rw-r--r--src/extension/internal/grid.cpp12
5 files changed, 15 insertions, 44 deletions
diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h
index 1232ae0c8..fa4a64725 100644
--- a/src/extension/implementation/implementation.h
+++ b/src/extension/implementation/implementation.h
@@ -59,6 +59,17 @@ public:
ImplementationDocumentCache (Inkscape::UI::View::View * view) :
_view(view)
{
+ SPDesktop *desktop = (SPDesktop*)view;
+ Inkscape::Selection * selection = NULL;
+ if (desktop) {
+ selection = desktop->getSelection();
+ if (selection && !selection->params.empty()) {
+ selection->restoreBackup();
+ if (!desktop->on_live_extension) {
+ selection->emptyBackup();
+ }
+ }
+ }
return;
};
virtual ~ImplementationDocumentCache ( ) { return; };
diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp
index 32d6f59e3..636b9d6a4 100644
--- a/src/extension/internal/bitmap/imagemagick.cpp
+++ b/src/extension/internal/bitmap/imagemagick.cpp
@@ -64,16 +64,6 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) :
_imageItems(NULL)
{
SPDesktop *desktop = (SPDesktop*)view;
- Inkscape::Selection * selection = NULL;
- if (desktop) {
- selection = desktop->getSelection();
- if (selection && !selection->params.empty()) {
- selection->restoreBackup();
- if (!desktop->on_live_extension) {
- selection->emptyBackup();
- }
- }
- }
auto selectedItemList = desktop->selection->items();
int selectCount = (int) boost::distance(selectedItemList);
diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp
index c086405e5..4bcc5d715 100644
--- a/src/extension/internal/bluredge.cpp
+++ b/src/extension/internal/bluredge.cpp
@@ -54,6 +54,7 @@ void
BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *desktop, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/)
{
+ Inkscape::Selection * selection = static_cast<SPDesktop *>(desktop)->selection;
float width = module->get_param_float("blur-width");
int steps = module->get_param_int("num-steps");
@@ -61,17 +62,6 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px");
- SPDesktop *deskt = static_cast<SPDesktop *>(desktop);
- Inkscape::Selection * selection = NULL;
- if (deskt) {
- selection = deskt->selection;
- if (selection && !selection->params.empty()) {
- selection->restoreBackup();
- if (!deskt->on_live_extension) {
- selection->emptyBackup();
- }
- }
- }
// TODO need to properly refcount the items, at least
std::vector<SPItem*> items(selection->items().begin(), selection->items().end());
selection->clear();
diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp
index af4997eba..69aec1595 100644
--- a/src/extension/internal/filter/filter.cpp
+++ b/src/extension/internal/filter/filter.cpp
@@ -120,19 +120,9 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie
if (filterdoc == NULL) {
return; // could not parse the XML source of the filter; typically parser will stderr a warning
}
-
//printf("Calling filter effect\n");
- SPDesktop *desktop = (SPDesktop *)document;
- Inkscape::Selection * selection = NULL;
- if (desktop) {
- selection = desktop->selection;
- if (selection && !selection->params.empty()) {
- selection->restoreBackup();
- if (!desktop->on_live_extension) {
- selection->emptyBackup();
- }
- }
- }
+ Inkscape::Selection * selection = ((SPDesktop *)document)->selection;
+
// TODO need to properly refcount the items, at least
std::vector<SPItem*> items(selection->items().begin(), selection->items().end());
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp
index 6b3f2efe3..c7ebf2494 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -86,17 +86,7 @@ Glib::ustring build_lines(Geom::Rect bounding_area,
void
Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/)
{
- SPDesktop *desktop = ((SPDesktop *)document);
- Inkscape::Selection * selection = NULL;
- if (desktop) {
- selection = desktop->getSelection();
- if (selection && !selection->params.empty()) {
- selection->restoreBackup();
- if (!desktop->on_live_extension) {
- selection->emptyBackup();
- }
- }
- }
+ Inkscape::Selection * selection = ((SPDesktop *)document)->selection;
Geom::Rect bounding_area = Geom::Rect(Geom::Point(0,0), Geom::Point(100,100));
if (selection->isEmpty()) {