Rename subtitle_use -> use_subtitles.
authorCarl Hetherington <cth@carlh.net>
Fri, 11 Jul 2014 10:16:01 +0000 (11:16 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 11 Jul 2014 10:16:01 +0000 (11:16 +0100)
src/lib/ffmpeg_content.cc
src/lib/player.cc
src/lib/subtitle_content.cc
src/lib/subtitle_content.h
src/wx/film_editor.cc
src/wx/subtitle_panel.cc
test/burnt_subtitle_test.cc
test/xml_subtitle_test.cc

index 9b2bfc60649c6b9e58b11905ed3216063e6148df..e14d1bd6bf784454639d1e73408c5bf5a7208a68 100644 (file)
@@ -110,7 +110,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> f, vector<boost::shared_ptr
 
        for (size_t i = 0; i < c.size(); ++i) {
                shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c[i]);
-               if (fc->subtitle_use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) {
+               if (fc->use_subtitles() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) {
                        throw JoinError (_("Content to be joined must use the same subtitle stream."));
                }
 
index 9e14b65b301aa1c2c20f77950a9a893c65a1f5cb..c8ac591a7b2919a36a6f77080dad538417c08982 100644 (file)
@@ -196,7 +196,7 @@ Player::content_changed (weak_ptr<Content> w, int property, bool frequent)
                Changed (frequent);
 
        } else if (
-               property == SubtitleContentProperty::SUBTITLE_USE ||
+               property == SubtitleContentProperty::USE_SUBTITLES ||
                property == SubtitleContentProperty::SUBTITLE_X_OFFSET ||
                property == SubtitleContentProperty::SUBTITLE_Y_OFFSET ||
                property == SubtitleContentProperty::SUBTITLE_SCALE ||
@@ -539,7 +539,7 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting)
 
        for (list<shared_ptr<Piece> >::const_iterator j = subs.begin(); j != subs.end(); ++j) {
                shared_ptr<SubtitleContent> subtitle_content = dynamic_pointer_cast<SubtitleContent> ((*j)->content);
-               if (!subtitle_content->subtitle_use ()) {
+               if (!subtitle_content->use_subtitles ()) {
                        continue;
                }
 
index 8c94a94b995f7f35798dc3ec06f1a02a090890a4..3415ae613f5aee8175e122a9dea0d0517b791cf1 100644 (file)
@@ -36,11 +36,11 @@ using dcp::raw_convert;
 int const SubtitleContentProperty::SUBTITLE_X_OFFSET = 500;
 int const SubtitleContentProperty::SUBTITLE_Y_OFFSET = 501;
 int const SubtitleContentProperty::SUBTITLE_SCALE = 502;
-int const SubtitleContentProperty::SUBTITLE_USE = 503;
+int const SubtitleContentProperty::USE_SUBTITLES = 503;
 
 SubtitleContent::SubtitleContent (shared_ptr<const Film> f)
        : Content (f)
-       , _subtitle_use (false)
+       , _use_subtitles (false)
        , _subtitle_x_offset (0)
        , _subtitle_y_offset (0)
        , _subtitle_scale (1)
@@ -50,7 +50,7 @@ SubtitleContent::SubtitleContent (shared_ptr<const Film> f)
 
 SubtitleContent::SubtitleContent (shared_ptr<const Film> f, boost::filesystem::path p)
        : Content (f, p)
-       , _subtitle_use (false)
+       , _use_subtitles (false)
        , _subtitle_x_offset (0)
        , _subtitle_y_offset (0)
        , _subtitle_scale (1)
@@ -60,13 +60,13 @@ SubtitleContent::SubtitleContent (shared_ptr<const Film> f, boost::filesystem::p
 
 SubtitleContent::SubtitleContent (shared_ptr<const Film> f, cxml::ConstNodePtr node, int version)
        : Content (f, node)
-       , _subtitle_use (false)
+       , _use_subtitles (false)
        , _subtitle_x_offset (0)
        , _subtitle_y_offset (0)
        , _subtitle_scale (1)
 {
        if (version >= 7) {
-               _subtitle_use = node->bool_child ("SubtitleUse");
+               _use_subtitles = node->bool_child ("UseSubtitles");
                _subtitle_x_offset = node->number_child<float> ("SubtitleXOffset");
                _subtitle_y_offset = node->number_child<float> ("SubtitleYOffset");
        } else {
@@ -85,7 +85,7 @@ SubtitleContent::SubtitleContent (shared_ptr<const Film> f, vector<shared_ptr<Co
        for (size_t i = 0; i < c.size(); ++i) {
                shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (c[i]);
 
-               if (sc->subtitle_use() != ref->subtitle_use()) {
+               if (sc->use_subtitles() != ref->use_subtitles()) {
                        throw JoinError (_("Content to be joined must have the same 'use subtitles' setting."));
                }
 
@@ -102,7 +102,7 @@ SubtitleContent::SubtitleContent (shared_ptr<const Film> f, vector<shared_ptr<Co
                }
        }
 
-       _subtitle_use = ref->subtitle_use ();
+       _use_subtitles = ref->use_subtitles ();
        _subtitle_x_offset = ref->subtitle_x_offset ();
        _subtitle_y_offset = ref->subtitle_y_offset ();
        _subtitle_scale = ref->subtitle_scale ();
@@ -111,20 +111,20 @@ SubtitleContent::SubtitleContent (shared_ptr<const Film> f, vector<shared_ptr<Co
 void
 SubtitleContent::as_xml (xmlpp::Node* root) const
 {
-       root->add_child("SubtitleUse")->add_child_text (raw_convert<string> (_subtitle_use));
+       root->add_child("UseSubtitles")->add_child_text (raw_convert<string> (_use_subtitles));
        root->add_child("SubtitleXOffset")->add_child_text (raw_convert<string> (_subtitle_x_offset));
        root->add_child("SubtitleYOffset")->add_child_text (raw_convert<string> (_subtitle_y_offset));
        root->add_child("SubtitleScale")->add_child_text (raw_convert<string> (_subtitle_scale));
 }
 
 void
-SubtitleContent::set_subtitle_use (bool u)
+SubtitleContent::set_use_subtitles (bool u)
 {
        {
                boost::mutex::scoped_lock lm (_mutex);
-               _subtitle_use = u;
+               _use_subtitles = u;
        }
-       signal_changed (SubtitleContentProperty::SUBTITLE_USE);
+       signal_changed (SubtitleContentProperty::USE_SUBTITLES);
 }
        
 void
index 29634f95a9e3921419e9e5b0f7eed21c9d4034bc..57f5eb9509264d68957ac8f99ef282932cbb28f9 100644 (file)
@@ -28,7 +28,7 @@ public:
        static int const SUBTITLE_X_OFFSET;
        static int const SUBTITLE_Y_OFFSET;
        static int const SUBTITLE_SCALE;
-       static int const SUBTITLE_USE;
+       static int const USE_SUBTITLES;
 };
 
 /** @class SubtitleContent
@@ -50,14 +50,14 @@ public:
 
        virtual bool has_subtitles () const = 0;
 
-       void set_subtitle_use (bool);
+       void set_use_subtitles (bool);
        void set_subtitle_x_offset (double);
        void set_subtitle_y_offset (double);
        void set_subtitle_scale (double);
 
-       bool subtitle_use () const {
+       bool use_subtitles () const {
                boost::mutex::scoped_lock lm (_mutex);
-               return _subtitle_use;
+               return _use_subtitles;
        }
 
        double subtitle_x_offset () const {
@@ -78,7 +78,7 @@ public:
 private:
        friend class ffmpeg_pts_offset_test;
 
-       bool _subtitle_use;
+       bool _use_subtitles;
        /** x offset for placing subtitles, as a proportion of the container width;
         * +ve is further right, -ve is further left.
         */
index ad7451cb93097a2dda9166e58a2c65e01152958d..c53943e20e93a53d5d04bad6eea292ad8d86d129 100644 (file)
@@ -544,7 +544,7 @@ FilmEditor::film_content_changed (int property)
                (*i)->film_content_changed (property);
        }
 
-       if (property == FFmpegContentProperty::AUDIO_STREAM || property == SubtitleContentProperty::SUBTITLE_USE) {
+       if (property == FFmpegContentProperty::AUDIO_STREAM || property == SubtitleContentProperty::USE_SUBTITLES) {
                setup_dcp_name ();
        } else if (property == ContentProperty::PATH) {
                setup_content ();
index 4271b2d92cfe3a0ba9e546a432f47f7fe84464f9..7473e5c3a642462212da080421f0c55cbb0ce888 100644 (file)
@@ -133,8 +133,8 @@ SubtitlePanel::film_content_changed (int property)
                        }
                }
                setup_sensitivity ();
-       } else if (property == SubtitleContentProperty::SUBTITLE_USE) {
-               checked_set (_use, scs ? scs->subtitle_use() : false);
+       } else if (property == SubtitleContentProperty::USE_SUBTITLES) {
+               checked_set (_use, scs ? scs->use_subtitles() : false);
                setup_sensitivity ();
        } else if (property == SubtitleContentProperty::SUBTITLE_X_OFFSET) {
                checked_set (_x_offset, scs ? (scs->subtitle_x_offset() * 100) : 0);
@@ -150,7 +150,7 @@ SubtitlePanel::use_toggled ()
 {
        SubtitleContentList c = _editor->selected_subtitle_content ();
        for (SubtitleContentList::iterator i = c.begin(); i != c.end(); ++i) {
-               (*i)->set_subtitle_use (_use->GetValue());
+               (*i)->set_use_subtitles (_use->GetValue());
        }
 }
 
@@ -241,7 +241,7 @@ void
 SubtitlePanel::content_selection_changed ()
 {
        film_content_changed (FFmpegContentProperty::SUBTITLE_STREAMS);
-       film_content_changed (SubtitleContentProperty::SUBTITLE_USE);
+       film_content_changed (SubtitleContentProperty::USE_SUBTITLES);
        film_content_changed (SubtitleContentProperty::SUBTITLE_X_OFFSET);
        film_content_changed (SubtitleContentProperty::SUBTITLE_Y_OFFSET);
        film_content_changed (SubtitleContentProperty::SUBTITLE_SCALE);
index dc2c622704007b586ec73f94f4e0524304b3597f..d10d1ed25239e54dac342c0bce6bcef40d0a94d6 100644 (file)
@@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_subrip)
        film->set_name ("frobozz");
        film->set_burn_subtitles (true);
        shared_ptr<SubRipContent> content (new SubRipContent (film, "test/data/subrip2.srt"));
-       content->set_subtitle_use (true);
+       content->set_use_subtitles (true);
        film->examine_and_add_content (content);
        wait_for_jobs ();
        film->make_dcp ();
@@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_dcp)
        film->set_name ("frobozz");
        film->set_burn_subtitles (true);
        shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent (film, "test/data/dcp_sub.xml"));
-       content->set_subtitle_use (true);
+       content->set_use_subtitles (true);
        film->examine_and_add_content (content);
        wait_for_jobs ();
        film->make_dcp ();
index 6c3cc9c036b65ef802d703c69f82192966988d5d..561b1021fc6013462f1268364b3f0bac7ecf0bb2 100644 (file)
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE (xml_subtitle_test)
        film->set_name ("frobozz");
        film->set_burn_subtitles (false);
        shared_ptr<SubRipContent> content (new SubRipContent (film, "test/data/subrip2.srt"));
-       content->set_subtitle_use (true);
+       content->set_use_subtitles (true);
        film->examine_and_add_content (content);
        wait_for_jobs ();
        film->make_dcp ();