13
0

Make stuff in the automation menu apply to the track selection.

git-svn-id: svn://localhost/ardour2/branches/3.0@9088 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-03-07 13:04:36 +00:00
parent 965a974083
commit 92a5e4da48
6 changed files with 153 additions and 124 deletions

View File

@ -311,38 +311,51 @@ AudioTimeAxisView::update_pan_track_visibility ()
} }
void void
AudioTimeAxisView::show_all_automation () AudioTimeAxisView::show_all_automation (bool apply_to_selection)
{ {
no_redraw = true; if (apply_to_selection) {
_editor.get_selection().tracks.foreach_audio_time_axis (boost::bind (&AudioTimeAxisView::show_all_automation, _1, false));
} else {
no_redraw = true;
RouteTimeAxisView::show_all_automation ();
RouteTimeAxisView::show_all_automation (); no_redraw = false;
no_redraw = false; _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
} }
void void
AudioTimeAxisView::show_existing_automation () AudioTimeAxisView::show_existing_automation (bool apply_to_selection)
{ {
no_redraw = true; if (apply_to_selection) {
_editor.get_selection().tracks.foreach_audio_time_axis (boost::bind (&AudioTimeAxisView::show_existing_automation, _1, false));
RouteTimeAxisView::show_existing_automation (); } else {
no_redraw = true;
no_redraw = false;
RouteTimeAxisView::show_existing_automation ();
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
} }
void void
AudioTimeAxisView::hide_all_automation () AudioTimeAxisView::hide_all_automation (bool apply_to_selection)
{ {
no_redraw = true; if (apply_to_selection) {
_editor.get_selection().tracks.foreach_audio_time_axis (boost::bind (&AudioTimeAxisView::hide_all_automation, _1, false));
RouteTimeAxisView::hide_all_automation(); } else {
no_redraw = true;
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ RouteTimeAxisView::hide_all_automation();
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
} }
void void
@ -436,23 +449,23 @@ AudioTimeAxisView::update_control_names ()
} }
void void
AudioTimeAxisView::build_automation_action_menu () AudioTimeAxisView::build_automation_action_menu (bool for_selection)
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
RouteTimeAxisView::build_automation_action_menu (); RouteTimeAxisView::build_automation_action_menu (for_selection);
MenuList& automation_items = automation_action_menu->items (); MenuList& automation_items = automation_action_menu->items ();
automation_items.push_back (CheckMenuElem (_("Fader"), sigc::mem_fun (*this, &AudioTimeAxisView::update_gain_track_visibility))); automation_items.push_back (CheckMenuElem (_("Fader"), sigc::mem_fun (*this, &AudioTimeAxisView::update_gain_track_visibility)));
gain_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ()); gain_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
gain_automation_item->set_active (gain_track->marked_for_display ()); gain_automation_item->set_active (gain_track->marked_for_display () && (!for_selection || _editor.get_selection().tracks.size() == 1));
_main_automation_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item; _main_automation_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item;
automation_items.push_back (CheckMenuElem (_("Pan"), sigc::mem_fun (*this, &AudioTimeAxisView::update_pan_track_visibility))); automation_items.push_back (CheckMenuElem (_("Pan"), sigc::mem_fun (*this, &AudioTimeAxisView::update_pan_track_visibility)));
pan_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ()); pan_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
pan_automation_item->set_active (pan_tracks.front()->marked_for_display ()); pan_automation_item->set_active (pan_tracks.front()->marked_for_display () && (!for_selection || _editor.get_selection().tracks.size() == 1));
set<Evoral::Parameter> const & params = _route->pannable()->what_can_be_automated (); set<Evoral::Parameter> const & params = _route->pannable()->what_can_be_automated ();
for (set<Evoral::Parameter>::iterator p = params.begin(); p != params.end(); ++p) { for (set<Evoral::Parameter>::iterator p = params.begin(); p != params.end(); ++p) {

View File

@ -95,11 +95,11 @@ class AudioTimeAxisView : public RouteTimeAxisView
void append_extra_display_menu_items (); void append_extra_display_menu_items ();
Gtk::Menu* build_mode_menu(); Gtk::Menu* build_mode_menu();
void build_automation_action_menu (); void build_automation_action_menu (bool);
void show_all_automation (); void show_all_automation (bool apply_to_selection = false);
void show_existing_automation (); void show_existing_automation (bool apply_to_selection = false);
void hide_all_automation (); void hide_all_automation (bool apply_to_selection = false);
void gain_hidden (); void gain_hidden ();
void pan_hidden (); void pan_hidden ();

View File

@ -414,7 +414,7 @@ MidiTimeAxisView::toggle_midi_thru ()
} }
void void
MidiTimeAxisView::build_automation_action_menu () MidiTimeAxisView::build_automation_action_menu (bool for_selection)
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
@ -430,7 +430,7 @@ MidiTimeAxisView::build_automation_action_menu ()
} }
_channel_command_menu_map.clear (); _channel_command_menu_map.clear ();
RouteTimeAxisView::build_automation_action_menu (); RouteTimeAxisView::build_automation_action_menu (for_selection);
MenuList& automation_items = automation_action_menu->items(); MenuList& automation_items = automation_action_menu->items();
@ -447,7 +447,9 @@ MidiTimeAxisView::build_automation_action_menu ()
*/ */
add_channel_command_menu_item (automation_items, _("Bender"), MidiPitchBenderAutomation, 0); add_channel_command_menu_item (automation_items, _("Bender"), MidiPitchBenderAutomation, 0);
automation_items.back().set_sensitive (!for_selection || _editor.get_selection().tracks.size() == 1);
add_channel_command_menu_item (automation_items, _("Pressure"), MidiChannelPressureAutomation, 0); add_channel_command_menu_item (automation_items, _("Pressure"), MidiChannelPressureAutomation, 0);
automation_items.back().set_sensitive (!for_selection || _editor.get_selection().tracks.size() == 1);
/* now all MIDI controllers. Always offer the possibility that we will rebuild the controllers menu /* now all MIDI controllers. Always offer the possibility that we will rebuild the controllers menu
since it might need to be updated after a channel mode change or other change. Also detach it since it might need to be updated after a channel mode change or other change. Also detach it
@ -458,6 +460,7 @@ MidiTimeAxisView::build_automation_action_menu ()
automation_items.push_back (SeparatorElem()); automation_items.push_back (SeparatorElem());
automation_items.push_back (MenuElem (_("Controllers"), *controller_menu)); automation_items.push_back (MenuElem (_("Controllers"), *controller_menu));
automation_items.back().set_sensitive (!for_selection || _editor.get_selection().tracks.size() == 1);
} else { } else {
automation_items.push_back (MenuElem (string_compose ("<i>%1</i>", _("No MIDI Channels selected")))); automation_items.push_back (MenuElem (string_compose ("<i>%1</i>", _("No MIDI Channels selected"))));
dynamic_cast<Label*> (automation_items.back().get_child())->set_use_markup (true); dynamic_cast<Label*> (automation_items.back().get_child())->set_use_markup (true);

View File

@ -112,7 +112,7 @@ class MidiTimeAxisView : public RouteTimeAxisView
void custom_device_mode_changed(); void custom_device_mode_changed();
void append_extra_display_menu_items (); void append_extra_display_menu_items ();
void build_automation_action_menu (); void build_automation_action_menu (bool);
Gtk::Menu* build_note_mode_menu(); Gtk::Menu* build_note_mode_menu();
Gtk::Menu* build_color_mode_menu(); Gtk::Menu* build_color_mode_menu();

View File

@ -338,7 +338,7 @@ void
RouteTimeAxisView::automation_click () RouteTimeAxisView::automation_click ()
{ {
conditionally_add_to_selection (); conditionally_add_to_selection ();
build_automation_action_menu (); build_automation_action_menu (false);
automation_action_menu->popup (1, gtk_get_current_event_time()); automation_action_menu->popup (1, gtk_get_current_event_time());
} }
@ -372,7 +372,7 @@ RouteTimeAxisView::set_state (const XMLNode& node, int version)
} }
void void
RouteTimeAxisView::build_automation_action_menu () RouteTimeAxisView::build_automation_action_menu (bool for_selection)
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
@ -391,13 +391,13 @@ RouteTimeAxisView::build_automation_action_menu ()
automation_action_menu->set_name ("ArdourContextMenu"); automation_action_menu->set_name ("ArdourContextMenu");
items.push_back (MenuElem (_("Show All Automation"), items.push_back (MenuElem (_("Show All Automation"),
sigc::mem_fun(*this, &RouteTimeAxisView::show_all_automation))); sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::show_all_automation), for_selection)));
items.push_back (MenuElem (_("Show Existing Automation"), items.push_back (MenuElem (_("Show Existing Automation"),
sigc::mem_fun(*this, &RouteTimeAxisView::show_existing_automation))); sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::show_existing_automation), for_selection)));
items.push_back (MenuElem (_("Hide All Automation"), items.push_back (MenuElem (_("Hide All Automation"),
sigc::mem_fun(*this, &RouteTimeAxisView::hide_all_automation))); sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::hide_all_automation), for_selection)));
items.push_back (SeparatorElem ()); items.push_back (SeparatorElem ());
@ -405,7 +405,7 @@ RouteTimeAxisView::build_automation_action_menu ()
so it was detached above */ so it was detached above */
items.push_back (MenuElem (_("Plugins"), subplugin_menu)); items.push_back (MenuElem (_("Plugins"), subplugin_menu));
items.back().set_sensitive (!subplugin_menu.items().empty()); items.back().set_sensitive (!subplugin_menu.items().empty() && (!for_selection || _editor.get_selection().tracks.size() == 1));;
} }
void void
@ -615,7 +615,7 @@ RouteTimeAxisView::build_display_menu ()
route_group_menu->build (r); route_group_menu->build (r);
items.push_back (MenuElem (_("Route Group"), *route_group_menu->menu ())); items.push_back (MenuElem (_("Route Group"), *route_group_menu->menu ()));
build_automation_action_menu (); build_automation_action_menu (true);
items.push_back (MenuElem (_("Automation"), *automation_action_menu)); items.push_back (MenuElem (_("Automation"), *automation_action_menu));
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
@ -1615,109 +1615,121 @@ RouteTimeAxisView::automation_track_hidden (Evoral::Parameter param)
void void
RouteTimeAxisView::show_all_automation () RouteTimeAxisView::show_all_automation (bool apply_to_selection)
{ {
no_redraw = true; if (apply_to_selection) {
_editor.get_selection().tracks.foreach_route_time_axis (boost::bind (&RouteTimeAxisView::show_all_automation, _1, false));
/* Show our automation */ } else {
no_redraw = true;
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
i->second->set_marked_for_display (true);
i->second->canvas_display()->show();
i->second->get_state_node()->add_property ("shown", X_("yes"));
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
if (menu) { /* Show our automation */
menu->set_active(true);
} for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
}
/* Show processor automation */
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
if ((*ii)->view == 0) {
add_processor_automation_curve ((*i)->processor, (*ii)->what);
}
(*ii)->menu_item->set_active (true);
}
}
no_redraw = false;
/* Redraw */
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
void
RouteTimeAxisView::show_existing_automation ()
{
no_redraw = true;
/* Show our automation */
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
if (i->second->has_automation()) {
i->second->set_marked_for_display (true); i->second->set_marked_for_display (true);
i->second->canvas_display()->show(); i->second->canvas_display()->show();
i->second->get_state_node()->add_property ("shown", X_("yes")); i->second->get_state_node()->add_property ("shown", X_("yes"));
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first); Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
if (menu) { if (menu) {
menu->set_active(true); menu->set_active(true);
} }
} }
}
/* Show processor automation */
/* Show processor automation */
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { if ((*ii)->view == 0) {
if ((*ii)->view != 0 && (*i)->processor->control((*ii)->what)->list()->size() > 0) { add_processor_automation_curve ((*i)->processor, (*ii)->what);
}
(*ii)->menu_item->set_active (true); (*ii)->menu_item->set_active (true);
} }
} }
no_redraw = false;
/* Redraw */
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
}
void
RouteTimeAxisView::show_existing_automation (bool apply_to_selection)
{
if (apply_to_selection) {
_editor.get_selection().tracks.foreach_route_time_axis (boost::bind (&RouteTimeAxisView::show_existing_automation, _1, false));
} else {
no_redraw = true;
/* Show our automation */
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
if (i->second->has_automation()) {
i->second->set_marked_for_display (true);
i->second->canvas_display()->show();
i->second->get_state_node()->add_property ("shown", X_("yes"));
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
if (menu) {
menu->set_active(true);
}
}
}
/* Show processor automation */
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
if ((*ii)->view != 0 && (*i)->processor->control((*ii)->what)->list()->size() > 0) {
(*ii)->menu_item->set_active (true);
}
}
}
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
} }
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
} }
void void
RouteTimeAxisView::hide_all_automation () RouteTimeAxisView::hide_all_automation (bool apply_to_selection)
{ {
no_redraw = true; if (apply_to_selection) {
_editor.get_selection().tracks.foreach_route_time_axis (boost::bind (&RouteTimeAxisView::hide_all_automation, _1, false));
} else {
no_redraw = true;
/* Hide our automation */ /* Hide our automation */
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
i->second->set_marked_for_display (false);
i->second->hide ();
i->second->get_state_node()->add_property ("shown", X_("no"));
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
if (menu) { for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
menu->set_active (false); i->second->set_marked_for_display (false);
i->second->hide ();
i->second->get_state_node()->add_property ("shown", X_("no"));
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
if (menu) {
menu->set_active (false);
}
} }
}
/* Hide processor automation */
/* Hide processor automation */
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { (*ii)->menu_item->set_active (false);
(*ii)->menu_item->set_active (false); }
} }
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
} }
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
} }

View File

@ -212,7 +212,7 @@ protected:
void set_color (Gdk::Color const &); void set_color (Gdk::Color const &);
virtual void build_automation_action_menu (); virtual void build_automation_action_menu (bool);
virtual void append_extra_display_menu_items () {} virtual void append_extra_display_menu_items () {}
void build_display_menu (); void build_display_menu ();
@ -225,9 +225,10 @@ protected:
void rename_current_playlist (); void rename_current_playlist ();
void automation_click (); void automation_click ();
virtual void show_all_automation ();
virtual void show_existing_automation (); virtual void show_all_automation (bool apply_to_selection = false);
virtual void hide_all_automation (); virtual void show_existing_automation (bool apply_to_selection = false);
virtual void hide_all_automation (bool apply_to_selection = false);
void timestretch (framepos_t start, framepos_t end); void timestretch (framepos_t start, framepos_t end);