Fix setting of fade in/out on multiple pieces of content at the same time (#1934).
authorCarl Hetherington <cth@carlh.net>
Sat, 20 Mar 2021 09:31:07 +0000 (10:31 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 20 Mar 2021 09:31:07 +0000 (10:31 +0100)
src/wx/timecode.h
src/wx/video_panel.cc

index 3fe35981db6a8048e5e44a6ebb61efbbdc4939d5..ccab0ecfcb1686229b8da208163bc25fa240b2d9 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.
 
@@ -22,6 +22,7 @@
 #define DCPOMATIC_WX_TIMECODE_H
 
 #include "wx_util.h"
+#include "lib/dcpomatic_time.h"
 #include "lib/types.h"
 #include <dcp/raw_convert.h>
 #include <wx/wx.h>
@@ -87,7 +88,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 +98,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);
        }
 };
 
index 6cb3bfc87680ca3f98f08d05a1bac1c758dd6b72..ce6b08f26f408f112e2b40d150ca3ec88f09eb7d 100644 (file)
@@ -635,18 +635,20 @@ VideoPanel::setup_sensitivity ()
 void
 VideoPanel::fade_in_changed ()
 {
-       for (auto i: _parent->selected_video ()) {
+       auto const hmsf = _fade_in->get();
+       for (auto i: _parent->selected_video()) {
                double const vfr = i->active_video_frame_rate (_parent->film());
-               i->video->set_fade_in (_fade_in->get(vfr).frames_round(vfr));
+               i->video->set_fade_in (dcpomatic::ContentTime(hmsf, vfr).frames_round(vfr));
        }
 }
 
 void
 VideoPanel::fade_out_changed ()
 {
-       for (auto i: _parent->selected_video ()) {
+       auto const hmsf = _fade_out->get();
+       for (auto i: _parent->selected_video()) {
                double const vfr = i->active_video_frame_rate (_parent->film());
-               i->video->set_fade_out (_fade_out->get(vfr).frames_round(vfr));
+               i->video->set_fade_out (dcpomatic::ContentTime(hmsf, vfr).frames_round(vfr));
        }
 }