From 40d38c8d011f0863f396f21cd750cdcef803a792 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 29 Apr 2020 22:14:15 +0200 Subject: [PATCH] Put current frame position in seek-by-frame dialogue when opening it (#1736). --- src/wx/controls.cc | 2 +- src/wx/playhead_to_frame_dialog.cc | 7 +++++-- src/wx/playhead_to_frame_dialog.h | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/wx/controls.cc b/src/wx/controls.cc index 022ebfe29..e3f476c05 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -355,7 +355,7 @@ Controls::timecode_clicked () void Controls::frame_number_clicked () { - PlayheadToFrameDialog* dialog = new PlayheadToFrameDialog (this, _film->video_frame_rate ()); + PlayheadToFrameDialog* dialog = new PlayheadToFrameDialog (this, _viewer->position(), _film->video_frame_rate()); if (dialog->ShowModal() == wxID_OK) { _viewer->seek (dialog->get(), true); } diff --git a/src/wx/playhead_to_frame_dialog.cc b/src/wx/playhead_to_frame_dialog.cc index 4c8bc1cc6..b4c4b1030 100644 --- a/src/wx/playhead_to_frame_dialog.cc +++ b/src/wx/playhead_to_frame_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2020 Carl Hetherington This file is part of DCP-o-matic. @@ -21,16 +21,19 @@ #include "playhead_to_frame_dialog.h" #include +using std::string; using dcp::locale_convert; using namespace dcpomatic; -PlayheadToFrameDialog::PlayheadToFrameDialog (wxWindow* parent, int fps) +PlayheadToFrameDialog::PlayheadToFrameDialog (wxWindow* parent, DCPTime time, int fps) : TableDialog (parent, _("Go to frame"), 2, 1, true) , _fps (fps) { add (_("Go to"), true); _frame = add (new wxTextCtrl (this, wxID_ANY, wxT (""))); _frame->SetFocus (); + _frame->SetValue (std_to_wx(locale_convert(time.frames_round(fps) + 1))); + _frame->SetSelection (-1, -1); layout (); } diff --git a/src/wx/playhead_to_frame_dialog.h b/src/wx/playhead_to_frame_dialog.h index ab3898dea..9b582ccf7 100644 --- a/src/wx/playhead_to_frame_dialog.h +++ b/src/wx/playhead_to_frame_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2020 Carl Hetherington This file is part of DCP-o-matic. @@ -24,7 +24,7 @@ class PlayheadToFrameDialog : public TableDialog { public: - PlayheadToFrameDialog (wxWindow* parent, int fps); + PlayheadToFrameDialog (wxWindow* parent, dcpomatic::DCPTime time, int fps); dcpomatic::DCPTime get () const; -- 2.30.2