Supporters update.
[dcpomatic.git] / src / wx / timing_panel.cc
index f251e3c93679fbe45bbcbb07ab30b303caa8e9be..494d415eca1742b10cddd0cbb16d6ab77026aeb5 100644 (file)
 
 */
 
-#include "timing_panel.h"
-#include "wx_util.h"
-#include "film_viewer.h"
-#include "timecode.h"
+
 #include "content_panel.h"
+#include "dcpomatic_button.h"
+#include "film_viewer.h"
 #include "move_to_dialog.h"
 #include "static_text.h"
-#include "dcpomatic_button.h"
+#include "timecode.h"
+#include "timing_panel.h"
+#include "wx_util.h"
+#include "lib/audio_content.h"
 #include "lib/content.h"
-#include "lib/image_content.h"
-#include "lib/text_content.h"
+#include "lib/dcp_content.h"
 #include "lib/dcp_subtitle_content.h"
-#include "lib/audio_content.h"
+#include "lib/ffmpeg_content.h"
+#include "lib/image_content.h"
 #include "lib/string_text_file_content.h"
+#include "lib/text_content.h"
 #include "lib/video_content.h"
-#include "lib/dcp_content.h"
-#include "lib/ffmpeg_content.h"
 #include <dcp/locale_convert.h>
-#include "lib/warnings.h"
+#include <dcp/warnings.h>
 #if defined(__WXGTK20__) && !defined(__WXGTK3__)
 #define TIMING_PANEL_ALIGNMENT_HACK 1
-DCPOMATIC_DISABLE_WARNINGS
+LIBDCP_DISABLE_WARNINGS
 #include <gtk/gtk.h>
-DCPOMATIC_ENABLE_WARNINGS
+LIBDCP_ENABLE_WARNINGS
 #endif
 #include <set>
-#include <iostream>
 
-using std::cout;
+
 using std::string;
 using std::set;
 using std::shared_ptr;
@@ -59,12 +59,20 @@ using namespace boost::placeholders;
 using dcp::locale_convert;
 using namespace dcpomatic;
 
+
 TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer)
        /* horrid hack for apparent lack of context support with wxWidgets i18n code */
        /// TRANSLATORS: translate the word "Timing" here; do not include the "Timing|" prefix
        : ContentSubPanel (p, S_("Timing|Timing"))
        , _viewer (viewer)
        , _film_content_changed_suspender (boost::bind(&TimingPanel::film_content_changed, this, _1))
+{
+
+}
+
+
+void
+TimingPanel::create ()
 {
        wxSize size = TimecodeBase::size (this);
 
@@ -123,6 +131,8 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer)
 
        setup_sensitivity ();
        add_to_grid ();
+
+       _sizer->Layout ();
 }
 
 void
@@ -403,9 +413,8 @@ TimingPanel::play_length_changed ()
        Suspender::Block bl = _film_content_changed_suspender.block ();
        for (auto i: _parent->selected()) {
                FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ());
-               i->set_trim_end (
-                       ContentTime (max(DCPTime(), i->full_length(_parent->film()) - play_length), frc) - i->trim_start()
-                       );
+               auto dcp = max(DCPTime(), i->full_length(_parent->film()) - play_length);
+               i->set_trim_end (max(ContentTime(), ContentTime(dcp, frc) - i->trim_start()));
        }
 }