From 63b1442519ce5032a7fd85d9585aa203de639f27 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 20 Dec 2023 23:41:49 +0100 Subject: Add validity check to Timecode. --- src/wx/timecode.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/wx/timecode.h') diff --git a/src/wx/timecode.h b/src/wx/timecode.h index 6c5d8ae23..22899ddc9 100644 --- a/src/wx/timecode.h +++ b/src/wx/timecode.h @@ -50,6 +50,7 @@ public: protected: void changed (); void set_clicked (); + virtual bool valid() const = 0; wxSizer* _sizer; wxPanel* _editable; @@ -96,6 +97,11 @@ public: _frames->SetHint (std_to_wx(dcp::raw_convert(hmsf.f))); } + void set_maximum(dcpomatic::HMSF maximum) + { + _maximum = std::move(maximum); + } + dcpomatic::HMSF get () const { auto value_or_hint = [](wxTextCtrl const * t) { @@ -116,6 +122,13 @@ public: { return T(get(), fps); } + +private: + bool valid() const override { + return !_maximum || get() <= *_maximum; + } + + boost::optional _maximum; }; #endif -- cgit v1.2.3