Put current frame position in seek-by-frame dialogue when opening it (#1736).
authorCarl Hetherington <cth@carlh.net>
Wed, 29 Apr 2020 20:14:15 +0000 (22:14 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 29 Apr 2020 20:14:25 +0000 (22:14 +0200)
src/wx/controls.cc
src/wx/playhead_to_frame_dialog.cc
src/wx/playhead_to_frame_dialog.h

index 022ebfe29552df64e2c4d28296ee1e590296c5ae..e3f476c05e35530dc28a473bb133d4cd160987d4 100644 (file)
@@ -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);
        }
index 4c8bc1cc6ede06f9ca03014808684517dfb68743..b4c4b1030bd2b787d171228546e643f784c5af8c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #include "playhead_to_frame_dialog.h"
 #include <dcp/locale_convert.h>
 
+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<string>(time.frames_round(fps) + 1)));
+       _frame->SetSelection (-1, -1);
 
        layout ();
 }
index ab3898dea1f004e9f1bc717e26cae8d36ce00591..9b582ccf71c94b2c7465a5fa791fc9b3933d7cbd 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
 
     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;