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__
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 "processor_selection.h"
34 #include "point_selection.h"
35 #include "marker_selection.h"
36 #include "midi_selection.h"
56 /// Lists of selected things
58 /** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */
60 class Selection : public sigc::trackable
75 TrackSelection tracks;
76 RegionSelection regions;
78 AutomationSelection lines;
79 PlaylistSelection playlists;
80 PointSelection points;
81 MarkerSelection markers;
82 MidiRegionSelection midi_regions;
83 MidiNoteSelection midi_notes;
85 Selection (PublicEditor const * e) : editor (e), next_time_id (0) {
89 Selection& operator= (const Selection& other);
91 sigc::signal<void> RegionsChanged;
92 sigc::signal<void> TracksChanged;
93 sigc::signal<void> TimeChanged;
94 sigc::signal<void> LinesChanged;
95 sigc::signal<void> PlaylistsChanged;
96 sigc::signal<void> PointsChanged;
97 sigc::signal<void> MarkersChanged;
98 sigc::signal<void> MidiNotesChanged;
99 sigc::signal<void> MidiRegionsChanged;
102 bool empty (bool internal_selection = false);
104 void dump_region_layers();
106 bool selected (TimeAxisView*);
107 bool selected (RegionView*);
108 bool selected (Marker*);
110 void set (std::list<Selectable*>&);
111 void add (std::list<Selectable*>&);
112 void toggle (std::list<Selectable*>&);
114 void set (TimeAxisView*);
115 void set (const std::list<TimeAxisView*>&);
116 void set (const MidiNoteSelection&);
117 void set (RegionView*, bool also_clear_tracks = true);
118 void set (MidiRegionView*);
119 void set (std::vector<RegionView*>&);
120 long set (TimeAxisView*, nframes_t, nframes_t);
121 void set (boost::shared_ptr<Evoral::ControlList>);
122 void set (boost::shared_ptr<ARDOUR::Playlist>);
123 void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
124 void set (AutomationSelectable*);
126 void set (const RegionSelection&);
128 void toggle (TimeAxisView*);
129 void toggle (const std::list<TimeAxisView*>&);
130 void toggle (const MidiNoteSelection&);
131 void toggle (RegionView*);
132 void toggle (MidiRegionView*);
133 void toggle (MidiCutBuffer*);
134 void toggle (std::vector<RegionView*>&);
135 long toggle (nframes_t, nframes_t);
136 void toggle (ARDOUR::AutomationList*);
137 void toggle (boost::shared_ptr<ARDOUR::Playlist>);
138 void toggle (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
139 void toggle (const std::vector<AutomationSelectable*>&);
140 void toggle (Marker*);
142 void add (TimeAxisView*);
143 void add (const std::list<TimeAxisView*>&);
144 void add (const MidiNoteSelection&);
145 void add (RegionView*);
146 void add (MidiRegionView*);
147 void add (MidiCutBuffer*);
148 void add (std::vector<RegionView*>&);
149 long add (nframes_t, nframes_t);
150 void add (boost::shared_ptr<Evoral::ControlList>);
151 void add (boost::shared_ptr<ARDOUR::Playlist>);
152 void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
154 void add (const std::list<Marker*>&);
155 void add (const RegionSelection&);
156 void remove (TimeAxisView*);
157 void remove (const std::list<TimeAxisView*>&);
158 void remove (const MidiNoteSelection&);
159 void remove (RegionView*);
160 void remove (MidiRegionView*);
161 void remove (MidiCutBuffer*);
162 void remove (uint32_t selection_id);
163 void remove (nframes_t, nframes_t);
164 void remove (boost::shared_ptr<ARDOUR::AutomationList>);
165 void remove (boost::shared_ptr<ARDOUR::Playlist>);
166 void remove (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
167 void remove (const std::list<Selectable*>&);
168 void remove (Marker*);
170 void replace (uint32_t time_index, nframes_t start, nframes_t end);
172 void clear_regions();
173 void clear_tracks ();
176 void clear_playlists ();
177 void clear_points ();
178 void clear_markers ();
179 void clear_midi_notes ();
180 void clear_midi_regions ();
182 void foreach_region (void (ARDOUR::Region::*method)(void));
183 void foreach_regionview (void (RegionView::*method)(void));
184 void foreach_midi_regionview (void (MidiRegionView::*method)(void));
185 template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
188 PublicEditor const * editor;
189 uint32_t next_time_id;
191 void add (std::vector<AutomationSelectable*>&);
194 bool operator==(const Selection& a, const Selection& b);
196 #endif /* __ardour_gtk_selection_h__ */