diff options
author | Carl Hetherington <carl@carlh.net> | 2011-03-07 13:04:46 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-03-07 13:04:46 +0000 |
commit | 8f45604f277f07cbde4c73a6fe3aeb802df19eab (patch) | |
tree | 4a0f62813dafb11bc266d49b9a9be9800a0f4666 /gtk2_ardour | |
parent | 92a5e4da48b85017647fb2c55d2d76fff47243e1 (diff) |
Make Active apply to the selection.
git-svn-id: svn://localhost/ardour2/branches/3.0@9089 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/audio_time_axis.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 40 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 23 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 29 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.cc | 23 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/track_selection.h | 23 |
9 files changed, 87 insertions, 63 deletions
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index 79751145bf..2480c87967 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -409,7 +409,6 @@ AudioTimeAxisView::reveal_dependent_views (TimeAxisViewItem& tavi) void AudioTimeAxisView::route_active_changed () { - RouteTimeAxisView::route_active_changed (); update_control_names (); } diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 0348e632f8..a1e8ef1f04 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -820,31 +820,39 @@ MidiTimeAxisView::update_range() } void -MidiTimeAxisView::show_all_automation () +MidiTimeAxisView::show_all_automation (bool apply_to_selection) { - if (midi_track()) { - const set<Evoral::Parameter> params = midi_track()->midi_playlist()->contained_automation(); - - for (set<Evoral::Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) { - create_automation_child(*i, true); + if (apply_to_selection) { + _editor.get_selection().tracks.foreach_midi_time_axis (boost::bind (&MidiTimeAxisView::show_all_automation, _1, false)); + } else { + if (midi_track()) { + const set<Evoral::Parameter> params = midi_track()->midi_playlist()->contained_automation(); + + for (set<Evoral::Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) { + create_automation_child(*i, true); + } } + + RouteTimeAxisView::show_all_automation (); } - - RouteTimeAxisView::show_all_automation (); } void -MidiTimeAxisView::show_existing_automation () +MidiTimeAxisView::show_existing_automation (bool apply_to_selection) { - if (midi_track()) { - const set<Evoral::Parameter> params = midi_track()->midi_playlist()->contained_automation(); - - for (set<Evoral::Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) { - create_automation_child(*i, true); + if (apply_to_selection) { + _editor.get_selection().tracks.foreach_midi_time_axis (boost::bind (&MidiTimeAxisView::show_existing_automation, _1, false)); + } else { + if (midi_track()) { + const set<Evoral::Parameter> params = midi_track()->midi_playlist()->contained_automation(); + + for (set<Evoral::Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) { + create_automation_child(*i, true); + } } + + RouteTimeAxisView::show_existing_automation (); } - - RouteTimeAxisView::show_existing_automation (); } /** Create an automation track for the given parameter (pitch bend, channel pressure). diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index 94926e28a2..88dcb9d917 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -74,8 +74,8 @@ class MidiTimeAxisView : public RouteTimeAxisView boost::shared_ptr<ARDOUR::MidiRegion> add_region (ARDOUR::framepos_t, ARDOUR::framecnt_t, bool); - void show_all_automation (); - void show_existing_automation (); + void show_all_automation (bool apply_to_selection = false); + void show_existing_automation (bool apply_to_selection = false); void create_automation_child (const Evoral::Parameter& param, bool show); ARDOUR::NoteMode note_mode() const { return _note_mode; } diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 919ec86ada..ba79bd2419 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1321,13 +1321,13 @@ MixerStrip::show_route_color () { name_button.modify_bg (STATE_NORMAL, color()); top_event_box.modify_bg (STATE_NORMAL, color()); - route_active_changed (); + reset_strip_style (); } void MixerStrip::show_passthru_color () { - route_active_changed (); + reset_strip_style (); } void @@ -1345,9 +1345,10 @@ MixerStrip::build_route_ops_menu () items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename))); rename_menu_item = &items.back(); items.push_back (SeparatorElem()); - items.push_back (CheckMenuElem (_("Active"), sigc::mem_fun (*this, &RouteUI::toggle_route_active))); - route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back()); - route_active_menu_item->set_active (_route->active()); + items.push_back (CheckMenuElem (_("Active"))); + CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back()); + i->set_active (_route->active()); + i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false)); items.push_back (SeparatorElem()); @@ -1387,9 +1388,8 @@ MixerStrip::name_button_button_press (GdkEventButton* ev) void MixerStrip::list_route_operations () { - if (route_ops_menu == 0) { - build_route_ops_menu (); - } + delete route_ops_menu; + build_route_ops_menu (); } void @@ -1497,13 +1497,6 @@ MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p) } void -MixerStrip::route_active_changed () -{ - RouteUI::route_active_changed (); - reset_strip_style (); -} - -void MixerStrip::reset_strip_style () { if (_current_delivery && boost::dynamic_pointer_cast<Send>(_current_delivery)) { diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 5debbdb3a1..ef35bf237d 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -260,8 +260,6 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void show_route_color (); void show_passthru_color (); - void route_active_changed (); - void name_changed (); void update_speed_display (); void map_frozen (); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 7197f30bcd..cb9f23ff32 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -621,9 +621,32 @@ RouteTimeAxisView::build_display_menu () items.push_back (SeparatorElem()); } - items.push_back (CheckMenuElem (_("Active"), sigc::mem_fun(*this, &RouteUI::toggle_route_active))); - route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back()); - route_active_menu_item->set_active (_route->active()); + int active = 0; + int inactive = 0; + TrackSelection const & s = _editor.get_selection().tracks; + for (TrackSelection::const_iterator i = s.begin(); i != s.end(); ++i) { + RouteTimeAxisView* r = dynamic_cast<RouteTimeAxisView*> (*i); + if (!r) { + continue; + } + + if (r->route()->active()) { + ++active; + } else { + ++inactive; + } + } + + items.push_back (CheckMenuElem (_("Active"))); + CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back()); + bool click_sets_active = true; + if (active > 0 && inactive == 0) { + i->set_active (true); + click_sets_active = false; + } else if (active > 0 && inactive > 0) { + i->set_inconsistent (true); + } + i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), click_sets_active, true)); items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Hide"), sigc::bind (sigc::mem_fun(_editor, &PublicEditor::hide_track_in_display), this, false))); diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 4600f04f14..3df8e74d49 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -109,7 +109,6 @@ RouteUI::init () solo_safe_led = 0; _solo_release = 0; _mute_release = 0; - route_active_menu_item = 0; denormal_menu_item = 0; step_edit_item = 0; multiple_mute_change = false; @@ -179,7 +178,6 @@ RouteUI::reset () xml_node = 0; } - route_active_menu_item = 0; denormal_menu_item = 0; } @@ -1467,26 +1465,15 @@ RouteUI::property_changed (const PropertyChange& what_changed) } void -RouteUI::toggle_route_active () +RouteUI::set_route_active (bool a, bool apply_to_selection) { - bool yn; - - if (route_active_menu_item) { - if (route_active_menu_item->get_active() != (yn = _route->active())) { - _route->set_active (!yn, this); - } - } -} - -void -RouteUI::route_active_changed () -{ - if (route_active_menu_item) { - Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&CheckMenuItem::set_active, route_active_menu_item, _route->active())); + if (apply_to_selection) { + ARDOUR_UI::instance()->the_editor().get_selection().tracks.foreach_route_ui (boost::bind (&RouteTimeAxisView::set_route_active, _1, a, false)); + } else { + _route->set_active (a, this); } } - void RouteUI::toggle_denormal_protection () { diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 4a33c8f16d..41721abc77 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -175,9 +175,8 @@ class RouteUI : public virtual AxisView virtual void property_changed (const PBD::PropertyChange&); void route_removed (); - Gtk::CheckMenuItem *route_active_menu_item; - void toggle_route_active (); - virtual void route_active_changed (); + virtual void route_active_changed () {} + void set_route_active (bool, bool); Gtk::Menu* record_menu; void build_record_menu (); diff --git a/gtk2_ardour/track_selection.h b/gtk2_ardour/track_selection.h index e61e62958f..5f85bcfd58 100644 --- a/gtk2_ardour/track_selection.h +++ b/gtk2_ardour/track_selection.h @@ -23,6 +23,7 @@ #include "track_view_list.h" #include "route_ui.h" #include "audio_time_axis.h" +#include "midi_time_axis.h" class PublicEditor; @@ -47,7 +48,9 @@ public: void foreach_route_ui (Function f) { for (iterator i = begin(); i != end(); ++i) { RouteUI* t = dynamic_cast<RouteUI*> (*i); - f (t); + if (t) { + f (t); + } } } @@ -55,7 +58,9 @@ public: void foreach_route_time_axis (Function f) { for (iterator i = begin(); i != end(); ++i) { RouteTimeAxisView* t = dynamic_cast<RouteTimeAxisView*> (*i); - f (t); + if (t) { + f (t); + } } } @@ -63,7 +68,19 @@ public: void foreach_audio_time_axis (Function f) { for (iterator i = begin(); i != end(); ++i) { AudioTimeAxisView* t = dynamic_cast<AudioTimeAxisView*> (*i); - f (t); + if (t) { + f (t); + } + } + } + + template <typename Function> + void foreach_midi_time_axis (Function f) { + for (iterator i = begin(); i != end(); ++i) { + MidiTimeAxisView* t = dynamic_cast<MidiTimeAxisView*> (*i); + if (t) { + f (t); + } } } |