fix keyboard event handling for host-provided plugin GUIs
[ardour2.git] / gtk2_ardour / selection.h
blob82ceb969a38c09ef6b6198a7b5ce50890f1650bd
1 /*
2 Copyright (C) 2000-2003 Paul Davis
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 #ifndef __ardour_gtk_selection_h__
21 #define __ardour_gtk_selection_h__
23 #include <vector>
24 #include <boost/shared_ptr.hpp>
26 #include <sigc++/signal.h>
28 #include "time_selection.h"
29 #include "region_selection.h"
30 #include "track_selection.h"
31 #include "automation_selection.h"
32 #include "playlist_selection.h"
33 #include "redirect_selection.h"
34 #include "point_selection.h"
35 #include "marker_selection.h"
37 class TimeAxisView;
38 class RegionView;
39 class Selectable;
41 namespace ARDOUR {
42 class Region;
43 class AudioRegion;
44 class Playlist;
45 class Redirect;
46 class AutomationList;
49 class Selection : public sigc::trackable
51 public:
52 enum SelectionType {
53 Object = 0x1,
54 Range = 0x2
57 enum Operation {
58 Set,
59 Add,
60 Toggle,
61 Extend
64 TrackSelection tracks;
65 RegionSelection regions;
66 TimeSelection time;
67 AutomationSelection lines;
68 PlaylistSelection playlists;
69 RedirectSelection redirects;
70 PointSelection points;
71 MarkerSelection markers;
73 Selection() {
74 next_time_id = 0;
75 clear();
78 Selection& operator= (const Selection& other);
80 sigc::signal<void> RegionsChanged;
81 sigc::signal<void> TracksChanged;
82 sigc::signal<void> TimeChanged;
83 sigc::signal<void> LinesChanged;
84 sigc::signal<void> PlaylistsChanged;
85 sigc::signal<void> RedirectsChanged;
86 sigc::signal<void> PointsChanged;
87 sigc::signal<void> MarkersChanged;
89 void clear ();
90 bool empty();
92 void dump_region_layers();
94 bool selected (TimeAxisView*);
95 bool selected (RegionView*);
96 bool selected (Marker*);
98 void set (std::list<Selectable*>&);
99 void add (std::list<Selectable*>&);
100 void toggle (std::list<Selectable*>&);
102 void set (TimeAxisView*);
103 void set (const std::list<TimeAxisView*>&);
104 void set (RegionView*, bool also_clear_tracks = true);
105 void set (std::vector<RegionView*>&);
106 long set (TimeAxisView*, nframes_t, nframes_t);
107 void set (ARDOUR::AutomationList*);
108 void set (boost::shared_ptr<ARDOUR::Playlist>);
109 void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
110 void set (boost::shared_ptr<ARDOUR::Redirect>);
111 void set (AutomationSelectable*);
112 void set (Marker*);
113 void set (const RegionSelection&);
115 void toggle (TimeAxisView*);
116 void toggle (const std::list<TimeAxisView*>&);
117 void toggle (RegionView*);
118 void toggle (std::vector<RegionView*>&);
119 long toggle (nframes_t, nframes_t);
120 void toggle (ARDOUR::AutomationList*);
121 void toggle (boost::shared_ptr<ARDOUR::Playlist>);
122 void toggle (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
123 void toggle (boost::shared_ptr<ARDOUR::Redirect>);
124 void toggle (const std::vector<AutomationSelectable*>&);
125 void toggle (Marker*);
127 void add (TimeAxisView*);
128 void add (const std::list<TimeAxisView*>&);
129 void add (RegionView*);
130 void add (std::vector<RegionView*>&);
131 long add (nframes_t, nframes_t);
132 void add (ARDOUR::AutomationList*);
133 void add (boost::shared_ptr<ARDOUR::Playlist>);
134 void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
135 void add (boost::shared_ptr<ARDOUR::Redirect>);
136 void add (Marker*);
137 void add (const std::list<Marker*>&);
138 void add (const RegionSelection&);
140 void remove (TimeAxisView*);
141 void remove (const std::list<TimeAxisView*>&);
142 void remove (RegionView*);
143 void remove (uint32_t selection_id);
144 void remove (nframes_t, nframes_t);
145 void remove (ARDOUR::AutomationList*);
146 void remove (boost::shared_ptr<ARDOUR::Playlist>);
147 void remove (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
148 void remove (boost::shared_ptr<ARDOUR::Redirect>);
149 void remove (const list<Selectable*>&);
150 void remove (Marker*);
152 void replace (uint32_t time_index, nframes_t start, nframes_t end);
154 void clear_regions();
155 void clear_tracks ();
156 void clear_time();
157 void clear_lines ();
158 void clear_playlists ();
159 void clear_redirects ();
160 void clear_points ();
161 void clear_markers ();
163 void foreach_region (void (ARDOUR::Region::*method)(void));
164 template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
166 private:
167 uint32_t next_time_id;
169 void add (std::vector<AutomationSelectable*>&);
172 bool operator==(const Selection& a, const Selection& b);
174 #endif /* __ardour_gtk_selection_h__ */