diff --git a/ChangeLog b/ChangeLog index 9c689a2a5a..d4e68d852e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-02-09 Bill Skaggs + + Merged 24822:24845 from trunk. + 2008-02-09 Bill Skaggs Initial implementation of two-column docks. Needs diff --git a/app/app.c b/app/app.c index 70e046b3cb..e6edb36b16 100644 --- a/app/app.c +++ b/app/app.c @@ -30,7 +30,7 @@ #include #endif -#include +#include #include "libgimpbase/gimpbase.h" #include "libgimpconfig/gimpconfig.h" diff --git a/app/base/base-utils.c b/app/base/base-utils.c index 08de2578f4..5ed2774d94 100644 --- a/app/base/base-utils.c +++ b/app/base/base-utils.c @@ -27,14 +27,23 @@ #ifdef G_OS_WIN32 #define _WIN32_WINNT 0x0500 #include +#include #endif #include "base-utils.h" + #define NUM_PROCESSORS_DEFAULT 1 + /* public functions */ +GPid +get_pid (void) +{ + return getpid (); +} + gint get_number_of_processors (void) { diff --git a/app/base/base-utils.h b/app/base/base-utils.h index b9c86d5940..71da944818 100644 --- a/app/base/base-utils.h +++ b/app/base/base-utils.h @@ -20,6 +20,7 @@ #define __BASE_H__ +GPid get_pid (void); gint get_number_of_processors (void); guint64 get_physical_memory_size (void); diff --git a/app/base/base.c b/app/base/base.c index 5859364828..8aa7331404 100644 --- a/app/base/base.c +++ b/app/base/base.c @@ -21,18 +21,12 @@ #include #include #include - -#ifdef HAVE_UNISTD_H -#include -#endif - #include #include #include #ifdef G_OS_WIN32 -#include /* for _getpid() */ #include "libgimpbase/gimpwin32-io.h" #endif diff --git a/app/base/tile-swap.c b/app/base/tile-swap.c index 92ff547380..2e947bf9ee 100644 --- a/app/base/tile-swap.c +++ b/app/base/tile-swap.c @@ -35,8 +35,6 @@ #ifdef G_OS_WIN32 #include #include "libgimpbase/gimpwin32-io.h" -#include -#define getpid _getpid #endif #include "base-types.h" @@ -48,6 +46,7 @@ #define _O_TEMPORARY 0 #endif +#include "base-utils.h" #include "tile.h" #include "tile-rowhints.h" #include "tile-swap.h" @@ -169,7 +168,7 @@ tile_swap_init (const gchar *path) g_return_if_fail (path != NULL); dirname = gimp_config_path_expand (path, TRUE, NULL); - basename = g_strdup_printf ("gimpswap.%lu", (unsigned long) getpid ()); + basename = g_strdup_printf ("gimpswap.%lu", (unsigned long) get_pid ()); /* create the swap directory if it doesn't exist */ if (! g_file_test (dirname, G_FILE_TEST_EXISTS)) diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c index dac5bda1eb..302d65544d 100644 --- a/app/core/gimp-utils.c +++ b/app/core/gimp-utils.c @@ -26,18 +26,6 @@ #include #endif -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include - -#ifdef G_OS_WIN32 -#include -#endif - #include #include @@ -48,6 +36,8 @@ #include "core-types.h" +#include "base/base-utils.h" + #include "config/gimpbaseconfig.h" #include "gimp.h" @@ -491,7 +481,7 @@ gimp_get_temp_filename (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); if (id == 0) - pid = getpid (); + pid = get_pid (); if (extension) basename = g_strdup_printf ("gimp-temp-%d%d.%s", pid, id++, extension); diff --git a/app/core/gimpcurve.c b/app/core/gimpcurve.c index 9d345e0358..1cf93b73cb 100644 --- a/app/core/gimpcurve.c +++ b/app/core/gimpcurve.c @@ -331,18 +331,18 @@ gimp_curve_reset (GimpCurve *curve, curve->curve_type = GIMP_CURVE_SMOOTH; for (i = 0; i < 256; i++) - curve->curve[i] = i; + curve->curve[i] = (gdouble) i / 255.0; for (i = 0; i < GIMP_CURVE_NUM_POINTS; i++) { - curve->points[i][0] = -1; - curve->points[i][1] = -1; + curve->points[i].x = -1.0; + curve->points[i].y = -1.0; } - curve->points[0][0] = 0; - curve->points[0][1] = 0; - curve->points[GIMP_CURVE_NUM_POINTS - 1][0] = 255; - curve->points[GIMP_CURVE_NUM_POINTS - 1][1] = 255; + curve->points[0].x = 0.0; + curve->points[0].y = 0.0; + curve->points[GIMP_CURVE_NUM_POINTS - 1].x = 1.0; + curve->points[GIMP_CURVE_NUM_POINTS - 1].y = 1.0; g_object_freeze_notify (G_OBJECT (curve)); @@ -371,18 +371,17 @@ gimp_curve_set_curve_type (GimpCurve *curve, if (curve_type == GIMP_CURVE_SMOOTH) { - gint i; - gint32 index; + gint i; /* pick representative points from the curve and make them * control points */ for (i = 0; i <= 8; i++) { - index = CLAMP0255 (i * 32); + gint32 index = CLAMP0255 (i * 32); - curve->points[i * 2][0] = index; - curve->points[i * 2][1] = curve->curve[index]; + curve->points[i * 2].x = (gdouble) index / 255.0; + curve->points[i * 2].y = curve->curve[index]; } g_object_notify (G_OBJECT (curve), "points"); @@ -404,30 +403,30 @@ gimp_curve_get_curve_type (GimpCurve *curve) return curve->curve_type; } -#define MIN_DISTANCE 8 +#define MIN_DISTANCE (8.0 / 255.0) gint gimp_curve_get_closest_point (GimpCurve *curve, - gint x) + gdouble x) { - gint closest_point = 0; - gint distance = G_MAXINT; - gint i; + gint closest_point = 0; + gdouble distance = G_MAXDOUBLE; + gint i; g_return_val_if_fail (GIMP_IS_CURVE (curve), 0); for (i = 0; i < GIMP_CURVE_NUM_POINTS; i++) { - if (curve->points[i][0] != -1) - if (abs (x - curve->points[i][0]) < distance) - { - distance = abs (x - curve->points[i][0]); - closest_point = i; - } + if (curve->points[i].x >= 0.0 && + fabs (x - curve->points[i].x) < distance) + { + distance = fabs (x - curve->points[i].x); + closest_point = i; + } } if (distance > MIN_DISTANCE) - closest_point = (x + 8) / 16; + closest_point = ((gint) (x * 255.999) + 8) / 16; return closest_point; } @@ -435,8 +434,8 @@ gimp_curve_get_closest_point (GimpCurve *curve, void gimp_curve_set_point (GimpCurve *curve, gint point, - gint x, - gint y) + gdouble x, + gdouble y) { g_return_if_fail (GIMP_IS_CURVE (curve)); @@ -445,8 +444,8 @@ gimp_curve_set_point (GimpCurve *curve, g_object_freeze_notify (G_OBJECT (curve)); - curve->points[point][0] = x; - curve->points[point][1] = y; + curve->points[point].x = x; + curve->points[point].y = y; g_object_notify (G_OBJECT (curve), "points"); @@ -458,7 +457,7 @@ gimp_curve_set_point (GimpCurve *curve, void gimp_curve_move_point (GimpCurve *curve, gint point, - gint y) + gdouble y) { g_return_if_fail (GIMP_IS_CURVE (curve)); @@ -467,7 +466,7 @@ gimp_curve_move_point (GimpCurve *curve, g_object_freeze_notify (G_OBJECT (curve)); - curve->points[point][1] = y; + curve->points[point].y = y; g_object_notify (G_OBJECT (curve), "points"); @@ -478,8 +477,8 @@ gimp_curve_move_point (GimpCurve *curve, void gimp_curve_set_curve (GimpCurve *curve, - gint x, - gint y) + gdouble x, + gdouble y) { g_return_if_fail (GIMP_IS_CURVE (curve)); @@ -488,7 +487,7 @@ gimp_curve_set_curve (GimpCurve *curve, g_object_freeze_notify (G_OBJECT (curve)); - curve->curve[x] = y; + curve->curve[(gint) (x * 255.999)] = y; g_object_notify (G_OBJECT (curve), "curve"); @@ -497,14 +496,45 @@ gimp_curve_set_curve (GimpCurve *curve, gimp_data_dirty (GIMP_DATA (curve)); } +gdouble +gimp_curve_map (GimpCurve *curve, + gdouble x) +{ + gdouble value; + + g_return_val_if_fail (GIMP_IS_CURVE (curve), 0.0); + + if (x < 0.0) + { + value = curve->curve[0]; + } + else if (x >= 1.0) + { + value = curve->curve[255]; + } + else /* interpolate the curve */ + { + gint index = floor (x * 255.0); + gdouble f = x * 255.0 - index; + + value = ((1.0 - f) * curve->curve[index ] + + f * curve->curve[index + 1]); + } + + return value; +} + void gimp_curve_get_uchar (GimpCurve *curve, guchar *dest_array) { + gint i; + g_return_if_fail (GIMP_IS_CURVE (curve)); g_return_if_fail (dest_array != NULL); - memcpy (dest_array, curve->curve, 256); + for (i = 0; i < 256; i++) + dest_array[i] = curve->curve[i] * 255.999; } @@ -527,17 +557,17 @@ gimp_curve_calculate (GimpCurve *curve) /* cycle through the curves */ num_pts = 0; for (i = 0; i < GIMP_CURVE_NUM_POINTS; i++) - if (curve->points[i][0] != -1) + if (curve->points[i].x >= 0.0) points[num_pts++] = i; /* Initialize boundary curve points */ if (num_pts != 0) { - for (i = 0; i < curve->points[points[0]][0]; i++) - curve->curve[i] = curve->points[points[0]][1]; + for (i = 0; i < (gint) (curve->points[points[0]].x * 255.999); i++) + curve->curve[i] = curve->points[points[0]].y; - for (i = curve->points[points[num_pts - 1]][0]; i < 256; i++) - curve->curve[i] = curve->points[points[num_pts - 1]][1]; + for (i = (gint) (curve->points[points[num_pts - 1]].x * 255.999); i < 256; i++) + curve->curve[i] = curve->points[points[num_pts - 1]].y; } for (i = 0; i < num_pts - 1; i++) @@ -553,10 +583,10 @@ gimp_curve_calculate (GimpCurve *curve) /* ensure that the control points are used exactly */ for (i = 0; i < num_pts; i++) { - gint x = curve->points[points[i]][0]; - gint y = curve->points[points[i]][1]; + gdouble x = curve->points[points[i]].x; + gdouble y = curve->points[points[i]].y; - curve->curve[x] = y; + curve->curve[(gint) (x * 255.999)] = y; } g_object_notify (G_OBJECT (curve), "curve"); @@ -591,10 +621,10 @@ gimp_curve_plot (GimpCurve *curve, gdouble slope; /* the outer control points for the bezier curve. */ - x0 = curve->points[p2][0]; - y0 = curve->points[p2][1]; - x3 = curve->points[p3][0]; - y3 = curve->points[p3][1]; + x0 = curve->points[p2].x; + y0 = curve->points[p2].y; + x3 = curve->points[p3].x; + y3 = curve->points[p3].y; /* * the x values of the inner control points are fixed at @@ -625,8 +655,8 @@ gimp_curve_plot (GimpCurve *curve, * the control handle of the right tangent, to ensure that the curve * does not have an inflection point. */ - slope = (curve->points[p4][1] - y0) / - (curve->points[p4][0] - x0); + slope = (curve->points[p4].y - y0) / + (curve->points[p4].x - x0); y2 = y3 - slope * dx / 3.0; y1 = y0 + (y2 - y0) / 2.0; @@ -634,8 +664,8 @@ gimp_curve_plot (GimpCurve *curve, else if (p1 != p2 && p3 == p4) { /* see previous case */ - slope = (y3 - curve->points[p1][1]) / - (x3 - curve->points[p1][0]); + slope = (y3 - curve->points[p1].y) / + (x3 - curve->points[p1].x); y1 = y0 + slope * dx / 3.0; y2 = y3 + (y1 - y3) / 2.0; @@ -646,13 +676,13 @@ gimp_curve_plot (GimpCurve *curve, * parallel to the line between the opposite endpoint and the adjacent * neighbor. */ - slope = (y3 - curve->points[p1][1]) / - (x3 - curve->points[p1][0]); + slope = (y3 - curve->points[p1].y) / + (x3 - curve->points[p1].x); y1 = y0 + slope * dx / 3.0; - slope = (curve->points[p4][1] - y0) / - (curve->points[p4][0] - x0); + slope = (curve->points[p4].y - y0) / + (curve->points[p4].x - x0); y2 = y3 - slope * dx / 3.0; } @@ -661,14 +691,14 @@ gimp_curve_plot (GimpCurve *curve, * finally calculate the y(t) values for the given bezier values. We can * use homogenously distributed values for t, since x(t) increases linearily. */ - for (i = 0; i <= dx; i++) + for (i = 0; i <= (gint) (dx * 255.999); i++) { - t = i / dx; + t = i / dx / 255.0; y = y0 * (1-t) * (1-t) * (1-t) + 3 * y1 * (1-t) * (1-t) * t + 3 * y2 * (1-t) * t * t + y3 * t * t * t; - curve->curve[ROUND(x0) + i] = CLAMP0255 (ROUND (y)); + curve->curve[(gint) (x0 * 255.999) + i] = CLAMP (y, 0.0, 1.0); } } diff --git a/app/core/gimpcurve.h b/app/core/gimpcurve.h index e3848cf6f6..c2e304a022 100644 --- a/app/core/gimpcurve.h +++ b/app/core/gimpcurve.h @@ -21,6 +21,7 @@ #include "gimpdata.h" +#include "libgimpmath/gimpvector.h" #define GIMP_CURVE_NUM_POINTS 17 /* TODO: get rid of this limit */ @@ -42,8 +43,8 @@ struct _GimpCurve GimpCurveType curve_type; - gint points[GIMP_CURVE_NUM_POINTS][2]; - guchar curve[256]; + GimpVector2 points[GIMP_CURVE_NUM_POINTS]; + gdouble curve[256]; }; struct _GimpCurveClass @@ -65,18 +66,21 @@ void gimp_curve_set_curve_type (GimpCurve *curve, GimpCurveType gimp_curve_get_curve_type (GimpCurve *curve); gint gimp_curve_get_closest_point (GimpCurve *curve, - gint x); + gdouble x); void gimp_curve_set_point (GimpCurve *curve, gint point, - gint x, - gint y); + gdouble x, + gdouble y); void gimp_curve_move_point (GimpCurve *curve, gint point, - gint y); + gdouble y); void gimp_curve_set_curve (GimpCurve *curve, - gint x, - gint y); + gdouble x, + gdouble y); + +gdouble gimp_curve_map (GimpCurve *curve, + gdouble x); void gimp_curve_get_uchar (GimpCurve *curve, guchar *dest_array); diff --git a/app/core/gimpdrawable-curves.c b/app/core/gimpdrawable-curves.c index 72109d4b45..66ebfd3397 100644 --- a/app/core/gimpdrawable-curves.c +++ b/app/core/gimpdrawable-curves.c @@ -128,7 +128,9 @@ gimp_drawable_curves_explicit (GimpDrawable *drawable, gimp_curve_set_curve_type (curve, GIMP_CURVE_SMOOTH); for (i = 0; i < 256; i++) - gimp_curve_set_curve (curve, i, points[i]); + gimp_curve_set_curve (curve, + (gdouble) i / 255.0, + (gdouble) points[i] / 255.0); gimp_data_thaw (GIMP_DATA (curve)); diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c index 01a31e9a16..0ebc4f3136 100644 --- a/app/core/gimpimagemap.c +++ b/app/core/gimpimagemap.c @@ -465,16 +465,24 @@ gimp_image_map_apply (GimpImageMap *image_map, g_object_unref (sink_operation); } - if (gegl_node_get_pad (image_map->operation, "input")) + if (gegl_node_get_pad (image_map->operation, "input") && + gegl_node_get_pad (image_map->operation, "output")) { + /* if there are input and output pads we probably have a + * filter OP, connect it on both ends. + */ gegl_node_link_many (image_map->input, image_map->shift, image_map->operation, image_map->output, NULL); } - else + else if (gegl_node_get_pad (image_map->operation, "output")) { + /* if there is only an output pad we probably have a + * source OP, blend its result on top of the original + * pixels. + */ GeglNode *over = gegl_node_new_child (image_map->gegl, "operation", "over", NULL); @@ -488,6 +496,15 @@ gimp_image_map_apply (GimpImageMap *image_map, gegl_node_connect_to (image_map->operation, "output", over, "aux"); } + else + { + /* otherwise we just construct a silly nop pipleline + */ + gegl_node_link_many (image_map->input, + image_map->shift, + image_map->output, + NULL); + } } gegl_node_set (image_map->input, diff --git a/app/dialogs/tips-parser.c b/app/dialogs/tips-parser.c index 8c6b93142a..30081221eb 100644 --- a/app/dialogs/tips-parser.c +++ b/app/dialogs/tips-parser.c @@ -296,7 +296,7 @@ tips_parser_end_element (GMarkupParseContext *context, switch (parser->state) { case TIPS_START: - g_warning ("tips_parser: This shouldn't happen.\n"); + g_warning ("%s: shouldn't get here", G_STRLOC); break; case TIPS_IN_TIPS: diff --git a/app/gegl/gimpcurvesconfig.c b/app/gegl/gimpcurvesconfig.c index 0489bcd06b..728efa8313 100644 --- a/app/gegl/gimpcurvesconfig.c +++ b/app/gegl/gimpcurvesconfig.c @@ -373,7 +373,9 @@ gimp_curves_config_load_cruft (GimpCurvesConfig *config, gimp_curve_set_curve_type (curve, GIMP_CURVE_SMOOTH); for (j = 0; j < GIMP_CURVE_NUM_POINTS; j++) - gimp_curve_set_point (curve, j, index[i][j], value[i][j]); + gimp_curve_set_point (curve, j, + (gdouble) index[i][j] / 255.0, + (gdouble) value[i][j] / 255.0); gimp_data_thaw (GIMP_DATA (curve)); } @@ -387,9 +389,8 @@ gboolean gimp_curves_config_save_cruft (GimpCurvesConfig *config, gpointer fp) { - FILE *file = fp; - gint i, j; - gint32 index; + FILE *file = fp; + gint i; g_return_val_if_fail (GIMP_IS_CURVES_CONFIG (config), FALSE); g_return_val_if_fail (file != NULL, FALSE); @@ -399,6 +400,7 @@ gimp_curves_config_save_cruft (GimpCurvesConfig *config, for (i = 0; i < 5; i++) { GimpCurve *curve = config->curve[i]; + gint j; if (curve->curve_type == GIMP_CURVE_FREE) { @@ -407,17 +409,17 @@ gimp_curves_config_save_cruft (GimpCurvesConfig *config, */ for (j = 0; j <= 8; j++) { - index = CLAMP0255 (j * 32); + gint32 index = CLAMP0255 (j * 32); - curve->points[j * 2][0] = index; - curve->points[j * 2][1] = curve->curve[index]; + curve->points[j * 2].x = (gdouble) index / 255.0; + curve->points[j * 2].y = curve->curve[index]; } } for (j = 0; j < GIMP_CURVE_NUM_POINTS; j++) fprintf (file, "%d %d ", - curve->points[j][0], - curve->points[j][1]); + (gint) (curve->points[j].x * 255.999), + (gint) (curve->points[j].y * 255.999)); fprintf (file, "\n"); } @@ -442,11 +444,13 @@ gimp_curves_config_to_cruft (GimpCurvesConfig *config, channel <= GIMP_HISTOGRAM_ALPHA; channel++) { - gimp_curve_get_uchar (config->curve[channel], cruft->curve[channel]); + gimp_curve_get_uchar (config->curve[channel], + cruft->curve[channel]); } if (! is_color) { - gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_ALPHA], cruft->curve[1]); + gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_ALPHA], + cruft->curve[1]); } } diff --git a/app/gegl/gimpoperationcurves.c b/app/gegl/gimpoperationcurves.c index 76791a24d7..b27905cec4 100644 --- a/app/gegl/gimpoperationcurves.c +++ b/app/gegl/gimpoperationcurves.c @@ -75,30 +75,6 @@ gimp_operation_curves_init (GimpOperationCurves *self) { } -static inline gdouble -gimp_operation_curves_map (gdouble value, - GimpCurve *curve) -{ - if (value < 0.0) - { - value = curve->curve[0] / 255.0; - } - else if (value >= 1.0) - { - value = curve->curve[255] / 255.0; - } - else /* interpolate the curve */ - { - gint index = floor (value * 255.0); - gdouble f = value * 255.0 - index; - - value = ((1.0 - f) * curve->curve[index ] + - f * curve->curve[index + 1] ) / 255.0; - } - - return value; -} - static gboolean gimp_operation_curves_process (GeglOperation *operation, void *in_buf, @@ -121,13 +97,11 @@ gimp_operation_curves_process (GeglOperation *operation, { gdouble value; - value = gimp_operation_curves_map (src[channel], - config->curve[channel + 1]); + value = gimp_curve_map (config->curve[channel + 1], src[channel]); /* don't apply the overall curve to the alpha channel */ if (channel != ALPHA_PIX) - value = gimp_operation_curves_map (value, - config->curve[0]); + value = gimp_curve_map (config->curve[0], value); dest[channel] = value; } diff --git a/app/gegl/gimpoperationtilesource.c b/app/gegl/gimpoperationtilesource.c index e6e8de1d26..68aea4fcba 100644 --- a/app/gegl/gimpoperationtilesource.c +++ b/app/gegl/gimpoperationtilesource.c @@ -55,7 +55,7 @@ static void gimp_operation_tile_source_set_property (GObject *object, static void gimp_operation_tile_source_prepare (GeglOperation *operation); static GeglRectangle - gimp_operation_tile_source_get_defined_region (GeglOperation *operation); + gimp_operation_tile_source_get_bounding_box (GeglOperation *operation); static gboolean gimp_operation_tile_source_process (GeglOperation *operation, GeglNodeContext *context, GeglBuffer *output, @@ -81,8 +81,8 @@ gimp_operation_tile_source_class_init (GimpOperationTileSourceClass *klass) operation_class->name = "gimp-tilemanager-source"; operation_class->prepare = gimp_operation_tile_source_prepare; - operation_class->get_defined_region = gimp_operation_tile_source_get_defined_region; - operation_class->adjust_result_region = NULL; /* the default source is + operation_class->get_bounding_box = gimp_operation_tile_source_get_bounding_box; + operation_class->get_cached_region = NULL; /* the default source is expanding to agressivly make use of available caching, this behavior is at least a @@ -197,7 +197,7 @@ gimp_operation_tile_source_prepare (GeglOperation *operation) } static GeglRectangle -gimp_operation_tile_source_get_defined_region (GeglOperation *operation) +gimp_operation_tile_source_get_bounding_box (GeglOperation *operation) { GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (operation); GeglRectangle result = { 0, }; diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c index a2aeb5852b..be445d5ebd 100644 --- a/app/paint/gimpclone.c +++ b/app/paint/gimpclone.c @@ -29,7 +29,6 @@ #include "base/pixel-region.h" #include "base/temp-buf.h" -#include "base/tile-manager.h" #include "paint-funcs/paint-funcs.h" diff --git a/app/paint/gimpheal.c b/app/paint/gimpheal.c index c3042e5b24..61cea4f53d 100644 --- a/app/paint/gimpheal.c +++ b/app/paint/gimpheal.c @@ -31,7 +31,6 @@ #include "base/pixel-region.h" #include "base/temp-buf.h" -#include "base/tile-manager.h" #include "core/gimppickable.h" #include "core/gimpimage.h" diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c index 3b99dfe0f2..e410b11d46 100644 --- a/app/paint/gimpink.c +++ b/app/paint/gimpink.c @@ -28,8 +28,6 @@ #include "base/pixel-region.h" #include "base/temp-buf.h" -#include "base/tile.h" -#include "base/tile-manager.h" #include "paint-funcs/paint-funcs.h" diff --git a/app/pdb/brush_cmds.c b/app/pdb/brush_cmds.c index 57cd949fcf..60f89ce11f 100644 --- a/app/pdb/brush_cmds.c +++ b/app/pdb/brush_cmds.c @@ -25,9 +25,6 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "base/temp-buf.h" #include "core/gimp.h" @@ -35,8 +32,11 @@ #include "core/gimpbrushgenerated.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" @@ -452,171 +452,6 @@ brush_get_shape_invoker (GimpProcedure *procedure, return return_vals; } -static GValueArray * -brush_get_radius_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GValueArray *return_vals; - const gchar *name; - gdouble radius = 0.0; - - name = g_value_get_string (&args->values[0]); - - if (success) - { - GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); - - if (brush) - radius = GIMP_BRUSH_GENERATED (brush)->radius; - else - success = FALSE; - } - - return_vals = gimp_procedure_get_return_values (procedure, success); - - if (success) - g_value_set_double (&return_vals->values[1], radius); - - return return_vals; -} - -static GValueArray * -brush_get_spikes_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GValueArray *return_vals; - const gchar *name; - gint32 spikes = 0; - - name = g_value_get_string (&args->values[0]); - - if (success) - { - GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); - - if (brush) - spikes = GIMP_BRUSH_GENERATED (brush)->spikes; - else - success = FALSE; - } - - return_vals = gimp_procedure_get_return_values (procedure, success); - - if (success) - g_value_set_int (&return_vals->values[1], spikes); - - return return_vals; -} - -static GValueArray * -brush_get_hardness_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GValueArray *return_vals; - const gchar *name; - gdouble hardness = 0.0; - - name = g_value_get_string (&args->values[0]); - - if (success) - { - GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); - - if (brush) - hardness = GIMP_BRUSH_GENERATED (brush)->hardness; - else - success = FALSE; - } - - return_vals = gimp_procedure_get_return_values (procedure, success); - - if (success) - g_value_set_double (&return_vals->values[1], hardness); - - return return_vals; -} - -static GValueArray * -brush_get_aspect_ratio_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GValueArray *return_vals; - const gchar *name; - gdouble aspect_ratio = 0.0; - - name = g_value_get_string (&args->values[0]); - - if (success) - { - GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); - - if (brush) - aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio; - else - success = FALSE; - } - - return_vals = gimp_procedure_get_return_values (procedure, success); - - if (success) - g_value_set_double (&return_vals->values[1], aspect_ratio); - - return return_vals; -} - -static GValueArray * -brush_get_angle_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GValueArray *return_vals; - const gchar *name; - gdouble angle = 0.0; - - name = g_value_get_string (&args->values[0]); - - if (success) - { - GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); - - if (brush) - angle = GIMP_BRUSH_GENERATED (brush)->angle; - else - success = FALSE; - } - - return_vals = gimp_procedure_get_return_values (procedure, success); - - if (success) - g_value_set_double (&return_vals->values[1], angle); - - return return_vals; -} - static GValueArray * brush_set_shape_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -656,6 +491,39 @@ brush_set_shape_invoker (GimpProcedure *procedure, return return_vals; } +static GValueArray * +brush_get_radius_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GValueArray *return_vals; + const gchar *name; + gdouble radius = 0.0; + + name = g_value_get_string (&args->values[0]); + + if (success) + { + GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); + + if (brush) + radius = GIMP_BRUSH_GENERATED (brush)->radius; + else + success = FALSE; + } + + return_vals = gimp_procedure_get_return_values (procedure, success); + + if (success) + g_value_set_double (&return_vals->values[1], radius); + + return return_vals; +} + static GValueArray * brush_set_radius_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -695,6 +563,39 @@ brush_set_radius_invoker (GimpProcedure *procedure, return return_vals; } +static GValueArray * +brush_get_spikes_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GValueArray *return_vals; + const gchar *name; + gint32 spikes = 0; + + name = g_value_get_string (&args->values[0]); + + if (success) + { + GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); + + if (brush) + spikes = GIMP_BRUSH_GENERATED (brush)->spikes; + else + success = FALSE; + } + + return_vals = gimp_procedure_get_return_values (procedure, success); + + if (success) + g_value_set_int (&return_vals->values[1], spikes); + + return return_vals; +} + static GValueArray * brush_set_spikes_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -734,6 +635,39 @@ brush_set_spikes_invoker (GimpProcedure *procedure, return return_vals; } +static GValueArray * +brush_get_hardness_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GValueArray *return_vals; + const gchar *name; + gdouble hardness = 0.0; + + name = g_value_get_string (&args->values[0]); + + if (success) + { + GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); + + if (brush) + hardness = GIMP_BRUSH_GENERATED (brush)->hardness; + else + success = FALSE; + } + + return_vals = gimp_procedure_get_return_values (procedure, success); + + if (success) + g_value_set_double (&return_vals->values[1], hardness); + + return return_vals; +} + static GValueArray * brush_set_hardness_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -773,6 +707,39 @@ brush_set_hardness_invoker (GimpProcedure *procedure, return return_vals; } +static GValueArray * +brush_get_aspect_ratio_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GValueArray *return_vals; + const gchar *name; + gdouble aspect_ratio = 0.0; + + name = g_value_get_string (&args->values[0]); + + if (success) + { + GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); + + if (brush) + aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio; + else + success = FALSE; + } + + return_vals = gimp_procedure_get_return_values (procedure, success); + + if (success) + g_value_set_double (&return_vals->values[1], aspect_ratio); + + return return_vals; +} + static GValueArray * brush_set_aspect_ratio_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -812,6 +779,39 @@ brush_set_aspect_ratio_invoker (GimpProcedure *procedure, return return_vals; } +static GValueArray * +brush_get_angle_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GValueArray *return_vals; + const gchar *name; + gdouble angle = 0.0; + + name = g_value_get_string (&args->values[0]); + + if (success) + { + GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error); + + if (brush) + angle = GIMP_BRUSH_GENERATED (brush)->angle; + else + success = FALSE; + } + + return_vals = gimp_procedure_get_return_values (procedure, success); + + if (success) + g_value_set_double (&return_vals->values[1], angle); + + return return_vals; +} + static GValueArray * brush_set_angle_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -1238,151 +1238,6 @@ register_brush_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); - /* - * gimp-brush-get-radius - */ - procedure = gimp_procedure_new (brush_get_radius_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-radius"); - gimp_procedure_set_static_strings (procedure, - "gimp-brush-get-radius", - "Get the radius of a generated brush.", - "This procedure gets the radius value for a generated brush. If called for any other type of brush, it does not succeed.", - "Bill Skaggs ", - "Bill Skaggs", - "2004", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_string ("name", - "name", - "The brush name", - FALSE, FALSE, TRUE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - g_param_spec_double ("radius", - "radius", - "The radius of the brush in pixels", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-brush-get-spikes - */ - procedure = gimp_procedure_new (brush_get_spikes_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-spikes"); - gimp_procedure_set_static_strings (procedure, - "gimp-brush-get-spikes", - "Get the number of spikes for a generated brush.", - "This procedure gets the number of spikes for a generated brush. If called for any other type of brush, it does not succeed.", - "Bill Skaggs ", - "Bill Skaggs", - "2004", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_string ("name", - "name", - "The brush name", - FALSE, FALSE, TRUE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_int32 ("spikes", - "spikes", - "The number of spikes on the brush.", - G_MININT32, G_MAXINT32, 0, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-brush-get-hardness - */ - procedure = gimp_procedure_new (brush_get_hardness_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-hardness"); - gimp_procedure_set_static_strings (procedure, - "gimp-brush-get-hardness", - "Get the hardness of a generated brush.", - "This procedure gets the hardness of a generated brush. The hardness of a brush is the amount its intensity fades at the outside edge. If called for any other type of brush, the function does not succeed.", - "Bill Skaggs ", - "Bill Skaggs", - "2004", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_string ("name", - "name", - "The brush name", - FALSE, FALSE, TRUE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - g_param_spec_double ("hardness", - "hardness", - "The hardness of the brush.", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-brush-get-aspect-ratio - */ - procedure = gimp_procedure_new (brush_get_aspect_ratio_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-aspect-ratio"); - gimp_procedure_set_static_strings (procedure, - "gimp-brush-get-aspect-ratio", - "Get the aspect ratio of a generated brush.", - "This procedure gets the aspect ratio of a generated brush. If called for any other type of brush, it does not succeed.", - "Bill Skaggs ", - "Bill Skaggs", - "2004", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_string ("name", - "name", - "The brush name", - FALSE, FALSE, TRUE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - g_param_spec_double ("aspect-ratio", - "aspect ratio", - "The aspect ratio of the brush.", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-brush-get-angle - */ - procedure = gimp_procedure_new (brush_get_angle_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-angle"); - gimp_procedure_set_static_strings (procedure, - "gimp-brush-get-angle", - "Get the rotation angle of a generated brush.", - "This procedure gets the angle of rotation for a generated brush. If called for any other type of brush, it does not succeed.", - "Bill Skaggs ", - "Bill Skaggs", - "2004", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_string ("name", - "name", - "The brush name", - FALSE, FALSE, TRUE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - g_param_spec_double ("angle", - "angle", - "The rotation angle of the brush.", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - /* * gimp-brush-set-shape */ @@ -1420,6 +1275,35 @@ register_brush_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); + /* + * gimp-brush-get-radius + */ + procedure = gimp_procedure_new (brush_get_radius_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-radius"); + gimp_procedure_set_static_strings (procedure, + "gimp-brush-get-radius", + "Get the radius of a generated brush.", + "This procedure gets the radius value for a generated brush. If called for any other type of brush, it does not succeed.", + "Bill Skaggs ", + "Bill Skaggs", + "2004", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_string ("name", + "name", + "The brush name", + FALSE, FALSE, TRUE, + NULL, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_return_value (procedure, + g_param_spec_double ("radius", + "radius", + "The radius of the brush in pixels", + -G_MAXDOUBLE, G_MAXDOUBLE, 0, + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + /* * gimp-brush-set-radius */ @@ -1455,6 +1339,35 @@ register_brush_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); + /* + * gimp-brush-get-spikes + */ + procedure = gimp_procedure_new (brush_get_spikes_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-spikes"); + gimp_procedure_set_static_strings (procedure, + "gimp-brush-get-spikes", + "Get the number of spikes for a generated brush.", + "This procedure gets the number of spikes for a generated brush. If called for any other type of brush, it does not succeed.", + "Bill Skaggs ", + "Bill Skaggs", + "2004", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_string ("name", + "name", + "The brush name", + FALSE, FALSE, TRUE, + NULL, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_return_value (procedure, + gimp_param_spec_int32 ("spikes", + "spikes", + "The number of spikes on the brush.", + G_MININT32, G_MAXINT32, 0, + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + /* * gimp-brush-set-spikes */ @@ -1490,6 +1403,35 @@ register_brush_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); + /* + * gimp-brush-get-hardness + */ + procedure = gimp_procedure_new (brush_get_hardness_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-hardness"); + gimp_procedure_set_static_strings (procedure, + "gimp-brush-get-hardness", + "Get the hardness of a generated brush.", + "This procedure gets the hardness of a generated brush. The hardness of a brush is the amount its intensity fades at the outside edge. If called for any other type of brush, the function does not succeed.", + "Bill Skaggs ", + "Bill Skaggs", + "2004", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_string ("name", + "name", + "The brush name", + FALSE, FALSE, TRUE, + NULL, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_return_value (procedure, + g_param_spec_double ("hardness", + "hardness", + "The hardness of the brush.", + -G_MAXDOUBLE, G_MAXDOUBLE, 0, + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + /* * gimp-brush-set-hardness */ @@ -1525,6 +1467,35 @@ register_brush_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); + /* + * gimp-brush-get-aspect-ratio + */ + procedure = gimp_procedure_new (brush_get_aspect_ratio_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-aspect-ratio"); + gimp_procedure_set_static_strings (procedure, + "gimp-brush-get-aspect-ratio", + "Get the aspect ratio of a generated brush.", + "This procedure gets the aspect ratio of a generated brush. If called for any other type of brush, it does not succeed.", + "Bill Skaggs ", + "Bill Skaggs", + "2004", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_string ("name", + "name", + "The brush name", + FALSE, FALSE, TRUE, + NULL, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_return_value (procedure, + g_param_spec_double ("aspect-ratio", + "aspect ratio", + "The aspect ratio of the brush.", + -G_MAXDOUBLE, G_MAXDOUBLE, 0, + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + /* * gimp-brush-set-aspect-ratio */ @@ -1560,6 +1531,35 @@ register_brush_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); + /* + * gimp-brush-get-angle + */ + procedure = gimp_procedure_new (brush_get_angle_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-angle"); + gimp_procedure_set_static_strings (procedure, + "gimp-brush-get-angle", + "Get the rotation angle of a generated brush.", + "This procedure gets the angle of rotation for a generated brush. If called for any other type of brush, it does not succeed.", + "Bill Skaggs ", + "Bill Skaggs", + "2004", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_string ("name", + "name", + "The brush name", + FALSE, FALSE, TRUE, + NULL, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_return_value (procedure, + g_param_spec_double ("angle", + "angle", + "The rotation angle of the brush.", + -G_MAXDOUBLE, G_MAXDOUBLE, 0, + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + /* * gimp-brush-set-angle */ diff --git a/app/pdb/brush_select_cmds.c b/app/pdb/brush_select_cmds.c index 9efda7f8d4..165b409878 100644 --- a/app/pdb/brush_select_cmds.c +++ b/app/pdb/brush_select_cmds.c @@ -20,17 +20,16 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpdatafactory.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/brushes_cmds.c b/app/pdb/brushes_cmds.c index 863b820d0f..c0f8f70c13 100644 --- a/app/pdb/brushes_cmds.c +++ b/app/pdb/brushes_cmds.c @@ -25,9 +25,6 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "base/temp-buf.h" #include "core/gimp.h" @@ -35,8 +32,11 @@ #include "core/gimpcontainer-filter.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/buffer_cmds.c b/app/pdb/buffer_cmds.c index 8d0ead978b..831da5866a 100644 --- a/app/pdb/buffer_cmds.c +++ b/app/pdb/buffer_cmds.c @@ -25,16 +25,16 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpbuffer.h" #include "core/gimpcontainer-filter.h" #include "core/gimpcontainer.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/channel_cmds.c b/app/pdb/channel_cmds.c index 68265349f3..ec25ce2e4c 100644 --- a/app/pdb/channel_cmds.c +++ b/app/pdb/channel_cmds.c @@ -20,24 +20,24 @@ #include "config.h" - #include #include "libgimpbase/gimpbase.h" #include "libgimpcolor/gimpcolor.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimpchannel-combine.h" #include "core/gimpchannel.h" #include "core/gimpimage.h" -#include "gimp-intl.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * channel_new_invoker (GimpProcedure *procedure, diff --git a/app/pdb/color_cmds.c b/app/pdb/color_cmds.c index 6cb604564b..3407fa6791 100644 --- a/app/pdb/color_cmds.c +++ b/app/pdb/color_cmds.c @@ -20,14 +20,9 @@ #include "config.h" -#include - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "base/gimphistogram.h" #include "core/gimpdrawable-brightness-contrast.h" @@ -43,11 +38,15 @@ #include "core/gimpdrawable-posterize.h" #include "core/gimpdrawable-threshold.h" #include "core/gimpdrawable.h" -#include "gimp-intl.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * brightness_contrast_invoker (GimpProcedure *procedure, diff --git a/app/pdb/context_cmds.c b/app/pdb/context_cmds.c index cb5b42c29c..f7399aa928 100644 --- a/app/pdb/context_cmds.c +++ b/app/pdb/context_cmds.c @@ -20,25 +20,24 @@ #include "config.h" - #include #include "libgimpcolor/gimpcolor.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpcontainer.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" #include "plug-in/gimpplugin-context.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimppluginmanager.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" @@ -80,6 +79,29 @@ context_pop_invoker (GimpProcedure *procedure, return gimp_procedure_get_return_values (procedure, success); } +static GValueArray * +context_list_paint_methods_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + GValueArray *return_vals; + gint32 num_paint_methods = 0; + gchar **paint_methods = NULL; + + paint_methods = gimp_container_get_name_array (gimp->paint_info_list, + &num_paint_methods); + + return_vals = gimp_procedure_get_return_values (procedure, TRUE); + + g_value_set_int (&return_vals->values[1], num_paint_methods); + gimp_value_take_stringarray (&return_vals->values[2], paint_methods, num_paint_methods); + + return return_vals; +} + static GValueArray * context_get_paint_method_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -133,29 +155,6 @@ context_set_paint_method_invoker (GimpProcedure *procedure, return gimp_procedure_get_return_values (procedure, success); } -static GValueArray * -context_list_paint_methods_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - GValueArray *return_vals; - gint32 num_paint_methods = 0; - gchar **paint_methods = NULL; - - paint_methods = gimp_container_get_name_array (gimp->paint_info_list, - &num_paint_methods); - - return_vals = gimp_procedure_get_return_values (procedure, TRUE); - - g_value_set_int (&return_vals->values[1], num_paint_methods); - gimp_value_take_stringarray (&return_vals->values[2], paint_methods, num_paint_methods); - - return return_vals; -} - static GValueArray * context_get_foreground_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -646,6 +645,33 @@ register_context_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); + /* + * gimp-context-list-paint-methods + */ + procedure = gimp_procedure_new (context_list_paint_methods_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-context-list-paint-methods"); + gimp_procedure_set_static_strings (procedure, + "gimp-context-list-paint-methods", + "Lists the available paint methods.", + "This procedure lists the names of the available paint methods. Any of the results can be used for 'gimp-context-set-paint-method'.", + "Simon Budig", + "Simon Budig", + "2007", + NULL); + gimp_procedure_add_return_value (procedure, + gimp_param_spec_int32 ("num-paint-methods", + "num paint methods", + "The number of the available paint methods", + 0, G_MAXINT32, 0, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_return_value (procedure, + gimp_param_spec_string_array ("paint-methods", + "paint methods", + "The names of the available paint methods", + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + /* * gimp-context-get-paint-method */ @@ -692,33 +718,6 @@ register_context_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); - /* - * gimp-context-list-paint-methods - */ - procedure = gimp_procedure_new (context_list_paint_methods_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-context-list-paint-methods"); - gimp_procedure_set_static_strings (procedure, - "gimp-context-list-paint-methods", - "Lists the available paint methods.", - "This procedure lists the names of the available paint methods. Any of the results can be used for 'gimp-context-set-paint-method'.", - "Simon Budig", - "Simon Budig", - "2007", - NULL); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_int32 ("num-paint-methods", - "num paint methods", - "The number of the available paint methods", - 0, G_MAXINT32, 0, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_string_array ("paint-methods", - "paint methods", - "The names of the available paint methods", - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - /* * gimp-context-get-foreground */ diff --git a/app/pdb/convert_cmds.c b/app/pdb/convert_cmds.c index 52f478491e..4e6cc4446e 100644 --- a/app/pdb/convert_cmds.c +++ b/app/pdb/convert_cmds.c @@ -20,19 +20,17 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" -#include "core/gimp.h" #include "core/gimpimage-convert.h" #include "core/gimpimage.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/display_cmds.c b/app/pdb/display_cmds.c index b8eacc6935..7938ad096f 100644 --- a/app/pdb/display_cmds.c +++ b/app/pdb/display_cmds.c @@ -20,18 +20,17 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpcontainer.h" #include "core/gimpimage.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/drawable_cmds.c b/app/pdb/drawable_cmds.c index a05f61c263..b02d298815 100644 --- a/app/pdb/drawable_cmds.c +++ b/app/pdb/drawable_cmds.c @@ -20,13 +20,9 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "base/temp-buf.h" #include "base/tile-manager.h" @@ -40,13 +36,17 @@ #include "core/gimpimage.h" #include "core/gimplayer.h" #include "core/gimplayermask.h" -#include "gimp-intl.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimppluginmanager.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * drawable_is_valid_invoker (GimpProcedure *procedure, diff --git a/app/pdb/drawable_transform_cmds.c b/app/pdb/drawable_transform_cmds.c index 30ffdcecbf..6d0f3d5a17 100644 --- a/app/pdb/drawable_transform_cmds.c +++ b/app/pdb/drawable_transform_cmds.c @@ -20,15 +20,11 @@ #include "config.h" - #include #include "libgimpmath/gimpmath.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "config/gimpcoreconfig.h" #include "core/gimp-transform-utils.h" @@ -36,12 +32,16 @@ #include "core/gimpdrawable-transform.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "core/gimpparamspecs.h" #include "core/gimpprogress.h" -#include "gimp-intl.h" -#include "gimppdb-utils.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * drawable_transform_flip_simple_invoker (GimpProcedure *procedure, diff --git a/app/pdb/edit_cmds.c b/app/pdb/edit_cmds.c index 8354499032..639b211485 100644 --- a/app/pdb/edit_cmds.c +++ b/app/pdb/edit_cmds.c @@ -25,9 +25,6 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp-edit.h" #include "core/gimp.h" @@ -37,14 +34,18 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimplayer.h" +#include "core/gimpparamspecs.h" #include "core/gimpprogress.h" #include "core/gimpstrokedesc.h" -#include "gimp-intl.h" -#include "gimppdb-utils.h" #include "vectors/gimpvectors.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * edit_cut_invoker (GimpProcedure *procedure, diff --git a/app/pdb/fileops_cmds.c b/app/pdb/fileops_cmds.c index 4c5f6db885..0d265cf44e 100644 --- a/app/pdb/fileops_cmds.c +++ b/app/pdb/fileops_cmds.c @@ -28,14 +28,12 @@ #include "libgimpconfig/gimpconfig.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp-utils.h" #include "core/gimp.h" #include "core/gimpimage.h" #include "core/gimplayer.h" +#include "core/gimpparamspecs.h" #include "file/file-open.h" #include "file/file-procedure.h" #include "file/file-save.h" @@ -43,6 +41,8 @@ #include "plug-in/gimppluginmanager-file.h" #include "plug-in/gimppluginmanager.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/floating_sel_cmds.c b/app/pdb/floating_sel_cmds.c index dae5490359..8975fa746c 100644 --- a/app/pdb/floating_sel_cmds.c +++ b/app/pdb/floating_sel_cmds.c @@ -20,23 +20,23 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimpdrawable.h" #include "core/gimplayer-floating-sel.h" #include "core/gimplayer.h" -#include "gimp-intl.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" #include "gimppdberror.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * floating_sel_remove_invoker (GimpProcedure *procedure, diff --git a/app/pdb/font_select_cmds.c b/app/pdb/font_select_cmds.c index 1a9e8cd4ed..e9c3ede559 100644 --- a/app/pdb/font_select_cmds.c +++ b/app/pdb/font_select_cmds.c @@ -20,16 +20,15 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/fonts_cmds.c b/app/pdb/fonts_cmds.c index 6002737b0e..6a4097ac93 100644 --- a/app/pdb/fonts_cmds.c +++ b/app/pdb/fonts_cmds.c @@ -20,19 +20,18 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpcontainer-filter.h" #include "core/gimpcontainer.h" +#include "core/gimpparamspecs.h" #include "text/gimp-fonts.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/gimprc_cmds.c b/app/pdb/gimprc_cmds.c index 5e2cc039b2..4ecc36b302 100644 --- a/app/pdb/gimprc_cmds.c +++ b/app/pdb/gimprc_cmds.c @@ -29,15 +29,15 @@ #include "libgimpmodule/gimpmodule.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "config/gimprc.h" #include "core/gimp-utils.h" #include "core/gimp.h" +#include "core/gimpparamspecs.h" #include "core/gimptemplate.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/gradient_cmds.c b/app/pdb/gradient_cmds.c index e159dd7164..5ad327c9e1 100644 --- a/app/pdb/gradient_cmds.c +++ b/app/pdb/gradient_cmds.c @@ -27,16 +27,16 @@ #include "libgimpcolor/gimpcolor.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" #include "core/gimpgradient.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/gradient_select_cmds.c b/app/pdb/gradient_select_cmds.c index bc136e0d0b..efe4a2d392 100644 --- a/app/pdb/gradient_select_cmds.c +++ b/app/pdb/gradient_select_cmds.c @@ -20,18 +20,17 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpdatafactory.h" #include "core/gimpgradient.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/gradients_cmds.c b/app/pdb/gradients_cmds.c index a1719cefc5..d1a8add8f8 100644 --- a/app/pdb/gradients_cmds.c +++ b/app/pdb/gradients_cmds.c @@ -25,17 +25,17 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpcontainer-filter.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" #include "core/gimpgradient.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/grid_cmds.c b/app/pdb/grid_cmds.c index 5fd0ee254c..7b9e3f8d38 100644 --- a/app/pdb/grid_cmds.c +++ b/app/pdb/grid_cmds.c @@ -20,21 +20,20 @@ #include "config.h" - #include #include "libgimpbase/gimpbaseenums.h" #include "libgimpcolor/gimpcolor.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimpgrid.h" #include "core/gimpimage-grid.h" #include "core/gimpimage.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/guides_cmds.c b/app/pdb/guides_cmds.c index b7824f781a..a7499730d2 100644 --- a/app/pdb/guides_cmds.c +++ b/app/pdb/guides_cmds.c @@ -20,19 +20,18 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimpguide.h" #include "core/gimpimage-guides.h" #include "core/gimpimage-undo-push.h" #include "core/gimpimage.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/help_cmds.c b/app/pdb/help_cmds.c index 59b500c16a..d5e56c9ea9 100644 --- a/app/pdb/help_cmds.c +++ b/app/pdb/help_cmds.c @@ -20,19 +20,18 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" +#include "core/gimpparamspecs.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimppluginmanager-help-domain.h" #include "plug-in/gimppluginmanager.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/image_cmds.c b/app/pdb/image_cmds.c index 23c37113e1..916e29ca06 100644 --- a/app/pdb/image_cmds.c +++ b/app/pdb/image_cmds.c @@ -20,7 +20,6 @@ #include "config.h" - #include #include "libgimpbase/gimpbase.h" @@ -28,9 +27,6 @@ #include "libgimpmath/gimpmath.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "base/temp-buf.h" #include "config/gimpcoreconfig.h" @@ -50,15 +46,19 @@ #include "core/gimplayer.h" #include "core/gimplayermask.h" #include "core/gimplist.h" +#include "core/gimpparamspecs.h" #include "core/gimppickable.h" #include "core/gimpselection.h" #include "core/gimpunit.h" -#include "gimp-intl.h" #include "gimppdberror.h" #include "vectors/gimpvectors.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + #if defined (HAVE_FINITE) #define FINITE(x) finite(x) diff --git a/app/pdb/layer_cmds.c b/app/pdb/layer_cmds.c index 30c398327d..621302810a 100644 --- a/app/pdb/layer_cmds.c +++ b/app/pdb/layer_cmds.c @@ -20,15 +20,11 @@ #include "config.h" - #include #include "libgimpbase/gimpbase.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "config/gimpcoreconfig.h" #include "core/gimp.h" @@ -38,11 +34,15 @@ #include "core/gimpitem-linked.h" #include "core/gimplayer.h" #include "core/gimplayermask.h" -#include "gimp-intl.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * layer_new_invoker (GimpProcedure *procedure, diff --git a/app/pdb/message_cmds.c b/app/pdb/message_cmds.c index cc82c2cbcc..8213c0a324 100644 --- a/app/pdb/message_cmds.c +++ b/app/pdb/message_cmds.c @@ -25,17 +25,18 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" -#include "gimp-intl.h" +#include "core/gimpparamspecs.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimppluginmanager.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * message_invoker (GimpProcedure *procedure, diff --git a/app/pdb/misc_cmds.c b/app/pdb/misc_cmds.c index fca8a6ba27..7d43252a8b 100644 --- a/app/pdb/misc_cmds.c +++ b/app/pdb/misc_cmds.c @@ -20,30 +20,18 @@ #include "config.h" -#include - -#ifdef G_OS_WIN32 -#include -#endif - -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - - #include #include "libgimpbase/gimpbase.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" + +#include "base/base-utils.h" +#include "core/gimp.h" #include "core/gimpparamspecs.h" -#include "core/gimp.h" - +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" @@ -77,7 +65,7 @@ getpid_invoker (GimpProcedure *procedure, GValueArray *return_vals; gint32 pid = 0; - pid = getpid (); + pid = get_pid (); return_vals = gimp_procedure_get_return_values (procedure, TRUE); g_value_set_int (&return_vals->values[1], pid); diff --git a/app/pdb/paint_tools_cmds.c b/app/pdb/paint_tools_cmds.c index 15925f734a..cb32f0b42e 100644 --- a/app/pdb/paint_tools_cmds.c +++ b/app/pdb/paint_tools_cmds.c @@ -20,24 +20,22 @@ #include "config.h" - #include #include "libgimpmath/gimpmath.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" -#include "core/gimp.h" #include "core/gimpdrawable.h" #include "core/gimppaintinfo.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" #include "paint/gimppaintcore-stroke.h" #include "paint/gimppaintcore.h" #include "paint/gimppaintoptions.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/palette_cmds.c b/app/pdb/palette_cmds.c index 9a11c58679..3df11015fe 100644 --- a/app/pdb/palette_cmds.c +++ b/app/pdb/palette_cmds.c @@ -27,16 +27,16 @@ #include "libgimpcolor/gimpcolor.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" #include "core/gimppalette.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/palette_select_cmds.c b/app/pdb/palette_select_cmds.c index f08d525a28..47ea09bfe5 100644 --- a/app/pdb/palette_select_cmds.c +++ b/app/pdb/palette_select_cmds.c @@ -20,17 +20,16 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpdatafactory.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/palettes_cmds.c b/app/pdb/palettes_cmds.c index a8ff194c5b..86889b7ed3 100644 --- a/app/pdb/palettes_cmds.c +++ b/app/pdb/palettes_cmds.c @@ -27,17 +27,17 @@ #include "libgimpcolor/gimpcolor.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpcontainer-filter.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" #include "core/gimppalette.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/parasite_cmds.c b/app/pdb/parasite_cmds.c index 7ead01673e..ccbecf53ab 100644 --- a/app/pdb/parasite_cmds.c +++ b/app/pdb/parasite_cmds.c @@ -20,21 +20,20 @@ #include "config.h" - #include #include "libgimpbase/gimpbase.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp-parasites.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "core/gimpparamspecs.h" #include "vectors/gimpvectors.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/paths_cmds.c b/app/pdb/paths_cmds.c index f437541300..1546ebd0dd 100644 --- a/app/pdb/paths_cmds.c +++ b/app/pdb/paths_cmds.c @@ -27,24 +27,24 @@ #include "libgimpmath/gimpmath.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" -#include "core/gimp.h" #include "core/gimpchannel-select.h" #include "core/gimpimage.h" #include "core/gimplist.h" +#include "core/gimpparamspecs.h" #include "core/gimpstrokedesc.h" -#include "gimp-intl.h" #include "vectors/gimpanchor.h" #include "vectors/gimpbezierstroke.h" #include "vectors/gimpvectors-compat.h" #include "vectors/gimpvectors-import.h" #include "vectors/gimpvectors.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * path_list_invoker (GimpProcedure *procedure, diff --git a/app/pdb/pattern_cmds.c b/app/pdb/pattern_cmds.c index 726fda546e..970bf633e3 100644 --- a/app/pdb/pattern_cmds.c +++ b/app/pdb/pattern_cmds.c @@ -25,17 +25,16 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "base/temp-buf.h" -#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" +#include "core/gimpparamspecs.h" #include "core/gimppattern.h" -#include "gimppdb-utils.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/pattern_select_cmds.c b/app/pdb/pattern_select_cmds.c index b401b18e6c..891873c8b7 100644 --- a/app/pdb/pattern_select_cmds.c +++ b/app/pdb/pattern_select_cmds.c @@ -20,17 +20,16 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpdatafactory.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/patterns_cmds.c b/app/pdb/patterns_cmds.c index 9fd394f933..b9ff4e2633 100644 --- a/app/pdb/patterns_cmds.c +++ b/app/pdb/patterns_cmds.c @@ -25,18 +25,18 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "base/temp-buf.h" #include "core/gimp.h" #include "core/gimpcontainer-filter.h" #include "core/gimpcontext.h" #include "core/gimpdatafactory.h" +#include "core/gimpparamspecs.h" #include "core/gimppattern.h" -#include "gimppdb-utils.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/plug_in_cmds.c b/app/pdb/plug_in_cmds.c index 010683d651..2e1d384694 100644 --- a/app/pdb/plug_in_cmds.c +++ b/app/pdb/plug_in_cmds.c @@ -28,11 +28,9 @@ #include "libgimpbase/gimpbase.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" +#include "core/gimpparamspecs.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimpplugindef.h" #include "plug-in/gimppluginmanager-menu-branch.h" @@ -40,6 +38,8 @@ #include "plug-in/gimppluginmanager.h" #include "plug-in/gimppluginprocedure.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/procedural_db_cmds.c b/app/pdb/procedural_db_cmds.c index 11761973ed..fe21a298b2 100644 --- a/app/pdb/procedural_db_cmds.c +++ b/app/pdb/procedural_db_cmds.c @@ -20,22 +20,21 @@ #include "config.h" - #include #include "libgimpbase/gimpbase.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpparamspecs-desc.h" +#include "core/gimpparamspecs.h" #include "gimp-pdb-compat.h" #include "gimppdb-query.h" #include "plug-in/gimppluginmanager-data.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/progress_cmds.c b/app/pdb/progress_cmds.c index 6afd88e90a..f43a9112f0 100644 --- a/app/pdb/progress_cmds.c +++ b/app/pdb/progress_cmds.c @@ -20,19 +20,18 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" +#include "core/gimpparamspecs.h" #include "plug-in/gimpplugin-progress.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimppluginmanager.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/selection_cmds.c b/app/pdb/selection_cmds.c index 6bc85ea624..72910908c2 100644 --- a/app/pdb/selection_cmds.c +++ b/app/pdb/selection_cmds.c @@ -20,26 +20,26 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimpchannel-select.h" #include "core/gimpchannel.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimplayer.h" +#include "core/gimpparamspecs.h" #include "core/gimppickable.h" #include "core/gimpselection.h" -#include "gimp-intl.h" -#include "gimppdb-utils.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * selection_bounds_invoker (GimpProcedure *procedure, diff --git a/app/pdb/selection_tools_cmds.c b/app/pdb/selection_tools_cmds.c index ce1659a174..204f9460ac 100644 --- a/app/pdb/selection_tools_cmds.c +++ b/app/pdb/selection_tools_cmds.c @@ -20,24 +20,24 @@ #include "config.h" - #include #include "libgimpbase/gimpbase.h" #include "libgimpcolor/gimpcolor.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimpchannel-select.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" -#include "gimp-intl.h" +#include "core/gimpparamspecs.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * by_color_select_invoker (GimpProcedure *procedure, diff --git a/app/pdb/text_tool_cmds.c b/app/pdb/text_tool_cmds.c index 30a48bd713..69c336f2c3 100644 --- a/app/pdb/text_tool_cmds.c +++ b/app/pdb/text_tool_cmds.c @@ -20,22 +20,21 @@ #include "config.h" - #include #include "libgimpbase/gimpbase.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimplayer.h" -#include "gimppdb-utils.h" +#include "core/gimpparamspecs.h" #include "text/gimptext-compat.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/transform_tools_cmds.c b/app/pdb/transform_tools_cmds.c index 8b0d21c9f2..f46417491a 100644 --- a/app/pdb/transform_tools_cmds.c +++ b/app/pdb/transform_tools_cmds.c @@ -20,15 +20,11 @@ #include "config.h" - #include #include "libgimpmath/gimpmath.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "config/gimpcoreconfig.h" #include "core/gimp-transform-utils.h" @@ -36,12 +32,16 @@ #include "core/gimpdrawable-transform.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "core/gimpparamspecs.h" #include "core/gimpprogress.h" -#include "gimp-intl.h" -#include "gimppdb-utils.h" +#include "gimppdb.h" +#include "gimppdb-utils.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * flip_invoker (GimpProcedure *procedure, diff --git a/app/pdb/undo_cmds.c b/app/pdb/undo_cmds.c index 176a75093c..ea698839b5 100644 --- a/app/pdb/undo_cmds.c +++ b/app/pdb/undo_cmds.c @@ -20,21 +20,20 @@ #include "config.h" - #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" #include "core/gimp.h" #include "core/gimpimage-undo.h" #include "core/gimpimage.h" +#include "core/gimpparamspecs.h" #include "plug-in/gimpplugin-cleanup.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimppluginmanager.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/unit_cmds.c b/app/pdb/unit_cmds.c index 48f5fa82f7..4401f425a3 100644 --- a/app/pdb/unit_cmds.c +++ b/app/pdb/unit_cmds.c @@ -20,18 +20,17 @@ #include "config.h" - #include #include "libgimpbase/gimpbase.h" #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" +#include "core/gimpparamspecs.h" #include "core/gimpunit.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" diff --git a/app/pdb/vectors_cmds.c b/app/pdb/vectors_cmds.c index 613cfe9246..b1b816abbd 100644 --- a/app/pdb/vectors_cmds.c +++ b/app/pdb/vectors_cmds.c @@ -25,15 +25,11 @@ #include #include "pdb-types.h" -#include "gimppdb.h" -#include "gimpprocedure.h" -#include "core/gimpparamspecs.h" -#include "core/gimp.h" #include "core/gimpchannel-select.h" #include "core/gimpimage.h" #include "core/gimplist.h" -#include "gimp-intl.h" +#include "core/gimpparamspecs.h" #include "vectors/gimpanchor.h" #include "vectors/gimpbezierstroke.h" #include "vectors/gimpstroke-new.h" @@ -41,8 +37,12 @@ #include "vectors/gimpvectors-import.h" #include "vectors/gimpvectors.h" +#include "gimppdb.h" +#include "gimpprocedure.h" #include "internal_procs.h" +#include "gimp-intl.h" + static GValueArray * vectors_is_valid_invoker (GimpProcedure *procedure, diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index 6a25dcc69c..aed892e79e 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -64,6 +64,7 @@ #include "plug-in-types.h" +#include "base/base-utils.h" #include "base/tile.h" #include "gimppluginshm.h" @@ -180,7 +181,7 @@ gimp_plug_in_shm_new (void) gint shm_fd; /* Our shared memory id will be our process ID */ - pid = getpid (); + pid = get_pid (); /* From the id, derive the file map name */ g_snprintf (shm_handle, sizeof (shm_handle), "/gimp-shm-%d", pid); diff --git a/app/text/gimptext-parasite.c b/app/text/gimptext-parasite.c index bdb9eb4ea6..c805f3c547 100644 --- a/app/text/gimptext-parasite.c +++ b/app/text/gimptext-parasite.c @@ -106,14 +106,14 @@ gimp_text_gdyntext_parasite_name (void) enum { - TEXT = 0, + TEXT = 0, ANTIALIAS = 1, - ALIGNMENT = 2, - ROTATION = 3, - LINE_SPACING = 4, - COLOR = 5, + ALIGNMENT = 2, + ROTATION = 3, + LINE_SPACING = 4, + COLOR = 5, LAYER_ALIGNMENT = 6, - XLFD = 7, + XLFD = 7, NUM_PARAMS }; diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index d9fd894404..04f49a5dc3 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -178,8 +178,8 @@ gimp_curves_tool_init (GimpCurvesTool *tool) tool->lut = gimp_lut_new (); - for (i = 0; i < G_N_ELEMENTS (tool->col_value); i++) - tool->col_value[i] = -1; + for (i = 0; i < G_N_ELEMENTS (tool->picked_color); i++) + tool->picked_color[i] = -1.0; im_tool->apply_func = (GimpImageMapApplyFunc) gimp_lut_process; im_tool->apply_data = tool->lut; @@ -248,19 +248,16 @@ gimp_curves_tool_button_release (GimpTool *tool, if (state & GDK_SHIFT_MASK) { GimpCurve *curve = config->curve[config->channel]; + gdouble value = c_tool->picked_color[config->channel]; gint closest; - closest = - gimp_curve_get_closest_point (curve, - c_tool->col_value[config->channel]); + closest = gimp_curve_get_closest_point (curve, value); gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph), closest); - gimp_curve_set_point (curve, - closest, - c_tool->col_value[config->channel], - curve->curve[c_tool->col_value[config->channel]]); + gimp_curve_set_point (curve, closest, + value, gimp_curve_map (curve, value)); } else if (state & GDK_CONTROL_MASK) { @@ -269,19 +266,16 @@ gimp_curves_tool_button_release (GimpTool *tool, for (i = 0; i < 5; i++) { GimpCurve *curve = config->curve[i]; + gdouble value = c_tool->picked_color[i]; gint closest; - closest = - gimp_curve_get_closest_point (curve, - c_tool->col_value[i]); + closest = gimp_curve_get_closest_point (curve, value); gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph), closest); - gimp_curve_set_point (curve, - closest, - c_tool->col_value[i], - curve->curve[c_tool->col_value[i]]); + gimp_curve_set_point (curve, closest, + value, gimp_curve_map (curve, value)); } } @@ -341,26 +335,21 @@ gimp_curves_tool_color_picked (GimpColorTool *color_tool, { GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool); GimpDrawable *drawable; - guchar r, g, b, a; drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable; - gimp_rgba_get_uchar (color, &r, &g, &b, &a); - - tool->col_value[GIMP_HISTOGRAM_RED] = r; - tool->col_value[GIMP_HISTOGRAM_GREEN] = g; - tool->col_value[GIMP_HISTOGRAM_BLUE] = b; + tool->picked_color[GIMP_HISTOGRAM_RED] = color->r; + tool->picked_color[GIMP_HISTOGRAM_GREEN] = color->g; + tool->picked_color[GIMP_HISTOGRAM_BLUE] = color->b; if (gimp_drawable_has_alpha (drawable)) - tool->col_value[GIMP_HISTOGRAM_ALPHA] = a; + tool->picked_color[GIMP_HISTOGRAM_ALPHA] = color->a; - if (gimp_drawable_is_indexed (drawable)) - tool->col_value[GIMP_HISTOGRAM_ALPHA] = color_index; - - tool->col_value[GIMP_HISTOGRAM_VALUE] = MAX (MAX (r, g), b); + tool->picked_color[GIMP_HISTOGRAM_VALUE] = MAX (MAX (color->r, color->g), + color->b); gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph), - tool->col_value[tool->config->channel]); + tool->picked_color[tool->config->channel]); } static GeglNode * @@ -641,29 +630,35 @@ gimp_curves_tool_config_notify (GObject *object, switch (config->channel) { + guchar r[256]; + guchar g[256]; + guchar b[256]; + case GIMP_HISTOGRAM_VALUE: case GIMP_HISTOGRAM_ALPHA: case GIMP_HISTOGRAM_RGB: + gimp_curve_get_uchar (curve, r); + gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange), - curve->curve, - curve->curve, - curve->curve); + r, r, r); break; case GIMP_HISTOGRAM_RED: case GIMP_HISTOGRAM_GREEN: case GIMP_HISTOGRAM_BLUE: + gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_RED], r); + gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_GREEN], g); + gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_BLUE], b); + gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange), - config->curve[GIMP_HISTOGRAM_RED]->curve, - config->curve[GIMP_HISTOGRAM_GREEN]->curve, - config->curve[GIMP_HISTOGRAM_BLUE]->curve); + r, g, b); break; } gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->graph), config->channel); gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph), - tool->col_value[config->channel]); + tool->picked_color[config->channel]); gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange), config->channel); diff --git a/app/tools/gimpcurvestool.h b/app/tools/gimpcurvestool.h index 37048da936..9374e3206e 100644 --- a/app/tools/gimpcurvestool.h +++ b/app/tools/gimpcurvestool.h @@ -41,7 +41,7 @@ struct _GimpCurvesTool GimpLut *lut; /* dialog */ - gint col_value[5]; + gdouble picked_color[5]; GtkWidget *channel_menu; GtkWidget *xrange; diff --git a/app/tools/gimpgegltool.c b/app/tools/gimpgegltool.c index 71dd220d9b..4e18164c60 100644 --- a/app/tools/gimpgegltool.c +++ b/app/tools/gimpgegltool.c @@ -350,6 +350,17 @@ gimp_param_spec_duplicate (GParamSpec *pspec) spec->default_value, pspec->flags); } + else if (G_IS_PARAM_SPEC_ENUM (pspec)) + { + GParamSpecEnum *spec = G_PARAM_SPEC_ENUM (pspec); + + return g_param_spec_enum (pspec->name, + g_param_spec_get_nick (pspec), + g_param_spec_get_blurb (pspec), + G_TYPE_FROM_CLASS (spec->enum_class), + spec->default_value, + pspec->flags); + } else if (G_IS_PARAM_SPEC_DOUBLE (pspec)) { GParamSpecDouble *spec = G_PARAM_SPEC_DOUBLE (pspec); diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am index 6dba1471c6..f62d0cab90 100644 --- a/app/widgets/Makefile.am +++ b/app/widgets/Makefile.am @@ -1,6 +1,8 @@ ## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ + -DISO_CODES_LOCATION=\"$(ISO_CODES_LOCATION)\" \ + -DISO_CODES_LOCALEDIR=\"$(ISO_CODES_LOCALEDIR)\" \ -DG_LOG_DOMAIN=\"Gimp-Widgets\" INCLUDES = \ @@ -189,6 +191,10 @@ libappwidgets_a_sources = \ gimpimageview.h \ gimpitemtreeview.c \ gimpitemtreeview.h \ + gimplanguagestore.c \ + gimplanguagestore.h \ + gimplanguagestore-parser.c \ + gimplanguagestore-parser.h \ gimplayertreeview.c \ gimplayertreeview.h \ gimpmenudock.c \ diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c index 37e51df67e..c8fdf4f8f3 100644 --- a/app/widgets/gimpcurveview.c +++ b/app/widgets/gimpcurveview.c @@ -68,6 +68,11 @@ static gboolean gimp_curve_view_leave_notify (GtkWidget *widget, static gboolean gimp_curve_view_key_press (GtkWidget *widget, GdkEventKey *kevent); +static void gimp_curve_view_set_cursor (GimpCurveView *view, + gdouble x, + gdouble y); +static void gimp_curve_view_unset_cursor (GimpCurveView *view); + G_DEFINE_TYPE (GimpCurveView, gimp_curve_view, GIMP_TYPE_HISTOGRAM_VIEW) @@ -117,11 +122,12 @@ gimp_curve_view_init (GimpCurveView *view) { view->curve = NULL; view->selected = 0; - view->last = 0; + view->last_x = 0.0; + view->last_y = 0.0; view->cursor_type = -1; - view->xpos = -1; - view->cursor_x = -1; - view->cursor_y = -1; + view->xpos = -1.0; + view->cursor_x = -1.0; + view->cursor_y = -1.0; GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS); @@ -307,21 +313,23 @@ gimp_curve_view_draw_point (GimpCurveView *view, gint height, gint border) { - gint x, y; + gdouble x, y; - x = view->curve->points[i][0]; - if (x < 0) + x = view->curve->points[i].x; + y = 1.0 - view->curve->points[i].y; + + if (x < 0.0) return; - y = 255 - view->curve->points[i][1]; +#define RADIUS 3 cairo_move_to (cr, - border + (gdouble) width * x / 256.0, - border + (gdouble) height * y / 256.0); + border + (gdouble) width * x + RADIUS, + border + (gdouble) height * y); cairo_arc (cr, - border + (gdouble) width * x / 256.0, - border + (gdouble) height * y / 256.0, - 3, + border + (gdouble) width * x, + border + (gdouble) height * y, + RADIUS, 0, 2 * G_PI); } @@ -335,7 +343,7 @@ gimp_curve_view_expose (GtkWidget *widget, gint border; gint width; gint height; - gint x, y; + gdouble x, y; gint i; GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); @@ -345,8 +353,8 @@ gimp_curve_view_expose (GtkWidget *widget, border = GIMP_HISTOGRAM_VIEW (view)->border_width; - width = widget->allocation.width - 2 * border; - height = widget->allocation.height - 2 * border; + width = widget->allocation.width - 2 * border - 1; + height = widget->allocation.height - 2 * border - 1; cr = gdk_cairo_create (widget->window); @@ -361,26 +369,26 @@ gimp_curve_view_expose (GtkWidget *widget, /* Draw the curve */ gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]); - x = 0; - y = 255 - view->curve->curve[x]; + x = 0.0; + y = 1.0 - gimp_curve_map (view->curve, 0.0); cairo_move_to (cr, - border + (gdouble) width * x / 256.0, - border + (gdouble) height * y / 256.0); + border + (gdouble) width * x, + border + (gdouble) height * y); - for (i = 0; i < 256; i++) + for (i = 1; i < 256; i++) { - x = i; - y = 255 - view->curve->curve[x]; + x = (gdouble) i / 255.0; + y = 1.0 - gimp_curve_map (view->curve, x); cairo_line_to (cr, - border + (gdouble) width * x / 256.0, - border + (gdouble) height * y / 256.0); + border + (gdouble) width * x, + border + (gdouble) height * y); } cairo_stroke (cr); - if (view->curve->curve_type == GIMP_CURVE_SMOOTH) + if (gimp_curve_get_curve_type (view->curve) == GIMP_CURVE_SMOOTH) { gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]); @@ -404,44 +412,46 @@ gimp_curve_view_expose (GtkWidget *widget, } } - if (view->xpos >= 0) + if (view->xpos >= 0.0) { + gint layout_x; + gint layout_y; gchar buf[32]; gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]); /* draw the color line */ cairo_move_to (cr, - border + ROUND ((gdouble) width * view->xpos / 256.0), + border + ROUND ((gdouble) width * view->xpos), border); cairo_line_to (cr, - border + ROUND ((gdouble) width * view->xpos / 256.0), + border + ROUND ((gdouble) width * view->xpos), border + height - 1); cairo_stroke (cr); /* and xpos indicator */ - g_snprintf (buf, sizeof (buf), "x:%d", view->xpos); + g_snprintf (buf, sizeof (buf), "x:%d", (gint) (view->xpos * 255.999)); if (! view->xpos_layout) view->xpos_layout = gtk_widget_create_pango_layout (widget, NULL); pango_layout_set_text (view->xpos_layout, buf, -1); - pango_layout_get_pixel_size (view->xpos_layout, &x, &y); + pango_layout_get_pixel_size (view->xpos_layout, &layout_x, &layout_y); - if (view->xpos < 127) - x = border; + if (view->xpos < 0.5) + layout_x = border; else - x = -(x + border); + layout_x = -(layout_x + border); cairo_move_to (cr, - border + (gdouble) width * view->xpos / 256.0 + x, - border + height - border - y); + border + (gdouble) width * view->xpos + layout_x, + border + height - border - layout_y); pango_cairo_show_layout (cr, view->xpos_layout); cairo_fill (cr); } - if (view->cursor_x >= 0 && view->cursor_x <= 255 && - view->cursor_y >= 0 && view->cursor_y <= 255) + if (view->cursor_x >= 0.0 && view->cursor_x <= 1.0 && + view->cursor_y >= 0.0 && view->cursor_y <= 1.0) { gchar buf[32]; gint w, h; @@ -470,7 +480,8 @@ gimp_curve_view_expose (GtkWidget *widget, cairo_stroke (cr); g_snprintf (buf, sizeof (buf), "x:%3d y:%3d", - view->cursor_x, 255 - view->cursor_y); + (gint) (view->cursor_x * 255.999), + (gint) ((1.0 - view->cursor_y) * 255.999)); pango_layout_set_text (view->cursor_layout, buf, -1); gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]); @@ -512,7 +523,8 @@ gimp_curve_view_button_press (GtkWidget *widget, GimpCurve *curve = view->curve; gint border; gint width, height; - gint x, y; + gdouble x; + gdouble y; gint closest_point; gint i; @@ -523,11 +535,11 @@ gimp_curve_view_button_press (GtkWidget *widget, width = widget->allocation.width - 2 * border; height = widget->allocation.height - 2 * border; - x = ROUND (((gdouble) (bevent->x - border) / (gdouble) width) * 255.0); - y = ROUND (((gdouble) (bevent->y - border) / (gdouble) height) * 255.0); + x = (gdouble) (bevent->x - border) / (gdouble) width; + y = (gdouble) (bevent->y - border) / (gdouble) height; - x = CLAMP0255 (x); - y = CLAMP0255 (y); + x = CLAMP (x, 0.0, 1.0); + y = CLAMP (y, 0.0, 1.0); closest_point = gimp_curve_get_closest_point (curve, x); @@ -535,36 +547,36 @@ gimp_curve_view_button_press (GtkWidget *widget, set_cursor (view, GDK_TCROSS); - switch (curve->curve_type) + switch (gimp_curve_get_curve_type (curve)) { case GIMP_CURVE_SMOOTH: /* determine the leftmost and rightmost points */ - view->leftmost = -1; + view->leftmost = -1.0; for (i = closest_point - 1; i >= 0; i--) - if (curve->points[i][0] != -1) + if (curve->points[i].x >= 0.0) { - view->leftmost = curve->points[i][0]; + view->leftmost = curve->points[i].x; break; } - view->rightmost = 256; + view->rightmost = 2.0; for (i = closest_point + 1; i < GIMP_CURVE_NUM_POINTS; i++) - if (curve->points[i][0] != -1) + if (curve->points[i].x >= 0.0) { - view->rightmost = curve->points[i][0]; + view->rightmost = curve->points[i].x; break; } gimp_curve_view_set_selected (view, closest_point); - gimp_curve_set_point (curve, view->selected, x, 255 - y); + gimp_curve_set_point (curve, view->selected, x, 1.0 - y); break; case GIMP_CURVE_FREE: - gimp_curve_view_set_selected (view, x); - view->last = y; + view->last_x = x; + view->last_y = y; - gimp_curve_set_curve (curve, x, 255 - y); + gimp_curve_set_curve (curve, x, 1.0 - y); break; } @@ -599,9 +611,9 @@ gimp_curve_view_motion_notify (GtkWidget *widget, GimpCursorType new_cursor = GDK_X_CURSOR; gint border; gint width, height; - gint x, y; + gdouble x; + gdouble y; gint closest_point; - gint i; if (! curve) return TRUE; @@ -610,20 +622,20 @@ gimp_curve_view_motion_notify (GtkWidget *widget, width = widget->allocation.width - 2 * border; height = widget->allocation.height - 2 * border; - x = ROUND (((gdouble) (mevent->x - border) / (gdouble) width) * 255.0); - y = ROUND (((gdouble) (mevent->y - border) / (gdouble) height) * 255.0); + x = (gdouble) (mevent->x - border) / (gdouble) width; + y = (gdouble) (mevent->y - border) / (gdouble) height; - x = CLAMP0255 (x); - y = CLAMP0255 (y); + x = CLAMP (x, 0.0, 1.0); + y = CLAMP (y, 0.0, 1.0); closest_point = gimp_curve_get_closest_point (curve, x); - switch (curve->curve_type) + switch (gimp_curve_get_curve_type (curve)) { case GIMP_CURVE_SMOOTH: if (! view->grabbed) /* If no point is grabbed... */ { - if (curve->points[closest_point][0] != -1) + if (curve->points[closest_point].x >= 0.0) new_cursor = GDK_FLEUR; else new_cursor = GDK_TCROSS; @@ -634,15 +646,15 @@ gimp_curve_view_motion_notify (GtkWidget *widget, gimp_data_freeze (GIMP_DATA (curve)); - gimp_curve_set_point (curve, view->selected, -1, -1); + gimp_curve_set_point (curve, view->selected, -1.0, -1.0); if (x > view->leftmost && x < view->rightmost) { - closest_point = (x + 8) / 16; - if (curve->points[closest_point][0] == -1) + closest_point = ((gint) (x * 255.999) + 8) / 16; + if (curve->points[closest_point].x < 0.0) gimp_curve_view_set_selected (view, closest_point); - gimp_curve_set_point (curve, view->selected, x, 255 - y); + gimp_curve_set_point (curve, view->selected, x, 1.0 - y); } gimp_data_thaw (GIMP_DATA (curve)); @@ -652,40 +664,44 @@ gimp_curve_view_motion_notify (GtkWidget *widget, case GIMP_CURVE_FREE: if (view->grabbed) { - gint x1, x2, y1, y2; + gdouble x1, x2; + gdouble y1, y2; - if (view->selected > x) + if (view->last_x > x) { x1 = x; - x2 = view->selected; + x2 = view->last_x; y1 = y; - y2 = view->last; + y2 = view->last_y; } else { - x1 = view->selected; + x1 = view->last_x; x2 = x; - y1 = view->last; + y1 = view->last_y; y2 = y; } if (x2 != x1) { + gint i; + gimp_data_freeze (GIMP_DATA (curve)); - for (i = x1; i <= x2; i++) - gimp_curve_set_curve (curve, i, - 255 - (y1 + ((y2 - y1) * (i - x1)) / (x2 - x1))); + for (i = (gint) (x1 * 255.999); i <= (gint) (x2 * 255.999); i++) + gimp_curve_set_curve (curve, + (gdouble) i / 255.0, + 1.0 - (y1 + ((y2 - y1) * ((gdouble) i / 255.0 - x1)) / (x2 - x1))); gimp_data_thaw (GIMP_DATA (curve)); } else { - gimp_curve_set_curve (curve, x, 255 - y); + gimp_curve_set_curve (curve, x, 1.0 - y); } - gimp_curve_view_set_selected (view, x); - view->last = y; + view->last_x = x; + view->last_y = y; } if (mevent->state & GDK_BUTTON1_MASK) @@ -709,7 +725,7 @@ gimp_curve_view_leave_notify (GtkWidget *widget, { GimpCurveView *view = GIMP_CURVE_VIEW (widget); - gimp_curve_view_set_cursor (view, -1, -1); + gimp_curve_view_unset_cursor (view); return TRUE; } @@ -721,10 +737,11 @@ gimp_curve_view_key_press (GtkWidget *widget, GimpCurveView *view = GIMP_CURVE_VIEW (widget); GimpCurve *curve = view->curve; gint i = view->selected; - gint y = curve->points[i][1]; + gdouble y = curve->points[i].y; gboolean retval = FALSE; - if (view->grabbed || ! curve || curve->curve_type == GIMP_CURVE_FREE) + if (view->grabbed || ! curve || + gimp_curve_get_curve_type (curve) == GIMP_CURVE_FREE) return FALSE; switch (kevent->keyval) @@ -732,7 +749,7 @@ gimp_curve_view_key_press (GtkWidget *widget, case GDK_Left: for (i = i - 1; i >= 0 && ! retval; i--) { - if (curve->points[i][0] != -1) + if (curve->points[i].x >= 0.0) { gimp_curve_view_set_selected (view, i); @@ -744,7 +761,7 @@ gimp_curve_view_key_press (GtkWidget *widget, case GDK_Right: for (i = i + 1; i < GIMP_CURVE_NUM_POINTS && ! retval; i++) { - if (curve->points[i][0] != -1) + if (curve->points[i].x >= 0.0) { gimp_curve_view_set_selected (view, i); @@ -754,11 +771,12 @@ gimp_curve_view_key_press (GtkWidget *widget, break; case GDK_Up: - if (y < 255) + if (y < 1.0) { - y = y + (kevent->state & GDK_SHIFT_MASK ? 16 : 1); + y = y + (kevent->state & GDK_SHIFT_MASK ? + (16.0 / 255.0) : (1.0 / 255.0)); - gimp_curve_move_point (curve, i, CLAMP0255 (y)); + gimp_curve_move_point (curve, i, CLAMP (y, 0.0, 1.0)); retval = TRUE; } @@ -767,9 +785,10 @@ gimp_curve_view_key_press (GtkWidget *widget, case GDK_Down: if (y > 0) { - y = y - (kevent->state & GDK_SHIFT_MASK ? 16 : 1); + y = y - (kevent->state & GDK_SHIFT_MASK ? + (16.0 / 255.0) : (1.0 / 255.0)); - gimp_curve_move_point (curve, i, CLAMP0255 (y)); + gimp_curve_move_point (curve, i, CLAMP (y, 0.0, 1.0)); retval = TRUE; } @@ -848,7 +867,7 @@ gimp_curve_view_set_selected (GimpCurveView *view, void gimp_curve_view_set_xpos (GimpCurveView *view, - gint x) + gdouble x) { g_return_if_fail (GIMP_IS_CURVE_VIEW (view)); @@ -857,15 +876,25 @@ gimp_curve_view_set_xpos (GimpCurveView *view, gtk_widget_queue_draw (GTK_WIDGET (view)); } -void -gimp_curve_view_set_cursor (GimpCurveView *view, - gint x, - gint y) -{ - g_return_if_fail (GIMP_IS_CURVE_VIEW (view)); +/* private functions */ + +static void +gimp_curve_view_set_cursor (GimpCurveView *view, + gdouble x, + gdouble y) +{ view->cursor_x = x; view->cursor_y = y; gtk_widget_queue_draw (GTK_WIDGET (view)); } + +static void +gimp_curve_view_unset_cursor (GimpCurveView *view) +{ + view->cursor_x = -1.0; + view->cursor_y = -1.0; + + gtk_widget_queue_draw (GTK_WIDGET (view)); +} diff --git a/app/widgets/gimpcurveview.h b/app/widgets/gimpcurveview.h index 4225ea45df..d68f6d39d4 100644 --- a/app/widgets/gimpcurveview.h +++ b/app/widgets/gimpcurveview.h @@ -44,18 +44,19 @@ struct _GimpCurveView gint grid_columns; gint selected; - gint last; - gint leftmost; - gint rightmost; + gdouble last_x; + gdouble last_y; + gdouble leftmost; + gdouble rightmost; gboolean grabbed; GdkCursorType cursor_type; - gint xpos; + gdouble xpos; PangoLayout *xpos_layout; - gint cursor_x; - gint cursor_y; + gdouble cursor_x; + gdouble cursor_y; PangoLayout *cursor_layout; PangoRectangle cursor_rect; }; @@ -77,10 +78,7 @@ GimpCurve * gimp_curve_view_get_curve (GimpCurveView *view); void gimp_curve_view_set_selected (GimpCurveView *view, gint selected); void gimp_curve_view_set_xpos (GimpCurveView *view, - gint x); -void gimp_curve_view_set_cursor (GimpCurveView *view, - gint x, - gint y); + gdouble x); #endif /* __GIMP_CURVE_VIEW_H__ */ diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c index 6f333de202..07ef2f11bb 100644 --- a/app/widgets/gimphistogrameditor.c +++ b/app/widgets/gimphistogrameditor.c @@ -25,7 +25,6 @@ #include "widgets-types.h" #include "base/gimphistogram.h" -#include "base/pixel-region.h" #include "core/gimp.h" #include "core/gimpdrawable.h" diff --git a/app/widgets/gimplanguagestore-parser.c b/app/widgets/gimplanguagestore-parser.c new file mode 100644 index 0000000000..685463c27e --- /dev/null +++ b/app/widgets/gimplanguagestore-parser.c @@ -0,0 +1,241 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimplanguagestore-parser.c + * Copyright (C) 2008 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include + +#include "widgets-types.h" + +#include "config/gimpxmlparser.h" + +#include "gimplanguagestore.h" +#include "gimplanguagestore-parser.h" + +#include "gimp-intl.h" + + +typedef enum +{ + ISO_CODES_START, + ISO_CODES_IN_ENTRIES, + ISO_CODES_IN_ENTRY, + ISO_CODES_IN_UNKNOWN +} IsoCodesParserState; + +typedef struct +{ + IsoCodesParserState state; + IsoCodesParserState last_known_state; + gint unknown_depth; + GimpLanguageStore *store; +} IsoCodesParser; + + +static void iso_codes_parser_start_element (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer user_data, + GError **error); +static void iso_codes_parser_end_element (GMarkupParseContext *context, + const gchar *element_name, + gpointer user_data, + GError **error); + +static void iso_codes_parser_start_unknown (IsoCodesParser *parser); +static void iso_codes_parser_end_unknown (IsoCodesParser *parser); + + +static const GMarkupParser markup_parser = +{ + iso_codes_parser_start_element, + iso_codes_parser_end_element, + NULL, /* characters */ + NULL, /* passthrough */ + NULL /* error */ +}; + + +gboolean +gimp_language_store_populate (GimpLanguageStore *store, + GError **error) +{ +#ifdef HAVE_ISO_CODES + GimpXmlParser *xml_parser; + gchar *filename; + gboolean success; + IsoCodesParser parser = { 0, }; + + g_return_val_if_fail (GIMP_IS_LANGUAGE_STORE (store), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + bindtextdomain ("iso_639", ISO_CODES_LOCALEDIR); + + parser.store = g_object_ref (store); + + xml_parser = gimp_xml_parser_new (&markup_parser, &parser); + + filename = g_build_filename (ISO_CODES_LOCATION, "iso_639.xml", NULL); + + success = gimp_xml_parser_parse_file (xml_parser, filename, error); + + g_free (filename); + + gimp_xml_parser_free (xml_parser); + g_object_unref (parser.store); + + return success; +#endif + + return TRUE; +} + +static void +iso_codes_parser_entry (IsoCodesParser *parser, + const gchar **names, + const gchar **values) +{ + const gchar *lang = NULL; + const gchar *code = NULL; + + while (*names && *values) + { + if (strcmp (*names, "name") == 0) + { + lang = *values; + } + else if (strcmp (*names, "iso_639_1_code") == 0) + { + code = *values; + } + + names++; + values++; + } + + if (lang && *lang && code && *code) + { + const gchar *semicolon; + + lang = dgettext ("iso_639", lang); + + /* there might be several language names; use the first one */ + semicolon = strchr (lang, ';'); + + if (semicolon) + { + gchar *first = g_strndup (lang, semicolon - lang); + + gimp_language_store_add (parser->store, first, code); + g_free (first); + } + else + { + gimp_language_store_add (parser->store, lang, code); + } + } +} + +static void +iso_codes_parser_start_element (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer user_data, + GError **error) +{ + IsoCodesParser *parser = user_data; + + switch (parser->state) + { + case ISO_CODES_START: + if (strcmp (element_name, "iso_639_entries") == 0) + { + parser->state = ISO_CODES_IN_ENTRIES; + break; + } + + case ISO_CODES_IN_ENTRIES: + if (strcmp (element_name, "iso_639_entry") == 0) + { + parser->state = ISO_CODES_IN_ENTRY; + iso_codes_parser_entry (parser, attribute_names, attribute_values); + break; + } + + case ISO_CODES_IN_ENTRY: + case ISO_CODES_IN_UNKNOWN: + iso_codes_parser_start_unknown (parser); + break; + } +} + +static void +iso_codes_parser_end_element (GMarkupParseContext *context, + const gchar *element_name, + gpointer user_data, + GError **error) +{ + IsoCodesParser *parser = user_data; + + switch (parser->state) + { + case ISO_CODES_START: + g_warning ("%s: shouldn't get here", G_STRLOC); + break; + + case ISO_CODES_IN_ENTRIES: + parser->state = ISO_CODES_START; + break; + + case ISO_CODES_IN_ENTRY: + parser->state = ISO_CODES_IN_ENTRIES; + break; + + case ISO_CODES_IN_UNKNOWN: + iso_codes_parser_end_unknown (parser); + break; + } +} + +static void +iso_codes_parser_start_unknown (IsoCodesParser *parser) +{ + if (parser->unknown_depth == 0) + parser->last_known_state = parser->state; + + parser->state = ISO_CODES_IN_UNKNOWN; + parser->unknown_depth++; +} + +static void +iso_codes_parser_end_unknown (IsoCodesParser *parser) +{ + g_assert (parser->unknown_depth > 0 && parser->state == ISO_CODES_IN_UNKNOWN); + + parser->unknown_depth--; + + if (parser->unknown_depth == 0) + parser->state = parser->last_known_state; +} diff --git a/app/widgets/gimplanguagestore-parser.h b/app/widgets/gimplanguagestore-parser.h new file mode 100644 index 0000000000..82ea38d80b --- /dev/null +++ b/app/widgets/gimplanguagestore-parser.h @@ -0,0 +1,30 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimplanguagestore-parser.h + * Copyright (C) 2008 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GIMP_LANGUAGE_STORE_PARSER_H__ +#define __GIMP_LANGUAGE_STORE_PARSER_H__ + + +gboolean gimp_language_store_populate (GimpLanguageStore *store, + GError **error); + + +#endif /* __GIMP_LANGUAGE_STORE_PARSER_H__ */ diff --git a/app/widgets/gimplanguagestore.c b/app/widgets/gimplanguagestore.c new file mode 100644 index 0000000000..4911492a09 --- /dev/null +++ b/app/widgets/gimplanguagestore.c @@ -0,0 +1,140 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimplanguagestore.c + * Copyright (C) 2008 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "widgets-types.h" + +#include "gimplanguagestore.h" +#include "gimplanguagestore-parser.h" + + +enum +{ + PROP_0, + PROP_TRANSLATIONS +}; + + +static void gimp_language_store_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_language_store_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + +G_DEFINE_TYPE (GimpLanguageStore, gimp_language_store, GTK_TYPE_LIST_STORE) + +static void +gimp_language_store_class_init (GimpLanguageStoreClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->set_property = gimp_language_store_set_property; + object_class->get_property = gimp_language_store_get_property; + + g_object_class_install_property (object_class, PROP_TRANSLATIONS, + g_param_spec_boolean ("translations", + NULL, NULL, + FALSE, + GIMP_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); +} + +static void +gimp_language_store_init (GimpLanguageStore *store) +{ + GType column_types[2] = { G_TYPE_STRING, G_TYPE_STRING }; + + gtk_list_store_set_column_types (GTK_LIST_STORE (store), + G_N_ELEMENTS (column_types), column_types); + + gimp_language_store_populate (store, NULL); +} + +static void +gimp_language_store_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GimpLanguageStore *store = GIMP_LANGUAGE_STORE (object); + + switch (property_id) + { + case PROP_TRANSLATIONS: + store->translations = g_value_get_boolean (value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gimp_language_store_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GimpLanguageStore *store = GIMP_LANGUAGE_STORE (object); + + switch (property_id) + { + case PROP_TRANSLATIONS: + g_value_set_boolean (value, store->translations); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +GtkListStore * +gimp_language_store_new (gboolean translations) +{ + return g_object_new (GIMP_TYPE_LANGUAGE_STORE, + "translations", translations, + NULL); +} + +void +gimp_language_store_add (GimpLanguageStore *store, + const gchar *lang, + const gchar *code) +{ + GtkTreeIter iter; + + g_return_if_fail (GIMP_IS_LANGUAGE_STORE (store)); + g_return_if_fail (lang != NULL && code != NULL); + + gtk_list_store_append (GTK_LIST_STORE (store), &iter); + gtk_list_store_set (GTK_LIST_STORE (store), &iter, + GIMP_LANGUAGE_STORE_LANGUAGE, lang, + GIMP_LANGUAGE_STORE_ISO_639_1, code, + -1); +} diff --git a/app/widgets/gimplanguagestore.h b/app/widgets/gimplanguagestore.h new file mode 100644 index 0000000000..09fb2c3096 --- /dev/null +++ b/app/widgets/gimplanguagestore.h @@ -0,0 +1,64 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimplanguagestore.h + * Copyright (C) 2008 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GIMP_LANGUAGE_STORE_H__ +#define __GIMP_LANGUAGE_STORE_H__ + + +enum +{ + GIMP_LANGUAGE_STORE_LANGUAGE, + GIMP_LANGUAGE_STORE_ISO_639_1 +}; + + +#define GIMP_TYPE_LANGUAGE_STORE (gimp_language_store_get_type ()) +#define GIMP_LANGUAGE_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LANGUAGE_STORE, GimpLanguageStore)) +#define GIMP_LANGUAGE_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LANGUAGE_STORE, GimpLanguageStoreClass)) +#define GIMP_IS_LANGUAGE_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LANGUAGE_STORE)) +#define GIMP_IS_LANGUAGE_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LANGUAGE_STORE)) +#define GIMP_LANGUAGE_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LANGUAGE_STORE, GimpLanguageStoreClass)) + + +typedef struct _GimpLanguageStoreClass GimpLanguageStoreClass; + +struct _GimpLanguageStoreClass +{ + GtkListStoreClass parent_class; +}; + +struct _GimpLanguageStore +{ + GtkListStore parent_instance; + + gboolean translations; +}; + + +GType gimp_language_store_get_type (void) G_GNUC_CONST; + +GtkListStore * gimp_language_store_new (gboolean translations); +void gimp_language_store_add (GimpLanguageStore *store, + const gchar *lang, + const gchar *code); + + +#endif /* __GIMP_LANGUAGE_STORE_H__ */ diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c index c712ef2176..dfa2a64f24 100644 --- a/app/widgets/gimppropwidgets.c +++ b/app/widgets/gimppropwidgets.c @@ -792,6 +792,11 @@ gimp_prop_table_new (GObject *config, widget = gimp_prop_check_button_new (config, pspec->name, g_param_spec_get_nick (pspec)); } + else if (G_IS_PARAM_SPEC_ENUM (pspec)) + { + widget = gimp_prop_enum_combo_box_new (config, pspec->name, 0, 0); + label = g_param_spec_get_nick (pspec); + } else if (G_IS_PARAM_SPEC_INT (pspec) || G_IS_PARAM_SPEC_UINT (pspec) || G_IS_PARAM_SPEC_FLOAT (pspec) || diff --git a/app/widgets/gimpselectiondata.c b/app/widgets/gimpselectiondata.c index 4a3c3c45e2..ada014ff71 100644 --- a/app/widgets/gimpselectiondata.c +++ b/app/widgets/gimpselectiondata.c @@ -18,24 +18,16 @@ #include "config.h" -#include -#include #include -#include -#ifdef HAVE_UNISTD_H -#include -#endif #include -#ifdef G_OS_WIN32 -#include /* getpid() : defined from _getpid by GLib */ -#endif - #include "libgimpcolor/gimpcolor.h" #include "widgets-types.h" +#include "base/base-utils.h" + #include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontainer.h" @@ -365,7 +357,7 @@ gimp_selection_data_set_image (GtkSelectionData *selection, g_return_if_fail (selection != NULL); g_return_if_fail (GIMP_IS_IMAGE (image)); - str = g_strdup_printf ("%d:%d", getpid (), gimp_image_get_ID (image)); + str = g_strdup_printf ("%d:%d", get_pid (), gimp_image_get_ID (image)); gtk_selection_data_set (selection, selection->target, 8, (guchar *) str, strlen (str) + 1); @@ -390,7 +382,7 @@ gimp_selection_data_get_image (GtkSelectionData *selection, return NULL; if (sscanf (str, "%i:%i", &pid, &ID) == 2 && - pid == getpid ()) + pid == get_pid ()) { image = gimp_image_get_by_ID (gimp, ID); } @@ -410,7 +402,7 @@ gimp_selection_data_set_component (GtkSelectionData *selection, g_return_if_fail (selection != NULL); g_return_if_fail (GIMP_IS_IMAGE (image)); - str = g_strdup_printf ("%d:%d:%d", getpid (), gimp_image_get_ID (image), + str = g_strdup_printf ("%d:%d:%d", get_pid (), gimp_image_get_ID (image), (gint) channel); gtk_selection_data_set (selection, selection->target, @@ -441,7 +433,7 @@ gimp_selection_data_get_component (GtkSelectionData *selection, return NULL; if (sscanf (str, "%i:%i:%i", &pid, &ID, &ch) == 3 && - pid == getpid ()) + pid == get_pid ()) { image = gimp_image_get_by_ID (gimp, ID); @@ -463,7 +455,7 @@ gimp_selection_data_set_item (GtkSelectionData *selection, g_return_if_fail (selection != NULL); g_return_if_fail (GIMP_IS_ITEM (item)); - str = g_strdup_printf ("%d:%d", getpid (), gimp_item_get_ID (item)); + str = g_strdup_printf ("%d:%d", get_pid (), gimp_item_get_ID (item)); gtk_selection_data_set (selection, selection->target, 8, (guchar *) str, strlen (str) + 1); @@ -488,7 +480,7 @@ gimp_selection_data_get_item (GtkSelectionData *selection, return NULL; if (sscanf (str, "%i:%i", &pid, &ID) == 2 && - pid == getpid ()) + pid == get_pid ()) { item = gimp_item_get_by_ID (gimp, ID); } @@ -513,7 +505,7 @@ gimp_selection_data_set_object (GtkSelectionData *selection, { gchar *str; - str = g_strdup_printf ("%d:%p:%s", getpid (), object, name); + str = g_strdup_printf ("%d:%p:%s", get_pid (), object, name); gtk_selection_data_set (selection, selection->target, 8, (guchar *) str, strlen (str) + 1); g_free (str); @@ -680,7 +672,7 @@ gimp_selection_data_get_object (GtkSelectionData *selection, return NULL; if (sscanf (str, "%i:%p:%n", &pid, &object_addr, &name_offset) >= 2 && - pid == getpid () && name_offset > 0) + pid == get_pid () && name_offset > 0) { gchar *name = str + name_offset; diff --git a/app/widgets/gimptexteditor.c b/app/widgets/gimptexteditor.c index 190cba97f9..23e3e11b7a 100644 --- a/app/widgets/gimptexteditor.c +++ b/app/widgets/gimptexteditor.c @@ -2,7 +2,7 @@ * Copyright (C) 1995 Spencer Kimball and Peter Mattis * * GimpTextEditor - * Copyright (C) 2002-2003 Sven Neumann + * Copyright (C) 2002-2003, 2008 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 @@ -31,6 +31,7 @@ #include "gimphelp-ids.h" #include "gimpmenufactory.h" +#include "gimplanguagestore.h" #include "gimptexteditor.h" #include "gimpuimanager.h" @@ -45,12 +46,14 @@ enum }; -static void gimp_text_editor_finalize (GObject *object); +static void gimp_text_editor_finalize (GObject *object); -static void gimp_text_editor_text_changed (GtkTextBuffer *buffer, - GimpTextEditor *editor); -static void gimp_text_editor_font_toggled (GtkToggleButton *button, - GimpTextEditor *editor); +static GtkWidget * gimp_text_editor_language_entry_new (void); + +static void gimp_text_editor_text_changed (GtkTextBuffer *buffer, + GimpTextEditor *editor); +static void gimp_text_editor_font_toggled (GtkToggleButton *button, + GimpTextEditor *editor); G_DEFINE_TYPE (GimpTextEditor, gimp_text_editor, GIMP_TYPE_DIALOG) @@ -163,9 +166,33 @@ gimp_text_editor_new (const gchar *title, if (toolbar) { + GtkToolItem *item; + GtkWidget *hbox; + GtkWidget *label; + GtkWidget *entry; + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (editor)->vbox), toolbar, FALSE, FALSE, 0); gtk_widget_show (toolbar); + + item = gtk_tool_item_new (); + gtk_tool_item_set_expand (item, TRUE); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); + gtk_widget_show (GTK_WIDGET (item)); + + hbox = gtk_hbox_new (FALSE, 6); + gtk_container_add (GTK_CONTAINER (item), hbox); + gtk_widget_show (hbox); + + label = gtk_label_new_with_mnemonic (_("_Language:")); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_widget_show (label); + + entry = gimp_text_editor_language_entry_new (); + gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); + gtk_widget_show (entry); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); } scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -197,7 +224,7 @@ gimp_text_editor_new (const gchar *title, break; } - gtk_widget_set_size_request (editor->view, 128, 64); + gtk_widget_set_size_request (editor->view, 150, 64); editor->font_toggle = gtk_check_button_new_with_mnemonic (_("_Use selected font")); @@ -323,6 +350,30 @@ gimp_text_editor_get_font_name (GimpTextEditor *editor) /* private functions */ +static GtkWidget * +gimp_text_editor_language_entry_new (void) +{ + GtkWidget *entry; + GtkListStore *store; + GtkEntryCompletion *completion; + + entry = gtk_entry_new (); + + completion = gtk_entry_completion_new (); + gtk_entry_completion_set_text_column (completion, + GIMP_LANGUAGE_STORE_LANGUAGE); + gtk_entry_completion_set_inline_completion (completion, TRUE); + + store = gimp_language_store_new (FALSE); + gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (store)); + g_object_unref (store); + + gtk_entry_set_completion (GTK_ENTRY (entry), completion); + g_object_unref (completion); + + return entry; +} + static void gimp_text_editor_text_changed (GtkTextBuffer *buffer, GimpTextEditor *editor) diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h index aeae65052c..d26f58f676 100644 --- a/app/widgets/widgets-types.h +++ b/app/widgets/widgets-types.h @@ -209,6 +209,7 @@ typedef struct _GimpCellRendererViewable GimpCellRendererViewable; /* misc utilities & constructors */ typedef struct _GimpDialogFactory GimpDialogFactory; +typedef struct _GimpLanguageStore GimpLanguageStore; typedef struct _GimpUnitStore GimpUnitStore; typedef struct _GimpUnitComboBox GimpUnitComboBox; diff --git a/configure.in b/configure.in index b79638cb1e..eb1181eda2 100644 --- a/configure.in +++ b/configure.in @@ -155,6 +155,10 @@ AM_MAINTAINER_MODE ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" +# Check for pkg-config +PKG_PROG_PKG_CONFIG(0.16) + + ########################### # Check target architecture ########################### @@ -401,6 +405,21 @@ AC_PROG_INTLTOOL AM_GLIB_GNU_GETTEXT +AC_MSG_CHECKING([for iso-codes]) +PKG_CHECK_EXISTS(iso-codes, + have_iso_codes="yes" + AC_DEFINE(HAVE_ISO_CODES, 1, + [Define to 1 if the iso-codes package is available]) + ISO_CODES_PREFIX=`$PKG_CONFIG --variable=prefix iso-codes` + ISO_CODES_LOCATION="$ISO_CODES_PREFIX/share/xml/iso-codes" + ISO_CODES_LOCALEDIR="$ISO_CODES_PREFIX/$DATADIRNAME/locale", + have_iso_codes="no (iso-codes package not found)") +AC_MSG_RESULT($have_iso_codes) + +AC_SUBST(ISO_CODES_LOCATION) +AC_SUBST(ISO_CODES_LOCALEDIR) + + ############################### # Checks for required libraries ############################### @@ -2063,6 +2082,7 @@ Extra Binaries: Optional Features: D-Bus service: $have_dbus_glib + Language selection: $have_iso_codes Optional Plug-Ins: Ascii Art: $have_libaa diff --git a/libgimp/gimpbrush_pdb.c b/libgimp/gimpbrush_pdb.c index 74c2f2a128..6e365ea402 100644 --- a/libgimp/gimpbrush_pdb.c +++ b/libgimp/gimpbrush_pdb.c @@ -461,172 +461,6 @@ gimp_brush_get_shape (const gchar *name) return shape; } -/** - * gimp_brush_get_radius: - * @name: The brush name. - * - * Get the radius of a generated brush. - * - * This procedure gets the radius value for a generated brush. If - * called for any other type of brush, it does not succeed. - * - * Returns: The radius of the brush in pixels. - * - * Since: GIMP 2.4 - */ -gdouble -gimp_brush_get_radius (const gchar *name) -{ - GimpParam *return_vals; - gint nreturn_vals; - gdouble radius = 0.0; - - return_vals = gimp_run_procedure ("gimp-brush-get-radius", - &nreturn_vals, - GIMP_PDB_STRING, name, - GIMP_PDB_END); - - if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - radius = return_vals[1].data.d_float; - - gimp_destroy_params (return_vals, nreturn_vals); - - return radius; -} - -/** - * gimp_brush_get_spikes: - * @name: The brush name. - * - * Get the number of spikes for a generated brush. - * - * This procedure gets the number of spikes for a generated brush. If - * called for any other type of brush, it does not succeed. - * - * Returns: The number of spikes on the brush. - * - * Since: GIMP 2.4 - */ -gint -gimp_brush_get_spikes (const gchar *name) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint spikes = 0; - - return_vals = gimp_run_procedure ("gimp-brush-get-spikes", - &nreturn_vals, - GIMP_PDB_STRING, name, - GIMP_PDB_END); - - if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - spikes = return_vals[1].data.d_int32; - - gimp_destroy_params (return_vals, nreturn_vals); - - return spikes; -} - -/** - * gimp_brush_get_hardness: - * @name: The brush name. - * - * Get the hardness of a generated brush. - * - * This procedure gets the hardness of a generated brush. The hardness - * of a brush is the amount its intensity fades at the outside edge. If - * called for any other type of brush, the function does not succeed. - * - * Returns: The hardness of the brush. - * - * Since: GIMP 2.4 - */ -gdouble -gimp_brush_get_hardness (const gchar *name) -{ - GimpParam *return_vals; - gint nreturn_vals; - gdouble hardness = 0.0; - - return_vals = gimp_run_procedure ("gimp-brush-get-hardness", - &nreturn_vals, - GIMP_PDB_STRING, name, - GIMP_PDB_END); - - if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - hardness = return_vals[1].data.d_float; - - gimp_destroy_params (return_vals, nreturn_vals); - - return hardness; -} - -/** - * gimp_brush_get_aspect_ratio: - * @name: The brush name. - * - * Get the aspect ratio of a generated brush. - * - * This procedure gets the aspect ratio of a generated brush. If called - * for any other type of brush, it does not succeed. - * - * Returns: The aspect ratio of the brush. - * - * Since: GIMP 2.4 - */ -gdouble -gimp_brush_get_aspect_ratio (const gchar *name) -{ - GimpParam *return_vals; - gint nreturn_vals; - gdouble aspect_ratio = 0.0; - - return_vals = gimp_run_procedure ("gimp-brush-get-aspect-ratio", - &nreturn_vals, - GIMP_PDB_STRING, name, - GIMP_PDB_END); - - if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - aspect_ratio = return_vals[1].data.d_float; - - gimp_destroy_params (return_vals, nreturn_vals); - - return aspect_ratio; -} - -/** - * gimp_brush_get_angle: - * @name: The brush name. - * - * Get the rotation angle of a generated brush. - * - * This procedure gets the angle of rotation for a generated brush. If - * called for any other type of brush, it does not succeed. - * - * Returns: The rotation angle of the brush. - * - * Since: GIMP 2.4 - */ -gdouble -gimp_brush_get_angle (const gchar *name) -{ - GimpParam *return_vals; - gint nreturn_vals; - gdouble angle = 0.0; - - return_vals = gimp_run_procedure ("gimp-brush-get-angle", - &nreturn_vals, - GIMP_PDB_STRING, name, - GIMP_PDB_END); - - if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - angle = return_vals[1].data.d_float; - - gimp_destroy_params (return_vals, nreturn_vals); - - return angle; -} - /** * gimp_brush_set_shape: * @name: The brush name. @@ -667,6 +501,39 @@ gimp_brush_set_shape (const gchar *name, return shape_out; } +/** + * gimp_brush_get_radius: + * @name: The brush name. + * + * Get the radius of a generated brush. + * + * This procedure gets the radius value for a generated brush. If + * called for any other type of brush, it does not succeed. + * + * Returns: The radius of the brush in pixels. + * + * Since: GIMP 2.4 + */ +gdouble +gimp_brush_get_radius (const gchar *name) +{ + GimpParam *return_vals; + gint nreturn_vals; + gdouble radius = 0.0; + + return_vals = gimp_run_procedure ("gimp-brush-get-radius", + &nreturn_vals, + GIMP_PDB_STRING, name, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + radius = return_vals[1].data.d_float; + + gimp_destroy_params (return_vals, nreturn_vals); + + return radius; +} + /** * gimp_brush_set_radius: * @name: The brush name. @@ -703,6 +570,39 @@ gimp_brush_set_radius (const gchar *name, return radius_out; } +/** + * gimp_brush_get_spikes: + * @name: The brush name. + * + * Get the number of spikes for a generated brush. + * + * This procedure gets the number of spikes for a generated brush. If + * called for any other type of brush, it does not succeed. + * + * Returns: The number of spikes on the brush. + * + * Since: GIMP 2.4 + */ +gint +gimp_brush_get_spikes (const gchar *name) +{ + GimpParam *return_vals; + gint nreturn_vals; + gint spikes = 0; + + return_vals = gimp_run_procedure ("gimp-brush-get-spikes", + &nreturn_vals, + GIMP_PDB_STRING, name, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + spikes = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return spikes; +} + /** * gimp_brush_set_spikes: * @name: The brush name. @@ -739,6 +639,40 @@ gimp_brush_set_spikes (const gchar *name, return spikes_out; } +/** + * gimp_brush_get_hardness: + * @name: The brush name. + * + * Get the hardness of a generated brush. + * + * This procedure gets the hardness of a generated brush. The hardness + * of a brush is the amount its intensity fades at the outside edge. If + * called for any other type of brush, the function does not succeed. + * + * Returns: The hardness of the brush. + * + * Since: GIMP 2.4 + */ +gdouble +gimp_brush_get_hardness (const gchar *name) +{ + GimpParam *return_vals; + gint nreturn_vals; + gdouble hardness = 0.0; + + return_vals = gimp_run_procedure ("gimp-brush-get-hardness", + &nreturn_vals, + GIMP_PDB_STRING, name, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + hardness = return_vals[1].data.d_float; + + gimp_destroy_params (return_vals, nreturn_vals); + + return hardness; +} + /** * gimp_brush_set_hardness: * @name: The brush name. @@ -775,6 +709,39 @@ gimp_brush_set_hardness (const gchar *name, return hardness_out; } +/** + * gimp_brush_get_aspect_ratio: + * @name: The brush name. + * + * Get the aspect ratio of a generated brush. + * + * This procedure gets the aspect ratio of a generated brush. If called + * for any other type of brush, it does not succeed. + * + * Returns: The aspect ratio of the brush. + * + * Since: GIMP 2.4 + */ +gdouble +gimp_brush_get_aspect_ratio (const gchar *name) +{ + GimpParam *return_vals; + gint nreturn_vals; + gdouble aspect_ratio = 0.0; + + return_vals = gimp_run_procedure ("gimp-brush-get-aspect-ratio", + &nreturn_vals, + GIMP_PDB_STRING, name, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + aspect_ratio = return_vals[1].data.d_float; + + gimp_destroy_params (return_vals, nreturn_vals); + + return aspect_ratio; +} + /** * gimp_brush_set_aspect_ratio: * @name: The brush name. @@ -811,6 +778,39 @@ gimp_brush_set_aspect_ratio (const gchar *name, return aspect_ratio_out; } +/** + * gimp_brush_get_angle: + * @name: The brush name. + * + * Get the rotation angle of a generated brush. + * + * This procedure gets the angle of rotation for a generated brush. If + * called for any other type of brush, it does not succeed. + * + * Returns: The rotation angle of the brush. + * + * Since: GIMP 2.4 + */ +gdouble +gimp_brush_get_angle (const gchar *name) +{ + GimpParam *return_vals; + gint nreturn_vals; + gdouble angle = 0.0; + + return_vals = gimp_run_procedure ("gimp-brush-get-angle", + &nreturn_vals, + GIMP_PDB_STRING, name, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + angle = return_vals[1].data.d_float; + + gimp_destroy_params (return_vals, nreturn_vals); + + return angle; +} + /** * gimp_brush_set_angle: * @name: The brush name. diff --git a/libgimp/gimpbrush_pdb.h b/libgimp/gimpbrush_pdb.h index c8210d818e..48f0e33706 100644 --- a/libgimp/gimpbrush_pdb.h +++ b/libgimp/gimpbrush_pdb.h @@ -55,21 +55,21 @@ gboolean gimp_brush_get_spacing (const gchar *n gboolean gimp_brush_set_spacing (const gchar *name, gint spacing); GimpBrushGeneratedShape gimp_brush_get_shape (const gchar *name); -gdouble gimp_brush_get_radius (const gchar *name); -gint gimp_brush_get_spikes (const gchar *name); -gdouble gimp_brush_get_hardness (const gchar *name); -gdouble gimp_brush_get_aspect_ratio (const gchar *name); -gdouble gimp_brush_get_angle (const gchar *name); GimpBrushGeneratedShape gimp_brush_set_shape (const gchar *name, GimpBrushGeneratedShape shape_in); +gdouble gimp_brush_get_radius (const gchar *name); gdouble gimp_brush_set_radius (const gchar *name, gdouble radius_in); +gint gimp_brush_get_spikes (const gchar *name); gint gimp_brush_set_spikes (const gchar *name, gint spikes_in); +gdouble gimp_brush_get_hardness (const gchar *name); gdouble gimp_brush_set_hardness (const gchar *name, gdouble hardness_in); +gdouble gimp_brush_get_aspect_ratio (const gchar *name); gdouble gimp_brush_set_aspect_ratio (const gchar *name, gdouble aspect_ratio_in); +gdouble gimp_brush_get_angle (const gchar *name); gdouble gimp_brush_set_angle (const gchar *name, gdouble angle_in); diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c index 49b13e8507..5b0c802256 100644 --- a/libgimp/gimpcontext_pdb.c +++ b/libgimp/gimpcontext_pdb.c @@ -88,6 +88,51 @@ gimp_context_pop (void) return success; } +/** + * gimp_context_list_paint_methods: + * @num_paint_methods: The number of the available paint methods. + * @paint_methods: The names of the available paint methods. + * + * Lists the available paint methods. + * + * This procedure lists the names of the available paint methods. Any + * of the results can be used for gimp_context_set_paint_method(). + * + * Returns: TRUE on success. + * + * Since: GIMP 2.4 + */ +gboolean +gimp_context_list_paint_methods (gint *num_paint_methods, + gchar ***paint_methods) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + gint i; + + return_vals = gimp_run_procedure ("gimp-context-list-paint-methods", + &nreturn_vals, + GIMP_PDB_END); + + *num_paint_methods = 0; + *paint_methods = NULL; + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + if (success) + { + *num_paint_methods = return_vals[1].data.d_int32; + *paint_methods = g_new (gchar *, *num_paint_methods); + for (i = 0; i < *num_paint_methods; i++) + (*paint_methods)[i] = g_strdup (return_vals[2].data.d_stringarray[i]); + } + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + /** * gimp_context_get_paint_method: * @@ -155,51 +200,6 @@ gimp_context_set_paint_method (const gchar *name) return success; } -/** - * gimp_context_list_paint_methods: - * @num_paint_methods: The number of the available paint methods. - * @paint_methods: The names of the available paint methods. - * - * Lists the available paint methods. - * - * This procedure lists the names of the available paint methods. Any - * of the results can be used for gimp_context_set_paint_method(). - * - * Returns: TRUE on success. - * - * Since: GIMP 2.4 - */ -gboolean -gimp_context_list_paint_methods (gint *num_paint_methods, - gchar ***paint_methods) -{ - GimpParam *return_vals; - gint nreturn_vals; - gboolean success = TRUE; - gint i; - - return_vals = gimp_run_procedure ("gimp-context-list-paint-methods", - &nreturn_vals, - GIMP_PDB_END); - - *num_paint_methods = 0; - *paint_methods = NULL; - - success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; - - if (success) - { - *num_paint_methods = return_vals[1].data.d_int32; - *paint_methods = g_new (gchar *, *num_paint_methods); - for (i = 0; i < *num_paint_methods; i++) - (*paint_methods)[i] = g_strdup (return_vals[2].data.d_stringarray[i]); - } - - gimp_destroy_params (return_vals, nreturn_vals); - - return success; -} - /** * gimp_context_get_foreground: * @foreground: The foreground color. diff --git a/libgimp/gimpcontext_pdb.h b/libgimp/gimpcontext_pdb.h index 3ccee1c9ab..945d87f628 100644 --- a/libgimp/gimpcontext_pdb.h +++ b/libgimp/gimpcontext_pdb.h @@ -31,10 +31,10 @@ G_BEGIN_DECLS gboolean gimp_context_push (void); gboolean gimp_context_pop (void); -gchar* gimp_context_get_paint_method (void); -gboolean gimp_context_set_paint_method (const gchar *name); gboolean gimp_context_list_paint_methods (gint *num_paint_methods, gchar ***paint_methods); +gchar* gimp_context_get_paint_method (void); +gboolean gimp_context_set_paint_method (const gchar *name); gboolean gimp_context_get_foreground (GimpRGB *foreground); gboolean gimp_context_set_foreground (const GimpRGB *foreground); gboolean gimp_context_get_background (GimpRGB *background); diff --git a/libgimpconfig/gimpconfig.def b/libgimpconfig/gimpconfig.def index e80600b195..09efe4a351 100644 --- a/libgimpconfig/gimpconfig.def +++ b/libgimpconfig/gimpconfig.def @@ -5,6 +5,7 @@ EXPORTS gimp_config_build_data_path gimp_config_build_plug_in_path gimp_config_build_writable_path + gimp_config_copy gimp_config_deserialize_file gimp_config_deserialize_properties gimp_config_deserialize_property diff --git a/plug-ins/common/ripple.c b/plug-ins/common/ripple.c index 13c5f76b4d..2e86187472 100644 --- a/plug-ins/common/ripple.c +++ b/plug-ins/common/ripple.c @@ -57,6 +57,7 @@ typedef struct gint waveform; gboolean antialias; gboolean tile; + gint phase_shift; } RippleValues; @@ -99,7 +100,8 @@ static RippleValues rvals = WRAP, /* edges */ SINE, /* waveform */ TRUE, /* antialias */ - FALSE /* tile */ + FALSE, /* tile */ + 0 /* phase shift */ }; /***** Functions *****/ @@ -603,7 +605,7 @@ ripple_dialog (GimpDrawable *drawable) gtk_widget_show (table); - table = gtk_table_new (2, 3, FALSE); + table = gtk_table_new (3, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); @@ -634,6 +636,19 @@ ripple_dialog (GimpDrawable *drawable) G_CALLBACK (gimp_preview_invalidate), preview); + /* Phase Shift */ + scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 2, + _("Phase _shift:"), SCALE_WIDTH, 0, + rvals.phase_shift, 0, 360, 1, 15, 0, + TRUE, 0, 0, + NULL, NULL); + g_signal_connect (scale_data, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + &rvals.phase_shift); + g_signal_connect_swapped (scale_data, "value-changed", + G_CALLBACK (gimp_preview_invalidate), + preview); + gtk_widget_show (frame); gtk_widget_show (table); gtk_widget_show (dialog); @@ -680,15 +695,20 @@ average_two_pixels (guchar *dest, static gdouble displace_amount (gint location) { + gdouble phi = rvals.phase_shift / 360.0; + gdouble lambda; + switch (rvals.waveform) { case SINE: return (rvals.amplitude * - sin (location * (2 * G_PI) / (gdouble) rvals.period)); + sin (2 * G_PI * (location / (gdouble) rvals.period - phi))); + case SAWTOOTH: - return (rvals.amplitude * - (fabs ((((location % rvals.period) / - (gdouble) rvals.period) * 4) - 2) - 1)); + lambda = location % rvals.period - phi * rvals.period; + if (lambda < 0) + lambda += rvals.period; + return (rvals.amplitude * (fabs (((lambda / rvals.period) * 4) - 2) - 1)); } return 0.0; diff --git a/tools/pdbgen/app.pl b/tools/pdbgen/app.pl index 58cb545ccc..09696bb6f1 100644 --- a/tools/pdbgen/app.pl +++ b/tools/pdbgen/app.pl @@ -669,6 +669,8 @@ GPL foreach (@{$main::grp{$group}->{headers}}) { $out->{headers}->{$_}++ } + $out->{headers}->{"\"core/gimpparamspecs.h\""}++; + my @headers = sort { my ($x, $y) = ($a, $b); foreach ($x, $y) { @@ -681,30 +683,22 @@ GPL } $x cmp $y; } keys %{$out->{headers}}; - my $headers = ""; my $lib = 0; my $seen = 0; my $nl = 0; - my $sys = 0; my $base = 0; + + my $headers = ""; + my $lib = 0; + my $seen = 0; + my $sys = 0; + my $base = 0; + my $intl = 0; + my $utils = 0; + foreach (@headers) { - $headers .= "\n" if $nl; - $nl = 0; - - if ($_ eq '') { - $headers .= "\n" if $seen; - $headers .= "#ifdef HAVE_UNISTD_H\n"; - } - if ($_ eq '') { - $headers .= "\n" if $seen; - $headers .= "#include \n\n"; - $headers .= "#ifdef G_OS_WIN32\n"; - } - - $seen++ if /^'; - $headers .= "\n\n"; + $headers .= "\n" if $seen; + $headers .= "#include \n\n"; } $seen = 0 if !/^') { - $headers .= "#endif\n"; - $seen = 0; - $nl = 1; - } - - if ($_ eq '') { - $headers .= "#endif\n"; - $seen = 0; - $nl = 1; + if (/gimp-intl/) { + $intl = 1; + } + elsif (/gimppdb-utils/) { + $utils = 1; + } + else { + $headers .= "#include $_\n"; } - - $headers .= "\n" if $_ eq '"config.h"'; } - $headers .= "\n#include \"internal_procs.h\"\n"; + $headers .= "\n"; + $headers .= "#include \"gimppdb.h\"\n"; + $headers .= "#include \"gimppdb-utils.h\"\n" if $utils; + $headers .= "#include \"gimpprocedure.h\"\n"; + $headers .= "#include \"internal_procs.h\"\n"; + + $headers .= "\n#include \"gimp-intl.h\"\n" if $intl; my $extra = {}; if (exists $main::grp{$group}->{extra}->{app}) { diff --git a/tools/pdbgen/pdb/brush.pdb b/tools/pdbgen/pdb/brush.pdb index 92ba2bbf7d..7ac70d0df9 100644 --- a/tools/pdbgen/pdb/brush.pdb +++ b/tools/pdbgen/pdb/brush.pdb @@ -845,16 +845,21 @@ CODE "core/gimpdatafactory.h" "gimppdb-utils.h"); -@procs = qw(brush_new brush_duplicate brush_is_generated - brush_rename brush_delete brush_is_editable - brush_get_info brush_get_pixels +@procs = qw(brush_new + brush_duplicate + brush_is_generated + brush_rename + brush_delete + brush_is_editable + brush_get_info + brush_get_pixels brush_get_spacing brush_set_spacing - brush_get_shape brush_get_radius - brush_get_spikes brush_get_hardness - brush_get_aspect_ratio brush_get_angle - brush_set_shape brush_set_radius - brush_set_spikes brush_set_hardness - brush_set_aspect_ratio brush_set_angle); + brush_get_shape brush_set_shape + brush_get_radius brush_set_radius + brush_get_spikes brush_set_spikes + brush_get_hardness brush_set_hardness + brush_get_aspect_ratio brush_set_aspect_ratio + brush_get_angle brush_set_angle); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/brush_select.pdb b/tools/pdbgen/pdb/brush_select.pdb index 1957b2724d..c61988c396 100644 --- a/tools/pdbgen/pdb/brush_select.pdb +++ b/tools/pdbgen/pdb/brush_select.pdb @@ -120,9 +120,12 @@ CODE } -@headers = qw("core/gimp.h" "core/gimpdatafactory.h"); +@headers = qw("core/gimp.h" + "core/gimpdatafactory.h"); -@procs = qw(brushes_popup brushes_close_popup brushes_set_popup); +@procs = qw(brushes_popup + brushes_close_popup + brushes_set_popup); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/brushes.pdb b/tools/pdbgen/pdb/brushes.pdb index d48696f74a..8f4d5354c8 100644 --- a/tools/pdbgen/pdb/brushes.pdb +++ b/tools/pdbgen/pdb/brushes.pdb @@ -206,7 +206,8 @@ CODE "core/gimpdatafactory.h" "gimppdb-utils.h"); -@procs = qw(brushes_refresh brushes_get_list +@procs = qw(brushes_refresh + brushes_get_list brushes_get_brush brushes_get_spacing brushes_set_spacing brushes_get_brush_data); diff --git a/tools/pdbgen/pdb/buffer.pdb b/tools/pdbgen/pdb/buffer.pdb index 657edea566..16070203d6 100644 --- a/tools/pdbgen/pdb/buffer.pdb +++ b/tools/pdbgen/pdb/buffer.pdb @@ -239,9 +239,12 @@ CODE "gimppdb-utils.h"); @procs = qw(buffers_get_list - buffer_rename buffer_delete - buffer_get_width buffer_get_height - buffer_get_bytes buffer_get_image_type); + buffer_rename + buffer_delete + buffer_get_width + buffer_get_height + buffer_get_bytes + buffer_get_image_type); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/channel.pdb b/tools/pdbgen/pdb/channel.pdb index 4ffe8bc586..1c7341fa9d 100644 --- a/tools/pdbgen/pdb/channel.pdb +++ b/tools/pdbgen/pdb/channel.pdb @@ -344,7 +344,9 @@ CODE @headers = qw("libgimpbase/gimpbase.h"); -@procs = qw(channel_new channel_new_from_component channel_copy +@procs = qw(channel_new + channel_new_from_component + channel_copy channel_combine_masks channel_get_show_masked channel_set_show_masked channel_get_opacity channel_set_opacity diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb index f641a148e7..71a6a88be8 100644 --- a/tools/pdbgen/pdb/color.pdb +++ b/tools/pdbgen/pdb/color.pdb @@ -684,8 +684,7 @@ CODE } -@headers = qw( - "core/gimpdrawable.h" +@headers = qw("core/gimpdrawable.h" "gimppdb-utils.h" "gimp-intl.h"); diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb index 9babb17590..47dee3665c 100644 --- a/tools/pdbgen/pdb/context.pdb +++ b/tools/pdbgen/pdb/context.pdb @@ -717,11 +717,12 @@ CODE "gimppdb-utils.h"); @procs = qw(context_push context_pop - context_get_paint_method context_set_paint_method context_list_paint_methods + context_get_paint_method context_set_paint_method context_get_foreground context_set_foreground context_get_background context_set_background - context_set_default_colors context_swap_colors + context_set_default_colors + context_swap_colors context_get_opacity context_set_opacity context_get_paint_mode context_set_paint_mode context_get_brush context_set_brush diff --git a/tools/pdbgen/pdb/convert.pdb b/tools/pdbgen/pdb/convert.pdb index a73fd69b7a..554bd09dfe 100644 --- a/tools/pdbgen/pdb/convert.pdb +++ b/tools/pdbgen/pdb/convert.pdb @@ -183,8 +183,7 @@ CODE ); } -@headers = qw("core/gimp.h" - "core/gimpimage.h" +@headers = qw("core/gimpimage.h" "core/gimpimage-convert.h" "gimppdb-utils.h"); diff --git a/tools/pdbgen/pdb/display.pdb b/tools/pdbgen/pdb/display.pdb index 57e720bf3c..75edc6e696 100644 --- a/tools/pdbgen/pdb/display.pdb +++ b/tools/pdbgen/pdb/display.pdb @@ -210,9 +210,12 @@ CODE @headers = qw("core/gimp.h"); -@procs = qw(display_is_valid display_new display_delete +@procs = qw(display_is_valid + display_new + display_delete display_get_window_handle - displays_flush displays_reconnect); + displays_flush + displays_reconnect); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb index 01804d1a8b..294d3fe5d0 100644 --- a/tools/pdbgen/pdb/drawable.pdb +++ b/tools/pdbgen/pdb/drawable.pdb @@ -1279,18 +1279,25 @@ CODE drawable_is_layer drawable_is_layer_mask drawable_is_channel drawable_type drawable_type_with_alpha drawable_has_alpha drawable_is_rgb drawable_is_gray drawable_is_indexed - drawable_bpp drawable_width drawable_height drawable_offsets + drawable_bpp + drawable_width + drawable_height + drawable_offsets drawable_delete drawable_get_image drawable_set_image drawable_get_name drawable_set_name drawable_get_visible drawable_set_visible drawable_get_linked drawable_set_linked drawable_get_tattoo drawable_set_tattoo - drawable_mask_bounds drawable_mask_intersect - drawable_merge_shadow drawable_update + drawable_mask_bounds + drawable_mask_intersect + drawable_merge_shadow + drawable_update drawable_get_pixel drawable_set_pixel - drawable_fill drawable_offset - drawable_thumbnail drawable_sub_thumbnail + drawable_fill + drawable_offset + drawable_thumbnail + drawable_sub_thumbnail drawable_foreground_extract); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/drawable_transform.pdb b/tools/pdbgen/pdb/drawable_transform.pdb index e357f6ceb3..e50e69c361 100644 --- a/tools/pdbgen/pdb/drawable_transform.pdb +++ b/tools/pdbgen/pdb/drawable_transform.pdb @@ -1037,15 +1037,21 @@ CODE "gimp-intl.h"); @procs = qw(drawable_transform_flip_simple - drawable_transform_flip drawable_transform_flip_default + drawable_transform_flip + drawable_transform_flip_default drawable_transform_perspective drawable_transform_perspective_default drawable_transform_rotate_simple - drawable_transform_rotate drawable_transform_rotate_default - drawable_transform_scale drawable_transform_scale_default - drawable_transform_shear drawable_transform_shear_default - drawable_transform_2d drawable_transform_2d_default - drawable_transform_matrix drawable_transform_matrix_default); + drawable_transform_rotate + drawable_transform_rotate_default + drawable_transform_scale + drawable_transform_scale_default + drawable_transform_shear + drawable_transform_shear_default + drawable_transform_2d + drawable_transform_2d_default + drawable_transform_matrix + drawable_transform_matrix_default); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/edit.pdb b/tools/pdbgen/pdb/edit.pdb index 931ed3d064..a8af1c2d5d 100644 --- a/tools/pdbgen/pdb/edit.pdb +++ b/tools/pdbgen/pdb/edit.pdb @@ -896,12 +896,19 @@ CODE "gimppdb-utils.h" "gimp-intl.h"); -@procs = qw(edit_cut edit_copy edit_copy_visible +@procs = qw(edit_cut + edit_copy edit_copy_visible edit_paste edit_paste_as_new - edit_named_cut edit_named_copy edit_named_copy_visible + edit_named_cut + edit_named_copy edit_named_copy_visible edit_named_paste edit_named_paste_as_new - edit_clear edit_fill edit_bucket_fill edit_bucket_fill_full - edit_blend edit_stroke edit_stroke_vectors); + edit_clear + edit_fill + edit_bucket_fill + edit_bucket_fill_full + edit_blend + edit_stroke + edit_stroke_vectors); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/fileops.pdb b/tools/pdbgen/pdb/fileops.pdb index 5050b2927f..7a5126b7cb 100644 --- a/tools/pdbgen/pdb/fileops.pdb +++ b/tools/pdbgen/pdb/fileops.pdb @@ -615,11 +615,15 @@ CODE "file/file-procedure.h" "file/file-utils.h"); -@procs = qw(file_load file_load_layer file_load_layers +@procs = qw(file_load + file_load_layer + file_load_layers file_save - file_load_thumbnail file_save_thumbnail + file_load_thumbnail + file_save_thumbnail temp_name - register_magic_load_handler register_load_handler + register_magic_load_handler + register_load_handler register_save_handler register_file_handler_mime register_thumbnail_loader); diff --git a/tools/pdbgen/pdb/font_select.pdb b/tools/pdbgen/pdb/font_select.pdb index 3a4e762ebe..d3a7fc1e78 100644 --- a/tools/pdbgen/pdb/font_select.pdb +++ b/tools/pdbgen/pdb/font_select.pdb @@ -98,7 +98,9 @@ CODE @headers = qw("core/gimp.h"); -@procs = qw(fonts_popup fonts_close_popup fonts_set_popup); +@procs = qw(fonts_popup + fonts_close_popup + fonts_set_popup); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/fonts.pdb b/tools/pdbgen/pdb/fonts.pdb index 5e365e6c1e..79a0eb9898 100644 --- a/tools/pdbgen/pdb/fonts.pdb +++ b/tools/pdbgen/pdb/fonts.pdb @@ -69,9 +69,12 @@ CODE } -@headers = qw("core/gimp.h" "core/gimpcontainer.h" "text/gimp-fonts.h"); +@headers = qw("core/gimp.h" + "core/gimpcontainer.h" + "text/gimp-fonts.h"); -@procs = qw(fonts_refresh fonts_get_list); +@procs = qw(fonts_refresh + fonts_get_list); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/gimprc.pdb b/tools/pdbgen/pdb/gimprc.pdb index d466bb8892..fc1ebb46a9 100644 --- a/tools/pdbgen/pdb/gimprc.pdb +++ b/tools/pdbgen/pdb/gimprc.pdb @@ -239,9 +239,14 @@ CODE "config/gimprc.h" "core/gimp.h"); -@procs = qw(gimprc_query gimprc_set - get_default_comment get_default_unit get_monitor_resolution - get_theme_dir get_color_configuration get_module_load_inhibit); +@procs = qw(gimprc_query + gimprc_set + get_default_comment + get_default_unit + get_monitor_resolution + get_theme_dir + get_color_configuration + get_module_load_inhibit); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/gradient.pdb b/tools/pdbgen/pdb/gradient.pdb index 0c9576e31a..d4b7784969 100644 --- a/tools/pdbgen/pdb/gradient.pdb +++ b/tools/pdbgen/pdb/gradient.pdb @@ -1382,8 +1382,11 @@ CODE "core/gimpdatafactory.h" "gimppdb-utils.h"); -@procs = qw(gradient_new gradient_duplicate gradient_is_editable - gradient_rename gradient_delete +@procs = qw(gradient_new + gradient_duplicate + gradient_is_editable + gradient_rename + gradient_delete gradient_get_uniform_samples gradient_get_custom_samples gradient_segment_get_left_color gradient_segment_set_left_color gradient_segment_get_right_color gradient_segment_set_right_color diff --git a/tools/pdbgen/pdb/gradient_select.pdb b/tools/pdbgen/pdb/gradient_select.pdb index d1bf1dc6a0..6e13d80d12 100644 --- a/tools/pdbgen/pdb/gradient_select.pdb +++ b/tools/pdbgen/pdb/gradient_select.pdb @@ -106,9 +106,13 @@ CODE } -@headers = qw("core/gimp.h" "core/gimpdatafactory.h" "core/gimpgradient.h"); +@headers = qw("core/gimp.h" + "core/gimpdatafactory.h" + "core/gimpgradient.h"); -@procs = qw(gradients_popup gradients_close_popup gradients_set_popup); +@procs = qw(gradients_popup + gradients_close_popup + gradients_set_popup); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/gradients.pdb b/tools/pdbgen/pdb/gradients.pdb index bbada3ff4b..ade150571f 100644 --- a/tools/pdbgen/pdb/gradients.pdb +++ b/tools/pdbgen/pdb/gradients.pdb @@ -253,8 +253,10 @@ CODE "core/gimpgradient.h" "gimppdb-utils.h"); -@procs = qw(gradients_refresh gradients_get_list - gradients_sample_uniform gradients_sample_custom +@procs = qw(gradients_refresh + gradients_get_list + gradients_sample_uniform + gradients_sample_custom gradients_get_gradient_data); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index 85c6f1ec91..62c6d4dff7 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -2559,14 +2559,18 @@ CODE image_base_type image_width image_height image_free_shadow - image_resize image_resize_to_layers image_scale + image_resize image_resize_to_layers + image_scale image_crop image_flip image_rotate - image_get_layers image_get_channels + image_get_layers + image_get_channels image_get_vectors image_get_active_drawable image_unset_active_channel - image_get_floating_sel image_floating_sel_attached_to - image_pick_color image_pick_correlate_layer + image_get_floating_sel + image_floating_sel_attached_to + image_pick_color + image_pick_correlate_layer image_add_layer image_remove_layer image_get_layer_position image_raise_layer image_lower_layer diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb index 45365a1af4..d52dd04c02 100644 --- a/tools/pdbgen/pdb/layer.pdb +++ b/tools/pdbgen/pdb/layer.pdb @@ -956,11 +956,18 @@ CODE "gimppdb-utils.h" "gimp-intl.h"); -@procs = qw(layer_new layer_new_from_drawable layer_copy - layer_add_alpha layer_flatten - layer_scale layer_resize layer_resize_to_image_size - layer_translate layer_set_offsets - layer_create_mask layer_get_mask layer_from_mask +@procs = qw(layer_new + layer_new_from_drawable + layer_copy + layer_add_alpha + layer_flatten + layer_scale + layer_resize layer_resize_to_image_size + layer_translate + layer_set_offsets + layer_create_mask + layer_get_mask + layer_from_mask layer_add_mask layer_remove_mask layer_is_floating_sel layer_get_lock_alpha layer_set_lock_alpha diff --git a/tools/pdbgen/pdb/message.pdb b/tools/pdbgen/pdb/message.pdb index 00d4aee8ff..2f1cb809df 100644 --- a/tools/pdbgen/pdb/message.pdb +++ b/tools/pdbgen/pdb/message.pdb @@ -103,7 +103,9 @@ CODE "plug-in/gimppluginmanager.h" "gimp-intl.h"); -@procs = qw(message message_get_handler message_set_handler); +@procs = qw(message + message_get_handler + message_set_handler); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/misc.pdb b/tools/pdbgen/pdb/misc.pdb index f83dfdc28e..6b552f5b19 100644 --- a/tools/pdbgen/pdb/misc.pdb +++ b/tools/pdbgen/pdb/misc.pdb @@ -56,10 +56,10 @@ HELP ); %invoke = ( - headers => [ qw( ) ], + headers => [ qw("base/base-utils.h") ], code => <<'CODE' { - pid = getpid (); + pid = get_pid (); } CODE ); @@ -82,8 +82,7 @@ HELP ); %invoke = ( - headers => [ qw("core/gimp.h") ], - code => <<'CODE' + code => <<'CODE' { gimp_exit (gimp, force); } @@ -92,7 +91,11 @@ CODE } -@procs = qw(version getpid quit); +@headers = qw("core/gimp.h"); + +@procs = qw(version + getpid + quit); %exports = (app => [@procs], lib => [@procs[0..1]]); diff --git a/tools/pdbgen/pdb/paint_tools.pdb b/tools/pdbgen/pdb/paint_tools.pdb index 1677972bda..6299126645 100644 --- a/tools/pdbgen/pdb/paint_tools.pdb +++ b/tools/pdbgen/pdb/paint_tools.pdb @@ -942,7 +942,6 @@ CODE @headers = qw("libgimpmath/gimpmath.h" - "core/gimp.h" "core/gimppaintinfo.h" "paint/gimppaintcore.h" "paint/gimppaintcore-stroke.h" diff --git a/tools/pdbgen/pdb/palette.pdb b/tools/pdbgen/pdb/palette.pdb index 1c42fe7187..991e4df5ed 100644 --- a/tools/pdbgen/pdb/palette.pdb +++ b/tools/pdbgen/pdb/palette.pdb @@ -546,8 +546,12 @@ CODE "core/gimppalette.h" "gimppdb-utils.h"); -@procs = qw(palette_new palette_duplicate palette_rename palette_delete - palette_is_editable palette_get_info +@procs = qw(palette_new + palette_duplicate + palette_rename + palette_delete + palette_is_editable + palette_get_info palette_get_columns palette_set_columns palette_add_entry palette_delete_entry palette_entry_get_color palette_entry_set_color diff --git a/tools/pdbgen/pdb/palette_select.pdb b/tools/pdbgen/pdb/palette_select.pdb index 773273e7ae..a639641cec 100644 --- a/tools/pdbgen/pdb/palette_select.pdb +++ b/tools/pdbgen/pdb/palette_select.pdb @@ -100,9 +100,12 @@ CODE } -@headers = qw("core/gimp.h" "core/gimpdatafactory.h"); +@headers = qw("core/gimp.h" + "core/gimpdatafactory.h"); -@procs = qw(palettes_popup palettes_close_popup palettes_set_popup); +@procs = qw(palettes_popup + palettes_close_popup + palettes_set_popup); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/palettes.pdb b/tools/pdbgen/pdb/palettes.pdb index 8edf7d739f..d4db0606d3 100644 --- a/tools/pdbgen/pdb/palettes.pdb +++ b/tools/pdbgen/pdb/palettes.pdb @@ -153,8 +153,10 @@ CODE "core/gimppalette.h" "gimppdb-utils.h"); -@procs = qw(palettes_refresh palettes_get_list - palettes_get_palette palettes_get_palette_entry); +@procs = qw(palettes_refresh + palettes_get_list + palettes_get_palette + palettes_get_palette_entry); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/paths.pdb b/tools/pdbgen/pdb/paths.pdb index 550f93c1a8..f1ff183958 100644 --- a/tools/pdbgen/pdb/paths.pdb +++ b/tools/pdbgen/pdb/paths.pdb @@ -596,7 +596,6 @@ CODE @headers = qw( "libgimpmath/gimpmath.h" - "core/gimp.h" "core/gimplist.h" "core/gimpchannel-select.h" "vectors/gimpanchor.h" diff --git a/tools/pdbgen/pdb/pattern.pdb b/tools/pdbgen/pdb/pattern.pdb index a02fe0a9af..8a9ca99f13 100644 --- a/tools/pdbgen/pdb/pattern.pdb +++ b/tools/pdbgen/pdb/pattern.pdb @@ -114,13 +114,13 @@ CODE @headers = qw( "base/temp-buf.h" - "core/gimp.h" "core/gimpcontext.h" "core/gimpdatafactory.h" "core/gimppattern.h" "gimppdb-utils.h"); -@procs = qw(pattern_get_info pattern_get_pixels); +@procs = qw(pattern_get_info + pattern_get_pixels); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/pattern_select.pdb b/tools/pdbgen/pdb/pattern_select.pdb index 79949307c9..ddd3adc5d9 100644 --- a/tools/pdbgen/pdb/pattern_select.pdb +++ b/tools/pdbgen/pdb/pattern_select.pdb @@ -100,9 +100,12 @@ CODE } -@headers = qw("core/gimp.h" "core/gimpdatafactory.h"); +@headers = qw("core/gimp.h" + "core/gimpdatafactory.h"); -@procs = qw(patterns_popup patterns_close_popup patterns_set_popup); +@procs = qw(patterns_popup + patterns_close_popup + patterns_set_popup); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/patterns.pdb b/tools/pdbgen/pdb/patterns.pdb index 07363e466b..0c8921c2f6 100644 --- a/tools/pdbgen/pdb/patterns.pdb +++ b/tools/pdbgen/pdb/patterns.pdb @@ -158,7 +158,9 @@ CODE "core/gimppattern.h" "gimppdb-utils.h"); -@procs = qw(patterns_refresh patterns_get_list patterns_get_pattern +@procs = qw(patterns_refresh + patterns_get_list + patterns_get_pattern patterns_get_pattern_data); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/plug_in.pdb b/tools/pdbgen/pdb/plug_in.pdb index ffeafcf41b..0e9c4dbcf8 100644 --- a/tools/pdbgen/pdb/plug_in.pdb +++ b/tools/pdbgen/pdb/plug_in.pdb @@ -283,8 +283,10 @@ CODE "plug-in/gimppluginprocedure.h"); @procs = qw(plugins_query - plugin_domain_register plugin_help_register - plugin_menu_register plugin_menu_branch_register + plugin_domain_register + plugin_help_register + plugin_menu_register + plugin_menu_branch_register plugin_icon_register); %exports = (app => [@procs], lib => [@procs[1,2,3,4,5]]); diff --git a/tools/pdbgen/pdb/procedural_db.pdb b/tools/pdbgen/pdb/procedural_db.pdb index becd5514a9..dc6504cd2e 100644 --- a/tools/pdbgen/pdb/procedural_db.pdb +++ b/tools/pdbgen/pdb/procedural_db.pdb @@ -447,13 +447,15 @@ CODE @headers = qw("libgimpbase/gimpbase.h" "core/gimp.h" "core/gimpparamspecs-desc.h" + "plug-in/gimppluginmanager-data.h" "gimppdb-query.h" - "gimp-pdb-compat.h" - "plug-in/gimppluginmanager-data.h"); + "gimp-pdb-compat.h"); -@procs = qw(procedural_db_temp_name procedural_db_dump - procedural_db_query procedural_db_proc_info - procedural_db_proc_arg procedural_db_proc_val +@procs = qw(procedural_db_temp_name + procedural_db_dump + procedural_db_query + procedural_db_proc_info + procedural_db_proc_arg procedural_db_proc_val procedural_db_get_data procedural_db_get_data_size procedural_db_set_data); diff --git a/tools/pdbgen/pdb/progress.pdb b/tools/pdbgen/pdb/progress.pdb index b3d5eb80ea..05f9e5afd9 100644 --- a/tools/pdbgen/pdb/progress.pdb +++ b/tools/pdbgen/pdb/progress.pdb @@ -302,9 +302,15 @@ CODE "plug-in/gimpplugin-progress.h" "plug-in/gimppluginmanager.h"); -@procs = qw(progress_init progress_update progress_pulse progress_set_text - progress_end progress_get_window_handle - progress_install progress_uninstall progress_cancel); +@procs = qw(progress_init + progress_update + progress_pulse + progress_set_text + progress_end + progress_get_window_handle + progress_install + progress_uninstall + progress_cancel); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/transform_tools.pdb b/tools/pdbgen/pdb/transform_tools.pdb index 16fba0076f..22fed64a8b 100644 --- a/tools/pdbgen/pdb/transform_tools.pdb +++ b/tools/pdbgen/pdb/transform_tools.pdb @@ -421,7 +421,12 @@ CODE "gimppdb-utils.h" "gimp-intl.h"); -@procs = qw(flip perspective rotate scale shear transform_2d); +@procs = qw(flip + perspective + rotate + scale + shear + transform_2d); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/vectors.pdb b/tools/pdbgen/pdb/vectors.pdb index 1936ab2371..f447859bac 100644 --- a/tools/pdbgen/pdb/vectors.pdb +++ b/tools/pdbgen/pdb/vectors.pdb @@ -1345,8 +1345,11 @@ CODE } -@headers = qw( "core/gimp.h" "core/gimplist.h" "core/gimpimage.h" - "core/gimpchannel-select.h" "vectors/gimpanchor.h" +@headers = qw( + "core/gimplist.h" + "core/gimpimage.h" + "core/gimpchannel-select.h" + "vectors/gimpanchor.h" "vectors/gimpstroke-new.h" "vectors/gimpbezierstroke.h" "vectors/gimpvectors.h"