- int h;
- int m;
- int s;
- int f;
- t.split (fps, h, m, s, f);
-
- checked_set (_hours, boost::lexical_cast<std::string> (h));
- checked_set (_minutes, boost::lexical_cast<std::string> (m));
- checked_set (_seconds, boost::lexical_cast<std::string> (s));
- checked_set (_frames, boost::lexical_cast<std::string> (f));
-
- _fixed->SetLabel (std_to_wx (t.timecode (fps)));
+ auto const hmsf = t.split (fps);
+
+ checked_set (_hours, dcp::raw_convert<std::string>(hmsf.h));
+ checked_set (_minutes, dcp::raw_convert<std::string>(hmsf.m));
+ checked_set (_seconds, dcp::raw_convert<std::string>(hmsf.s));
+ checked_set (_frames, dcp::raw_convert<std::string>(hmsf.f));
+
+ checked_set (_fixed, t.timecode (fps));
+ }
+
+ void set_hint (T t, float fps)
+ {
+ auto hmsf = t.split (fps);
+
+ _hours->SetHint (std_to_wx(dcp::raw_convert<std::string>(hmsf.h)));
+ _minutes->SetHint (std_to_wx(dcp::raw_convert<std::string>(hmsf.m)));
+ _seconds->SetHint (std_to_wx(dcp::raw_convert<std::string>(hmsf.s)));
+ _frames->SetHint (std_to_wx(dcp::raw_convert<std::string>(hmsf.f)));
+ }
+
+ dcpomatic::HMSF get () const
+ {
+ auto value_or_hint = [](wxTextCtrl const * t) {
+ auto s = wx_to_std (t->GetValue().IsEmpty() ? t->GetHint() : t->GetValue());
+ if (s.empty()) {
+ return 0;
+ }
+ return dcp::raw_convert<int>(s);
+ };
+
+ return { value_or_hint(_hours),
+ value_or_hint(_minutes),
+ value_or_hint(_seconds),
+ value_or_hint(_frames) };