summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-06-14 19:04:30 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-14 19:04:30 +0100
commitcea83d339056dbd0213d1eb327accd96ea0c3b46 (patch)
tree05f02e5e382fe32ed5f347098e88d70136625281 /src
parentaf90e52cd6960c54586cd27a831d535a2001971e (diff)
Fix messed up position slider caused by trim changes.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_viewer.cc33
-rw-r--r--src/wx/film_viewer.h3
2 files changed, 28 insertions, 8 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index bdbfc6c03..26d81ee86 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -130,7 +130,8 @@ FilmViewer::set_film (shared_ptr<Film> f)
_frame.reset ();
- update_position ();
+ update_position_slider ();
+ update_position_label ();
if (!_film) {
return;
@@ -212,7 +213,6 @@ FilmViewer::get (DCPTime p, bool accurate)
_position = p;
}
- update_position ();
refresh_panel ();
_last_get_accurate = accurate;
@@ -222,6 +222,8 @@ void
FilmViewer::timer ()
{
get (_position + DCPTime::from_frames (1, _film->video_frame_rate ()), true);
+ update_position_label ();
+ update_position_slider ();
}
void
@@ -275,6 +277,7 @@ FilmViewer::slider_moved ()
t = _film->length() - DCPTime::from_frames (1, _film->video_frame_rate ());
}
get (t, false);
+ update_position_label ();
}
void
@@ -285,6 +288,8 @@ FilmViewer::panel_sized (wxSizeEvent& ev)
calculate_sizes ();
get (_position, _last_get_accurate);
+ update_position_label ();
+ update_position_slider ();
}
void
@@ -337,15 +342,13 @@ FilmViewer::check_play_state ()
}
void
-FilmViewer::update_position ()
+FilmViewer::update_position_slider ()
{
if (!_film) {
_slider->SetValue (0);
- _frame_number->SetLabel ("0");
- _timecode->SetLabel ("0:0:0.0");
return;
}
-
+
DCPTime const len = _film->length ();
if (len.get ()) {
@@ -354,7 +357,17 @@ FilmViewer::update_position ()
_slider->SetValue (new_slider_position);
}
}
-
+}
+
+void
+FilmViewer::update_position_label ()
+{
+ if (!_film) {
+ _frame_number->SetLabel ("0");
+ _timecode->SetLabel ("0:0:0.0");
+ return;
+ }
+
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 (_position.seconds() * fps)) + 1));
@@ -390,12 +403,16 @@ FilmViewer::back_clicked ()
}
get (p, true);
+ update_position_label ();
+ update_position_slider ();
}
void
FilmViewer::forward_clicked ()
{
get (_position + DCPTime::from_frames (1, _film->video_frame_rate ()), true);
+ update_position_label ();
+ update_position_slider ();
}
void
@@ -407,6 +424,8 @@ FilmViewer::player_changed (bool frequent)
calculate_sizes ();
get (_position, _last_get_accurate);
+ update_position_label ();
+ update_position_slider ();
}
void
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 9e4a454ea..f6ab1a567 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -56,7 +56,8 @@ private:
void back_clicked ();
void forward_clicked ();
void player_changed (bool);
- void update_position ();
+ void update_position_label ();
+ void update_position_slider ();
void get (DCPTime, bool);
void refresh_panel ();
void setup_sensitivity ();