From e881aeab8b5ffdfbc65b6a3ea0bf4cd96f350c8b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 20 Mar 2021 08:59:40 +0100 Subject: [PATCH] Tidy up slightly with a lambda. --- src/wx/timecode.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/wx/timecode.h b/src/wx/timecode.h index 0c99d5361..bce527ed2 100644 --- a/src/wx/timecode.h +++ b/src/wx/timecode.h @@ -98,6 +98,15 @@ public: T get (float fps) const { T t; + + auto value_or_hint = [](wxTextCtrl const * t) { + if (!t->GetValue().IsEmpty()) { + return wx_to_std (t->GetValue()); + } else { + return wx_to_std (t->GetHint()); + } + }; + std::string const h = value_or_hint (_hours); t += T::from_seconds (dcp::raw_convert(h.empty() ? "0" : h) * 3600); std::string const m = value_or_hint (_minutes); @@ -109,16 +118,6 @@ public: return t; } - -private: - std::string value_or_hint (wxTextCtrl const * t) const - { - if (!t->GetValue().IsEmpty()) { - return wx_to_std (t->GetValue()); - } else { - return wx_to_std (t->GetHint()); - } - } }; #endif -- 2.30.2