From: dooglus Date: Tue, 19 Feb 2008 10:31:20 +0000 (+0000) Subject: Show the 'select all child layers' icon in the layers panel all the time, rather... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=791054f319195ea3c24da4b535640bc9f2414287;p=synfig.git Show the 'select all child layers' icon in the layers panel all the time, rather than adding and removing it. git-svn-id: http://svn.voria.com/code@1755 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/dock_layers.cpp b/synfig-studio/trunk/src/gtkmm/dock_layers.cpp index 12bbe0f..74b8d5f 100644 --- a/synfig-studio/trunk/src/gtkmm/dock_layers.cpp +++ b/synfig-studio/trunk/src/gtkmm/dock_layers.cpp @@ -140,19 +140,23 @@ Dock_Layers::Dock_Layers(): } } + if(layer_action_manager) + action_group_layer_ops->add(layer_action_manager->get_action_select_all_child_layers()); action_group_layer_ops->add( Gtk::Action::create("toolbar-layer", _("Layer Ops")) ); App::ui_manager()->insert_action_group(action_group_layer_ops); - Glib::ustring ui_info = "" " " " " " " + " " " " " " + " " " " + " " " " " " " " diff --git a/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp b/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp index 34d7f20..3191970 100644 --- a/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp +++ b/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp @@ -128,7 +128,12 @@ LayerActionManager::LayerActionManager(): _("Amount"),_("Amount") ); - + action_select_all_child_layers_=Gtk::Action::create( + "select-all-child-layers", + Gtk::StockID("synfig-select_all_child_layers"), + _("Select All Child Layers"),_("Select All Child Layers") + ); + action_select_all_child_layers_->set_sensitive(false); } LayerActionManager::~LayerActionManager() @@ -231,8 +236,7 @@ LayerActionManager::refresh() return; } - - String ui_info, ui_toolbar_info; + String ui_info; action_paste_->set_sensitive(!clipboard_.empty()); action_group_->add(action_paste_); @@ -286,17 +290,22 @@ LayerActionManager::refresh() if(!multiple_selected && layer->get_name()=="PasteCanvas") { - action_group_->add(Gtk::Action::create( - "select-all-child-layers", - Gtk::StockID("synfig-select_all_child_layers"), - _("Select All Child Layers"), - _("Select All Child Layers")), + if (select_all_child_layers_connection) + select_all_child_layers_connection.disconnect(); + + select_all_child_layers_connection = action_select_all_child_layers_->signal_activate().connect( sigc::bind(sigc::mem_fun(*layer_tree_, &studio::LayerTree::select_all_children_layers), Layer::LooseHandle(layer))); + + action_select_all_child_layers_->set_sensitive(true); + ui_info+=""; - ui_toolbar_info+=""; } + else + action_select_all_child_layers_->set_sensitive(false); + action_group_->add(action_select_all_child_layers_); + handle::cast_static(get_canvas_interface()->get_instance())-> add_actions_to_group(action_group_, ui_info, param_list, synfigapp::Action::CATEGORY_LAYER); } @@ -313,7 +322,6 @@ LayerActionManager::refresh() "" "" "" + - ui_toolbar_info + ""); popup_id_=get_ui_manager()->add_ui_from_string(ui_info); #ifdef ONE_ACTION_GROUP diff --git a/synfig-studio/trunk/src/gtkmm/layeractionmanager.h b/synfig-studio/trunk/src/gtkmm/layeractionmanager.h index 0e9305a..91c400f 100644 --- a/synfig-studio/trunk/src/gtkmm/layeractionmanager.h +++ b/synfig-studio/trunk/src/gtkmm/layeractionmanager.h @@ -62,10 +62,11 @@ class LayerActionManager Glib::RefPtr action_amount_dec_; Glib::RefPtr action_amount_; + Glib::RefPtr action_select_all_child_layers_; + sigc::connection select_all_child_layers_connection; std::list clipboard_; - sigc::connection selection_changed_connection; bool queued; @@ -100,6 +101,8 @@ public: void refresh(); void clear(); + + Glib::RefPtr get_action_select_all_child_layers() { return action_select_all_child_layers_; } }; // END of LayerActionManager }; // END of namespace studio