From: Carl Hetherington Date: Thu, 12 Nov 2009 00:17:45 +0000 (+0000) Subject: Allow route name edit from the right-hand-side editor list. X-Git-Tag: 3.0-alpha5~2820 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=9d0e560a1fffc5fb1453da0194d6e5608f26d220;p=ardour.git Allow route name edit from the right-hand-side editor list. git-svn-id: svn://localhost/ardour2/branches/3.0@6065 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index 38a78370ff..24fe0f7c4b 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -90,12 +90,17 @@ EditorRoutes::EditorRoutes (Editor* e) _display.set_headers_visible (true); _display.set_name ("TrackListDisplay"); - _display.get_selection()->set_mode (SELECTION_NONE); + _display.get_selection()->set_mode (SELECTION_SINGLE); _display.set_reorderable (true); _display.set_rules_hint (true); _display.set_size_request (100, -1); _display.add_object_drag (_columns.route.index(), "routes"); + CellRendererText* name_cell = dynamic_cast (_display.get_column_cell_renderer (2)); + assert (name_cell); + name_cell->property_editable() = true; + name_cell->signal_edited().connect (mem_fun (*this, &EditorRoutes::name_edit)); + CellRendererToggle* visible_cell = dynamic_cast(_display.get_column_cell_renderer (1)); visible_cell->property_activatable() = true; @@ -847,3 +852,18 @@ EditorRoutes::clear () _model->clear (); _display.set_model (_model); } + +void +EditorRoutes::name_edit (Glib::ustring const & path, Glib::ustring const & new_text) +{ + TreeIter iter = _model->get_iter (path); + if (!iter) { + return; + } + + boost::shared_ptr route = (*iter)[_columns.route]; + + if (route) { + route->set_name (new_text); + } +} diff --git a/gtk2_ardour/editor_routes.h b/gtk2_ardour/editor_routes.h index 22bff40e35..1086313d08 100644 --- a/gtk2_ardour/editor_routes.h +++ b/gtk2_ardour/editor_routes.h @@ -73,6 +73,7 @@ private: ); void track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const & iter, int* new_order); bool selection_filter (Glib::RefPtr const &, Gtk::TreeModel::Path const &, bool); + void name_edit (Glib::ustring const &, Glib::ustring const &); struct ModelColumns : public Gtk::TreeModel::ColumnRecord { ModelColumns() {