2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000-2003 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_gtk_selection_h__
|
|
|
|
#define __ardour_gtk_selection_h__
|
|
|
|
|
2006-03-05 14:39:16 -05:00
|
|
|
#include <vector>
|
2006-07-27 12:52:14 -04:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2009-12-19 15:26:31 -05:00
|
|
|
#include <boost/noncopyable.hpp>
|
2006-03-05 14:39:16 -05:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <sigc++/signal.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "time_selection.h"
|
|
|
|
#include "region_selection.h"
|
|
|
|
#include "track_selection.h"
|
|
|
|
#include "automation_selection.h"
|
|
|
|
#include "playlist_selection.h"
|
2007-06-27 16:23:48 -04:00
|
|
|
#include "processor_selection.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "point_selection.h"
|
2007-11-07 20:40:25 -05:00
|
|
|
#include "marker_selection.h"
|
2009-08-10 15:29:29 -04:00
|
|
|
#include "midi_selection.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
class TimeAxisView;
|
2006-07-31 23:23:35 -04:00
|
|
|
class RegionView;
|
2005-09-25 14:42:24 -04:00
|
|
|
class Selectable;
|
2007-10-07 11:51:14 -04:00
|
|
|
class PublicEditor;
|
2009-08-10 15:29:29 -04:00
|
|
|
class MidiRegionView;
|
2010-08-10 21:23:03 -04:00
|
|
|
class AutomationLine;
|
|
|
|
class ControlPoint;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-05 14:39:16 -05:00
|
|
|
namespace ARDOUR {
|
|
|
|
class Region;
|
|
|
|
class AudioRegion;
|
|
|
|
class Playlist;
|
2007-06-27 16:23:48 -04:00
|
|
|
class Processor;
|
2006-03-05 14:39:16 -05:00
|
|
|
class AutomationList;
|
|
|
|
}
|
|
|
|
|
2008-09-18 20:47:49 -04:00
|
|
|
namespace Evoral {
|
|
|
|
class ControlList;
|
|
|
|
}
|
|
|
|
|
2007-05-10 07:53:35 -04:00
|
|
|
/// Lists of selected things
|
|
|
|
|
|
|
|
/** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
class Selection : public sigc::trackable, public PBD::ScopedConnectionList
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum SelectionType {
|
|
|
|
Object = 0x1,
|
|
|
|
Range = 0x2
|
|
|
|
};
|
|
|
|
|
2006-03-05 14:39:16 -05:00
|
|
|
enum Operation {
|
|
|
|
Set,
|
2006-11-09 15:38:39 -05:00
|
|
|
Add,
|
2006-03-05 14:39:16 -05:00
|
|
|
Toggle,
|
|
|
|
Extend
|
|
|
|
};
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
TrackSelection tracks;
|
2006-07-31 23:23:35 -04:00
|
|
|
RegionSelection regions;
|
2005-09-25 14:42:24 -04:00
|
|
|
TimeSelection time;
|
|
|
|
AutomationSelection lines;
|
|
|
|
PlaylistSelection playlists;
|
|
|
|
PointSelection points;
|
2007-11-07 20:40:25 -05:00
|
|
|
MarkerSelection markers;
|
2009-08-12 21:57:03 -04:00
|
|
|
MidiRegionSelection midi_regions;
|
2011-07-08 11:28:19 -04:00
|
|
|
|
|
|
|
/** only used when this class is used as a cut buffer */
|
2009-08-12 21:57:03 -04:00
|
|
|
MidiNoteSelection midi_notes;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-25 16:06:52 -05:00
|
|
|
Selection (PublicEditor const * e);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
// Selection& operator= (const Selection& other);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
sigc::signal<void> RegionsChanged;
|
|
|
|
sigc::signal<void> TracksChanged;
|
|
|
|
sigc::signal<void> TimeChanged;
|
|
|
|
sigc::signal<void> LinesChanged;
|
|
|
|
sigc::signal<void> PlaylistsChanged;
|
|
|
|
sigc::signal<void> PointsChanged;
|
2007-11-07 20:40:25 -05:00
|
|
|
sigc::signal<void> MarkersChanged;
|
2009-08-12 21:57:03 -04:00
|
|
|
sigc::signal<void> MidiNotesChanged;
|
|
|
|
sigc::signal<void> MidiRegionsChanged;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-11-15 14:33:09 -05:00
|
|
|
void block_tracks_changed (bool);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void clear ();
|
2016-04-11 08:06:26 -04:00
|
|
|
|
|
|
|
/** check if all selections are empty
|
|
|
|
* @param internal_selection also check object internals (e.g midi notes, automation points), when false only check objects.
|
|
|
|
* @return true if nothing is selected.
|
|
|
|
*/
|
2009-08-12 21:57:03 -04:00
|
|
|
bool empty (bool internal_selection = false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
void dump_region_layers();
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
bool selected (TimeAxisView*);
|
2006-07-31 23:23:35 -04:00
|
|
|
bool selected (RegionView*);
|
2015-07-23 07:23:47 -04:00
|
|
|
bool selected (ArdourMarker*);
|
2012-05-31 10:39:48 -04:00
|
|
|
bool selected (ControlPoint*);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-01-04 21:22:58 -05:00
|
|
|
void set (std::list<Selectable*> const &);
|
|
|
|
void add (std::list<Selectable*> const &);
|
|
|
|
void toggle (std::list<Selectable*> const &);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
void set (TimeAxisView*);
|
2009-12-13 14:09:52 -05:00
|
|
|
void set (const TrackViewList&);
|
2009-08-12 21:57:03 -04:00
|
|
|
void set (const MidiNoteSelection&);
|
2008-01-10 16:20:59 -05:00
|
|
|
void set (RegionView*, bool also_clear_tracks = true);
|
2009-08-10 15:29:29 -04:00
|
|
|
void set (MidiRegionView*);
|
2006-07-31 23:23:35 -04:00
|
|
|
void set (std::vector<RegionView*>&);
|
2010-12-03 17:26:29 -05:00
|
|
|
long set (framepos_t, framepos_t);
|
2011-04-17 09:55:41 -04:00
|
|
|
void set_preserving_all_ranges (framepos_t, framepos_t);
|
2008-09-18 20:47:49 -04:00
|
|
|
void set (boost::shared_ptr<Evoral::ControlList>);
|
2006-12-14 09:15:43 -05:00
|
|
|
void set (boost::shared_ptr<ARDOUR::Playlist>);
|
2007-01-17 23:34:00 -05:00
|
|
|
void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
|
2010-08-10 21:23:03 -04:00
|
|
|
void set (ControlPoint *);
|
2015-07-23 07:23:47 -04:00
|
|
|
void set (ArdourMarker*);
|
2008-01-10 16:20:59 -05:00
|
|
|
void set (const RegionSelection&);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
void toggle (TimeAxisView*);
|
2009-12-13 14:09:52 -05:00
|
|
|
void toggle (const TrackViewList&);
|
2009-08-12 21:57:03 -04:00
|
|
|
void toggle (const MidiNoteSelection&);
|
2006-07-31 23:23:35 -04:00
|
|
|
void toggle (RegionView*);
|
2009-08-10 15:29:29 -04:00
|
|
|
void toggle (MidiRegionView*);
|
2009-08-12 21:57:03 -04:00
|
|
|
void toggle (MidiCutBuffer*);
|
2006-07-31 23:23:35 -04:00
|
|
|
void toggle (std::vector<RegionView*>&);
|
2010-12-03 17:26:29 -05:00
|
|
|
long toggle (framepos_t, framepos_t);
|
2006-03-05 14:39:16 -05:00
|
|
|
void toggle (ARDOUR::AutomationList*);
|
2006-12-14 09:15:43 -05:00
|
|
|
void toggle (boost::shared_ptr<ARDOUR::Playlist>);
|
2007-01-17 23:34:00 -05:00
|
|
|
void toggle (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
|
2010-08-10 21:23:03 -04:00
|
|
|
void toggle (ControlPoint *);
|
|
|
|
void toggle (std::vector<ControlPoint*> const &);
|
2015-07-23 07:23:47 -04:00
|
|
|
void toggle (ArdourMarker*);
|
2006-03-05 14:39:16 -05:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
void add (TimeAxisView*);
|
2009-12-13 14:09:52 -05:00
|
|
|
void add (const TrackViewList&);
|
2009-08-12 21:57:03 -04:00
|
|
|
void add (const MidiNoteSelection&);
|
2006-07-31 23:23:35 -04:00
|
|
|
void add (RegionView*);
|
2009-08-10 15:29:29 -04:00
|
|
|
void add (MidiRegionView*);
|
2009-08-12 21:57:03 -04:00
|
|
|
void add (MidiCutBuffer*);
|
2006-07-31 23:23:35 -04:00
|
|
|
void add (std::vector<RegionView*>&);
|
2010-12-03 17:26:29 -05:00
|
|
|
long add (framepos_t, framepos_t);
|
2008-09-18 20:47:49 -04:00
|
|
|
void add (boost::shared_ptr<Evoral::ControlList>);
|
2006-12-14 09:15:43 -05:00
|
|
|
void add (boost::shared_ptr<ARDOUR::Playlist>);
|
2007-01-17 23:34:00 -05:00
|
|
|
void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
|
2010-08-10 21:23:03 -04:00
|
|
|
void add (ControlPoint *);
|
|
|
|
void add (std::vector<ControlPoint*> const &);
|
2015-07-23 07:23:47 -04:00
|
|
|
void add (ArdourMarker*);
|
|
|
|
void add (const std::list<ArdourMarker*>&);
|
2008-01-10 16:20:59 -05:00
|
|
|
void add (const RegionSelection&);
|
2012-04-22 10:03:07 -04:00
|
|
|
void add (const PointSelection&);
|
2009-07-09 13:58:13 -04:00
|
|
|
void remove (TimeAxisView*);
|
2009-12-13 14:09:52 -05:00
|
|
|
void remove (const TrackViewList&);
|
2009-08-12 21:57:03 -04:00
|
|
|
void remove (const MidiNoteSelection&);
|
2006-07-31 23:23:35 -04:00
|
|
|
void remove (RegionView*);
|
2009-08-10 15:29:29 -04:00
|
|
|
void remove (MidiRegionView*);
|
2009-08-12 21:57:03 -04:00
|
|
|
void remove (MidiCutBuffer*);
|
2005-09-25 14:42:24 -04:00
|
|
|
void remove (uint32_t selection_id);
|
2010-12-03 17:26:29 -05:00
|
|
|
void remove (framepos_t, framepos_t);
|
2008-09-18 20:47:49 -04:00
|
|
|
void remove (boost::shared_ptr<ARDOUR::AutomationList>);
|
2006-12-14 09:15:43 -05:00
|
|
|
void remove (boost::shared_ptr<ARDOUR::Playlist>);
|
2007-01-17 23:34:00 -05:00
|
|
|
void remove (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
|
2009-05-12 13:03:42 -04:00
|
|
|
void remove (const std::list<Selectable*>&);
|
2015-07-23 07:23:47 -04:00
|
|
|
void remove (ArdourMarker*);
|
2012-04-22 10:03:07 -04:00
|
|
|
void remove (ControlPoint *);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-01-03 20:03:36 -05:00
|
|
|
void remove_regions (TimeAxisView *);
|
|
|
|
|
2012-12-13 14:39:36 -05:00
|
|
|
void move_time (framecnt_t);
|
|
|
|
|
2010-12-03 17:26:29 -05:00
|
|
|
void replace (uint32_t time_index, framepos_t start, framepos_t end);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-11-26 17:37:34 -05:00
|
|
|
/*
|
|
|
|
* A note about items in an editing Selection:
|
|
|
|
* At a high level, selections can include Tracks, Objects, or Time Ranges
|
|
|
|
* Range and Object selections are mutually exclusive.
|
|
|
|
* Selecting a Range will deselect all Objects, and vice versa.
|
|
|
|
* This is done to avoid confusion over what will happen in an operation such as Delete
|
|
|
|
* Tracks are somewhat orthogonal b/c editing operations don't apply to tracks.
|
|
|
|
* The Track selection isn't affected when ranges or objects are added.
|
|
|
|
*/
|
|
|
|
|
2014-12-12 18:16:50 -05:00
|
|
|
void clear_all() { clear_time(); clear_tracks(); clear_objects(); }
|
|
|
|
|
2016-01-29 16:05:03 -05:00
|
|
|
void clear_time(bool with_signal = true); //clears any time selection ( i.e. Range )
|
|
|
|
void clear_tracks (bool with_signal = true); //clears the track header selections
|
|
|
|
void clear_objects(bool with_signal = true); //clears the items listed below
|
2012-11-26 17:37:34 -05:00
|
|
|
|
|
|
|
// these items get cleared wholesale in clear_objects
|
2016-01-29 16:05:03 -05:00
|
|
|
void clear_regions(bool with_signal = true);
|
|
|
|
void clear_lines (bool with_signal = true);
|
|
|
|
void clear_playlists (bool with_signal = true);
|
|
|
|
void clear_points (bool with_signal = true);
|
|
|
|
void clear_markers (bool with_signal = true);
|
|
|
|
void clear_midi_notes (bool with_signal = true);
|
|
|
|
void clear_midi_regions (bool with_signal = true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-31 23:23:35 -04:00
|
|
|
void foreach_region (void (ARDOUR::Region::*method)(void));
|
2007-05-10 07:53:35 -04:00
|
|
|
void foreach_regionview (void (RegionView::*method)(void));
|
2009-08-26 23:09:30 -04:00
|
|
|
void foreach_midi_regionview (void (MidiRegionView::*method)(void));
|
2006-07-31 23:23:35 -04:00
|
|
|
template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-08-17 22:20:15 -04:00
|
|
|
XMLNode& get_state () const;
|
|
|
|
int set_state (XMLNode const &, int);
|
|
|
|
|
2016-10-15 08:50:02 -04:00
|
|
|
std::list<std::pair<PBD::ID const, std::list<Evoral::event_id_t> > > pending_midi_note_selection;
|
2015-01-10 12:07:31 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
private:
|
2007-10-07 11:51:14 -04:00
|
|
|
PublicEditor const * editor;
|
2005-09-25 14:42:24 -04:00
|
|
|
uint32_t next_time_id;
|
2011-11-15 14:33:09 -05:00
|
|
|
bool _no_tracks_changed;
|
2005-09-25 14:42:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
bool operator==(const Selection& a, const Selection& b);
|
|
|
|
|
|
|
|
#endif /* __ardour_gtk_selection_h__ */
|