Fix up selection of automation points.
git-svn-id: svn://localhost/ardour2/branches/3.0@7556 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
c333b19422
commit
c06c6c153d
|
@ -950,28 +950,24 @@ AutomationLine::remove_point (ControlPoint& cp)
|
|||
/** Get selectable points within an area.
|
||||
* @param start Start position in session frames.
|
||||
* @param end End position in session frames.
|
||||
* @param botfrac Bottom of area, as a fraction of the line height.
|
||||
* @param topfrac Bottom of area, as a fraction of the line height.
|
||||
* @param bot Bottom y range, as a fraction of line height, where 0 is the bottom of the line.
|
||||
* @param top Top y range, as a fraction of line height, where 0 is the bottom of the line.
|
||||
* @param result Filled in with selectable things.
|
||||
*/
|
||||
void
|
||||
AutomationLine::get_selectables (
|
||||
framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results
|
||||
)
|
||||
{
|
||||
|
||||
double top;
|
||||
double bot;
|
||||
|
||||
/* these two are in AutomationList model coordinates */
|
||||
double nstart;
|
||||
double nend;
|
||||
|
||||
bool collecting = false;
|
||||
|
||||
/* Curse X11 and its inverted coordinate system! */
|
||||
|
||||
bot = (1.0 - topfrac) * _height;
|
||||
top = (1.0 - botfrac) * _height;
|
||||
/* convert fractions to display coordinates with 0 at the top of the track */
|
||||
double const bot_track = (1 - topfrac) * trackview.current_height ();
|
||||
double const top_track = (1 - botfrac) * trackview.current_height ();
|
||||
|
||||
nstart = DBL_MAX;
|
||||
nend = 0;
|
||||
|
@ -982,7 +978,7 @@ AutomationLine::get_selectables (
|
|||
|
||||
if (session_frames_when >= start && session_frames_when <= end) {
|
||||
|
||||
if ((*i)->get_y() >= bot && (*i)->get_y() <= top) {
|
||||
if ((*i)->get_y() >= bot_track && (*i)->get_y() <= top_track) {
|
||||
|
||||
(*i)->show();
|
||||
(*i)->set_visible(true);
|
||||
|
@ -1027,10 +1023,8 @@ AutomationLine::point_selection_to_control_points (PointSelection const & s)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Curse X11 and its inverted coordinate system! */
|
||||
|
||||
double const bot = (1.0 - i->high_fract) * _height;
|
||||
double const top = (1.0 - i->low_fract) * _height;
|
||||
double const bot = (1 - i->high_fract) * trackview.current_height ();
|
||||
double const top = (1 - i->low_fract) * trackview.current_height ();
|
||||
|
||||
for (vector<ControlPoint*>::iterator j = control_points.begin(); j != control_points.end(); ++j) {
|
||||
|
||||
|
|
|
@ -68,9 +68,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
|
|||
|
||||
std::list<ControlPoint*> point_selection_to_control_points (PointSelection const &);
|
||||
void set_selected_points (PointSelection&);
|
||||
void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end,
|
||||
double botfrac, double topfrac,
|
||||
std::list<Selectable*>& results);
|
||||
void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*>&);
|
||||
void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
|
||||
|
||||
virtual void remove_point (ControlPoint&);
|
||||
|
|
|
@ -25,8 +25,11 @@
|
|||
class TimeAxisView;
|
||||
|
||||
/** A selected automation point, expressed as a rectangle.
|
||||
*
|
||||
* x coordinates start/end are in AutomationList model coordinates.
|
||||
* y coordinates are a expressed as a fraction of track height.
|
||||
* y coordinates are a expressed as a fraction of the AutomationTimeAxisView's height, where 0 is the
|
||||
* bottom of the track, and 1 is the top.
|
||||
*
|
||||
* This representation falls between the visible GUI control points and
|
||||
* the back-end "actual" automation points, some of which may not be
|
||||
* visible; it is not trivial to convert from one of these to the
|
||||
|
|
|
@ -276,6 +276,10 @@ AutomationStreamView::clear ()
|
|||
|
||||
/** @param start Start position in session frames.
|
||||
* @param end End position in session frames.
|
||||
* @param bot Bottom position expressed as a fraction of track height where 0 is the bottom of the track.
|
||||
* @param top Top position expressed as a fraction of track height where 0 is the bottom of the track.
|
||||
* NOTE: this y system is different to that for the StreamView method that this overrides, which is a little
|
||||
* confusing.
|
||||
*/
|
||||
void
|
||||
AutomationStreamView::get_selectables (framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results)
|
||||
|
|
|
@ -827,21 +827,23 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, framepos_t pos, float t
|
|||
}
|
||||
|
||||
void
|
||||
AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
|
||||
AutomationTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results)
|
||||
{
|
||||
if (!_line && !_view) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (touched (top, bot)) {
|
||||
double topfrac;
|
||||
double botfrac;
|
||||
|
||||
/* remember: this is X Window - coordinate space starts in upper left and moves down.
|
||||
_y_position is the "origin" or "top" of the track.
|
||||
*/
|
||||
|
||||
double mybot = _y_position + height;
|
||||
/* bottom of our track */
|
||||
double const mybot = _y_position + height;
|
||||
|
||||
double topfrac;
|
||||
double botfrac;
|
||||
|
||||
if (_y_position >= top && mybot <= bot) {
|
||||
|
||||
|
@ -858,6 +860,7 @@ AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double
|
|||
|
||||
topfrac = 1.0 - ((top - _y_position) / height);
|
||||
botfrac = 1.0 - ((bot - _y_position) / height);
|
||||
|
||||
}
|
||||
|
||||
if (_line) {
|
||||
|
|
|
@ -78,7 +78,7 @@ class AutomationTimeAxisView : public TimeAxisView {
|
|||
boost::shared_ptr<AutomationLine> line() { return _line; }
|
||||
|
||||
void set_selected_points (PointSelection&);
|
||||
void get_selectables (nframes_t start, nframes_t end, double top, double bot, std::list<Selectable *>&);
|
||||
void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&);
|
||||
void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
|
||||
|
||||
void show_timestretch (nframes_t /*start*/, nframes_t /*end*/) {}
|
||||
|
|
|
@ -275,7 +275,7 @@ Editor::canvas_stream_view_event (GdkEvent *event, ArdourCanvas::Item* item, Rou
|
|||
clicked_regionview = 0;
|
||||
clicked_control_point = 0;
|
||||
clicked_axisview = tv;
|
||||
clicked_routeview = dynamic_cast<RouteTimeAxisView*>(tv);
|
||||
clicked_routeview = dynamic_cast<RouteTimeAxisView*>(clicked_axisview);
|
||||
ret = button_press_handler (item, event, StreamItem);
|
||||
break;
|
||||
|
||||
|
|
|
@ -2832,7 +2832,7 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
|
||||
/* just a click */
|
||||
|
||||
if ((event->type == GDK_BUTTON_RELEASE) && (event->button.button == 1) && Keyboard::modifier_state_equals (event->button.state, Keyboard::TertiaryModifier)) {
|
||||
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::TertiaryModifier)) {
|
||||
_editor->reset_point_selection ();
|
||||
}
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp
|
|||
break;
|
||||
|
||||
case ControlPointItem:
|
||||
set_selected_track_as_side_effect ();
|
||||
set_selected_track_as_side_effect (true);
|
||||
if (mouse_mode != MouseRange || _join_object_range_state == JOIN_OBJECT_RANGE_OBJECT) {
|
||||
set_selected_control_point_from_click (op, false);
|
||||
}
|
||||
|
|
|
@ -170,23 +170,23 @@ Editor::select_all_tracks ()
|
|||
selection->set (visible_views);
|
||||
}
|
||||
|
||||
/** Select clicked_routeview, unless there are no currently selected
|
||||
/** Select clicked_axisview, 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)
|
||||
{
|
||||
if (!clicked_routeview) {
|
||||
if (!clicked_axisview) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!selection->tracks.empty()) {
|
||||
if (!selection->selected (clicked_routeview)) {
|
||||
selection->add (clicked_routeview);
|
||||
if (!selection->selected (clicked_axisview)) {
|
||||
selection->add (clicked_axisview);
|
||||
}
|
||||
|
||||
} else if (force) {
|
||||
selection->set (clicked_routeview);
|
||||
selection->set (clicked_axisview);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,9 +255,10 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool /*n
|
|||
*/
|
||||
|
||||
double const size = clicked_control_point->size ();
|
||||
AutomationLine& line = clicked_control_point->line ();
|
||||
|
||||
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);
|
||||
nframes64_t const x1 = pixel_to_frame (clicked_control_point->get_x() - size / 2) + line.time_converter().origin_b ();
|
||||
nframes64_t const x2 = pixel_to_frame (clicked_control_point->get_x() + size / 2) + line.time_converter().origin_b ();
|
||||
double y1 = clicked_control_point->get_y() - size / 2;
|
||||
double y2 = clicked_control_point->get_y() + size / 2;
|
||||
|
||||
|
@ -269,7 +270,7 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool /*n
|
|||
_trackview_group->w2i (dummy, y2);
|
||||
|
||||
/* and set up the selection */
|
||||
return select_all_within (x1, x2, y1, y2, selection->tracks, Selection::Set);
|
||||
return select_all_within (x1, x2, y1, y2, selection->tracks, op);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -979,8 +980,8 @@ Editor::invert_selection ()
|
|||
|
||||
/** @param start Start time in session frames.
|
||||
* @param end End time in session frames.
|
||||
* @param top Top (lower) y limit in trackview coordinates.
|
||||
* @param bottom Bottom (higher) y limit in trackview coordinates.
|
||||
* @param top Top (lower) y limit in trackview coordinates (ie 0 at the top of the track view)
|
||||
* @param bottom Bottom (higher) y limit in trackview coordinates (ie 0 at the top of the track view)
|
||||
*/
|
||||
bool
|
||||
Editor::select_all_within (framepos_t start, framepos_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op)
|
||||
|
|
|
@ -57,7 +57,6 @@ class MidiStreamView : public StreamView
|
|||
~MidiStreamView ();
|
||||
|
||||
void set_selected_regionviews (RegionSelection&);
|
||||
void get_selectables (nframes_t start, nframes_t end, std::list<Selectable* >&);
|
||||
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
|
||||
|
||||
enum VisibleNoteRange {
|
||||
|
|
|
@ -1182,7 +1182,7 @@ RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
|
|||
* @param results List to add things to.
|
||||
*/
|
||||
void
|
||||
RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results)
|
||||
RouteTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results)
|
||||
{
|
||||
double speed = 1.0;
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
void selection_click (GdkEventButton*);
|
||||
void set_selected_points (PointSelection&);
|
||||
void set_selected_regionviews (RegionSelection&);
|
||||
void get_selectables (nframes_t start, nframes_t end, double top, double bot, std::list<Selectable *>&);
|
||||
void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&);
|
||||
void get_inverted_selectables (Selection&, std::list<Selectable*>&);
|
||||
void set_layer_display (LayerDisplay d);
|
||||
LayerDisplay layer_display () const;
|
||||
|
|
|
@ -501,8 +501,17 @@ StreamView::set_selected_regionviews (RegionSelection& regions)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/** Get selectable things within a given range.
|
||||
* @param start Start time in session frames.
|
||||
* @param end End time in session frames.
|
||||
* @param top Top y range, in trackview coordinates (ie 0 is the top of the track view)
|
||||
* @param bot Bottom y range, in trackview coordinates (ie 0 is the top of the track view)
|
||||
* @param result Filled in with selectable things.
|
||||
*/
|
||||
|
||||
void
|
||||
StreamView::get_selectables (nframes_t start, nframes_t end, double top, double bottom, list<Selectable*>& results)
|
||||
StreamView::get_selectables (framepos_t start, framepos_t end, double top, double bottom, list<Selectable*>& results)
|
||||
{
|
||||
layer_t min_layer = 0;
|
||||
layer_t max_layer = 0;
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
|
||||
|
||||
void set_selected_regionviews (RegionSelection&);
|
||||
void get_selectables (nframes_t, nframes_t, double, double, std::list<Selectable* >&);
|
||||
void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&);
|
||||
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
|
||||
|
||||
virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}
|
||||
|
|
|
@ -886,8 +886,15 @@ TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
|
|||
}
|
||||
}
|
||||
|
||||
/** Get selectable things within a given range.
|
||||
* @param start Start time in session frames.
|
||||
* @param end End time in session frames.
|
||||
* @param top Top y range, in trackview coordinates (ie 0 is the top of the track view)
|
||||
* @param bot Bottom y range, in trackview coordinates (ie 0 is the top of the track view)
|
||||
* @param result Filled in with selectable things.
|
||||
*/
|
||||
void
|
||||
TimeAxisView::get_selectables (nframes_t /*start*/, nframes_t /*end*/, double /*top*/, double /*bot*/, list<Selectable*>& /*result*/)
|
||||
TimeAxisView::get_selectables (framepos_t /*start*/, framepos_t /*end*/, double /*top*/, double /*bot*/, list<Selectable*>& /*result*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
|
|||
|
||||
void order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top);
|
||||
|
||||
virtual void get_selectables (nframes_t start, nframes_t end, double top, double bot, std::list<Selectable*>& results);
|
||||
virtual void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*>&);
|
||||
virtual void get_inverted_selectables (Selection&, std::list<Selectable *>& results);
|
||||
|
||||
void add_ghost (RegionView*);
|
||||
|
|
Loading…
Reference in New Issue