diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-11-09 00:43:48 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-11-09 00:43:48 +0000 |
| commit | 294704d07de1fd6981362d85a26e4a83a6ef08fa (patch) | |
| tree | 780d8a4bf0961697e16be3be1984dc8aa24c4056 /src | |
| parent | b6a281b4ba1d5e2b91ae3d54e073ee88308f61b6 (diff) | |
Desensitize trim-up-to buttons as appropriate (#737).
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/timing_panel.cc | 38 | ||||
| -rw-r--r-- | src/wx/timing_panel.h | 1 |
2 files changed, 30 insertions, 9 deletions
diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index bb0547b9c..9f5aa78ea 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -147,6 +147,10 @@ TimingPanel::TimingPanel (ContentPanel* p, FilmViewer* viewer) _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)); + + _viewer->ImageChanged.connect (boost::bind (&TimingPanel::setup_sensitivity, this)); + + setup_sensitivity (); } void @@ -294,6 +298,7 @@ TimingPanel::film_content_changed (int property) _full_length->set_editable (have_still); _play_length->set_editable (!have_still); _set_video_frame_rate->Enable (false); + setup_sensitivity (); } void @@ -324,7 +329,6 @@ TimingPanel::trim_start_changed () } } - void TimingPanel::trim_end_changed () { @@ -372,14 +376,7 @@ TimingPanel::set_video_frame_rate () void TimingPanel::content_selection_changed () { - bool const e = !_parent->selected().empty (); - - _position->Enable (e); - _full_length->Enable (e); - _trim_start->Enable (e); - _trim_end->Enable (e); - _play_length->Enable (e); - _video_frame_rate->Enable (e); + setup_sensitivity (); film_content_changed (ContentProperty::POSITION); film_content_changed (ContentProperty::LENGTH); @@ -430,6 +427,29 @@ TimingPanel::trim_end_to_playhead_clicked () FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ()); i->set_trim_end (ContentTime (i->position() + i->full_length() - ph - DCPTime::from_frames (1, frc.dcp), frc) - i->trim_start()); } + } +} + +void +TimingPanel::setup_sensitivity () +{ + bool const e = !_parent->selected().empty (); + + _position->Enable (e); + _full_length->Enable (e); + _trim_start->Enable (e); + _trim_end->Enable (e); + _play_length->Enable (e); + _video_frame_rate->Enable (e); + DCPTime const ph = _viewer->position (); + bool any_over_ph = false; + BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) { + if (i->position() <= ph && ph < i->end()) { + any_over_ph = true; + } } + + _trim_start_to_playhead->Enable (any_over_ph); + _trim_end_to_playhead->Enable (any_over_ph); } diff --git a/src/wx/timing_panel.h b/src/wx/timing_panel.h index d1f5ea549..f73fbed55 100644 --- a/src/wx/timing_panel.h +++ b/src/wx/timing_panel.h @@ -43,6 +43,7 @@ private: void set_video_frame_rate (); void update_full_length (); void update_play_length (); + void setup_sensitivity (); FilmViewer* _viewer; |
