From bf12a078f0b5a762092a87519fceab07f6347bc9 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sat, 11 Jan 2003 01:31:22 +0000 Subject: [PATCH] always build gimpconfig-dump. 2003-01-11 Sven Neumann * app/config/Makefile.am: always build gimpconfig-dump. * app/config/gimpconfig-params.[ch]: added an enum to specify the type of path with GIMP_PARAM_SPEC_PATH. * app/config/gimpconfig-dump.c: document the different types of paths differently. * app/config/gimpbaseconfig.c * app/config/gimpcoreconfig.c * app/config/gimpguiconfig.c * app/config/gimppluginconfig.c: register the path types. * etc/gimprc: generated a new system gimprc. * plug-ins/common/tiff.c: added missing spaces in warning and removed trailing newlines in strings passed to g_message(). --- ChangeLog | 20 +++++++++ app/config/Makefile.am | 11 ++++- app/config/gimpbaseconfig.c | 2 + app/config/gimpconfig-dump.c | 49 ++++++++++++++++----- app/config/gimpconfig-params.c | 53 ++++++++++++++++++++--- app/config/gimpconfig-params.h | 41 +++++++++++++++--- app/config/gimpcoreconfig.c | 9 ++++ app/config/gimpguiconfig.c | 1 + app/config/gimppluginconfig.c | 5 +++ etc/gimprc | 55 ++++++++++++----------- libgimpconfig/gimpconfig-params.h | 41 +++++++++++++++--- plug-ins/common/tiff.c | 72 +++++++++++++++---------------- 12 files changed, 261 insertions(+), 98 deletions(-) diff --git a/ChangeLog b/ChangeLog index b133a3a67f..722bf206bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2003-01-11 Sven Neumann + + * app/config/Makefile.am: always build gimpconfig-dump. + + * app/config/gimpconfig-params.[ch]: added an enum to specify the + type of path with GIMP_PARAM_SPEC_PATH. + + * app/config/gimpconfig-dump.c: document the different types of + paths differently. + + * app/config/gimpbaseconfig.c + * app/config/gimpcoreconfig.c + * app/config/gimpguiconfig.c + * app/config/gimppluginconfig.c: register the path types. + + * etc/gimprc: generated a new system gimprc. + + * plug-ins/common/tiff.c: added missing spaces in warning and + removed trailing newlines in strings passed to g_message(). + 2003-01-10 Maurits Rijk * plug-ins/common/tiff.c (load_image): fix compilation error and diff --git a/app/config/Makefile.am b/app/config/Makefile.am index f819687b07..f33072bd53 100644 --- a/app/config/Makefile.am +++ b/app/config/Makefile.am @@ -58,15 +58,22 @@ gimpconfig_libs = \ # -# extra programs, not to be built by default and never installed +# GimpConfig dump utility that generates a system gimprc and the manpage # -EXTRA_PROGRAMS = gimpconfig-dump test-config +noinst_PROGRAMS = gimpconfig-dump gimpconfig_dump_SOURCES = gimpconfig-dump.c gimpconfig_dump_LDADD = $(GLIB_LIBS) $(gimpconfig_libs) + +# +# unit tests for the GimpConfig system +# + +EXTRA_PROGRAMS = test-config + TESTS = test-config test_config_DEPENDENCIES = $(gimpconfig_dependencies) diff --git a/app/config/gimpbaseconfig.c b/app/config/gimpbaseconfig.c index 69c90af94f..a312890f56 100644 --- a/app/config/gimpbaseconfig.c +++ b/app/config/gimpbaseconfig.c @@ -102,10 +102,12 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass) GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_TEMP_PATH, "temp-path", TEMP_PATH_BLURB, + GIMP_PARAM_PATH_DIR, "${gimp_dir}" G_DIR_SEPARATOR_S "tmp", GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_SWAP_PATH, "swap-path", SWAP_PATH_BLURB, + GIMP_PARAM_PATH_DIR, "${gimp_dir}", GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_STINGY_MEMORY_USE, diff --git a/app/config/gimpconfig-dump.c b/app/config/gimpconfig-dump.c index af3d417bf7..0052ab8983 100644 --- a/app/config/gimpconfig-dump.c +++ b/app/config/gimpconfig-dump.c @@ -127,10 +127,10 @@ dump_system_gimprc (void) "# By default everything in this file is commented out. The file then\n" "# documents the default values and shows what changes are possible.\n" "\n" - "# The variable gimp_dir is set to either the internal value\n" - "# @gimpdir@ or the environment variable GIMP_DIRECTORY. If\n" - "# the path in GIMP_DIRECTORY is relative, it is considered\n" - "# relative to your home directory.\n" + "# The variable ${gimp_dir} is set to the value of the environment\n" + "# variable GIMP_DIRECTORY or, if that is not set, the compiled-in\n" + "# default value is used. If GIMP_DIRECTORY is not an absolute path,\n" + "# it is interpreted relative to your home directory.\n" "\n"); write (1, str->str, str->len); @@ -208,15 +208,44 @@ dump_get_comment (GParamSpec *param_spec) } else if (g_type_is_a (type, GIMP_TYPE_PATH)) { - switch (G_SEARCHPATH_SEPARATOR) + switch (gimp_param_spec_path_type (param_spec)) { - case ':': - values = "This is a colon-separated list of directories to search."; + case GIMP_PARAM_PATH_FILE: + values = "This is a single filename."; break; - case ';': - values = "This is a semicolon-separated list of directories to search."; + + case GIMP_PARAM_PATH_FILE_LIST: + switch (G_SEARCHPATH_SEPARATOR) + { + case ':': + values = "This is a colon-separated list of files."; + break; + case ';': + values = "This is a semicolon-separated list of files."; + break; + default: + g_warning ("unhandled G_SEARCHPATH_SEPARATOR value"); + break; + } break; - default: + + case GIMP_PARAM_PATH_DIR: + values = "This is a single folder."; + break; + + case GIMP_PARAM_PATH_DIR_LIST: + switch (G_SEARCHPATH_SEPARATOR) + { + case ':': + values = "This is a colon-separated list of folders to search."; + break; + case ';': + values = "This is a semicolon-separated list of folders to search."; + break; + default: + g_warning ("unhandled G_SEARCHPATH_SEPARATOR value"); + break; + } break; } } diff --git a/app/config/gimpconfig-params.c b/app/config/gimpconfig-params.c index fa961cf4d1..002faf7707 100644 --- a/app/config/gimpconfig-params.c +++ b/app/config/gimpconfig-params.c @@ -30,6 +30,10 @@ #include "gimpconfig-types.h" +/* + * GIMP_TYPE_PARAM_COLOR + */ + #define GIMP_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_COLOR, GimpParamSpecColor)) static void gimp_param_color_class_init (GParamSpecClass *class); @@ -184,6 +188,10 @@ gimp_param_spec_color (const gchar *name, } +/* + * GIMP_TYPE_PARAM_MEMSIZE + */ + static void gimp_param_memsize_class_init (GParamSpecClass *class); GType @@ -239,6 +247,21 @@ gimp_param_spec_memsize (const gchar *name, } +/* + * GIMP_TYPE_PARAM_PATH + */ + +#define GIMP_PARAM_SPEC_PATH(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_PATH, GimpParamSpecPath)) + +typedef struct _GimpParamSpecPath GimpParamSpecPath; + +struct _GimpParamSpecPath +{ + GParamSpecString parent_instance; + + GimpParamPathType type; +}; + static void gimp_param_path_class_init (GParamSpecClass *class); GType @@ -254,7 +277,7 @@ gimp_param_path_get_type (void) NULL, NULL, (GClassInitFunc) gimp_param_path_class_init, NULL, NULL, - sizeof (GParamSpecString), + sizeof (GimpParamSpecPath), 0, NULL, NULL }; @@ -273,22 +296,38 @@ gimp_param_path_class_init (GParamSpecClass *class) } GParamSpec * -gimp_param_spec_path (const gchar *name, - const gchar *nick, - const gchar *blurb, - gchar *default_value, - GParamFlags flags) +gimp_param_spec_path (const gchar *name, + const gchar *nick, + const gchar *blurb, + GimpParamPathType type, + gchar *default_value, + GParamFlags flags) { GParamSpecString *pspec; pspec = g_param_spec_internal (GIMP_TYPE_PARAM_PATH, name, nick, blurb, flags); - pspec->default_value = default_value; + pspec->default_value = default_value; + + GIMP_PARAM_SPEC_PATH (pspec)->type = type; + return G_PARAM_SPEC (pspec); } +GimpParamPathType +gimp_param_spec_path_type (GParamSpec *pspec) +{ + g_return_val_if_fail (GIMP_IS_PARAM_SPEC_PATH (pspec), 0); + + return GIMP_PARAM_SPEC_PATH (pspec)->type; +} + + +/* + * GIMP_TYPE_PARAM_UNIT + */ static void gimp_param_unit_class_init (GParamSpecClass *class); static gboolean gimp_param_unit_value_validate (GParamSpec *pspec, diff --git a/app/config/gimpconfig-params.h b/app/config/gimpconfig-params.h index b390e43c9e..c25d5ea65a 100644 --- a/app/config/gimpconfig-params.h +++ b/app/config/gimpconfig-params.h @@ -33,6 +33,10 @@ GIMP_PARAM_SERIALIZE) +/* + * GIMP_TYPE_PARAM_COLOR + */ + #define GIMP_TYPE_PARAM_COLOR (gimp_param_color_get_type ()) #define GIMP_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_COLOR)) @@ -45,6 +49,10 @@ GParamSpec * gimp_param_spec_color (const gchar *name, GParamFlags flags); +/* + * GIMP_TYPE_PARAM_MEMSIZE + */ + #define GIMP_TYPE_PARAM_MEMSIZE (gimp_param_memsize_get_type ()) #define GIMP_IS_PARAM_SPEC_MEMSIZE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MEMSIZE)) @@ -59,17 +67,36 @@ GParamSpec * gimp_param_spec_memsize (const gchar *name, GParamFlags flags); +/* + * GIMP_TYPE_PARAM_PATH + */ + +typedef enum +{ + GIMP_PARAM_PATH_FILE, + GIMP_PARAM_PATH_FILE_LIST, + GIMP_PARAM_PATH_DIR, + GIMP_PARAM_PATH_DIR_LIST +} GimpParamPathType; + #define GIMP_TYPE_PARAM_PATH (gimp_param_path_get_type ()) #define GIMP_IS_PARAM_SPEC_PATH(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_PATH)) GType gimp_param_path_get_type (void) G_GNUC_CONST; -GParamSpec * gimp_param_spec_path (const gchar *name, - const gchar *nick, - const gchar *blurb, - gchar *default_value, - GParamFlags flags); +GParamSpec * gimp_param_spec_path (const gchar *name, + const gchar *nick, + const gchar *blurb, + GimpParamPathType type, + gchar *default_value, + GParamFlags flags); +GimpParamPathType gimp_param_spec_path_type (GParamSpec *pspec); + + +/* + * GIMP_TYPE_PARAM_UNIT + */ #define GIMP_TYPE_PARAM_UNIT (gimp_param_unit_get_type ()) #define GIMP_IS_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_UNIT)) @@ -129,10 +156,10 @@ GParamSpec * gimp_param_spec_unit (const gchar *name, object_type,\ flags | GIMP_CONFIG_PARAM_FLAGS)) #define GIMP_CONFIG_INSTALL_PROP_PATH(class, id,\ - name, blurb, default, flags)\ + name, blurb, type, default, flags)\ g_object_class_install_property (class, id,\ gimp_param_spec_path (name, NULL, blurb,\ - default,\ + type, default,\ flags | GIMP_CONFIG_PARAM_FLAGS)) #define GIMP_CONFIG_INSTALL_PROP_STRING(class, id,\ name, blurb, default, flags)\ diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c index 8ceb397ecd..4e7dd10aee 100644 --- a/app/config/gimpcoreconfig.c +++ b/app/config/gimpcoreconfig.c @@ -132,34 +132,42 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass) 0); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PLUG_IN_PATH, "plug-in-path", PLUG_IN_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_plug_in_path ("plug-ins"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_TOOL_PLUG_IN_PATH, "tool-plug-in-path", TOOL_PLUG_IN_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_plug_in_path ("tool-plug-ins"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_MODULE_PATH, "module-path", MODULE_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_plug_in_path ("modules"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_ENVIRON_PATH, "environ-path", ENVIRON_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_plug_in_path ("environ"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_BRUSH_PATH, "brush-path", BRUSH_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("brushes"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PATTERN_PATH, "pattern-path", PATTERN_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("patterns"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PALETTE_PATH, "palette-path", PALETTE_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("palettes"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_GRADIENT_PATH, "gradient-path", GRADIENT_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("gradients"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_DEFAULT_BRUSH, @@ -225,6 +233,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass) GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PLUGINRC_PATH, "pluginrc-path", PLUGINRC_PATH_BLURB, + GIMP_PARAM_PATH_FILE, "${gimp_dir}" G_DIR_SEPARATOR_S "pluginrc", GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_MODULE_LOAD_INHIBIT, diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c index 088e869e11..742de61b67 100644 --- a/app/config/gimpguiconfig.c +++ b/app/config/gimpguiconfig.c @@ -171,6 +171,7 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) 0); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_THEME_PATH, "theme-path", THEME_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("themes"), GIMP_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_THEME, diff --git a/app/config/gimppluginconfig.c b/app/config/gimppluginconfig.c index 01da7eda0c..e998271dc5 100644 --- a/app/config/gimppluginconfig.c +++ b/app/config/gimppluginconfig.c @@ -104,28 +104,33 @@ gimp_plugin_config_class_init (GimpPluginConfigClass *klass) PROP_FRACTALEXPLORER_PATH, "fractalexplorer-path", FRACTALEXPLORER_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("fractalexplorer"), 0); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_GFIG_PATH, "gfig-path", GFIG_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("gfig"), 0); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_GFLARE_PATH, "gflare-path", GFLARE_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("gflare"), 0); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_GIMPRESSIONIST_PATH, "gimpressionist-path", GIMPRESSIONIST_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("gimpressionist"), 0); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_SCRIPT_FU_PATH, "script-fu-path", SCRIPT_FU_PATH_BLURB, + GIMP_PARAM_PATH_DIR_LIST, gimp_config_build_data_path ("scripts"), 0); } diff --git a/etc/gimprc b/etc/gimprc index be46d1bd50..455f625645 100644 --- a/etc/gimprc +++ b/etc/gimprc @@ -7,17 +7,16 @@ # By default everything in this file is commented out. The file then # documents the default values and shows what changes are possible. -# The variable gimp_dir is set to either the internal value -# @gimpdir@ or the environment variable GIMP_DIRECTORY. If -# the path in GIMP_DIRECTORY is relative, it is considered -# relative to your home directory. +# The variable ${gimp_dir} is set to the value of the environment +# variable GIMP_DIRECTORY or, if that is not set, the compiled-in +# default value is used. If GIMP_DIRECTORY is not an absolute path, +# it is interpreted relative to your home directory. # Set the temporary storage directory. Files will appear here during the # course of running the gimp. Most files will disappear when the gimp exits, # but some files are likely to remain, such as working palette files, so it is # best if this directory not be one that is shared by other users or is -# cleared on machine reboot such as /tmp. This is a colon-separated list of -# directories to search. +# cleared on machine reboot such as /tmp. This is a single folder. # # (temp-path "${gimp_dir}/tmp") @@ -27,7 +26,7 @@ # gimp is used with large images. Also, things can get horribly slow if the # swap file is created on a directory that is mounted over NFS. For these # reasons, it may be desirable to put your swap file in "/tmp". This is a -# colon-separated list of directories to search. +# single folder. # # (swap-path "${gimp_dir}") @@ -59,41 +58,41 @@ # # (interpolation-type linear) -# Set the plug-in search path. This is a colon-separated list of directories -# to search. +# Set the plug-in search path. This is a colon-separated list of folders to +# search. # # (plug-in-path "${gimp_dir}/plug-ins:${gimp_plug_in_dir}/plug-ins") -# tool-plug-in-path This is a colon-separated list of directories to search. +# tool-plug-in-path This is a colon-separated list of folders to search. # # (tool-plug-in-path "${gimp_dir}/tool-plug-ins:${gimp_plug_in_dir}/tool-plug-ins") -# Set the module search path. This is a colon-separated list of directories -# to search. +# Set the module search path. This is a colon-separated list of folders to +# search. # # (module-path "${gimp_dir}/modules:${gimp_plug_in_dir}/modules") -# environ-path This is a colon-separated list of directories to search. +# environ-path This is a colon-separated list of folders to search. # # (environ-path "${gimp_dir}/environ:${gimp_plug_in_dir}/environ") -# Set the brush search path. This is a colon-separated list of directories to +# Set the brush search path. This is a colon-separated list of folders to # search. # # (brush-path "${gimp_dir}/brushes:${gimp_data_dir}/brushes") -# Set the pattern search path. This is a colon-separated list of directories -# to search. +# Set the pattern search path. This is a colon-separated list of folders to +# search. # # (pattern-path "${gimp_dir}/patterns:${gimp_data_dir}/patterns") -# Set the palette search path. This is a colon-separated list of directories -# to search. +# Set the palette search path. This is a colon-separated list of folders to +# search. # # (palette-path "${gimp_dir}/palettes:${gimp_data_dir}/palettes") -# Set the gradient search path. This is a colon-separated list of directories -# to search. +# Set the gradient search path. This is a colon-separated list of folders to +# search. # # (gradient-path "${gimp_dir}/gradients:${gimp_data_dir}/gradients") @@ -144,7 +143,7 @@ # # (undo-levels 5) -# pluginrc-path This is a colon-separated list of directories to search. +# pluginrc-path This is a single filename. # # (pluginrc-path "${gimp_dir}/pluginrc") @@ -365,7 +364,7 @@ # # (max-new-image-size 32M) -# theme-path This is a colon-separated list of directories to search. +# theme-path This is a colon-separated list of folders to search. # # (theme-path "${gimp_dir}/themes:${gimp_data_dir}/themes") @@ -378,27 +377,27 @@ # (help-browser gimp) # Where to search for fractals used by the Fractal Explorer plug-in. This is -# a colon-separated list of directories to search. +# a colon-separated list of folders to search. # # (fractalexplorer-path "${gimp_dir}/fractalexplorer:${gimp_data_dir}/fractalexplorer") -# Where to search for GFig figures used by the GFig plug-in. This is a -# colon-separated list of directories to search. +# Where to search for Gfig figures used by the Gfig plug-in. This is a +# colon-separated list of folders to search. # # (gfig-path "${gimp_dir}/gfig:${gimp_data_dir}/gfig") # Where to search for gflares used by the GFlare plug-in. This is a -# colon-separated list of directories to search. +# colon-separated list of folders to search. # # (gflare-path "${gimp_dir}/gflare:${gimp_data_dir}/gflare") # Where to search for data used by the Gimpressionist plug-in. This is a -# colon-separated list of directories to search. +# colon-separated list of folders to search. # # (gimpressionist-path "${gimp_dir}/gimpressionist:${gimp_data_dir}/gimpressionist") # This path will be searched for scripts when the Script-Fu plug-in is run. -# This is a colon-separated list of directories to search. +# This is a colon-separated list of folders to search. # # (script-fu-path "${gimp_dir}/scripts:${gimp_data_dir}/scripts") diff --git a/libgimpconfig/gimpconfig-params.h b/libgimpconfig/gimpconfig-params.h index b390e43c9e..c25d5ea65a 100644 --- a/libgimpconfig/gimpconfig-params.h +++ b/libgimpconfig/gimpconfig-params.h @@ -33,6 +33,10 @@ GIMP_PARAM_SERIALIZE) +/* + * GIMP_TYPE_PARAM_COLOR + */ + #define GIMP_TYPE_PARAM_COLOR (gimp_param_color_get_type ()) #define GIMP_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_COLOR)) @@ -45,6 +49,10 @@ GParamSpec * gimp_param_spec_color (const gchar *name, GParamFlags flags); +/* + * GIMP_TYPE_PARAM_MEMSIZE + */ + #define GIMP_TYPE_PARAM_MEMSIZE (gimp_param_memsize_get_type ()) #define GIMP_IS_PARAM_SPEC_MEMSIZE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MEMSIZE)) @@ -59,17 +67,36 @@ GParamSpec * gimp_param_spec_memsize (const gchar *name, GParamFlags flags); +/* + * GIMP_TYPE_PARAM_PATH + */ + +typedef enum +{ + GIMP_PARAM_PATH_FILE, + GIMP_PARAM_PATH_FILE_LIST, + GIMP_PARAM_PATH_DIR, + GIMP_PARAM_PATH_DIR_LIST +} GimpParamPathType; + #define GIMP_TYPE_PARAM_PATH (gimp_param_path_get_type ()) #define GIMP_IS_PARAM_SPEC_PATH(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_PATH)) GType gimp_param_path_get_type (void) G_GNUC_CONST; -GParamSpec * gimp_param_spec_path (const gchar *name, - const gchar *nick, - const gchar *blurb, - gchar *default_value, - GParamFlags flags); +GParamSpec * gimp_param_spec_path (const gchar *name, + const gchar *nick, + const gchar *blurb, + GimpParamPathType type, + gchar *default_value, + GParamFlags flags); +GimpParamPathType gimp_param_spec_path_type (GParamSpec *pspec); + + +/* + * GIMP_TYPE_PARAM_UNIT + */ #define GIMP_TYPE_PARAM_UNIT (gimp_param_unit_get_type ()) #define GIMP_IS_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_UNIT)) @@ -129,10 +156,10 @@ GParamSpec * gimp_param_spec_unit (const gchar *name, object_type,\ flags | GIMP_CONFIG_PARAM_FLAGS)) #define GIMP_CONFIG_INSTALL_PROP_PATH(class, id,\ - name, blurb, default, flags)\ + name, blurb, type, default, flags)\ g_object_class_install_property (class, id,\ gimp_param_spec_path (name, NULL, blurb,\ - default,\ + type, default,\ flags | GIMP_CONFIG_PARAM_FLAGS)) #define GIMP_CONFIG_INSTALL_PROP_STRING(class, id,\ name, blurb, default, flags)\ diff --git a/plug-ins/common/tiff.c b/plug-ins/common/tiff.c index 4d88a5e904..8ea7b2ea85 100644 --- a/plug-ins/common/tiff.c +++ b/plug-ins/common/tiff.c @@ -442,12 +442,12 @@ load_image (gchar *filename) tif = TIFFOpen (filename, "r"); if (!tif) { - g_message ("TIFF Can't open %s\n", filename); + g_message (_("TIFF: Can't open '%s'"), filename); gimp_quit (); } if (run_mode == GIMP_RUN_INTERACTIVE) { - name = g_strdup_printf( _("Loading %s:"), filename); + name = g_strdup_printf( _("Loading '%s' ..."), filename); gimp_progress_init (name); g_free (name); } @@ -464,17 +464,17 @@ load_image (gchar *filename) extra = 0; if (!TIFFGetField (tif, TIFFTAG_IMAGEWIDTH, &cols)) { - g_message ("TIFF Can't get image width\n"); + g_message ("TIFF: Can't get image width"); gimp_quit (); } if (!TIFFGetField (tif, TIFFTAG_IMAGELENGTH, &rows)) { - g_message ("TIFF Can't get image length\n"); + g_message ("TIFF: Can't get image length"); gimp_quit (); } if (!TIFFGetField (tif, TIFFTAG_PHOTOMETRIC, &photomet)) { - g_message("TIFF Can't get photometric\nAssuming min-is-black\n"); + g_message("TIFF: Can't get photometric\nAssuming min-is-black\n"); /* old AppleScan software misses out the photometric tag (and * incidentally assumes min-is-white, but xv assumes min-is-black, * so we follow xv's lead. It's not much hardship to invert the @@ -525,7 +525,7 @@ load_image (gchar *filename) } if ((image = gimp_image_new (cols, rows, image_type)) == -1) { - g_message("TIFF Can't create a new image\n"); + g_message ("TIFF: Can't create a new image"); gimp_quit (); } gimp_image_set_filename (image, filename); @@ -591,7 +591,7 @@ load_image (gchar *filename) { case RESUNIT_NONE: /* ImageMagick writes files with this silly resunit */ - g_message ("TIFF warning: resolution units meaningless\n"); + g_message ("TIFF warning: resolution units meaningless"); break; case RESUNIT_INCH: @@ -606,20 +606,20 @@ load_image (gchar *filename) default: g_message ("TIFF file error: unknown resolution unit type %d, " - "assuming dpi\n", read_unit); + "assuming dpi", read_unit); break; } } else { /* no res unit tag */ /* old AppleScan software produces these */ - g_message ("TIFF warning: resolution specified without\n" - "any units tag, assuming dpi\n"); + g_message ("TIFF warning: resolution specified without any units tag, " + "assuming dpi"); } } else { /* xres but no yres */ - g_message("TIFF warning: no y resolution info, assuming same as x\n"); + g_message ("TIFF warning: no y resolution info, assuming same as x"); yres = xres; } @@ -650,7 +650,7 @@ load_image (gchar *filename) { if (!TIFFGetField (tif, TIFFTAG_COLORMAP, &redmap, &greenmap, &bluemap)) { - g_message ("TIFF Can't get colormaps\n"); + g_message ("TIFF: Can't get colormaps"); gimp_quit (); } @@ -665,8 +665,8 @@ load_image (gchar *filename) /* Allocate channel_data for all channels, even the background layer */ channel = g_new (channel_data, extra + 1); - layer = gimp_layer_new (image, _("Background"), cols, rows, layer_type, - 100, GIMP_NORMAL_MODE); + layer = gimp_layer_new (image, _("Background"), + cols, rows, layer_type, 100, GIMP_NORMAL_MODE); channel[0].ID= layer; gimp_image_add_layer (image, layer, 0); channel[0].drawable= gimp_drawable_get(layer); @@ -674,18 +674,18 @@ load_image (gchar *filename) if (extra > 0 && !worst_case) { /* Add alpha channels as appropriate */ for (i= 1; i <= extra; ++i) { - channel[i].ID= gimp_channel_new(image, _("TIFF Channel"), cols, rows, - 100.0, &color); + channel[i].ID= gimp_channel_new (image, _("TIFF Channel"), cols, rows, + 100.0, &color); gimp_image_add_channel(image, channel[i].ID, 0); channel[i].drawable= gimp_drawable_get (channel[i].ID); } } if (bps == 16) - g_message (_("TIFF warning: the image you are loading has 16 bits per" - "channel.\nGIMP can only handle 8 bit, so it will be" - "converted for you.\nInformation will be lost because of" - "this conversion.")); + g_message (_("TIFF warning:\n" + "The image you are loading has 16 bits per channel. GIMP " + "can only handle 8 bit, so it will be converted for you. " + "Information will be lost because of this conversion.")); if (worst_case) { load_rgba (tif, channel); @@ -703,24 +703,24 @@ load_image (gchar *filename) { case ORIENTATION_TOPLEFT: flip_horizontal = FALSE; - flip_vertical = FALSE; + flip_vertical = FALSE; break; case ORIENTATION_TOPRIGHT: flip_horizontal = TRUE; - flip_vertical = FALSE; + flip_vertical = FALSE; break; case ORIENTATION_BOTRIGHT: flip_horizontal = TRUE; - flip_vertical = TRUE; + flip_vertical = TRUE; break; case ORIENTATION_BOTLEFT: flip_horizontal = FALSE; - flip_vertical = TRUE; + flip_vertical = TRUE; break; default: flip_horizontal = FALSE; - flip_vertical = FALSE; - printf("Orientation %d not handled yet!\n", orientation); + flip_vertical = FALSE; + g_warning ("Orientation %d not handled yet!", orientation); break; } @@ -771,20 +771,18 @@ load_rgba (TIFF *tif, channel_data *channel) TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imageLength); gimp_pixel_rgn_init (&(channel[0].pixel_rgn), channel[0].drawable, 0, 0, imageWidth, imageLength, TRUE, FALSE); - buffer = g_new(uint32, imageWidth * imageLength); + buffer = g_new (uint32, imageWidth * imageLength); channel[0].pixels = (guchar*) buffer; - if (buffer == NULL) { - g_message("TIFF Unable to allocate temporary buffer\n"); - } + if (!TIFFReadRGBAImage(tif, imageWidth, imageLength, buffer, 0)) - g_message("TIFF Unsupported layout, no RGBA loader\n"); + g_message ("TIFF Unsupported layout, no RGBA loader"); for (row = 0; row < imageLength; ++row) { gimp_pixel_rgn_set_rect(&(channel[0].pixel_rgn), channel[0].pixels + row * imageWidth * 4, 0, imageLength -row -1, imageWidth, 1); if (run_mode == GIMP_RUN_INTERACTIVE) - gimp_progress_update ((double) row / (double) imageLength); + gimp_progress_update ((gdouble) row / (gdouble) imageLength); } } @@ -1300,8 +1298,8 @@ read_separate (guchar *source, gint bitsleft = 8, maxval = (1 << bps) - 1; if (bps > 8) { - g_message("TIFF Unsupported layout\n"); - gimp_quit(); + g_message ("TIFF: Unsupported layout"); + gimp_quit (); } if (sample < channel[0].drawable->bpp) { @@ -1620,13 +1618,13 @@ save_image (gchar *filename, } if (!success) { - g_message ("TIFF Failed a scanline write on row %d", row); + g_message ("TIFF: Failed a scanline write on row %d", row); return 0; } } if (run_mode == GIMP_RUN_INTERACTIVE) - gimp_progress_update ((double) row / (double) rows); + gimp_progress_update ((gdouble) row / (gdouble) rows); } TIFFFlushData (tif); @@ -1744,7 +1742,7 @@ comment_entry_callback (GtkWidget *widget, /* Temporary kludge for overlength strings - just return */ if (len > 240) { - g_message ("TIFF save: Your comment string is too long.\n"); + g_message (_("TIFF: Your comment string is too long.")); return; }