refactor point-selection-changed logic "up" into EditingContext

This commit is contained in:
Paul Davis 2025-01-14 15:28:51 -07:00
parent c15556568e
commit 13161a3975
7 changed files with 23 additions and 1 deletions

View file

@ -229,6 +229,7 @@ EditingContext::EditingContext (std::string const & name)
full_zoom_button.set_name ("zoom button");
full_zoom_button.set_icon (ArdourIcon::ZoomFull);
selection->PointsChanged.connect (sigc::mem_fun(*this, &EditingContext::point_selection_changed));
for (int i = 0; i < 16; i++) {
char buf[4];

View file

@ -341,6 +341,8 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider
void reset_point_selection ();
virtual void point_selection_changed () = 0;
/** Set the mouse mode (gain, object, range, timefx etc.)
* @param m Mouse mode (defined in editing_syms.inc.h)
* @param force Perform the effects of the change even if no change is required

View file

@ -467,7 +467,6 @@ Editor::Editor ()
editor_regions_selection_changed_connection = selection->RegionsChanged.connect (sigc::mem_fun(*this, &Editor::region_selection_changed));
selection->PointsChanged.connect (sigc::mem_fun(*this, &Editor::point_selection_changed));
selection->MarkersChanged.connect (sigc::mem_fun(*this, &Editor::marker_selection_changed));
edit_controls_vbox.set_spacing (0);

View file

@ -2095,3 +2095,11 @@ Pianoroll::full_zoom_clicked()
samplecnt_t s = dur.second.samples() - dur.first.samples();
reposition_and_zoom (0, (s / (double) _visible_canvas_width));
}
void
Pianoroll::point_selection_changed ()
{
if (view) {
view->point_selection_changed ();
}
}

View file

@ -269,4 +269,6 @@ class Pianoroll : public CueEditor
void build_zoom_focus_menu ();
std::pair<Temporal::timepos_t,Temporal::timepos_t> max_zoom_extent() const;
void point_selection_changed ();
};

View file

@ -623,3 +623,11 @@ PianorollMidiView::automation_leave ()
active_automation->line->track_entered ();
}
}
void
PianorollMidiView::point_selection_changed ()
{
if (active_automation) {
active_automation->line->set_selected_points (_editing_context.get_selection().points);
}
}

View file

@ -77,6 +77,8 @@ class PianorollMidiView : public MidiView
void automation_entry();
void automation_leave ();
void point_selection_changed ();
sigc::signal<void> AutomationStateChange;
protected: