summaryrefslogtreecommitdiff
path: root/gtk2_ardour/route_ui.cc
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2014-07-29 16:40:19 -0500
committerBen Loftis <ben@harrisonconsoles.com>2014-07-29 16:40:19 -0500
commitb32823f074ae029bc8ecbb7c73e00035845c5c3e (patch)
tree90fa2d19fa6b77ccb95153bb33e7cbeee12ea92d /gtk2_ardour/route_ui.cc
parent79b34f0d8f5f6dde7676d6fb3f1d5bf3786f91ca (diff)
Various UI tweaks.
Refactor comments dialog into Route_UI so it can be shared by tracks and strips. Make Color and Comments selections consistent in the menus Refine the color displays at the top of each mixer strip Correctly color the number displays on tracks
Diffstat (limited to 'gtk2_ardour/route_ui.cc')
-rw-r--r--gtk2_ardour/route_ui.cc84
1 files changed, 79 insertions, 5 deletions
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 7802a0dd7b..0de1f81dac 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -71,6 +71,7 @@ RouteUI::RouteUI (ARDOUR::Session* sess)
, solo_menu(0)
, sends_menu(0)
, record_menu(0)
+ , comment_window(0)
, _invert_menu(0)
{
if (sess) init ();
@@ -86,6 +87,7 @@ RouteUI::~RouteUI()
delete sends_menu;
delete record_menu;
delete _invert_menu;
+ delete comment_window;
}
void
@@ -216,6 +218,8 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
_route->active_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_active_changed, this), gui_context());
_route->mute_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::mute_changed, this, _1), gui_context());
+ _route->comment_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::comment_changed, this, _1), gui_context());
+
_route->solo_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
_route->solo_safe_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
_route->listen_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
@@ -1383,8 +1387,7 @@ RouteUI::toggle_solo_safe (Gtk::CheckMenuItem* check)
_route->set_solo_safe (check->get_active(), this);
}
-/** Ask the user to choose a colour, and then set all selected tracks
- * to that colour.
+/** Ask the user to choose a colour, and then apply that color to my route
*/
void
RouteUI::choose_color ()
@@ -1393,9 +1396,7 @@ RouteUI::choose_color ()
Gdk::Color const color = Gtkmm2ext::UI::instance()->get_color (_("Color Selection"), picked, &_color);
if (picked) {
- ARDOUR_UI::instance()->the_editor().get_selection().tracks.foreach_route_ui (
- boost::bind (&RouteUI::set_color, _1, color)
- );
+ set_color(color);
}
}
@@ -1581,6 +1582,79 @@ RouteUI::property_changed (const PropertyChange& what_changed)
}
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 ()
+{
+ string const str = comment_area->get_buffer()->get_text();
+ if (str == _route->comment ()) {
+ return;
+ }
+
+ _route->set_comment (str, this);
+}
+
+void
RouteUI::set_route_active (bool a, bool apply_to_selection)
{
if (apply_to_selection) {