2 Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include <wx/graphics.h>
23 #include "lib/playlist.h"
24 #include "film_editor.h"
25 #include "timeline_dialog.h"
27 #include "content_panel.h"
32 using boost::shared_ptr;
34 TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film)
35 : wxDialog (cp->panel(), wxID_ANY, _("Timeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
37 , _timeline (this, cp, film)
39 wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
41 wxBoxSizer* controls = new wxBoxSizer (wxHORIZONTAL);
42 _snap = new wxCheckBox (this, wxID_ANY, _("Snap"));
43 controls->Add (_snap);
44 _sequence = new wxCheckBox (this, wxID_ANY, _("Keep video and subtitles in sequence"));
45 controls->Add (_sequence, 1, wxLEFT, 12);
47 sizer->Add (controls, 0, wxALL, 12);
48 sizer->Add (&_timeline, 1, wxEXPAND | wxALL, 12);
50 #ifdef DCPOMATIC_LINUX
51 wxSizer* buttons = CreateSeparatedButtonSizer (wxCLOSE);
53 sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
59 sizer->SetSizeHints (this);
61 _snap->SetValue (_timeline.snap ());
62 _snap->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::snap_toggled, this));
63 film_changed (Film::SEQUENCE);
64 _sequence->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::sequence_toggled, this));
66 _film_changed_connection = film->Changed.connect (bind (&TimelineDialog::film_changed, this, _1));
70 TimelineDialog::snap_toggled ()
72 _timeline.set_snap (_snap->GetValue ());
76 TimelineDialog::sequence_toggled ()
78 shared_ptr<Film> film = _film.lock ();
83 film->set_sequence (_sequence->GetValue ());
87 TimelineDialog::film_changed (Film::Property p)
89 shared_ptr<Film> film = _film.lock ();
94 if (p == Film::SEQUENCE) {
95 _sequence->SetValue (film->sequence ());
100 TimelineDialog::set_selection (ContentList selection)
102 _timeline.set_selection (selection);