summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/selection-chemistry.cpp30
-rw-r--r--src/selection-chemistry.h1
-rw-r--r--src/ui/dialog/layers.cpp2
3 files changed, 33 insertions, 0 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index d94b085a0..cd0001175 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -250,6 +250,36 @@ void SelectionHelper::selectPrev(SPDesktop *dt)
}
}
+/*
+ * Fixes the current selection, removing locked objects from it
+ */
+void SelectionHelper::fixSelection(SPDesktop *dt)
+{
+ if(!dt)
+ return;
+
+ Inkscape::Selection *selection = sp_desktop_selection(dt);
+
+ GSList *items = NULL;
+
+ GSList const *selList = selection->itemList();
+
+ for( GSList const *i = selList; i; i = i->next ) {
+ if( SP_IS_ITEM(i->data) &&
+ !dt->isLayer(SP_ITEM(i->data)) &&
+ (!SP_ITEM(i->data)->isLocked()))
+ {
+ items = g_slist_prepend(items, SP_ITEM(i->data));
+ }
+ }
+
+ selection->setList(items);
+
+ if(items) {
+ g_slist_free(items);
+ }
+}
+
} // namespace Inkscape
diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h
index 1c627fd1a..8711a6cdf 100644
--- a/src/selection-chemistry.h
+++ b/src/selection-chemistry.h
@@ -47,6 +47,7 @@ namespace Inkscape {
static void reverse(SPDesktop *dt);
static void selectNext(SPDesktop *desktop);
static void selectPrev(SPDesktop *desktop);
+ static void fixSelection(SPDesktop *desktop);
};
} // namespace Inkscape
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index dd147d00f..5cc9578f1 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -41,6 +41,7 @@
#include "xml/repr.h"
#include "sp-root.h"
#include "event-context.h"
+#include "selection-chemistry.h"
//#define DUMP_LAYERS 1
@@ -536,6 +537,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol )
break;
}
}
+ Inkscape::SelectionHelper::fixSelection(_desktop);
}
bool LayersPanel::_handleKeyEvent(GdkEventKey *event)