return dcpomatic::Rect<int> (
time_x (content->position ()) - 8,
y_pos (_track) - 8,
return dcpomatic::Rect<int> (
time_x (content->position ()) - 8,
y_pos (_track) - 8,
- wxString name = wxString::Format (wxT ("%s [%s]"), std_to_wx (cont->path().filename().string()).data(), type().data());
+ wxString name = wxString::Format (wxT ("%s [%s]"), std_to_wx (cont->path_summary()).data(), type().data());
wxDouble name_width;
wxDouble name_height;
wxDouble name_descent;
wxDouble name_leading;
gc->GetTextExtent (name, &name_width, &name_height, &name_descent, &name_leading);
wxDouble name_width;
wxDouble name_height;
wxDouble name_descent;
wxDouble name_leading;
gc->GetTextExtent (name, &name_width, &name_height, &name_descent, &name_leading);
- gc->Clip (wxRegion (time_x (position), y_pos (_track), len * _timeline.pixels_per_time_unit(), _timeline.track_height()));
+ gc->Clip (wxRegion (time_x (position), y_pos (_track), len.seconds() * _timeline.pixels_per_second(), _timeline.track_height()));
+class SubtitleContentView : public ContentView
+{
+public:
+ SubtitleContentView (Timeline& tl, shared_ptr<Content> c)
+ : ContentView (tl, c)
+ {}
+
+private:
+ wxString type () const
+ {
+ return _("subtitles");
+ }
+
+ wxColour colour () const
+ {
+ return wxColour (163, 255, 154, 255);
+ }
+};
+
{
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID));
{
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID));
wxGraphicsPath path = gc->CreatePath ();
path.MoveToPoint (time_x (t), _y - 4);
path.AddLineToPoint (time_x (t), _y + 4);
gc->StrokePath (path);
wxGraphicsPath path = gc->CreatePath ();
path.MoveToPoint (time_x (t), _y - 4);
path.AddLineToPoint (time_x (t), _y + 4);
gc->StrokePath (path);
wxDouble str_leading;
gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading);
wxDouble str_leading;
gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading);
if ((tx + str_width) < _timeline.width()) {
gc->DrawText (str, time_x (t), _y + 16);
}
if ((tx + str_width) < _timeline.width()) {
gc->DrawText (str, time_x (t), _y + 16);
}
Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film)
: wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
, _film_editor (ed)
, _film (film)
, _time_axis_view (new TimeAxisView (*this, 32))
, _tracks (0)
Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film)
: wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
, _film_editor (ed)
, _film (film)
, _time_axis_view (new TimeAxisView (*this, 32))
, _tracks (0)
if (dynamic_pointer_cast<AudioContent> (*i)) {
_views.push_back (shared_ptr<View> (new AudioContentView (*this, *i)));
}
if (dynamic_pointer_cast<AudioContent> (*i)) {
_views.push_back (shared_ptr<View> (new AudioContentView (*this, *i)));
}
- shared_ptr<ContentView> cv = dynamic_pointer_cast<ContentView> (*i);
- if (cv) {
- cv->set_track (0);
- _tracks = 1;
+ shared_ptr<VideoContentView> v = dynamic_pointer_cast<VideoContentView> (*i);
+ if (v) {
+ video.push_back (v);
+ }
+
+ shared_ptr<AudioContentView> a = dynamic_pointer_cast<AudioContentView> (*i);
+ if (a) {
+ audio.push_back (a);
+ }
+
+ shared_ptr<SubtitleContentView> s = dynamic_pointer_cast<SubtitleContentView> (*i);
+ if (s) {
+ subtitle.push_back (s);
- for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
- shared_ptr<AudioContentView> acv = dynamic_pointer_cast<AudioContentView> (*i);
- if (!acv) {
- continue;
+ _tracks = 0;
+ if (!video.empty ()) {
+ for (list<shared_ptr<VideoContentView> >::iterator i = video.begin(); i != video.end(); ++i) {
+ (*i)->set_track (_tracks);
- shared_ptr<Content> acv_content = acv->content();
+ if (!subtitle.empty ()) {
+ for (list<shared_ptr<SubtitleContentView> >::iterator i = subtitle.begin(); i != subtitle.end(); ++i) {
+ (*i)->set_track (_tracks);
+ }
+ ++_tracks;
+ }
+
+ int const audio_start = _tracks;
+
+ for (list<shared_ptr<AudioContentView> >::iterator i = audio.begin(); i != audio.end(); ++i) {
+ shared_ptr<Content> acv_content = (*i)->content();
- ViewList::iterator j = _views.begin();
- while (j != _views.end()) {
- shared_ptr<AudioContentView> test = dynamic_pointer_cast<AudioContentView> (*j);
- if (!test) {
- ++j;
- continue;
- }
-
- shared_ptr<Content> test_content = test->content();
-
- if (test && test->track() == t) {
+ list<shared_ptr<AudioContentView> >::iterator j = audio.begin ();
+ while (j != audio.end()) {
+ if ((*j)->track() == t) {
- (acv_content->position() < test_content->position() && acv_content->end() < test_content->position()) ||
- (acv_content->position() > test_content->end() && acv_content->end() > test_content->end());
+ (acv_content->position() < (*j)->content()->position() && acv_content->end() < (*j)->content()->position()) ||
+ (acv_content->position() > (*j)->content()->end() && acv_content->end() > (*j)->content()->end());
/* Find the nearest content edge; this is inefficient */
for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
/* Find the nearest content edge; this is inefficient */
for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
if (d < nearest_distance) {
nearest_distance = d;
nearest_new_position = cv->content()->position() - _down_view->content()->length_after_trim ();
if (d < nearest_distance) {
nearest_distance = d;
nearest_new_position = cv->content()->position() - _down_view->content()->length_after_trim ();