{
#ifndef __WXOSX__
SetDoubleBuffered (true);
-#endif
+#endif
Bind (wxEVT_PAINT, boost::bind (&Timeline::paint, this));
Bind (wxEVT_LEFT_DOWN, boost::bind (&Timeline::left_down, this, _1));
Bind (wxEVT_MOTION, boost::bind (&Timeline::mouse_moved, this, _1));
Bind (wxEVT_SIZE, boost::bind (&Timeline::resized, this));
- playlist_changed ();
+ film_changed (Film::CONTENT);
SetMinSize (wxSize (640, tracks() * track_height() + 96));
- _playlist_changed_connection = film->playlist()->Changed.connect (bind (&Timeline::playlist_changed, this));
- _playlist_content_changed_connection = film->playlist()->ContentChanged.connect (bind (&Timeline::playlist_content_changed, this, _2));
+ _film_changed_connection = film->Changed.connect (bind (&Timeline::film_changed, this, _1));
+ _film_content_changed_connection = film->ContentChanged.connect (bind (&Timeline::film_content_changed, this, _2));
}
void
}
void
-Timeline::playlist_changed ()
+Timeline::film_changed (Film::Property p)
{
- ensure_ui_thread ();
- recreate_views ();
+ if (p == Film::CONTENT) {
+ ensure_ui_thread ();
+ recreate_views ();
+ }
}
void
Timeline::recreate_views ()
{
- shared_ptr<const Film> fl = _film.lock ();
- if (!fl) {
+ shared_ptr<const Film> film = _film.lock ();
+ if (!film) {
return;
}
_views.clear ();
_views.push_back (_time_axis_view);
- ContentList content = fl->playlist()->content ();
+ ContentList content = film->content ();
for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
if (dynamic_pointer_cast<VideoContent> (*i)) {
}
shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (*i);
- if (ac && !ac->audio_mapping().mapped_dcp_channels().empty ()) {
+ if (ac && !ac->audio_mapping().mapped_output_channels().empty ()) {
_views.push_back (shared_ptr<TimelineView> (new TimelineAudioContentView (*this, *i)));
}
}
void
-Timeline::playlist_content_changed (int property)
+Timeline::film_content_changed (int property)
{
ensure_ui_thread ();
++j;
continue;
}
-
+
shared_ptr<Content> test_content = test->content();
-
+
if (test && test->track() && test->track().get() == t) {
bool const no_overlap =
(content->position() < test_content->position() && content->end() < test_content->position()) ||
(content->position() > test_content->end() && content->end() > test_content->end());
-
+
if (!no_overlap) {
/* we have an overlap on track `t' */
++t;
break;
}
}
-
+
++j;
}
if (!cv) {
continue;
}
-
+
if (!ev.ShiftDown ()) {
cv->set_selected (view == *i);
}
-
+
if (view == *i) {
_content_panel->set_selection (cv->content ());
}
if (!_down_view) {
return;
}
-
+
DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / pps);
-
+
if (_snap) {
DCPTime const new_end = new_position + _down_view->content()->length_after_trim () - DCPTime (1);
positive is right).
*/
optional<DCPTime> nearest_distance;
-
+
/* Find the nearest content edge; this is inefficient */
for (TimelineViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
shared_ptr<TimelineContentView> cv = dynamic_pointer_cast<TimelineContentView> (*i);
maybe_snap (cv->content()->end() + DCPTime (1), new_position, nearest_distance);
maybe_snap (cv->content()->end() + DCPTime (1), new_end, nearest_distance);
}
-
+
if (nearest_distance) {
/* Snap if it's close; `close' means within a proportion of the time on the timeline */
if (nearest_distance.get().abs() < DCPTime::from_seconds ((width() / pps) / 64)) {
}
}
}
-
+
if (new_position < DCPTime ()) {
new_position = DCPTime ();
}
_down_view->content()->set_position (new_position);
-
+
shared_ptr<Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
film->set_sequence_video (false);
Timeline::selected_views () const
{
TimelineContentViewList sel;
-
+
for (TimelineViewList::const_iterator i = _views.begin(); i != _views.end(); ++i) {
shared_ptr<TimelineContentView> cv = dynamic_pointer_cast<TimelineContentView> (*i);
if (cv && cv->selected()) {
{
ContentList sel;
TimelineContentViewList views = selected_views ();
-
+
for (TimelineContentViewList::const_iterator i = views.begin(); i != views.end(); ++i) {
sel.push_back ((*i)->content ());
}