Code

Option to keep selection when changing layers
authorjoncruz <joncruz@users.sourceforge.net>
Sun, 28 May 2006 08:07:39 +0000 (08:07 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Sun, 28 May 2006 08:07:39 +0000 (08:07 +0000)
ChangeLog
src/dialogs/layers-panel.cpp
src/layer-manager.cpp
src/layer-manager.h
src/preferences-skeleton.h
src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h
src/widgets/layer-selector.cpp

index 4eca93a67fac2223a08b5ce3da9123cc1f47e38d..0b7f66a708cec9b4030721c701eb05e5167fe0a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-05-28  Jon A. Cruz  <jon@joncruz.org>
+
+       * src/layer-manager.cpp, src/layer-manager.cpp,
+         src/preferences-skeleton.h, src/ui/dialog/inkscape-preferences.cpp,
+         src/ui/dialog/inkscape-preferences.h,
+         src/widgets/layer-selector.cpp, src/dialogs/layers-panel.cpp:
+
+         Finished option to turn on or off deslecting when switching layers.
+         Fixes RFE #1495701.
+
 2006-05-28  Jon A. Cruz  <jon@joncruz.org>
 
        * src/dialogs/layers-panel.h, src/dialogs/layers-panel.cpp:
index 2dc7c2a9e9918cf8c16079972df13ab48c4d59a2..cdcafbbc1c5d80d9b9a97dc1ac68627247027003 100644 (file)
@@ -29,8 +29,6 @@
 
 #include "document.h"
 #include "desktop.h"
-#include "desktop-handles.h"
-#include "selection.h"
 #include "sp-object.h"
 #include "sp-item.h"
 #include "widgets/icon.h"
@@ -504,14 +502,10 @@ void LayersPanel::_pushTreeSelectionToCurrent()
     if ( inTree ) {
         SPObject* curr = _desktop->currentLayer();
         if ( curr != inTree ) {
-            // TODO - move these to a function in layer-manager.cpp
-            _desktop->setCurrentLayer( inTree );
-            sp_desktop_selection(_desktop)->clear();
+            _mgr->setCurrentLayer( inTree );
         }
     } else {
-        // TODO - move these to a function in layer-manager.cpp
-        _desktop->setCurrentLayer( _desktop->doc()->root );
-        sp_desktop_selection(_desktop)->clear();
+        _mgr->setCurrentLayer( _desktop->doc()->root );
     }
 }
 
index 81e8698b05f083a537a4e95f7c7fd4d9e236247c..e2e40340f6dff1d4d94e3594eba369429aa21585 100644 (file)
 #include "gc-finalized.h"
 #include "document.h"
 #include "desktop.h"
+#include "desktop-handles.h"
 #include "layer-manager.h"
+#include "prefs-utils.h"
 #include "ui/view/view.h"
+#include "selection.h"
 #include "sp-object.h"
 #include "xml/node.h"
 #include "xml/node-observer.h"
@@ -70,6 +73,15 @@ LayerManager::LayerManager(SPDesktop *desktop)
 }
 
 
+void LayerManager::setCurrentLayer( SPObject* obj )
+{
+    _desktop->setCurrentLayer( obj );
+
+    if ( prefs_get_int_attribute_limited("options.selection", "layerdeselect", 1, 0, 1) ) {
+        sp_desktop_selection( _desktop )->clear();
+    }
+}
+
 void LayerManager::renameLayer( SPObject* obj, gchar const *label )
 {
     Glib::ustring incoming( label ? label : "" );
index 461134baab4d735e688afb3ef6d2736d880ce16c..fa710e93803883f792bfedab39b397da57a23f3e 100644 (file)
@@ -26,6 +26,7 @@ class LayerManager : public DocumentSubset,
 public:
     LayerManager(SPDesktop *desktop);
 
+    void setCurrentLayer( SPObject* obj );
     void renameLayer( SPObject* obj, gchar const *label );
 
     sigc::connection connectCurrentLayerChanged(const sigc::slot<void, SPObject *> & slot) {
index 30748bfdcaad2d562d4efd8668c5197982b986b8..a0aa1a1a535094ad5b719e4f2b5268d5698072d2 100644 (file)
@@ -186,6 +186,7 @@ static char const preferences_skeleton[] =
 "    <group id=\"importbitmapsasimages\" value=\"1\"/>\n"
 "    <group id=\"transform\" stroke=\"1\" rectcorners=\"1\" pattern=\"1\" gradient=\"1\" />\n"
 "    <group id=\"kbselection\" inlayer=\"1\" onlyvisible=\"1\" onlysensitive=\"1\" />\n"
+"    <group id=\"selection\" layerdeselect=\"1\" />\n"
 "    <group id=\"createbitmap\" minsize=\"250\"/>\n"
 "    <group id=\"compassangledisplay\" value=\"0\"/>\n"
 "    <group id=\"maskobject\" topmost=\"1\" remove=\"1\"/>\n"
index 04f28dc0030cdb9d7a1395dd1dff86b929052b65..c8e9448b4e99a6a21f2199b7941da22b04af0a42 100644 (file)
@@ -487,6 +487,7 @@ void InkscapePreferences::initPageSelecting()
     _sel_recursive.init ( _("Select in current layer and sublayers"), "options.kbselection", "inlayer", PREFS_SELECTION_LAYER_RECURSIVE, false, &_sel_all);
     _sel_hidden.init ( _("Ignore hidden objects"), "options.kbselection", "onlyvisible", true);
     _sel_locked.init ( _("Ignore locked objects"), "options.kbselection", "onlysensitive", true);
+    _sel_layer_deselects.init ( _("Deselect upon layer change"), "options.selection", "layerdeselect", true);
 
     _page_select.add_group_header( _("Ctrl+A, Tab, Shift+Tab:"));
     _page_select.add_line( true, "", _sel_all, "", 
@@ -500,6 +501,9 @@ void InkscapePreferences::initPageSelecting()
     _page_select.add_line( true, "", _sel_locked, "", 
                            _("Uncheck this to be able to select objects that are locked (either by themselves or by being in a locked group or layer)"));
 
+    _page_select.add_line( false, "", _sel_layer_deselects, "", 
+                           _("Uncheck this to be able to keep the current objects selected when the current layer changes"));
+
     this->AddPage(_page_select, _("Selecting"), PREFS_PAGE_SELECTING);
 }
 
index fb9fc2f49537271c5a8efac803b5bf7204db756c..00b415b668c7471004f097cc76a0fa15a7013552 100644 (file)
@@ -129,6 +129,7 @@ protected:
     PrefRadioButton _sel_current;
     PrefRadioButton _sel_recursive;
     PrefCheckButton _sel_hidden, _sel_locked;
+    PrefCheckButton _sel_layer_deselects;
 
     PrefSpinButton  _misc_export, _misc_recent, _misc_simpl;
     PrefCheckButton _misc_imp_bitmap, _misc_comment, _misc_scripts;
index bf23dcfcac1bbad8d03eccbf621bb6557f59f686..94a891dc24106c7eca22eb889a977a9ae858d85c 100644 (file)
@@ -28,6 +28,7 @@
 #include "desktop.h"
 #include "document.h"
 #include "dialogs/layer-properties.h"
+#include "layer-manager.h"
 #include "xml/node-event-vector.h"
 
 namespace Inkscape {
@@ -290,9 +291,11 @@ void LayerSelector::_setDesktopLayer() {
     SPObject *layer=_selector.get_active()->get_value(_model_columns.object);
     if ( _desktop && layer ) {
         _layer_changed_connection.block();
-        _desktop->setCurrentLayer(layer);
+
+        _desktop->layer_manager->setCurrentLayer(layer);
+
         _layer_changed_connection.unblock();
-        sp_desktop_selection(_desktop)->clear();
+
         _selectLayer(_desktop->currentLayer());
     }
 }