13
0

ProcessorBox actions are static, so setting their sensitivity must be done just before the menu is opened, not when the selection in one ProcessorBox changes (otherwise there are problems when you select in one box then open a menu in another). Also clarify what can and cannot be renamed, processor-wise.

git-svn-id: svn://localhost/ardour2/branches/3.0@10495 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-11-08 14:44:06 +00:00
parent b37bc5e5b2
commit e63989c8d1
2 changed files with 26 additions and 26 deletions

View File

@ -493,7 +493,6 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
processor_display.Reordered.connect (sigc::mem_fun (*this, &ProcessorBox::reordered));
processor_display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &ProcessorBox::object_drop));
processor_display.SelectionChanged.connect (sigc::mem_fun (*this, &ProcessorBox::selection_changed));
processor_scroller.show ();
processor_display.show ();
@ -656,12 +655,16 @@ ProcessorBox::show_processor_menu (int arg)
processor_menu->signal_unmap().connect (sigc::mem_fun (*this, &ProcessorBox::processor_menu_unmapped));
}
/* Sort out the plugin submenu */
Gtk::MenuItem* plugin_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/ProcessorMenu/newplugin"));
if (plugin_menu_item) {
plugin_menu_item->set_submenu (*_get_plugin_selector()->plugin_menu());
}
/* And the aux submenu */
Gtk::MenuItem* aux_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/ProcessorMenu/newaux"));
if (aux_menu_item) {
@ -676,9 +679,31 @@ ProcessorBox::show_processor_menu (int arg)
}
}
/* Sensitise actions as approprioate */
cut_action->set_sensitive (can_cut());
paste_action->set_sensitive (!_rr_selection.processors.empty());
const bool sensitive = !processor_display.selection().empty();
ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive);
edit_action->set_sensitive (one_processor_can_be_edited ());
boost::shared_ptr<Processor> single_selection;
if (processor_display.selection().size() == 1) {
single_selection = processor_display.selection().front()->processor ();
}
boost::shared_ptr<PluginInsert> pi;
if (single_selection) {
pi = boost::dynamic_pointer_cast<PluginInsert> (single_selection);
}
/* enable gui for plugin inserts with editors */
controls_action->set_sensitive(pi && pi->plugin()->has_editor());
/* disallow rename for multiple selections, for plugin inserts and for the fader */
rename_action->set_sensitive (single_selection && !pi && !boost::dynamic_pointer_cast<Amp> (single_selection));
processor_menu->popup (1, arg);
/* Add a placeholder gap to the processor list to indicate where a processor would be
@ -842,29 +867,6 @@ ProcessorBox::build_processor_menu ()
return processor_menu;
}
void
ProcessorBox::selection_changed ()
{
const bool sensitive = !processor_display.selection().empty();
ActionManager::set_sensitive(ActionManager::plugin_selection_sensitive_actions,
sensitive);
edit_action->set_sensitive(one_processor_can_be_edited());
const bool single_selection = (processor_display.selection().size() == 1);
boost::shared_ptr<PluginInsert> pi;
if (single_selection) {
pi = boost::dynamic_pointer_cast<PluginInsert>(
processor_display.selection().front()->processor());
}
/* enable gui for plugin inserts with editors */
controls_action->set_sensitive(pi && pi->plugin()->has_editor());
/* disallow rename for multiple selections and for plugin inserts */
rename_action->set_sensitive(single_selection && pi);
}
void
ProcessorBox::select_all_processors ()
{

View File

@ -257,8 +257,6 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
void route_going_away ();
void selection_changed ();
Gtkmm2ext::DnDVBox<ProcessorEntry> processor_display;
Gtk::ScrolledWindow processor_scroller;