Fix strange layout problems with the content sub panels (#2059).
[dcpomatic.git] / src / wx / timeline.cc
index 89f2239569edea9cf9e8b79f325381e119ec460b..359de9bf9f1b93d65e64e2045487ad120f6d6071 100644 (file)
@@ -112,7 +112,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film, w
        _main_canvas->Bind   (wxEVT_SCROLLWIN_PAGEDOWN,   boost::bind (&Timeline::scrolled,     this, _1));
        _main_canvas->Bind   (wxEVT_SCROLLWIN_THUMBTRACK, boost::bind (&Timeline::scrolled,     this, _1));
 
-       film_change (ChangeType::DONE, Film::CONTENT);
+       film_change (ChangeType::DONE, Film::Property::CONTENT);
 
        SetMinSize (wxSize (640, 4 * pixels_per_track() + 96));
 
@@ -182,7 +182,7 @@ Timeline::paint_main ()
                list<dcpomatic::Rect<int>> overlaps;
                for (auto j: _views) {
                        auto jc = dynamic_pointer_cast<TimelineContentView> (j);
-                       /* No overlap with non-content views, views no different tracks, audio views or non-active views */
+                       /* No overlap with non-content views, views on different tracks, audio views or non-active views */
                        if (!ic || !jc || i == j || ic->track() != jc->track() || ic->track().get_value_or(2) >= 2 || !ic->active() || !jc->active()) {
                                continue;
                        }
@@ -231,10 +231,10 @@ Timeline::film_change (ChangeType type, Film::Property p)
                return;
        }
 
-       if (p == Film::CONTENT || p == Film::REEL_TYPE || p == Film::REEL_LENGTH) {
+       if (p == Film::Property::CONTENT || p == Film::Property::REEL_TYPE || p == Film::Property::REEL_LENGTH) {
                ensure_ui_thread ();
                recreate_views ();
-       } else if (p == Film::CONTENT_ORDER) {
+       } else if (p == Film::Property::CONTENT_ORDER) {
                Refresh ();
        }
 }
@@ -370,8 +370,9 @@ void
 Timeline::assign_tracks ()
 {
        /* Tracks are:
-          Video (mono or left-eye)
-          Video (right-eye)
+          Video 1
+          Video 2
+          Video N
           Text 1
           Text 2
           Text N
@@ -393,29 +394,7 @@ Timeline::assign_tracks ()
                }
        }
 
-       /* Video */
-
-       bool have_3d = false;
-       for (auto i: _views) {
-               auto cv = dynamic_pointer_cast<TimelineVideoContentView>(i);
-               if (!cv) {
-                       continue;
-               }
-
-               /* Video on tracks 0 and maybe 1 (left and right eye) */
-               if (cv->content()->video->frame_type() == VideoFrameType::THREE_D_RIGHT) {
-                       cv->set_track (1);
-                       _tracks = max (_tracks, 2);
-                       have_3d = true;
-               } else {
-                       cv->set_track (0);
-               }
-       }
-
-       _tracks = max (_tracks, 1);
-
-       /* Texts */
-
+       int const video_tracks = place<TimelineVideoContentView> (film, _views, _tracks);
        int const text_tracks = place<TimelineTextContentView> (film, _views, _tracks);
 
        /* Atmos */
@@ -441,7 +420,7 @@ Timeline::assign_tracks ()
        sort(views.begin(), views.end(), AudioMappingComparator());
        int const audio_tracks = place<TimelineAudioContentView> (film, views, _tracks);
 
-       _labels_view->set_3d (have_3d);
+       _labels_view->set_video_tracks (video_tracks);
        _labels_view->set_audio_tracks (audio_tracks);
        _labels_view->set_text_tracks (text_tracks);
        _labels_view->set_atmos (have_atmos);
@@ -625,6 +604,8 @@ Timeline::left_up_zoom (wxMouseEvent& ev)
 
        if ((bottom_right.x - top_left.x) < 8 || (bottom_right.y - top_left.y) < 8) {
                /* Very small zoom rectangle: we assume it wasn't intentional */
+               _zoom_point = optional<wxPoint> ();
+               Refresh ();
                return;
        }