2 Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <boost/shared_ptr.hpp>
21 #include <boost/weak_ptr.hpp>
22 #include <boost/signals2.hpp>
33 class Timeline : public wxPanel
36 Timeline (wxWindow *, FilmEditor *, boost::shared_ptr<Film>);
38 boost::shared_ptr<const Film> film () const;
40 void force_redraw (dcpomatic::Rect<int> const &);
42 int x_offset () const {
47 return GetSize().GetWidth ();
50 int track_height () const {
54 double pixels_per_time_unit () const {
55 return _pixels_per_time_unit;
58 Position<int> tracks_position () const {
59 return Position<int> (8, 8);
64 void setup_pixels_per_time_unit ();
67 void paint (wxPaintEvent &);
68 void left_down (wxMouseEvent &);
69 void left_up (wxMouseEvent &);
70 void right_down (wxMouseEvent &);
71 void mouse_moved (wxMouseEvent &);
72 void playlist_changed ();
73 void resized (wxSizeEvent &);
74 void assign_tracks ();
75 void set_start_from_event (wxMouseEvent &);
76 void clear_selection ();
78 void repeat (wxCommandEvent &);
79 void remove (wxCommandEvent &);
81 typedef std::vector<boost::shared_ptr<View> > ViewList;
82 typedef std::vector<boost::shared_ptr<ContentView> > ContentViewList;
84 boost::shared_ptr<View> event_to_view (wxMouseEvent &);
85 ContentViewList selected_views () const;
86 ContentList selected_content () const;
88 FilmEditor* _film_editor;
89 boost::weak_ptr<Film> _film;
91 boost::shared_ptr<TimeAxisView> _time_axis_view;
93 double _pixels_per_time_unit;
96 boost::shared_ptr<ContentView> _down_view;
97 Time _down_view_start;
101 boost::signals2::scoped_connection _playlist_connection;