diff --git a/gtk2_ardour/editor_sections.cc b/gtk2_ardour/editor_sections.cc index 6a21b1711a..53cea3f4c3 100644 --- a/gtk2_ardour/editor_sections.cc +++ b/gtk2_ardour/editor_sections.cc @@ -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 (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*) { diff --git a/gtk2_ardour/editor_sections.h b/gtk2_ardour/editor_sections.h index 0d9a6d5ef1..1852949453 100644 --- a/gtk2_ardour/editor_sections.h +++ b/gtk2_ardour/editor_sections.h @@ -60,6 +60,8 @@ private: void drag_data_received (Glib::RefPtr const&, int, int, Gtk::SelectionData const&, guint, guint); void drag_leave (Glib::RefPtr const&, guint); + void name_edited (const std::string&, const std::string&); + struct Section { Section () : location (NULL)