diff options
| -rw-r--r-- | src/lib/film.cc | 30 | ||||
| -rw-r--r-- | src/lib/film.h | 17 | ||||
| -rw-r--r-- | src/wx/dcp_panel.cc | 60 | ||||
| -rw-r--r-- | src/wx/dcp_panel.h | 8 | ||||
| -rw-r--r-- | src/wx/timing_panel.cc | 39 | ||||
| -rw-r--r-- | src/wx/timing_panel.h | 6 | ||||
| -rw-r--r-- | src/wx/wx_util.cc | 45 | ||||
| -rw-r--r-- | src/wx/wx_util.h | 3 |
8 files changed, 164 insertions, 44 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index ed2c5a372..c46caff03 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -429,6 +429,8 @@ Film::metadata (bool with_content_paths) const i.as_xml (root->add_child("Rating")); } root->add_child("ContentVersion")->add_child_text(_content_version); + root->add_child("Head")->add_child_text(raw_convert<string>(_head.get())); + root->add_child("Tail")->add_child_text(raw_convert<string>(_tail.get())); _playlist->as_xml (root->add_child ("Playlist"), with_content_paths); return doc; @@ -578,6 +580,20 @@ Film::read_metadata (optional<boost::filesystem::path> path) _content_version = f.optional_string_child("ContentVersion").get_value_or(""); + { + optional<DCPTime::Type> h = f.optional_number_child<int64_t>("Head"); + if (h) { + _head = DCPTime(*h); + } + } + + { + optional<DCPTime::Type> t = f.optional_number_child<int64_t>("Tail"); + if (t) { + _tail = DCPTime(*t); + } + } + list<string> notes; _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes); @@ -1165,6 +1181,20 @@ Film::set_key (dcp::Key key) _key = key; } +void +Film::set_head (DCPTime h) +{ + ChangeSignaller<Film> ch (this, HEAD); + _head = h; +} + +void +Film::set_tail (DCPTime t) +{ + ChangeSignaller<Film> ch (this, TAIL); + _tail = t; +} + ContentList Film::content () const { diff --git a/src/lib/film.h b/src/lib/film.h index c72251880..8d5f51a41 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -240,7 +240,9 @@ public: REENCODE_J2K, MARKERS, RATINGS, - CONTENT_VERSION + CONTENT_VERSION, + HEAD, + TAIL }; @@ -349,6 +351,15 @@ public: return _content_version; } + dcpomatic::DCPTime head () const { + return _head; + } + + dcpomatic::DCPTime tail () const { + return _tail; + } + + /* SET */ void set_directory (boost::filesystem::path); @@ -383,6 +394,8 @@ public: void unset_marker (dcp::Marker type); void set_ratings (std::vector<dcp::Rating> r); void set_content_version (std::string v); + void set_head (dcpomatic::DCPTime); + void set_tail (dcpomatic::DCPTime); /** Emitted when some property has of the Film is about to change or has changed */ mutable boost::signals2::signal<void (ChangeType, Property)> Change; @@ -474,6 +487,8 @@ private: std::map<dcp::Marker, dcpomatic::DCPTime> _markers; std::vector<dcp::Rating> _ratings; std::string _content_version; + dcpomatic::DCPTime _head; + dcpomatic::DCPTime _tail; int _state_version; diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index c4a14a58b..b2413e9bd 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -118,6 +118,16 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v _standard_label = create_label (_panel, _("Standard"), true); _standard = new wxChoice (_panel, wxID_ANY); + _hmsf = hmsf_labels (_panel); + + _head_label = create_label (_panel, _("Head"), true); + _head = new Timecode<dcpomatic::DCPTime> (_panel, true); + _head->SetToolTip (_("Amount of black, silent padding to add to the start of the DCP.")); + + _tail_label = create_label (_panel, _("Tail"), true); + _tail = new Timecode<dcpomatic::DCPTime> (_panel, true); + _tail->SetToolTip (_("Amount of black, silent padding to add to the end of the DCP.")); + _upload_after_make_dcp = new CheckBox (_panel, _("Upload DCP to TMS after it is made")); _markers = new Button (_panel, _("Markers...")); @@ -140,6 +150,8 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v _reel_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::reel_type_changed, this)); _reel_length->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this)); _standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this)); + _head->Changed.connect (boost::bind(&DCPPanel::head_changed, this)); + _tail->Changed.connect (boost::bind(&DCPPanel::tail_changed, this)); _upload_after_make_dcp->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::upload_after_make_dcp_changed, this)); _markers->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::markers_clicked, this)); _metadata->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::metadata_clicked, this)); @@ -223,6 +235,11 @@ DCPPanel::add_to_grid () _reel_length_gb_label->Show (full); _standard_label->Show (full); _standard->Show (full); + _hmsf->Show (full); + _head_label->Show (full); + _head->Show (full); + _tail_label->Show (full); + _tail->Show (full); _upload_after_make_dcp->Show (full); _markers->Show (full); _metadata->Show (full); @@ -256,6 +273,17 @@ DCPPanel::add_to_grid () _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); ++r; + _grid->Add (_hmsf, wxGBPosition(r,1)); + ++r; + + add_label_to_sizer (_grid, _head_label, true, wxGBPosition(r, 0)); + _grid->Add (_head, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); + ++r; + + add_label_to_sizer (_grid, _tail_label, true, wxGBPosition(r, 0)); + _grid->Add (_tail, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); + ++r; + _grid->Add (_upload_after_make_dcp, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; @@ -535,6 +563,12 @@ DCPPanel::film_changed (int p) case Film::CONTENT: setup_dcp_name (); break; + case Film::HEAD: + _head->set (_film->head(), _film->video_frame_rate()); + break; + case Film::TAIL: + _tail->set (_film->tail(), _film->video_frame_rate()); + break; default: break; } @@ -656,6 +690,8 @@ DCPPanel::set_film (shared_ptr<Film> film) film_changed (Film::REEL_LENGTH); film_changed (Film::UPLOAD_AFTER_MAKE_DCP); film_changed (Film::REENCODE_J2K); + film_changed (Film::HEAD); + film_changed (Film::TAIL); set_general_sensitivity(static_cast<bool>(_film)); } @@ -700,6 +736,8 @@ DCPPanel::setup_sensitivity () _resolution->Enable (_generally_sensitive && _film && !_film->references_dcp_video()); _three_d->Enable (_generally_sensitive && _film && !_film->references_dcp_video()); _standard->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio()); + _head->Enable (_generally_sensitive); + _tail->Enable (_generally_sensitive); _reencode_j2k->Enable (_generally_sensitive && _film); _show_audio->Enable (_generally_sensitive && _film); } @@ -1053,3 +1091,25 @@ DCPPanel::add_audio_processors () } _audio_panel_sizer->Layout(); } + +void +DCPPanel::head_changed () +{ + if (!_film) { + return; + } + + _film->set_head (_head->get(_film->video_frame_rate())); +} + +void +DCPPanel::tail_changed () +{ + if (!_film) { + return; + } + + _film->set_tail (_tail->get(_film->video_frame_rate())); +} + + diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h index 887ae7c77..a50a473e9 100644 --- a/src/wx/dcp_panel.h +++ b/src/wx/dcp_panel.h @@ -19,6 +19,7 @@ */ #include "lib/config.h" +#include "timecode.h" #include <boost/shared_ptr.hpp> #include <boost/noncopyable.hpp> @@ -83,6 +84,8 @@ private: void markers_clicked (); void metadata_clicked (); void reencode_j2k_changed (); + void head_changed (); + void tail_changed (); void setup_frame_rate_widget (); void setup_container (); @@ -139,6 +142,11 @@ private: wxChoice* _resolution; wxStaticText* _standard_label; wxChoice* _standard; + wxSizer* _hmsf; + wxStaticText* _head_label; + Timecode<dcpomatic::DCPTime>* _head; + wxStaticText* _tail_label; + Timecode<dcpomatic::DCPTime>* _tail; wxCheckBox* _signed; wxCheckBox* _encrypted; wxStaticText* _key_label; diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index 184356a20..ca5529517 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -57,34 +57,6 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer) , _viewer (viewer) , _film_content_changed_suspender (boost::bind(&TimingPanel::film_content_changed, this, _1)) { - wxSize size = TimecodeBase::size (this); - - for (int i = 0; i < 3; ++i) { - _colon[i] = create_label (this, wxT(":"), false); - } - - //// TRANSLATORS: this is an abbreviation for "hours" - _h_label = new StaticText (this, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); -#ifdef DCPOMATIC_LINUX - /* Hack to work around failure to centre text on GTK */ - gtk_label_set_line_wrap (GTK_LABEL(_h_label->GetHandle()), FALSE); -#endif - //// TRANSLATORS: this is an abbreviation for "minutes" - _m_label = new StaticText (this, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); -#ifdef DCPOMATIC_LINUX - gtk_label_set_line_wrap (GTK_LABEL (_m_label->GetHandle()), FALSE); -#endif - //// TRANSLATORS: this is an abbreviation for "seconds" - _s_label = new StaticText (this, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); -#ifdef DCPOMATIC_LINUX - gtk_label_set_line_wrap (GTK_LABEL(_s_label->GetHandle()), FALSE); -#endif - //// TRANSLATORS: this is an abbreviation for "frames" - _f_label = new StaticText (this, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); -#ifdef DCPOMATIC_LINUX - gtk_label_set_line_wrap (GTK_LABEL(_f_label->GetHandle()), FALSE); -#endif - _position_label = create_label (this, _("Position"), true); _position = new Timecode<DCPTime> (this); _move_to_start_of_reel = new Button (this, _("Move to start of reel")); @@ -98,6 +70,7 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer) _trim_end_to_playhead = new Button (this, _("Trim after current position")); _play_length_label = create_label (this, _("Play length"), true); _play_length = new Timecode<DCPTime> (this); + _hmsf_labels = hmsf_labels(this); _video_frame_rate_label = create_label (this, _("Video frame rate"), true); _video_frame_rate = new wxTextCtrl (this, wxID_ANY); @@ -155,15 +128,7 @@ TimingPanel::add_to_grid () int r = 0; - wxSizer* labels = new wxBoxSizer (wxHORIZONTAL); - labels->Add (_h_label, 1, wxEXPAND); - add_label_to_sizer (labels, _colon[0], false); - labels->Add (_m_label, 1, wxEXPAND); - add_label_to_sizer (labels, _colon[1], false); - labels->Add (_s_label, 1, wxEXPAND); - add_label_to_sizer (labels, _colon[2], false); - labels->Add (_f_label, 1, wxEXPAND); - _grid->Add (labels, wxGBPosition(r, 1)); + _grid->Add (_hmsf_labels, wxGBPosition(r, 1)); ++r; add_label_to_sizer (_grid, _position_label, true, wxGBPosition(r, 0)); diff --git a/src/wx/timing_panel.h b/src/wx/timing_panel.h index e0be2d74b..7b632976a 100644 --- a/src/wx/timing_panel.h +++ b/src/wx/timing_panel.h @@ -51,11 +51,6 @@ private: boost::weak_ptr<FilmViewer> _viewer; - wxStaticText* _h_label; - wxStaticText* _m_label; - wxStaticText* _s_label; - wxStaticText* _f_label; - wxStaticText* _colon[3]; wxStaticText* _tip; wxStaticText* _position_label; Timecode<dcpomatic::DCPTime>* _position; @@ -75,4 +70,5 @@ private: wxButton* _set_video_frame_rate; Suspender _film_content_changed_suspender; + wxSizer* _hmsf_labels; }; diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 28f79431a..6f63f91bc 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -530,3 +530,48 @@ display_progress (wxString title, wxString task) return ok; } + +wxSizer* +hmsf_labels (wxWindow* parent) +{ + wxClientDC dc (parent); + wxSize size = dc.GetTextExtent (wxT("9999")); + size.SetHeight (-1); + + wxStaticText* colon[3]; + for (int i = 0; i < 3; ++i) { + colon[i] = create_label (parent, wxT(":"), false); + } + + wxStaticText* h_label = new StaticText (parent, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); +#ifdef DCPOMATIC_LINUX + /* Hack to work around failure to centre text on GTK */ + gtk_label_set_line_wrap (GTK_LABEL(h_label->GetHandle()), FALSE); +#endif + //// TRANSLATORS: this is an abbreviation for "minutes" + wxStaticText* m_label = new StaticText (parent, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); +#ifdef DCPOMATIC_LINUX + gtk_label_set_line_wrap (GTK_LABEL (m_label->GetHandle()), FALSE); +#endif + //// TRANSLATORS: this is an abbreviation for "seconds" + wxStaticText* s_label = new StaticText (parent, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); +#ifdef DCPOMATIC_LINUX + gtk_label_set_line_wrap (GTK_LABEL(s_label->GetHandle()), FALSE); +#endif + //// TRANSLATORS: this is an abbreviation for "frames" + wxStaticText* f_label = new StaticText (parent, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); +#ifdef DCPOMATIC_LINUX + gtk_label_set_line_wrap (GTK_LABEL(f_label->GetHandle()), FALSE); +#endif + wxSizer* labels = new wxBoxSizer (wxHORIZONTAL); + labels->Add (h_label, 1, wxEXPAND); + add_label_to_sizer (labels, colon[0], false); + labels->Add (m_label, 1, wxEXPAND); + add_label_to_sizer (labels, colon[1], false); + labels->Add (s_label, 1, wxEXPAND); + add_label_to_sizer (labels, colon[2], false); + labels->Add (f_label, 1, wxEXPAND); + + return labels; +} + diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 400493f18..6cf839cc3 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -90,6 +90,7 @@ extern wxSplashScreen* maybe_show_splash (); extern double calculate_mark_interval (double start); extern bool display_progress (wxString title, wxString task); extern bool report_errors_from_last_job (wxWindow* parent); +extern wxSizer* hmsf_labels (wxWindow* parent); extern void checked_set (FilePickerCtrl* widget, boost::filesystem::path value); extern void checked_set (wxDirPickerCtrl* widget, boost::filesystem::path value); |
