Hide scroomer when using layered mode

In layered mode the scroomer is not usable with stacked MIDI regions.

Ideally we'd only hide it if there is more than one layer
but that is for another day.
This commit is contained in:
Robin Gareus 2022-03-29 01:30:29 +02:00
parent 08acf42676
commit 5d7ff24130
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 47 additions and 16 deletions

View File

@ -581,21 +581,7 @@ MidiTimeAxisView::set_height (uint32_t h, TrackHeightMode m)
_midi_controls_box.hide();
}
if (h >= KEYBOARD_MIN_HEIGHT) {
if (is_track() && _range_scroomer) {
_range_scroomer->show();
}
if (is_track() && _piano_roll_header) {
_piano_roll_header->show();
}
} else {
if (is_track() && _range_scroomer) {
_range_scroomer->hide();
}
if (is_track() && _piano_roll_header) {
_piano_roll_header->hide();
}
}
update_scroomer_visbility (h, layer_display ());
/* We need to do this after changing visibility of our stuff, as it will
* eventually trigger a call to Editor::reset_controls_layout_width(),
@ -605,6 +591,47 @@ MidiTimeAxisView::set_height (uint32_t h, TrackHeightMode m)
RouteTimeAxisView::set_height (h, m);
}
void
MidiTimeAxisView::update_scroomer_visbility (uint32_t h, LayerDisplay d)
{
if (!is_track ()) {
return;
}
if (h >= KEYBOARD_MIN_HEIGHT && d == Overlaid) {
if (_range_scroomer) {
_range_scroomer->show();
}
if (_piano_roll_header) {
_piano_roll_header->show();
}
} else {
if (_range_scroomer) {
_range_scroomer->hide();
}
if (_piano_roll_header) {
_piano_roll_header->hide();
}
}
}
void
MidiTimeAxisView::set_layer_display (LayerDisplay d)
{
LayerDisplay prev_layer_display = layer_display ();
RouteTimeAxisView::set_layer_display (d);
LayerDisplay curr_layer_display = layer_display ();
if (curr_layer_display == prev_layer_display) {
return;
}
uint32_t h = current_height ();
update_scroomer_visbility (h, curr_layer_display);
/* If visibility changed, trigger a call to Editor::reset_controls_layout_width() */
_stripable->gui_changed ("track_height", (void *) 0);
}
void
MidiTimeAxisView::append_extra_display_menu_items ()
{

View File

@ -86,6 +86,7 @@ public:
MidiStreamView* midi_view();
void set_height (uint32_t, TrackHeightMode m = OnlySelf);
void set_layer_display (LayerDisplay d);
boost::shared_ptr<ARDOUR::MidiRegion> add_region (Temporal::timepos_t const &, Temporal::timecnt_t const &, bool);
@ -141,6 +142,8 @@ private:
void note_range_changed ();
void contents_height_changed ();
void update_scroomer_visbility (uint32_t, LayerDisplay);
void update_control_names ();
void update_midi_controls_visibility (uint32_t);

View File

@ -103,7 +103,8 @@ public:
void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list<Selectable *>&, bool within = false);
void get_inverted_selectables (Selection&, std::list<Selectable*>&);
void get_regionviews_at_or_after (Temporal::timepos_t const &, RegionSelection&);
void set_layer_display (LayerDisplay d);
virtual void set_layer_display (LayerDisplay d);
void toggle_layer_display ();
LayerDisplay layer_display () const;