summaryrefslogtreecommitdiff
path: root/src/wx/timecode.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-03-20 08:59:40 +0100
committerCarl Hetherington <cth@carlh.net>2021-03-20 08:59:40 +0100
commite881aeab8b5ffdfbc65b6a3ea0bf4cd96f350c8b (patch)
tree960dd6e3f475f471914f16636b3421ce5d33ce93 /src/wx/timecode.h
parent1887baa719c0e496ed34b208749ca2e62ff8f49b (diff)
Tidy up slightly with a lambda.
Diffstat (limited to 'src/wx/timecode.h')
-rw-r--r--src/wx/timecode.h19
1 files 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<int>(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