pianoroll header: parametize kbd width and use when rendering

This commit is contained in:
Paul Davis 2025-08-06 11:11:39 -06:00
parent 35ee5a54d5
commit ffa0e3547b
3 changed files with 8 additions and 7 deletions

View file

@ -98,10 +98,10 @@ PianoRollHeader::size_request (double& w, double& h) const
if (show_scroomer()) {
_scroomer_size = 60.f * UIConfiguration::instance().get_ui_scale();
} else {
_scroomer_size = 20.f * UIConfiguration::instance().get_ui_scale();
_scroomer_size = kbd_width * UIConfiguration::instance().get_ui_scale();
}
w = _scroomer_size + 20.;
w = _scroomer_size + (kbd_width * UIConfiguration::instance().get_ui_scale());
}
bool

View file

@ -241,7 +241,6 @@ PianoRollHeaderBase::render (ArdourCanvas::Rect const & self, ArdourCanvas::Rect
origin_y -= 1;
}
cr->translate (origin_x, origin_y);
// Render the MIDNAM text or its equivalent. First, set up a clip
@ -351,13 +350,14 @@ PianoRollHeaderBase::render (ArdourCanvas::Rect const & self, ArdourCanvas::Rect
}
Gtkmm2ext::set_source_rgba (cr, bg);
double x = _scroomer_size;;
assert (_scroomer_size = width() - kbd_width);
double x = _scroomer_size;
double y = positions[n];
cr->rectangle (x, y, width() - 1., heights[n]);
cr->rectangle (x, y, kbd_width, heights[n]);
cr->fill ();
if ((oct_rel == 4 || oct_rel == 11) && y > 0) {
@ -369,7 +369,7 @@ PianoRollHeaderBase::render (ArdourCanvas::Rect const & self, ArdourCanvas::Rect
which are rects
*/
cr->move_to (x, y + 0.5);
cr->line_to (x + width(), y + 0.5);
cr->line_to (x + kbd_width, y + 0.5);
cr->stroke ();
}
}

View file

@ -103,6 +103,7 @@ class PianoRollHeaderBase : virtual public sigc::trackable {
double _saved_bottom_val;
mutable bool _mini_map_display;
bool entered;
static const int kbd_width = 20;
// void on_size_request(Gtk::Requisition*);