diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 7771aea650..952a393f27 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -25,6 +25,8 @@ #include // for fontmap resolution control for GnomeCanvas #include +#include +#include #include #include #include @@ -226,7 +228,7 @@ get_font_for_style (string widgetname) Glib::RefPtr layout = foobar.get_layout(); - PangoFontDescription *pfd = (PangoFontDescription *)pango_layout_get_font_description(const_cast(layout->gobj())); + PangoFontDescription *pfd = const_cast (pango_layout_get_font_description(const_cast(layout->gobj()))); if (!pfd) { @@ -586,11 +588,44 @@ longest (vector& strings) bool key_is_legal_for_numeric_entry (guint keyval) { + /* we assume that this does not change over the life of the process + */ + + static int comma_decimal = -1; + switch (keyval) { - case GDK_minus: - case GDK_plus: case GDK_period: case GDK_comma: + if (comma_decimal < 0) { + std::lconv* lc = std::localeconv(); + if (strchr (lc->decimal_point, ',') != 0) { + comma_decimal = 1; + } else { + comma_decimal = 0; + } + } + break; + default: + break; + } + + switch (keyval) { + case GDK_period: + if (comma_decimal) { + return false; + } else { + return true; + } + break; + case GDK_comma: + if (comma_decimal) { + return true; + } else { + return false; + } + break; + case GDK_minus: + case GDK_plus: case GDK_0: case GDK_1: case GDK_2: