Make Active apply to the selection.

git-svn-id: svn://localhost/ardour2/branches/3.0@9089 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-03-07 13:04:46 +00:00
parent 92a5e4da48
commit 8f45604f27
9 changed files with 87 additions and 63 deletions

View File

@ -409,7 +409,6 @@ AudioTimeAxisView::reveal_dependent_views (TimeAxisViewItem& tavi)
void
AudioTimeAxisView::route_active_changed ()
{
RouteTimeAxisView::route_active_changed ();
update_control_names ();
}

View File

@ -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).

View File

@ -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; }

View File

@ -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
@ -1496,13 +1496,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 ()
{

View File

@ -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 ();

View File

@ -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)));

View File

@ -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);
}
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::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()));
}
}
void
RouteUI::toggle_denormal_protection ()
{

View File

@ -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 ();

View File

@ -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);
}
}
}