13
0

midi cue editor: don't allocate space for automation till asked to do so

This commit is contained in:
Paul Davis 2024-11-12 08:51:29 -07:00
parent 0622f26b2a
commit d3272a6400
3 changed files with 22 additions and 11 deletions

View File

@ -141,11 +141,11 @@ MidiCueEditor::build_lower_toolbar ()
button_bar.pack_start (*pressure_button, false, false); button_bar.pack_start (*pressure_button, false, false);
button_bar.pack_start (*modulation_button, false, false); button_bar.pack_start (*modulation_button, false, false);
velocity_button->signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiVelocityAutomation, 0), false); velocity_button->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiVelocityAutomation, 0), false);
pressure_button->signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiChannelPressureAutomation, 0), false); pressure_button->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiChannelPressureAutomation, 0), false);
bender_button->signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiPitchBenderAutomation, 0), false); bender_button->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiPitchBenderAutomation, 0), false);
modulation_button->signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiCCAutomation, MIDI_CTL_MSB_MODWHEEL), false); modulation_button->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiCCAutomation, MIDI_CTL_MSB_MODWHEEL), false);
expression_button->signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiCCAutomation, MIDI_CTL_MSB_EXPRESSION), false); expression_button->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &MidiCueEditor::automation_button_event), ARDOUR::MidiCCAutomation, MIDI_CTL_MSB_EXPRESSION), false);
_toolbox.pack_start (button_bar, false, false); _toolbox.pack_start (button_bar, false, false);
} }

View File

@ -56,6 +56,7 @@ MidiCueView::MidiCueView (std::shared_ptr<ARDOUR::MidiTrack> mt,
, active_automation (nullptr) , active_automation (nullptr)
, velocity_display (nullptr) , velocity_display (nullptr)
, _slot_index (slot_index) , _slot_index (slot_index)
, _height (0.)
{ {
CANVAS_DEBUG_NAME (_note_group, X_("note group for MIDI cue")); CANVAS_DEBUG_NAME (_note_group, X_("note group for MIDI cue"));
@ -80,10 +81,6 @@ MidiCueView::MidiCueView (std::shared_ptr<ARDOUR::MidiTrack> mt,
set_extensible (true); set_extensible (true);
/* show velocity by default */
update_automation_display (Evoral::Parameter (MidiVelocityAutomation, 0, 0), SelectionSet);
} }
MidiCueView::~MidiCueView () MidiCueView::~MidiCueView ()
@ -94,8 +91,18 @@ MidiCueView::~MidiCueView ()
void void
MidiCueView::set_height (double h) MidiCueView::set_height (double h)
{ {
double note_area_height = ceil (h / 2.); _height = h;
double automation_height = ceil (h - note_area_height);
double note_area_height;
double automation_height;
if (automation_map.empty()) {
note_area_height = h;
automation_height = 0.;
} else {
note_area_height = ceil (h / 2.);
automation_height = ceil (h - note_area_height);
}
event_rect->set (ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, note_area_height)); event_rect->set (ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, note_area_height));
midi_context().set_size (midi_context().width(), note_area_height); midi_context().set_size (midi_context().width(), note_area_height);
@ -350,6 +357,8 @@ MidiCueView::update_automation_display (Evoral::Parameter const & param, Selecti
/* undefined in this context */ /* undefined in this context */
break; break;
} }
set_height (_height);
} }
std::list<SelectableOwner*> std::list<SelectableOwner*>

View File

@ -115,4 +115,6 @@ class MidiCueView : public MidiView
void update_sustained (Note *); void update_sustained (Note *);
void update_hit (Hit *); void update_hit (Hit *);
double _height;
}; };