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)
42 /* I can't get wxFRAME_FLOAT_ON_PARENT to work on OS X, and although wxSTAY_ON_TOP keeps
43 the window above all others (and not just our own) it's better than nothing for now.
45 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE | wxSTAY_ON_TOP
47 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE | wxFRAME_FLOAT_ON_PARENT
51 , _timeline (this, cp, film)
53 wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
55 wxBoxSizer* controls = new wxBoxSizer (wxHORIZONTAL);
56 _snap = new wxCheckBox (this, wxID_ANY, _("Snap"));
57 controls->Add (_snap);
58 _sequence = new wxCheckBox (this, wxID_ANY, _("Keep video and subtitles in sequence"));
59 controls->Add (_sequence, 1, wxLEFT, 12);
61 sizer->Add (controls, 0, wxALL, 12);
62 sizer->Add (&_timeline, 1, wxEXPAND | wxALL, 12);
64 #ifdef DCPOMATIC_LINUX
65 wxSizer* buttons = CreateSeparatedButtonSizer (wxCLOSE);
67 sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
73 sizer->SetSizeHints (this);
75 _snap->SetValue (_timeline.snap ());
76 _snap->Bind (wxEVT_CHECKBOX, boost::bind (&TimelineDialog::snap_toggled, this));
77 film_changed (Film::SEQUENCE);
78 _sequence->Bind (wxEVT_CHECKBOX, boost::bind (&TimelineDialog::sequence_toggled, this));
80 _film_changed_connection = film->Changed.connect (bind (&TimelineDialog::film_changed, this, _1));
84 TimelineDialog::snap_toggled ()
86 _timeline.set_snap (_snap->GetValue ());
90 TimelineDialog::sequence_toggled ()
92 shared_ptr<Film> film = _film.lock ();
97 film->set_sequence (_sequence->GetValue ());
101 TimelineDialog::film_changed (Film::Property p)
103 shared_ptr<Film> film = _film.lock ();
108 if (p == Film::SEQUENCE) {
109 _sequence->SetValue (film->sequence ());
114 TimelineDialog::set_selection (ContentList selection)
116 _timeline.set_selection (selection);