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
}
}
- /* 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 */
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);
TimelineLabelsView::TimelineLabelsView (Timeline& tl)
: TimelineView (tl)
- , _threed (true)
- , _audio_tracks (0)
- , _text_tracks (0)
- , _atmos (true)
{
wxString labels[] = {
_("Video"),
_("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());
}
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
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);
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;
};