Fix recently-broken video frame rate override control sensitivity.
authorCarl Hetherington <cth@carlh.net>
Wed, 30 Sep 2015 13:56:47 +0000 (14:56 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 30 Sep 2015 13:56:47 +0000 (14:56 +0100)
ChangeLog
src/wx/timing_panel.cc

index 7d10859fab370fb1d72ae2ea88526146a1b03206..5fa89b7719b3d870bcdd71c2e6849a903504124e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-30  c.hetherington  <cth@carlh.net>
+
+       * Fix broken video frame rate override control.
+
 2015-09-30  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.3.11 released.
index 5d74773b2d9b053a9f1b3307b6cff9774b9e014c..e416a671c10bedb74792fd35a86cfe658134a72b 100644 (file)
@@ -248,37 +248,31 @@ TimingPanel::film_content_changed (int property)
                update_play_length ();
        }
 
-       if (property == VideoContentProperty::VIDEO_FRAME_RATE) {
-               set<double> check;
+       if (property == VideoContentProperty::VIDEO_FRAME_RATE || property == SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE) {
+               set<double> check_vc;
                shared_ptr<const VideoContent> vc;
+               int count_sc = 0;
+               shared_ptr<const SubtitleContent> sc;
                BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
-                       shared_ptr<const VideoContent> t = dynamic_pointer_cast<const VideoContent> (i);
-                       if (t) {
-                               check.insert (t->video_frame_rate ());
-                               vc = t;
+                       shared_ptr<const VideoContent> vt = dynamic_pointer_cast<const VideoContent> (i);
+                       if (vt) {
+                               check_vc.insert (vt->video_frame_rate ());
+                               vc = vt;
                        }
+                       shared_ptr<const SubtitleContent> st = dynamic_pointer_cast<const SubtitleContent> (i);
+                       if (st) {
+                               ++count_sc;
+                               sc = st;
+                       }
+
                }
-               if (check.size() == 1) {
-                       checked_set (_video_frame_rate, raw_convert<string> (vc->video_frame_rate (), 5));
-                       _video_frame_rate->Enable (true);
-               } else {
-                       checked_set (_video_frame_rate, wxT (""));
-                       _video_frame_rate->Enable (false);
-               }
-       }
 
-       if (property == SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE) {
-               shared_ptr<const SubtitleContent> check;
-               int count = 0;
-               BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
-                       shared_ptr<const SubtitleContent> t = dynamic_pointer_cast<const SubtitleContent> (i);
-                       if (t) {
-                               check = t;
-                               ++count;
+               if (check_vc.size() == 1 || count_sc == 1) {
+                       if (vc) {
+                               checked_set (_video_frame_rate, raw_convert<string> (vc->video_frame_rate (), 5));
+                       } else if (sc) {
+                               checked_set (_video_frame_rate, raw_convert<string> (sc->subtitle_video_frame_rate (), 5));
                        }
-               }
-               if (count == 1) {
-                       checked_set (_video_frame_rate, raw_convert<string> (check->subtitle_video_frame_rate (), 5));
                        _video_frame_rate->Enable (true);
                } else {
                        checked_set (_video_frame_rate, wxT (""));