- T t;
- std::string const h = wx_to_std (_hours->GetValue ());
- t += T::from_seconds (boost::lexical_cast<int> (h.empty() ? "0" : h) * 3600);
- std::string const m = wx_to_std (_minutes->GetValue());
- t += T::from_seconds (boost::lexical_cast<int> (m.empty() ? "0" : m) * 60);
- std::string const s = wx_to_std (_seconds->GetValue());
- t += T::from_seconds (boost::lexical_cast<int> (s.empty() ? "0" : s));
- std::string const f = wx_to_std (_frames->GetValue());
- t += T::from_seconds (boost::lexical_cast<double> (f.empty() ? "0" : f) / fps);
-
- return t;
+ 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) };
+ }
+
+ T get (float fps) const
+ {
+ return T(get(), fps);