diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-12-13 00:42:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-03-12 23:41:00 +0100 |
| commit | da46a695431d3b573924e53ac1a0163056a1a5b5 (patch) | |
| tree | 936e6ae61f3f1eac565e48babf169de1833f9ac8 /src/wx/dcp_timeline.h | |
| parent | 1d028a206c999bf61df84544e3aeb70cec4e505c (diff) | |
Add new interface for setting reel breaks (#2678).2678-reel-break
Diffstat (limited to 'src/wx/dcp_timeline.h')
| -rw-r--r-- | src/wx/dcp_timeline.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/wx/dcp_timeline.h b/src/wx/dcp_timeline.h new file mode 100644 index 000000000..3413c2814 --- /dev/null +++ b/src/wx/dcp_timeline.h @@ -0,0 +1,123 @@ +/* + Copyright (C) 2023 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#ifndef DCPOMATIC_DCP_TIMELINE_H +#define DCPOMATIC_DCP_TIMELINE_H + + +#include "timecode.h" +#include "timeline.h" +#include "lib/rect.h" +#include <dcp/warnings.h> +LIBDCP_DISABLE_WARNINGS +#include <wx/wx.h> +LIBDCP_ENABLE_WARNINGS +#include <memory> + + +class CheckBox; +class Choice; +class Film; +class ReelBoundary; +class SpinCtrl; +class wxGridBagSizer; + + +class DCPTimeline : public Timeline +{ +public: + DCPTimeline(wxWindow* parent, std::shared_ptr<Film> film); + + void force_redraw(dcpomatic::Rect<int> const &); + +private: + void paint(); + void paint_reels(wxGraphicsContext* gc); + void paint_content(wxGraphicsContext* gc); + void setup_pixels_per_second(); + void left_down(wxMouseEvent& ev); + void right_down(wxMouseEvent& ev); + void left_up(wxMouseEvent& ev); + void mouse_moved(wxMouseEvent& ev); + void reel_mode_changed(); + void maximum_reel_size_changed(); + void film_changed(ChangeType type, FilmProperty property); + std::shared_ptr<Film> film() const; + void setup_sensitivity(); + + void add_reel_boundary(); + void setup_reel_settings(); + void setup_reel_boundaries(); + std::shared_ptr<ReelBoundary> event_to_reel_boundary(wxMouseEvent& ev) const; + void set_reel_boundary(int index, dcpomatic::DCPTime time); + bool editable() const; + + std::weak_ptr<Film> _film; + + wxScrolledCanvas* _canvas; + + class Drag + { + public: + Drag( + std::shared_ptr<ReelBoundary> reel_boundary_, + std::vector<std::shared_ptr<ReelBoundary>> const& reel_boundaries, + std::shared_ptr<const Film> film, + int offset_, + bool snap, + dcpomatic::DCPTime snap_distance + ); + + std::shared_ptr<ReelBoundary> reel_boundary; + std::shared_ptr<ReelBoundary> previous; + std::shared_ptr<ReelBoundary> next; + int offset = 0; + + void set_time(dcpomatic::DCPTime time); + dcpomatic::DCPTime time() const; + + private: + std::vector<dcpomatic::DCPTime> _snaps; + dcpomatic::DCPTime _snap_distance; + }; + + boost::optional<Drag> _drag; + + wxPoint _right_down_position; + + wxPanel* _reel_settings; + Choice* _reel_type; + SpinCtrl* _maximum_reel_size; + CheckBox* _snap; + wxPanel* _reel_detail; + wxGridBagSizer* _reel_detail_sizer; + + wxMenu* _menu; + wxMenuItem* _add_reel_boundary; + + boost::signals2::scoped_connection _film_connection; + + std::vector<std::shared_ptr<ReelBoundary>> _reel_boundaries; +}; + + +#endif + |
