selection->set (visible_views);
}
+/** Select clicked_routeview, unless there are no currently selected
+ * tracks, in which case nothing will happen unless `force' is true.
+ */
void
Editor::set_selected_track_as_side_effect (bool force)
{
return false;
}
- /* select this point and any others that it represents */
-
- double y1, y2;
- nframes64_t x1, x2;
-
- x1 = pixel_to_frame (clicked_control_point->get_x() - 10);
- x2 = pixel_to_frame (clicked_control_point->get_x() + 10);
- y1 = clicked_control_point->get_x() - 10;
- y2 = clicked_control_point->get_y() + 10;
+ if (clicked_control_point->selected()) {
+ /* the clicked control point is already selected; others may be as well, so
+ don't change the selection.
+ */
+ return true;
+ }
- return select_all_within (x1, x2, y1, y2, selection->tracks, op);
+ /* We know the ControlPoint that was clicked, but (as discussed in automation_selectable.h)
+ * selected automation data are described by areas on the AutomationLine. A ControlPoint
+ * represents any model points in the space that it takes up, so the AutomationSelectable
+ * needs to be the size of the ControlPoint.
+ */
+
+ double const size = clicked_control_point->size ();
+
+ nframes64_t const x1 = pixel_to_frame (clicked_control_point->get_x() - size / 2);
+ nframes64_t const x2 = pixel_to_frame (clicked_control_point->get_x() + size / 2);
+ double y1 = clicked_control_point->get_y() - size / 2;
+ double y2 = clicked_control_point->get_y() + size / 2;
+
+ /* convert the y values to trackview space */
+ double dummy = 0;
+ clicked_control_point->line().parent_group().i2w (dummy, y1);
+ clicked_control_point->line().parent_group().i2w (dummy, y2);
+ _trackview_group->w2i (dummy, y1);
+ _trackview_group->w2i (dummy, y2);
+
+ /* and set up the selection */
+ return select_all_within (x1, x2, y1, y2, selection->tracks, Selection::Set);
}
void
*/
void
-Editor::mapover_tracks (sigc::slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisView* basis, RouteGroup::Property prop) const
+Editor::mapover_tracks (sigc::slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisView* basis, PBD::PropertyID prop) const
{
RouteTimeAxisView* route_basis = dynamic_cast<RouteTimeAxisView*> (basis);
if (route_basis == 0) {
tracks.insert (route_basis);
RouteGroup* group = route_basis->route()->route_group();
- if (group && group->active_property (prop)) {
+ if (group && group->enabled_property (prop)) {
/* the basis is a member of an active route group, with the appropriate
properties; find other members */
}
void
-Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions, RouteGroup::Property prop) const
+Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions, PBD::PropertyID property) const
{
- mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_trackview(), prop);
+ mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_trackview(), property);
/* add clicked regionview since we skipped all other regions in the same track as the one it was in */
}
RegionSelection
-Editor::get_equivalent_regions (RegionSelection & basis, RouteGroup::Property prop) const
+Editor::get_equivalent_regions (RegionSelection & basis, PBD::PropertyID prop) const
{
RegionSelection equivalent;
if (press) {
if (selection->selected (clicked_routeview)) {
- get_equivalent_regions (clicked_regionview, all_equivalent_regions, RouteGroup::Select);
+ get_equivalent_regions (clicked_regionview, all_equivalent_regions, ARDOUR::Properties::select.property_id);
} else {
all_equivalent_regions.push_back (clicked_regionview);
}
case Selection::Set:
if (!selection->selected (clicked_regionview)) {
- get_equivalent_regions (clicked_regionview, all_equivalent_regions, RouteGroup::Select);
+ get_equivalent_regions (clicked_regionview, all_equivalent_regions, ARDOUR::Properties::select.property_id);
selection->set (all_equivalent_regions);
commit = true;
} else {
(*i)->hide_selection ();
}
- if (selection->tracks.empty()) {
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- (*i)->show_selection (selection->time);
- }
- } else {
- for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
- (*i)->show_selection (selection->time);
- }
+ for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
+ (*i)->show_selection (selection->time);
}
if (selection->time.empty()) {
} else {
ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, true);
}
-
}
void
_regions->unselect_all ();
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
-
(*i)->set_selected_regionviews (selection->regions);
- _regions->set_selected (selection->regions);
-
}
+ _regions->set_selected (selection->regions);
+
sensitize_the_right_region_actions (!selection->regions.empty());
_regions->block_change_connection (false);
selection->set (touched);
}
+/** @param top Top (lower) y limit in trackview coordinates.
+ * @param bottom Bottom (higher) y limit in trackview coordinates.
+ */
bool
-Editor::select_all_within (nframes64_t start, nframes64_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op)
+Editor::select_all_within (
+ nframes64_t start, nframes64_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op
+ )
{
- list<Selectable*> touched;
- list<Selectable*>::size_type n = 0;
- TrackViewList touched_tracks;
+ list<Selectable*> found;
+ TrackViewList tracks;
for (TrackViewList::const_iterator iter = tracklist.begin(); iter != tracklist.end(); ++iter) {
+
if ((*iter)->hidden()) {
continue;
}
- n = touched.size();
+ list<Selectable*>::size_type const n = found.size ();
- (*iter)->get_selectables (start, end, top, bot, touched);
+ (*iter)->get_selectables (start, end, top, bot, found);
- if (n != touched.size()) {
- touched_tracks.push_back (*iter);
+ if (n != found.size()) {
+ tracks.push_back (*iter);
}
}
-
- if (touched.empty()) {
+
+ if (found.empty()) {
return false;
}
- if (!touched_tracks.empty()) {
+ if (!tracks.empty()) {
switch (op) {
case Selection::Add:
- selection->add (touched_tracks);
+ selection->add (tracks);
break;
case Selection::Toggle:
- selection->toggle (touched_tracks);
+ selection->toggle (tracks);
break;
case Selection::Set:
- selection->set (touched_tracks);
+ selection->set (tracks);
break;
case Selection::Extend:
/* not defined yet */
begin_reversible_command (_("select all within"));
switch (op) {
case Selection::Add:
- selection->add (touched);
+ selection->add (found);
break;
case Selection::Toggle:
- selection->toggle (touched);
+ selection->toggle (found);
break;
case Selection::Set:
- selection->set (touched);
+ selection->set (found);
break;
case Selection::Extend:
/* not defined yet */
commit_reversible_command ();
- return !touched.empty();
+ return !found.empty();
}
void
return;
}
- selection->set (0, selection->regions.start(), selection->regions.end_frame());
+ selection->set (selection->regions.start(), selection->regions.end_frame());
if (!Profile->get_sae()) {
set_mouse_mode (Editing::MouseRange, false);
}
{
Location* location;
- if ((location = session->locations()->auto_punch_location()) == 0) {
+ if ((location = _session->locations()->auto_punch_location()) == 0) {
return;
}
{
Location* location;
- if ((location = session->locations()->auto_loop_location()) == 0) {
+ if ((location = _session->locations()->auto_loop_location()) == 0) {
return;
}
set_selection_from_range (*location);
Editor::set_selection_from_range (Location& loc)
{
begin_reversible_command (_("set selection from range"));
- selection->set (0, loc.start(), loc.end());
+ selection->set (loc.start(), loc.end());
commit_reversible_command ();
if (!Profile->get_sae()) {
void
Editor::select_all_selectables_using_punch()
{
- Location* location = session->locations()->auto_punch_location();
+ Location* location = _session->locations()->auto_punch_location();
list<Selectable *> touched;
if (location == 0 || (location->end() - location->start() <= 1)) {
void
Editor::select_all_selectables_using_loop()
{
- Location* location = session->locations()->auto_loop_location();
+ Location* location = _session->locations()->auto_loop_location();
list<Selectable *> touched;
if (location == 0 || (location->end() - location->start() <= 1)) {
if (after) {
begin_reversible_command (_("select all after cursor"));
start = cursor->current_frame ;
- end = session->current_end_frame();
+ end = _session->current_end_frame();
} else {
if (cursor->current_frame > 0) {
begin_reversible_command (_("select all before cursor"));
if (after) {
begin_reversible_command (_("select all after edit"));
start = get_preferred_edit_position();
- end = session->current_end_frame();
+ end = _session->current_end_frame();
} else {
if ((end = get_preferred_edit_position()) > 1) {
begin_reversible_command (_("select all before edit"));
}
set_mouse_mode (MouseRange);
- selection->set ((TimeAxisView*) 0, start, end);
+ selection->set (start, end);
}
bool
}
start = selection->markers.front()->position();
- end = session->audible_frame();
+ end = _session->audible_frame();
} else {
if (selection->markers.empty()) {
/* use mouse + playhead */
start = m;
- end = session->audible_frame();
+ end = _session->audible_frame();
} else {
/* use playhead + selected marker */
- start = session->audible_frame();
+ start = _session->audible_frame();
end = selection->markers.front()->position();
}
break;
/* use mouse + selected marker */
if (selection->markers.empty()) {
start = m;
- end = session->audible_frame();
+ end = _session->audible_frame();
} else {
start = selection->markers.front()->position();
end = m;
selection->clear ();
}
-
+long
+Editor::select_range_around_region (RegionView* rv)
+{
+ assert (rv);
+
+ selection->set (&rv->get_time_axis_view());
+
+ selection->time.clear ();
+ boost::shared_ptr<Region> r = rv->region ();
+ return selection->set (r->position(), r->position() + r->length());
+}