From e0255a64d22440d718e5512f34a4f21f0d37a21b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 31 Jan 2021 23:47:14 +0100 Subject: [PATCH] Use enum class for Film::Property. --- src/lib/audio_content.cc | 8 +-- src/lib/butler.h | 13 ++--- src/lib/change_signaller.h | 24 ++++++--- src/lib/content.cc | 12 ++--- src/lib/content.h | 6 ++- src/lib/content_part.h | 4 +- src/lib/dcp_content.cc | 16 +++--- src/lib/ffmpeg_content.cc | 10 ++-- src/lib/film.cc | 84 ++++++++++++++--------------- src/lib/film.h | 27 ++++++---- src/lib/player.cc | 10 ++-- src/lib/playlist.h | 3 +- src/lib/text_content.cc | 2 +- src/lib/types.h | 7 --- src/lib/video_content.cc | 8 +-- src/tools/dcpomatic_player.cc | 2 +- src/wx/audio_dialog.cc | 10 ++-- src/wx/audio_dialog.h | 2 +- src/wx/audio_panel.cc | 16 +++--- src/wx/content_panel.cc | 8 +-- src/wx/controls.cc | 4 +- src/wx/dcp_panel.cc | 80 +++++++++++++-------------- src/wx/dcp_panel.h | 13 +++-- src/wx/film_editor.cc | 2 +- src/wx/film_viewer.cc | 12 ++--- src/wx/hints_dialog.h | 4 +- src/wx/smpte_metadata_dialog.cc | 44 +++++++-------- src/wx/subtitle_appearance_dialog.h | 1 + src/wx/text_panel.cc | 2 +- src/wx/timeline.cc | 6 +-- src/wx/timeline_content_view.cc | 1 - src/wx/timeline_content_view.h | 5 +- src/wx/timeline_dialog.cc | 4 +- src/wx/timing_panel.cc | 2 +- src/wx/video_panel.cc | 10 ++-- 35 files changed, 243 insertions(+), 219 deletions(-) diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index c70afcda4..4f5fd8748 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -146,7 +146,7 @@ AudioContent::technical_summary () const void AudioContent::set_mapping (AudioMapping mapping) { - ChangeSignaller 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 film, list& p void AudioContent::set_streams (vector streams) { - ChangeSignaller 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 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 cc (_parent, AudioContentProperty::STREAMS); + ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS); { boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/butler.h b/src/lib/butler.h index 49a57a826..8c7f554cb 100644 --- a/src/lib/butler.h +++ b/src/lib/butler.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016-2017 Carl Hetherington + Copyright (C) 2016-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,15 +18,16 @@ */ -#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 +#include #include #include -#include -#include class Player; class PlayerVideo; diff --git a/src/lib/change_signaller.h b/src/lib/change_signaller.h index 55a5f2dc5..74965fc3e 100644 --- a/src/lib/change_signaller.h +++ b/src/lib/change_signaller.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,16 +18,24 @@ */ + #ifndef DCPOMATIC_CHANGE_SIGNALLER_H #define DCPOMATIC_CHANGE_SIGNALLER_H -#include -template -class ChangeSignaller : public boost::noncopyable +enum class ChangeType +{ + PENDING, + DONE, + CANCELLED +}; + + +template +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 diff --git a/src/lib/content.cc b/src/lib/content.cc index 40790bdc0..0171563ae 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -229,7 +229,7 @@ Content::set_position (shared_ptr film, DCPTime p, bool force_emit) audio->modify_position (film, p); } - ChangeSignaller 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 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 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 paths) { - ChangeSignaller 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 void Content::set_video_frame_rate (double r) { - ChangeSignaller 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 cc (this, ContentProperty::VIDEO_FRAME_RATE); + ContentChangeSignaller cc (this, ContentProperty::VIDEO_FRAME_RATE); { boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/content.h b/src/lib/content.h index 8a28762d3..eafadd3ec 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -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 friend class ChangeSignaller; + template friend class ChangeSignaller; void signal_change (ChangeType, int); @@ -232,4 +232,8 @@ private: bool _change_signals_frequent; }; + +typedef ChangeSignaller ContentChangeSignaller; + + #endif diff --git a/src/lib/content_part.h b/src/lib/content_part.h index a81334270..443c356b1 100644 --- a/src/lib/content_part.h +++ b/src/lib/content_part.h @@ -41,7 +41,7 @@ protected: void maybe_set (T& member, T new_value, int property) const { - ChangeSignaller 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& member, T new_value, int property) const { - ChangeSignaller cc (_parent, property); + ContentChangeSignaller cc (_parent, property); { boost::mutex::scoped_lock lm (_mutex); if (member && member.get() == new_value) { diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 4bd718e96..156a1a205 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -219,10 +219,10 @@ DCPContent::examine (shared_ptr film, shared_ptr job) bool const needed_kdm = needs_kdm (); string const old_name = name (); - ChangeSignaller cc_texts (this, DCPContentProperty::TEXTS); - ChangeSignaller cc_assets (this, DCPContentProperty::NEEDS_ASSETS); - ChangeSignaller cc_kdm (this, DCPContentProperty::NEEDS_KDM); - ChangeSignaller 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 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 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 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 c) void DCPContent::set_cpl (string id) { - ChangeSignaller cc (this, DCPContentProperty::CPL); + ContentChangeSignaller cc (this, DCPContentProperty::CPL); { boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 7f1c75a93..b1bb632b1 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -248,8 +248,8 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const void FFmpegContent::examine (shared_ptr film, shared_ptr job) { - ChangeSignaller cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS); - ChangeSignaller 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 s) { - ChangeSignaller 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 const & filters) { - ChangeSignaller 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 cc (this, FFmpegContentProperty::SUBTITLE_STREAM); + ContentChangeSignaller cc (this, FFmpegContentProperty::SUBTITLE_STREAM); } vector > diff --git a/src/lib/film.cc b/src/lib/film.cc index 193dedf4c..772024902 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1034,21 +1034,21 @@ Film::set_directory (boost::filesystem::path d) void Film::set_name (string n) { - ChangeSignaller ch (this, NAME); + FilmChangeSignaller ch (this, Property::NAME); _name = n; } void Film::set_use_isdcf_name (bool u) { - ChangeSignaller 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 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 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 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 ch (this, J2K_BANDWIDTH); + FilmChangeSignaller ch (this, Property::J2K_BANDWIDTH); _j2k_bandwidth = b; } void Film::set_isdcf_metadata (ISDCFMetadata m) { - ChangeSignaller 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 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 ch (this, AUDIO_CHANNELS); + FilmChangeSignaller ch (this, Property::AUDIO_CHANNELS); _audio_channels = c; } void Film::set_three_d (bool t) { - ChangeSignaller 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 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 ch (this, INTEROP); + FilmChangeSignaller ch (this, Property::INTEROP); _interop = i; } void Film::set_audio_processor (AudioProcessor const * processor) { - ChangeSignaller ch1 (this, AUDIO_PROCESSOR); - ChangeSignaller 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 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 ch (this, REEL_LENGTH); + FilmChangeSignaller ch (this, Property::REEL_LENGTH); _reel_length = r; } void Film::set_reencode_j2k (bool r) { - ChangeSignaller 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 ch (this, ENCRYPTED); + FilmChangeSignaller ch (this, Property::ENCRYPTED); _encrypted = e; } @@ -1444,9 +1444,9 @@ void Film::playlist_content_change (ChangeType type, weak_ptr 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 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 ch (this, MARKERS); + FilmChangeSignaller ch (this, Property::MARKERS); _markers[type] = time; } void Film::unset_marker (dcp::Marker type) { - ChangeSignaller 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 ch (this, MARKERS); + FilmChangeSignaller ch (this, Property::MARKERS); _markers.clear (); } @@ -1947,14 +1947,14 @@ Film::clear_markers () void Film::set_ratings (vector r) { - ChangeSignaller ch (this, RATINGS); + FilmChangeSignaller ch (this, Property::RATINGS); _ratings = r; } void Film::set_content_versions (vector v) { - ChangeSignaller ch (this, CONTENT_VERSIONS); + FilmChangeSignaller ch (this, Property::CONTENT_VERSIONS); _content_versions = v; } @@ -1962,7 +1962,7 @@ Film::set_content_versions (vector v) void Film::set_name_language (dcp::LanguageTag lang) { - ChangeSignaller 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 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 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 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 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 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 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 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 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 languages) { - ChangeSignaller ch (this, SUBTITLE_LANGUAGES); + FilmChangeSignaller ch (this, Property::SUBTITLE_LANGUAGES); _subtitle_languages = languages; } @@ -2049,7 +2049,7 @@ Film::set_subtitle_languages (vector languages) void Film::set_facility (string f) { - ChangeSignaller ch (this, FACILITY); + FilmChangeSignaller ch (this, Property::FACILITY); _facility = f; } diff --git a/src/lib/film.h b/src/lib/film.h index 6828df21a..c354b646c 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2020 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -26,22 +26,23 @@ #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 -#include +#include "types.h" +#include "util.h" #include +#include +#include +#include #include #include -#include #include +#include #include #include -#include 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 friend class ChangeSignaller; + template friend class ChangeSignaller; boost::filesystem::path info_file (dcpomatic::DCPTimePeriod p) const; @@ -555,4 +556,8 @@ private: friend struct film_metadata_test; }; + +typedef ChangeSignaller FilmChangeSignaller; + + #endif diff --git a/src/lib/player.cc b/src/lib/player.cc index 74e7480f5..b696f04c1 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -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 (); diff --git a/src/lib/playlist.h b/src/lib/playlist.h index b49baa430..91f39bf6b 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -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 #include #include diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc index 79ac42f43..0c25e5696 100644 --- a/src/lib/text_content.cc +++ b/src/lib/text_content.cc @@ -430,7 +430,7 @@ void TextContent::font_changed () { /* XXX: too late */ - ChangeSignaller cc (_parent, TextContentProperty::FONTS); + ContentChangeSignaller cc (_parent, TextContentProperty::FONTS); } void diff --git a/src/lib/types.h b/src/lib/types.h index 3cd8768e8..6fbad2188 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -131,13 +131,6 @@ enum class ReelType BY_LENGTH }; -enum class ChangeType -{ - PENDING, - DONE, - CANCELLED -}; - enum class VideoRange { diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 216ad6784..fed28b5e4 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -284,10 +284,10 @@ VideoContent::take_from_examiner (shared_ptr d) auto const yuv = d->yuv (); auto const range = d->range (); - ChangeSignaller cc1 (_parent, VideoContentProperty::SIZE); - ChangeSignaller cc2 (_parent, VideoContentProperty::SCALE); - ChangeSignaller cc3 (_parent, ContentProperty::LENGTH); - ChangeSignaller 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); diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 539b58504..d3aae9811 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -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; } diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index b8c7f7b73..c27d9f061 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -101,7 +101,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, weak_ptrSetFont (subheading_font); right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 16); } @@ -116,7 +116,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, weak_ptrSetFont (subheading_font); right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16); } @@ -133,7 +133,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, weak_ptrSetFont (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 (); diff --git a/src/wx/audio_dialog.h b/src/wx/audio_dialog.h index a94e98e32..12dd0cadf 100644 --- a/src/wx/audio_dialog.h +++ b/src/wx/audio_dialog.h @@ -41,7 +41,7 @@ public: void set_cursor (boost::optional time, boost::optional 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 &); diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index f29704b54..59c9cd2a8 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -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: diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index a06791d4d..d54f3dc6b 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -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_changed (Film::CONTENT); - film_changed (Film::AUDIO_CHANNELS); + film_changed (Film::Property::CONTENT); + film_changed (Film::Property::AUDIO_CHANNELS); if (_film) { check_selection (); diff --git a/src/wx/controls.cc b/src/wx/controls.cc index 311343400..9eae77495 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -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 (); } } diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index cf4d5d3fe..b925213ad 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -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(_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) 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(_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); } } } diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h index cce97a2dc..9b362a26c 100644 --- a/src/wx/dcp_panel.h +++ b/src/wx/dcp_panel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2019 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,8 +18,10 @@ */ + #include "lib/config.h" -#include +#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, std::weak_ptr viewer); + DCPPanel (DCPPanel const&) = delete; + DCPPanel& operator= (DCPPanel const&) = delete; + void set_film (std::shared_ptr); void set_general_sensitivity (bool); - void film_changed (int); + void film_changed (Film::Property); void film_content_changed (int); wxPanel* panel () const { diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 47a6358cc..767676fff 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -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 ()); } diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index f31553239..bfacbdfe1 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -184,8 +184,8 @@ FilmViewer::set_film (shared_ptr 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); } } diff --git a/src/wx/hints_dialog.h b/src/wx/hints_dialog.h index 4c4449a26..9124d5c13 100644 --- a/src/wx/hints_dialog.h +++ b/src/wx/hints_dialog.h @@ -18,13 +18,15 @@ */ -#include "lib/types.h" + +#include "lib/change_signaller.h" #include "lib/warnings.h" DCPOMATIC_DISABLE_WARNINGS #include DCPOMATIC_ENABLE_WARNINGS #include + class wxRichTextCtrl; class Film; class Hints; diff --git a/src/wx/smpte_metadata_dialog.cc b/src/wx/smpte_metadata_dialog.cc index b8a1184e0..64afcac5c 100644 --- a/src/wx/smpte_metadata_dialog.cc +++ b/src/wx/smpte_metadata_dialog.cc @@ -244,16 +244,16 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr 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 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 tag = d->get(); + auto tag = d->get(); if (tag) { - film()->set_release_territory (*tag); + film()->set_release_territory(*tag); } d->Destroy (); } diff --git a/src/wx/subtitle_appearance_dialog.h b/src/wx/subtitle_appearance_dialog.h index 299b3c70a..daaccf08f 100644 --- a/src/wx/subtitle_appearance_dialog.h +++ b/src/wx/subtitle_appearance_dialog.h @@ -19,6 +19,7 @@ */ #include "timecode.h" +#include "lib/change_signaller.h" #include "lib/rgba.h" #include "lib/warnings.h" DCPOMATIC_DISABLE_WARNINGS diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index dec58f0cd..0a35e6497 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -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 (); } } diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 89f223956..60200d8bb 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -112,7 +112,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr 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 (); } } diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index bb84d6147..677b83bdd 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -34,7 +34,6 @@ using namespace boost::placeholders; TimelineContentView::TimelineContentView (Timeline& tl, shared_ptr c) : TimelineView (tl) , _content (c) - , _selected (false) { _content_connection = c->Change.connect (bind (&TimelineContentView::content_change, this, _1, _3)); } diff --git a/src/wx/timeline_content_view.h b/src/wx/timeline_content_view.h index fcc068064..e9b294854 100644 --- a/src/wx/timeline_content_view.h +++ b/src/wx/timeline_content_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington + Copyright (C) 2013-2021 Carl Hetherington 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 _track; - bool _selected; + bool _selected = false; boost::signals2::scoped_connection _content_connection; }; diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc index f15bf7bfc..77acb9758 100644 --- a/src/wx/timeline_dialog.cc +++ b/src/wx/timeline_dialog.cc @@ -91,7 +91,7 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr 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 ()); } } diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index ecf55640d..f251e3c93 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -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 (); } diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index b9c09cc69..6cb3bfc87 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -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: -- 2.30.2