X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_mixer.cc;h=ae045d7a45fbcf5648acadea81b82ff5e7983ca2;hb=fc32ea76423d8dc4d393970531e8249f6811afcb;hp=8cffd5c64b357368045662f6486db103a8dc83a8;hpb=2c16f7aa7f7b78e84399d9ed0d8cf99a84d09eb6;p=ardour.git diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 8cffd5c64b..ae045d7a45 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -17,22 +17,28 @@ */ +#ifdef WAF_BUILD +#include "gtk2ardour-config.h" +#endif + #include #include #include #include "pbd/enumwriter.h" -#include "editor.h" -#include "mixer_strip.h" +#include "actions.h" #include "ardour_ui.h" -#include "selection.h" #include "audio_time_axis.h" -#include "actions.h" +#include "automation_time_axis.h" +#include "editor.h" #include "editor_routes.h" #include "editor_route_groups.h" #include "editor_regions.h" #include "gui_thread.h" +#include "midi_time_axis.h" +#include "mixer_strip.h" +#include "selection.h" #include "i18n.h" @@ -115,7 +121,7 @@ Editor::show_editor_mixer (bool yn) if (current_mixer_strip->get_parent() == 0) { global_hpacker.pack_start (*current_mixer_strip, Gtk::PACK_SHRINK ); global_hpacker.reorder_child (*current_mixer_strip, 0); - current_mixer_strip->show_all (); + current_mixer_strip->show (); } } else { @@ -150,6 +156,7 @@ Editor::create_editor_mixer () _session, false); current_mixer_strip->Hiding.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_hidden)); + current_mixer_strip->WidthChanged.connect (sigc::mem_fun (*this, &Editor::mixer_strip_width_changed)); #ifdef GTKOSX current_mixer_strip->WidthChanged.connect (sigc::mem_fun(*this, &Editor::ensure_all_elements_drawn)); @@ -160,9 +167,7 @@ Editor::create_editor_mixer () void Editor::set_selected_mixer_strip (TimeAxisView& view) { - RouteTimeAxisView* at; - - if (!_session || (at = dynamic_cast(&view)) == 0) { + if (!_session) { return; } @@ -180,31 +185,48 @@ Editor::set_selected_mixer_strip (TimeAxisView& view) create_editor_mixer (); } - /* might be nothing to do */ - if (current_mixer_strip->route() == at->route()) { - return; - } + // if this is an automation track, then we shold the mixer strip should + // show the parent - current_mixer_strip->set_route (at->route()); - current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this); -} + boost::shared_ptr route; + AutomationTimeAxisView* atv; + + if ((atv = dynamic_cast(&view)) != 0) { -void -Editor::current_mixer_strip_hidden () -{ - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + AudioTimeAxisView *parent = dynamic_cast(view.get_parent()); - RouteTimeAxisView* tmp; + if (parent) { + route = parent->route (); + } - if ((tmp = dynamic_cast(*i)) != 0) { - if (tmp->route() == current_mixer_strip->route()) { - (*i)->set_selected (false); - break; + } else { + + AudioTimeAxisView* at = dynamic_cast (&view); + + if (at) { + route = at->route(); + } else { + MidiTimeAxisView* mt = dynamic_cast (&view); + if (mt) { + route = mt->route(); } } } + + if (current_mixer_strip->route() == route) { + return; + } + + if (route) { + current_mixer_strip->set_route (route); + current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this); + } +} +void +Editor::current_mixer_strip_hidden () +{ Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer")); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); @@ -216,7 +238,16 @@ void Editor::maybe_add_mixer_strip_width (XMLNode& node) { if (current_mixer_strip) { - node.add_property ("mixer-width", enum_2_string (current_mixer_strip->get_width_enum())); + node.add_property ("mixer-width", enum_2_string (editor_mixer_strip_width)); } } +void +Editor::mixer_strip_width_changed () +{ +#ifdef GTKOSX + ensure_all_elements_drawn (); +#endif + + editor_mixer_strip_width = current_mixer_strip->get_width_enum (); +}