diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2016-09-06 14:27:10 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2017-04-19 09:36:59 +1000 |
commit | e7a23eaaa81564568d17fd0af1bdeb20996a434f (patch) | |
tree | 28690276f77406e22699eb103e5ff2d220540038 /gtk2_ardour/ui_config.h | |
parent | 0656d5ab1a44ceec3c3f0713b8c9fa1fbe9054f7 (diff) |
Use snprintf instead of std::stringstream when converting color values to strings
std::ostream/stringstream will use the current locale to determine the numeric
formatting. If the locale uses grouping then thousands separators will be
inserted in the output which produces an invalid color string in
UIConfiguration::reset_gtk_theme() and when converting colors to strings in
UIConfiguration::store_color_theme()
This has not been a problem so far because it appears that LocaleGuard does not
reset the LC_NUMERIC value for the global C++ locale. So if a LocaleGuard is
created at any time before these functions are called(even if it goes out of
scope) the numeric formatting used by std::streams will use the "C" locale
formatting facets.
Diffstat (limited to 'gtk2_ardour/ui_config.h')
-rw-r--r-- | gtk2_ardour/ui_config.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index 2fac5e571d..977ec20351 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -83,6 +83,9 @@ private: ArdourCanvas::HSV color_hsv (const std::string&) const; ArdourCanvas::SVAModifier modifier (const std::string&) const; + static std::string color_to_hex_string (ArdourCanvas::Color c); + static std::string color_to_hex_string_no_alpha (ArdourCanvas::Color c); + sigc::signal<void> ColorsChanged; void reset_dpi (); |