Allow to edit arrangement label in sidebar

This commit is contained in:
Robin Gareus 2023-08-30 23:04:39 +02:00
parent 44e1de4261
commit 7997c83b01
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 22 additions and 1 deletions

View File

@ -44,7 +44,16 @@ EditorSections::EditorSections ()
{
_model = ListStore::create (_columns);
_view.set_model (_model);
_view.append_column (_("Name"), _columns.name);
Gtk::TreeViewColumn* c = manage (new Gtk::TreeViewColumn (_("Name"), _columns.name));
_view.append_column (*c);
c->set_resizable (true);
c->set_data ("mouse-edits-require-mod1", (gpointer)0x1);
CellRendererText* section_name_cell = dynamic_cast<CellRendererText*> (c->get_first_cell ());
section_name_cell->property_editable () = true;
section_name_cell->signal_edited ().connect (sigc::mem_fun (*this, &EditorSections::name_edited));
_view.append_column (_("Start"), _columns.s_start);
_view.append_column (_("End"), _columns.s_end);
_view.set_headers_visible (true);
@ -414,6 +423,16 @@ EditorSections::button_press (GdkEventButton* ev)
return false;
}
void
EditorSections::name_edited (const std::string& path, const std::string& new_text)
{
TreeIter i;
if ((i = _model->get_iter (path))) {
Location* l = (*i)[_columns.location];
l->set_name (new_text);
}
}
bool
EditorSections::enter_notify (GdkEventCrossing*)
{

View File

@ -60,6 +60,8 @@ private:
void drag_data_received (Glib::RefPtr<Gdk::DragContext> const&, int, int, Gtk::SelectionData const&, guint, guint);
void drag_leave (Glib::RefPtr<Gdk::DragContext> const&, guint);
void name_edited (const std::string&, const std::string&);
struct Section {
Section ()
: location (NULL)