2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2006-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
* Copyright (C) 2015-2016 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#ifndef __ardour_gtk_selection_h__
|
|
|
|
#define __ardour_gtk_selection_h__
|
|
|
|
|
2023-02-16 12:59:41 -05:00
|
|
|
#include <memory>
|
2006-03-05 14:39:16 -05:00
|
|
|
#include <vector>
|
2023-02-16 12:59:41 -05:00
|
|
|
|
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"
|
2021-11-10 18:37:15 -05:00
|
|
|
#include "trigger_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
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2005-09-25 14:42:24 -04:00
|
|
|
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;
|
2021-11-10 18:37:15 -05:00
|
|
|
TriggerSelection triggers;
|
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
|
|
|
|
2020-04-16 13:36:00 -04:00
|
|
|
/** we don't store MidiRegionViews in their own selection, we just pull
|
|
|
|
* them from "regions" as a convenience for various operations.
|
|
|
|
*/
|
|
|
|
MidiRegionSelection midi_regions();
|
|
|
|
|
2017-06-07 12:14:44 -04:00
|
|
|
Selection (PublicEditor const * e, bool manage_libardour_selection);
|
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
|
|
|
|
2018-02-11 10:39:45 -05:00
|
|
|
sigc::signal<void> TracksChanged;
|
2005-09-25 16:33:00 -04:00
|
|
|
sigc::signal<void> RegionsChanged;
|
|
|
|
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;
|
2021-11-10 18:37:15 -05:00
|
|
|
sigc::signal<void> TriggersChanged;
|
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();
|
|
|
|
|
2017-02-24 06:59:07 -05:00
|
|
|
bool selected (TimeAxisView*) const;
|
|
|
|
bool selected (RegionView*) const;
|
|
|
|
bool selected (ArdourMarker*) const;
|
|
|
|
bool selected (ControlPoint*) const;
|
2021-11-10 18:37:15 -05:00
|
|
|
bool selected (TriggerEntry*) const;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2021-12-01 09:06:30 -05:00
|
|
|
/* ToDo: some region operations (midi quantize, audio reverse) expect
|
|
|
|
* a RegionSelection (a list of regionviews). We're likely going to
|
|
|
|
* need a region_view + time_axis_view proxy, and this will get it.
|
|
|
|
*/
|
|
|
|
RegionSelection trigger_regionview_proxy () const;
|
|
|
|
|
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);
|
2006-07-31 23:23:35 -04:00
|
|
|
void set (std::vector<RegionView*>&);
|
2020-09-26 11:14:59 -04:00
|
|
|
long set (Temporal::timepos_t const &, Temporal::timepos_t const &);
|
2020-10-19 14:37:54 -04:00
|
|
|
void set_preserving_all_ranges (Temporal::timepos_t const &, Temporal::timepos_t const &);
|
2023-02-16 18:33:28 -05:00
|
|
|
void set (std::shared_ptr<Evoral::ControlList>);
|
|
|
|
void set (std::shared_ptr<ARDOUR::Playlist>);
|
|
|
|
void set (const std::list<std::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&);
|
2021-11-10 18:37:15 -05:00
|
|
|
void set (TriggerEntry*);
|
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-12 21:57:03 -04:00
|
|
|
void toggle (MidiCutBuffer*);
|
2006-07-31 23:23:35 -04:00
|
|
|
void toggle (std::vector<RegionView*>&);
|
2020-10-19 14:37:54 -04:00
|
|
|
long toggle (Temporal::timepos_t const &, Temporal::timepos_t const &);
|
2006-03-05 14:39:16 -05:00
|
|
|
void toggle (ARDOUR::AutomationList*);
|
2023-02-16 18:33:28 -05:00
|
|
|
void toggle (std::shared_ptr<ARDOUR::Playlist>);
|
|
|
|
void toggle (const std::list<std::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*);
|
2021-11-10 18:37:15 -05:00
|
|
|
void toggle (TriggerEntry*);
|
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-12 21:57:03 -04:00
|
|
|
void add (MidiCutBuffer*);
|
2006-07-31 23:23:35 -04:00
|
|
|
void add (std::vector<RegionView*>&);
|
2020-10-15 01:09:22 -04:00
|
|
|
long add (Temporal::timepos_t const &, Temporal::timepos_t const &);
|
2023-02-16 18:33:28 -05:00
|
|
|
void add (std::shared_ptr<Evoral::ControlList>);
|
|
|
|
void add (std::shared_ptr<ARDOUR::Playlist>);
|
|
|
|
void add (const std::list<std::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&);
|
2021-11-10 18:37:15 -05:00
|
|
|
void add (TriggerEntry*);
|
|
|
|
|
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*);
|
2021-06-03 17:35:09 -04:00
|
|
|
void remove (std::vector<RegionView*>);
|
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);
|
2017-09-18 12:39:17 -04:00
|
|
|
void remove (samplepos_t, samplepos_t);
|
2023-02-16 18:33:28 -05:00
|
|
|
void remove (std::shared_ptr<ARDOUR::AutomationList>);
|
|
|
|
void remove (std::shared_ptr<ARDOUR::Playlist>);
|
|
|
|
void remove (const std::list<std::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 *);
|
2021-11-10 18:37:15 -05:00
|
|
|
void remove (TriggerEntry*);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-01-03 20:03:36 -05:00
|
|
|
void remove_regions (TimeAxisView *);
|
|
|
|
|
2020-10-15 01:09:22 -04:00
|
|
|
void move_time (Temporal::timecnt_t const &);
|
2012-12-13 14:39:36 -05:00
|
|
|
|
2020-10-15 01:09:22 -04:00
|
|
|
void replace (uint32_t time_index, Temporal::timepos_t const & start, Temporal::timepos_t const & end);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-07-01 15:11:14 -04: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.
|
|
|
|
*/
|
2012-11-26 17:37:34 -05:00
|
|
|
|
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);
|
2021-11-29 17:27:51 -05:00
|
|
|
void clear_triggers (bool with_signal = true);
|
2021-11-10 18:37:15 -05: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
|
|
|
|
2017-05-05 07:31:49 -04:00
|
|
|
void core_selection_changed (PBD::PropertyChange const & pc);
|
|
|
|
|
2017-07-01 15:11:14 -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;
|
2017-06-07 12:14:44 -04:00
|
|
|
bool manage_libardour_selection;
|
2017-05-05 07:31:49 -04:00
|
|
|
|
|
|
|
TrackViewList add_grouped_tracks (TrackViewList const & t);
|
2005-09-25 14:42:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
bool operator==(const Selection& a, const Selection& b);
|
|
|
|
|
|
|
|
#endif /* __ardour_gtk_selection_h__ */
|