Cleanup: move variable assignment that happens in every branch.
[dcpomatic.git] / src / wx / timecode.h
index 3fe35981db6a8048e5e44a6ebb61efbbdc4939d5..6c5d8ae231cd0d6679e1b56cd2e98b0da34b89d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #ifndef DCPOMATIC_WX_TIMECODE_H
 #define DCPOMATIC_WX_TIMECODE_H
 
+
 #include "wx_util.h"
-#include "lib/types.h"
+#include "lib/dcpomatic_time.h"
 #include <dcp/raw_convert.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/wx.h>
+LIBDCP_ENABLE_WARNINGS
 #include <boost/signals2.hpp>
 
+
 class TimecodeBase : public wxPanel
 {
 public:
@@ -53,8 +59,11 @@ protected:
        wxTextCtrl* _frames;
        wxButton* _set_button;
        wxStaticText* _fixed;
+
+       bool _ignore_changed = false;
 };
 
+
 template <class T>
 class Timecode : public TimecodeBase
 {
@@ -87,7 +96,7 @@ public:
                _frames->SetHint (std_to_wx(dcp::raw_convert<std::string>(hmsf.f)));
        }
 
-       T get (float fps) const
+       dcpomatic::HMSF get () const
        {
                auto value_or_hint = [](wxTextCtrl const * t) {
                        auto s = wx_to_std (t->GetValue().IsEmpty() ? t->GetHint() : t->GetValue());
@@ -97,15 +106,15 @@ public:
                        return dcp::raw_convert<int>(s);
                };
 
-               return T (
-                       {
-                               value_or_hint(_hours),
-                               value_or_hint(_minutes),
-                               value_or_hint(_seconds),
-                               value_or_hint(_frames)
-                       },
-                       fps
-                       );
+               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);
        }
 };