diff options
author | Carl Hetherington <carl@carlh.net> | 2010-01-15 00:52:22 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-01-15 00:52:22 +0000 |
commit | 43e8e880dc25a52b6a929b9c5eebfbe348c43e95 (patch) | |
tree | c14a1bd69d98091963b9ff0692a5e26d70bc166a /gtk2_ardour/utils.cc | |
parent | bbb65d07d33160366533d9f2390f3f8d56fcb8e1 (diff) |
Escape underscores in port matrix menus correctly so that track names etc. with underscores get displayed properly.
git-svn-id: svn://localhost/ardour2/branches/3.0@6491 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r-- | gtk2_ardour/utils.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 9aba168ef1..b8d7569414 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -1016,3 +1016,21 @@ pixbuf_from_ustring(const ustring& name, Pango::FontDescription* font, int clip_ return buf; } + +/** Replace _ with __ in a string; for use with menu item text to make underscores displayed correctly */ +string +escape_underscores (string const & s) +{ + string o; + string::size_type const N = s.length (); + + for (string::size_type i = 0; i < N; ++i) { + if (s[i] == '_') { + o += "__"; + } else { + o += s[i]; + } + } + + return o; +} |