+void
+RouteUI::toggle_comment_editor ()
+{
+// if (ignore_toggle) {
+// return;
+// }
+
+ if (comment_window && comment_window->is_visible ()) {
+ comment_window->hide ();
+ } else {
+ open_comment_editor ();
+ }
+}
+
+
+void
+RouteUI::open_comment_editor ()
+{
+ if (comment_window == 0) {
+ setup_comment_editor ();
+ }
+
+ string title;
+ title = _route->name();
+ title += _(": comment editor");
+
+ comment_window->set_title (title);
+ comment_window->present();
+}
+
+void
+RouteUI::setup_comment_editor ()
+{
+ comment_window = new ArdourWindow (""); // title will be reset to show route
+ comment_window->set_skip_taskbar_hint (true);
+ comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing));
+ comment_window->set_default_size (400, 200);
+
+ comment_area = manage (new TextView());
+ comment_area->set_name ("MixerTrackCommentArea");
+ comment_area->set_wrap_mode (WRAP_WORD);
+ comment_area->set_editable (true);
+ comment_area->get_buffer()->set_text (_route->comment());
+ comment_area->show ();
+
+ comment_window->add (*comment_area);
+}
+
+void
+RouteUI::comment_changed (void *src)
+{
+ ENSURE_GUI_THREAD (*this, &MixerStrip::comment_changed, src)
+
+ if (src != this) {
+ ignore_comment_edit = true;
+ if (comment_area) {
+ comment_area->get_buffer()->set_text (_route->comment());
+ }
+ ignore_comment_edit = false;
+ }
+}
+
+void
+RouteUI::comment_editor_done_editing ()
+{
+ ENSURE_GUI_THREAD (*this, &MixerStrip::comment_editor_done_editing, src)
+
+ string const str = comment_area->get_buffer()->get_text();
+ if (str == _route->comment ()) {
+ return;
+ }
+
+ _route->set_comment (str, this);
+}
+