Merge master.
[dcpomatic.git] / src / wx / timeline_dialog.cc
index 91d1f7b07d3652ecd67e0251dc75e9c68a08f837..a63c219dbfb43ca3966cd076653f6a9afd18e44c 100644 (file)
 
 #include <list>
 #include <wx/graphics.h>
+#include "lib/playlist.h"
+#include "film_editor.h"
 #include "timeline_dialog.h"
 #include "wx_util.h"
-#include "playlist.h"
 
 using std::list;
 using std::cout;
 using boost::shared_ptr;
 
-TimelineDialog::TimelineDialog (wxWindow* parent, shared_ptr<const Film> film)
-       : wxDialog (parent, wxID_ANY, _("Timeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
-       , _timeline (this, film)
+DCPTimelineDialog::DCPTimelineDialog (FilmEditor* ed, shared_ptr<Film> film)
+       : wxDialog (ed, wxID_ANY, _("DCPTimeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
+       , _timeline (this, ed, film)
 {
        wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
-       
+
+       wxBoxSizer* controls = new wxBoxSizer (wxHORIZONTAL);
+       _snap = new wxCheckBox (this, wxID_ANY, _("Snap"));
+       controls->Add (_snap);
+
+       sizer->Add (controls, 0, wxALL, 12);
        sizer->Add (&_timeline, 1, wxEXPAND | wxALL, 12);
 
        SetSizer (sizer);
        sizer->Layout ();
        sizer->SetSizeHints (this);
+
+       _snap->SetValue (_timeline.snap ());
+       _snap->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPTimelineDialog::snap_toggled, this));
+}
+
+void
+DCPTimelineDialog::snap_toggled ()
+{
+       _timeline.set_snap (_snap->GetValue ());
 }