Update supporters list.
[dcpomatic.git] / src / wx / markers_dialog.cc
index 11a76548e002e049b281d8ffc25d6efadea25d77..205d44195e20a9c2aeb548c4e422ff264149ebe9 100644 (file)
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "markers_dialog.h"
 #include "wx_util.h"
 #include "timecode.h"
@@ -31,6 +32,7 @@
 #include <boost/bind/bind.hpp>
 #include <iostream>
 
+
 using std::cout;
 using std::shared_ptr;
 using std::weak_ptr;
@@ -39,6 +41,7 @@ using boost::optional;
 using boost::bind;
 using dcpomatic::DCPTime;
 
+
 class Marker
 {
 public:
@@ -66,11 +69,17 @@ public:
                set_sensitivity ();
 
                set_button->Bind (wxEVT_BUTTON, bind(&Marker::set, this));
-               checkbox->Bind (wxEVT_CHECKBOX, bind(&Marker::set_sensitivity, this));
+               checkbox->Bind (wxEVT_CHECKBOX, bind(&Marker::checkbox_clicked, this));
                timecode->Changed.connect (bind(&Marker::changed, this));
        }
 
 private:
+       void checkbox_clicked ()
+       {
+               set_sensitivity ();
+               changed ();
+       }
+
        void set_sensitivity ()
        {
                timecode->Enable (checkbox->GetValue());
@@ -91,10 +100,11 @@ private:
        {
                auto f = film.lock ();
                DCPOMATIC_ASSERT (f);
-               auto tc = timecode->get(f->video_frame_rate());
+               auto vfr = f->video_frame_rate();
+               auto tc = timecode->get(vfr);
                if (tc >= f->length()) {
-                       tc = f->length();
-                       timecode->set (tc, f->video_frame_rate());
+                       tc = f->length() - DCPTime::from_frames(1, vfr);
+                       timecode->set (tc, vfr);
                }
                if (checkbox->GetValue()) {
                        f->set_marker (type, tc);
@@ -111,6 +121,7 @@ private:
        Button* set_button;
 };
 
+
 MarkersDialog::MarkersDialog (wxWindow* parent, weak_ptr<Film> film, weak_ptr<FilmViewer> viewer)
        : wxDialog (parent, wxID_ANY, _("Markers"))
        , _film (film)
@@ -131,5 +142,11 @@ MarkersDialog::MarkersDialog (wxWindow* parent, weak_ptr<Film> film, weak_ptr<Fi
        _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of moving credits"), dcp::Marker::LFMC));
 
        sizer->Add (grid, 0, wxALL, 8);
+
+       auto buttons = CreateSeparatedButtonSizer (wxCLOSE);
+       if (buttons) {
+               sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+       }
+
        SetSizerAndFit (sizer);
 }