C++11 tidying.
[dcpomatic.git] / src / wx / film_viewer.cc
index 920ca3a10bce5c874c4b420056fca527347f8f32..b9e9bd5331ae07c9b2959446a5a50a8ae9b69e4c 100644 (file)
@@ -65,9 +65,10 @@ using std::list;
 using std::bad_alloc;
 using std::make_pair;
 using std::exception;
-using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
-using boost::weak_ptr;
+using std::shared_ptr;
+using std::dynamic_pointer_cast;
+using std::vector;
+using std::weak_ptr;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
@@ -180,12 +181,11 @@ FilmViewer::set_film (shared_ptr<Film> film)
        _player->set_play_referenced ();
 
        _film->Change.connect (boost::bind (&FilmViewer::film_change, this, _1, _2));
-       _film->ContentChange.connect (boost::bind(&FilmViewer::content_change, this, _1, _3));
        _film->LengthChange.connect (boost::bind(&FilmViewer::film_length_change, this));
        _player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
 
-       film_change (CHANGE_TYPE_DONE, Film::VIDEO_FRAME_RATE);
-       film_change (CHANGE_TYPE_DONE, Film::THREE_D);
+       film_change (ChangeType::DONE, Film::Property::VIDEO_FRAME_RATE);
+       film_change (ChangeType::DONE, Film::Property::THREE_D);
        film_length_change ();
 
        /* Keep about 1 second's worth of history samples */
@@ -217,7 +217,7 @@ FilmViewer::recreate_butler ()
                        Config::instance()->audio_mapping(_audio_channels),
                        _audio_channels,
                        bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24),
-                       VIDEO_RANGE_FULL,
+                       VideoRange::FULL,
                        false,
                        true
                        )
@@ -376,7 +376,7 @@ FilmViewer::stop ()
 void
 FilmViewer::player_change (ChangeType type, int property, bool frequent)
 {
-       if (type != CHANGE_TYPE_DONE || frequent) {
+       if (type != ChangeType::DONE || frequent) {
                return;
        }
 
@@ -385,39 +385,58 @@ FilmViewer::player_change (ChangeType type, int property, bool frequent)
                return;
        }
 
+       player_change ({property});
+}
+
+void
+FilmViewer::player_change (vector<int> properties)
+{
        calculate_sizes ();
-       bool refreshed = false;
-       if (
-               property == VideoContentProperty::CROP ||
-               property == VideoContentProperty::SCALE ||
-               property == VideoContentProperty::FADE_IN ||
-               property == VideoContentProperty::FADE_OUT ||
-               property == VideoContentProperty::COLOUR_CONVERSION ||
-               property == PlayerProperty::VIDEO_CONTAINER_SIZE ||
-               property == PlayerProperty::FILM_CONTAINER
-               ) {
-               refreshed = quick_refresh ();
-       }
-
-       if (!refreshed) {
+
+       bool try_quick_refresh = false;
+       bool update_ccap_tracks = false;
+
+       for (auto i: properties) {
+               if (
+                       i == VideoContentProperty::CROP ||
+                       i == VideoContentProperty::SCALE ||
+                       i == VideoContentProperty::FADE_IN ||
+                       i == VideoContentProperty::FADE_OUT ||
+                       i == VideoContentProperty::COLOUR_CONVERSION ||
+                       i == PlayerProperty::VIDEO_CONTAINER_SIZE ||
+                       i == PlayerProperty::FILM_CONTAINER
+                  ) {
+                       try_quick_refresh = true;
+               }
+
+               if (i == TextContentProperty::USE || i == TextContentProperty::TYPE || i == TextContentProperty::DCP_TRACK) {
+                       update_ccap_tracks = true;
+               }
+       }
+
+       if (!try_quick_refresh || !quick_refresh()) {
                slow_refresh ();
        }
+
+       if (update_ccap_tracks) {
+               _closed_captions_dialog->update_tracks (_film);
+       }
 }
 
 void
 FilmViewer::film_change (ChangeType type, Film::Property p)
 {
-       if (type != CHANGE_TYPE_DONE) {
+       if (type != ChangeType::DONE) {
                return;
        }
 
-       if (p == Film::AUDIO_CHANNELS) {
+       if (p == Film::Property::AUDIO_CHANNELS) {
                recreate_butler ();
-       } else if (p == Film::VIDEO_FRAME_RATE) {
+       } else if (p == Film::Property::VIDEO_FRAME_RATE) {
                _video_view->set_video_frame_rate (_film->video_frame_rate());
-       } else if (p == Film::THREE_D) {
+       } else if (p == Film::Property::THREE_D) {
                _video_view->set_three_d (_film->three_d());
-       } else if (p == Film::CONTENT) {
+       } else if (p == Film::Property::CONTENT) {
                _closed_captions_dialog->update_tracks (_film);
        }
 }
@@ -463,9 +482,7 @@ FilmViewer::set_coalesce_player_changes (bool c)
        _coalesce_player_changes = c;
 
        if (!c) {
-               BOOST_FOREACH (int i, _pending_player_changes) {
-                       player_change (CHANGE_TYPE_DONE, i, false);
-               }
+               player_change (_pending_player_changes);
                _pending_player_changes.clear ();
        }
 }
@@ -622,7 +639,7 @@ FilmViewer::average_latency () const
         }
 
         Frame total = 0;
-        BOOST_FOREACH (Frame i, _latency_history) {
+        for (auto i: _latency_history) {
                 total += i;
         }
 
@@ -707,19 +724,6 @@ FilmViewer::gets () const
 }
 
 
-void
-FilmViewer::content_change (ChangeType type, int property)
-{
-       if (type != CHANGE_TYPE_DONE) {
-               return;
-       }
-
-       if (property == TextContentProperty::USE || property == TextContentProperty::TYPE || property == TextContentProperty::DCP_TRACK) {
-               _closed_captions_dialog->update_tracks (_film);
-       }
-}
-
-
 void
 FilmViewer::image_changed (shared_ptr<PlayerVideo> pv)
 {