mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 00:56:33 +01:00
Cleanup of previous two commits.
git-svn-id: svn://localhost/ardour2/branches/3.0@6452 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0d5ce8d939
commit
a23811502c
3 changed files with 41 additions and 81 deletions
|
|
@ -64,6 +64,10 @@ class ControlPoint
|
||||||
void show ();
|
void show ();
|
||||||
void set_color ();
|
void set_color ();
|
||||||
|
|
||||||
|
double size () const {
|
||||||
|
return _size;
|
||||||
|
}
|
||||||
|
|
||||||
void set_size (double);
|
void set_size (double);
|
||||||
void set_visible (bool);
|
void set_visible (bool);
|
||||||
bool visible () const;
|
bool visible () const;
|
||||||
|
|
|
||||||
|
|
@ -1630,12 +1630,6 @@ public:
|
||||||
|
|
||||||
/* object rubberband select process */
|
/* object rubberband select process */
|
||||||
|
|
||||||
std::pair<std::list<Selectable*>, TrackViewList> find_selectables_within (
|
|
||||||
nframes64_t, nframes64_t, double, double, TrackViewList const &
|
|
||||||
);
|
|
||||||
|
|
||||||
bool select_selectables_and_tracks (std::list<Selectable*> const &, TrackViewList const &, Selection::Operation);
|
|
||||||
|
|
||||||
bool select_all_within (nframes64_t, nframes64_t, double, double, TrackViewList const &, Selection::Operation op);
|
bool select_all_within (nframes64_t, nframes64_t, double, double, TrackViewList const &, Selection::Operation op);
|
||||||
|
|
||||||
ArdourCanvas::SimpleRect *rubberband_rect;
|
ArdourCanvas::SimpleRect *rubberband_rect;
|
||||||
|
|
|
||||||
|
|
@ -242,14 +242,25 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool /*n
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rectangle 10 pixels surrounding the clicked control point */
|
if (clicked_control_point->selected()) {
|
||||||
/* XXX: not really sure why we look for more control points close to the clicked one,
|
/* the clicked control point is already selected; others may be as well, so
|
||||||
and don't just use the clicked one
|
don't change the selection.
|
||||||
*/
|
*/
|
||||||
nframes64_t const x1 = pixel_to_frame (clicked_control_point->get_x() - 10);
|
return true;
|
||||||
nframes64_t const x2 = pixel_to_frame (clicked_control_point->get_x() + 10);
|
}
|
||||||
double y1 = clicked_control_point->get_y() - 10;
|
|
||||||
double y2 = clicked_control_point->get_y() + 10;
|
/* 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 */
|
/* convert the y values to trackview space */
|
||||||
double dummy = 0;
|
double dummy = 0;
|
||||||
|
|
@ -258,36 +269,8 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool /*n
|
||||||
_trackview_group->w2i (dummy, y1);
|
_trackview_group->w2i (dummy, y1);
|
||||||
_trackview_group->w2i (dummy, y2);
|
_trackview_group->w2i (dummy, y2);
|
||||||
|
|
||||||
/* find any other points nearby */
|
/* and set up the selection */
|
||||||
pair<list<Selectable*>, TrackViewList> const f = find_selectables_within (x1, x2, y1, y2, selection->tracks);
|
return select_all_within (x1, x2, y1, y2, selection->tracks, Selection::Set);
|
||||||
|
|
||||||
PointSelection ps;
|
|
||||||
for (list<Selectable*>::const_iterator i = f.first.begin(); i != f.first.end(); ++i) {
|
|
||||||
AutomationSelectable* a = dynamic_cast<AutomationSelectable*> (*i);
|
|
||||||
if (a) {
|
|
||||||
ps.push_back (*a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
list<ControlPoint*> const cp = clicked_control_point->line().point_selection_to_control_points (ps);
|
|
||||||
list<ControlPoint*>::const_iterator i = cp.begin ();
|
|
||||||
while (i != cp.end() && (*i)->selected() == false) {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i != cp.end()) {
|
|
||||||
/* one of the control points that we just clicked on is already selected,
|
|
||||||
so leave the selection alone.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (list<Selectable*>::const_iterator i = f.first.begin(); i != f.first.end(); ++i) {
|
|
||||||
delete *i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return select_selectables_and_tracks (f.first, f.second, op);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -993,15 +976,13 @@ Editor::invert_selection ()
|
||||||
selection->set (touched);
|
selection->set (touched);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Find Selectable things within an area.
|
/** @param top Top (lower) y limit in trackview coordinates.
|
||||||
* @param start Start temporal position (session frames)
|
* @param bottom Bottom (higher) y limit in trackview coordinates.
|
||||||
* @param end End temporal position (session frames)
|
|
||||||
* @param top Top (lower) y position (trackview coordinates)
|
|
||||||
* @param bot Bottom (higher) y position (trackview coordinates)
|
|
||||||
* @return Selectable things and tracks that they are on.
|
|
||||||
*/
|
*/
|
||||||
pair<list<Selectable*>, TrackViewList>
|
bool
|
||||||
Editor::find_selectables_within (nframes64_t start, nframes64_t end, double top, double bot, const TrackViewList& tracklist)
|
Editor::select_all_within (
|
||||||
|
nframes64_t start, nframes64_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op
|
||||||
|
)
|
||||||
{
|
{
|
||||||
list<Selectable*> found;
|
list<Selectable*> found;
|
||||||
TrackViewList tracks;
|
TrackViewList tracks;
|
||||||
|
|
@ -1020,41 +1001,22 @@ Editor::find_selectables_within (nframes64_t start, nframes64_t end, double top,
|
||||||
tracks.push_back (*iter);
|
tracks.push_back (*iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return make_pair (found, tracks);
|
if (found.empty()) {
|
||||||
}
|
|
||||||
|
|
||||||
/** @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
|
|
||||||
)
|
|
||||||
{
|
|
||||||
pair<list<Selectable*>, TrackViewList> const f = find_selectables_within (start, end, top, bot, tracklist);
|
|
||||||
return select_selectables_and_tracks (f.first, f.second, op);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Select a list of Selectables and also a list of Tracks; nothing will be selected if there are no Selectables */
|
|
||||||
bool
|
|
||||||
Editor::select_selectables_and_tracks (list<Selectable*> const & s, TrackViewList const & t, Selection::Operation op)
|
|
||||||
{
|
|
||||||
if (s.empty()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!t.empty()) {
|
if (!tracks.empty()) {
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case Selection::Add:
|
case Selection::Add:
|
||||||
selection->add (t);
|
selection->add (tracks);
|
||||||
break;
|
break;
|
||||||
case Selection::Toggle:
|
case Selection::Toggle:
|
||||||
selection->toggle (t);
|
selection->toggle (tracks);
|
||||||
break;
|
break;
|
||||||
case Selection::Set:
|
case Selection::Set:
|
||||||
selection->set (t);
|
selection->set (tracks);
|
||||||
break;
|
break;
|
||||||
case Selection::Extend:
|
case Selection::Extend:
|
||||||
/* not defined yet */
|
/* not defined yet */
|
||||||
|
|
@ -1065,13 +1027,13 @@ Editor::select_selectables_and_tracks (list<Selectable*> const & s, TrackViewLis
|
||||||
begin_reversible_command (_("select all within"));
|
begin_reversible_command (_("select all within"));
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case Selection::Add:
|
case Selection::Add:
|
||||||
selection->add (s);
|
selection->add (found);
|
||||||
break;
|
break;
|
||||||
case Selection::Toggle:
|
case Selection::Toggle:
|
||||||
selection->toggle (s);
|
selection->toggle (found);
|
||||||
break;
|
break;
|
||||||
case Selection::Set:
|
case Selection::Set:
|
||||||
selection->set (s);
|
selection->set (found);
|
||||||
break;
|
break;
|
||||||
case Selection::Extend:
|
case Selection::Extend:
|
||||||
/* not defined yet */
|
/* not defined yet */
|
||||||
|
|
@ -1080,7 +1042,7 @@ Editor::select_selectables_and_tracks (list<Selectable*> const & s, TrackViewLis
|
||||||
|
|
||||||
commit_reversible_command ();
|
commit_reversible_command ();
|
||||||
|
|
||||||
return !s.empty();
|
return !found.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue