summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-04-01 21:44:06 +0100
committerCarl Hetherington <cth@carlh.net>2014-04-01 21:44:06 +0100
commit1eeba876ce09cedfa4c779bf3554372c01dc34c5 (patch)
tree3b1590b8b1e25a985a7805e28187d454df52a1a6 /src/wx
parent70b1f90c6986e36afc2af36ee127f6a3eb8653cd (diff)
Various small fixes.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/film_viewer.cc30
-rw-r--r--src/wx/film_viewer.h4
2 files changed, 14 insertions, 20 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 1d8a1d322..33af202bc 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 (DCPTime ());
+ set_position_text ();
if (!_film) {
return;
@@ -146,6 +146,10 @@ FilmViewer::set_film (shared_ptr<Film> f)
void
FilmViewer::get (DCPTime p, bool accurate)
{
+ if (!_player) {
+ return;
+ }
+
shared_ptr<DCPVideo> dcp_video = _player->get_video (p, accurate);
if (dcp_video) {
_frame = dcp_video->image (PIX_FMT_BGRA, true);
@@ -154,7 +158,9 @@ FilmViewer::get (DCPTime p, bool accurate)
_frame.reset ();
}
- set_position_text (p);
+ _position = p;
+
+ set_position_text ();
_panel->Refresh ();
_panel->Update ();
}
@@ -162,10 +168,6 @@ FilmViewer::get (DCPTime p, bool accurate)
void
FilmViewer::timer ()
{
- if (!_player) {
- return;
- }
-
get (_position + DCPTime::from_frames (1, _film->video_frame_rate ()), true);
DCPTime const len = _film->length ();
@@ -214,7 +216,7 @@ FilmViewer::paint_panel ()
void
FilmViewer::slider_moved ()
{
- if (!_film || !_player) {
+ if (!_film) {
return;
}
@@ -292,7 +294,7 @@ FilmViewer::check_play_state ()
}
void
-FilmViewer::set_position_text (DCPTime t)
+FilmViewer::set_position_text ()
{
if (!_film) {
_frame_number->SetLabel ("0");
@@ -302,9 +304,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.seconds() * fps)) + 1));
+ _frame_number->SetLabel (wxString::Format (wxT("%d"), int (rint (_position.seconds() * fps)) + 1));
- double w = t.seconds ();
+ double w = _position.seconds ();
int const h = (w / 3600);
w -= h * 3600;
int const m = (w / 60);
@@ -338,10 +340,6 @@ FilmViewer::active_jobs_changed (bool a)
void
FilmViewer::back_clicked ()
{
- if (!_player) {
- return;
- }
-
DCPTime p = _position - DCPTime::from_frames (1, _film->video_frame_rate ());
if (p < DCPTime ()) {
p = DCPTime ();
@@ -353,10 +351,6 @@ FilmViewer::back_clicked ()
void
FilmViewer::forward_clicked ()
{
- if (!_player) {
- return;
- }
-
get (_position + DCPTime::from_frames (1, _film->video_frame_rate ()), true);
}
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 52876030c..207004f29 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
@@ -52,7 +52,7 @@ private:
void back_clicked ();
void forward_clicked ();
void player_changed (bool);
- void set_position_text (DCPTime);
+ void set_position_text ();
void get (DCPTime, bool);
boost::shared_ptr<Film> _film;