X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fmarkers_dialog.cc;h=2e4dc42c5950e4f6922651521b9971eebc3e76a2;hb=92858c0cc30fed42119ac632988c8106155e1949;hp=11a76548e002e049b281d8ffc25d6efadea25d77;hpb=b156dc80cde3f33a04ee80b9b39f944a93515d67;p=dcpomatic.git diff --git a/src/wx/markers_dialog.cc b/src/wx/markers_dialog.cc index 11a76548e..2e4dc42c5 100644 --- a/src/wx/markers_dialog.cc +++ b/src/wx/markers_dialog.cc @@ -18,27 +18,32 @@ */ -#include "markers_dialog.h" -#include "wx_util.h" -#include "timecode.h" -#include "static_text.h" -#include "dcpomatic_button.h" + #include "check_box.h" +#include "dcpomatic_button.h" #include "film_viewer.h" +#include "markers.h" +#include "markers_dialog.h" +#include "static_text.h" +#include "timecode.h" +#include "wx_util.h" #include "lib/film.h" #include +#include +LIBDCP_DISABLE_WARNINGS #include +LIBDCP_ENABLE_WARNINGS #include -#include -using std::cout; + +using std::make_shared; using std::shared_ptr; using std::weak_ptr; -using std::make_shared; -using boost::optional; using boost::bind; +using boost::optional; using dcpomatic::DCPTime; + class Marker { public: @@ -66,11 +71,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 +102,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 +123,7 @@ private: Button* set_button; }; + MarkersDialog::MarkersDialog (wxWindow* parent, weak_ptr film, weak_ptr viewer) : wxDialog (parent, wxID_ANY, _("Markers")) , _film (film) @@ -119,17 +132,16 @@ MarkersDialog::MarkersDialog (wxWindow* parent, weak_ptr film, weak_ptr(this, grid, r++, film, viewer, _("First frame of composition"), dcp::Marker::FFOC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of composition"), dcp::Marker::LFOC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("First frame of title credits"), dcp::Marker::FFTC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of title credits"), dcp::Marker::LFTC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("First frame of intermission"), dcp::Marker::FFOI)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of intermission"), dcp::Marker::LFOI)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("First frame of end credits"), dcp::Marker::FFEC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of end credits"), dcp::Marker::LFEC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("First frame of moving credits"), dcp::Marker::FFMC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of moving credits"), dcp::Marker::LFMC)); + for (auto const& marker: all_markers()) { + _markers.push_back (make_shared(this, grid, r++, film, viewer, marker.first, marker.second)); + } sizer->Add (grid, 0, wxALL, 8); + + auto buttons = CreateSeparatedButtonSizer (wxCLOSE); + if (buttons) { + sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); + } + SetSizerAndFit (sizer); }