show() widgets explicitly in the MixerUI window, fix UI::just_hide_it(), so that...
[ardour.git] / gtk2_ardour / mixer_ui.cc
index f1f8714e80a44baf6a2d159fb8f3daf9fce1a147..85c5ebce1817f77c0e94afff8322e524abae66f5 100644 (file)
@@ -28,8 +28,8 @@
 #include <gtkmm2ext/gtk_ui.h>
 #include <gtkmm2ext/utils.h>
 #include <gtkmm2ext/stop_signal.h>
+#include <gtkmm2ext/window_title.h>
 
-#include <ardour/audioengine.h>
 #include <ardour/session.h>
 #include <ardour/audio_track.h>
 #include <ardour/session_route.h>
@@ -58,9 +58,8 @@ using namespace std;
 
 using PBD::atoi;
 
-Mixer_UI::Mixer_UI (AudioEngine& eng)
-       : Window (Gtk::WINDOW_TOPLEVEL),
-         engine (eng)
+Mixer_UI::Mixer_UI ()
+       : Window (Gtk::WINDOW_TOPLEVEL)
 {
        _strip_width = Wide;
        track_menu = 0;
@@ -203,7 +202,11 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
 
        add (global_vpacker);
        set_name ("MixerWindow");
-       set_title (_("ardour: mixer"));
+       
+       WindowTitle title(Glib::get_application_name());
+       title += _("Mixer");
+       set_title (title.get_string());
+
        set_wmclass (X_("ardour_mixer"), "Ardour");
 
        add_accel_group (ActionManager::ui_manager->get_accel_group());
@@ -216,6 +219,31 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
        signal_configure_event().connect (mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
 
        _selection.RoutesChanged.connect (mem_fun(*this, &Mixer_UI::follow_strip_selection));
+       
+       mix_group_display_button_box->show();
+       mix_group_add_button->show();
+       mix_group_remove_button->show();
+
+       global_hpacker.show();
+       global_vpacker.show();
+       scroller.show();
+       scroller_base.show();
+       scroller_hpacker.show();
+       mixer_scroller_vpacker.show();
+       list_vpacker.show();
+       group_display_button_label.show();
+       group_display_button.show();
+       track_display_scroller.show();
+       group_display_scroller.show();
+       group_display_vbox.show();
+       track_display_frame.show();
+       group_display_frame.show();
+       rhs_pane1.show();
+       strip_packer.show();
+       out_packer.show();
+       list_hpane.show();
+       track_display.show();
+       group_display.show();
 }
 
 Mixer_UI::~Mixer_UI ()
@@ -231,7 +259,7 @@ Mixer_UI::ensure_float (Window& win)
 void
 Mixer_UI::show_window ()
 {
-       show_all ();
+       present ();
 
        /* now reset each strips width so the right widgets are shown */
        MixerStrip* ms;
@@ -241,7 +269,7 @@ Mixer_UI::show_window ()
 
        for (ri = rows.begin(); ri != rows.end(); ++ri) {
                ms = (*ri)[track_columns.strip];
-               ms->set_width (ms->get_width());
+               ms->set_width (ms->get_width(), ms->width_owner());
        }
        _visible = true;
 }
@@ -264,14 +292,17 @@ Mixer_UI::add_strip (Session::RouteList& routes)
        for (Session::RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
                boost::shared_ptr<Route> route = (*x);
 
-               if (route->hidden()) {
+               if (route->is_hidden()) {
                        return;
                }
                
                strip = new MixerStrip (*this, *session, route);
                strips.push_back (strip);
                
-               strip->set_width (_strip_width);
+               if (strip->width_owner() != strip) {
+                       strip->set_width (_strip_width, this);
+               }
+
                show_strip (strip);
                
                no_track_list_redisplay = true;
@@ -286,7 +317,7 @@ Mixer_UI::add_strip (Session::RouteList& routes)
                no_track_list_redisplay = false;
                redisplay_track_list ();
                
-               route->name_changed.connect (bind (mem_fun(*this, &Mixer_UI::strip_name_changed), strip));
+               route->NameChanged.connect (bind (mem_fun(*this, &Mixer_UI::strip_name_changed), strip));
                strip->GoingAway.connect (bind (mem_fun(*this, &Mixer_UI::remove_strip), strip));
                
                strip->signal_button_release_event().connect (bind (mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
@@ -355,9 +386,11 @@ Mixer_UI::connect_to_session (Session* sess)
        XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
        set_state (*node);
 
-       string wintitle = _("ardour: mixer: ");
-       wintitle += session->name();
-       set_title (wintitle);
+       WindowTitle title(session->name());
+       title += _("Mixer");
+       title += Glib::get_application_name();
+
+       set_title (title.get_string());
 
        initial_track_display ();
 
@@ -383,7 +416,12 @@ Mixer_UI::disconnect_from_session ()
        ENSURE_GUI_THREAD(mem_fun(*this, &Mixer_UI::disconnect_from_session));
        
        group_model->clear ();
-       set_title (_("ardour: mixer"));
+       _selection.clear ();
+
+       WindowTitle title(Glib::get_application_name());
+       title += _("Mixer");
+       set_title (title.get_string());
+       
        stop_updating ();
 }
 
@@ -460,7 +498,7 @@ Mixer_UI::set_all_strips_visibility (bool yn)
                        continue;
                }
                
-               if (strip->route()->master() || strip->route()->control()) {
+               if (strip->route()->is_master() || strip->route()->is_control()) {
                        continue;
                }
 
@@ -488,11 +526,11 @@ Mixer_UI::set_all_audio_visibility (int tracks, bool yn)
                        continue;
                }
 
-               if (strip->route()->master() || strip->route()->control()) {
+               if (strip->route()->is_master() || strip->route()->is_control()) {
                        continue;
                }
 
-               AudioTrack* at = strip->audio_track();
+               boost::shared_ptr<AudioTrack> at = strip->audio_track();
 
                switch (tracks) {
                case 0:
@@ -592,7 +630,7 @@ Mixer_UI::redisplay_track_list ()
 
                        if (strip->packed()) {
 
-                               if (strip->route()->master() || strip->route()->control()) {
+                               if (strip->route()->is_master() || strip->route()->is_control()) {
                                        out_packer.reorder_child (*strip, -1);
                                } else {
                                        strip_packer.reorder_child (*strip, -1); /* put at end */
@@ -600,18 +638,18 @@ Mixer_UI::redisplay_track_list ()
 
                        } else {
 
-                               if (strip->route()->master() || strip->route()->control()) {
+                               if (strip->route()->is_master() || strip->route()->is_control()) {
                                        out_packer.pack_start (*strip, false, false);
                                } else {
                                        strip_packer.pack_start (*strip, false, false);
                                }
                                strip->set_packed (true);
-                               strip->show_all ();
+                               //strip->show();
                        }
 
                } else {
 
-                       if (strip->route()->master() || strip->route()->control()) {
+                       if (strip->route()->is_master() || strip->route()->is_control()) {
                                /* do nothing, these cannot be hidden */
                        } else {
                                if (strip->packed()) {
@@ -689,7 +727,7 @@ Mixer_UI::track_display_button_press (GdkEventButton* ev)
                        MixerStrip* strip = (*iter)[track_columns.strip];
                        if (strip) {
 
-                               if (!strip->route()->master() && !strip->route()->control()) {
+                               if (!strip->route()->is_master() && !strip->route()->is_control()) {
                                        bool visible = (*iter)[track_columns.visible];
                                        (*iter)[track_columns.visible] = !visible;
                                }
@@ -725,9 +763,9 @@ Mixer_UI::build_track_menu ()
 }
 
 void
-Mixer_UI::strip_name_changed (void* src, MixerStrip* mx)
+Mixer_UI::strip_name_changed (MixerStrip* mx)
 {
-       ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::strip_name_changed), src, mx));
+       ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::strip_name_changed), mx));
        
        TreeModel::Children rows = track_model->children();
        TreeModel::Children::iterator i;
@@ -896,6 +934,16 @@ Mixer_UI::group_flags_changed (void* src, RouteGroup* group)
        }
 
        ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::group_flags_changed), src, group));
+
+       /* force an update of any mixer strips that are using this group,
+          otherwise mix group names don't change in mixer strips 
+       */
+
+       for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
+               if ((*i)->mix_group() == group) {
+                       (*i)->mix_group_changed(0);
+               }
+       }
        
        TreeModel::iterator i;
        TreeModel::Children rows = group_model->children();
@@ -1007,7 +1055,7 @@ Mixer_UI::strip_scroller_button_release (GdkEventButton* ev)
        using namespace Menu_Helpers;
 
        if (Keyboard::is_context_menu_event (ev)) {
-               ARDOUR_UI::instance()->add_route();
+               ARDOUR_UI::instance()->add_route (this);
                return true;
        }
 
@@ -1020,7 +1068,7 @@ Mixer_UI::set_strip_width (Width w)
        _strip_width = w;
 
        for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
-               (*i)->set_width (w);
+               (*i)->set_width (w, this);
        }
 }