From baf41a65c369a46e5d9ab3f992b584a1ae0e6658 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 30 Jun 2025 09:39:51 -0600 Subject: [PATCH] some incremental improvements in scroomer behavior Notably dbl-click works consistently/reliably --- gtk2_ardour/editing_context.cc | 29 ++++++++++++++++++----------- gtk2_ardour/midi_view_background.cc | 21 +++++---------------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index 77ca262e63..d5ed295b75 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -955,8 +955,6 @@ EditingContext::draw_length_changed () void EditingContext::set_draw_velocity_to (int v) { - std::cerr << "sdv = " << v << std::endl; - if (v < 0 || v > 127) { v = DRAW_VEL_AUTO; } @@ -1272,31 +1270,41 @@ EditingContext::build_draw_midi_menus () /* Note-Length when drawing */ - std::vector grids ({GridTypeBeat, + std::vector grids ({GridTypeBeat, GridTypeBeatDiv2, GridTypeBeatDiv4, GridTypeBeatDiv8, GridTypeBeatDiv16, GridTypeBeatDiv32, GridTypeNone}); + std::vector draw_grid_type_strings; + + draw_length_action (GridTypeNone)->set_active(); /* default */ for (auto & g : grids) { - draw_length_selector.append (draw_length_action ((GridType) g)); + Glib::RefPtr ract = draw_length_action (g); + draw_length_selector.append (ract); + draw_grid_type_strings.push_back (ract->get_short_label()); + } - { - std::vector draw_grid_type_strings = {grid_type_strings.begin() + GridTypeBeat, grid_type_strings.begin() + GridTypeBeatDiv32 + 1}; - draw_grid_type_strings.push_back (_("Auto")); - grid_type_selector.set_sizing_texts (draw_grid_type_strings); - } + grid_type_selector.set_sizing_texts (draw_grid_type_strings); /* Note-Velocity when drawing */ std::vector preselected_velocities ({8,32,64,82,100,127, DRAW_VEL_AUTO}); + std::vector draw_velocity_strings; + + draw_velocity_action (DRAW_VEL_AUTO)->set_active (); /* default */ + for (auto & v : preselected_velocities) { - draw_velocity_selector.append (draw_velocity_action (v)); + Glib::RefPtr ract = draw_velocity_action (v); + draw_velocity_selector.append (ract); + draw_velocity_strings.push_back (ract->get_short_label()); } + draw_velocity_selector.set_sizing_texts (draw_velocity_strings); + /* Note-Channel when drawing */ for (int i = 0; i<= 15; i++) { char buf[64]; @@ -3513,4 +3521,3 @@ EditingContext::center_screen_internal (samplepos_t sample, float page) reset_x_origin (sample); } - diff --git a/gtk2_ardour/midi_view_background.cc b/gtk2_ardour/midi_view_background.cc index 77a4e79afa..6fa63d4769 100644 --- a/gtk2_ardour/midi_view_background.cc +++ b/gtk2_ardour/midi_view_background.cc @@ -190,9 +190,7 @@ MidiViewBackground::setup_note_lines() void MidiViewBackground::set_note_visibility_range_style (VisibleNoteRange r) { - _visibility_note_range = r; - - if (_visibility_note_range == FullRange) { + if (r == ContentsRange) { if (apply_note_range (_data_note_min, _data_note_max, true)) { _visibility_note_range = ContentsRange; } @@ -278,15 +276,9 @@ MidiViewBackground::apply_note_range (uint8_t lowest, uint8_t highest, bool to_c float uiscale = UIConfiguration::instance().get_ui_scale(); int const range = _highest_note - _lowest_note; - int nh = std::min ((int) (UIConfiguration::instance().get_max_note_height() * uiscale), (int) ceil ((double) contents_height() / range)); + int nh = std::max (5, std::min ((int) (UIConfiguration::instance().get_max_note_height() * uiscale), (int) ceil ((double) contents_height() / range))); int additional_notes = 0; - if (nh < 5) { - _lowest_note = ol; - _highest_note = oh; - return false; - } - if (note_range_set) { /* how many notes do we need to add or remove to adequately * fill contents_height() with note lines? @@ -313,14 +305,11 @@ MidiViewBackground::apply_note_range (uint8_t lowest, uint8_t highest, bool to_c if ((can_move & CanMoveTop) && (i % 2 && _highest_note < 127)) { _highest_note--; - } - else if ((can_move & CanMoveBottom) && (i % 2)) { + } else if ((can_move & CanMoveBottom) && (i % 2)) { _lowest_note++; - } - else if ((can_move & CanMoveBottom) && (_lowest_note > 0)) { + } else if ((can_move & CanMoveBottom) && (_lowest_note > 0)) { _lowest_note++; - } - else if ((can_move & CanMoveTop)) { + } else if ((can_move & CanMoveTop)) { _highest_note--; } }