diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-10 12:53:28 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-29 01:10:11 +0200 |
| commit | d394f2a171235fcbd5bdaf07c3b9b91529368538 (patch) | |
| tree | 3c222790aba4c0f8905e1de03a2f01f0efe60f72 /src/wx/markers_panel.h | |
| parent | 7861a2f4fe15952d43323a64284afd71427d09f4 (diff) | |
Basic display of markers above the playback timeline (#1921).
Diffstat (limited to 'src/wx/markers_panel.h')
| -rw-r--r-- | src/wx/markers_panel.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/wx/markers_panel.h b/src/wx/markers_panel.h new file mode 100644 index 000000000..b88efa9a0 --- /dev/null +++ b/src/wx/markers_panel.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2021 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/>. + +*/ + + +#include "lib/dcpomatic_time.h" +#include "lib/film.h" +#include <wx/wx.h> +#include <map> + + +class wxTipWindow; + + +class MarkersPanel : public wxPanel +{ +public: + MarkersPanel (wxWindow* parent, std::weak_ptr<FilmViewer> viewer); + + void set_film (std::weak_ptr<Film> film); + +private: + void paint (); + void mouse_moved (wxMouseEvent& ev); + void mouse_left_down (); + void mouse_right_down (wxMouseEvent& ev); + int position (dcpomatic::DCPTime time, int width) const; + void move_marker_to_current_position (); + void remove_marker (); + void add_marker (wxCommandEvent& ev); + void film_changed (ChangeType type, Film::Property property); + void update_from_film (std::shared_ptr<Film> film); + + wxTipWindow* _tip = nullptr; + + class Marker { + public: + Marker () {} + + Marker (dcpomatic::DCPTime t, bool b) + : time (t) + , line_before_label (b) + {} + + dcpomatic::DCPTime time; + int width = 0; + bool line_before_label = false; + }; + + std::weak_ptr<Film> _film; + std::map<dcp::Marker, Marker> _markers; + boost::optional<dcp::Marker> _over; + std::weak_ptr<FilmViewer> _viewer; + boost::optional<dcp::Marker> _menu_marker; +}; + |
