21 #include <sigc++/bind.h>
55 , _no_tracks_changed (false)
73 Selection::operator= (
const Selection& other)
130 for (TrackViewList::iterator x =
tracks.begin(); x !=
tracks.end(); ++x) {
131 (*x)->set_selected (
false);
151 cerr <<
"region selection layer dump" << endl;
152 for (RegionSelection::iterator i =
regions.begin(); i !=
regions.end(); ++i) {
153 cerr <<
"layer: " << (int)(*i)->region()->layer() << endl;
199 (*i)->drop_regions ();
212 if (!
lines.empty()) {
233 PlaylistSelection::iterator i;
248 for (TrackViewList::const_iterator i = track_list.begin(); i != track_list.end(); ++i) {
256 TrackSelection::iterator i;
277 for (MidiNoteSelection::const_iterator i = midi_note_list.begin(); i != midi_note_list.end(); ++i) {
285 MidiNoteSelection::iterator i;
305 RegionSelection::iterator i;
322 MidiRegionSelection::iterator i;
339 RegionSelection::iterator i;
341 for (vector<RegionView*>::iterator x = r.begin(); x != r.end(); ++x) {
389 bool changed =
false;
411 if (!added.empty()) {
412 for (TrackViewList::iterator x = added.begin(); x != added.end(); ++x) {
413 (*x)->set_selected (
true);
428 tr.push_back (track);
438 const MidiNoteSelection::const_iterator b = midi_list.begin();
439 const MidiNoteSelection::const_iterator e = midi_list.end();
441 if (!midi_list.empty()) {
467 bool changed =
false;
469 for (vector<RegionView*>::iterator i = v.begin(); i != v.end(); ++i) {
489 bool changed =
false;
491 for (RegionSelection::const_iterator i = rs.begin(); i != rs.end(); ++i) {
554 for (list<AudioRange>::iterator i =
time.begin(); i !=
time.end(); ++i) {
555 (*i).start += distance;
556 (*i).end += distance;
567 for (list<AudioRange>::iterator i =
time.begin(); i !=
time.end(); ++i) {
568 if ((*i).id == sid) {
593 warning <<
"Programming error: Selected list is not an ARDOUR::AutomationList" <<
endmsg;
597 lines.push_back (al);
605 list<TimeAxisView*>::iterator i;
618 bool changed =
false;
620 for (TrackViewList::const_iterator i = track_list.begin(); i != track_list.end(); ++i) {
622 TrackViewList::iterator x = find (
tracks.begin(),
tracks.end(), *i);
624 (*i)->set_selected (
false);
640 PointSelection::iterator i = find (
points.begin(),
points.end(), p);
649 bool changed =
false;
651 for (MidiNoteSelection::const_iterator i = midi_list.begin(); i != midi_list.end(); ++i) {
653 MidiNoteSelection::iterator x;
669 MidiNoteSelection::iterator x;
682 list<boost::shared_ptr<Playlist> >::iterator i;
692 bool changed =
false;
696 list<boost::shared_ptr<Playlist> >::iterator x;
720 MidiRegionSelection::iterator x;
736 for (list<AudioRange>::iterator i =
time.begin(); i !=
time.end(); ++i) {
737 if ((*i).id == selection_id) {
754 AutomationSelection::iterator i;
850 if ((start == 0 && end == 0) || end < start) {
859 while (
time.size() > 1) {
863 time.front().end = end;
870 return time.front().id;
886 if ((start == 0 && end == 0) || (end < start)) {
895 time.back().end = end;
940 bool object_level_empty =
regions.empty () &&
951 if (!internal_selection) {
952 return object_level_empty;
969 PointSelection::iterator i = find (
points.begin(),
points.end(), cp);
985 for (vector<ControlPoint*>::const_iterator i = cps.begin(); i != cps.end(); ++i) {
998 vector<RegionView*> rvs;
999 vector<ControlPoint*> cps;
1001 for (std::list<Selectable*>::const_iterator i = selectables.begin(); i != selectables.end(); ++i) {
1002 if ((rv = dynamic_cast<RegionView*> (*i)) != 0) {
1004 }
else if ((cp = dynamic_cast<ControlPoint*> (*i)) != 0) {
1007 fatal <<
_(
"programming error: ")
1008 <<
X_(
"unknown selectable type passed to Selection::toggle()")
1039 for (PointSelection::const_iterator i = s.begin(); i != s.end(); ++i) {
1052 vector<RegionView*> rvs;
1053 vector<ControlPoint*> cps;
1055 for (std::list<Selectable*>::const_iterator i = selectables.begin(); i != selectables.end(); ++i) {
1056 if ((rv = dynamic_cast<RegionView*> (*i)) != 0) {
1058 }
else if ((cp = dynamic_cast<ControlPoint*> (*i)) != 0) {
1061 fatal <<
_(
"programming error: ")
1062 <<
X_(
"unknown selectable type passed to Selection::add()")
1103 for (vector<ControlPoint*>::const_iterator i = cps.begin(); i != cps.end(); ++i) {
1104 (*i)->set_selected (
true);
1120 for (uint32_t i = 0; i < cp->
line().
npoints(); ++i) {
1141 MarkerSelection::iterator i;
1153 MarkerSelection::iterator i;
1192 for (MarkerSelection::iterator i = begin(); i != end(); ++i) {
1194 if ((*i)->position() < s) {
1195 s = (*i)->position();
1198 if ((*i)->position() > e) {
1199 e = (*i)->position();
1203 s = std::min (s, e);
1204 e = std::max (s, e);
1217 for (TrackSelection::const_iterator i =
tracks.begin(); i !=
tracks.end(); ++i) {
1230 for (RegionSelection::const_iterator i =
regions.begin(); i !=
regions.end(); ++i) {
1237 list<pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > > rid_notes;
1239 if (!rid_notes.empty()) {
1242 list<pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > >::iterator rn_it;
1243 for (rn_it = rid_notes.begin(); rn_it != rid_notes.end(); ++rn_it) {
1249 snprintf(buf,
sizeof(buf),
"%d", (*i)->channel());
1252 snprintf(buf,
sizeof(buf),
"%f", (*i)->time().to_double());
1255 snprintf(buf,
sizeof(buf),
"%d", (*i)->note());
1258 snprintf(buf,
sizeof(buf),
"%f", (*i)->length().to_double());
1261 snprintf(buf,
sizeof(buf),
"%d", (*i)->velocity());
1264 snprintf(buf,
sizeof(buf),
"%d", (*i)->off_velocity());
1269 for (PointSelection::const_iterator i =
points.begin(); i !=
points.end(); ++i) {
1276 r->
add_property (
X_(
"automation-list-id"),
atoi ((*i)->line().the_list()->id ().to_s ().c_str()));
1277 r->
add_property (
X_(
"parameter"), EventTypeMap::instance().to_symbol ((*i)->line().the_list()->parameter ()));
1279 snprintf(buf,
sizeof(buf),
"%d", (*i)->view_index());
1285 for (TimeSelection::const_iterator i =
time.begin(); i !=
time.end(); ++i) {
1287 snprintf(buf,
sizeof(buf),
"%" PRId64, (*i).start);
1289 snprintf(buf,
sizeof(buf),
"%" PRId64, (*i).end);
1293 for (MarkerSelection::const_iterator i =
markers.begin(); i !=
markers.end(); ++i) {
1309 if (node.
name() !=
X_(
"Selection")) {
1321 for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
1322 if ((*i)->name() ==
X_(
"RouteView")) {
1332 }
else if ((*i)->name() ==
X_(
"Region")) {
1350 }
else if ((*i)->name() ==
X_(
"MIDINote")) {
1351 XMLProperty* prop_region_id = (*i)->property (
X_(
"region-id"));
1353 assert (prop_region_id);
1360 std::list<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > notes;
1363 for (XMLNodeList::const_iterator ci = children.begin(); ci != children.end(); ++ci) {
1364 XMLProperty* prop_channel = (*ci)->property (
X_(
"channel"));
1368 XMLProperty* prop_velocity = (*ci)->property (
X_(
"velocity"));
1369 XMLProperty* prop_off_velocity = (*ci)->property (
X_(
"off-velocity"));
1371 assert (prop_channel);
1374 assert (prop_length);
1375 assert (prop_velocity);
1376 assert (prop_off_velocity);
1378 uint8_t channel =
atoi(prop_channel->
value());
1381 uint8_t note =
atoi(prop_note->
value());
1382 uint8_t velocity =
atoi(prop_velocity->
value());
1383 uint8_t off_velocity =
atoi(prop_off_velocity->
value());
1386 the_note->set_off_velocity (off_velocity);
1388 notes.push_back (the_note);
1391 for (RegionSelection::iterator rsi = rs.begin(); rsi != rs.end(); ++rsi) {
1403 }
else if ((*i)->name() ==
X_(
"ControlPoint")) {
1408 if (prop_type->
value () ==
"track") {
1410 XMLProperty* prop_route_id = (*i)->property (
X_(
"route-id"));
1411 XMLProperty* prop_alist_id = (*i)->property (
X_(
"automation-list-id"));
1412 XMLProperty* prop_parameter = (*i)->property (
X_(
"parameter"));
1413 XMLProperty* prop_view_index = (*i)->property (
X_(
"view-index"));
1416 assert (prop_route_id);
1417 assert (prop_alist_id);
1418 assert (prop_parameter);
1419 assert (prop_view_index);
1423 vector <ControlPoint *> cps;
1428 list<boost::shared_ptr<AutomationLine> >
lines = atv->
lines();
1430 if ((*li)->the_list()->id() == prop_alist_id->
value()) {
1445 }
else if ((*i)->name() ==
X_(
"AudioRange")) {
1449 assert (prop_start);
1457 }
else if ((*i)->name() ==
X_(
"AutomationView")) {
1460 XMLProperty* prop_parameter = (*i)->property (
X_(
"parameter"));
1463 assert (prop_parameter);
1481 }
else if ((*i)->name() ==
X_(
"Marker")) {
1486 assert (prop_start);
1504 RegionSelection::iterator i =
regions.begin();
1506 RegionSelection::iterator tmp = i;
1509 if (&(*i)->get_time_axis_view() == t) {
static PBD::Signal1< void, TimeAxisView * > CatchDeletion
PBD::Signal0< void > ClearMidiNoteSelection
LIBPBD_API Transmitter fatal
ControlPoint * nth(uint32_t)
void move_time(framecnt_t)
std::list< PBD::ID > pending
int atoi(const string &s)
void remove_regions(TimeAxisView *)
AutomationSelection lines
const std::string & value() const
bool remove(RegionView *)
void remove(TimeAxisView *)
boost::shared_ptr< ARDOUR::Route > parent_route()
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
virtual void get_regionviews_by_id(PBD::ID const id, RegionSelection ®ions) const =0
AutomationLine & line() const
const std::string & name() const
Lists of selected things.
sigc::signal< void > PlaylistsChanged
Representation of the interface of the Editor class.
void set(std::list< Selectable * > const &)
sigc::signal< void > MarkersChanged
std::list< boost::shared_ptr< AutomationLine > > lines() const
void block_tracks_changed(bool)
LIBPBD_API Transmitter warning
const XMLNodeList & children(const std::string &str=std::string()) const
static PBD::Signal1< void, Marker * > CatchDeletion
std::list< std::pair< PBD::ID const, std::list< boost::shared_ptr< Evoral::Note< Evoral::Beats > > > > > pending_midi_note_selection
sigc::signal< void > TimeChanged
void range(ARDOUR::framepos_t &start, ARDOUR::framepos_t &end)
std::ostream & endmsg(std::ostream &ostr)
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
XMLNode * add_child(const char *)
void set_preserving_all_ranges(framepos_t, framepos_t)
sigc::signal< void > MidiRegionsChanged
bool empty(bool internal_selection=false)
bool operator==(const Selection &a, const Selection &b)
static PBD::Signal1< void, ControlPoint * > CatchDeletion
std::list< XMLNode * > XMLNodeList
Selection(PublicEditor const *e)
void add(std::list< Selectable * > const &)
int32_t atol(const string &s)
void toggle(std::list< Selectable * > const &)
void replace(uint32_t time_index, framepos_t start, framepos_t end)
Evoral::Parameter parameter() const
bool string_is_affirmative(const std::string &str)
TrackViewList add(TrackViewList const &)
const PBD::ID & id() const
MidiNoteSelection midi_notes
MidiRegionSelection midi_regions
virtual ARDOUR::Location * find_location_from_marker(Marker *, bool &) const =0
bool get_selected() const
PlaylistSelection playlists
virtual RouteTimeAxisView * get_route_view_by_route_id(const PBD::ID &id) const =0
virtual Marker * find_marker_from_location_id(PBD::ID const &, bool) const =0
bool selected(TimeAxisView *)
XMLProperty * add_property(const char *name, const std::string &value)
ARDOUR::framepos_t start()
virtual void get_per_region_note_selection(std::list< std::pair< PBD::ID, std::set< boost::shared_ptr< Evoral::Note< Evoral::Beats > > > > > &) const =0
sigc::signal< void > PointsChanged
XMLNode & get_state() const
sigc::signal< void > LinesChanged
sigc::signal< void > MidiNotesChanged
static const framepos_t max_framepos
sigc::signal< void > TracksChanged
bool operator()(AudioRange a, AudioRange b)
void select_notes(std::list< boost::shared_ptr< NoteType > >)
sigc::signal< void > RegionsChanged
virtual void set_selected(bool yn)
PublicEditor const * editor
#define MISSING_INVALIDATOR
void clear_midi_regions()
boost::shared_ptr< ARDOUR::Route > route() const
void dump_region_layers()
double atof(const string &s)
LIBARDOUR_API PBD::PropertyDescriptor< framecnt_t > length
int set_state(XMLNode const &, int)