summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-02-15 00:43:12 +0100
committerCarl Hetherington <cth@carlh.net>2021-02-15 03:16:16 +0100
commit14a9755762cf1d1e33877dec4a02b627dfa400cb (patch)
tree0e414426dca1b5799c955ba8eae3cd2c7ab86f05 /src
parent88c1642d83bed44a75c4fe6827c5f02fc50141c2 (diff)
Allow multiple video tracks to be visible in the timeline.
Diffstat (limited to 'src')
-rw-r--r--src/wx/timeline.cc31
-rw-r--r--src/wx/timeline_labels_view.cc26
-rw-r--r--src/wx/timeline_labels_view.h12
3 files changed, 22 insertions, 47 deletions
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index 3187792be..359de9bf9 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -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);
diff --git a/src/wx/timeline_labels_view.cc b/src/wx/timeline_labels_view.cc
index d3aa02afc..b0bd8acbb 100644
--- a/src/wx/timeline_labels_view.cc
+++ b/src/wx/timeline_labels_view.cc
@@ -30,10 +30,6 @@ using std::max;
TimelineLabelsView::TimelineLabelsView (Timeline& tl)
: TimelineView (tl)
- , _threed (true)
- , _audio_tracks (0)
- , _text_tracks (0)
- , _atmos (true)
{
wxString labels[] = {
_("Video"),
@@ -42,11 +38,9 @@ TimelineLabelsView::TimelineLabelsView (Timeline& tl)
_("Atmos")
};
- _width = 0;
-
wxClientDC dc (&_timeline);
for (int i = 0; i < 3; ++i) {
- wxSize size = dc.GetTextExtent (labels[i]);
+ auto size = dc.GetTextExtent (labels[i]);
_width = max (_width, size.GetWidth());
}
@@ -66,32 +60,34 @@ TimelineLabelsView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> >
gc->SetFont (gc->CreateFont(wxNORMAL_FONT->Bold(), wxColour (0, 0, 0)));
int fy = 0;
- int ty = _threed ? 2 * h : h;
- gc->DrawText (_("Video"), 0, (ty + fy) / 2 - 8);
- fy = ty;
+ if (_video_tracks) {
+ int ty = fy + _video_tracks * h;
+ gc->DrawText (_("Video"), 0, (ty + fy) / 2 - 8);
+ fy = ty;
+ }
if (_text_tracks) {
- ty = fy + _text_tracks * h;
+ int ty = fy + _text_tracks * h;
gc->DrawText (_("Subtitles/captions"), 0, (ty + fy) / 2 - 8);
fy = ty;
}
if (_atmos) {
- ty = fy + h;
+ int ty = fy + h;
gc->DrawText (_("Atmos"), 0, (ty + fy) / 2 - 8);
fy = ty;
}
if (_audio_tracks) {
- ty = _timeline.tracks() * h;
+ int ty = _timeline.tracks() * h;
gc->DrawText (_("Audio"), 0, (ty + fy) / 2 - 8);
}
}
void
-TimelineLabelsView::set_3d (bool s)
+TimelineLabelsView::set_video_tracks (int n)
{
- _threed = s;
+ _video_tracks = n;
}
void
diff --git a/src/wx/timeline_labels_view.h b/src/wx/timeline_labels_view.h
index f26c9762b..88094f2c4 100644
--- a/src/wx/timeline_labels_view.h
+++ b/src/wx/timeline_labels_view.h
@@ -29,7 +29,7 @@ public:
dcpomatic::Rect<int> bbox () const;
- void set_3d (bool s);
+ void set_video_tracks (int n);
void set_audio_tracks (int n);
void set_text_tracks (int n);
void set_atmos (bool s);
@@ -37,9 +37,9 @@ public:
private:
void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
- int _width;
- bool _threed;
- int _audio_tracks;
- int _text_tracks;
- bool _atmos;
+ int _width = 0;
+ int _video_tracks = 0;
+ int _audio_tracks = 0;
+ int _text_tracks = 0;
+ bool _atmos = true;
};