mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
Allow to select region-gain points via rubber-band drag
This commit is contained in:
parent
64d633cd26
commit
1f4490fff9
3 changed files with 26 additions and 20 deletions
|
|
@ -948,14 +948,13 @@ void
|
||||||
AutomationLine::get_selectables (timepos_t const & start, timepos_t const & end, double botfrac, double topfrac, list<Selectable*>& results)
|
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 */
|
/* convert fractions to display coordinates with 0 at the top of the track */
|
||||||
double const bot_track = (1 - topfrac) * 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 ();
|
double const top_track = (1 - botfrac) * trackview.current_height (); // --"--
|
||||||
|
|
||||||
for (auto const & cp : control_points) {
|
for (auto const & cp : control_points) {
|
||||||
|
|
||||||
const timepos_t w = session_position ((*cp->model())->when);
|
const timepos_t w = session_position ((*cp->model())->when);
|
||||||
|
|
||||||
|
|
||||||
if (w >= start && w <= end && cp->get_y() >= bot_track && cp->get_y() <= top_track) {
|
if (w >= start && w <= end && cp->get_y() >= bot_track && cp->get_y() <= top_track) {
|
||||||
results.push_back (cp);
|
results.push_back (cp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1045,11 +1045,9 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RegionItem:
|
case RegionItem:
|
||||||
if (dynamic_cast<AutomationRegionView*>(clicked_regionview)) {
|
/* rubberband drag to select region gain points */
|
||||||
/* rubberband drag to select automation points */
|
_drags->set (new EditorRubberbandSelectDrag (this, item), event);
|
||||||
_drags->set (new EditorRubberbandSelectDrag (this, item), event);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -2324,6 +2322,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, bool from_aut
|
||||||
update_join_object_range_location (event->motion.y);
|
update_join_object_range_location (event->motion.y);
|
||||||
|
|
||||||
if (_drags->active ()) {
|
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
|
//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);
|
return _drags->motion_handler (event, from_autoscroll);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,11 @@
|
||||||
#include "canvas/rectangle.h"
|
#include "canvas/rectangle.h"
|
||||||
#include "canvas/debug.h"
|
#include "canvas/debug.h"
|
||||||
|
|
||||||
|
#include "audio_region_view.h"
|
||||||
#include "streamview.h"
|
#include "streamview.h"
|
||||||
#include "region_view.h"
|
#include "region_view.h"
|
||||||
#include "route_time_axis.h"
|
#include "route_time_axis.h"
|
||||||
|
#include "region_gain_line.h"
|
||||||
#include "region_selection.h"
|
#include "region_selection.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
|
|
@ -585,10 +587,6 @@ StreamView::set_selected_regionviews (RegionSelection& regions)
|
||||||
void
|
void
|
||||||
StreamView::get_selectables (timepos_t const & start, timepos_t const & end, double top, double bottom, list<Selectable*>& results, bool within)
|
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 min_layer = 0;
|
||||||
layer_t max_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_t const l = (*i)->region()->layer ();
|
||||||
layer_ok = (min_layer <= l && l <= max_layer);
|
layer_ok = (min_layer <= l && l <= max_layer);
|
||||||
}
|
}
|
||||||
|
if (!layer_ok) {
|
||||||
if (within) {
|
continue;
|
||||||
if ((*i)->region()->coverage (start, end) == Temporal::OverlapExternal && layer_ok) {
|
}
|
||||||
results.push_back (*i);
|
if ((within && (*i)->region()->coverage (start, end) == Temporal::OverlapExternal)
|
||||||
}
|
|| (!within && (*i)->region()->coverage (start, end) != Temporal::OverlapNone)) {
|
||||||
} else {
|
if (_trackview.editor().internal_editing()) {
|
||||||
if ((*i)->region()->coverage (start, end) != Temporal::OverlapNone && layer_ok) {
|
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);
|
results.push_back (*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue