more work on multiple automation display
This commit is contained in:
parent
c8b2c0c543
commit
c08cfa8109
@ -1622,8 +1622,9 @@ MidiCueEditor::enter_handler (ArdourCanvas::Item* item, GdkEvent* ev, ItemType i
|
|||||||
switch (item_type) {
|
switch (item_type) {
|
||||||
case AutomationTrackItem:
|
case AutomationTrackItem:
|
||||||
/* item is the base rectangle */
|
/* item is the base rectangle */
|
||||||
al = reinterpret_cast<EditorAutomationLine*> (item->get_data ("line"));
|
if (view) {
|
||||||
al->track_entered ();
|
view->automation_entry ();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EditorAutomationLineItem:
|
case EditorAutomationLineItem:
|
||||||
@ -1665,7 +1666,7 @@ MidiCueEditor::leave_handler (ArdourCanvas::Item* item, GdkEvent* ev, ItemType i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
||||||
al->track_exited ();
|
view->automation_leave ();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ MidiCueView::MidiCueView (std::shared_ptr<ARDOUR::MidiTrack> mt,
|
|||||||
MidiViewBackground& bg,
|
MidiViewBackground& bg,
|
||||||
uint32_t basic_color)
|
uint32_t basic_color)
|
||||||
: MidiView (mt, parent, ec, bg, basic_color)
|
: MidiView (mt, parent, ec, bg, basic_color)
|
||||||
|
, active_automation (nullptr)
|
||||||
, velocity_display (nullptr)
|
, velocity_display (nullptr)
|
||||||
, _slot_index (slot_index)
|
, _slot_index (slot_index)
|
||||||
{
|
{
|
||||||
@ -78,14 +79,6 @@ MidiCueView::MidiCueView (std::shared_ptr<ARDOUR::MidiTrack> mt,
|
|||||||
automation_group->set_fill_color (UIConfiguration::instance().color ("midi automation track fill"));
|
automation_group->set_fill_color (UIConfiguration::instance().color ("midi automation track fill"));
|
||||||
automation_group->set_data ("linemerger", this);
|
automation_group->set_data ("linemerger", this);
|
||||||
|
|
||||||
velocity_display = new MidiCueVelocityDisplay (editing_context(), midi_context(), *this, *automation_group, 0x312244ff);
|
|
||||||
|
|
||||||
for (auto & ev : _events) {
|
|
||||||
velocity_display->add_note (ev.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
velocity_display->hide ();
|
|
||||||
|
|
||||||
button_bar = new ArdourCanvas::Box (&parent, ArdourCanvas::Box::Horizontal);
|
button_bar = new ArdourCanvas::Box (&parent, ArdourCanvas::Box::Horizontal);
|
||||||
CANVAS_DEBUG_NAME (button_bar, "button bar");
|
CANVAS_DEBUG_NAME (button_bar, "button bar");
|
||||||
button_bar->set_spacing (12.);
|
button_bar->set_spacing (12.);
|
||||||
@ -123,8 +116,14 @@ MidiCueView::MidiCueView (std::shared_ptr<ARDOUR::MidiTrack> mt,
|
|||||||
|
|
||||||
set_extensible (true);
|
set_extensible (true);
|
||||||
|
|
||||||
Evoral::Parameter fully_qualified_param (ARDOUR::MidiVelocityAutomation, 0, 0);
|
/* show velocity by default */
|
||||||
update_automation_display (fully_qualified_param, SelectionSet);
|
|
||||||
|
update_automation_display (Evoral::Parameter (MidiVelocityAutomation, 0, 0), SelectionSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
MidiCueView::~MidiCueView ()
|
||||||
|
{
|
||||||
|
delete velocity_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -330,24 +329,44 @@ MidiCueView::update_automation_display (Evoral::Parameter const & param, Selecti
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (op == SelectionRemove) {
|
||||||
|
/* remove it, but it doesn't exist yet, no worries */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (param.type() == MidiVelocityAutomation) {
|
if (param.type() == MidiVelocityAutomation) {
|
||||||
|
|
||||||
|
|
||||||
|
if (!velocity_display) {
|
||||||
|
|
||||||
|
/* Create and add to automation display map */
|
||||||
|
|
||||||
|
velocity_display = new MidiCueVelocityDisplay (editing_context(), midi_context(), *this, *automation_group, 0x312244ff);
|
||||||
|
auto res = automation_map.insert (std::make_pair (Evoral::Parameter (ARDOUR::MidiVelocityAutomation, 0, 0), AutomationDisplayState (*velocity_display, true)));
|
||||||
|
|
||||||
|
ads = &((*res.first).second);
|
||||||
|
|
||||||
|
for (auto & ev : _events) {
|
||||||
|
velocity_display->add_note (ev.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
std::shared_ptr<Evoral::Control> control = _midi_region->model()->control (param, true);
|
std::shared_ptr<Evoral::Control> control = _midi_region->model()->control (param, true);
|
||||||
automation_control = std::dynamic_pointer_cast<AutomationControl> (control);
|
CueAutomationControl ac = std::dynamic_pointer_cast<AutomationControl> (control);
|
||||||
|
|
||||||
if (!automation_control) {
|
if (!ac) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
automation_line.reset (new MidiCueAutomationLine ("whatevs",
|
CueAutomationLine line (new MidiCueAutomationLine (ARDOUR::EventTypeMap::instance().to_symbol (param),
|
||||||
_editing_context,
|
_editing_context,
|
||||||
*automation_group,
|
*automation_group,
|
||||||
automation_group,
|
automation_group,
|
||||||
automation_control->alist(),
|
ac->alist(),
|
||||||
automation_control->desc()));
|
ac->desc()));
|
||||||
AutomationDisplayState cad (automation_control, automation_line, true);
|
AutomationDisplayState cad (ac, line, true);
|
||||||
|
|
||||||
auto res = automation_map.insert (std::make_pair (param, cad));
|
auto res = automation_map.insert (std::make_pair (param, cad));
|
||||||
|
|
||||||
@ -355,7 +374,7 @@ MidiCueView::update_automation_display (Evoral::Parameter const & param, Selecti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "sad " << op << " param " << enum_2_string (param.type()) << std::endl;
|
std::cerr << "sad " << op << " param " << ARDOUR::EventTypeMap::instance().to_symbol (param) << std::endl;
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case SelectionSet:
|
case SelectionSet:
|
||||||
@ -367,18 +386,26 @@ MidiCueView::update_automation_display (Evoral::Parameter const & param, Selecti
|
|||||||
case SelectionAdd:
|
case SelectionAdd:
|
||||||
ads->set_height (automation_group->get().height());
|
ads->set_height (automation_group->get().height());
|
||||||
ads->show ();
|
ads->show ();
|
||||||
|
active_automation = ads;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SelectionRemove:
|
case SelectionRemove:
|
||||||
ads->hide ();
|
ads->hide ();
|
||||||
|
if (active_automation == ads) {
|
||||||
|
active_automation = nullptr;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SelectionToggle:
|
case SelectionToggle:
|
||||||
if (ads->visible) {
|
if (ads->visible) {
|
||||||
ads->hide ();
|
ads->hide ();
|
||||||
|
if (active_automation == ads) {
|
||||||
|
active_automation = nullptr;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ads->set_height (automation_group->get().height());
|
ads->set_height (automation_group->get().height());
|
||||||
ads->show ();
|
ads->show ();
|
||||||
|
active_automation = ads;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -392,8 +419,8 @@ std::list<SelectableOwner*>
|
|||||||
MidiCueView::selectable_owners()
|
MidiCueView::selectable_owners()
|
||||||
{
|
{
|
||||||
std::list<SelectableOwner*> sl;
|
std::list<SelectableOwner*> sl;
|
||||||
if (automation_line) {
|
if (active_automation && active_automation->line) {
|
||||||
sl.push_back (automation_line.get());
|
sl.push_back (active_automation->line.get());
|
||||||
}
|
}
|
||||||
return sl;
|
return sl;
|
||||||
}
|
}
|
||||||
@ -401,16 +428,24 @@ MidiCueView::selectable_owners()
|
|||||||
MergeableLine*
|
MergeableLine*
|
||||||
MidiCueView::make_merger ()
|
MidiCueView::make_merger ()
|
||||||
{
|
{
|
||||||
return new MergeableLine (automation_line, automation_control,
|
if (active_automation && active_automation->line) {
|
||||||
[](Temporal::timepos_t const& t) { return t; },
|
return new MergeableLine (active_automation->line, active_automation->control,
|
||||||
nullptr, nullptr);
|
[](Temporal::timepos_t const& t) { return t; },
|
||||||
|
nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MidiCueView::automation_rb_click (GdkEvent* event, Temporal::timepos_t const & pos)
|
MidiCueView::automation_rb_click (GdkEvent* event, Temporal::timepos_t const & pos)
|
||||||
{
|
{
|
||||||
|
if (!active_automation || !active_automation->control || !active_automation->line) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
|
bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
|
||||||
automation_line->add (automation_control, event, pos, event->button.y, with_guard_points);
|
active_automation->line->add (active_automation->control, event, pos, event->button.y, with_guard_points);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,27 +456,33 @@ MidiCueView::line_drag_click (GdkEvent* event, Temporal::timepos_t const & pos)
|
|||||||
|
|
||||||
MidiCueView::AutomationDisplayState::~AutomationDisplayState()
|
MidiCueView::AutomationDisplayState::~AutomationDisplayState()
|
||||||
{
|
{
|
||||||
delete velocity_display;
|
/* We do not own the velocity_display */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiCueView::AutomationDisplayState::hide ()
|
MidiCueView::AutomationDisplayState::hide ()
|
||||||
{
|
{
|
||||||
if (velocity_display) {
|
if (velocity_display) {
|
||||||
|
std::cerr << "hide vdisp\n";
|
||||||
velocity_display->hide ();
|
velocity_display->hide ();
|
||||||
} else if (line) {
|
} else if (line) {
|
||||||
|
std::cerr << "hide line\n";
|
||||||
line->hide_all ();
|
line->hide_all ();
|
||||||
}
|
}
|
||||||
|
visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiCueView::AutomationDisplayState::show ()
|
MidiCueView::AutomationDisplayState::show ()
|
||||||
{
|
{
|
||||||
if (velocity_display) {
|
if (velocity_display) {
|
||||||
|
std::cerr << "show vdisp\n";
|
||||||
velocity_display->show ();
|
velocity_display->show ();
|
||||||
} else if (line) {
|
} else if (line) {
|
||||||
|
std::cerr << "show line\n";
|
||||||
line->show ();
|
line->show ();
|
||||||
}
|
}
|
||||||
|
visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -453,3 +494,20 @@ MidiCueView::AutomationDisplayState::set_height (double h)
|
|||||||
line->set_height (h);
|
line->set_height (h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiCueView::automation_entry ()
|
||||||
|
{
|
||||||
|
if (active_automation && active_automation->line) {
|
||||||
|
active_automation->line->track_entered ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiCueView::automation_leave ()
|
||||||
|
{
|
||||||
|
if (active_automation && active_automation->line) {
|
||||||
|
active_automation->line->track_entered ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -49,6 +49,8 @@ class MidiCueView : public MidiView
|
|||||||
uint32_t basic_color
|
uint32_t basic_color
|
||||||
);
|
);
|
||||||
|
|
||||||
|
~MidiCueView();
|
||||||
|
|
||||||
bool canvas_event (GdkEvent*);
|
bool canvas_event (GdkEvent*);
|
||||||
void set_samples_per_pixel (double);
|
void set_samples_per_pixel (double);
|
||||||
void set_height (double);
|
void set_height (double);
|
||||||
@ -70,6 +72,9 @@ class MidiCueView : public MidiView
|
|||||||
bool automation_rb_click (GdkEvent*, Temporal::timepos_t const &);
|
bool automation_rb_click (GdkEvent*, Temporal::timepos_t const &);
|
||||||
void line_drag_click (GdkEvent*, Temporal::timepos_t const &);
|
void line_drag_click (GdkEvent*, Temporal::timepos_t const &);
|
||||||
|
|
||||||
|
void automation_entry();
|
||||||
|
void automation_leave ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool scroll (GdkEventScroll* ev);
|
bool scroll (GdkEventScroll* ev);
|
||||||
|
|
||||||
@ -83,7 +88,7 @@ class MidiCueView : public MidiView
|
|||||||
AutomationDisplayState (CueAutomationControl ctl, CueAutomationLine ln, bool vis)
|
AutomationDisplayState (CueAutomationControl ctl, CueAutomationLine ln, bool vis)
|
||||||
: control (ctl), line (ln), velocity_display (nullptr), visible (vis) {}
|
: control (ctl), line (ln), velocity_display (nullptr), visible (vis) {}
|
||||||
AutomationDisplayState (VelocityDisplay& vdisp, bool vis)
|
AutomationDisplayState (VelocityDisplay& vdisp, bool vis)
|
||||||
: control (nullptr), velocity_display (&vdisp), visible (vis) {}
|
: control (nullptr), line (nullptr), velocity_display (&vdisp), visible (vis) {}
|
||||||
|
|
||||||
~AutomationDisplayState();
|
~AutomationDisplayState();
|
||||||
|
|
||||||
@ -103,8 +108,6 @@ class MidiCueView : public MidiView
|
|||||||
AutomationDisplayState* active_automation;
|
AutomationDisplayState* active_automation;
|
||||||
|
|
||||||
VelocityDisplay* velocity_display;
|
VelocityDisplay* velocity_display;
|
||||||
CueAutomationLine automation_line;
|
|
||||||
CueAutomationControl automation_control;
|
|
||||||
|
|
||||||
ArdourCanvas::Box* button_bar;
|
ArdourCanvas::Box* button_bar;
|
||||||
ArdourCanvas::Button* velocity_button;
|
ArdourCanvas::Button* velocity_button;
|
||||||
|
@ -436,13 +436,16 @@ VelocityDisplay::hide ()
|
|||||||
{
|
{
|
||||||
if (lolli_container) {
|
if (lolli_container) {
|
||||||
lolli_container->hide ();
|
lolli_container->hide ();
|
||||||
|
lolli_container->set_ignore_events (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VelocityDisplay::show ()
|
VelocityDisplay::show ()
|
||||||
{
|
{
|
||||||
if (lolli_container) {
|
if (lolli_container) {
|
||||||
lolli_container->hide ();
|
lolli_container->show ();
|
||||||
|
lolli_container->set_ignore_events (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user