tweak display of remote control id (dialog text)
[ardour.git] / gtk2_ardour / route_ui.cc
index 64ba5b067d85da04f0994ed35b2c854beec3ae11..c264588b2b2f70f9ce836bdffbcad831f72322ad 100644 (file)
 #include "route_time_axis.h"
 #include "group_tabs.h"
 
-#include "ardour/route.h"
-#include "ardour/event_type_map.h"
-#include "ardour/session.h"
-#include "ardour/audioengine.h"
 #include "ardour/audio_track.h"
+#include "ardour/audioengine.h"
+#include "ardour/filename_extensions.h"
 #include "ardour/midi_track.h"
+#include "ardour/route.h"
+#include "ardour/session.h"
 #include "ardour/template_utils.h"
-#include "ardour/filename_extensions.h"
-#include "ardour/directory_names.h"
-#include "ardour/profile.h"
 
 #include "i18n.h"
 using namespace Gtk;
@@ -1287,10 +1284,13 @@ RouteUI::solo_isolate_button_release (GdkEventButton* ev)
 }
 
 bool
-RouteUI::solo_safe_button_release (GdkEventButton*)
+RouteUI::solo_safe_button_release (GdkEventButton* ev)
 {
-        _route->set_solo_safe (!solo_safe_led->active_state(), this);
-        return true;
+       if (ev->button == 1) {
+               _route->set_solo_safe (!solo_safe_led->active_state(), this);
+               return true;
+       }
+       return false;
 }
 
 void
@@ -1344,7 +1344,7 @@ RouteUI::set_color (const Gdk::Color & c)
           the time axis view and the mixer strip
        */
        
-       gui_object_state().set<string> (route_state_id(), X_("color"), buf);
+       gui_object_state().set_property<string> (route_state_id(), X_("color"), buf);
        _route->gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */
 }
 
@@ -1628,14 +1628,14 @@ RouteUI::adjust_latency ()
 void
 RouteUI::save_as_template ()
 {
-       sys::path path;
+       std::string path;
        std::string safe_name;
        string name;
 
        path = ARDOUR::user_route_template_directory ();
 
-       if (g_mkdir_with_parents (path.to_string().c_str(), 0755)) {
-               error << string_compose (_("Cannot create route template directory %1"), path.to_string()) << endmsg;
+       if (g_mkdir_with_parents (path.c_str(), 0755)) {
+               error << string_compose (_("Cannot create route template directory %1"), path) << endmsg;
                return;
        }
 
@@ -1657,9 +1657,9 @@ RouteUI::save_as_template ()
        safe_name = legalize_for_path (name);
        safe_name += template_suffix;
 
-       path /= safe_name;
+       path = Glib::build_filename (path, safe_name);
 
-       _route->save_as_template (path.to_string(), name);
+       _route->save_as_template (path, name);
 }
 
 void
@@ -1716,27 +1716,53 @@ void
 RouteUI::open_remote_control_id_dialog ()
 {
        ArdourDialog dialog (_("Remote Control ID"));
+       SpinButton* spin = 0;
 
-       uint32_t const limit = _session->ntracks() + _session->nbusses () + 4;
-
-       HBox* hbox = manage (new HBox);
-       hbox->set_spacing (6);
-       hbox->pack_start (*manage (new Label (_("Remote control ID:"))));
-       SpinButton* spin = manage (new SpinButton);
-       spin->set_digits (0);
-       spin->set_increments (1, 10);
-       spin->set_range (0, limit);
-       spin->set_value (_route->remote_control_id());
-       hbox->pack_start (*spin);
-       dialog.get_vbox()->pack_start (*hbox);
+       dialog.get_vbox()->set_border_width (18);
 
-       dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL);
-       dialog.add_button (Stock::APPLY, RESPONSE_ACCEPT);
+       if (Config->get_remote_model() == UserOrdered) {
+               uint32_t const limit = _session->ntracks() + _session->nbusses () + 4;
+               
+               HBox* hbox = manage (new HBox);
+               hbox->set_spacing (6);
+               hbox->pack_start (*manage (new Label (_("Remote control ID:"))));
+               spin = manage (new SpinButton);
+               spin->set_digits (0);
+               spin->set_increments (1, 10);
+               spin->set_range (0, limit);
+               spin->set_value (_route->remote_control_id());
+               hbox->pack_start (*spin);
+               dialog.get_vbox()->pack_start (*hbox);
+               
+               dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL);
+               dialog.add_button (Stock::APPLY, RESPONSE_ACCEPT);
+       } else {
+               Label* l = manage (new Label());
+               if (_route->is_master() || _route->is_monitor()) {
+                       l->set_markup (string_compose (_("The remote control ID of %1 is: %2\n\n\n"
+                                                        "The remote control ID of %3 cannot be changed."),
+                                                      Glib::Markup::escape_text (_route->name()),
+                                                      _route->remote_control_id(),
+                                                      (_route->is_master() ? _("the master bus") : _("the monitor bus"))));
+               } else {
+                       l->set_markup (string_compose (_("The remote control ID of %6 is: %3\n\n\n"
+                                                        "Remote Control IDs are currently determined by track/bus ordering in %1\n\n"
+                                                        "%4Use the User Interaction tab of the Preferences window if you want to change this%5"),
+                                                      (Config->get_remote_model() == MixerOrdered ? _("the mixer") : ("the editor")),
+                                                      (is_track() ? _("track") : _("bus")),
+                                                      _route->remote_control_id(),
+                                                      "<span size=\"small\" style=\"italic\">",
+                                                      "</span>",
+                                                      Glib::Markup::escape_text (_route->name())));
+               }
+               dialog.get_vbox()->pack_start (*l);
+               dialog.add_button (Stock::OK, RESPONSE_CANCEL);
+       }
 
        dialog.show_all ();
        int const r = dialog.run ();
 
-       if (r == RESPONSE_ACCEPT) {
+       if (r == RESPONSE_ACCEPT && spin) {
                _route->set_remote_control_id (spin->get_value_as_int ());
        }
 }