ensure that a Pianoroll window (and its action groups) are deleted when appropriate

This commit is contained in:
Paul Davis 2025-01-28 13:29:11 -07:00
parent 146df0306c
commit b82ae5590c
5 changed files with 15 additions and 2 deletions

View file

@ -2403,7 +2403,7 @@ EditingContext::register_grid_actions ()
ActionManager::register_action (editor_actions, X_("next-grid-choice"), _("Next Quantize Grid Choice"), sigc::mem_fun (*this, &EditingContext::next_grid_choice));
ActionManager::register_action (editor_actions, X_("prev-grid-choice"), _("Previous Quantize Grid Choice"), sigc::mem_fun (*this, &EditingContext::prev_grid_choice));
Glib::RefPtr<ActionGroup> snap_actions = ActionManager::create_action_group (bindings, editor_name() + X_("Snap"));
snap_actions = ActionManager::create_action_group (bindings, editor_name() + X_("Snap"));
RadioAction::Group grid_choice_group;
ActionManager::register_radio_action (snap_actions, grid_choice_group, X_("grid-type-thirtyseconds"), grid_type_strings[(int)GridTypeBeatDiv32].c_str(), (sigc::bind (sigc::mem_fun(*this, &EditingContext::grid_type_chosen), Editing::GridTypeBeatDiv32)));

View file

@ -680,6 +680,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider
ArdourWidgets::ArdourButton mouse_content_button;
Glib::RefPtr<Gtk::ActionGroup> editor_actions;
Glib::RefPtr<Gtk::ActionGroup> snap_actions;
virtual void register_actions() = 0;
void register_grid_actions ();

View file

@ -97,6 +97,8 @@ Pianoroll::Pianoroll (std::string const & name)
Pianoroll::~Pianoroll ()
{
delete bindings;
ActionManager::drop_action_group (editor_actions);
ActionManager::drop_action_group (snap_actions);
}
bool

View file

@ -18,6 +18,8 @@
#include "pbd/compose.h"
#include "gtkmm2ext/doi.h"
#include "ardour_ui.h"
#include "pianoroll.h"
#include "pianoroll_window.h"
@ -52,3 +54,10 @@ PianorollWindow::on_key_press_event (GdkEventKey* ev)
{
return ARDOUR_UI::instance()->key_event_handler (ev, this);
}
bool
PianorollWindow::on_delete_event (GdkEventAny*)
{
delete_when_idle (this);
return true;
}

View file

@ -34,7 +34,8 @@ class PianorollWindow : public ArdourWindow
~PianorollWindow ();
void set (std::shared_ptr<ARDOUR::MidiTrack>, std::shared_ptr<ARDOUR::MidiRegion>);
bool on_key_press_event (GdkEventKey* ev);
bool on_key_press_event (GdkEventKey*);
bool on_delete_event (GdkEventAny*);
private:
Pianoroll* pianoroll;