13
0

Arranger: allow renaming by context-menu

This commit is contained in:
Ben Loftis 2023-09-01 15:11:44 -05:00 committed by Robin Gareus
parent 101744b812
commit 5ceb66c902
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 18 additions and 0 deletions

View File

@ -358,6 +358,21 @@ EditorSections::drag_data_received (Glib::RefPtr<Gdk::DragContext> const& contex
redisplay ();
}
bool
EditorSections::rename_selected_section ()
{
if (_view.get_selection ()->count_selected_rows () != 1) {
return false;
}
TreeView::Selection::ListHandle_Path rows = _view.get_selection ()->get_selected_rows ();
_view.set_cursor (*rows.begin (), *_view.get_column (0), true);
return true;
}
bool
EditorSections::delete_selected_section ()
{
@ -401,6 +416,8 @@ EditorSections::show_context_menu (int button, int time)
using namespace Gtk::Menu_Helpers;
Gtk::Menu* menu = ARDOUR_UI_UTILS::shared_popup_menu ();
MenuList& items = menu->items ();
items.push_back (MenuElem (_("Rename the selected Section"), hide_return (sigc::mem_fun (*this, &EditorSections::rename_selected_section))));
items.push_back (SeparatorElem ());
items.push_back (MenuElem (_("Remove the selected Section"), hide_return (sigc::mem_fun (*this, &EditorSections::delete_selected_section))));
menu->popup (button, time);
}

View File

@ -42,6 +42,7 @@ public:
private:
void redisplay ();
bool delete_selected_section ();
bool rename_selected_section ();
void clear_selection ();
void selection_changed ();