do not pass a non-zero offset to plugins AFTER the first call to connect_and_run...
[ardour.git] / gtk2_ardour / editor_mixer.cc
index 64eccf79fc34b7edc253447e4047ee0c9c69c36b..de0a27c687cbc59c2bd9ae088c29b3aa81aa45fb 100644 (file)
@@ -61,6 +61,7 @@ Editor::show_editor_mixer (bool yn)
        show_editor_mixer_when_tracks_arrive = false;
 
        if (!session) {
+               show_editor_mixer_when_tracks_arrive = yn;
                return;
        }
 
@@ -130,11 +131,19 @@ Editor::show_editor_mixer (bool yn)
 
 #ifdef GTKOSX
        /* XXX gtk problem here */
+       ensure_all_elements_drawn();
+#endif
+}
+
+#ifdef GTKOSX
+void
+Editor::ensure_all_elements_drawn ()
+{
+       controls_layout.queue_draw ();
        ruler_label_event_box.queue_draw ();
        time_button_event_box.queue_draw ();
-       controls_layout.queue_draw ();
-#endif
 }
+#endif
 
 void
 Editor::create_editor_mixer ()
@@ -144,6 +153,9 @@ Editor::create_editor_mixer ()
                                              false);
        current_mixer_strip->Hiding.connect (mem_fun(*this, &Editor::current_mixer_strip_hidden));
        current_mixer_strip->GoingAway.connect (mem_fun(*this, &Editor::current_mixer_strip_removed));
+#ifdef GTKOSX
+       current_mixer_strip->WidthChanged.connect (mem_fun(*this, &Editor::ensure_all_elements_drawn));
+#endif
        current_mixer_strip->set_embedded (true);
 }      
 
@@ -210,6 +222,17 @@ Editor::update_current_screen ()
                        goto almost_done;
                }
 
+#undef DEBUG_CURRENT_SCREEN
+#if DEBUG_CURRENT_SCREEN
+
+               cerr << "@ " << frame << " last " << last_update_frame << " follow " << _follow_playhead 
+                    << " ret " << session->requested_return_frame()
+                    << " left " << leftmost_frame
+                    << " right " << leftmost_frame + current_page_frames()
+                    << " speed " << session->transport_speed ()
+                    << endl;
+#endif
+
                /* only update if the playhead is on screen or we are following it */
 
                if (_follow_playhead && session->requested_return_frame() < 0) {
@@ -222,7 +245,10 @@ Editor::update_current_screen ()
 #undef CONTINUOUS_SCROLL
 #ifndef  CONTINUOUS_SCROLL
                                if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
-                                       
+
+#ifdef DEBUG_CURRENT_SCREEN
+                                       cerr << "\trecenter...\n";
+#endif                                         
                                        if (session->transport_speed() < 0) {
                                                if (frame > (current_page_frames()/2)) {
                                                        center_screen (frame-(current_page_frames()/2));
@@ -370,11 +396,15 @@ Editor::session_going_away ()
                current_bbt_points = 0;
        }
 
-       /* mixer strip will be deleted all by itself 
-          when its route is deleted.
-       */
+       /* get rid of any existing editor mixer strip */
 
-       current_mixer_strip = 0;
+       if (current_mixer_strip) {
+               if (current_mixer_strip->get_parent() != 0) {
+                       global_hpacker.remove (*current_mixer_strip);
+               }
+               delete current_mixer_strip;
+               current_mixer_strip = 0;
+       }
 
        WindowTitle title(Glib::get_application_name());
        title += _("Editor");