From: joncruz Date: Sun, 28 May 2006 08:07:39 +0000 (+0000) Subject: Option to keep selection when changing layers X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6a13f00062e752dfe3aecd06dbc6d57c5f62ba8c;p=inkscape.git Option to keep selection when changing layers --- diff --git a/ChangeLog b/ChangeLog index 4eca93a67..0b7f66a70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-05-28 Jon A. Cruz + + * 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 * src/dialogs/layers-panel.h, src/dialogs/layers-panel.cpp: diff --git a/src/dialogs/layers-panel.cpp b/src/dialogs/layers-panel.cpp index 2dc7c2a9e..cdcafbbc1 100644 --- a/src/dialogs/layers-panel.cpp +++ b/src/dialogs/layers-panel.cpp @@ -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 ); } } diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 81e8698b0..e2e40340f 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -14,8 +14,11 @@ #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 : "" ); diff --git a/src/layer-manager.h b/src/layer-manager.h index 461134baa..fa710e938 100644 --- a/src/layer-manager.h +++ b/src/layer-manager.h @@ -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 & slot) { diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 30748bfdc..a0aa1a1a5 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -186,6 +186,7 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" +" \n" " \n" " \n" " \n" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 04f28dc00..c8e9448b4 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -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); } diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index fb9fc2f49..00b415b66 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -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; diff --git a/src/widgets/layer-selector.cpp b/src/widgets/layer-selector.cpp index bf23dcfca..94a891dc2 100644 --- a/src/widgets/layer-selector.cpp +++ b/src/widgets/layer-selector.cpp @@ -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()); } }