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>
25 #include <boost/noncopyable.hpp>
27 #include <sigc++/signal.h>
29 #include "pbd/signals.h"
31 #include "time_selection.h"
32 #include "region_selection.h"
33 #include "track_selection.h"
34 #include "automation_selection.h"
35 #include "playlist_selection.h"
36 #include "processor_selection.h"
37 #include "point_selection.h"
38 #include "marker_selection.h"
39 #include "midi_selection.h"
59 /// Lists of selected things
61 /** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */
63 class Selection
: public sigc::trackable
, public PBD::ScopedConnectionList
78 TrackSelection tracks
;
79 RegionSelection regions
;
81 AutomationSelection lines
;
82 PlaylistSelection playlists
;
83 PointSelection points
;
84 MarkerSelection markers
;
85 MidiRegionSelection midi_regions
;
86 MidiNoteSelection midi_notes
;
88 Selection (PublicEditor
const * e
);
90 // Selection& operator= (const Selection& other);
92 sigc::signal
<void> RegionsChanged
;
93 sigc::signal
<void> TracksChanged
;
94 sigc::signal
<void> TimeChanged
;
95 sigc::signal
<void> LinesChanged
;
96 sigc::signal
<void> PlaylistsChanged
;
97 sigc::signal
<void> PointsChanged
;
98 sigc::signal
<void> MarkersChanged
;
99 sigc::signal
<void> MidiNotesChanged
;
100 sigc::signal
<void> MidiRegionsChanged
;
103 bool empty (bool internal_selection
= false);
105 void dump_region_layers();
107 bool selected (TimeAxisView
*);
108 bool selected (RegionView
*);
109 bool selected (Marker
*);
111 void set (std::list
<Selectable
*> const &);
112 void add (std::list
<Selectable
*> const &);
113 void toggle (std::list
<Selectable
*> const &);
115 void set (TimeAxisView
*);
116 void set (const TrackViewList
&);
117 void set (const MidiNoteSelection
&);
118 void set (RegionView
*, bool also_clear_tracks
= true);
119 void set (MidiRegionView
*);
120 void set (std::vector
<RegionView
*>&);
121 long set (nframes_t
, nframes_t
);
122 void set (boost::shared_ptr
<Evoral::ControlList
>);
123 void set (boost::shared_ptr
<ARDOUR::Playlist
>);
124 void set (const std::list
<boost::shared_ptr
<ARDOUR::Playlist
> >&);
125 void set (AutomationSelectable
*);
127 void set (const RegionSelection
&);
129 void toggle (TimeAxisView
*);
130 void toggle (const TrackViewList
&);
131 void toggle (const MidiNoteSelection
&);
132 void toggle (RegionView
*);
133 void toggle (MidiRegionView
*);
134 void toggle (MidiCutBuffer
*);
135 void toggle (std::vector
<RegionView
*>&);
136 long toggle (nframes_t
, nframes_t
);
137 void toggle (ARDOUR::AutomationList
*);
138 void toggle (boost::shared_ptr
<ARDOUR::Playlist
>);
139 void toggle (const std::list
<boost::shared_ptr
<ARDOUR::Playlist
> >&);
140 void toggle (const std::vector
<AutomationSelectable
*>&);
141 void toggle (Marker
*);
143 void add (TimeAxisView
*);
144 void add (const TrackViewList
&);
145 void add (const MidiNoteSelection
&);
146 void add (RegionView
*);
147 void add (MidiRegionView
*);
148 void add (MidiCutBuffer
*);
149 void add (std::vector
<RegionView
*>&);
150 long add (nframes_t
, nframes_t
);
151 void add (boost::shared_ptr
<Evoral::ControlList
>);
152 void add (boost::shared_ptr
<ARDOUR::Playlist
>);
153 void add (const std::list
<boost::shared_ptr
<ARDOUR::Playlist
> >&);
155 void add (const std::list
<Marker
*>&);
156 void add (const RegionSelection
&);
157 void remove (TimeAxisView
*);
158 void remove (const TrackViewList
&);
159 void remove (const MidiNoteSelection
&);
160 void remove (RegionView
*);
161 void remove (MidiRegionView
*);
162 void remove (MidiCutBuffer
*);
163 void remove (uint32_t selection_id
);
164 void remove (nframes_t
, nframes_t
);
165 void remove (boost::shared_ptr
<ARDOUR::AutomationList
>);
166 void remove (boost::shared_ptr
<ARDOUR::Playlist
>);
167 void remove (const std::list
<boost::shared_ptr
<ARDOUR::Playlist
> >&);
168 void remove (const std::list
<Selectable
*>&);
169 void remove (Marker
*);
171 void replace (uint32_t time_index
, nframes_t start
, nframes_t end
);
173 void clear_regions();
174 void clear_tracks ();
177 void clear_playlists ();
178 void clear_points ();
179 void clear_markers ();
180 void clear_midi_notes ();
181 void clear_midi_regions ();
183 void foreach_region (void (ARDOUR::Region::*method
)(void));
184 void foreach_regionview (void (RegionView::*method
)(void));
185 void foreach_midi_regionview (void (MidiRegionView::*method
)(void));
186 template<class A
> void foreach_region (void (ARDOUR::Region::*method
)(A
), A arg
);
189 PublicEditor
const * editor
;
190 uint32_t next_time_id
;
192 void add (std::vector
<AutomationSelectable
*>&);
195 bool operator==(const Selection
& a
, const Selection
& b
);
197 #endif /* __ardour_gtk_selection_h__ */