make private (non-usable) copy constructor for Selection compile, to follow changes...
[ardour.git] / gtk2_ardour / selection.h
1 /*
2     Copyright (C) 2000-2003 Paul Davis
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __ardour_gtk_selection_h__
21 #define __ardour_gtk_selection_h__
22
23 #include <vector>
24 #include <boost/shared_ptr.hpp>
25
26 #include <sigc++/signal.h>
27
28 #include "pbd/scoped_connections.h"
29
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"
39
40 class TimeAxisView;
41 class RegionView;
42 class Selectable;
43 class PublicEditor;
44 class MidiRegionView;
45
46 namespace ARDOUR {
47         class Region;
48         class AudioRegion;
49         class Playlist;
50         class Processor;
51         class AutomationList;
52 }
53
54 namespace Evoral {
55         class ControlList;
56 }
57
58 /// Lists of selected things
59
60 /** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */
61
62 class Selection : public sigc::trackable, public PBD::ScopedConnectionList
63 {
64   public:
65         enum SelectionType {
66                 Object = 0x1,
67                 Range = 0x2
68         };
69
70         enum Operation {
71                 Set,
72                 Add,
73                 Toggle,
74                 Extend
75         };
76
77         TrackSelection       tracks;
78         RegionSelection      regions;
79         TimeSelection        time;
80         AutomationSelection  lines;
81         PlaylistSelection    playlists;
82         PointSelection       points;
83         MarkerSelection      markers;
84         MidiRegionSelection  midi_regions;
85         MidiNoteSelection    midi_notes;
86
87         Selection (PublicEditor const * e) : tracks (e), editor (e), next_time_id (0) {
88                 clear();
89         }
90
91         // Selection& operator= (const Selection& other);
92
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;
102
103         void clear ();
104         bool empty (bool internal_selection = false);
105
106         void dump_region_layers();
107
108         bool selected (TimeAxisView*);
109         bool selected (RegionView*);
110         bool selected (Marker*);
111
112         void set (std::list<Selectable*>&);
113         void add (std::list<Selectable*>&);
114         void toggle (std::list<Selectable*>&);
115
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*);
127         void set (Marker*);
128         void set (const RegionSelection&);
129
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*);
143
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> >&);
155         void add (Marker*);
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*);
171
172         void replace (uint32_t time_index, nframes_t start, nframes_t end);
173
174         void clear_regions();
175         void clear_tracks ();
176         void clear_time();
177         void clear_lines ();
178         void clear_playlists ();
179         void clear_points ();
180         void clear_markers ();
181         void clear_midi_notes ();
182         void clear_midi_regions ();
183
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);
188
189   private:
190         Selection (const Selection& other) : tracks (other.tracks) {}
191         PublicEditor const * editor;
192         uint32_t next_time_id;
193         
194         void add (std::vector<AutomationSelectable*>&);
195 };
196
197 bool operator==(const Selection& a, const Selection& b);
198
199 #endif /* __ardour_gtk_selection_h__ */