lollis: only allow velocity editing on currently selected region
This commit is contained in:
parent
6ef84ca376
commit
7dc532a646
@ -56,6 +56,7 @@
|
||||
|
||||
#include "automation_time_axis.h"
|
||||
#include "automation_streamview.h"
|
||||
#include "ghostregion.h"
|
||||
#include "gui_thread.h"
|
||||
#include "route_time_axis.h"
|
||||
#include "automation_line.h"
|
||||
@ -1250,3 +1251,19 @@ AutomationTimeAxisView::set_velocity_mode (VelocityMode vm, bool force)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AutomationTimeAxisView::set_selected_regionviews (RegionSelection& rs)
|
||||
{
|
||||
if (_parameter.type() != MidiVelocityAutomation) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto & ghost : ghosts) {
|
||||
if (std::find (rs.begin(), rs.end(), &ghost->parent_rv) != rs.end()) {
|
||||
ghost->set_selected (true);
|
||||
} else {
|
||||
ghost->set_selected (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +145,8 @@ public:
|
||||
VelocityMode velocity_mode () const { return _velocity_mode; }
|
||||
void set_velocity_mode (VelocityMode, bool force = false);
|
||||
|
||||
void set_selected_regionviews (RegionSelection&);
|
||||
|
||||
protected:
|
||||
/* Note that for MIDI controller "automation" (in regions), all of these
|
||||
* may be set. In this case, _automatable is likely _route so the
|
||||
|
@ -68,6 +68,8 @@ public:
|
||||
|
||||
void set_duration(double units);
|
||||
|
||||
virtual void set_selected (bool) {}
|
||||
|
||||
guint source_track_color(unsigned char alpha = 0xff);
|
||||
bool is_automation_ghost();
|
||||
|
||||
|
@ -1849,4 +1849,3 @@ MidiTimeAxisView::create_velocity_automation_child (Evoral::Parameter const &, b
|
||||
|
||||
add_automation_child (Evoral::Parameter(MidiVelocityAutomation), velocity_track, show);
|
||||
}
|
||||
|
||||
|
@ -1145,6 +1145,10 @@ RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
|
||||
if (_view) {
|
||||
_view->set_selected_regionviews (regions);
|
||||
}
|
||||
|
||||
for (auto & child : children) {
|
||||
child->set_selected_regionviews (regions);
|
||||
}
|
||||
}
|
||||
|
||||
/** Add the selectable things that we have to a list.
|
||||
|
@ -56,6 +56,7 @@ VelocityGhostRegion::VelocityGhostRegion (MidiRegionView& mrv, TimeAxisView& tv,
|
||||
, dragging_line (nullptr)
|
||||
, last_drag_x (-1)
|
||||
, drag_did_change (false)
|
||||
, selected (false)
|
||||
{
|
||||
base_rect->Event.connect (sigc::mem_fun (*this, &VelocityGhostRegion::base_event));
|
||||
base_rect->set_fill_color (UIConfiguration::instance().color_mod ("ghost track base", "ghost track midi fill"));
|
||||
@ -71,6 +72,11 @@ VelocityGhostRegion::~VelocityGhostRegion ()
|
||||
bool
|
||||
VelocityGhostRegion::base_event (GdkEvent* ev)
|
||||
{
|
||||
if (!selected) {
|
||||
/* eat event to prevent it passing up th the automation track */
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<NoteBase*> affected_lollis;
|
||||
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (&parent_rv);
|
||||
@ -97,10 +103,12 @@ VelocityGhostRegion::base_event (GdkEvent* ev)
|
||||
dragging_line->add_point (ArdourCanvas::Duple (ev->motion.x - r.x0, ev->motion.y - r.y0));
|
||||
last_drag_x = ev->motion.x;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case GDK_BUTTON_PRESS:
|
||||
if (ev->button.button == 1) {
|
||||
assert (!dragging);
|
||||
desensitize_lollis ();
|
||||
dragging = true;
|
||||
drag_did_change = false;
|
||||
@ -115,15 +123,17 @@ VelocityGhostRegion::base_event (GdkEvent* ev)
|
||||
dragging_line->raise_to_top();
|
||||
base_rect->grab();
|
||||
mrv->begin_drag_edit (_("draw velocities"));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
if (ev->button.button == 1) {
|
||||
if (ev->button.button == 1 && dragging) {
|
||||
mrv->end_drag_edit (drag_did_change);
|
||||
base_rect->ungrab();
|
||||
dragging_line->hide ();
|
||||
dragging = false;
|
||||
sensitize_lollis ();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -131,6 +141,7 @@ VelocityGhostRegion::base_event (GdkEvent* ev)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -210,7 +221,13 @@ VelocityGhostRegion::set_colors ()
|
||||
base_rect->set_fill_color (UIConfiguration::instance().color_mod ("ghost track base", "ghost track midi fill"));
|
||||
|
||||
for (auto & gev : events) {
|
||||
gev.second->item->set_fill_color (gev.second->event->base_color());
|
||||
if (selected) {
|
||||
gev.second->item->set_fill_color (gev.second->event->base_color());
|
||||
gev.second->item->set_ignore_events (false);
|
||||
} else {
|
||||
gev.second->item->set_fill_color (UIConfiguration::instance().color ("ghost track wave"));
|
||||
gev.second->item->set_ignore_events (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,3 +378,9 @@ VelocityGhostRegion::sensitize_lollis ()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
VelocityGhostRegion::set_selected (bool yn)
|
||||
{
|
||||
selected = yn;
|
||||
set_colors ();
|
||||
}
|
||||
|
@ -47,11 +47,14 @@ public:
|
||||
|
||||
int y_position_to_velocity (double y) const;
|
||||
|
||||
void set_selected (bool);
|
||||
|
||||
private:
|
||||
bool dragging;
|
||||
ArdourCanvas::PolyLine* dragging_line;
|
||||
int last_drag_x;
|
||||
bool drag_did_change;
|
||||
bool selected;
|
||||
|
||||
bool base_event (GdkEvent*);
|
||||
bool lollevent (GdkEvent*, MidiGhostRegion::GhostEvent*);
|
||||
|
Loading…
Reference in New Issue
Block a user