projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Supporters update.
[dcpomatic.git]
/
src
/
wx
/
controls.cc
diff --git
a/src/wx/controls.cc
b/src/wx/controls.cc
index 700769a50c7543cdaee030223128facda4541323..a90ac79b40e5b89ab706a55a9e0a1a3ecb4b368d 100644
(file)
--- a/
src/wx/controls.cc
+++ b/
src/wx/controls.cc
@@
-19,22
+19,22
@@
*/
*/
+#include "check_box.h"
+#include "content_view.h"
#include "controls.h"
#include "controls.h"
+#include "dcpomatic_button.h"
#include "film_viewer.h"
#include "film_viewer.h"
-#include "wx_util.h"
-#include "playhead_to_timecode_dialog.h"
#include "playhead_to_frame_dialog.h"
#include "playhead_to_frame_dialog.h"
-#include "
content_view
.h"
+#include "
playhead_to_timecode_dialog
.h"
#include "static_text.h"
#include "static_text.h"
-#include "check_box.h"
-#include "dcpomatic_button.h"
-#include "lib/job_manager.h"
-#include "lib/player_video.h"
-#include "lib/dcp_content.h"
-#include "lib/job.h"
-#include "lib/examine_content_job.h"
+#include "wx_util.h"
#include "lib/content_factory.h"
#include "lib/cross.h"
#include "lib/content_factory.h"
#include "lib/cross.h"
+#include "lib/dcp_content.h"
+#include "lib/examine_content_job.h"
+#include "lib/job.h"
+#include "lib/job_manager.h"
+#include "lib/player_video.h"
#include <dcp/dcp.h>
#include <dcp/cpl.h>
#include <dcp/reel.h>
#include <dcp/dcp.h>
#include <dcp/cpl.h>
#include <dcp/reel.h>
@@
-144,13
+144,13
@@
Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
_jump_to_selected->SetValue (Config::instance()->jump_to_selected ());
}
_jump_to_selected->SetValue (Config::instance()->jump_to_selected ());
}
-
_
viewer->Started.connect (boost::bind(&Controls::started, this));
-
_
viewer->Stopped.connect (boost::bind(&Controls::stopped, this));
+ viewer->Started.connect (boost::bind(&Controls::started, this));
+ viewer->Stopped.connect (boost::bind(&Controls::stopped, this));
Bind (wxEVT_TIMER, boost::bind(&Controls::update_position, this));
_timer.Start (80, wxTIMER_CONTINUOUS);
Bind (wxEVT_TIMER, boost::bind(&Controls::update_position, this));
_timer.Start (80, wxTIMER_CONTINUOUS);
- set_film (
_
viewer->film());
+ set_film (viewer->film());
setup_sensitivity ();
setup_sensitivity ();
@@
-186,7
+186,12
@@
Controls::stopped ()
void
Controls::update_position ()
{
void
Controls::update_position ()
{
- if (!_slider_being_moved && !_viewer->pending_idle_get()) {
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return;
+ }
+
+ if (!_slider_being_moved && !viewer->pending_idle_get()) {
update_position_label ();
update_position_slider ();
}
update_position_label ();
update_position_slider ();
}
@@
-196,14
+201,24
@@
Controls::update_position ()
void
Controls::eye_changed ()
{
void
Controls::eye_changed ()
{
- _viewer->set_eyes (_eye->GetSelection() == 0 ? Eyes::LEFT : Eyes::RIGHT);
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return;
+ }
+
+ viewer->set_eyes (_eye->GetSelection() == 0 ? Eyes::LEFT : Eyes::RIGHT);
}
void
Controls::outline_content_changed ()
{
}
void
Controls::outline_content_changed ()
{
- _viewer->set_outline_content (_outline_content->GetValue());
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return;
+ }
+
+ viewer->set_outline_content (_outline_content->GetValue());
}
}
@@
-211,13
+226,14
@@
Controls::outline_content_changed ()
void
Controls::slider_moved (bool page)
{
void
Controls::slider_moved (bool page)
{
- if (!_film) {
+ auto viewer = _viewer.lock ();
+ if (!_film || !viewer) {
return;
}
if (!page && !_slider_being_moved) {
/* This is the first event of a drag; stop playback for the duration of the drag */
return;
}
if (!page && !_slider_being_moved) {
/* This is the first event of a drag; stop playback for the duration of the drag */
-
_
viewer->suspend ();
+ viewer->suspend ();
_slider_being_moved = true;
}
_slider_being_moved = true;
}
@@
-228,25
+244,24
@@
Controls::slider_moved (bool page)
*/
bool accurate = false;
if (t >= _film->length ()) {
*/
bool accurate = false;
if (t >= _film->length ()) {
- t = _film->length() -
_
viewer->one_video_frame();
+ t = _film->length() - viewer->one_video_frame();
accurate = true;
}
accurate = true;
}
-
_
viewer->seek (t, accurate);
+ viewer->seek (t, accurate);
update_position_label ();
update_position_label ();
-
- log (
- wxString::Format(
- "playback-seeked %s", t.timecode(_film->video_frame_rate()).c_str()
- )
- );
}
void
Controls::slider_released ()
{
}
void
Controls::slider_released ()
{
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return;
+ }
+
/* Restart after a drag */
/* Restart after a drag */
-
_
viewer->resume ();
+ viewer->resume ();
_slider_being_moved = false;
}
_slider_being_moved = false;
}
@@
-259,10
+274,15
@@
Controls::update_position_slider ()
return;
}
return;
}
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return;
+ }
+
auto const len = _film->length ();
if (len.get ()) {
auto const len = _film->length ();
if (len.get ()) {
- int const new_slider_position = 4096 *
_
viewer->position().get() / len.get();
+ int const new_slider_position = 4096 * viewer->position().get() / len.get();
if (new_slider_position != _slider->GetValue()) {
_slider->SetValue (new_slider_position);
}
if (new_slider_position != _slider->GetValue()) {
_slider->SetValue (new_slider_position);
}
@@
-279,10
+299,15
@@
Controls::update_position_label ()
return;
}
return;
}
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return;
+ }
+
double const fps = _film->video_frame_rate ();
/* Count frame number from 1 ... not sure if this is the best idea */
double const fps = _film->video_frame_rate ();
/* Count frame number from 1 ... not sure if this is the best idea */
- checked_set (_frame_number, wxString::Format (wxT("%ld"), lrint (
_
viewer->position().seconds() * fps) + 1));
- checked_set (_timecode, time_to_timecode (
_
viewer->position(), fps));
+ checked_set (_frame_number, wxString::Format (wxT("%ld"), lrint (viewer->position().seconds() * fps) + 1));
+ checked_set (_timecode, time_to_timecode (viewer->position(), fps));
}
}
@@
-297,7
+322,12
@@
Controls::active_jobs_changed (optional<string> j)
DCPTime
Controls::nudge_amount (wxKeyboardState& ev)
{
DCPTime
Controls::nudge_amount (wxKeyboardState& ev)
{
- auto amount = _viewer->one_video_frame ();
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return {};
+ }
+
+ auto amount = viewer->one_video_frame ();
if (ev.ShiftDown() && !ev.ControlDown()) {
amount = DCPTime::from_seconds (1);
if (ev.ShiftDown() && !ev.ControlDown()) {
amount = DCPTime::from_seconds (1);
@@
-314,7
+344,10
@@
Controls::nudge_amount (wxKeyboardState& ev)
void
Controls::rewind_clicked (wxMouseEvent& ev)
{
void
Controls::rewind_clicked (wxMouseEvent& ev)
{
- _viewer->seek (DCPTime(), true);
+ auto viewer = _viewer.lock ();
+ if (viewer) {
+ viewer->seek (DCPTime(), true);
+ }
ev.Skip();
}
ev.Skip();
}
@@
-322,28
+355,40
@@
Controls::rewind_clicked (wxMouseEvent& ev)
void
Controls::back_frame ()
{
void
Controls::back_frame ()
{
- _viewer->seek_by (-_viewer->one_video_frame(), true);
+ auto viewer = _viewer.lock ();
+ if (viewer) {
+ viewer->seek_by (-viewer->one_video_frame(), true);
+ }
}
void
Controls::forward_frame ()
{
}
void
Controls::forward_frame ()
{
- _viewer->seek_by (_viewer->one_video_frame(), true);
+ auto viewer = _viewer.lock ();
+ if (viewer) {
+ viewer->seek_by (viewer->one_video_frame(), true);
+ }
}
void
Controls::back_clicked (wxKeyboardState& ev)
{
}
void
Controls::back_clicked (wxKeyboardState& ev)
{
- _viewer->seek_by (-nudge_amount(ev), true);
+ auto viewer = _viewer.lock ();
+ if (viewer) {
+ viewer->seek_by (-nudge_amount(ev), true);
+ }
}
void
Controls::forward_clicked (wxKeyboardState& ev)
{
}
void
Controls::forward_clicked (wxKeyboardState& ev)
{
- _viewer->seek_by (nudge_amount(ev), true);
+ auto viewer = _viewer.lock ();
+ if (viewer) {
+ viewer->seek_by (nudge_amount(ev), true);
+ }
}
}
@@
-376,9
+421,14
@@
Controls::setup_sensitivity ()
void
Controls::timecode_clicked ()
{
void
Controls::timecode_clicked ()
{
- auto dialog = new PlayheadToTimecodeDialog (this, _viewer->position(), _film->video_frame_rate());
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return;
+ }
+
+ auto dialog = new PlayheadToTimecodeDialog (this, viewer->position(), _film->video_frame_rate());
if (dialog->ShowModal() == wxID_OK) {
if (dialog->ShowModal() == wxID_OK) {
-
_
viewer->seek (dialog->get(), true);
+ viewer->seek (dialog->get(), true);
}
dialog->Destroy ();
}
}
dialog->Destroy ();
}
@@
-387,9
+437,14
@@
Controls::timecode_clicked ()
void
Controls::frame_number_clicked ()
{
void
Controls::frame_number_clicked ()
{
- auto dialog = new PlayheadToFrameDialog (this, _viewer->position(), _film->video_frame_rate());
+ auto viewer = _viewer.lock ();
+ if (!viewer) {
+ return;
+ }
+
+ auto dialog = new PlayheadToFrameDialog (this, viewer->position(), _film->video_frame_rate());
if (dialog->ShowModal() == wxID_OK) {
if (dialog->ShowModal() == wxID_OK) {
-
_
viewer->seek (dialog->get(), true);
+ viewer->seek (dialog->get(), true);
}
dialog->Destroy ();
}
}
dialog->Destroy ();
}