*/
-#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 <dcp/types.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
#include <wx/gbsizer.h>
+LIBDCP_ENABLE_WARNINGS
#include <boost/bind/bind.hpp>
-#include <iostream>
-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:
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());
{
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);
Button* set_button;
};
+
MarkersDialog::MarkersDialog (wxWindow* parent, weak_ptr<Film> film, weak_ptr<FilmViewer> viewer)
: wxDialog (parent, wxID_ANY, _("Markers"))
, _film (film)
auto grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
int r = 0;
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of composition"), dcp::Marker::FFOC));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of composition"), dcp::Marker::LFOC));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of title credits"), dcp::Marker::FFTC));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of title credits"), dcp::Marker::LFTC));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of intermission"), dcp::Marker::FFOI));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of intermission"), dcp::Marker::LFOI));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of end credits"), dcp::Marker::FFEC));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of end credits"), dcp::Marker::LFEC));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of moving credits"), dcp::Marker::FFMC));
- _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of moving credits"), dcp::Marker::LFMC));
+ for (auto const& marker: all_markers()) {
+ _markers.push_back (make_shared<Marker>(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);
}