X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ftimeline_dialog.cc;h=ab2162b3964181ae65cf0ee5b7be4695d019855d;hb=e60bb3e51bd1508b149e6b8f6608f09b5196ae26;hp=9493d0acbcfa2ad02d3c9a7cdac3258a167091a5;hpb=59404039618db5d70a2f8fc0cb8c49ae4f8ce527;p=dcpomatic.git diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc index 9493d0acb..ab2162b39 100644 --- a/src/wx/timeline_dialog.cc +++ b/src/wx/timeline_dialog.cc @@ -23,20 +23,66 @@ #include "film_editor.h" #include "timeline_dialog.h" #include "wx_util.h" +#include "content_panel.h" using std::list; using std::cout; using boost::shared_ptr; -TimelineDialog::TimelineDialog (FilmEditor* ed, shared_ptr 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) + : wxDialog (cp->panel(), wxID_ANY, _("Timeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE) + , _film (film) + , _timeline (this, cp, film) { wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); - + + wxBoxSizer* controls = new wxBoxSizer (wxHORIZONTAL); + _snap = new wxCheckBox (this, wxID_ANY, _("Snap")); + controls->Add (_snap); + _sequence_video = new wxCheckBox (this, wxID_ANY, _("Keep video in sequence")); + controls->Add (_sequence_video, 1, wxLEFT, 12); + + 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)); + film_changed (Film::SEQUENCE_VIDEO); + _snap->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::sequence_video_toggled, this)); + + _film_changed_connection = film->Changed.connect (bind (&TimelineDialog::film_changed, this, _1)); +} + +void +TimelineDialog::snap_toggled () +{ + _timeline.set_snap (_snap->GetValue ()); +} + +void +TimelineDialog::sequence_video_toggled () +{ + shared_ptr film = _film.lock (); + if (!film) { + return; + } + + film->set_sequence_video (_sequence_video->GetValue ()); +} + +void +TimelineDialog::film_changed (Film::Property p) +{ + shared_ptr film = _film.lock (); + if (!film) { + return; + } + + if (p == Film::SEQUENCE_VIDEO) { + _sequence_video->SetValue (film->sequence_video ()); + } }