Fix GL information fetching.
[dcpomatic.git] / src / wx / playhead_to_frame_dialog.cc
index af20c159268c352b4a60f7cae3277c7018647306..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/raw_convert.h>
+#include <dcp/locale_convert.h>
 
-using dcp::raw_convert;
+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 ();
 }
@@ -36,5 +41,5 @@ PlayheadToFrameDialog::PlayheadToFrameDialog (wxWindow* parent, int fps)
 DCPTime
 PlayheadToFrameDialog::get () const
 {
-       return DCPTime::from_frames (raw_convert<Frame> (wx_to_std (_frame->GetValue ())) - 1, _fps);
+       return DCPTime::from_frames (locale_convert<Frame> (wx_to_std (_frame->GetValue ())) - 1, _fps);
 }