summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-04 20:22:47 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-04 20:22:47 +0000
commit1b1bc528ee5ca1fee1bd33f9fb6f79cd551e3b33 (patch)
treed60b9fb573dd8d6ab89036fb8788cd1b1c69aada /src/wx
parent6d8bcba724be622739a749064466901486304cee (diff)
New DCPTime/ContentTime types.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/film_editor.cc2
-rw-r--r--src/wx/film_editor.h6
-rw-r--r--src/wx/film_viewer.cc12
-rw-r--r--src/wx/properties_dialog.cc4
-rw-r--r--src/wx/timecode.cc24
-rw-r--r--src/wx/timeline.cc124
-rw-r--r--src/wx/timeline.h16
-rw-r--r--src/wx/timeline_dialog.cc8
-rw-r--r--src/wx/timeline_dialog.h6
-rw-r--r--src/wx/timing_panel.cc17
10 files changed, 112 insertions, 107 deletions
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 831a57a02..78a5c440c 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -936,7 +936,7 @@ FilmEditor::content_timeline_clicked ()
_timeline_dialog = 0;
}
- _timeline_dialog = new DCPTimelineDialog (this, _film);
+ _timeline_dialog = new TimelineDialog (this, _film);
_timeline_dialog->Show ();
}
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index dadb583ae..23c87e678 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -33,9 +33,9 @@ class wxNotebook;
class wxListCtrl;
class wxListEvent;
class Film;
-class DCPTimelineDialog;
+class TimelineDialog;
class Ratio;
-class DCPTimecode;
+class Timecode;
class FilmEditorPanel;
class SubtitleContent;
@@ -156,5 +156,5 @@ private:
std::vector<Ratio const *> _ratios;
bool _generally_sensitive;
- DCPTimelineDialog* _timeline_dialog;
+ TimelineDialog* _timeline_dialog;
};
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index d88f88f5e..a2c489838 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -122,7 +122,7 @@ FilmViewer::set_film (shared_ptr<Film> f)
_frame.reset ();
_slider->SetValue (0);
- set_position_text (0);
+ set_position_text (DCPTime ());
if (!_film) {
return;
@@ -222,7 +222,7 @@ FilmViewer::slider_moved ()
{
if (_film && _player) {
try {
- _player->seek (_slider->GetValue() * _film->length() / 4096, false);
+ _player->seek (DCPTime (_film->length().get() * _slider->GetValue() / 4096), false);
fetch_next_frame ();
} catch (OpenFileError& e) {
/* There was a problem opening a content file; we'll let this slide as it
@@ -325,9 +325,9 @@ FilmViewer::set_position_text (DCPTime t)
double const fps = _film->video_frame_rate ();
/* Count frame number from 1 ... not sure if this is the best idea */
- _frame_number->SetLabel (wxString::Format (wxT("%d"), int (rint (t * fps / TIME_HZ)) + 1));
+ _frame_number->SetLabel (wxString::Format (wxT("%d"), int (rint (t.seconds() * fps)) + 1));
- double w = static_cast<double>(t) / TIME_HZ;
+ double w = t.seconds ();
int const h = (w / 3600);
w -= h * 3600;
int const m = (w / 60);
@@ -398,9 +398,9 @@ FilmViewer::back_clicked ()
We want to see the one before it, so we need to go back 2.
*/
- DCPTime p = _player->video_position() - _film->video_frames_to_time (2);
+ DCPTime p = _player->video_position() - DCPTime::from_frames (2, _film->video_frame_rate ());
if (p < 0) {
- p = 0;
+ p = DCPTime ();
}
try {
diff --git a/src/wx/properties_dialog.cc b/src/wx/properties_dialog.cc
index 11510cd0f..bdc5742d8 100644
--- a/src/wx/properties_dialog.cc
+++ b/src/wx/properties_dialog.cc
@@ -51,7 +51,7 @@ PropertiesDialog::PropertiesDialog (wxWindow* parent, shared_ptr<Film> film)
_encoded->Finished.connect (boost::bind (&PropertiesDialog::layout, this));
_table->Add (_encoded, 1, wxALIGN_CENTER_VERTICAL);
- _frames->SetLabel (std_to_wx (lexical_cast<string> (_film->time_to_video_frames (_film->length()))));
+ _frames->SetLabel (std_to_wx (lexical_cast<string> (_film->length().frames (_film->video_frame_rate ()))));
double const disk = double (_film->required_disk_space()) / 1073741824.0f;
stringstream s;
s << fixed << setprecision (1) << disk << wx_to_std (_("Gb"));
@@ -88,7 +88,7 @@ PropertiesDialog::frames_already_encoded () const
if (_film->length()) {
/* XXX: encoded_frames() should check which frames have been encoded */
- u << " (" << (_film->encoded_frames() * 100 / _film->time_to_video_frames (_film->length())) << "%)";
+ u << " (" << (_film->encoded_frames() * 100 / _film->length().frames (_film->video_frame_rate ())) << "%)";
}
return u.str ();
}
diff --git a/src/wx/timecode.cc b/src/wx/timecode.cc
index 7208bd4c6..045327254 100644
--- a/src/wx/timecode.cc
+++ b/src/wx/timecode.cc
@@ -85,13 +85,13 @@ Timecode::Timecode (wxWindow* parent)
void
Timecode::set (DCPTime t, int fps)
{
- int const h = t / (3600 * TIME_HZ);
- t -= h * 3600 * TIME_HZ;
- int const m = t / (60 * TIME_HZ);
- t -= m * 60 * TIME_HZ;
- int const s = t / TIME_HZ;
- t -= s * TIME_HZ;
- int const f = divide_with_round (t * fps, TIME_HZ);
+ int const h = t.seconds() / 3600;
+ t -= DCPTime::from_seconds (h * 3600);
+ int const m = t.seconds() / 60;
+ t -= DCPTime::from_seconds (m * 60);
+ int const s = t.seconds();
+ t -= DCPTime::from_seconds (s);
+ int const f = rint (t.seconds() * fps);
checked_set (_hours, lexical_cast<string> (h));
checked_set (_minutes, lexical_cast<string> (m));
@@ -104,15 +104,15 @@ Timecode::set (DCPTime t, int fps)
DCPTime
Timecode::get (int fps) const
{
- DCPTime t = 0;
+ DCPTime t;
string const h = wx_to_std (_hours->GetValue ());
- t += lexical_cast<int> (h.empty() ? "0" : h) * 3600 * TIME_HZ;
+ t += DCPTime::from_seconds (lexical_cast<int> (h.empty() ? "0" : h) * 3600);
string const m = wx_to_std (_minutes->GetValue());
- t += lexical_cast<int> (m.empty() ? "0" : m) * 60 * TIME_HZ;
+ t += DCPTime::from_seconds (lexical_cast<int> (m.empty() ? "0" : m) * 60);
string const s = wx_to_std (_seconds->GetValue());
- t += lexical_cast<int> (s.empty() ? "0" : s) * TIME_HZ;
+ t += DCPTime::from_seconds (lexical_cast<int> (s.empty() ? "0" : s));
string const f = wx_to_std (_frames->GetValue());
- t += lexical_cast<int> (f.empty() ? "0" : f) * TIME_HZ / fps;
+ t += DCPTime::from_seconds (lexical_cast<double> (f.empty() ? "0" : f) / fps);
return t;
}
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index ac26c77a9..0e713d1de 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -39,7 +39,7 @@ using boost::optional;
class View : public boost::noncopyable
{
public:
- View (DCPTimeline& t)
+ View (Timeline& t)
: _timeline (t)
{
@@ -64,12 +64,12 @@ public:
protected:
virtual void do_paint (wxGraphicsContext *) = 0;
- int time_x (DCPTime t) const
+ int time_x (double t) const
{
- return _timeline.tracks_position().x + t * _timeline.pixels_per_time_unit();
+ return _timeline.tracks_position().x + t * _timeline.pixels_per_second ();
}
- DCPTimeline& _timeline;
+ Timeline& _timeline;
private:
dcpomatic::Rect<int> _last_paint_bbox;
@@ -80,7 +80,7 @@ private:
class ContentView : public View
{
public:
- ContentView (DCPTimeline& tl, shared_ptr<Content> c)
+ ContentView (Timeline& tl, shared_ptr<Content> c)
: View (tl)
, _content (c)
, _track (0)
@@ -100,7 +100,7 @@ public:
return dcpomatic::Rect<int> (
time_x (content->position ()) - 8,
y_pos (_track) - 8,
- content->length_after_trim () * _timeline.pixels_per_time_unit() + 16,
+ content->length_after_trim().seconds() * _timeline.pixels_per_second() + 16,
_timeline.track_height() + 16
);
}
@@ -169,7 +169,7 @@ private:
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()));
gc->DrawText (name, time_x (position) + 12, y_pos (_track + 1) - name_height - 4);
gc->ResetClip ();
}
@@ -188,7 +188,7 @@ private:
}
if (!frequent) {
- _timeline.setup_pixels_per_time_unit ();
+ _timeline.setup_pixels_per_second ();
_timeline.Refresh ();
}
}
@@ -203,7 +203,7 @@ private:
class AudioContentView : public ContentView
{
public:
- AudioContentView (DCPTimeline& tl, shared_ptr<Content> c)
+ AudioContentView (Timeline& tl, shared_ptr<Content> c)
: ContentView (tl, c)
{}
@@ -222,7 +222,7 @@ private:
class VideoContentView : public ContentView
{
public:
- VideoContentView (DCPTimeline& tl, shared_ptr<Content> c)
+ VideoContentView (Timeline& tl, shared_ptr<Content> c)
: ContentView (tl, c)
{}
@@ -243,10 +243,10 @@ private:
}
};
-class DCPTimeAxisView : public View
+class TimeAxisView : public View
{
public:
- DCPTimeAxisView (DCPTimeline& tl, int y)
+ TimeAxisView (Timeline& tl, int y)
: View (tl)
, _y (y)
{}
@@ -268,18 +268,18 @@ private:
{
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID));
- int mark_interval = rint (128 / (TIME_HZ * _timeline.pixels_per_time_unit ()));
+ double mark_interval = rint (128 / _timeline.pixels_per_second ());
if (mark_interval > 5) {
- mark_interval -= mark_interval % 5;
+ mark_interval -= int (rint (mark_interval)) % 5;
}
if (mark_interval > 10) {
- mark_interval -= mark_interval % 10;
+ mark_interval -= int (rint (mark_interval)) % 10;
}
if (mark_interval > 60) {
- mark_interval -= mark_interval % 60;
+ mark_interval -= int (rint (mark_interval)) % 60;
}
if (mark_interval > 3600) {
- mark_interval -= mark_interval % 3600;
+ mark_interval -= int (rint (mark_interval)) % 3600;
}
if (mark_interval < 1) {
@@ -291,14 +291,15 @@ private:
path.AddLineToPoint (_timeline.width(), _y);
gc->StrokePath (path);
- DCPTime t = 0;
- while ((t * _timeline.pixels_per_time_unit()) < _timeline.width()) {
+ /* Time in seconds */
+ double t;
+ while ((t * _timeline.pixels_per_second()) < _timeline.width()) {
wxGraphicsPath path = gc->CreatePath ();
path.MoveToPoint (time_x (t), _y - 4);
path.AddLineToPoint (time_x (t), _y + 4);
gc->StrokePath (path);
- int tc = t / TIME_HZ;
+ double tc = t;
int const h = tc / 3600;
tc -= h * 3600;
int const m = tc / 60;
@@ -312,12 +313,12 @@ private:
wxDouble str_leading;
gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading);
- int const tx = _timeline.x_offset() + t * _timeline.pixels_per_time_unit();
+ int const tx = _timeline.x_offset() + t * _timeline.pixels_per_second();
if ((tx + str_width) < _timeline.width()) {
gc->DrawText (str, time_x (t), _y + 16);
}
- t += mark_interval * TIME_HZ;
+ t += mark_interval;
}
}
@@ -326,13 +327,13 @@ private:
};
-DCPTimeline::DCPTimeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film)
+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 DCPTimeAxisView (*this, 32))
+ , _time_axis_view (new TimeAxisView (*this, 32))
, _tracks (0)
- , _pixels_per_time_unit (0)
+ , _pixels_per_second (0)
, _left_down (false)
, _down_view_position (0)
, _first_move (false)
@@ -343,22 +344,22 @@ DCPTimeline::DCPTimeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> fil
SetDoubleBuffered (true);
#endif
- Bind (wxEVT_PAINT, boost::bind (&DCPTimeline::paint, this));
- Bind (wxEVT_LEFT_DOWN, boost::bind (&DCPTimeline::left_down, this, _1));
- Bind (wxEVT_LEFT_UP, boost::bind (&DCPTimeline::left_up, this, _1));
- Bind (wxEVT_RIGHT_DOWN, boost::bind (&DCPTimeline::right_down, this, _1));
- Bind (wxEVT_MOTION, boost::bind (&DCPTimeline::mouse_moved, this, _1));
- Bind (wxEVT_SIZE, boost::bind (&DCPTimeline::resized, this));
+ Bind (wxEVT_PAINT, boost::bind (&Timeline::paint, this));
+ Bind (wxEVT_LEFT_DOWN, boost::bind (&Timeline::left_down, this, _1));
+ Bind (wxEVT_LEFT_UP, boost::bind (&Timeline::left_up, this, _1));
+ Bind (wxEVT_RIGHT_DOWN, boost::bind (&Timeline::right_down, this, _1));
+ Bind (wxEVT_MOTION, boost::bind (&Timeline::mouse_moved, this, _1));
+ Bind (wxEVT_SIZE, boost::bind (&Timeline::resized, this));
playlist_changed ();
SetMinSize (wxSize (640, tracks() * track_height() + 96));
- _playlist_connection = film->playlist()->Changed.connect (bind (&DCPTimeline::playlist_changed, this));
+ _playlist_connection = film->playlist()->Changed.connect (bind (&Timeline::playlist_changed, this));
}
void
-DCPTimeline::paint ()
+Timeline::paint ()
{
wxPaintDC dc (this);
@@ -377,7 +378,7 @@ DCPTimeline::paint ()
}
void
-DCPTimeline::playlist_changed ()
+Timeline::playlist_changed ()
{
ensure_ui_thread ();
@@ -401,12 +402,12 @@ DCPTimeline::playlist_changed ()
}
assign_tracks ();
- setup_pixels_per_time_unit ();
+ setup_pixels_per_second ();
Refresh ();
}
void
-DCPTimeline::assign_tracks ()
+Timeline::assign_tracks ()
{
for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
shared_ptr<ContentView> cv = dynamic_pointer_cast<ContentView> (*i);
@@ -465,24 +466,24 @@ DCPTimeline::assign_tracks ()
}
int
-DCPTimeline::tracks () const
+Timeline::tracks () const
{
return _tracks;
}
void
-DCPTimeline::setup_pixels_per_time_unit ()
+Timeline::setup_pixels_per_second ()
{
shared_ptr<const Film> film = _film.lock ();
if (!film || film->length() == 0) {
return;
}
- _pixels_per_time_unit = static_cast<double>(width() - x_offset() * 2) / film->length ();
+ _pixels_per_second = static_cast<double>(width() - x_offset() * 2) / film->length().seconds ();
}
shared_ptr<View>
-DCPTimeline::event_to_view (wxMouseEvent& ev)
+Timeline::event_to_view (wxMouseEvent& ev)
{
ViewList::iterator i = _views.begin();
Position<int> const p (ev.GetX(), ev.GetY());
@@ -498,7 +499,7 @@ DCPTimeline::event_to_view (wxMouseEvent& ev)
}
void
-DCPTimeline::left_down (wxMouseEvent& ev)
+Timeline::left_down (wxMouseEvent& ev)
{
shared_ptr<View> view = event_to_view (ev);
shared_ptr<ContentView> content_view = dynamic_pointer_cast<ContentView> (view);
@@ -539,7 +540,7 @@ DCPTimeline::left_down (wxMouseEvent& ev)
}
void
-DCPTimeline::left_up (wxMouseEvent& ev)
+Timeline::left_up (wxMouseEvent& ev)
{
_left_down = false;
@@ -551,7 +552,7 @@ DCPTimeline::left_up (wxMouseEvent& ev)
}
void
-DCPTimeline::mouse_moved (wxMouseEvent& ev)
+Timeline::mouse_moved (wxMouseEvent& ev)
{
if (!_left_down) {
return;
@@ -561,7 +562,7 @@ DCPTimeline::mouse_moved (wxMouseEvent& ev)
}
void
-DCPTimeline::right_down (wxMouseEvent& ev)
+Timeline::right_down (wxMouseEvent& ev)
{
shared_ptr<View> view = event_to_view (ev);
shared_ptr<ContentView> cv = dynamic_pointer_cast<ContentView> (view);
@@ -578,7 +579,7 @@ DCPTimeline::right_down (wxMouseEvent& ev)
}
void
-DCPTimeline::set_position_from_event (wxMouseEvent& ev)
+Timeline::set_position_from_event (wxMouseEvent& ev)
{
wxPoint const p = ev.GetPosition();
@@ -597,13 +598,13 @@ DCPTimeline::set_position_from_event (wxMouseEvent& ev)
return;
}
- DCPTime new_position = _down_view_position + (p.x - _down_point.x) / _pixels_per_time_unit;
+ DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / _pixels_per_second);
if (_snap) {
bool first = true;
- DCPTime nearest_distance = TIME_MAX;
- DCPTime nearest_new_position = TIME_MAX;
+ DCPTime nearest_distance = DCPTime::max ();
+ DCPTime nearest_new_position = DCPTime::max ();
/* Find the nearest content edge; this is inefficient */
for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
@@ -614,7 +615,7 @@ DCPTimeline::set_position_from_event (wxMouseEvent& ev)
{
/* Snap starts to ends */
- DCPTime const d = abs (cv->content()->end() - new_position);
+ DCPTime const d = DCPTime (cv->content()->end() - new_position).abs ();
if (first || d < nearest_distance) {
nearest_distance = d;
nearest_new_position = cv->content()->end();
@@ -623,7 +624,10 @@ DCPTimeline::set_position_from_event (wxMouseEvent& ev)
{
/* Snap ends to starts */
- DCPTime const d = abs (cv->content()->position() - (new_position + _down_view->content()->length_after_trim()));
+ DCPTime const d = DCPTime (
+ cv->content()->position() - (new_position + _down_view->content()->length_after_trim())
+ ).abs ();
+
if (d < nearest_distance) {
nearest_distance = d;
nearest_new_position = cv->content()->position() - _down_view->content()->length_after_trim ();
@@ -635,14 +639,14 @@ DCPTimeline::set_position_from_event (wxMouseEvent& ev)
if (!first) {
/* Snap if it's close; `close' means within a proportion of the time on the timeline */
- if (nearest_distance < (width() / pixels_per_time_unit()) / 32) {
+ if (nearest_distance < (width() / pixels_per_second()) / 32) {
new_position = nearest_new_position;
}
}
}
if (new_position < 0) {
- new_position = 0;
+ new_position = DCPTime ();
}
_down_view->content()->set_position (new_position);
@@ -653,25 +657,25 @@ DCPTimeline::set_position_from_event (wxMouseEvent& ev)
}
void
-DCPTimeline::force_redraw (dcpomatic::Rect<int> const & r)
+Timeline::force_redraw (dcpomatic::Rect<int> const & r)
{
RefreshRect (wxRect (r.x, r.y, r.width, r.height), false);
}
shared_ptr<const Film>
-DCPTimeline::film () const
+Timeline::film () const
{
return _film.lock ();
}
void
-DCPTimeline::resized ()
+Timeline::resized ()
{
- setup_pixels_per_time_unit ();
+ setup_pixels_per_second ();
}
void
-DCPTimeline::clear_selection ()
+Timeline::clear_selection ()
{
for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
shared_ptr<ContentView> cv = dynamic_pointer_cast<ContentView> (*i);
@@ -681,8 +685,8 @@ DCPTimeline::clear_selection ()
}
}
-DCPTimeline::ContentViewList
-DCPTimeline::selected_views () const
+Timeline::ContentViewList
+Timeline::selected_views () const
{
ContentViewList sel;
@@ -697,7 +701,7 @@ DCPTimeline::selected_views () const
}
ContentList
-DCPTimeline::selected_content () const
+Timeline::selected_content () const
{
ContentList sel;
ContentViewList views = selected_views ();
diff --git a/src/wx/timeline.h b/src/wx/timeline.h
index b3ee77fff..35153dd17 100644
--- a/src/wx/timeline.h
+++ b/src/wx/timeline.h
@@ -29,12 +29,12 @@ class Film;
class View;
class ContentView;
class FilmEditor;
-class DCPTimeAxisView;
+class TimeAxisView;
-class DCPTimeline : public wxPanel
+class Timeline : public wxPanel
{
public:
- DCPTimeline (wxWindow *, FilmEditor *, boost::shared_ptr<Film>);
+ Timeline (wxWindow *, FilmEditor *, boost::shared_ptr<Film>);
boost::shared_ptr<const Film> film () const;
@@ -52,8 +52,8 @@ public:
return 48;
}
- double pixels_per_time_unit () const {
- return _pixels_per_time_unit;
+ double pixels_per_second () const {
+ return _pixels_per_second;
}
Position<int> tracks_position () const {
@@ -62,7 +62,7 @@ public:
int tracks () const;
- void setup_pixels_per_time_unit ();
+ void setup_pixels_per_second ();
void set_snap (bool s) {
_snap = s;
@@ -94,9 +94,9 @@ private:
FilmEditor* _film_editor;
boost::weak_ptr<Film> _film;
ViewList _views;
- boost::shared_ptr<DCPTimeAxisView> _time_axis_view;
+ boost::shared_ptr<TimeAxisView> _time_axis_view;
int _tracks;
- double _pixels_per_time_unit;
+ double _pixels_per_second;
bool _left_down;
wxPoint _down_point;
boost::shared_ptr<ContentView> _down_view;
diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc
index a63c219db..dbf7ae232 100644
--- a/src/wx/timeline_dialog.cc
+++ b/src/wx/timeline_dialog.cc
@@ -28,8 +28,8 @@ using std::list;
using std::cout;
using boost::shared_ptr;
-DCPTimelineDialog::DCPTimelineDialog (FilmEditor* ed, shared_ptr<Film> film)
- : wxDialog (ed, wxID_ANY, _("DCPTimeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
+TimelineDialog::TimelineDialog (FilmEditor* ed, shared_ptr<Film> film)
+ : wxDialog (ed, wxID_ANY, _("Timeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
, _timeline (this, ed, film)
{
wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
@@ -46,11 +46,11 @@ DCPTimelineDialog::DCPTimelineDialog (FilmEditor* ed, shared_ptr<Film> film)
sizer->SetSizeHints (this);
_snap->SetValue (_timeline.snap ());
- _snap->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPTimelineDialog::snap_toggled, this));
+ _snap->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::snap_toggled, this));
}
void
-DCPTimelineDialog::snap_toggled ()
+TimelineDialog::snap_toggled ()
{
_timeline.set_snap (_snap->GetValue ());
}
diff --git a/src/wx/timeline_dialog.h b/src/wx/timeline_dialog.h
index b64445d9c..1e5955003 100644
--- a/src/wx/timeline_dialog.h
+++ b/src/wx/timeline_dialog.h
@@ -24,14 +24,14 @@
class Playlist;
-class DCPTimelineDialog : public wxDialog
+class TimelineDialog : public wxDialog
{
public:
- DCPTimelineDialog (FilmEditor *, boost::shared_ptr<Film>);
+ TimelineDialog (FilmEditor *, boost::shared_ptr<Film>);
private:
void snap_toggled ();
- DCPTimeline _timeline;
+ Timeline _timeline;
wxCheckBox* _snap;
};
diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc
index 34702463c..b8b923a6b 100644
--- a/src/wx/timing_panel.cc
+++ b/src/wx/timing_panel.cc
@@ -85,31 +85,31 @@ TimingPanel::film_content_changed (int property)
if (content) {
_position->set (content->position (), _editor->film()->video_frame_rate ());
} else {
- _position->set (0, 24);
+ _position->set (DCPTime () , 24);
}
} else if (property == ContentProperty::LENGTH || property == VideoContentProperty::VIDEO_FRAME_RATE) {
if (content) {
_full_length->set (content->full_length (), _editor->film()->video_frame_rate ());
_play_length->set (content->length_after_trim (), _editor->film()->video_frame_rate ());
} else {
- _full_length->set (0, 24);
- _play_length->set (0, 24);
+ _full_length->set (DCPTime (), 24);
+ _play_length->set (DCPTime (), 24);
}
} else if (property == ContentProperty::TRIM_START) {
if (content) {
_trim_start->set (content->trim_start (), _editor->film()->video_frame_rate ());
_play_length->set (content->length_after_trim (), _editor->film()->video_frame_rate ());
} else {
- _trim_start->set (0, 24);
- _play_length->set (0, 24);
+ _trim_start->set (DCPTime (), 24);
+ _play_length->set (DCPTime (), 24);
}
} else if (property == ContentProperty::TRIM_END) {
if (content) {
_trim_end->set (content->trim_end (), _editor->film()->video_frame_rate ());
_play_length->set (content->length_after_trim (), _editor->film()->video_frame_rate ());
} else {
- _trim_end->set (0, 24);
- _play_length->set (0, 24);
+ _trim_end->set (DCPTime (), 24);
+ _play_length->set (DCPTime (), 24);
}
}
@@ -149,7 +149,8 @@ TimingPanel::full_length_changed ()
if (c.size() == 1) {
shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (c.front ());
if (ic && ic->still ()) {
- ic->set_video_length (rint (_full_length->get (_editor->film()->video_frame_rate()) * ic->video_frame_rate() / TIME_HZ));
+ /* XXX: No effective FRC here... is this right? */
+ ic->set_video_length (ContentTime (_full_length->get (_editor->film()->video_frame_rate()), FrameRateChange (1, 1)));
}
}
}