mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 00:56:33 +01:00
more logic improvements for managing active/visible state of pianoroll automation
This commit is contained in:
parent
1911899d15
commit
a8914cbb61
2 changed files with 45 additions and 8 deletions
|
|
@ -133,7 +133,7 @@ PianorollMidiView::set_height (double h)
|
||||||
double note_area_height;
|
double note_area_height;
|
||||||
double automation_height;
|
double automation_height;
|
||||||
|
|
||||||
if (automation_map.empty()) {
|
if (!have_visible_automation()) {
|
||||||
note_area_height = h;
|
note_area_height = h;
|
||||||
automation_height = 0.;
|
automation_height = 0.;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -424,6 +424,18 @@ PianorollMidiView::find_or_create_automation_display_state (Evoral::Parameter co
|
||||||
return ads;
|
return ads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PianorollMidiView::have_visible_automation () const
|
||||||
|
{
|
||||||
|
for (auto const & [oarameter,ads] : automation_map) {
|
||||||
|
if (ads.visible) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PianorollMidiView::toggle_visibility (Evoral::Parameter const & param)
|
PianorollMidiView::toggle_visibility (Evoral::Parameter const & param)
|
||||||
{
|
{
|
||||||
|
|
@ -456,9 +468,11 @@ PianorollMidiView::toggle_visibility (Evoral::Parameter const & param)
|
||||||
ads->hide ();
|
ads->hide ();
|
||||||
if (ads == active_automation) {
|
if (ads == active_automation) {
|
||||||
unset_active_automation ();
|
unset_active_automation ();
|
||||||
/* no need to set height or emit signal */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!have_visible_automation()) {
|
||||||
|
set_height (_height);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ads->show ();
|
ads->show ();
|
||||||
}
|
}
|
||||||
|
|
@ -480,15 +494,33 @@ PianorollMidiView::set_active_automation (Evoral::Parameter const & param)
|
||||||
void
|
void
|
||||||
PianorollMidiView::unset_active_automation ()
|
PianorollMidiView::unset_active_automation ()
|
||||||
{
|
{
|
||||||
for (CueAutomationMap::iterator i = automation_map.begin(); i != automation_map.end(); ++i) {
|
if (!active_automation) {
|
||||||
if (i->second.line) {
|
return;
|
||||||
i->second.line->set_sensitive (false);
|
}
|
||||||
|
|
||||||
|
CueAutomationMap::size_type visible = 0;
|
||||||
|
|
||||||
|
for (auto & [param,ads] : automation_map) {
|
||||||
|
if (ads.line) {
|
||||||
|
ads.line->set_sensitive (false);
|
||||||
} else {
|
} else {
|
||||||
i->second.velocity_display->set_sensitive (false);
|
ads.velocity_display->set_sensitive (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ads.visible) {
|
||||||
|
visible++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the currently active automation is the only one visible, hide it */
|
||||||
|
|
||||||
|
if (active_automation->visible && visible == 1) {
|
||||||
|
active_automation->hide ();
|
||||||
|
set_height (_height);
|
||||||
|
}
|
||||||
|
|
||||||
active_automation = nullptr;
|
active_automation = nullptr;
|
||||||
|
|
||||||
AutomationStateChange(); /* EMIT SIGNAL */
|
AutomationStateChange(); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -496,14 +528,18 @@ void
|
||||||
PianorollMidiView::internal_set_active_automation (AutomationDisplayState& ads)
|
PianorollMidiView::internal_set_active_automation (AutomationDisplayState& ads)
|
||||||
{
|
{
|
||||||
if (active_automation == &ads) {
|
if (active_automation == &ads) {
|
||||||
|
unset_active_automation ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* active automation MUST be visible and sensitive */
|
/* active automation MUST be visible and sensitive */
|
||||||
|
bool had_visible = have_visible_automation ();
|
||||||
|
ads.show ();
|
||||||
|
if (!had_visible) {
|
||||||
|
set_height (_height);
|
||||||
|
}
|
||||||
ads.set_sensitive (true);
|
ads.set_sensitive (true);
|
||||||
ads.set_height (automation_group->get().height());
|
ads.set_height (automation_group->get().height());
|
||||||
ads.show ();
|
|
||||||
active_automation = &ads;
|
active_automation = &ads;
|
||||||
|
|
||||||
/* Now desensitize the rest */
|
/* Now desensitize the rest */
|
||||||
|
|
|
||||||
|
|
@ -137,4 +137,5 @@ class PianorollMidiView : public MidiView
|
||||||
Gtkmm2ext::Color line_color_for (Evoral::Parameter const &);
|
Gtkmm2ext::Color line_color_for (Evoral::Parameter const &);
|
||||||
|
|
||||||
void reset_width_dependent_items (double pixel_width);
|
void reset_width_dependent_items (double pixel_width);
|
||||||
|
bool have_visible_automation () const;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue