Merge branch '1.0' into 1.0-vob
[dcpomatic.git] / src / wx / timing_panel.cc
index 512a83cd9cec1e18863216df6695b278e767eb59..b5a0c43d4981ce28bc094a9bec220475d4c727d9 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include "lib/content.h"
-#include "lib/still_image_content.h"
+#include "lib/image_content.h"
 #include "timing_panel.h"
 #include "wx_util.h"
 #include "timecode.h"
@@ -88,7 +88,8 @@ TimingPanel::film_content_changed (int property)
                }
        }       
 
-       _length->set_editable (dynamic_pointer_cast<StillImageContent> (content));
+       shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (content);
+       _length->set_editable (ic && ic->still ());
 }
 
 void
@@ -105,8 +106,8 @@ TimingPanel::length_changed ()
 {
        ContentList c = _editor->selected_content ();
        if (c.size() == 1) {
-               shared_ptr<StillImageContent> ic = dynamic_pointer_cast<StillImageContent> (c.front ());
-               if (ic) {
+               shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (c.front ());
+               if (ic && ic->still ()) {
                        ic->set_video_length (rint (_length->get (_editor->film()->video_frame_rate()) * ic->video_frame_rate() / TIME_HZ));
                }
        }
@@ -134,5 +135,17 @@ TimingPanel::trim_end_changed ()
 void
 TimingPanel::content_selection_changed ()
 {
-
+       VideoContentList sel = _editor->selected_video_content ();
+       bool const single = sel.size() == 1;
+
+       /* Things that are only allowed with single selections */
+       _position->Enable (single);
+       _length->Enable (single);
+       _trim_start->Enable (single);
+       _trim_end->Enable (single);
+       
+       film_content_changed (ContentProperty::POSITION);
+       film_content_changed (ContentProperty::LENGTH);
+       film_content_changed (ContentProperty::TRIM_START);
+       film_content_changed (ContentProperty::TRIM_END);
 }