add overlay text to pianoroll midi view

This commit is contained in:
Paul Davis 2025-04-09 11:11:32 -06:00
parent c8576880e6
commit e4f7571050
2 changed files with 36 additions and 0 deletions

View file

@ -28,6 +28,7 @@
#include "canvas/button.h"
#include "canvas/canvas.h"
#include "canvas/debug.h"
#include "canvas/text.h"
#include "editing_context.h"
#include "editor_drag.h"
@ -723,3 +724,33 @@ PianorollMidiView::clear_selection ()
}
}
}
void
PianorollMidiView::set_overlay_text (std::string const & str)
{
if (!overlay_text) {
overlay_text = new ArdourCanvas::Text (_note_group->parent());
Pango::FontDescription font ("Sans 18");
overlay_text->set_font_description (font);
overlay_text->set_color (0xff0000ff);
}
overlay_text->set (str);
show_overlay_text ();
}
void
PianorollMidiView::show_overlay_text ()
{
if (overlay_text) {
overlay_text->show ();
}
}
void
PianorollMidiView::hide_overlay_text ()
{
if (overlay_text) {
overlay_text->hide ();
}
}

View file

@ -86,10 +86,15 @@ class PianorollMidiView : public MidiView
sigc::signal<void> AutomationStateChange;
void set_overlay_text (std::string const &);
void hide_overlay_text ();
void show_overlay_text ();
protected:
bool scroll (GdkEventScroll* ev);
ArdourCanvas::Rectangle* automation_group;
ArdourCanvas::Text* overlay_text;
typedef std::shared_ptr<PianorollAutomationLine> CueAutomationLine;
typedef std::shared_ptr<ARDOUR::AutomationControl> CueAutomationControl;