Zoom session when the mouse pointer is moved up and down during a playhead drag.
[ardour2.git] / gtk2_ardour / selection.h
blobac3c9330f0599890b3622746ecabe62e7e1b69c0
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>
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"
41 class TimeAxisView;
42 class RegionView;
43 class Selectable;
44 class PublicEditor;
45 class MidiRegionView;
46 class AutomationLine;
47 class ControlPoint;
50 namespace ARDOUR {
51 class Region;
52 class AudioRegion;
53 class Playlist;
54 class Processor;
55 class AutomationList;
58 namespace Evoral {
59 class ControlList;
62 /// Lists of selected things
64 /** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */
66 class Selection : public sigc::trackable, public PBD::ScopedConnectionList
68 public:
69 enum SelectionType {
70 Object = 0x1,
71 Range = 0x2
74 enum Operation {
75 Set,
76 Add,
77 Toggle,
78 Extend
81 TrackSelection tracks;
82 RegionSelection regions;
83 TimeSelection time;
84 AutomationSelection lines;
85 PlaylistSelection playlists;
86 PointSelection points;
87 MarkerSelection markers;
88 MidiRegionSelection midi_regions;
89 MidiNoteSelection midi_notes;
91 Selection (PublicEditor const * e);
93 // Selection& operator= (const Selection& other);
95 sigc::signal<void> RegionsChanged;
96 sigc::signal<void> TracksChanged;
97 sigc::signal<void> TimeChanged;
98 sigc::signal<void> LinesChanged;
99 sigc::signal<void> PlaylistsChanged;
100 sigc::signal<void> PointsChanged;
101 sigc::signal<void> MarkersChanged;
102 sigc::signal<void> MidiNotesChanged;
103 sigc::signal<void> MidiRegionsChanged;
105 void clear ();
106 bool empty (bool internal_selection = false);
108 void dump_region_layers();
110 bool selected (TimeAxisView*);
111 bool selected (RegionView*);
112 bool selected (Marker*);
114 void set (std::list<Selectable*> const &);
115 void add (std::list<Selectable*> const &);
116 void toggle (std::list<Selectable*> const &);
118 void set (TimeAxisView*);
119 void set (const TrackViewList&);
120 void set (const MidiNoteSelection&);
121 void set (RegionView*, bool also_clear_tracks = true);
122 void set (MidiRegionView*);
123 void set (std::vector<RegionView*>&);
124 long set (framepos_t, framepos_t);
125 void set_preserving_all_ranges (framepos_t, framepos_t);
126 void set (boost::shared_ptr<Evoral::ControlList>);
127 void set (boost::shared_ptr<ARDOUR::Playlist>);
128 void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
129 void set (ControlPoint *);
130 void set (Marker*);
131 void set (const RegionSelection&);
133 void toggle (TimeAxisView*);
134 void toggle (const TrackViewList&);
135 void toggle (const MidiNoteSelection&);
136 void toggle (RegionView*);
137 void toggle (MidiRegionView*);
138 void toggle (MidiCutBuffer*);
139 void toggle (std::vector<RegionView*>&);
140 long toggle (framepos_t, framepos_t);
141 void toggle (ARDOUR::AutomationList*);
142 void toggle (boost::shared_ptr<ARDOUR::Playlist>);
143 void toggle (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
144 void toggle (ControlPoint *);
145 void toggle (std::vector<ControlPoint*> const &);
146 void toggle (Marker*);
148 void add (TimeAxisView*);
149 void add (const TrackViewList&);
150 void add (const MidiNoteSelection&);
151 void add (RegionView*);
152 void add (MidiRegionView*);
153 void add (MidiCutBuffer*);
154 void add (std::vector<RegionView*>&);
155 long add (framepos_t, framepos_t);
156 void add (boost::shared_ptr<Evoral::ControlList>);
157 void add (boost::shared_ptr<ARDOUR::Playlist>);
158 void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
159 void add (ControlPoint *);
160 void add (std::vector<ControlPoint*> const &);
161 void add (Marker*);
162 void add (const std::list<Marker*>&);
163 void add (const RegionSelection&);
164 void remove (TimeAxisView*);
165 void remove (const TrackViewList&);
166 void remove (const MidiNoteSelection&);
167 void remove (RegionView*);
168 void remove (MidiRegionView*);
169 void remove (MidiCutBuffer*);
170 void remove (uint32_t selection_id);
171 void remove (framepos_t, framepos_t);
172 void remove (boost::shared_ptr<ARDOUR::AutomationList>);
173 void remove (boost::shared_ptr<ARDOUR::Playlist>);
174 void remove (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
175 void remove (const std::list<Selectable*>&);
176 void remove (Marker*);
178 void remove_regions (TimeAxisView *);
180 void replace (uint32_t time_index, framepos_t start, framepos_t end);
182 void clear_regions();
183 void clear_tracks ();
184 void clear_time();
185 void clear_lines ();
186 void clear_playlists ();
187 void clear_points ();
188 void clear_markers ();
189 void clear_midi_notes ();
190 void clear_midi_regions ();
192 void foreach_region (void (ARDOUR::Region::*method)(void));
193 void foreach_regionview (void (RegionView::*method)(void));
194 void foreach_midi_regionview (void (MidiRegionView::*method)(void));
195 template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
197 XMLNode& get_state () const;
198 int set_state (XMLNode const &, int);
200 private:
201 void set_point_selection_from_line (AutomationLine const &);
203 PublicEditor const * editor;
204 uint32_t next_time_id;
207 bool operator==(const Selection& a, const Selection& b);
209 #endif /* __ardour_gtk_selection_h__ */