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 "pbd/scoped_connections.h"
30 #include "time_selection.h"
31 #include "region_selection.h"
32 #include "track_selection.h"
33 #include "automation_selection.h"
34 #include "playlist_selection.h"
35 #include "processor_selection.h"
36 #include "point_selection.h"
37 #include "marker_selection.h"
38 #include "midi_selection.h"
58 /// Lists of selected things
60 /** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */
62 class Selection : public sigc::trackable, public PBD::ScopedConnectionList
77 TrackSelection tracks;
78 RegionSelection regions;
80 AutomationSelection lines;
81 PlaylistSelection playlists;
82 PointSelection points;
83 MarkerSelection markers;
84 MidiRegionSelection midi_regions;
85 MidiNoteSelection midi_notes;
87 Selection (PublicEditor const * e) : tracks (e), editor (e), next_time_id (0) {
91 // Selection& operator= (const Selection& other);
93 sigc::signal<void> RegionsChanged;
94 sigc::signal<void> TracksChanged;
95 sigc::signal<void> TimeChanged;
96 sigc::signal<void> LinesChanged;
97 sigc::signal<void> PlaylistsChanged;
98 sigc::signal<void> PointsChanged;
99 sigc::signal<void> MarkersChanged;
100 sigc::signal<void> MidiNotesChanged;
101 sigc::signal<void> MidiRegionsChanged;
104 bool empty (bool internal_selection = false);
106 void dump_region_layers();
108 bool selected (TimeAxisView*);
109 bool selected (RegionView*);
110 bool selected (Marker*);
112 void set (std::list<Selectable*>&);
113 void add (std::list<Selectable*>&);
114 void toggle (std::list<Selectable*>&);
116 void set (TimeAxisView*);
117 void set (const TrackViewList&);
118 void set (const MidiNoteSelection&);
119 void set (RegionView*, bool also_clear_tracks = true);
120 void set (MidiRegionView*);
121 void set (std::vector<RegionView*>&);
122 long set (nframes_t, nframes_t);
123 void set (boost::shared_ptr<Evoral::ControlList>);
124 void set (boost::shared_ptr<ARDOUR::Playlist>);
125 void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
126 void set (AutomationSelectable*);
128 void set (const RegionSelection&);
130 void toggle (TimeAxisView*);
131 void toggle (const TrackViewList&);
132 void toggle (const MidiNoteSelection&);
133 void toggle (RegionView*);
134 void toggle (MidiRegionView*);
135 void toggle (MidiCutBuffer*);
136 void toggle (std::vector<RegionView*>&);
137 long toggle (nframes_t, nframes_t);
138 void toggle (ARDOUR::AutomationList*);
139 void toggle (boost::shared_ptr<ARDOUR::Playlist>);
140 void toggle (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
141 void toggle (const std::vector<AutomationSelectable*>&);
142 void toggle (Marker*);
144 void add (TimeAxisView*);
145 void add (const TrackViewList&);
146 void add (const MidiNoteSelection&);
147 void add (RegionView*);
148 void add (MidiRegionView*);
149 void add (MidiCutBuffer*);
150 void add (std::vector<RegionView*>&);
151 long add (nframes_t, nframes_t);
152 void add (boost::shared_ptr<Evoral::ControlList>);
153 void add (boost::shared_ptr<ARDOUR::Playlist>);
154 void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
156 void add (const std::list<Marker*>&);
157 void add (const RegionSelection&);
158 void remove (TimeAxisView*);
159 void remove (const TrackViewList&);
160 void remove (const MidiNoteSelection&);
161 void remove (RegionView*);
162 void remove (MidiRegionView*);
163 void remove (MidiCutBuffer*);
164 void remove (uint32_t selection_id);
165 void remove (nframes_t, nframes_t);
166 void remove (boost::shared_ptr<ARDOUR::AutomationList>);
167 void remove (boost::shared_ptr<ARDOUR::Playlist>);
168 void remove (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
169 void remove (const std::list<Selectable*>&);
170 void remove (Marker*);
172 void replace (uint32_t time_index, nframes_t start, nframes_t end);
174 void clear_regions();
175 void clear_tracks ();
178 void clear_playlists ();
179 void clear_points ();
180 void clear_markers ();
181 void clear_midi_notes ();
182 void clear_midi_regions ();
184 void foreach_region (void (ARDOUR::Region::*method)(void));
185 void foreach_regionview (void (RegionView::*method)(void));
186 void foreach_midi_regionview (void (MidiRegionView::*method)(void));
187 template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
190 Selection (const Selection& other) : tracks (other.tracks) {}
191 PublicEditor const * editor;
192 uint32_t next_time_id;
194 void add (std::vector<AutomationSelectable*>&);
197 bool operator==(const Selection& a, const Selection& b);
199 #endif /* __ardour_gtk_selection_h__ */