mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 00:34:59 +01:00
more work on scroomer behavior, close to as intended but still a little bit meh
This commit is contained in:
parent
99c1f50a72
commit
d847266cd5
3 changed files with 14 additions and 7 deletions
|
|
@ -247,6 +247,10 @@ MidiViewBackground::apply_note_range (uint8_t lowest, uint8_t highest, bool to_c
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lowest == highest) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
uint8_t ol = _lowest_note;
|
uint8_t ol = _lowest_note;
|
||||||
uint8_t oh = _highest_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 nh = std::min ((int) (UIConfiguration::instance().get_max_note_height() * uiscale), apparent_note_height);
|
||||||
int additional_notes = 0;
|
int additional_notes = 0;
|
||||||
|
|
||||||
if (nh < 3) {
|
if (nh < 1) {
|
||||||
/* range does not fit, so center on the data range */
|
/* range does not fit, so center on the data range */
|
||||||
nh = 3;
|
nh = 1;
|
||||||
range = _data_note_max - _data_note_min;
|
range = _data_note_max - _data_note_min;
|
||||||
int center = _data_note_min + (range /2);
|
int center = _data_note_min + (range /2);
|
||||||
highest = center + ((contents_height() / nh) / 2);
|
highest = center + ((contents_height() / nh) / 2);
|
||||||
|
|
|
||||||
|
|
@ -575,9 +575,9 @@ PianoRollHeaderBase::motion_handler (GdkEventMotion* ev)
|
||||||
_saved_top_val = min (_adj.get_value() + _adj.get_page_size (), 127.0);
|
_saved_top_val = min (_adj.get_value() + _adj.get_page_size (), 127.0);
|
||||||
} else {
|
} else {
|
||||||
_saved_top_val = 0.0;
|
_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_lower = _adj.get_value();
|
||||||
idle_upper = real_val_at_pointer;
|
idle_upper = real_val_at_pointer;
|
||||||
|
idle_range_move = MidiViewBackground::CanMoveTop;
|
||||||
if (!scroomer_drag_connection.connected()) {
|
if (!scroomer_drag_connection.connected()) {
|
||||||
scroomer_drag_connection = Glib::signal_idle().connect (sigc::mem_fun (*this, &PianoRollHeaderBase::idle_apply_range));
|
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:
|
case BOTTOM:
|
||||||
real_val_at_pointer = real_val_at_pointer >= _saved_bottom_val? _adj.get_value() : real_val_at_pointer;
|
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));
|
real_val_at_pointer = max (0.0, floor (real_val_at_pointer));
|
||||||
|
|
||||||
if (_midi_context.note_height() >= UIConfiguration::instance().get_max_note_height()){
|
if (_midi_context.note_height() >= UIConfiguration::instance().get_max_note_height()){
|
||||||
_saved_bottom_val = _adj.get_value();
|
_saved_bottom_val = _adj.get_value();
|
||||||
} else {
|
} else {
|
||||||
_saved_bottom_val = 127.0;
|
_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_lower = real_val_at_pointer;
|
||||||
idle_upper = _adj.get_value();
|
idle_range_move = MidiViewBackground::CanMoveBottom;
|
||||||
if (!scroomer_drag_connection.connected()) {
|
if (!scroomer_drag_connection.connected()) {
|
||||||
scroomer_drag_connection = Glib::signal_idle().connect (sigc::mem_fun (*this, &PianoRollHeaderBase::idle_apply_range));
|
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
|
bool
|
||||||
PianoRollHeaderBase::idle_apply_range ()
|
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 ();
|
scroomer_drag_connection.disconnect ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
#include <ytkmm/adjustment.h>
|
#include <ytkmm/adjustment.h>
|
||||||
|
|
||||||
|
#include "midi_view_background.h"
|
||||||
|
|
||||||
namespace Gdk {
|
namespace Gdk {
|
||||||
class Window;
|
class Window;
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +39,6 @@ namespace ARDOUR {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MidiView;
|
class MidiView;
|
||||||
class MidiViewBackground;
|
|
||||||
class EditingContext;
|
class EditingContext;
|
||||||
|
|
||||||
class PianoRollHeaderBase : virtual public sigc::trackable {
|
class PianoRollHeaderBase : virtual public sigc::trackable {
|
||||||
|
|
@ -149,5 +150,6 @@ class PianoRollHeaderBase : virtual public sigc::trackable {
|
||||||
bool idle_apply_range ();
|
bool idle_apply_range ();
|
||||||
double idle_lower;
|
double idle_lower;
|
||||||
double idle_upper;
|
double idle_upper;
|
||||||
|
MidiViewBackground::RangeCanMove idle_range_move;
|
||||||
sigc::connection scroomer_drag_connection;
|
sigc::connection scroomer_drag_connection;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue