From f98c0013f16e82809206663a765fce769300dc05 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Fri, 14 Nov 2003 13:41:16 +0000 Subject: [PATCH] app/config/gimpscanner.c configured the scanner to use 64bit integers. 2003-11-14 Sven Neumann * app/config/gimpscanner.c * app/config/gimpconfig-deserialize.c: configured the scanner to use 64bit integers. This means you must now access value.v_int64 instead of value.v_int. Fortunately gimp_scanner_parse_int() hides this ugly detail from you. * app/config/gimpconfig-params.[ch] * app/config/gimpconfig-types.c: derive GimpMemsize from guint64 now that support for 64bit integers is guaranteed by glib. * app/config/gimpbaseconfig.c * app/config/gimpcoreconfig.c * app/config/gimpguiconfig.[ch] * app/widgets/gimppropwidgets.c: changed accordingly. * app/gui/preferences-dialog.c: changed a label. --- ChangeLog | 19 ++++++++ app/config/gimpbaseconfig.c | 12 ++--- app/config/gimpconfig-deserialize.c | 28 ++++++++--- app/config/gimpconfig-params.c | 14 +++--- app/config/gimpconfig-params.h | 6 +-- app/config/gimpconfig-types.c | 28 +++++------ app/config/gimpcoreconfig.c | 4 +- app/config/gimpguiconfig.c | 6 +-- app/config/gimpguiconfig.h | 2 +- app/config/gimpscanner.c | 8 +-- app/dialogs/preferences-dialog.c | 2 +- app/gui/preferences-dialog.c | 2 +- app/widgets/gimppropwidgets.c | 67 ++++++++++++++++++++------ libgimpconfig/gimpconfig-deserialize.c | 28 ++++++++--- libgimpconfig/gimpconfig-params.h | 6 +-- libgimpconfig/gimpscanner.c | 8 +-- libgimpwidgets/gimppropwidgets.c | 67 ++++++++++++++++++++------ 17 files changed, 220 insertions(+), 87 deletions(-) diff --git a/ChangeLog b/ChangeLog index 899d11aa27..bd1eb3756c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2003-11-14 Sven Neumann + + * app/config/gimpscanner.c + * app/config/gimpconfig-deserialize.c: configured the scanner to + use 64bit integers. This means you must now access value.v_int64 + instead of value.v_int. Fortunately gimp_scanner_parse_int() hides + this ugly detail from you. + + * app/config/gimpconfig-params.[ch] + * app/config/gimpconfig-types.c: derive GimpMemsize from guint64 + now that support for 64bit integers is guaranteed by glib. + + * app/config/gimpbaseconfig.c + * app/config/gimpcoreconfig.c + * app/config/gimpguiconfig.[ch] + * app/widgets/gimppropwidgets.c: changed accordingly. + + * app/gui/preferences-dialog.c: changed a label. + 2003-11-14 Michael Natterer * app/widgets/gimpdevices.c: code review & cleanup. diff --git a/app/config/gimpbaseconfig.c b/app/config/gimpbaseconfig.c index 12bcc21c8a..5ec45ffaa0 100644 --- a/app/config/gimpbaseconfig.c +++ b/app/config/gimpbaseconfig.c @@ -61,7 +61,7 @@ enum static GObjectClass *parent_class = NULL; -GType +GType gimp_base_config_get_type (void) { static GType config_type = 0; @@ -81,8 +81,8 @@ gimp_base_config_get_type (void) NULL /* instance_init */ }; - config_type = g_type_register_static (G_TYPE_OBJECT, - "GimpBaseConfig", + config_type = g_type_register_static (G_TYPE_OBJECT, + "GimpBaseConfig", &config_info, 0); } @@ -132,7 +132,7 @@ gimp_base_config_finalize (GObject *object) GimpBaseConfig *base_config; base_config = GIMP_BASE_CONFIG (object); - + g_free (base_config->temp_path); g_free (base_config->swap_path); @@ -166,7 +166,7 @@ gimp_base_config_set_property (GObject *object, base_config->num_processors = g_value_get_uint (value); break; case PROP_TILE_CACHE_SIZE: - base_config->tile_cache_size = g_value_get_ulong (value); + base_config->tile_cache_size = g_value_get_uint64 (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -199,7 +199,7 @@ gimp_base_config_get_property (GObject *object, g_value_set_uint (value, base_config->num_processors); break; case PROP_TILE_CACHE_SIZE: - g_value_set_ulong (value, base_config->tile_cache_size); + g_value_set_uint64 (value, base_config->tile_cache_size); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); diff --git a/app/config/gimpconfig-deserialize.c b/app/config/gimpconfig-deserialize.c index b8369cff3e..f139b067a3 100644 --- a/app/config/gimpconfig-deserialize.c +++ b/app/config/gimpconfig-deserialize.c @@ -401,6 +401,7 @@ gimp_config_deserialize_fundamental (GValue *value, case G_TYPE_INT: case G_TYPE_LONG: + case G_TYPE_INT64: if (g_scanner_peek_next_token (scanner) == '-') { negate = TRUE; @@ -409,6 +410,7 @@ gimp_config_deserialize_fundamental (GValue *value, /* fallthrough */ case G_TYPE_UINT: case G_TYPE_ULONG: + case G_TYPE_UINT64: token = G_TOKEN_INT; break; @@ -464,18 +466,31 @@ gimp_config_deserialize_fundamental (GValue *value, case G_TYPE_INT: g_value_set_int (value, (negate ? - - scanner->value.v_int : scanner->value.v_int)); + - scanner->value.v_int64 : + scanner->value.v_int64)); break; case G_TYPE_UINT: - g_value_set_uint (value, scanner->value.v_int); + g_value_set_uint (value, scanner->value.v_int64); break; + case G_TYPE_LONG: g_value_set_long (value, (negate ? - - scanner->value.v_int : scanner->value.v_int)); + - scanner->value.v_int64 : + scanner->value.v_int64)); break; case G_TYPE_ULONG: - g_value_set_ulong (value, scanner->value.v_int); + g_value_set_ulong (value, scanner->value.v_int64); break; + + case G_TYPE_INT64: + g_value_set_int64 (value, (negate ? + - scanner->value.v_int64 : + scanner->value.v_int64)); + break; + case G_TYPE_UINT64: + g_value_set_uint64 (value, scanner->value.v_int64); + break; + case G_TYPE_FLOAT: g_value_set_float (value, negate ? - scanner->value.v_float : scanner->value.v_float); @@ -526,13 +541,14 @@ gimp_config_deserialize_enum (GValue *value, case G_TOKEN_INT: g_scanner_get_next_token (scanner); - enum_value = g_enum_get_value (enum_class, scanner->value.v_int); + enum_value = g_enum_get_value (enum_class, + (gint) scanner->value.v_int64); if (!enum_value) { g_scanner_error (scanner, _("invalid value '%ld' for token %s"), - scanner->value.v_int, prop_spec->name); + (glong) scanner->value.v_int64, prop_spec->name); return G_TOKEN_NONE; } break; diff --git a/app/config/gimpconfig-params.c b/app/config/gimpconfig-params.c index ebee088236..36adcb49aa 100644 --- a/app/config/gimpconfig-params.c +++ b/app/config/gimpconfig-params.c @@ -2,7 +2,7 @@ * Copyright (C) 1995 Spencer Kimball and Peter Mattis * * ParamSpecs for config objects - * Copyright (C) 2001 Sven Neumann + * Copyright (C) 2001-2003 Sven Neumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -331,11 +331,11 @@ gimp_param_memsize_get_type (void) NULL, NULL, (GClassInitFunc) gimp_param_memsize_class_init, NULL, NULL, - sizeof (GParamSpecULong), + sizeof (GParamSpecUInt64), 0, NULL, NULL }; - spec_type = g_type_register_static (G_TYPE_PARAM_ULONG, + spec_type = g_type_register_static (G_TYPE_PARAM_UINT64, "GimpParamMemsize", &type_info, 0); } @@ -353,12 +353,12 @@ GParamSpec * gimp_param_spec_memsize (const gchar *name, const gchar *nick, const gchar *blurb, - gulong minimum, - gulong maximum, - gulong default_value, + guint64 minimum, + guint64 maximum, + guint64 default_value, GParamFlags flags) { - GParamSpecULong *pspec; + GParamSpecUInt64 *pspec; pspec = g_param_spec_internal (GIMP_TYPE_PARAM_MEMSIZE, name, nick, blurb, flags); diff --git a/app/config/gimpconfig-params.h b/app/config/gimpconfig-params.h index 2ff7832062..42dd689fd7 100644 --- a/app/config/gimpconfig-params.h +++ b/app/config/gimpconfig-params.h @@ -95,9 +95,9 @@ GType gimp_param_memsize_get_type (void) G_GNUC_CONST; GParamSpec * gimp_param_spec_memsize (const gchar *name, const gchar *nick, const gchar *blurb, - gulong minimum, - gulong maximum, - gulong default_value, + guint64 minimum, + guint64 maximum, + guint64 default_value, GParamFlags flags); diff --git a/app/config/gimpconfig-types.c b/app/config/gimpconfig-types.c index edf4d3b18f..7a656f833f 100644 --- a/app/config/gimpconfig-types.c +++ b/app/config/gimpconfig-types.c @@ -88,7 +88,7 @@ gimp_memsize_get_type (void) { static const GTypeInfo type_info = { 0, }; - memsize_type = g_type_register_static (G_TYPE_ULONG, "GimpMemsize", + memsize_type = g_type_register_static (G_TYPE_UINT64, "GimpMemsize", &type_info, 0); g_value_register_transform_func (memsize_type, G_TYPE_STRING, @@ -104,15 +104,15 @@ gboolean gimp_memsize_set_from_string (GValue *value, const gchar *string) { - gchar *end; - gulong size; + gchar *end; + guint64 size; g_return_val_if_fail (GIMP_VALUE_HOLDS_MEMSIZE (value), FALSE); g_return_val_if_fail (string != NULL, FALSE); - size = strtoul (string, &end, 0); + size = g_ascii_strtoull (string, &end, 0); - if (size == ULONG_MAX && errno == ERANGE) + if (size == G_MAXUINT64 && errno == ERANGE) return FALSE; if (end && *end) @@ -140,7 +140,7 @@ gimp_memsize_set_from_string (GValue *value, /* protect against overflow */ if (shift) { - gulong limit = G_MAXULONG >> (shift); + guint64 limit = G_MAXUINT64 >> shift; if (size != (size & limit)) return FALSE; @@ -149,7 +149,7 @@ gimp_memsize_set_from_string (GValue *value, } } - g_value_set_ulong (value, size); + g_value_set_uint64 (value, size); return TRUE; } @@ -209,19 +209,19 @@ static void memsize_to_string (const GValue *src_value, GValue *dest_value) { - gulong size; - gchar *str; + guint64 size; + gchar *str; - size = g_value_get_ulong (src_value); + size = g_value_get_uint64 (src_value); if (size > (1 << 30) && size % (1 << 30) == 0) - str = g_strdup_printf ("%luG", size >> 30); + str = g_strdup_printf ("%" G_GUINT64_FORMAT "G", size >> 30); else if (size > (1 << 20) && size % (1 << 20) == 0) - str = g_strdup_printf ("%luM", size >> 20); + str = g_strdup_printf ("%" G_GUINT64_FORMAT "M", size >> 20); else if (size > (1 << 10) && size % (1 << 10) == 0) - str = g_strdup_printf ("%luk", size >> 10); + str = g_strdup_printf ("%" G_GUINT64_FORMAT "k", size >> 10); else - str = g_strdup_printf ("%lu", size); + str = g_strdup_printf ("%" G_GUINT64_FORMAT, size); g_value_set_string_take_ownership (dest_value, str); } diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c index 9202e45733..fb7b2c2108 100644 --- a/app/config/gimpcoreconfig.c +++ b/app/config/gimpcoreconfig.c @@ -387,7 +387,7 @@ gimp_core_config_set_property (GObject *object, core_config->levels_of_undo = g_value_get_int (value); break; case PROP_UNDO_SIZE: - core_config->undo_size = g_value_get_ulong (value); + core_config->undo_size = g_value_get_uint64 (value); break; case PROP_PLUGINRC_PATH: g_free (core_config->plug_in_rc_path); @@ -482,7 +482,7 @@ gimp_core_config_get_property (GObject *object, g_value_set_int (value, core_config->levels_of_undo); break; case PROP_UNDO_SIZE: - g_value_set_ulong (value, core_config->undo_size); + g_value_set_uint64 (value, core_config->undo_size); break; case PROP_PLUGINRC_PATH: g_value_set_string (value, core_config->plug_in_rc_path); diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c index a01a45fb49..3da34876fd 100644 --- a/app/config/gimpguiconfig.c +++ b/app/config/gimpguiconfig.c @@ -196,7 +196,7 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_MAX_NEW_IMAGE_SIZE, "max-new-image-size", MAX_NEW_IMAGE_SIZE_BLURB, - 0, G_MAXULONG, 1 << 26, + 0, (guint64) 1 << 40, 1 << 26, 0); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_THEME_PATH, "theme-path", THEME_PATH_BLURB, @@ -295,7 +295,7 @@ gimp_gui_config_set_property (GObject *object, gui_config->last_opened_size = g_value_get_int (value); break; case PROP_MAX_NEW_IMAGE_SIZE: - gui_config->max_new_image_size = g_value_get_ulong (value); + gui_config->max_new_image_size = g_value_get_uint64 (value); break; case PROP_THEME_PATH: g_free (gui_config->theme_path); @@ -380,7 +380,7 @@ gimp_gui_config_get_property (GObject *object, g_value_set_int (value, gui_config->last_opened_size); break; case PROP_MAX_NEW_IMAGE_SIZE: - g_value_set_ulong (value, gui_config->max_new_image_size); + g_value_set_uint64 (value, gui_config->max_new_image_size); break; case PROP_THEME_PATH: g_value_set_string (value, gui_config->theme_path); diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h index fb76cfcb01..2119563780 100644 --- a/app/config/gimpguiconfig.h +++ b/app/config/gimpguiconfig.h @@ -55,7 +55,7 @@ struct _GimpGuiConfig gboolean save_accels; gboolean restore_accels; gint last_opened_size; - gulong max_new_image_size; + guint64 max_new_image_size; gchar *theme_path; gchar *theme; gboolean use_help; diff --git a/app/config/gimpscanner.c b/app/config/gimpscanner.c index afc4b520b2..087fa70ecc 100644 --- a/app/config/gimpscanner.c +++ b/app/config/gimpscanner.c @@ -147,6 +147,8 @@ gimp_scanner_new (const gchar *name, G_CSET_DIGITS "-_" ); scanner->config->scan_identifier_1char = TRUE; + scanner->config->store_int64 = TRUE; + return scanner; } @@ -216,7 +218,7 @@ gimp_scanner_parse_string (GScanner *scanner, g_scanner_warn (scanner, _("invalid UTF-8 string")); return FALSE; } - + *dest = g_strdup (scanner->value.v_string); } else @@ -262,9 +264,9 @@ gimp_scanner_parse_int (GScanner *scanner, g_scanner_get_next_token (scanner); if (negate) - *dest = -scanner->value.v_int; + *dest = -scanner->value.v_int64; else - *dest = scanner->value.v_int; + *dest = scanner->value.v_int64; return TRUE; } diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index 47016be7d4..c493ecb51c 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -1126,7 +1126,7 @@ prefs_dialog_new (Gimp *gimp, table = prefs_table_new (1, GTK_CONTAINER (vbox), TRUE); prefs_memsize_entry_add (object, "max-new-image-size", - _("Maximum Image Size:"), + _("Maximum New Image Size:"), GTK_TABLE (table), 1); diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index 47016be7d4..c493ecb51c 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -1126,7 +1126,7 @@ prefs_dialog_new (Gimp *gimp, table = prefs_table_new (1, GTK_CONTAINER (vbox), TRUE); prefs_memsize_entry_add (object, "max-new-image-size", - _("Maximum Image Size:"), + _("Maximum New Image Size:"), GTK_TABLE (table), 1); diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c index c7af457da5..d7552923d4 100644 --- a/app/widgets/gimppropwidgets.c +++ b/app/widgets/gimppropwidgets.c @@ -836,19 +836,39 @@ gimp_prop_adjustment_callback (GtkAdjustment *adjustment, if (G_IS_PARAM_SPEC_INT (param_spec)) { - g_object_set (config, param_spec->name, (gint) adjustment->value, NULL); + g_object_set (config, + param_spec->name, (gint) adjustment->value, + NULL); } else if (G_IS_PARAM_SPEC_UINT (param_spec)) { - g_object_set (config, param_spec->name, (guint) adjustment->value, NULL); + g_object_set (config, + param_spec->name, (guint) adjustment->value, + NULL); } else if (G_IS_PARAM_SPEC_LONG (param_spec)) { - g_object_set (config, param_spec->name, (glong) adjustment->value, NULL); + g_object_set (config, + param_spec->name, (glong) adjustment->value, + NULL); } else if (G_IS_PARAM_SPEC_ULONG (param_spec)) { - g_object_set (config, param_spec->name, adjustment->value, NULL); + g_object_set (config, + param_spec->name, (gulong) adjustment->value, + NULL); + } + else if (G_IS_PARAM_SPEC_INT64 (param_spec)) + { + g_object_set (config, + param_spec->name, (gint64) adjustment->value, + NULL); + } + else if (G_IS_PARAM_SPEC_UINT64 (param_spec)) + { + g_object_set (config, + param_spec->name, (guint64) adjustment->value, + NULL); } else if (G_IS_PARAM_SPEC_DOUBLE (param_spec)) { @@ -903,6 +923,22 @@ gimp_prop_adjustment_notify (GObject *config, value = ulong_value; } + else if (G_IS_PARAM_SPEC_INT64 (param_spec)) + { + gint64 int64_value; + + g_object_get (config, param_spec->name, &int64_value, NULL); + + value = int64_value; + } + else if (G_IS_PARAM_SPEC_ULONG (param_spec)) + { + guint64 uint64_value; + + g_object_get (config, param_spec->name, &uint64_value, NULL); + + value = uint64_value; + } else if (G_IS_PARAM_SPEC_DOUBLE (param_spec)) { g_object_get (config, param_spec->name, &value, NULL); @@ -945,10 +981,10 @@ GtkWidget * gimp_prop_memsize_entry_new (GObject *config, const gchar *property_name) { - GParamSpec *param_spec; - GParamSpecULong *ulong_spec; - GtkWidget *entry; - gulong value; + GParamSpec *param_spec; + GParamSpecUInt64 *uint64_spec; + GtkWidget *entry; + guint64 value; param_spec = check_param_spec (config, property_name, GIMP_TYPE_PARAM_MEMSIZE, G_STRLOC); @@ -959,11 +995,14 @@ gimp_prop_memsize_entry_new (GObject *config, property_name, &value, NULL); - ulong_spec = G_PARAM_SPEC_ULONG (param_spec); + uint64_spec = G_PARAM_SPEC_UINT64 (param_spec); + + g_return_val_if_fail (uint64_spec->minimum <= (guint64) G_MAXDOUBLE, NULL); + g_return_val_if_fail (uint64_spec->maximum <= (guint64) G_MAXDOUBLE, NULL); entry = gimp_memsize_entry_new (value, - ulong_spec->minimum, - ulong_spec->maximum); + uint64_spec->minimum, + uint64_spec->maximum); set_param_spec (G_OBJECT (entry), GIMP_MEMSIZE_ENTRY (entry)->spinbutton, @@ -991,7 +1030,7 @@ gimp_prop_memsize_callback (GimpMemsizeEntry *entry, if (! param_spec) return; - g_return_if_fail (G_IS_PARAM_SPEC_ULONG (param_spec)); + g_return_if_fail (G_IS_PARAM_SPEC_UINT64 (param_spec)); g_object_set (config, param_spec->name, gimp_memsize_entry_get_value (entry), @@ -1003,9 +1042,9 @@ gimp_prop_memsize_notify (GObject *config, GParamSpec *param_spec, GimpMemsizeEntry *entry) { - gulong value; + guint64 value; - g_return_if_fail (G_IS_PARAM_SPEC_ULONG (param_spec)); + g_return_if_fail (G_IS_PARAM_SPEC_UINT64 (param_spec)); g_object_get (config, param_spec->name, &value, diff --git a/libgimpconfig/gimpconfig-deserialize.c b/libgimpconfig/gimpconfig-deserialize.c index b8369cff3e..f139b067a3 100644 --- a/libgimpconfig/gimpconfig-deserialize.c +++ b/libgimpconfig/gimpconfig-deserialize.c @@ -401,6 +401,7 @@ gimp_config_deserialize_fundamental (GValue *value, case G_TYPE_INT: case G_TYPE_LONG: + case G_TYPE_INT64: if (g_scanner_peek_next_token (scanner) == '-') { negate = TRUE; @@ -409,6 +410,7 @@ gimp_config_deserialize_fundamental (GValue *value, /* fallthrough */ case G_TYPE_UINT: case G_TYPE_ULONG: + case G_TYPE_UINT64: token = G_TOKEN_INT; break; @@ -464,18 +466,31 @@ gimp_config_deserialize_fundamental (GValue *value, case G_TYPE_INT: g_value_set_int (value, (negate ? - - scanner->value.v_int : scanner->value.v_int)); + - scanner->value.v_int64 : + scanner->value.v_int64)); break; case G_TYPE_UINT: - g_value_set_uint (value, scanner->value.v_int); + g_value_set_uint (value, scanner->value.v_int64); break; + case G_TYPE_LONG: g_value_set_long (value, (negate ? - - scanner->value.v_int : scanner->value.v_int)); + - scanner->value.v_int64 : + scanner->value.v_int64)); break; case G_TYPE_ULONG: - g_value_set_ulong (value, scanner->value.v_int); + g_value_set_ulong (value, scanner->value.v_int64); break; + + case G_TYPE_INT64: + g_value_set_int64 (value, (negate ? + - scanner->value.v_int64 : + scanner->value.v_int64)); + break; + case G_TYPE_UINT64: + g_value_set_uint64 (value, scanner->value.v_int64); + break; + case G_TYPE_FLOAT: g_value_set_float (value, negate ? - scanner->value.v_float : scanner->value.v_float); @@ -526,13 +541,14 @@ gimp_config_deserialize_enum (GValue *value, case G_TOKEN_INT: g_scanner_get_next_token (scanner); - enum_value = g_enum_get_value (enum_class, scanner->value.v_int); + enum_value = g_enum_get_value (enum_class, + (gint) scanner->value.v_int64); if (!enum_value) { g_scanner_error (scanner, _("invalid value '%ld' for token %s"), - scanner->value.v_int, prop_spec->name); + (glong) scanner->value.v_int64, prop_spec->name); return G_TOKEN_NONE; } break; diff --git a/libgimpconfig/gimpconfig-params.h b/libgimpconfig/gimpconfig-params.h index 2ff7832062..42dd689fd7 100644 --- a/libgimpconfig/gimpconfig-params.h +++ b/libgimpconfig/gimpconfig-params.h @@ -95,9 +95,9 @@ GType gimp_param_memsize_get_type (void) G_GNUC_CONST; GParamSpec * gimp_param_spec_memsize (const gchar *name, const gchar *nick, const gchar *blurb, - gulong minimum, - gulong maximum, - gulong default_value, + guint64 minimum, + guint64 maximum, + guint64 default_value, GParamFlags flags); diff --git a/libgimpconfig/gimpscanner.c b/libgimpconfig/gimpscanner.c index afc4b520b2..087fa70ecc 100644 --- a/libgimpconfig/gimpscanner.c +++ b/libgimpconfig/gimpscanner.c @@ -147,6 +147,8 @@ gimp_scanner_new (const gchar *name, G_CSET_DIGITS "-_" ); scanner->config->scan_identifier_1char = TRUE; + scanner->config->store_int64 = TRUE; + return scanner; } @@ -216,7 +218,7 @@ gimp_scanner_parse_string (GScanner *scanner, g_scanner_warn (scanner, _("invalid UTF-8 string")); return FALSE; } - + *dest = g_strdup (scanner->value.v_string); } else @@ -262,9 +264,9 @@ gimp_scanner_parse_int (GScanner *scanner, g_scanner_get_next_token (scanner); if (negate) - *dest = -scanner->value.v_int; + *dest = -scanner->value.v_int64; else - *dest = scanner->value.v_int; + *dest = scanner->value.v_int64; return TRUE; } diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c index c7af457da5..d7552923d4 100644 --- a/libgimpwidgets/gimppropwidgets.c +++ b/libgimpwidgets/gimppropwidgets.c @@ -836,19 +836,39 @@ gimp_prop_adjustment_callback (GtkAdjustment *adjustment, if (G_IS_PARAM_SPEC_INT (param_spec)) { - g_object_set (config, param_spec->name, (gint) adjustment->value, NULL); + g_object_set (config, + param_spec->name, (gint) adjustment->value, + NULL); } else if (G_IS_PARAM_SPEC_UINT (param_spec)) { - g_object_set (config, param_spec->name, (guint) adjustment->value, NULL); + g_object_set (config, + param_spec->name, (guint) adjustment->value, + NULL); } else if (G_IS_PARAM_SPEC_LONG (param_spec)) { - g_object_set (config, param_spec->name, (glong) adjustment->value, NULL); + g_object_set (config, + param_spec->name, (glong) adjustment->value, + NULL); } else if (G_IS_PARAM_SPEC_ULONG (param_spec)) { - g_object_set (config, param_spec->name, adjustment->value, NULL); + g_object_set (config, + param_spec->name, (gulong) adjustment->value, + NULL); + } + else if (G_IS_PARAM_SPEC_INT64 (param_spec)) + { + g_object_set (config, + param_spec->name, (gint64) adjustment->value, + NULL); + } + else if (G_IS_PARAM_SPEC_UINT64 (param_spec)) + { + g_object_set (config, + param_spec->name, (guint64) adjustment->value, + NULL); } else if (G_IS_PARAM_SPEC_DOUBLE (param_spec)) { @@ -903,6 +923,22 @@ gimp_prop_adjustment_notify (GObject *config, value = ulong_value; } + else if (G_IS_PARAM_SPEC_INT64 (param_spec)) + { + gint64 int64_value; + + g_object_get (config, param_spec->name, &int64_value, NULL); + + value = int64_value; + } + else if (G_IS_PARAM_SPEC_ULONG (param_spec)) + { + guint64 uint64_value; + + g_object_get (config, param_spec->name, &uint64_value, NULL); + + value = uint64_value; + } else if (G_IS_PARAM_SPEC_DOUBLE (param_spec)) { g_object_get (config, param_spec->name, &value, NULL); @@ -945,10 +981,10 @@ GtkWidget * gimp_prop_memsize_entry_new (GObject *config, const gchar *property_name) { - GParamSpec *param_spec; - GParamSpecULong *ulong_spec; - GtkWidget *entry; - gulong value; + GParamSpec *param_spec; + GParamSpecUInt64 *uint64_spec; + GtkWidget *entry; + guint64 value; param_spec = check_param_spec (config, property_name, GIMP_TYPE_PARAM_MEMSIZE, G_STRLOC); @@ -959,11 +995,14 @@ gimp_prop_memsize_entry_new (GObject *config, property_name, &value, NULL); - ulong_spec = G_PARAM_SPEC_ULONG (param_spec); + uint64_spec = G_PARAM_SPEC_UINT64 (param_spec); + + g_return_val_if_fail (uint64_spec->minimum <= (guint64) G_MAXDOUBLE, NULL); + g_return_val_if_fail (uint64_spec->maximum <= (guint64) G_MAXDOUBLE, NULL); entry = gimp_memsize_entry_new (value, - ulong_spec->minimum, - ulong_spec->maximum); + uint64_spec->minimum, + uint64_spec->maximum); set_param_spec (G_OBJECT (entry), GIMP_MEMSIZE_ENTRY (entry)->spinbutton, @@ -991,7 +1030,7 @@ gimp_prop_memsize_callback (GimpMemsizeEntry *entry, if (! param_spec) return; - g_return_if_fail (G_IS_PARAM_SPEC_ULONG (param_spec)); + g_return_if_fail (G_IS_PARAM_SPEC_UINT64 (param_spec)); g_object_set (config, param_spec->name, gimp_memsize_entry_get_value (entry), @@ -1003,9 +1042,9 @@ gimp_prop_memsize_notify (GObject *config, GParamSpec *param_spec, GimpMemsizeEntry *entry) { - gulong value; + guint64 value; - g_return_if_fail (G_IS_PARAM_SPEC_ULONG (param_spec)); + g_return_if_fail (G_IS_PARAM_SPEC_UINT64 (param_spec)); g_object_get (config, param_spec->name, &value,