Apply 9d49a592519fc7f0141e2a1a9fee0043776952ac; fix drag-and-drop and sort image...
[dcpomatic.git] / src / wx / timing_panel.cc
index 1b1c4b8934f936ea3a45bd9cc80104413a44dcd7..b466da8427aeefe539eb604f8eb4cd4aa225911c 100644 (file)
@@ -134,6 +134,40 @@ TimingPanel::TimingPanel (ContentPanel* p)
        _set_video_frame_rate->Bind   (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&TimingPanel::set_video_frame_rate, this));
 }
 
+void
+TimingPanel::update_full_length ()
+{
+       ContentList cl = _parent->selected ();
+
+       set<DCPTime> check;
+       for (ContentList::const_iterator i = cl.begin (); i != cl.end(); ++i) {
+               check.insert ((*i)->full_length ());
+       }
+       
+       if (check.size() == 1) {
+               _full_length->set (cl.front()->full_length (), _parent->film()->video_frame_rate ());
+       } else {
+               _full_length->clear ();
+       }
+}
+
+void
+TimingPanel::update_play_length ()
+{
+       ContentList cl = _parent->selected ();
+
+       set<DCPTime> check;
+       for (ContentList::const_iterator i = cl.begin (); i != cl.end(); ++i) {
+               check.insert ((*i)->length_after_trim ());
+       }
+       
+       if (check.size() == 1) {
+               _play_length->set (cl.front()->length_after_trim (), _parent->film()->video_frame_rate ());
+       } else {
+               _play_length->clear ();
+       }
+}
+
 void
 TimingPanel::film_content_changed (int property)
 {
@@ -163,16 +197,7 @@ TimingPanel::film_content_changed (int property)
                property == VideoContentProperty::VIDEO_FRAME_TYPE
                ) {
 
-               set<DCPTime> check;
-               for (ContentList::const_iterator i = cl.begin (); i != cl.end(); ++i) {
-                       check.insert ((*i)->full_length ());
-               }
-               
-               if (check.size() == 1) {
-                       _full_length->set (cl.front()->full_length (), film_video_frame_rate);
-               } else {
-                       _full_length->clear ();
-               }
+               update_full_length ();
 
        } else if (property == ContentProperty::TRIM_START) {
 
@@ -209,16 +234,7 @@ TimingPanel::film_content_changed (int property)
                property == VideoContentProperty::VIDEO_FRAME_TYPE
                ) {
 
-               set<DCPTime> check;
-               for (ContentList::const_iterator i = cl.begin (); i != cl.end(); ++i) {
-                       check.insert ((*i)->length_after_trim ());
-               }
-               
-               if (check.size() == 1) {
-                       _play_length->set (cl.front()->length_after_trim (), film_video_frame_rate);
-               } else {
-                       _play_length->clear ();
-               }
+               update_play_length ();
        }
 
        if (property == VideoContentProperty::VIDEO_FRAME_RATE) {
@@ -340,3 +356,12 @@ TimingPanel::content_selection_changed ()
        film_content_changed (ContentProperty::TRIM_END);
        film_content_changed (VideoContentProperty::VIDEO_FRAME_RATE);
 }
+
+void
+TimingPanel::film_changed (Film::Property p)
+{
+       if (p == Film::VIDEO_FRAME_RATE) {
+               update_full_length ();
+               update_play_length ();
+       }
+}