summaryrefslogtreecommitdiff
path: root/gtk2_ardour/processor_box.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-11-08 14:44:06 +0000
committerCarl Hetherington <carl@carlh.net>2011-11-08 14:44:06 +0000
commite63989c8d1cc8583e8cba38d041f4788baca95d2 (patch)
treeb7aae8171d1c41efb0783b50b842b4ec3a227e13 /gtk2_ardour/processor_box.cc
parentb37bc5e5b2d597c472a603747ed139cc74107013 (diff)
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
Diffstat (limited to 'gtk2_ardour/processor_box.cc')
-rw-r--r--gtk2_ardour/processor_box.cc50
1 files changed, 26 insertions, 24 deletions
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 2c2ac20d0b..bde5fb5e8c 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -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
@@ -843,29 +868,6 @@ ProcessorBox::build_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 ()
{
processor_display.select_all ();