/* 3 hours in 640 pixels */
double const Timeline::_minimum_pixels_per_second = 640.0 / (60 * 60 * 3);
/* 3 hours in 640 pixels */
double const Timeline::_minimum_pixels_per_second = 640.0 / (60 * 60 * 3);
sizer->Add (_labels_canvas, 0, wxEXPAND);
_labels_canvas->SetMinSize (wxSize (_labels_view->bbox().width, -1));
sizer->Add (_main_canvas, 1, wxEXPAND);
sizer->Add (_labels_canvas, 0, wxEXPAND);
_labels_canvas->SetMinSize (wxSize (_labels_view->bbox().width, -1));
sizer->Add (_main_canvas, 1, wxEXPAND);
- list<dcpomatic::Rect<int> > overlaps;
- BOOST_FOREACH (shared_ptr<TimelineView> j, _views) {
- shared_ptr<TimelineContentView> jc = dynamic_pointer_cast<TimelineContentView> (j);
+ 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 */
if (!ic || !jc || i == j || ic->track() != jc->track() || ic->track().get_value_or(2) >= 2 || !ic->active() || !jc->active()) {
continue;
}
/* No overlap with non-content views, views no 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;
}
double const ph = vp->position().seconds() * pixels_per_second().get_value_or(0);
path.MoveToPoint (ph, 0);
path.AddLineToPoint (ph, pixels_per_track() * _tracks + 32);
double const ph = vp->position().seconds() * pixels_per_second().get_value_or(0);
path.MoveToPoint (ph, 0);
path.AddLineToPoint (ph, pixels_per_track() * _tracks + 32);
- BOOST_FOREACH (shared_ptr<TextContent> j, i->text) {
- _views.push_back (shared_ptr<TimelineView> (new TimelineTextContentView (*this, i, j)));
+ for (auto j: i->text) {
+ _views.push_back (make_shared<TimelineTextContentView>(*this, i, j));
- if (dynamic_pointer_cast<AtmosMXFContent> (i)) {
- _views.push_back (shared_ptr<TimelineView> (new TimelineAtmosContentView (*this, i)));
+ if (i->atmos) {
+ _views.push_back (make_shared<TimelineAtmosContentView>(*this, i));
if (
test->track() && test->track().get() == t &&
content_period.overlap(DCPTimePeriod(test_content->position(), test_content->end(film)))) {
if (
test->track() && test->track().get() == t &&
content_period.overlap(DCPTimePeriod(test_content->position(), test_content->end(film)))) {
struct AudioMappingComparator {
bool operator()(shared_ptr<TimelineView> a, shared_ptr<TimelineView> b) {
int la = -1;
struct AudioMappingComparator {
bool operator()(shared_ptr<TimelineView> a, shared_ptr<TimelineView> b) {
int la = -1;
- BOOST_FOREACH (shared_ptr<TimelineView> i, _views) {
- shared_ptr<TimelineVideoContentView> cv = dynamic_pointer_cast<TimelineVideoContentView> (i);
- if (!cv) {
- continue;
- }
- if (dynamic_pointer_cast<TimelineAtmosContentView> (i)) {
- cv->set_track (_tracks - 1);
+ for (auto i: _views) {
+ auto cv = dynamic_pointer_cast<TimelineAtmosContentView>(i);
+ if (cv) {
+ cv->set_track (_tracks);
sort(views.begin(), views.end(), AudioMappingComparator());
int const audio_tracks = place<TimelineAudioContentView> (film, views, _tracks);
sort(views.begin(), views.end(), AudioMappingComparator());
int const audio_tracks = place<TimelineAudioContentView> (film, views, _tracks);
Timeline::event_to_view (wxMouseEvent& ev)
{
/* Search backwards through views so that we find the uppermost one first */
Timeline::event_to_view (wxMouseEvent& ev)
{
/* Search backwards through views so that we find the uppermost one first */
int vsx, vsy;
_main_canvas->GetViewStart (&vsx, &vsy);
Position<int> const p (ev.GetX() + vsx * _x_scroll_rate, ev.GetY() + vsy * _y_scroll_rate);
while (i != _views.rend() && !(*i)->bbox().contains (p)) {
int vsx, vsy;
_main_canvas->GetViewStart (&vsx, &vsy);
Position<int> const p (ev.GetX() + vsx * _x_scroll_rate, ev.GetY() + vsy * _y_scroll_rate);
while (i != _views.rend() && !(*i)->bbox().contains (p)) {
- shared_ptr<TimelineView> view = event_to_view (ev);
- shared_ptr<TimelineContentView> content_view = dynamic_pointer_cast<TimelineContentView> (view);
+ auto view = event_to_view (ev);
+ auto content_view = dynamic_pointer_cast<TimelineContentView>(view);
- DCPTime const time_left = DCPTime::from_seconds((top_left.x + vsx) / *_pixels_per_second);
- DCPTime const time_right = DCPTime::from_seconds((bottom_right.x + vsx) / *_pixels_per_second);
+ auto const time_left = DCPTime::from_seconds((top_left.x + vsx) / *_pixels_per_second);
+ auto const time_right = DCPTime::from_seconds((bottom_right.x + vsx) / *_pixels_per_second);
set_pixels_per_second (double(GetSize().GetWidth()) / (time_right.seconds() - time_left.seconds()));
double const tracks_top = double(top_left.y - tracks_y_offset()) / _pixels_per_track;
set_pixels_per_second (double(GetSize().GetWidth()) / (time_right.seconds() - time_left.seconds()));
double const tracks_top = double(top_left.y - tracks_y_offset()) / _pixels_per_track;
- shared_ptr<TimelineView> view = event_to_view (ev);
- shared_ptr<TimelineContentView> cv = dynamic_pointer_cast<TimelineContentView> (view);
+ auto view = event_to_view (ev);
+ auto cv = dynamic_pointer_cast<TimelineContentView> (view);
DCPOMATIC_ASSERT (film);
set_pixels_per_second ((_main_canvas->GetSize().GetWidth() - 32) / film->length().seconds());
set_pixels_per_track ((_main_canvas->GetSize().GetHeight() - tracks_y_offset() - _time_axis_view->bbox().height - 32) / _tracks);
DCPOMATIC_ASSERT (film);
set_pixels_per_second ((_main_canvas->GetSize().GetWidth() - 32) / film->length().seconds());
set_pixels_per_track ((_main_canvas->GetSize().GetHeight() - tracks_y_offset() - _time_axis_view->bbox().height - 32) / _tracks);