Merge master.
[dcpomatic.git] / src / wx / timeline_dialog.cc
index 35d5eec2105b5190ccaedd91973706c29895aa1f..8ac90b8def6994d0e3f49e566d0f963c77c74de9 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"
+#include "content_panel.h"
 
 using std::list;
 using std::cout;
 using boost::shared_ptr;
 
-TimelineDialog::TimelineDialog (FilmEditor* ed, shared_ptr<Film> film)
-       : wxDialog (ed, wxID_ANY, _("Timeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
-       , _timeline (this, ed, film)
+TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film)
+       : wxDialog (cp->panel(), wxID_ANY, _("Timeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
+       , _timeline (this, cp, 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 (&TimelineDialog::snap_toggled, this));
+}
+
+void
+TimelineDialog::snap_toggled ()
+{
+       _timeline.set_snap (_snap->GetValue ());
 }