pianoroll: click on (BBT) ruler now locates

This commit is contained in:
Paul Davis
2025-04-16 10:17:08 -06:00
parent f69a18bfee
commit 1671b145ba
2 changed files with 42 additions and 0 deletions

View File

@@ -569,6 +569,8 @@ Pianoroll::build_canvas ()
n_timebars++;
bbt_ruler->Event.connect (sigc::mem_fun (*this, &Pianoroll::bbt_ruler_event));
data_group = new ArdourCanvas::Container (hv_scroll_group);
CANVAS_DEBUG_NAME (data_group, "cue data group");
@@ -620,6 +622,43 @@ Pianoroll::build_canvas ()
_toolbox.pack_start (*_canvas_viewport, true, true);
}
bool
Pianoroll::bbt_ruler_event (GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_RELEASE:
if (ev->button.button == 1) {
ruler_locate (&ev->button);
}
return true;
default:
break;
}
return false;
}
void
Pianoroll::ruler_locate (GdkEventButton* ev)
{
if (!_session) {
return;
}
if (ref.box()) {
/* we don't locate when working with triggers */
return;
}
if (!view->midi_region()) {
return;
}
samplepos_t sample = pixel_to_sample_from_event (ev->x);
sample += view->midi_region()->source_position().samples();
_session->request_locate (sample);
}
void
Pianoroll::visible_channel_changed ()
{

View File

@@ -336,4 +336,7 @@ class Pianoroll : public CueEditor
void count_in (Temporal::timepos_t, unsigned int);
void maybe_set_count_in ();
bool bbt_ruler_event (GdkEvent*);
void ruler_locate (GdkEventButton*);
};