Add sequence video button.
authorCarl Hetherington <cth@carlh.net>
Fri, 19 Jul 2013 16:37:37 +0000 (17:37 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 19 Jul 2013 17:58:29 +0000 (18:58 +0100)
src/lib/film.cc
src/lib/film.h
src/wx/film_editor.cc
src/wx/film_editor.h

index d5a5abae4fe17daa9bbc7b3957af7798d3479e4d..031b4f1f4d326a75c09ec37c1134f3f270028616 100644 (file)
@@ -95,6 +95,7 @@ Film::Film (string d)
        , _dci_metadata (Config::instance()->default_dci_metadata ())
        , _dcp_video_frame_rate (24)
        , _dcp_audio_channels (MAX_AUDIO_CHANNELS)
+       , _sequence_video (true)
        , _dirty (false)
 {
        set_dci_date_today ();
@@ -122,6 +123,8 @@ Film::Film (string d)
 
        set_directory (result.string ());
        _log.reset (new FileLog ("log"));
+
+       _playlist->set_sequence_video (_sequence_video);
 }
 
 string
@@ -324,6 +327,7 @@ Film::write_metadata () const
        root->add_child("DCPVideoFrameRate")->add_child_text (lexical_cast<string> (_dcp_video_frame_rate));
        root->add_child("DCIDate")->add_child_text (boost::gregorian::to_iso_string (_dci_date));
        root->add_child("DCPAudioChannels")->add_child_text (lexical_cast<string> (_dcp_audio_channels));
+       root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
        _playlist->as_xml (root->add_child ("Playlist"));
 
        doc.write_to_file_formatted (file ("metadata.xml"));
@@ -369,6 +373,7 @@ Film::read_metadata ()
        _dcp_video_frame_rate = f.number_child<int> ("DCPVideoFrameRate");
        _dci_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate"));
        _dcp_audio_channels = f.number_child<int> ("DCPAudioChannels");
+       _sequence_video = f.bool_child ("SequenceVideo");
 
        _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"));
 
@@ -643,6 +648,7 @@ Film::signal_changed (Property p)
                set_dcp_video_frame_rate (_playlist->best_dcp_frame_rate ());
                break;
        case Film::DCP_VIDEO_FRAME_RATE:
+       case Film::SEQUENCE_VIDEO:
                _playlist->maybe_sequence_video ();
                break;
        default:
@@ -838,7 +844,13 @@ Film::dcp_audio_frame_rate () const
 void
 Film::set_sequence_video (bool s)
 {
-       _playlist->set_sequence_video (s);
+       {
+               boost::mutex::scoped_lock lm (_state_mutex);
+               _sequence_video = s;
+               _playlist->set_sequence_video (s);
+       }
+       
+       signal_changed (SEQUENCE_VIDEO);
 }
 
 libdcp::Size
index 51db8ce00729219c44e4f98077efaeedd6d34596..834de6cbe0694890b401e860bb7616ddbae2b4eb 100644 (file)
@@ -112,8 +112,6 @@ public:
        bool has_subtitles () const;
        OutputVideoFrame best_dcp_video_frame_rate () const;
 
-       void set_sequence_video (bool);
-
        /** Identifiers for the parts of our state;
            used for signalling changes.
        */
@@ -131,7 +129,8 @@ public:
                J2K_BANDWIDTH,
                DCI_METADATA,
                DCP_VIDEO_FRAME_RATE,
-               DCP_AUDIO_CHANNELS
+               DCP_AUDIO_CHANNELS,
+               SEQUENCE_VIDEO
        };
 
 
@@ -198,6 +197,12 @@ public:
                return _dcp_audio_channels;
        }
 
+       bool sequence_video () const {
+               boost::mutex::scoped_lock lm (_state_mutex);
+               return _sequence_video;
+       }
+       
+
        /* SET */
 
        void set_directory (std::string);
@@ -216,6 +221,7 @@ public:
        void set_dcp_video_frame_rate (int);
        void set_dcp_audio_channels (int);
        void set_dci_date_today ();
+       void set_sequence_video (bool);
 
        /** Emitted when some property has of the Film has changed */
        mutable boost::signals2::signal<void (Property)> Changed;
@@ -269,6 +275,7 @@ private:
        /** The date that we should use in a DCI name */
        boost::gregorian::date _dci_date;
        int _dcp_audio_channels;
+       bool _sequence_video;
 
        /** true if our state has changed since we last saved it */
        mutable bool _dirty;
index 83e8c619fddbd92d7eadbb16644c00ac8e7712fe..33f5603a486bff092eea17b1d40811ab07bb81bc 100644 (file)
@@ -237,6 +237,7 @@ FilmEditor::connect_to_widgets ()
        _audio_stream->Connect           (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::audio_stream_changed), 0, this);
        _subtitle_stream->Connect        (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::subtitle_stream_changed), 0, this);
        _dcp_resolution->Connect         (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::dcp_resolution_changed), 0, this);
+       _sequence_video->Connect         (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED,     wxCommandEventHandler (FilmEditor::sequence_video_changed), 0, this);
                
        _audio_mapping->Changed.connect  (boost::bind (&FilmEditor::audio_mapping_changed, this, _1));
        _start->Changed.connect          (boost::bind (&FilmEditor::start_changed, this));
@@ -334,6 +335,9 @@ FilmEditor::make_content_panel ()
                _content_sizer->Add (s, 0.75, wxEXPAND | wxALL, 6);
        }
 
+       _sequence_video = new wxCheckBox (_content_panel, wxID_ANY, _("Keep video in sequence"));
+       _content_sizer->Add (_sequence_video);
+
        _content_notebook = new wxNotebook (_content_panel, wxID_ANY);
        _content_sizer->Add (_content_notebook, 1, wxEXPAND | wxTOP, 6);
 
@@ -666,6 +670,9 @@ FilmEditor::film_changed (Film::Property p)
                _audio_mapping->set_channels (_film->dcp_audio_channels ());
                setup_dcp_name ();
                break;
+       case Film::SEQUENCE_VIDEO:
+               checked_set (_sequence_video, _film->sequence_video ());
+               break;
        }
 }
 
@@ -873,6 +880,7 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::DCI_METADATA);
        film_changed (Film::DCP_VIDEO_FRAME_RATE);
        film_changed (Film::DCP_AUDIO_CHANNELS);
+       film_changed (Film::SEQUENCE_VIDEO);
 
        if (!_film->content().empty ()) {
                set_selection (_film->content().front ());
@@ -1502,3 +1510,9 @@ FilmEditor::ratio_changed (wxCommandEvent &)
                vc->set_ratio (ratios[n]);
        }
 }
+
+void
+FilmEditor::sequence_video_changed (wxCommandEvent &)
+{
+       _film->set_sequence_video (_sequence_video->GetValue ());
+}
index a7e8ab197c1033c15300f123b975e4f36813de14..7347ab1a6326d6c2c75b849de2eb8f4d260fcf32 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -96,6 +96,7 @@ private:
        void ratio_changed (wxCommandEvent &);
        void dcp_audio_channels_changed (wxCommandEvent &);
        void dcp_resolution_changed (wxCommandEvent &);
+       void sequence_video_changed (wxCommandEvent &);
 
        /* Handle changes to the model */
        void film_changed (Film::Property);
@@ -140,6 +141,7 @@ private:
        wxButton* _content_earlier;
        wxButton* _content_later;
        wxButton* _content_timeline;
+       wxCheckBox* _sequence_video;
        wxButton* _edit_dci_button;
        wxChoice* _ratio;
        wxStaticText* _ratio_description;