enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / gtk2_ardour / route_ui.cc
index 868d6cae091784ec6df2e97b48801a327bc3d8b3..e06355637e9251afd3d61a13fead54137ed31b52 100644 (file)
@@ -63,6 +63,7 @@
 #include "mixer_strip.h"
 #include "plugin_pin_dialog.h"
 #include "prompter.h"
+#include "rgb_macros.h"
 #include "route_time_axis.h"
 #include "route_ui.h"
 #include "timers.h"
@@ -70,7 +71,7 @@
 #include "utils.h"
 
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace ARDOUR;
@@ -153,7 +154,6 @@ RouteUI::init ()
        multiple_mute_change = false;
        multiple_solo_change = false;
        _i_am_the_modifier = 0;
-       vca_button = 0;
 
        input_selector = 0;
        output_selector = 0;
@@ -346,6 +346,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
        check_rec_enable_sensitivity ();
        maybe_add_route_print_mgr ();
        route_color_changed();
+       route_gui_changed (PropertyChange (Properties::selected));
 }
 
 void
@@ -461,8 +462,7 @@ RouteUI::mute_press (GdkEventButton* ev)
                                        _mute_release->routes = rl;
                                }
 
-                               _session->set_control (_route->mute_control(), _route->muted_by_self() ? 0.0 : 1.0, Controllable::UseGroup);
-
+                               _route->mute_control()->set_value (!_route->muted_by_self(), Controllable::UseGroup);
                        }
                }
        }
@@ -599,9 +599,7 @@ RouteUI::solo_press(GdkEventButton* ev)
                                        /* ??? we need a just_one_listen() method */
                                } else {
                                        DisplaySuspender ds;
-                                       boost::shared_ptr<ControlList> cl (new ControlList);
-                                       cl->push_back (_route->solo_control());
-                                       _session->set_controls (cl, 1.0, Controllable::NoGroup);
+                                       _route->solo_control()->set_value (1.0, Controllable::NoGroup);
                                }
 
                        } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
@@ -756,7 +754,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
                } else {
 
                        boost::shared_ptr<Track> trk = track();
-                       _session->set_control (trk->rec_enable_control(), !trk->rec_enable_control()->get_value(), Controllable::UseGroup);
+                       trk->rec_enable_control()->set_value (!trk->rec_enable_control()->get_value(), Controllable::UseGroup);
                }
        }
 
@@ -1287,47 +1285,17 @@ RouteUI::update_mute_display ()
         mute_button->set_active_state (mute_active_state (_session, _route));
 }
 
-void
-RouteUI::update_vca_display ()
-{
-       if (!vca_button) {
-               return;
-       }
-
-       VCAList vcas (_session->vca_manager().vcas());
-       string label;
-
-       for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) {
-               if (_route->slaved_to (*v)) {
-                       if (!label.empty()) {
-                               label += ' ';
-                       }
-                       label += PBD::to_string ((*v)->number(), std::dec);
-               }
-       }
-
-       if (label.empty()) {
-               label = _("-vca-");
-               vca_button->set_active_state (Gtkmm2ext::Off);
-       } else {
-               vca_button->set_active_state (Gtkmm2ext::ExplicitActive);
-       }
-
-       vca_button->set_text (label);
-}
 
 void
 RouteUI::route_rec_enable_changed ()
 {
-       blink_rec_display(true);  //this lets the button change "immediately" rather than wait for the next blink
-       update_monitoring_display ();
+       blink_rec_display (true);  //this lets the button change "immediately" rather than wait for the next blink
 }
 
 void
 RouteUI::session_rec_enable_changed ()
 {
-       blink_rec_display(true);  //this lets the button change "immediately" rather than wait for the next blink
-       update_monitoring_display ();
+       blink_rec_display (true);  //this lets the button change "immediately" rather than wait for the next blink
 }
 
 void
@@ -1626,7 +1594,11 @@ RouteUI::route_state_id () const
 int
 RouteUI::set_color_from_route ()
 {
-       return 0;
+       if (_route->presentation_info().color_set()) {
+               return 0; /* nothing to do */
+       }
+
+       return 1; /* pick a color */
 }
 
 /** @return true if this name should be used for the route, otherwise false */
@@ -2044,9 +2016,9 @@ RouteUI::setup_invert_buttons ()
                }
 
                if (N <= _max_invert_buttons) {
-                       UI::instance()->set_tip (*b, string_compose (_("Left-click to invert (phase reverse) channel %1 of this track.  Right-click to show menu."), i + 1));
+                       UI::instance()->set_tip (*b, string_compose (_("Left-click to invert polarity of channel %1 of this track. Right-click to show menu."), i + 1));
                } else {
-                       UI::instance()->set_tip (*b, _("Click to show a menu of channels for inversion (phase reverse)"));
+                       UI::instance()->set_tip (*b, _("Click to show a menu of channels to invert polarity"));
                }
 
                _invert_buttons.push_back (b);
@@ -2172,33 +2144,6 @@ RouteUI::route_gui_changed (PropertyChange const& what_changed)
                        route_color_changed ();
                }
        }
-
-       if (what_changed.contains (Properties::selected)) {
-               show_selected ();
-       }
-}
-
-void
-RouteUI::set_selected (bool yn)
-{
-       Selectable::set_selected (yn);
-       if (_route) {
-               _route->presentation_info().set_selected (yn);
-       }
-}
-
-bool
-RouteUI::selected () const
-{
-       /* XXX not sure if this is a wise design. Probably don't really want
-        * the cached _selected value from Selectable.
-        */
-
-       if (!_route) {
-               return _selected;
-       }
-
-       return _route->presentation_info().selected();
 }
 
 void
@@ -2240,25 +2185,29 @@ RouteUI::route_color () const
 
                        /* old v4.x or earlier session. Use this information */
 
-                       int component;
+                       int red, green, blue;
                        char colon;
-                       PresentationInfo::color_t color = 0;
 
                        stringstream ss (p);
 
-                       ss >> component;
-                       ss >> colon;
-                       color |= ((component >> 2) << 16);
+                       /* old color format version was:
 
-                       ss >> component;
-                       ss >> colon;
-                       color |= ((component >> 2) << 8);
+                          16bit value for red:16 bit value for green:16 bit value for blue
 
-                       ss >> component;
+                          decode to rgb ..
+                       */
+
+                       ss >> red;
+                       ss >> colon;
+                       ss >> green;
                        ss >> colon;
-                       color |= (component >> 2);
+                       ss >> blue;
 
-                       _route->presentation_info().set_color (color);
+                       red >>= 2;
+                       green >>= 2;
+                       blue >>= 2;
+
+                       _route->presentation_info().set_color (RGBA_TO_UINT (red, green, blue, 255));
                }
 
                set_color_from_rgba (c, _route->presentation_info().color());
@@ -2389,3 +2338,10 @@ RouteUI::mark_hidden (bool yn)
        }
        return false;
 }
+
+boost::shared_ptr<Stripable>
+RouteUI::stripable () const
+{
+       return _route;
+}
+