Use enum class for Film::Property.
authorCarl Hetherington <cth@carlh.net>
Sun, 31 Jan 2021 22:47:14 +0000 (23:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 31 Jan 2021 22:47:14 +0000 (23:47 +0100)
35 files changed:
src/lib/audio_content.cc
src/lib/butler.h
src/lib/change_signaller.h
src/lib/content.cc
src/lib/content.h
src/lib/content_part.h
src/lib/dcp_content.cc
src/lib/ffmpeg_content.cc
src/lib/film.cc
src/lib/film.h
src/lib/player.cc
src/lib/playlist.h
src/lib/text_content.cc
src/lib/types.h
src/lib/video_content.cc
src/tools/dcpomatic_player.cc
src/wx/audio_dialog.cc
src/wx/audio_dialog.h
src/wx/audio_panel.cc
src/wx/content_panel.cc
src/wx/controls.cc
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/film_editor.cc
src/wx/film_viewer.cc
src/wx/hints_dialog.h
src/wx/smpte_metadata_dialog.cc
src/wx/subtitle_appearance_dialog.h
src/wx/text_panel.cc
src/wx/timeline.cc
src/wx/timeline_content_view.cc
src/wx/timeline_content_view.h
src/wx/timeline_dialog.cc
src/wx/timing_panel.cc
src/wx/video_panel.cc

index c70afcda43576113f6f907e08f553db7c6e0f9e2..4f5fd87489893b8140cf4ef2b170df16eb46178a 100644 (file)
@@ -146,7 +146,7 @@ AudioContent::technical_summary () const
 void
 AudioContent::set_mapping (AudioMapping mapping)
 {
-       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+       ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
 
        int c = 0;
        for (auto i: streams()) {
@@ -328,7 +328,7 @@ AudioContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p
 void
 AudioContent::set_streams (vector<AudioStreamPtr> streams)
 {
-       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+       ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -347,7 +347,7 @@ AudioContent::stream () const
 void
 AudioContent::add_stream (AudioStreamPtr stream)
 {
-       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+       ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -358,7 +358,7 @@ AudioContent::add_stream (AudioStreamPtr stream)
 void
 AudioContent::set_stream (AudioStreamPtr stream)
 {
-       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+       ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
index 49a57a826e4acdcad84c1568f5c3e059d7f00657..8c7f554cb800f4ef94a4a40278463748616cc8f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016-2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
-#include "video_ring_buffers.h"
-#include "audio_ring_buffers.h"
-#include "text_ring_buffers.h"
 #include "audio_mapping.h"
+#include "audio_ring_buffers.h"
+#include "change_signaller.h"
 #include "exception_store.h"
+#include "text_ring_buffers.h"
+#include "video_ring_buffers.h"
+#include <boost/asio.hpp>
+#include <boost/signals2.hpp>
 #include <boost/thread.hpp>
 #include <boost/thread/condition.hpp>
-#include <boost/signals2.hpp>
-#include <boost/asio.hpp>
 
 class Player;
 class PlayerVideo;
index 55a5f2dc57f90b5d8307fbd882db9894d02714ae..74965fc3e316646082a0563e2b68e7cafa868261 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #ifndef DCPOMATIC_CHANGE_SIGNALLER_H
 #define DCPOMATIC_CHANGE_SIGNALLER_H
 
-#include <boost/noncopyable.hpp>
 
-template <class T>
-class ChangeSignaller : public boost::noncopyable
+enum class ChangeType
+{
+       PENDING,
+       DONE,
+       CANCELLED
+};
+
+
+template <class T, class P>
+class ChangeSignaller
 {
 public:
-       ChangeSignaller (T* t, int p)
+       ChangeSignaller (T* t, P p)
                : _thing (t)
                , _property (p)
                , _done (true)
@@ -44,6 +52,9 @@ public:
                }
        }
 
+       ChangeSignaller (ChangeSignaller const&) = delete;
+       ChangeSignaller& operator== (ChangeSignaller const&) = delete;
+
        void abort ()
        {
                _done = false;
@@ -51,8 +62,9 @@ public:
 
 private:
        T* _thing;
-       int _property;
+       P _property;
        bool _done;
 };
 
+
 #endif
index 40790bdc09ca84a82d97614c38e056c5a0f4daa2..0171563ae5d041d1fb9ee97812bd17e8b2c2bf6f 100644 (file)
@@ -229,7 +229,7 @@ Content::set_position (shared_ptr<const Film> film, DCPTime p, bool force_emit)
                audio->modify_position (film, p);
        }
 
-       ChangeSignaller<Content> cc (this, ContentProperty::POSITION);
+       ContentChangeSignaller cc (this, ContentProperty::POSITION);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -256,7 +256,7 @@ Content::set_trim_start (ContentTime t)
                audio->modify_trim_start (t);
        }
 
-       ChangeSignaller<Content> cc (this, ContentProperty::TRIM_START);
+       ContentChangeSignaller cc (this, ContentProperty::TRIM_START);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -267,7 +267,7 @@ Content::set_trim_start (ContentTime t)
 void
 Content::set_trim_end (ContentTime t)
 {
-       ChangeSignaller<Content> cc (this, ContentProperty::TRIM_END);
+       ContentChangeSignaller cc (this, ContentProperty::TRIM_END);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -338,7 +338,7 @@ Content::paths_valid () const
 void
 Content::set_paths (vector<boost::filesystem::path> paths)
 {
-       ChangeSignaller<Content> cc (this, ContentProperty::PATH);
+       ContentChangeSignaller cc (this, ContentProperty::PATH);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -389,7 +389,7 @@ Content::reel_split_points (shared_ptr<const Film>) const
 void
 Content::set_video_frame_rate (double r)
 {
-       ChangeSignaller<Content> cc (this, ContentProperty::VIDEO_FRAME_RATE);
+       ContentChangeSignaller cc (this, ContentProperty::VIDEO_FRAME_RATE);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -408,7 +408,7 @@ Content::set_video_frame_rate (double r)
 void
 Content::unset_video_frame_rate ()
 {
-       ChangeSignaller<Content> cc (this, ContentProperty::VIDEO_FRAME_RATE);
+       ContentChangeSignaller cc (this, ContentProperty::VIDEO_FRAME_RATE);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
index 8a28762d3faf10078f893a02e6a942e9d41774a6..eafadd3ecbfd6d39404c0cccdad370a4ea8ad052 100644 (file)
@@ -212,7 +212,7 @@ private:
        friend struct best_dcp_frame_rate_test_single;
        friend struct best_dcp_frame_rate_test_double;
        friend struct audio_sampling_rate_test;
-       template<class> friend class ChangeSignaller;
+       template<class, class> friend class ChangeSignaller;
 
        void signal_change (ChangeType, int);
 
@@ -232,4 +232,8 @@ private:
        bool _change_signals_frequent;
 };
 
+
+typedef ChangeSignaller<Content, int> ContentChangeSignaller;
+
+
 #endif
index a81334270edc369fa24f5b4a449ca6e180d78d28..443c356b19ab45c883adc8d01e16417cd84fc72e 100644 (file)
@@ -41,7 +41,7 @@ protected:
        void
        maybe_set (T& member, T new_value, int property) const
        {
-               ChangeSignaller<Content> cc (_parent, property);
+               ContentChangeSignaller cc (_parent, property);
                {
                        boost::mutex::scoped_lock lm (_mutex);
                        if (member == new_value) {
@@ -56,7 +56,7 @@ protected:
        void
        maybe_set (boost::optional<T>& member, T new_value, int property) const
        {
-               ChangeSignaller<Content> cc (_parent, property);
+               ContentChangeSignaller cc (_parent, property);
                {
                        boost::mutex::scoped_lock lm (_mutex);
                        if (member && member.get() == new_value) {
index 4bd718e96207212eeb1860672514ccac27b1f214..156a1a2052a28e1d6c02556e43d605a50071dc10 100644 (file)
@@ -219,10 +219,10 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
        bool const needed_kdm = needs_kdm ();
        string const old_name = name ();
 
-       ChangeSignaller<Content> cc_texts (this, DCPContentProperty::TEXTS);
-       ChangeSignaller<Content> cc_assets (this, DCPContentProperty::NEEDS_ASSETS);
-       ChangeSignaller<Content> cc_kdm (this, DCPContentProperty::NEEDS_KDM);
-       ChangeSignaller<Content> cc_name (this, DCPContentProperty::NAME);
+       ContentChangeSignaller cc_texts (this, DCPContentProperty::TEXTS);
+       ContentChangeSignaller cc_assets (this, DCPContentProperty::NEEDS_ASSETS);
+       ContentChangeSignaller cc_kdm (this, DCPContentProperty::NEEDS_KDM);
+       ContentChangeSignaller cc_name (this, DCPContentProperty::NAME);
 
        if (job) {
                job->set_progress_unknown ();
@@ -509,7 +509,7 @@ DCPContent::set_default_colour_conversion ()
 void
 DCPContent::set_reference_video (bool r)
 {
-       ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_VIDEO);
+       ContentChangeSignaller cc (this, DCPContentProperty::REFERENCE_VIDEO);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -520,7 +520,7 @@ DCPContent::set_reference_video (bool r)
 void
 DCPContent::set_reference_audio (bool r)
 {
-       ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_AUDIO);
+       ContentChangeSignaller cc (this, DCPContentProperty::REFERENCE_AUDIO);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -531,7 +531,7 @@ DCPContent::set_reference_audio (bool r)
 void
 DCPContent::set_reference_text (TextType type, bool r)
 {
-       ChangeSignaller<Content> cc (this, DCPContentProperty::REFERENCE_TEXT);
+       ContentChangeSignaller cc (this, DCPContentProperty::REFERENCE_TEXT);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -788,7 +788,7 @@ DCPContent::take_settings_from (shared_ptr<const Content> c)
 void
 DCPContent::set_cpl (string id)
 {
-       ChangeSignaller<Content> cc (this, DCPContentProperty::CPL);
+       ContentChangeSignaller cc (this, DCPContentProperty::CPL);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
index 7f1c75a936915d3ea440cd24ccb4b6c2ffde2e75..b1bb632b1496536da2f6f3a1ff96b6b5655e0561 100644 (file)
@@ -248,8 +248,8 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
 void
 FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
-       ChangeSignaller<Content> cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS);
-       ChangeSignaller<Content> cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM);
+       ContentChangeSignaller cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS);
+       ContentChangeSignaller cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM);
 
        if (job) {
                job->set_progress_unknown ();
@@ -375,7 +375,7 @@ FFmpegContent::technical_summary () const
 void
 FFmpegContent::set_subtitle_stream (shared_ptr<FFmpegSubtitleStream> s)
 {
-       ChangeSignaller<Content> cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
+       ContentChangeSignaller cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -436,7 +436,7 @@ FFmpegContent::approximate_length () const
 void
 FFmpegContent::set_filters (vector<Filter const *> const & filters)
 {
-       ChangeSignaller<Content> cc (this, FFmpegContentProperty::FILTERS);
+       ContentChangeSignaller cc (this, FFmpegContentProperty::FILTERS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -658,7 +658,7 @@ void
 FFmpegContent::signal_subtitle_stream_changed ()
 {
        /* XXX: this is too late; really it should be before the change */
-       ChangeSignaller<Content> cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
+       ContentChangeSignaller cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
 }
 
 vector<shared_ptr<FFmpegAudioStream> >
index 193dedf4cd3bc1980dfababef1def911074c6c3c..7720249021eeaa0dd5bd3265b0db72c6ffe65788 100644 (file)
@@ -1034,21 +1034,21 @@ Film::set_directory (boost::filesystem::path d)
 void
 Film::set_name (string n)
 {
-       ChangeSignaller<Film> ch (this, NAME);
+       FilmChangeSignaller ch (this, Property::NAME);
        _name = n;
 }
 
 void
 Film::set_use_isdcf_name (bool u)
 {
-       ChangeSignaller<Film> ch (this, USE_ISDCF_NAME);
+       FilmChangeSignaller ch (this, Property::USE_ISDCF_NAME);
        _use_isdcf_name = u;
 }
 
 void
 Film::set_dcp_content_type (DCPContentType const * t)
 {
-       ChangeSignaller<Film> ch (this, DCP_CONTENT_TYPE);
+       FilmChangeSignaller ch (this, Property::DCP_CONTENT_TYPE);
        _dcp_content_type = t;
 }
 
@@ -1060,7 +1060,7 @@ Film::set_dcp_content_type (DCPContentType const * t)
 void
 Film::set_container (Ratio const * c, bool explicit_user)
 {
-       ChangeSignaller<Film> ch (this, CONTAINER);
+       FilmChangeSignaller ch (this, Property::CONTAINER);
        _container = c;
 
        if (explicit_user) {
@@ -1076,7 +1076,7 @@ Film::set_container (Ratio const * c, bool explicit_user)
 void
 Film::set_resolution (Resolution r, bool explicit_user)
 {
-       ChangeSignaller<Film> ch (this, RESOLUTION);
+       FilmChangeSignaller ch (this, Property::RESOLUTION);
        _resolution = r;
 
        if (explicit_user) {
@@ -1088,14 +1088,14 @@ Film::set_resolution (Resolution r, bool explicit_user)
 void
 Film::set_j2k_bandwidth (int b)
 {
-       ChangeSignaller<Film> ch (this, J2K_BANDWIDTH);
+       FilmChangeSignaller ch (this, Property::J2K_BANDWIDTH);
        _j2k_bandwidth = b;
 }
 
 void
 Film::set_isdcf_metadata (ISDCFMetadata m)
 {
-       ChangeSignaller<Film> ch (this, ISDCF_METADATA);
+       FilmChangeSignaller ch (this, Property::ISDCF_METADATA);
        _isdcf_metadata = m;
 }
 
@@ -1106,7 +1106,7 @@ Film::set_isdcf_metadata (ISDCFMetadata m)
 void
 Film::set_video_frame_rate (int f, bool user_explicit)
 {
-       ChangeSignaller<Film> ch (this, VIDEO_FRAME_RATE);
+       FilmChangeSignaller ch (this, Property::VIDEO_FRAME_RATE);
        _video_frame_rate = f;
        if (user_explicit) {
                _user_explicit_video_frame_rate = true;
@@ -1116,18 +1116,18 @@ Film::set_video_frame_rate (int f, bool user_explicit)
 void
 Film::set_audio_channels (int c)
 {
-       ChangeSignaller<Film> ch (this, AUDIO_CHANNELS);
+       FilmChangeSignaller ch (this, Property::AUDIO_CHANNELS);
        _audio_channels = c;
 }
 
 void
 Film::set_three_d (bool t)
 {
-       ChangeSignaller<Film> ch (this, THREE_D);
+       FilmChangeSignaller ch (this, Property::THREE_D);
        _three_d = t;
 
        if (_three_d && _isdcf_metadata.two_d_version_of_three_d) {
-               ChangeSignaller<Film> ch (this, ISDCF_METADATA);
+               FilmChangeSignaller ch (this, Property::ISDCF_METADATA);
                _isdcf_metadata.two_d_version_of_three_d = false;
        }
 }
@@ -1135,22 +1135,22 @@ Film::set_three_d (bool t)
 void
 Film::set_interop (bool i)
 {
-       ChangeSignaller<Film> ch (this, INTEROP);
+       FilmChangeSignaller ch (this, Property::INTEROP);
        _interop = i;
 }
 
 void
 Film::set_audio_processor (AudioProcessor const * processor)
 {
-       ChangeSignaller<Film> ch1 (this, AUDIO_PROCESSOR);
-       ChangeSignaller<Film> ch2 (this, AUDIO_CHANNELS);
+       FilmChangeSignaller ch1 (this, Property::AUDIO_PROCESSOR);
+       FilmChangeSignaller ch2 (this, Property::AUDIO_CHANNELS);
        _audio_processor = processor;
 }
 
 void
 Film::set_reel_type (ReelType t)
 {
-       ChangeSignaller<Film> ch (this, REEL_TYPE);
+       FilmChangeSignaller ch (this, Property::REEL_TYPE);
        _reel_type = t;
 }
 
@@ -1158,14 +1158,14 @@ Film::set_reel_type (ReelType t)
 void
 Film::set_reel_length (int64_t r)
 {
-       ChangeSignaller<Film> ch (this, REEL_LENGTH);
+       FilmChangeSignaller ch (this, Property::REEL_LENGTH);
        _reel_length = r;
 }
 
 void
 Film::set_reencode_j2k (bool r)
 {
-       ChangeSignaller<Film> ch (this, REENCODE_J2K);
+       FilmChangeSignaller ch (this, Property::REENCODE_J2K);
        _reencode_j2k = r;
 }
 
@@ -1181,7 +1181,7 @@ Film::signal_change (ChangeType type, Property p)
        if (type == ChangeType::DONE) {
                _dirty = true;
 
-               if (p == Film::CONTENT) {
+               if (p == Property::CONTENT) {
                        if (!_user_explicit_video_frame_rate) {
                                set_video_frame_rate (best_video_frame_rate());
                        }
@@ -1189,7 +1189,7 @@ Film::signal_change (ChangeType type, Property p)
 
                emit (boost::bind (boost::ref (Change), type, p));
 
-               if (p == Film::VIDEO_FRAME_RATE || p == Film::SEQUENCE) {
+               if (p == Property::VIDEO_FRAME_RATE || p == Property::SEQUENCE) {
                        /* We want to call Playlist::maybe_sequence but this must happen after the
                           main signal emission (since the butler will see that emission and un-suspend itself).
                        */
@@ -1275,7 +1275,7 @@ Film::cpls () const
 void
 Film::set_encrypted (bool e)
 {
-       ChangeSignaller<Film> ch (this, ENCRYPTED);
+       FilmChangeSignaller ch (this, Property::ENCRYPTED);
        _encrypted = e;
 }
 
@@ -1444,9 +1444,9 @@ void
 Film::playlist_content_change (ChangeType type, weak_ptr<Content> c, int p, bool frequent)
 {
        if (p == ContentProperty::VIDEO_FRAME_RATE) {
-               signal_change (type, Film::CONTENT);
+               signal_change (type, Property::CONTENT);
        } else if (p == AudioContentProperty::STREAMS) {
-               signal_change (type, Film::NAME);
+               signal_change (type, Property::NAME);
        }
 
        if (type == ChangeType::DONE) {
@@ -1470,8 +1470,8 @@ Film::playlist_length_change ()
 void
 Film::playlist_change (ChangeType type)
 {
-       signal_change (type, CONTENT);
-       signal_change (type, NAME);
+       signal_change (type, Property::CONTENT);
+       signal_change (type, Property::NAME);
 
        if (type == ChangeType::DONE) {
                check_settings_consistency ();
@@ -1536,7 +1536,7 @@ void
 Film::playlist_order_changed ()
 {
        /* XXX: missing PENDING */
-       signal_change (ChangeType::DONE, CONTENT_ORDER);
+       signal_change (ChangeType::DONE, Property::CONTENT_ORDER);
 }
 
 int
@@ -1555,7 +1555,7 @@ Film::set_sequence (bool s)
                return;
        }
 
-       ChangeSignaller<Film> cc (this, SEQUENCE);
+       FilmChangeSignaller cc (this, Property::SEQUENCE);
        _sequence = s;
        _playlist->set_sequence (s);
 }
@@ -1924,14 +1924,14 @@ Film::closed_caption_tracks () const
 void
 Film::set_marker (dcp::Marker type, DCPTime time)
 {
-       ChangeSignaller<Film> ch (this, MARKERS);
+       FilmChangeSignaller ch (this, Property::MARKERS);
        _markers[type] = time;
 }
 
 void
 Film::unset_marker (dcp::Marker type)
 {
-       ChangeSignaller<Film> ch (this, MARKERS);
+       FilmChangeSignaller ch (this, Property::MARKERS);
        _markers.erase (type);
 }
 
@@ -1939,7 +1939,7 @@ Film::unset_marker (dcp::Marker type)
 void
 Film::clear_markers ()
 {
-       ChangeSignaller<Film> ch (this, MARKERS);
+       FilmChangeSignaller ch (this, Property::MARKERS);
        _markers.clear ();
 }
 
@@ -1947,14 +1947,14 @@ Film::clear_markers ()
 void
 Film::set_ratings (vector<dcp::Rating> r)
 {
-       ChangeSignaller<Film> ch (this, RATINGS);
+       FilmChangeSignaller ch (this, Property::RATINGS);
        _ratings = r;
 }
 
 void
 Film::set_content_versions (vector<string> v)
 {
-       ChangeSignaller<Film> ch (this, CONTENT_VERSIONS);
+       FilmChangeSignaller ch (this, Property::CONTENT_VERSIONS);
        _content_versions = v;
 }
 
@@ -1962,7 +1962,7 @@ Film::set_content_versions (vector<string> v)
 void
 Film::set_name_language (dcp::LanguageTag lang)
 {
-       ChangeSignaller<Film> ch (this, NAME_LANGUAGE);
+       FilmChangeSignaller ch (this, Property::NAME_LANGUAGE);
        _name_language = lang;
 }
 
@@ -1970,7 +1970,7 @@ Film::set_name_language (dcp::LanguageTag lang)
 void
 Film::set_audio_language (dcp::LanguageTag lang)
 {
-       ChangeSignaller<Film> ch (this, AUDIO_LANGUAGE);
+       FilmChangeSignaller ch (this, Property::AUDIO_LANGUAGE);
        _audio_language = lang;
 }
 
@@ -1978,7 +1978,7 @@ Film::set_audio_language (dcp::LanguageTag lang)
 void
 Film::set_release_territory (dcp::LanguageTag::RegionSubtag region)
 {
-       ChangeSignaller<Film> ch (this, RELEASE_TERRITORY);
+       FilmChangeSignaller ch (this, Property::RELEASE_TERRITORY);
        _release_territory = region;
 }
 
@@ -1986,7 +1986,7 @@ Film::set_release_territory (dcp::LanguageTag::RegionSubtag region)
 void
 Film::set_status (dcp::Status s)
 {
-       ChangeSignaller<Film> ch (this, STATUS);
+       FilmChangeSignaller ch (this, Property::STATUS);
        _status = s;
 }
 
@@ -1994,7 +1994,7 @@ Film::set_status (dcp::Status s)
 void
 Film::set_version_number (int v)
 {
-       ChangeSignaller<Film> ch (this, VERSION_NUMBER);
+       FilmChangeSignaller ch (this, Property::VERSION_NUMBER);
        _version_number = v;
 }
 
@@ -2002,7 +2002,7 @@ Film::set_version_number (int v)
 void
 Film::set_chain (string c)
 {
-       ChangeSignaller<Film> ch (this, CHAIN);
+       FilmChangeSignaller ch (this, Property::CHAIN);
        _chain = c;
 }
 
@@ -2010,7 +2010,7 @@ Film::set_chain (string c)
 void
 Film::set_distributor (string d)
 {
-       ChangeSignaller<Film> ch (this, DISTRIBUTOR);
+       FilmChangeSignaller ch (this, Property::DISTRIBUTOR);
        _distributor = d;
 }
 
@@ -2018,7 +2018,7 @@ Film::set_distributor (string d)
 void
 Film::set_luminance (dcp::Luminance l)
 {
-       ChangeSignaller<Film> ch (this, LUMINANCE);
+       FilmChangeSignaller ch (this, Property::LUMINANCE);
        _luminance = l;
 }
 
@@ -2033,7 +2033,7 @@ Film::set_subtitle_language (dcp::LanguageTag language)
 void
 Film::unset_subtitle_language ()
 {
-       ChangeSignaller<Film> ch (this, SUBTITLE_LANGUAGES);
+       FilmChangeSignaller ch (this, Property::SUBTITLE_LANGUAGES);
        _subtitle_languages.clear();
 }
 
@@ -2041,7 +2041,7 @@ Film::unset_subtitle_language ()
 void
 Film::set_subtitle_languages (vector<dcp::LanguageTag> languages)
 {
-       ChangeSignaller<Film> ch (this, SUBTITLE_LANGUAGES);
+       FilmChangeSignaller ch (this, Property::SUBTITLE_LANGUAGES);
        _subtitle_languages = languages;
 }
 
@@ -2049,7 +2049,7 @@ Film::set_subtitle_languages (vector<dcp::LanguageTag> languages)
 void
 Film::set_facility (string f)
 {
-       ChangeSignaller<Film> ch (this, FACILITY);
+       FilmChangeSignaller ch (this, Property::FACILITY);
        _facility = f;
 }
 
index 6828df21aa366cad9e7506cedad0b5925a9d2dff..c354b646c5361a1a5f356045b6bd109b90fe6475 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #ifndef DCPOMATIC_FILM_H
 #define DCPOMATIC_FILM_H
 
-#include "util.h"
-#include "types.h"
-#include "isdcf_metadata.h"
+#include "change_signaller.h"
+#include "dcp_text_track.h"
 #include "frame_rate_change.h"
+#include "isdcf_metadata.h"
 #include "signaller.h"
-#include "dcp_text_track.h"
-#include <dcp/language_tag.h>
-#include <dcp/key.h>
+#include "types.h"
+#include "util.h"
 #include <dcp/encrypted_kdm.h>
+#include <dcp/key.h>
+#include <dcp/language_tag.h>
+#include <boost/filesystem.hpp>
 #include <boost/signals2.hpp>
 #include <boost/thread.hpp>
-#include <boost/filesystem.hpp>
 #include <boost/thread/mutex.hpp>
+#include <inttypes.h>
 #include <string>
 #include <vector>
-#include <inttypes.h>
 
 namespace xmlpp {
        class Document;
@@ -201,7 +202,7 @@ public:
        /** Identifiers for the parts of our state;
            used for signalling changes.
        */
-       enum Property {
+       enum class Property {
                NONE,
                NAME,
                USE_ISDCF_NAME,
@@ -448,7 +449,7 @@ private:
        friend struct ::isdcf_name_test;
        friend struct ::recover_test_2d_encrypted;
        friend struct ::atmos_encrypted_passthrough_test;
-       template <typename> friend class ChangeSignaller;
+       template <class, class> friend class ChangeSignaller;
 
        boost::filesystem::path info_file (dcpomatic::DCPTimePeriod p) const;
 
@@ -555,4 +556,8 @@ private:
        friend struct film_metadata_test;
 };
 
+
+typedef ChangeSignaller<Film, Film::Property> FilmChangeSignaller;
+
+
 #endif
index 74e7480f518166a96666d62b8c40f7a7e21714c6..b696f04c196d9cb6c7472448dd77718c4fba768d 100644 (file)
@@ -120,7 +120,7 @@ Player::construct ()
        _playlist_content_change_connection = playlist()->ContentChange.connect (bind(&Player::playlist_content_change, this, _1, _3, _4));
        set_video_container_size (_film->frame_size ());
 
-       film_change (ChangeType::DONE, Film::AUDIO_PROCESSOR);
+       film_change (ChangeType::DONE, Film::Property::AUDIO_PROCESSOR);
 
        setup_pieces ();
        seek (DCPTime (), true);
@@ -333,9 +333,9 @@ Player::film_change (ChangeType type, Film::Property p)
           last time we were run.
        */
 
-       if (p == Film::CONTAINER) {
+       if (p == Film::Property::CONTAINER) {
                Change (type, PlayerProperty::FILM_CONTAINER, false);
-       } else if (p == Film::VIDEO_FRAME_RATE) {
+       } else if (p == Film::Property::VIDEO_FRAME_RATE) {
                /* Pieces contain a FrameRateChange which contains the DCP frame rate,
                   so we need new pieces here.
                */
@@ -343,12 +343,12 @@ Player::film_change (ChangeType type, Film::Property p)
                        setup_pieces ();
                }
                Change (type, PlayerProperty::FILM_VIDEO_FRAME_RATE, false);
-       } else if (p == Film::AUDIO_PROCESSOR) {
+       } else if (p == Film::Property::AUDIO_PROCESSOR) {
                if (type == ChangeType::DONE && _film->audio_processor ()) {
                        boost::mutex::scoped_lock lm (_mutex);
                        _audio_processor = _film->audio_processor()->clone (_film->audio_frame_rate ());
                }
-       } else if (p == Film::AUDIO_CHANNELS) {
+       } else if (p == Film::Property::AUDIO_CHANNELS) {
                if (type == ChangeType::DONE) {
                        boost::mutex::scoped_lock lm (_mutex);
                        _audio_merger.clear ();
index b49baa43056369687b51cb8b4f38d6ab5eb27068..91f39bf6b058e54324412e6c5ba670abe46d8b1f 100644 (file)
@@ -21,8 +21,9 @@
 #ifndef DCPOMATIC_PLAYLIST_H
 #define DCPOMATIC_PLAYLIST_H
 
-#include "util.h"
+#include "change_signaller.h"
 #include "frame_rate_change.h"
+#include "util.h"
 #include <libcxml/cxml.h>
 #include <boost/signals2.hpp>
 #include <boost/thread.hpp>
index 79ac42f43b25f7eb732d1925b71f37a8a016e525..0c25e56969bc462d21dbba1a58e7161ecffa3607 100644 (file)
@@ -430,7 +430,7 @@ void
 TextContent::font_changed ()
 {
        /* XXX: too late */
-       ChangeSignaller<Content> cc (_parent, TextContentProperty::FONTS);
+       ContentChangeSignaller cc (_parent, TextContentProperty::FONTS);
 }
 
 void
index 3cd8768e80f180f50fbf5e06a91467fd195aed5a..6fbad21883084da078dcc7ed09d7c78d51921922 100644 (file)
@@ -131,13 +131,6 @@ enum class ReelType
        BY_LENGTH
 };
 
-enum class ChangeType
-{
-       PENDING,
-       DONE,
-       CANCELLED
-};
-
 
 enum class VideoRange
 {
index 216ad6784b22f1df56da7f2ebea36468f4fc7953..fed28b5e40b2708b943b8ca7e1f62f501bbbd8ee 100644 (file)
@@ -284,10 +284,10 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d)
        auto const yuv = d->yuv ();
        auto const range = d->range ();
 
-       ChangeSignaller<Content> cc1 (_parent, VideoContentProperty::SIZE);
-       ChangeSignaller<Content> cc2 (_parent, VideoContentProperty::SCALE);
-       ChangeSignaller<Content> cc3 (_parent, ContentProperty::LENGTH);
-       ChangeSignaller<Content> cc4 (_parent, VideoContentProperty::RANGE);
+       ContentChangeSignaller cc1 (_parent, VideoContentProperty::SIZE);
+       ContentChangeSignaller cc2 (_parent, VideoContentProperty::SCALE);
+       ContentChangeSignaller cc3 (_parent, ContentProperty::LENGTH);
+       ContentChangeSignaller cc4 (_parent, VideoContentProperty::RANGE);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
index 539b585042bcd3a258b0f890d3666aef4ac48825..d3aae9811f68fc00e9225ededc57a1b93651ec9c 100644 (file)
@@ -404,7 +404,7 @@ public:
 
        void film_changed (ChangeType type, Film::Property property)
        {
-               if (type != ChangeType::DONE || property != Film::CONTENT) {
+               if (type != ChangeType::DONE || property != Film::Property::CONTENT) {
                        return;
                }
 
index b8c7f7b7343b23af4b08f62361d68dd6747606cd..c27d9f06137ae20b523620f122ee5d47183d73b0 100644 (file)
@@ -101,7 +101,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<Film
        wxBoxSizer* right = new wxBoxSizer (wxVERTICAL);
 
        {
-               wxStaticText* m = new StaticText (this, _("Channels"));
+               auto m = new StaticText (this, _("Channels"));
                m->SetFont (subheading_font);
                right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 16);
        }
@@ -116,7 +116,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<Film
        show_or_hide_channel_checkboxes ();
 
        {
-               wxStaticText* m = new StaticText (this, _("Type"));
+               auto m = new StaticText (this, _("Type"));
                m->SetFont (subheading_font);
                right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16);
        }
@@ -133,7 +133,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<Film
        }
 
        {
-               wxStaticText* m = new StaticText (this, _("Smoothing"));
+               auto m = new StaticText (this, _("Smoothing"));
                m->SetFont (subheading_font);
                right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16);
        }
@@ -312,13 +312,13 @@ AudioDialog::channel_clicked (wxCommandEvent& ev)
 }
 
 void
-AudioDialog::film_change (ChangeType type, int p)
+AudioDialog::film_change (ChangeType type, Film::Property p)
 {
        if (type != ChangeType::DONE) {
                return;
        }
 
-       if (p == Film::AUDIO_CHANNELS) {
+       if (p == Film::Property::AUDIO_CHANNELS) {
                auto film = _film.lock ();
                if (film) {
                        _channels = film->audio_channels ();
index a94e98e32f4d5b6161a863aa104e721650cb4495..12dd0cadf287dff0859945e12c80afdcd1cdce49 100644 (file)
@@ -41,7 +41,7 @@ public:
        void set_cursor (boost::optional<dcpomatic::DCPTime> time, boost::optional<float> db);
 
 private:
-       void film_change (ChangeType, int);
+       void film_change (ChangeType, Film::Property);
        void content_change (ChangeType, int);
        void channel_clicked (wxCommandEvent &);
        void type_clicked (wxCommandEvent &);
index f29704b548b197d5c82cf318275d2c85bd0bda26..59c9cd2a898549a5e07d71ba6ad8cb8a4ffe0bb4 100644 (file)
@@ -104,9 +104,9 @@ AudioPanel::AudioPanel (ContentPanel* p)
        _delay->wrapped()->SetRange (-1000, 1000);
 
        content_selection_changed ();
-       film_changed (Film::AUDIO_CHANNELS);
-       film_changed (Film::VIDEO_FRAME_RATE);
-       film_changed (Film::REEL_TYPE);
+       film_changed (Film::Property::AUDIO_CHANNELS);
+       film_changed (Film::Property::VIDEO_FRAME_RATE);
+       film_changed (Film::Property::REEL_TYPE);
 
        _reference->Bind             (wxEVT_CHECKBOX, boost::bind (&AudioPanel::reference_clicked, this));
        _show->Bind                  (wxEVT_BUTTON,   boost::bind (&AudioPanel::show_clicked, this));
@@ -168,16 +168,16 @@ AudioPanel::film_changed (Film::Property property)
        }
 
        switch (property) {
-       case Film::AUDIO_CHANNELS:
-       case Film::AUDIO_PROCESSOR:
+       case Film::Property::AUDIO_CHANNELS:
+       case Film::Property::AUDIO_PROCESSOR:
                _mapping->set_output_channels (_parent->film()->audio_output_names ());
                setup_peak ();
                break;
-       case Film::VIDEO_FRAME_RATE:
+       case Film::Property::VIDEO_FRAME_RATE:
                setup_description ();
                break;
-       case Film::REEL_TYPE:
-       case Film::INTEROP:
+       case Film::Property::REEL_TYPE:
+       case Film::Property::INTEROP:
                setup_sensitivity ();
                break;
        default:
index a06791d4d0766be5351a43a8f9ea4ae893a0a634..d54f3dc6b9f2e722b4ce6bb656fa87682335b95c 100644 (file)
@@ -238,8 +238,8 @@ void
 ContentPanel::film_changed (Film::Property p)
 {
        switch (p) {
-       case Film::CONTENT:
-       case Film::CONTENT_ORDER:
+       case Film::Property::CONTENT:
+       case Film::Property::CONTENT_ORDER:
                setup ();
                break;
        default:
@@ -587,8 +587,8 @@ ContentPanel::set_film (shared_ptr<Film> film)
 
        _film = film;
 
-       film_changed (Film::CONTENT);
-       film_changed (Film::AUDIO_CHANNELS);
+       film_changed (Film::Property::CONTENT);
+       film_changed (Film::Property::AUDIO_CHANNELS);
 
        if (_film) {
                check_selection ();
index 31134340054b2ed232548068ed4bcfad42caeea0..9eae77495452cda5eb181964caebc6cc7a05274b 100644 (file)
@@ -408,11 +408,11 @@ void
 Controls::film_change (ChangeType type, Film::Property p)
 {
        if (type == ChangeType::DONE) {
-               if (p == Film::CONTENT) {
+               if (p == Film::Property::CONTENT) {
                        setup_sensitivity ();
                        update_position_label ();
                        update_position_slider ();
-               } else if (p == Film::THREE_D) {
+               } else if (p == Film::Property::THREE_D) {
                        setup_sensitivity ();
                }
        }
index cf4d5d3fe4a42c865d2b1675298d0425fb210fb4..b925213ad60d186a008f40835b679e65984b20c9 100644 (file)
@@ -334,34 +334,34 @@ DCPPanel::metadata_clicked ()
 }
 
 void
-DCPPanel::film_changed (int p)
+DCPPanel::film_changed (Film::Property p)
 {
        switch (p) {
-       case Film::NONE:
+       case Film::Property::NONE:
                break;
-       case Film::CONTAINER:
+       case Film::Property::CONTAINER:
                setup_container ();
                break;
-       case Film::NAME:
+       case Film::Property::NAME:
                checked_set (_name, _film->name());
                setup_dcp_name ();
                break;
-       case Film::DCP_CONTENT_TYPE:
+       case Film::Property::DCP_CONTENT_TYPE:
                checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
                setup_dcp_name ();
                break;
-       case Film::ENCRYPTED:
+       case Film::Property::ENCRYPTED:
                checked_set (_encrypted, _film->encrypted ());
                break;
-       case Film::RESOLUTION:
+       case Film::Property::RESOLUTION:
                checked_set (_resolution, _film->resolution() == Resolution::TWO_K ? 0 : 1);
                setup_container ();
                setup_dcp_name ();
                break;
-       case Film::J2K_BANDWIDTH:
+       case Film::Property::J2K_BANDWIDTH:
                checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
                break;
-       case Film::USE_ISDCF_NAME:
+       case Film::Property::USE_ISDCF_NAME:
        {
                checked_set (_use_isdcf_name, _film->use_isdcf_name ());
                if (_film->use_isdcf_name()) {
@@ -378,11 +378,11 @@ DCPPanel::film_changed (int p)
                _edit_isdcf_button->Enable (_film->use_isdcf_name ());
                break;
        }
-       case Film::ISDCF_METADATA:
-       case Film::SUBTITLE_LANGUAGES:
+       case Film::Property::ISDCF_METADATA:
+       case Film::Property::SUBTITLE_LANGUAGES:
                setup_dcp_name ();
                break;
-       case Film::VIDEO_FRAME_RATE:
+       case Film::Property::VIDEO_FRAME_RATE:
        {
                bool done = false;
                for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
@@ -403,7 +403,7 @@ DCPPanel::film_changed (int p)
                setup_dcp_name ();
                break;
        }
-       case Film::AUDIO_CHANNELS:
+       case Film::Property::AUDIO_CHANNELS:
                if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
                        _film->set_audio_channels (minimum_allowed_audio_channels ());
                } else {
@@ -411,35 +411,35 @@ DCPPanel::film_changed (int p)
                        setup_dcp_name ();
                }
                break;
-       case Film::THREE_D:
+       case Film::Property::THREE_D:
                checked_set (_three_d, _film->three_d ());
                setup_dcp_name ();
                break;
-       case Film::REENCODE_J2K:
+       case Film::Property::REENCODE_J2K:
                checked_set (_reencode_j2k, _film->reencode_j2k());
                break;
-       case Film::INTEROP:
+       case Film::Property::INTEROP:
                checked_set (_standard, _film->interop() ? 1 : 0);
                setup_dcp_name ();
                _markers->Enable (!_film->interop());
                break;
-       case Film::AUDIO_PROCESSOR:
+       case Film::Property::AUDIO_PROCESSOR:
                if (_film->audio_processor ()) {
                        checked_set (_audio_processor, _film->audio_processor()->id());
                } else {
                        checked_set (_audio_processor, 0);
                }
                setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
-               film_changed (Film::AUDIO_CHANNELS);
+               film_changed (Film::Property::AUDIO_CHANNELS);
                break;
-       case Film::REEL_TYPE:
+       case Film::Property::REEL_TYPE:
                checked_set (_reel_type, static_cast<int>(_film->reel_type()));
                _reel_length->Enable (_film->reel_type() == ReelType::BY_LENGTH);
                break;
-       case Film::REEL_LENGTH:
+       case Film::Property::REEL_LENGTH:
                checked_set (_reel_length, _film->reel_length() / 1000000000LL);
                break;
-       case Film::CONTENT:
+       case Film::Property::CONTENT:
                setup_dcp_name ();
                setup_sensitivity ();
                break;
@@ -547,24 +547,24 @@ DCPPanel::set_film (shared_ptr<Film> film)
                return;
        }
 
-       film_changed (Film::NAME);
-       film_changed (Film::USE_ISDCF_NAME);
-       film_changed (Film::CONTENT);
-       film_changed (Film::DCP_CONTENT_TYPE);
-       film_changed (Film::CONTAINER);
-       film_changed (Film::RESOLUTION);
-       film_changed (Film::ENCRYPTED);
-       film_changed (Film::J2K_BANDWIDTH);
-       film_changed (Film::ISDCF_METADATA);
-       film_changed (Film::VIDEO_FRAME_RATE);
-       film_changed (Film::AUDIO_CHANNELS);
-       film_changed (Film::SEQUENCE);
-       film_changed (Film::THREE_D);
-       film_changed (Film::INTEROP);
-       film_changed (Film::AUDIO_PROCESSOR);
-       film_changed (Film::REEL_TYPE);
-       film_changed (Film::REEL_LENGTH);
-       film_changed (Film::REENCODE_J2K);
+       film_changed (Film::Property::NAME);
+       film_changed (Film::Property::USE_ISDCF_NAME);
+       film_changed (Film::Property::CONTENT);
+       film_changed (Film::Property::DCP_CONTENT_TYPE);
+       film_changed (Film::Property::CONTAINER);
+       film_changed (Film::Property::RESOLUTION);
+       film_changed (Film::Property::ENCRYPTED);
+       film_changed (Film::Property::J2K_BANDWIDTH);
+       film_changed (Film::Property::ISDCF_METADATA);
+       film_changed (Film::Property::VIDEO_FRAME_RATE);
+       film_changed (Film::Property::AUDIO_CHANNELS);
+       film_changed (Film::Property::SEQUENCE);
+       film_changed (Film::Property::THREE_D);
+       film_changed (Film::Property::INTEROP);
+       film_changed (Film::Property::AUDIO_PROCESSOR);
+       film_changed (Film::Property::REEL_TYPE);
+       film_changed (Film::Property::REEL_LENGTH);
+       film_changed (Film::Property::REENCODE_J2K);
 
        set_general_sensitivity(static_cast<bool>(_film));
 }
@@ -687,7 +687,7 @@ DCPPanel::config_changed (Config::Property p)
                _audio_processor->Clear ();
                add_audio_processors ();
                if (_film) {
-                       film_changed (Film::AUDIO_PROCESSOR);
+                       film_changed (Film::Property::AUDIO_PROCESSOR);
                }
        }
 }
index cce97a2dc314ee9b743fb3386a9721c43d45ede0..9b362a26cd540118a433e2860dc9f64ef3649458 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "lib/config.h"
-#include <boost/noncopyable.hpp>
+#include "lib/film.h"
+
 
 class wxNotebook;
 class wxPanel;
@@ -41,15 +43,18 @@ class Film;
 class FilmViewer;
 class Ratio;
 
-class DCPPanel : public boost::noncopyable
+class DCPPanel
 {
 public:
        DCPPanel (wxNotebook *, std::shared_ptr<Film>, std::weak_ptr<FilmViewer> viewer);
 
+       DCPPanel (DCPPanel const&) = delete;
+       DCPPanel& operator= (DCPPanel const&) = delete;
+
        void set_film (std::shared_ptr<Film>);
        void set_general_sensitivity (bool);
 
-       void film_changed (int);
+       void film_changed (Film::Property);
        void film_content_changed (int);
 
        wxPanel* panel () const {
index 47a6358cca9677e3f35d9cf3a48ac7caaef80b73..767676fff100c76260fbd6ac083f446dd9d94e16 100644 (file)
@@ -86,7 +86,7 @@ FilmEditor::film_change (ChangeType type, Film::Property p)
        _content_panel->film_changed (p);
        _dcp_panel->film_changed (p);
 
-       if (p == Film::CONTENT && !_film->content().empty ()) {
+       if (p == Film::Property::CONTENT && !_film->content().empty()) {
                /* Select newly-added content */
                _content_panel->set_selection (_film->content().back ());
        }
index f3155323974bfd7ee9191caeeb3109f1fe0098bd..bfacbdfe1667179fc64b95103899aa64f0488c03 100644 (file)
@@ -184,8 +184,8 @@ FilmViewer::set_film (shared_ptr<Film> film)
        _film->LengthChange.connect (boost::bind(&FilmViewer::film_length_change, this));
        _player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
 
-       film_change (ChangeType::DONE, Film::VIDEO_FRAME_RATE);
-       film_change (ChangeType::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 */
@@ -411,13 +411,13 @@ FilmViewer::film_change (ChangeType type, Film::Property p)
                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);
        }
 }
index 4c4449a26ba6ff0c66a82a24621f383da8f57224..9124d5c13e9e7fc9d95ab73d3d61bde698ab8889 100644 (file)
 
 */
 
-#include "lib/types.h"
+
+#include "lib/change_signaller.h"
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/wx.h>
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/signals2.hpp>
 
+
 class wxRichTextCtrl;
 class Film;
 class Hints;
index b8a1184e0839bca02df4b35342315a8bbc9168b4..64afcac5c2240e6548b6c1a7da08c3042ed69219 100644 (file)
@@ -244,16 +244,16 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr<Film> weak_
 
        _film_changed_connection = film()->Change.connect(boost::bind(&SMPTEMetadataDialog::film_changed, this, _1, _2));
 
-       film_changed (ChangeType::DONE, Film::NAME_LANGUAGE);
-       film_changed (ChangeType::DONE, Film::RELEASE_TERRITORY);
-       film_changed (ChangeType::DONE, Film::VERSION_NUMBER);
-       film_changed (ChangeType::DONE, Film::STATUS);
-       film_changed (ChangeType::DONE, Film::CHAIN);
-       film_changed (ChangeType::DONE, Film::DISTRIBUTOR);
-       film_changed (ChangeType::DONE, Film::FACILITY);
-       film_changed (ChangeType::DONE, Film::CONTENT_VERSIONS);
-       film_changed (ChangeType::DONE, Film::LUMINANCE);
-       film_changed (ChangeType::DONE, Film::SUBTITLE_LANGUAGES);
+       film_changed (ChangeType::DONE, Film::Property::NAME_LANGUAGE);
+       film_changed (ChangeType::DONE, Film::Property::RELEASE_TERRITORY);
+       film_changed (ChangeType::DONE, Film::Property::VERSION_NUMBER);
+       film_changed (ChangeType::DONE, Film::Property::STATUS);
+       film_changed (ChangeType::DONE, Film::Property::CHAIN);
+       film_changed (ChangeType::DONE, Film::Property::DISTRIBUTOR);
+       film_changed (ChangeType::DONE, Film::Property::FACILITY);
+       film_changed (ChangeType::DONE, Film::Property::CONTENT_VERSIONS);
+       film_changed (ChangeType::DONE, Film::Property::LUMINANCE);
+       film_changed (ChangeType::DONE, Film::Property::SUBTITLE_LANGUAGES);
 
        setup_sensitivity ();
 }
@@ -266,13 +266,13 @@ SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
                return;
        }
 
-       if (property == Film::NAME_LANGUAGE) {
+       if (property == Film::Property::NAME_LANGUAGE) {
                _name_language->set (film()->name_language());
-       } else if (property == Film::RELEASE_TERRITORY) {
+       } else if (property == Film::Property::RELEASE_TERRITORY) {
                checked_set (_release_territory, std_to_wx(*dcp::LanguageTag::get_subtag_description(dcp::LanguageTag::SubtagType::REGION, film()->release_territory().subtag())));
-       } else if (property == Film::VERSION_NUMBER) {
+       } else if (property == Film::Property::VERSION_NUMBER) {
                checked_set (_version_number, film()->version_number());
-       } else if (property == Film::STATUS) {
+       } else if (property == Film::Property::STATUS) {
                switch (film()->status()) {
                case dcp::Status::TEMP:
                        checked_set (_status, 0);
@@ -284,13 +284,13 @@ SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
                        checked_set (_status, 2);
                        break;
                }
-       } else if (property == Film::CHAIN) {
+       } else if (property == Film::Property::CHAIN) {
                checked_set (_chain, film()->chain());
-       } else if (property == Film::DISTRIBUTOR) {
+       } else if (property == Film::Property::DISTRIBUTOR) {
                checked_set (_distributor, film()->distributor());
-       } else if (property == Film::FACILITY) {
+       } else if (property == Film::Property::FACILITY) {
                checked_set (_facility, film()->facility());
-       } else if (property == Film::LUMINANCE) {
+       } else if (property == Film::Property::LUMINANCE) {
                checked_set (_luminance_value, film()->luminance().value());
                switch (film()->luminance().unit()) {
                case dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE:
@@ -300,7 +300,7 @@ SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
                        checked_set (_luminance_unit, 1);
                        break;
                }
-       } else if (property == Film::SUBTITLE_LANGUAGES) {
+       } else if (property == Film::Property::SUBTITLE_LANGUAGES) {
                vector<dcp::LanguageTag> languages = film()->subtitle_languages();
                checked_set (_enable_main_subtitle_language, !languages.empty());
                if (!languages.empty()) {
@@ -357,11 +357,11 @@ SMPTEMetadataDialog::audio_language_changed (dcp::LanguageTag tag)
 void
 SMPTEMetadataDialog::edit_release_territory ()
 {
-       RegionSubtagDialog* d = new RegionSubtagDialog(this, film()->release_territory());
+       auto d = new RegionSubtagDialog(this, film()->release_territory());
        d->ShowModal ();
-       optional<dcp::LanguageTag::RegionSubtag> tag = d->get();
+       auto tag = d->get();
        if (tag) {
-               film()->set_release_territory (*tag);
+               film()->set_release_territory(*tag);
        }
        d->Destroy ();
 }
index 299b3c70a1c082d087171cf68f88a6d5d56449a8..daaccf08f86aa4251429ac318d89bf9e66c99cc4 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "timecode.h"
+#include "lib/change_signaller.h"
 #include "lib/rgba.h"
 #include "lib/warnings.h"
 DCPOMATIC_DISABLE_WARNINGS
index dec58f0cd1fc87b3a5ba49b4bd9ce983864b7622..0a35e649704e9484244ac944cd2ec8b748e9f594 100644 (file)
@@ -360,7 +360,7 @@ TextPanel::dcp_track_changed ()
 void
 TextPanel::film_changed (Film::Property property)
 {
-       if (property == Film::CONTENT || property == Film::REEL_TYPE || property == Film::INTEROP) {
+       if (property == Film::Property::CONTENT || property == Film::Property::REEL_TYPE || property == Film::Property::INTEROP) {
                setup_sensitivity ();
        }
 }
index 89f2239569edea9cf9e8b79f325381e119ec460b..60200d8bb7edc81ce5977221029429e122047cfd 100644 (file)
@@ -112,7 +112,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film, w
        _main_canvas->Bind   (wxEVT_SCROLLWIN_PAGEDOWN,   boost::bind (&Timeline::scrolled,     this, _1));
        _main_canvas->Bind   (wxEVT_SCROLLWIN_THUMBTRACK, boost::bind (&Timeline::scrolled,     this, _1));
 
-       film_change (ChangeType::DONE, Film::CONTENT);
+       film_change (ChangeType::DONE, Film::Property::CONTENT);
 
        SetMinSize (wxSize (640, 4 * pixels_per_track() + 96));
 
@@ -231,10 +231,10 @@ Timeline::film_change (ChangeType type, Film::Property p)
                return;
        }
 
-       if (p == Film::CONTENT || p == Film::REEL_TYPE || p == Film::REEL_LENGTH) {
+       if (p == Film::Property::CONTENT || p == Film::Property::REEL_TYPE || p == Film::Property::REEL_LENGTH) {
                ensure_ui_thread ();
                recreate_views ();
-       } else if (p == Film::CONTENT_ORDER) {
+       } else if (p == Film::Property::CONTENT_ORDER) {
                Refresh ();
        }
 }
index bb84d6147fe50e1b22f4a74145e3eac80c73257a..677b83bdde27a4dc7cd5176cb92cfcbf2fdc5fa9 100644 (file)
@@ -34,7 +34,6 @@ using namespace boost::placeholders;
 TimelineContentView::TimelineContentView (Timeline& tl, shared_ptr<Content> c)
        : TimelineView (tl)
        , _content (c)
-       , _selected (false)
 {
        _content_connection = c->Change.connect (bind (&TimelineContentView::content_change, this, _1, _3));
 }
index fcc0680647734c7dc80ca906b42e2eb0ef324266..e9b29485473b7eb64349c4548e4f0b5fa423e1cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -21,6 +21,7 @@
 #ifndef DCPOMATIC_TIMELINE_CONTENT_VIEW_H
 #define DCPOMATIC_TIMELINE_CONTENT_VIEW_H
 
+#include "lib/change_signaller.h"
 #include "lib/types.h"
 #include "lib/warnings.h"
 #include "timeline_view.h"
@@ -64,7 +65,7 @@ private:
        void content_change (ChangeType type, int p);
 
        boost::optional<int> _track;
-       bool _selected;
+       bool _selected = false;
 
        boost::signals2::scoped_connection _content_connection;
 };
index f15bf7bfc254f712d37968ce280f2b97f916edb5..77acb9758e9960dd49709f03b7872673d4e7481c 100644 (file)
@@ -91,7 +91,7 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film, weak_pt
        sizer->SetSizeHints (this);
 
         _toolbar->ToggleTool ((int) Timeline::SNAP, _timeline.snap ());
-       film_change (ChangeType::DONE, Film::SEQUENCE);
+       film_change (ChangeType::DONE, Film::Property::SEQUENCE);
 
        _film_changed_connection = film->Change.connect (bind (&TimelineDialog::film_change, this, _1, _2));
 }
@@ -108,7 +108,7 @@ TimelineDialog::film_change (ChangeType type, Film::Property p)
                return;
        }
 
-       if (p == Film::SEQUENCE) {
+       if (p == Film::Property::SEQUENCE) {
                _toolbar->ToggleTool ((int) Timeline::SEQUENCE, film->sequence ());
        }
 }
index ecf55640dc3f7cd5655ea482cfe639c4920293c1..f251e3c93679fbe45bbcbb07ab30b303caa8e9be 100644 (file)
@@ -425,7 +425,7 @@ TimingPanel::content_selection_changed ()
 void
 TimingPanel::film_changed (Film::Property p)
 {
-       if (p == Film::VIDEO_FRAME_RATE) {
+       if (p == Film::Property::VIDEO_FRAME_RATE) {
                update_full_length ();
                update_play_length ();
        }
index b9c09cc69672007c6d76c7117a01ad817ee8d466..6cb3bfc87680ca3f98f08d05a1bac1c758dd6b72 100644 (file)
@@ -326,14 +326,14 @@ void
 VideoPanel::film_changed (Film::Property property)
 {
        switch (property) {
-       case Film::VIDEO_FRAME_RATE:
-       case Film::CONTAINER:
-       case Film::RESOLUTION:
+       case Film::Property::VIDEO_FRAME_RATE:
+       case Film::Property::CONTAINER:
+       case Film::Property::RESOLUTION:
                setup_description ();
                setup_sensitivity ();
                break;
-       case Film::REEL_TYPE:
-       case Film::INTEROP:
+       case Film::Property::REEL_TYPE:
+       case Film::Property::INTEROP:
                setup_sensitivity ();
                break;
        default: