X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ftiming_panel.cc;h=aa4f70a81b476c715c8e068a27764eaa30636abc;hb=0b6c6de07f9a3aa28c2e8ca8ef30340e3fa1bfc6;hp=b5a0c43d4981ce28bc094a9bec220475d4c727d9;hpb=f0be0f0e060e40d9a0da1b44429ef41901b8a536;p=dcpomatic.git diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index b5a0c43d4..aa4f70a81 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -17,6 +17,7 @@ */ +#include #include "lib/content.h" #include "lib/image_content.h" #include "timing_panel.h" @@ -25,11 +26,15 @@ #include "film_editor.h" using std::cout; +using std::string; +using std::set; using boost::shared_ptr; using boost::dynamic_pointer_cast; +using libdcp::raw_convert; TimingPanel::TimingPanel (FilmEditor* e) - : FilmEditorPanel (e, _("Timing")) + /* horrid hack for apparent lack of context support with wxWidgets i18n code */ + : FilmEditorPanel (e, S_("Timing|Timing")) { wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4); _sizer->Add (grid, 0, wxALL, 8); @@ -37,78 +42,175 @@ TimingPanel::TimingPanel (FilmEditor* e) add_label_to_sizer (grid, this, _("Position"), true); _position = new Timecode (this); grid->Add (_position); - add_label_to_sizer (grid, this, _("Length"), true); - _length = new Timecode (this); - grid->Add (_length); + add_label_to_sizer (grid, this, _("Full length"), true); + _full_length = new Timecode (this); + grid->Add (_full_length); add_label_to_sizer (grid, this, _("Trim from start"), true); _trim_start = new Timecode (this); grid->Add (_trim_start); add_label_to_sizer (grid, this, _("Trim from end"), true); _trim_end = new Timecode (this); grid->Add (_trim_end); + add_label_to_sizer (grid, this, _("Play length"), true); + _play_length = new Timecode (this); + grid->Add (_play_length); - _position->Changed.connect (boost::bind (&TimingPanel::position_changed, this)); - _length->Changed.connect (boost::bind (&TimingPanel::length_changed, this)); - _trim_start->Changed.connect (boost::bind (&TimingPanel::trim_start_changed, this)); - _trim_end->Changed.connect (boost::bind (&TimingPanel::trim_end_changed, this)); + { + add_label_to_sizer (grid, this, _("Video frame rate"), true); + wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + _video_frame_rate = new wxTextCtrl (this, wxID_ANY); + s->Add (_video_frame_rate, 1, wxEXPAND); + _set_video_frame_rate = new wxButton (this, wxID_ANY, _("Set")); + _set_video_frame_rate->Enable (false); + s->Add (_set_video_frame_rate, 0, wxLEFT | wxRIGHT, 8); + grid->Add (s, 1, wxEXPAND); + } + + _position->Changed.connect (boost::bind (&TimingPanel::position_changed, this)); + _full_length->Changed.connect (boost::bind (&TimingPanel::full_length_changed, this)); + _trim_start->Changed.connect (boost::bind (&TimingPanel::trim_start_changed, this)); + _trim_end->Changed.connect (boost::bind (&TimingPanel::trim_end_changed, this)); + _play_length->Changed.connect (boost::bind (&TimingPanel::play_length_changed, this)); + _video_frame_rate->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TimingPanel::video_frame_rate_changed, this)); + _set_video_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&TimingPanel::set_video_frame_rate, this)); } void TimingPanel::film_content_changed (int property) { ContentList cl = _editor->selected_content (); - shared_ptr content; - if (cl.size() == 1) { - content = cl.front (); - } + int const film_video_frame_rate = _editor->film()->video_frame_rate (); + + /* Here we check to see if we have exactly one different value of various + properties, and fill the controls with that value if so. + */ if (property == ContentProperty::POSITION) { - if (content) { - _position->set (content->position (), _editor->film()->video_frame_rate ()); + + set