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)
41 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE | wxFRAME_FLOAT_ON_PARENT
44 , _timeline (this, cp, film)
46 wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
48 wxBoxSizer* controls = new wxBoxSizer (wxHORIZONTAL);
49 _snap = new wxCheckBox (this, wxID_ANY, _("Snap"));
50 controls->Add (_snap);
51 _sequence = new wxCheckBox (this, wxID_ANY, _("Keep video and subtitles in sequence"));
52 controls->Add (_sequence, 1, wxLEFT, 12);
54 sizer->Add (controls, 0, wxALL, 12);
55 sizer->Add (&_timeline, 1, wxEXPAND | wxALL, 12);
57 #ifdef DCPOMATIC_LINUX
58 wxSizer* buttons = CreateSeparatedButtonSizer (wxCLOSE);
60 sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
66 sizer->SetSizeHints (this);
68 _snap->SetValue (_timeline.snap ());
69 _snap->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::snap_toggled, this));
70 film_changed (Film::SEQUENCE);
71 _sequence->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::sequence_toggled, this));
73 _film_changed_connection = film->Changed.connect (bind (&TimelineDialog::film_changed, this, _1));
77 TimelineDialog::snap_toggled ()
79 _timeline.set_snap (_snap->GetValue ());
83 TimelineDialog::sequence_toggled ()
85 shared_ptr<Film> film = _film.lock ();
90 film->set_sequence (_sequence->GetValue ());
94 TimelineDialog::film_changed (Film::Property p)
96 shared_ptr<Film> film = _film.lock ();
101 if (p == Film::SEQUENCE) {
102 _sequence->SetValue (film->sequence ());
107 TimelineDialog::set_selection (ContentList selection)
109 _timeline.set_selection (selection);