2 Copyright (C) 2023 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 #ifndef DCPOMATIC_DCP_TIMELINE_H
23 #define DCPOMATIC_DCP_TIMELINE_H
29 #include <dcp/warnings.h>
30 LIBDCP_DISABLE_WARNINGS
32 LIBDCP_ENABLE_WARNINGS
44 class DCPTimeline : public Timeline
47 DCPTimeline(wxWindow* parent, std::shared_ptr<Film> film);
49 void force_redraw(dcpomatic::Rect<int> const &);
53 void paint_reels(wxGraphicsContext* gc);
54 void paint_content(wxGraphicsContext* gc);
55 void setup_pixels_per_second();
56 void left_down(wxMouseEvent& ev);
57 void right_down(wxMouseEvent& ev);
58 void left_up(wxMouseEvent& ev);
59 void mouse_moved(wxMouseEvent& ev);
60 void reel_mode_changed();
61 void maximum_reel_size_changed();
62 void film_changed(ChangeType type, FilmProperty property);
63 std::shared_ptr<Film> film() const;
64 void setup_sensitivity();
66 void add_reel_boundary();
67 void setup_reel_settings();
68 void setup_reel_boundaries();
69 std::shared_ptr<ReelBoundary> event_to_reel_boundary(wxMouseEvent& ev) const;
70 void set_reel_boundary(int index, dcpomatic::DCPTime time);
71 bool editable() const;
73 std::weak_ptr<Film> _film;
75 wxScrolledCanvas* _canvas;
81 std::shared_ptr<ReelBoundary> reel_boundary_,
82 std::vector<std::shared_ptr<ReelBoundary>> const& reel_boundaries,
83 std::shared_ptr<const Film> film,
86 dcpomatic::DCPTime snap_distance
89 std::shared_ptr<ReelBoundary> reel_boundary;
90 std::shared_ptr<ReelBoundary> previous;
91 std::shared_ptr<ReelBoundary> next;
94 void set_time(dcpomatic::DCPTime time);
95 dcpomatic::DCPTime time() const;
98 std::vector<dcpomatic::DCPTime> _snaps;
99 dcpomatic::DCPTime _snap_distance;
102 boost::optional<Drag> _drag;
104 wxPoint _right_down_position;
106 wxPanel* _reel_settings;
108 SpinCtrl* _maximum_reel_size;
110 wxPanel* _reel_detail;
111 wxGridBagSizer* _reel_detail_sizer;
114 wxMenuItem* _add_reel_boundary;
116 boost::signals2::scoped_connection _film_connection;
118 std::vector<std::shared_ptr<ReelBoundary>> _reel_boundaries;