diff options
Diffstat (limited to 'riscos/wimp.c')
-rw-r--r-- | riscos/wimp.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/riscos/wimp.c b/riscos/wimp.c index cc22c1091..9463df56b 100644 --- a/riscos/wimp.c +++ b/riscos/wimp.c @@ -21,7 +21,7 @@ */ #include <assert.h> -#include <ctype.h> +#include <locale.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> @@ -51,7 +51,7 @@ static wimp_w furniture_window = NULL; unsigned char last_sprite_found[16]; /** - * Gets the horzontal scrollbar height + * Gets the horizontal scrollbar height * * \param w the window to read (or NULL to read a cached value) */ @@ -398,7 +398,13 @@ void ro_gui_set_icon_string_le(wimp_w w, wimp_i i, const char *text) { */ void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value) { char buffer[20]; // Big enough for 64-bit int + + setlocale(LC_NUMERIC, ""); + sprintf(buffer, "%d", value); + + setlocale(LC_NUMERIC, "C"); + ro_gui_set_icon_string(w, i, buffer); } @@ -413,6 +419,8 @@ void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value) { void ro_gui_set_icon_decimal(wimp_w w, wimp_i i, int value, int decimal_places) { char buffer[20]; // Big enough for 64-bit int + setlocale(LC_NUMERIC, ""); + switch (decimal_places) { case 0: sprintf(buffer, "%d", value); @@ -427,6 +435,9 @@ void ro_gui_set_icon_decimal(wimp_w w, wimp_i i, int value, int decimal_places) assert(!"Unsupported decimal format"); break; } + + setlocale(LC_NUMERIC, "C"); + ro_gui_set_icon_string(w, i, buffer); } @@ -445,7 +456,12 @@ int ro_gui_get_icon_decimal(wimp_w w, wimp_i i, int decimal_places) { for (; decimal_places > 0; decimal_places--) multiple *= 10; + setlocale(LC_NUMERIC, ""); + value = atof(ro_gui_get_icon_string(w, i)) * multiple; + + setlocale(LC_NUMERIC, "C"); + return (int)value; } |