more work on scroomer behavior, close to as intended but still a little bit meh

This commit is contained in:
Paul Davis 2025-07-07 13:47:36 -06:00
parent 99c1f50a72
commit d847266cd5
3 changed files with 14 additions and 7 deletions

View file

@ -247,6 +247,10 @@ MidiViewBackground::apply_note_range (uint8_t lowest, uint8_t highest, bool to_c
return false;
}
if (lowest == highest) {
return false;
}
bool changed = false;
uint8_t ol = _lowest_note;
uint8_t oh = _highest_note;
@ -280,9 +284,9 @@ MidiViewBackground::apply_note_range (uint8_t lowest, uint8_t highest, bool to_c
int nh = std::min ((int) (UIConfiguration::instance().get_max_note_height() * uiscale), apparent_note_height);
int additional_notes = 0;
if (nh < 3) {
if (nh < 1) {
/* range does not fit, so center on the data range */
nh = 3;
nh = 1;
range = _data_note_max - _data_note_min;
int center = _data_note_min + (range /2);
highest = center + ((contents_height() / nh) / 2);

View file

@ -575,9 +575,9 @@ PianoRollHeaderBase::motion_handler (GdkEventMotion* ev)
_saved_top_val = min (_adj.get_value() + _adj.get_page_size (), 127.0);
} else {
_saved_top_val = 0.0;
// _midi_context.apply_note_range (_adj.get_value (), real_val_at_pointer, true, MidiViewBackground::CanMoveTop);
idle_lower = _adj.get_value();
idle_upper = real_val_at_pointer;
idle_range_move = MidiViewBackground::CanMoveTop;
if (!scroomer_drag_connection.connected()) {
scroomer_drag_connection = Glib::signal_idle().connect (sigc::mem_fun (*this, &PianoRollHeaderBase::idle_apply_range));
}
@ -587,13 +587,14 @@ PianoRollHeaderBase::motion_handler (GdkEventMotion* ev)
case BOTTOM:
real_val_at_pointer = real_val_at_pointer >= _saved_bottom_val? _adj.get_value() : real_val_at_pointer;
real_val_at_pointer = max (0.0, floor (real_val_at_pointer));
if (_midi_context.note_height() >= UIConfiguration::instance().get_max_note_height()){
_saved_bottom_val = _adj.get_value();
} else {
_saved_bottom_val = 127.0;
// _midi_context.apply_note_range (real_val_at_pointer, _adj.get_value () + _adj.get_page_size (), true, MidiViewBackground::CanMoveBottom);
idle_upper = _adj.get_value() + _adj.get_page_size();
idle_lower = real_val_at_pointer;
idle_upper = _adj.get_value();
idle_range_move = MidiViewBackground::CanMoveBottom;
if (!scroomer_drag_connection.connected()) {
scroomer_drag_connection = Glib::signal_idle().connect (sigc::mem_fun (*this, &PianoRollHeaderBase::idle_apply_range));
}
@ -648,7 +649,7 @@ PianoRollHeaderBase::motion_handler (GdkEventMotion* ev)
bool
PianoRollHeaderBase::idle_apply_range ()
{
_midi_context.apply_note_range (idle_lower, idle_upper, true, MidiViewBackground::CanMoveBottom);
_midi_context.apply_note_range (idle_lower, idle_upper, true, idle_range_move);
scroomer_drag_connection.disconnect ();
return false;
}

View file

@ -28,6 +28,8 @@
#include <ytkmm/adjustment.h>
#include "midi_view_background.h"
namespace Gdk {
class Window;
}
@ -37,7 +39,6 @@ namespace ARDOUR {
}
class MidiView;
class MidiViewBackground;
class EditingContext;
class PianoRollHeaderBase : virtual public sigc::trackable {
@ -149,5 +150,6 @@ class PianoRollHeaderBase : virtual public sigc::trackable {
bool idle_apply_range ();
double idle_lower;
double idle_upper;
MidiViewBackground::RangeCanMove idle_range_move;
sigc::connection scroomer_drag_connection;
};