Allow to select region-gain points via rubber-band drag
This commit is contained in:
parent
64d633cd26
commit
1f4490fff9
|
@ -948,14 +948,13 @@ void
|
|||
AutomationLine::get_selectables (timepos_t const & start, timepos_t const & end, double botfrac, double topfrac, list<Selectable*>& results)
|
||||
{
|
||||
/* 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 ();
|
||||
double const bot_track = (1 - topfrac) * trackview.current_height (); // this should StreamView::child_height () for RegionGain
|
||||
double const top_track = (1 - botfrac) * trackview.current_height (); // --"--
|
||||
|
||||
for (auto const & cp : control_points) {
|
||||
|
||||
const timepos_t w = session_position ((*cp->model())->when);
|
||||
|
||||
|
||||
if (w >= start && w <= end && cp->get_y() >= bot_track && cp->get_y() <= top_track) {
|
||||
results.push_back (cp);
|
||||
}
|
||||
|
|
|
@ -1045,11 +1045,9 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
break;
|
||||
|
||||
case RegionItem:
|
||||
if (dynamic_cast<AutomationRegionView*>(clicked_regionview)) {
|
||||
/* rubberband drag to select automation points */
|
||||
_drags->set (new EditorRubberbandSelectDrag (this, item), event);
|
||||
return true;
|
||||
}
|
||||
/* rubberband drag to select region gain points */
|
||||
_drags->set (new EditorRubberbandSelectDrag (this, item), event);
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2324,6 +2322,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, bool from_aut
|
|||
update_join_object_range_location (event->motion.y);
|
||||
|
||||
if (_drags->active ()) {
|
||||
_region_peak_cursor->hide ();
|
||||
//drags change the snapped_cursor location, because we are snapping the thing being dragged, not the actual mouse cursor
|
||||
return _drags->motion_handler (event, from_autoscroll);
|
||||
} else {
|
||||
|
|
|
@ -40,9 +40,11 @@
|
|||
#include "canvas/rectangle.h"
|
||||
#include "canvas/debug.h"
|
||||
|
||||
#include "audio_region_view.h"
|
||||
#include "streamview.h"
|
||||
#include "region_view.h"
|
||||
#include "route_time_axis.h"
|
||||
#include "region_gain_line.h"
|
||||
#include "region_selection.h"
|
||||
#include "selection.h"
|
||||
#include "public_editor.h"
|
||||
|
@ -585,10 +587,6 @@ StreamView::set_selected_regionviews (RegionSelection& regions)
|
|||
void
|
||||
StreamView::get_selectables (timepos_t const & start, timepos_t const & end, double top, double bottom, list<Selectable*>& results, bool within)
|
||||
{
|
||||
if (_trackview.editor().internal_editing()) {
|
||||
return; // Don't select regions with an internal tool
|
||||
}
|
||||
|
||||
layer_t min_layer = 0;
|
||||
layer_t max_layer = 0;
|
||||
|
||||
|
@ -619,17 +617,27 @@ StreamView::get_selectables (timepos_t const & start, timepos_t const & end, dou
|
|||
layer_t const l = (*i)->region()->layer ();
|
||||
layer_ok = (min_layer <= l && l <= max_layer);
|
||||
}
|
||||
|
||||
if (within) {
|
||||
if ((*i)->region()->coverage (start, end) == Temporal::OverlapExternal && layer_ok) {
|
||||
results.push_back (*i);
|
||||
}
|
||||
} else {
|
||||
if ((*i)->region()->coverage (start, end) != Temporal::OverlapNone && layer_ok) {
|
||||
if (!layer_ok) {
|
||||
continue;
|
||||
}
|
||||
if ((within && (*i)->region()->coverage (start, end) == Temporal::OverlapExternal)
|
||||
|| (!within && (*i)->region()->coverage (start, end) != Temporal::OverlapNone)) {
|
||||
if (_trackview.editor().internal_editing()) {
|
||||
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*i);
|
||||
if (arv && arv->get_gain_line ()) {
|
||||
/* Note: AutomationLine::get_selectables() uses trackview.current_height (),
|
||||
* disregarding Stacked layer display height
|
||||
*/
|
||||
double const c = height; // child_height (); // XXX
|
||||
double const y = (*i)->get_canvas_group ()->position().y;
|
||||
double t = 1.0 - std::min (1.0, std::max (0., (top - _trackview.y_position () - y) / c));
|
||||
double b = 1.0 - std::min (1.0, std::max (0., (bottom - _trackview.y_position () - y) / c));
|
||||
arv->get_gain_line()->get_selectables (start, end, b, t, results);
|
||||
}
|
||||
} else {
|
||||
results.push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user