Add new interface for setting reel breaks (#2678).
[dcpomatic.git] / src / wx / dcp_timeline_dialog.cc
1 /*
2     Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21
22 #include "dcp_panel.h"
23 #include "dcp_timeline_dialog.h"
24 #include "film_editor.h"
25 #include "wx_util.h"
26 #include "lib/compose.hpp"
27 #include "lib/cross.h"
28 #include "lib/film.h"
29 #include "lib/playlist.h"
30 #include <dcp/warnings.h>
31 LIBDCP_DISABLE_WARNINGS
32 #include <wx/graphics.h>
33 LIBDCP_ENABLE_WARNINGS
34 #include <list>
35
36
37 using std::list;
38 using std::shared_ptr;
39 using std::string;
40 using std::weak_ptr;
41 #if BOOST_VERSION >= 106100
42 using namespace boost::placeholders;
43 #endif
44
45
46 DCPTimelineDialog::DCPTimelineDialog(wxWindow* parent, shared_ptr<Film> film)
47         : wxDialog(
48                 parent,
49                 wxID_ANY,
50                 _("Reels"),
51                 wxDefaultPosition,
52                 wxSize(640, 512),
53 #ifdef DCPOMATIC_OSX
54                 /* I can't get wxFRAME_FLOAT_ON_PARENT to work on OS X, and although wxSTAY_ON_TOP keeps
55                    the window above all others (and not just our own) it's better than nothing for now.
56                 */
57                 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE | wxSTAY_ON_TOP
58 #else
59                 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE | wxFRAME_FLOAT_ON_PARENT
60 #endif
61                 )
62         , _timeline(this, film)
63 {
64         auto sizer = new wxBoxSizer(wxVERTICAL);
65         sizer->Add (&_timeline, 1, wxEXPAND | wxALL, 12);
66
67 #ifdef DCPOMATIC_LINUX
68         auto buttons = CreateSeparatedButtonSizer (wxCLOSE);
69         if (buttons) {
70                 sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
71         }
72 #endif
73
74         SetSizer(sizer);
75         sizer->Layout();
76         sizer->SetSizeHints(this);
77 }
78