various changes to get event sensitivity and cursors with pianoroll velocity/automation working better
This commit is contained in:
@@ -776,14 +776,23 @@ Pianoroll::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, It
|
||||
break;
|
||||
|
||||
case VelocityItem:
|
||||
if (mouse_mode == Editing::MouseContent) {
|
||||
_drags->set (new LollipopDrag (*this, item), event);
|
||||
}
|
||||
/* mouse mode independent - always allow drags */
|
||||
_drags->set (new LollipopDrag (*this, item), event);
|
||||
return true;
|
||||
break;
|
||||
|
||||
case VelocityBaseItem:
|
||||
_drags->set (new VelocityLineDrag (*this, *static_cast<ArdourCanvas::Rectangle*>(item), false, Temporal::BeatTime), event);
|
||||
switch (mouse_mode) {
|
||||
case Editing::MouseContent:
|
||||
/* rubberband drag to select notes */
|
||||
_drags->set (new RubberbandSelectDrag (*this, item, [&](GdkEvent* ev, timepos_t const & pos) { return view->velocity_rb_click (ev, pos); }), event);
|
||||
break;
|
||||
case Editing::MouseDraw:
|
||||
_drags->set (new VelocityLineDrag (*this, *static_cast<ArdourCanvas::Rectangle*>(item), false, Temporal::BeatTime), event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
||||
@@ -859,6 +868,7 @@ Pianoroll::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, It
|
||||
/* grab dragged, so do nothing else */
|
||||
return true;
|
||||
}
|
||||
std::cerr << "end grab was not true\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1760,7 +1770,7 @@ Pianoroll::which_mode_cursor () const
|
||||
|
||||
switch (mouse_mode) {
|
||||
case Editing::MouseContent:
|
||||
/* don't use mode cursor, pick a grabber cursor based on the item */
|
||||
mode_cursor = _cursors->grabber;
|
||||
break;
|
||||
|
||||
case Editing::MouseDraw:
|
||||
@@ -1822,6 +1832,9 @@ Pianoroll::which_canvas_cursor (ItemType type) const
|
||||
case RegionItem:
|
||||
cursor = nullptr; /* default cursor */
|
||||
break;
|
||||
case VelocityItem:
|
||||
cursor = _cursors->up_down;
|
||||
break;
|
||||
|
||||
case ClipEndItem:
|
||||
case ClipStartItem:
|
||||
@@ -1855,6 +1868,9 @@ Pianoroll::which_canvas_cursor (ItemType type) const
|
||||
case RegionItem:
|
||||
cursor = _cursors->midi_pencil;
|
||||
break;
|
||||
case VelocityItem:
|
||||
cursor = _cursors->up_down;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1897,6 +1913,8 @@ Pianoroll::leave_handler (ArdourCanvas::Item* item, GdkEvent* ev, ItemType item_
|
||||
{
|
||||
EditorAutomationLine* al;
|
||||
|
||||
set_canvas_cursor (which_mode_cursor());
|
||||
|
||||
switch (item_type) {
|
||||
case ControlPointItem:
|
||||
_verbose_cursor->hide ();
|
||||
|
||||
@@ -38,6 +38,9 @@ PianorollAutomationLine::PianorollAutomationLine (const std::string&
|
||||
bool
|
||||
PianorollAutomationLine::base_event_handler (GdkEvent* ev)
|
||||
{
|
||||
if (!sensitive()) {
|
||||
return false;
|
||||
}
|
||||
return _editing_context.typed_event (_drag_base, ev, AutomationTrackItem);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "canvas/box.h"
|
||||
#include "canvas/button.h"
|
||||
#include "canvas/canvas.h"
|
||||
#include "canvas/debug.h"
|
||||
|
||||
#include "editing_context.h"
|
||||
@@ -407,6 +408,8 @@ PianorollMidiView::update_automation_display (Evoral::Parameter const & param, S
|
||||
for (auto & ev : _events) {
|
||||
velocity_display->add_note (ev.second);
|
||||
}
|
||||
|
||||
velocity_display->set_sensitive (false);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -503,20 +506,21 @@ PianorollMidiView::internal_set_active_automation (Evoral::Parameter const & par
|
||||
{
|
||||
bool exists = false;
|
||||
|
||||
for (CueAutomationMap::iterator i = automation_map.begin(); i != automation_map.end(); ++i) {
|
||||
if (i->first == param) {
|
||||
if (i->second.line) {
|
||||
for (auto & iter : automation_map) {
|
||||
if (iter.first == param) {
|
||||
if (iter.second.line) {
|
||||
/* velocity does not have a line */
|
||||
i->second.line->set_sensitive (true);
|
||||
iter.second.line->set_sensitive (true);
|
||||
} else {
|
||||
iter.second.velocity_display->set_sensitive (true);
|
||||
}
|
||||
active_automation = &i->second;
|
||||
active_automation = &iter.second;
|
||||
exists = true;
|
||||
} else {
|
||||
if (i->second.line) {
|
||||
i->second.line->set_sensitive (false);
|
||||
if (iter.second.line) {
|
||||
iter.second.line->set_sensitive (false);
|
||||
} else {
|
||||
i->second.velocity_display->set_sensitive (false);
|
||||
iter.second.velocity_display->set_sensitive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -589,6 +593,16 @@ PianorollMidiView::automation_rb_click (GdkEvent* event, Temporal::timepos_t con
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
PianorollMidiView::velocity_rb_click (GdkEvent* event, Temporal::timepos_t const & pos)
|
||||
{
|
||||
if (!active_automation || !active_automation->control || !active_automation->velocity_display) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
PianorollMidiView::line_drag_click (GdkEvent* event, Temporal::timepos_t const & pos)
|
||||
{
|
||||
@@ -652,7 +666,9 @@ void
|
||||
PianorollMidiView::point_selection_changed ()
|
||||
{
|
||||
if (active_automation) {
|
||||
active_automation->line->set_selected_points (_editing_context.get_selection().points);
|
||||
if (active_automation->line) {
|
||||
active_automation->line->set_selected_points (_editing_context.get_selection().points);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,6 +679,8 @@ PianorollMidiView::clear_selection ()
|
||||
PointSelection empty;
|
||||
|
||||
for (CueAutomationMap::iterator i = automation_map.begin(); i != automation_map.end(); ++i) {
|
||||
i->second.line->set_selected_points (empty);
|
||||
if (i->second.line) {
|
||||
i->second.line->set_selected_points (empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ class PianorollMidiView : public MidiView
|
||||
MergeableLine* make_merger ();
|
||||
|
||||
bool automation_rb_click (GdkEvent*, Temporal::timepos_t const &);
|
||||
bool velocity_rb_click (GdkEvent*, Temporal::timepos_t const &);
|
||||
void line_drag_click (GdkEvent*, Temporal::timepos_t const &);
|
||||
|
||||
void automation_entry();
|
||||
|
||||
@@ -63,6 +63,9 @@ PianorollVelocityDisplay::remove_note (NoteBase* nb)
|
||||
bool
|
||||
PianorollVelocityDisplay::base_event (GdkEvent* ev)
|
||||
{
|
||||
if (!_sensitive) {
|
||||
return false;
|
||||
}
|
||||
return editing_context.canvas_velocity_base_event (ev, &base);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ VelocityDisplay::VelocityDisplay (EditingContext& ec, MidiViewBackground& backgr
|
||||
, drag_did_change (false)
|
||||
, selected (false)
|
||||
, _optimization_iterator (events.end())
|
||||
, _sensitive (false)
|
||||
{
|
||||
base.set_data (X_("ghostregionview"), this);
|
||||
base.Event.connect (sigc::mem_fun (*this, &VelocityDisplay::base_event));
|
||||
@@ -162,6 +163,14 @@ VelocityDisplay::set_sensitive (bool yn)
|
||||
for (auto & ev : events) {
|
||||
ev.second->set_sensitive (yn);
|
||||
}
|
||||
|
||||
_sensitive = yn;
|
||||
}
|
||||
|
||||
bool
|
||||
VelocityDisplay::sensitive () const
|
||||
{
|
||||
return _sensitive;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -174,7 +183,6 @@ VelocityDisplay::add_note (NoteBase* nb)
|
||||
events.insert (std::make_pair (nb->note(), event));
|
||||
|
||||
l->Event.connect (sigc::bind (sigc::mem_fun (*this, &VelocityDisplay::lollevent), event));
|
||||
l->set_ignore_events (true);
|
||||
l->raise_to_top ();
|
||||
l->set_data (X_("ghostregionview"), this);
|
||||
l->set_data (X_("note"), nb);
|
||||
|
||||
@@ -66,6 +66,7 @@ class VelocityDisplay
|
||||
int y_position_to_velocity (double y) const;
|
||||
|
||||
void set_sensitive (bool yn);
|
||||
bool sensitive () const;
|
||||
|
||||
void set_selected (bool);
|
||||
|
||||
@@ -94,6 +95,7 @@ class VelocityDisplay
|
||||
bool drag_did_change;
|
||||
bool selected;
|
||||
GhostEvent::EventList::iterator _optimization_iterator;
|
||||
bool _sensitive;
|
||||
|
||||
virtual bool base_event (GdkEvent*) = 0;
|
||||
void set_size_and_position (GhostEvent&);
|
||||
|
||||
Reference in New Issue
Block a user