positioning and other tweaks for Pianoroll overlay text

This commit is contained in:
Paul Davis
2025-04-11 11:23:03 -06:00
parent cf27064915
commit c61efd4900

View File

@@ -54,6 +54,7 @@ PianorollMidiView::PianorollMidiView (std::shared_ptr<ARDOUR::MidiTrack> mt,
MidiViewBackground& bg,
uint32_t basic_color)
: MidiView (mt, parent, ec, bg, basic_color)
, overlay_text (nullptr)
, active_automation (nullptr)
, velocity_display (nullptr)
, _height (0.)
@@ -233,6 +234,10 @@ PianorollMidiView::reset_width_dependent_items (double pixel_width)
{
MidiView::reset_width_dependent_items (pixel_width);
if (overlay_text) {
overlay_text->set_position (ArdourCanvas::Duple ((pixel_width / 2.0) - overlay_text->text_width(), (_height / 2.0 - overlay_text->text_height())));
}
for (auto & a : automation_map) {
if (a.second.line) {
a.second.line->reset ();
@@ -730,9 +735,11 @@ PianorollMidiView::set_overlay_text (std::string const & str)
{
if (!overlay_text) {
overlay_text = new ArdourCanvas::Text (_note_group->parent());
Pango::FontDescription font ("Sans 18");
Pango::FontDescription font ("Sans 200");
overlay_text->set_font_description (font);
overlay_text->set_color (0xff0000ff);
overlay_text->set_color (0xff000088);
overlay_text->set ("0"); /* not shown, used for positioning math */
overlay_text->set_position (ArdourCanvas::Duple ((midi_context().width() / 2.0) - (overlay_text->text_width()/2.), (midi_context().height() / 2.0) - (overlay_text->text_height() / 2.)));
}
overlay_text->set (str);