#include "timeline.h"
#include "timeline_time_axis_view.h"
#include "timeline_reels_view.h"
+#include "timeline_labels_view.h"
#include "timeline_video_content_view.h"
#include "timeline_audio_content_view.h"
#include "timeline_subtitle_content_view.h"
, _film (film)
, _time_axis_view (new TimelineTimeAxisView (*this, 64))
, _reels_view (new TimelineReelsView (*this, 32))
+ , _labels_view (new TimelineLabelsView (*this))
, _tracks (0)
, _left_down (false)
, _down_view_position (0)
SetMinSize (wxSize (640, tracks() * track_height() + 96));
+ _tracks_position = Position<int> (_labels_view->bbox().width, 8);
+
_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, _3));
}
_views.clear ();
_views.push_back (_time_axis_view);
_views.push_back (_reels_view);
+ _views.push_back (_labels_view);
BOOST_FOREACH (shared_ptr<Content> i, film->content ()) {
if (dynamic_pointer_cast<VideoContent> (i)) {
return;
}
- _pixels_per_second = static_cast<double>(width() - x_offset() * 2) / film->length().seconds ();
+ _pixels_per_second = static_cast<double>(width() - tracks_position().x * 2) / film->length().seconds ();
}
shared_ptr<TimelineView>
class TimelineView;
class TimelineTimeAxisView;
class TimelineReelsView;
+class TimelineLabelsView;
class Timeline : public wxPanel
{
void force_redraw (dcpomatic::Rect<int> const &);
- int x_offset () const {
- return 8;
- }
-
int width () const {
return GetSize().GetWidth ();
}
}
Position<int> tracks_position () const {
- return Position<int> (8, 8);
+ return _tracks_position;
}
int tracks () const;
TimelineViewList _views;
boost::shared_ptr<TimelineTimeAxisView> _time_axis_view;
boost::shared_ptr<TimelineReelsView> _reels_view;
+ boost::shared_ptr<TimelineLabelsView> _labels_view;
int _tracks;
boost::optional<double> _pixels_per_second;
bool _left_down;
bool _snap;
std::list<DCPTime> _start_snaps;
std::list<DCPTime> _end_snaps;
+ Position<int> _tracks_position;
boost::signals2::scoped_connection _film_changed_connection;
boost::signals2::scoped_connection _film_content_changed_connection;
--- /dev/null
+/*
+ Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+
+#include "timeline_labels_view.h"
+#include "timeline.h"
+#include <wx/wx.h>
+#include <wx/graphics.h>
+
+using std::list;
+using std::max;
+
+TimelineLabelsView::TimelineLabelsView (Timeline& tl)
+ : TimelineView (tl)
+{
+ wxString labels[] = {
+ _("Video"),
+ _("Audio"),
+ _("Subtitles")
+ };
+
+ _width = 0;
+
+ wxClientDC dc (&_timeline);
+ for (int i = 0; i < 3; ++i) {
+ wxSize size = dc.GetTextExtent (labels[i]);
+ _width = max (_width, size.GetWidth());
+ }
+
+ _width += 16;
+}
+
+dcpomatic::Rect<int>
+TimelineLabelsView::bbox () const
+{
+ return dcpomatic::Rect<int> (0, 0, _width, _timeline.tracks() * _timeline.track_height());
+}
+
+void
+TimelineLabelsView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> >)
+{
+ int const h = _timeline.track_height ();
+ gc->SetFont (gc->CreateFont(*wxNORMAL_FONT, wxColour (0, 0, 0)));
+ gc->DrawText (_("Video"), 0, h / 2);
+ gc->DrawText (_("Subtitles"), 0, 3 * h / 2);
+ gc->DrawText (_("Audio"), 0, h + _timeline.tracks() * h / 2);
+}
--- /dev/null
+/*
+ Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "timeline_view.h"
+
+class wxWindow;
+
+class TimelineLabelsView : public TimelineView
+{
+public:
+ TimelineLabelsView (Timeline& tl);
+
+ dcpomatic::Rect<int> bbox () const;
+
+private:
+ void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
+
+ int _width;
+};
private:
void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
-private:
int _y;
};
dcpomatic::Rect<int>
TimelineTimeAxisView::bbox () const
{
- return dcpomatic::Rect<int> (0, _y - 4, _timeline.width(), 24);
+ return dcpomatic::Rect<int> (_timeline.tracks_position().x, _y - 4, _timeline.width(), 24);
}
void
}
wxGraphicsPath path = gc->CreatePath ();
- path.MoveToPoint (_timeline.x_offset(), _y);
+ path.MoveToPoint (_timeline.tracks_position().x, _y);
path.AddLineToPoint (_timeline.width(), _y);
gc->StrokePath (path);
wxDouble str_leading;
gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading);
- int const tx = _timeline.x_offset() + t.seconds() * pps;
+ int const tx = _timeline.tracks_position().x + t.seconds() * pps;
if ((tx + str_width) < _timeline.width()) {
gc->DrawText (str, time_x (t), _y + 16);
}
private:
void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
-private:
int _y;
};
timeline_content_view.cc
timeline_dialog.cc
timeline_audio_content_view.cc
+ timeline_labels_view.cc
timeline_subtitle_content_view.cc
timeline_reels_view.cc
timeline_time_axis_view.cc