X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fcontrols.cc;h=0c9a27518635f70dde4b120ca111d8eb1e71deec;hb=92f024ea58c7279b8096e5e9f60f9cb2613e8a91;hp=df2c161348e01bfeaffffc24f8fb71fbd4b1a818;hpb=73461f719bfb3ee91644b84f4bffd91df0e6559f;p=dcpomatic.git diff --git a/src/wx/controls.cc b/src/wx/controls.cc index df2c16134..0c9a27518 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -24,6 +24,8 @@ #include "playhead_to_timecode_dialog.h" #include "playhead_to_frame_dialog.h" #include "lib/job_manager.h" +#include "lib/player_video.h" +#include "lib/dcp_content.h" #include #include #include @@ -38,6 +40,7 @@ using std::make_pair; using boost::optional; using boost::shared_ptr; using boost::weak_ptr; +using boost::dynamic_pointer_cast; Controls::Controls (wxWindow* parent, shared_ptr viewer, bool editor_controls) : wxPanel (parent) @@ -170,6 +173,7 @@ Controls::Controls (wxWindow* parent, shared_ptr viewer, bool editor _viewer->Started.connect (boost::bind(&Controls::started, this)); _viewer->Stopped.connect (boost::bind(&Controls::stopped, this)); _viewer->FilmChanged.connect (boost::bind(&Controls::film_changed, this)); + _viewer->ImageChanged.connect (boost::bind(&Controls::image_changed, this, _1)); film_changed (); @@ -420,8 +424,9 @@ Controls::setup_sensitivity () _forward_button->Enable (c); #ifdef DCPOMATIC_VARIANT_SWAROOP _play_button->Enable (c && !_viewer->playing()); - _pause_button->Enable (c && _viewer->playing()); - _stop_button->Enable (c); + _pause_button->Enable (c && (!_current_kind || _current_kind != dcp::ADVERTISEMENT) && _viewer->playing()); + _stop_button->Enable (c && (!_current_kind || _current_kind != dcp::ADVERTISEMENT)); + _slider->Enable (c && (!_current_kind || _current_kind != dcp::ADVERTISEMENT)); #else _play_button->Enable (c); #endif @@ -510,6 +515,9 @@ void Controls::show_extended_player_controls (bool s) { _cpl->Show (s); + if (s) { + update_dcp_directory (); + } _spl_view->Show (s); _log->Show (s); _add_button->Show (s); @@ -550,6 +558,10 @@ Controls::add_cpl_to_list (shared_ptr cpl, wxListCtrl* ctrl) void Controls::update_dcp_directory () { + if (!_cpl->IsShown()) { + return; + } + using namespace boost::filesystem; _cpl->DeleteAllItems (); @@ -603,3 +615,29 @@ Controls::log (wxString s) wxString ts = std_to_wx(string(buffer)) + N_(": "); _log->SetValue(_log->GetValue() + ts + s + "\n"); } + +void +Controls::image_changed (boost::weak_ptr weak_pv) +{ +#ifdef DCPOMATIC_VARIANT_SWAROOP + shared_ptr pv = weak_pv.lock (); + if (!pv) { + return; + } + + shared_ptr c = pv->content().lock(); + if (!c) { + return; + } + + shared_ptr dc = dynamic_pointer_cast (c); + if (!dc) { + return; + } + + if (!_current_kind || *_current_kind != dc->content_kind()) { + _current_kind = dc->content_kind (); + setup_sensitivity (); + } +#endif +}