Escape angled brackets in playlist names for tooltips.
authorCarl Hetherington <carl@carlh.net>
Tue, 12 Jun 2012 14:19:35 +0000 (14:19 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 12 Jun 2012 14:19:35 +0000 (14:19 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@12672 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/route_time_axis.cc
gtk2_ardour/utils.cc
gtk2_ardour/utils.h

index 6841b5a35fc8325fce958a3bf025f20854ea1b7f..2afffca3c0572ade8a75fdd1a54ea9b026deb83a 100644 (file)
@@ -1591,13 +1591,17 @@ RouteTimeAxisView::update_playlist_tip ()
                        take_name = take_name.substr (idx + group_string.length());
 
                        /* set the playlist button tooltip to the take name */
-                       ARDOUR_UI::instance()->set_tip (playlist_button,string_compose(_("Take: %1.%2"), rg->name(), take_name));
+                       ARDOUR_UI::instance()->set_tip (
+                               playlist_button,
+                               string_compose(_("Take: %1.%2"), escape_angled_brackets (rg->name()), escape_angled_brackets (take_name))
+                               );
+                       
                        return;
                }
        }
 
        /* set the playlist button tooltip to the playlist name */
-       ARDOUR_UI::instance()->set_tip (playlist_button, _("Playlist") + std::string(": ") + track()->playlist()->name());      
+       ARDOUR_UI::instance()->set_tip (playlist_button, _("Playlist") + std::string(": ") + escape_angled_brackets (track()->playlist()->name()));
 }
 
 
index 96bee1a87ba0b951067f2f7c8226f3fc73ce9065..b8594b7b2ff882482b92fb0db97c73649dc42824 100644 (file)
@@ -36,6 +36,7 @@
 #include <gtkmm/label.h>
 #include <gtkmm/paned.h>
 #include <gtk/gtkpaned.h>
+#include <boost/algorithm/string.hpp>
 
 #include "pbd/file_utils.h"
 
@@ -680,6 +681,16 @@ escape_underscores (string const & s)
        return o;
 }
 
+/** Replace < and > with &lt; and &gt; respectively to make < > display correctly in markup strings */
+string
+escape_angled_brackets (string const & s)
+{
+       string o = s;
+       boost::replace_all (o, "<", "&lt;");
+       boost::replace_all (o, ">", "&gt;");
+       return o;
+}
+
 Gdk::Color
 unique_random_color (list<Gdk::Color>& used_colors)
 {
index 699cd31981c901d5bc1c7fc070ea6737031261aa..7137f273c65752d44aa6513313be41ea89d679e6 100644 (file)
@@ -79,6 +79,7 @@ void set_pango_fontsize ();
 void resize_window_to_proportion_of_monitor (Gtk::Window*, int, int);
 
 std::string escape_underscores (std::string const &);
+std::string escape_angled_brackets (std::string const &);
 
 Gdk::Color unique_random_color (std::list<Gdk::Color> &);