X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fcontrols.cc;h=3e06664607d8617a158af7fbe74780b3ebb84774;hb=4bef2e0b93f84ee98d7a3dccbfa5b13106f7a263;hp=9fcdbd645b59daefd77f02708d845a43d8fdf0bb;hpb=6349c88c4fb9d4ac76ef14b277d455e3a2b006a6;p=dcpomatic.git diff --git a/src/wx/controls.cc b/src/wx/controls.cc index 9fcdbd645..3e0666460 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -24,6 +24,9 @@ #include "playhead_to_timecode_dialog.h" #include "playhead_to_frame_dialog.h" #include "content_view.h" +#include "static_text.h" +#include "check_box.h" +#include "dcpomatic_button.h" #include "lib/job_manager.h" #include "lib/player_video.h" #include "lib/dcp_content.h" @@ -59,25 +62,25 @@ Controls::Controls (wxWindow* parent, shared_ptr viewer, bool editor , _outline_content (0) , _eye (0) , _jump_to_selected (0) - , _rewind_button (new wxButton (this, wxID_ANY, wxT("|<"))) - , _back_button (new wxButton (this, wxID_ANY, wxT("<"))) - , _forward_button (new wxButton (this, wxID_ANY, wxT(">"))) - , _frame_number (new wxStaticText (this, wxID_ANY, wxT(""))) - , _timecode (new wxStaticText (this, wxID_ANY, wxT(""))) + , _rewind_button (new Button (this, wxT("|<"))) + , _back_button (new Button (this, wxT("<"))) + , _forward_button (new Button (this, wxT(">"))) + , _frame_number (new StaticText (this, wxT(""))) + , _timecode (new StaticText (this, wxT(""))) { _v_sizer = new wxBoxSizer (wxVERTICAL); SetSizer (_v_sizer); wxBoxSizer* view_options = new wxBoxSizer (wxHORIZONTAL); if (editor_controls) { - _outline_content = new wxCheckBox (this, wxID_ANY, _("Outline content")); + _outline_content = new CheckBox (this, _("Outline content")); view_options->Add (_outline_content, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); _eye = new wxChoice (this, wxID_ANY); _eye->Append (_("Left")); _eye->Append (_("Right")); _eye->SetSelection (0); view_options->Add (_eye, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); - _jump_to_selected = new wxCheckBox (this, wxID_ANY, _("Jump to selected content")); + _jump_to_selected = new CheckBox (this, _("Jump to selected content")); view_options->Add (_jump_to_selected, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); } @@ -117,6 +120,13 @@ Controls::Controls (wxWindow* parent, shared_ptr viewer, bool editor _slider->Bind (wxEVT_SCROLL_PAGEUP, boost::bind(&Controls::slider_moved, this, true)); _slider->Bind (wxEVT_SCROLL_PAGEDOWN, boost::bind(&Controls::slider_moved, this, true)); _slider->Bind (wxEVT_SCROLL_CHANGED, boost::bind(&Controls::slider_released, this)); +#ifdef DCPOMATIC_OSX + /* _CHANGED is not received on OS X (at least, not when the + slider is dragged), so use this instead. Perhaps all + platforms could just use _THUMBRELEASE. + */ + _slider->Bind (wxEVT_SCROLL_THUMBRELEASE, boost::bind(&Controls::slider_released, this)); +#endif _rewind_button->Bind (wxEVT_LEFT_DOWN, boost::bind(&Controls::rewind_clicked, this, _1)); _back_button->Bind (wxEVT_LEFT_DOWN, boost::bind(&Controls::back_clicked, this, _1)); _forward_button->Bind (wxEVT_LEFT_DOWN, boost::bind(&Controls::forward_clicked, this, _1)); @@ -204,6 +214,12 @@ Controls::slider_moved (bool page) } _viewer->seek (t, false); update_position_label (); + + log ( + wxString::Format( + "playback-seeked %s", t.timecode(_film->video_frame_rate()).c_str() + ) + ); } void @@ -363,6 +379,10 @@ Controls::set_film (shared_ptr film) _film = film; + if (_film) { + _film_change_connection = _film->Change.connect (boost::bind(&Controls::film_change, this, _1, _2)); + } + setup_sensitivity (); update_position_slider (); @@ -374,3 +394,17 @@ Controls::film () const { return _film; } + +void +Controls::film_change (ChangeType type, Film::Property p) +{ + if (type == CHANGE_TYPE_DONE) { + if (p == Film::CONTENT) { + setup_sensitivity (); + update_position_label (); + update_position_slider (); + } else if (p == Film::THREE_D) { + setup_sensitivity (); + } + } +}