? app/base/test-cpu-accel ? app/dialogs/change-display-dialog.c ? app/dialogs/change-display-dialog.h Index: app/actions/gradient-editor-commands.c =================================================================== RCS file: /cvs/gnome/gimp/app/actions/gradient-editor-commands.c,v retrieving revision 1.39 diff -u -p -r1.39 gradient-editor-commands.c --- app/actions/gradient-editor-commands.c 12 Apr 2006 12:49:10 -0000 1.39 +++ app/actions/gradient-editor-commands.c 29 Aug 2006 20:43:06 -0000 @@ -427,12 +427,12 @@ void gradient_editor_split_midpoint_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); - GimpGradient *gradient; - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); + GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data); + GimpGradient *gradient = GIMP_GRADIENT (data_editor->data); gimp_gradient_segment_range_split_midpoint (gradient, + data_editor->context, editor->control_sel_l, editor->control_sel_r, &editor->control_sel_l, @@ -794,9 +794,11 @@ gradient_editor_split_uniform_response ( if (response_id == GTK_RESPONSE_OK) { - GimpGradient *gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); + GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor); + GimpGradient *gradient = GIMP_GRADIENT (data_editor->data); gimp_gradient_segment_range_split_uniform (gradient, + data_editor->context, editor->control_sel_l, editor->control_sel_r, editor->split_parts, Index: app/core/core-enums.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/core-enums.c,v retrieving revision 1.98 diff -u -p -r1.98 core-enums.c --- app/core/core-enums.c 5 Aug 2006 13:01:05 -0000 1.98 +++ app/core/core-enums.c 29 Aug 2006 20:43:07 -0000 @@ -1015,6 +1015,40 @@ gimp_offset_type_get_type (void) } GType +gimp_gradient_color_get_type (void) +{ + static const GEnumValue values[] = + { + { GIMP_GRADIENT_COLOR_FIXED, "GIMP_GRADIENT_COLOR_FIXED", "fixed" }, + { GIMP_GRADIENT_COLOR_FOREGROUND, "GIMP_GRADIENT_COLOR_FOREGROUND", "foreground" }, + { GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT, "GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT", "foreground-transparent" }, + { GIMP_GRADIENT_COLOR_BACKGROUND, "GIMP_GRADIENT_COLOR_BACKGROUND", "background" }, + { GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT, "GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT", "background-transparent" }, + { 0, NULL, NULL } + }; + + static const GimpEnumDesc descs[] = + { + { GIMP_GRADIENT_COLOR_FIXED, "GIMP_GRADIENT_COLOR_FIXED", NULL }, + { GIMP_GRADIENT_COLOR_FOREGROUND, "GIMP_GRADIENT_COLOR_FOREGROUND", NULL }, + { GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT, "GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT", NULL }, + { GIMP_GRADIENT_COLOR_BACKGROUND, "GIMP_GRADIENT_COLOR_BACKGROUND", NULL }, + { GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT, "GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT", NULL }, + { 0, NULL, NULL } + }; + + static GType type = 0; + + if (! type) + { + type = g_enum_register_static ("GimpGradientColor", values); + gimp_enum_set_value_descriptions (type, descs); + } + + return type; +} + +GType gimp_gradient_segment_type_get_type (void) { static const GEnumValue values[] = Index: app/core/core-enums.h =================================================================== RCS file: /cvs/gnome/gimp/app/core/core-enums.h,v retrieving revision 1.117 diff -u -p -r1.117 core-enums.h --- app/core/core-enums.h 15 Aug 2006 16:20:43 -0000 1.117 +++ app/core/core-enums.h 29 Aug 2006 20:43:07 -0000 @@ -33,7 +33,7 @@ /* - * these enums that are registered with the type system + * these enums are registered with the type system */ @@ -479,6 +479,20 @@ typedef enum GIMP_OFFSET_BACKGROUND, GIMP_OFFSET_TRANSPARENT } GimpOffsetType; + + +#define GIMP_TYPE_GRADIENT_COLOR (gimp_gradient_color_get_type ()) + +GType gimp_gradient_color_get_type (void) G_GNUC_CONST; + +typedef enum /*< pdb-skip >*/ +{ + GIMP_GRADIENT_COLOR_FIXED, + GIMP_GRADIENT_COLOR_FOREGROUND, + GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT, + GIMP_GRADIENT_COLOR_BACKGROUND, + GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT +} GimpGradientColor; #define GIMP_TYPE_GRADIENT_SEGMENT_TYPE (gimp_gradient_segment_type_get_type ()) Index: app/core/gimp-gradients.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimp-gradients.c,v retrieving revision 1.9 diff -u -p -r1.9 gimp-gradients.c --- app/core/gimp-gradients.c 14 Jun 2005 20:40:05 -0000 1.9 +++ app/core/gimp-gradients.c 29 Aug 2006 20:43:07 -0000 @@ -44,15 +44,12 @@ /* local function prototypes */ -static GimpGradient * gimp_gradients_add_gradient (Gimp *gimp, - const gchar *name, - const gchar *id); -static void gimp_gradients_foreground_changed (GimpContext *context, - const GimpRGB *fg, - Gimp *gimp); -static void gimp_gradients_background_changed (GimpContext *context, - const GimpRGB *bg, - Gimp *gimp); +static GimpGradient * gimp_gradients_add_gradient (Gimp *gimp, + const gchar *name, + const gchar *id); +static void gimp_gradients_color_changed (GimpContext *context, + const GimpRGB *fg, + Gimp *gimp); /* public functions */ @@ -82,17 +79,13 @@ gimp_gradients_init (Gimp *gimp) gradient = gimp_gradients_add_gradient (gimp, _("FG to Transparent"), FG_TRANSPARENT_KEY); - gimp_rgba_set (&gradient->segments->right_color, - gradient->segments->left_color.r, - gradient->segments->left_color.g, - gradient->segments->left_color.b, - 0.0); + gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT; g_signal_connect (gimp->user_context, "foreground-changed", - G_CALLBACK (gimp_gradients_foreground_changed), + G_CALLBACK (gimp_gradients_color_changed), gimp); g_signal_connect (gimp->user_context, "background-changed", - G_CALLBACK (gimp_gradients_background_changed), + G_CALLBACK (gimp_gradients_color_changed), gimp); } @@ -104,16 +97,12 @@ gimp_gradients_add_gradient (Gimp const gchar *name, const gchar *id) { - GimpGradient *gradient; - - gradient = GIMP_GRADIENT (gimp_gradient_new (name)); + GimpGradient *gradient = GIMP_GRADIENT (gimp_gradient_new (name)); gimp_data_make_internal (GIMP_DATA (gradient)); - gimp_context_get_foreground (gimp->user_context, - &gradient->segments->left_color); - gimp_context_get_background (gimp->user_context, - &gradient->segments->right_color); + gradient->segments->left_color_type = GIMP_GRADIENT_COLOR_FOREGROUND; + gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_BACKGROUND; gimp_container_add (gimp->gradient_factory->container, GIMP_OBJECT (gradient)); @@ -125,75 +114,25 @@ gimp_gradients_add_gradient (Gimp } static void -gimp_gradients_foreground_changed (GimpContext *context, - const GimpRGB *fg, - Gimp *gimp) +gimp_gradients_color_changed (GimpContext *context, + const GimpRGB *color, + Gimp *gimp) { GimpGradient *gradient; gradient = g_object_get_data (G_OBJECT (gimp), FG_BG_RGB_KEY); - if (gradient) - { - gradient->segments->left_color = *fg; - gimp_data_dirty (GIMP_DATA (gradient)); - } + gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient)); gradient = g_object_get_data (G_OBJECT (gimp), FG_BG_HSV_CCW_KEY); - if (gradient) - { - gradient->segments->left_color = *fg; - gimp_data_dirty (GIMP_DATA (gradient)); - } + gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient)); gradient = g_object_get_data (G_OBJECT (gimp), FG_BG_HSV_CW_KEY); - if (gradient) - { - gradient->segments->left_color = *fg; - gimp_data_dirty (GIMP_DATA (gradient)); - } + gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient)); gradient = g_object_get_data (G_OBJECT (gimp), FG_TRANSPARENT_KEY); - - if (gradient) - { - gradient->segments->left_color = *fg; - gradient->segments->right_color = *fg; - gradient->segments->right_color.a = 0.0; - gimp_data_dirty (GIMP_DATA (gradient)); - } -} - -static void -gimp_gradients_background_changed (GimpContext *context, - const GimpRGB *bg, - Gimp *gimp) -{ - GimpGradient *gradient; - - gradient = g_object_get_data (G_OBJECT (gimp), FG_BG_RGB_KEY); - - if (gradient) - { - gradient->segments->right_color = *bg; - gimp_data_dirty (GIMP_DATA (gradient)); - } - - gradient = g_object_get_data (G_OBJECT (gimp), FG_BG_HSV_CCW_KEY); - - if (gradient) - { - gradient->segments->right_color = *bg; - gimp_data_dirty (GIMP_DATA (gradient)); - } - - gradient = g_object_get_data (G_OBJECT (gimp), FG_BG_HSV_CW_KEY); - if (gradient) - { - gradient->segments->right_color = *bg; - gimp_data_dirty (GIMP_DATA (gradient)); - } + gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient)); } Index: app/core/gimpbrush.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpbrush.c,v retrieving revision 1.99 diff -u -p -r1.99 gimpbrush.c --- app/core/gimpbrush.c 15 May 2006 09:46:11 -0000 1.99 +++ app/core/gimpbrush.c 29 Aug 2006 20:43:07 -0000 @@ -51,6 +51,7 @@ static gboolean gimp_brush_get_size gint *width, gint *height); static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); static gchar * gimp_brush_get_description (GimpViewable *viewable, @@ -170,6 +171,7 @@ gimp_brush_get_size (GimpViewable *viewa static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { Index: app/core/gimpbuffer.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpbuffer.c,v retrieving revision 1.32 diff -u -p -r1.32 gimpbuffer.c --- app/core/gimpbuffer.c 15 May 2006 09:46:11 -0000 1.32 +++ app/core/gimpbuffer.c 29 Aug 2006 20:43:07 -0000 @@ -54,6 +54,7 @@ static gboolean gimp_buffer_get_popup_s gint *popup_width, gint *popup_height); static TempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); static gchar * gimp_buffer_get_description (GimpViewable *viewable, @@ -194,6 +195,7 @@ gimp_buffer_get_popup_size (GimpViewable static TempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { Index: app/core/gimpdrawable-blend.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpdrawable-blend.c,v retrieving revision 1.163 diff -u -p -r1.163 gimpdrawable-blend.c --- app/core/gimpdrawable-blend.c 12 Apr 2006 12:49:16 -0000 1.163 +++ app/core/gimpdrawable-blend.c 29 Aug 2006 20:43:07 -0000 @@ -49,6 +49,7 @@ typedef struct { GimpGradient *gradient; + GimpContext *context; gboolean reverse; gdouble offset; gdouble sx, sy; @@ -765,7 +766,7 @@ gradient_render_pixel (gdouble x, if (rbd->blend_mode == GIMP_CUSTOM_MODE) { - gimp_gradient_get_color_at (rbd->gradient, NULL, + gimp_gradient_get_color_at (rbd->gradient, rbd->context, NULL, factor, rbd->reverse, color); } else @@ -867,6 +868,7 @@ gradient_fill_region (GimpImage * RenderBlendData rbd; rbd.gradient = gimp_context_get_gradient (context); + rbd.context = context; rbd.reverse = reverse; gimp_context_get_foreground (context, &rbd.fg); Index: app/core/gimpdrawable-preview.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpdrawable-preview.c,v retrieving revision 1.33 diff -u -p -r1.33 gimpdrawable-preview.c --- app/core/gimpdrawable-preview.c 7 Apr 2006 09:21:12 -0000 1.33 +++ app/core/gimpdrawable-preview.c 29 Aug 2006 20:43:07 -0000 @@ -58,6 +58,7 @@ static void gimp_drawable_preview_s TempBuf * gimp_drawable_get_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { Index: app/core/gimpdrawable-preview.h =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpdrawable-preview.h,v retrieving revision 1.6 diff -u -p -r1.6 gimpdrawable-preview.h --- app/core/gimpdrawable-preview.h 15 Dec 2004 14:40:52 -0000 1.6 +++ app/core/gimpdrawable-preview.h 29 Aug 2006 20:43:07 -0000 @@ -24,6 +24,7 @@ * virtual function of GimpDrawable -- dont't call directly */ TempBuf * gimp_drawable_get_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); Index: app/core/gimpgradient.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpgradient.c,v retrieving revision 1.60 diff -u -p -r1.60 gimpgradient.c --- app/core/gimpgradient.c 15 May 2006 09:46:11 -0000 1.60 +++ app/core/gimpgradient.c 29 Aug 2006 20:43:07 -0000 @@ -29,7 +29,7 @@ #include "base/temp-buf.h" -#include "gimpimage.h" +#include "gimpcontext.h" #include "gimpgradient.h" #include "gimpgradient-save.h" @@ -55,6 +55,7 @@ static gboolean gimp_gradient_get_popu gint *popup_width, gint *popup_height); static TempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); static gchar * gimp_gradient_get_extension (GimpData *data); @@ -173,6 +174,7 @@ gimp_gradient_get_popup_size (GimpViewab static TempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -194,7 +196,8 @@ gimp_gradient_get_new_preview (GimpViewa for (x = 0; x < width; x++) { - seg = gimp_gradient_get_color_at (gradient, seg, cur_x, FALSE, &color); + seg = gimp_gradient_get_color_at (gradient, context, seg, cur_x, + FALSE, &color); *p++ = color.r * 255.0; *p++ = color.g * 255.0; @@ -298,10 +301,11 @@ gimp_gradient_get_extension (GimpData *d /** * gimp_gradient_get_color_at: * @gradient: a gradient - * @seg: a segment to seed the search with (or %NULL) - * @pos: position in the gradient (between 0.0 and 1.0) - * @reverse: - * @color: returns the color + * @context: a context + * @seg: a segment to seed the search with (or %NULL) + * @pos: position in the gradient (between 0.0 and 1.0) + * @reverse: when %TRUE, use the reversed gradient + * @color: returns the color * * If you are iterating over an gradient, you should pass the the * return value from the last call for @seg. @@ -310,6 +314,7 @@ gimp_gradient_get_extension (GimpData *d **/ GimpGradientSegment * gimp_gradient_get_color_at (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *seg, gdouble pos, gboolean reverse, @@ -318,9 +323,12 @@ gimp_gradient_get_color_at (GimpGradient gdouble factor = 0.0; gdouble seg_len; gdouble middle; + GimpRGB left_color; + GimpRGB right_color; GimpRGB rgb; g_return_val_if_fail (GIMP_IS_GRADIENT (gradient), NULL); + g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (color != NULL, NULL); pos = CLAMP (pos, 0.0, 1.0); @@ -371,26 +379,81 @@ gimp_gradient_get_color_at (GimpGradient break; } - /* Calculate color components */ + /* Get left/right colors */ - if (seg->color == GIMP_GRADIENT_SEGMENT_RGB) + switch (seg->left_color_type) + { + case GIMP_GRADIENT_COLOR_FIXED: + left_color = seg->left_color; + break; + + case GIMP_GRADIENT_COLOR_FOREGROUND: + case GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT: + if (context) + gimp_context_get_foreground (context, &left_color); + else + gimp_rgba_set (&left_color, 0.0, 0.0, 0.0, 1.0); + + if (seg->left_color_type == GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT) + gimp_rgb_set_alpha (&left_color, 0.0); + break; + + case GIMP_GRADIENT_COLOR_BACKGROUND: + case GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT: + if (context) + gimp_context_get_background (context, &left_color); + else + gimp_rgba_set (&left_color, 1.0, 1.0, 1.0, 1.0); + + if (seg->left_color_type == GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT) + gimp_rgb_set_alpha (&left_color, 0.0); + break; + } + + switch (seg->right_color_type) { - rgb.r = - seg->left_color.r + (seg->right_color.r - seg->left_color.r) * factor; + case GIMP_GRADIENT_COLOR_FIXED: + right_color = seg->right_color; + break; + + case GIMP_GRADIENT_COLOR_FOREGROUND: + case GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT: + if (context) + gimp_context_get_foreground (context, &right_color); + else + gimp_rgba_set (&right_color, 0.0, 0.0, 0.0, 1.0); + + if (seg->right_color_type == GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT) + gimp_rgb_set_alpha (&right_color, 0.0); + break; + + case GIMP_GRADIENT_COLOR_BACKGROUND: + case GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT: + if (context) + gimp_context_get_background (context, &right_color); + else + gimp_rgba_set (&right_color, 1.0, 1.0, 1.0, 1.0); - rgb.g = - seg->left_color.g + (seg->right_color.g - seg->left_color.g) * factor; + if (seg->right_color_type == GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT) + gimp_rgb_set_alpha (&right_color, 0.0); + break; + } + + /* Calculate color components */ - rgb.b = - seg->left_color.b + (seg->right_color.b - seg->left_color.b) * factor; + if (seg->color == GIMP_GRADIENT_SEGMENT_RGB) + { + rgb.r = left_color.r + (right_color.r - left_color.r) * factor; + rgb.g = left_color.g + (right_color.g - left_color.g) * factor; + rgb.b = left_color.b + (right_color.b - left_color.b) * factor; } else { GimpHSV left_hsv; GimpHSV right_hsv; - gimp_rgb_to_hsv (&seg->left_color, &left_hsv); - gimp_rgb_to_hsv (&seg->right_color, &right_hsv); + gimp_rgb_to_hsv (&left_color, &left_hsv); + gimp_rgb_to_hsv (&right_color, &right_hsv); left_hsv.s = left_hsv.s + (right_hsv.s - left_hsv.s) * factor; left_hsv.v = left_hsv.v + (right_hsv.v - left_hsv.v) * factor; @@ -436,8 +499,7 @@ gimp_gradient_get_color_at (GimpGradient /* Calculate alpha */ - rgb.a = - seg->left_color.a + (seg->right_color.a - seg->left_color.a) * factor; + rgb.a = left_color.a + (right_color.a - left_color.a) * factor; *color = rgb; @@ -466,7 +528,10 @@ gimp_gradient_segment_new (void) seg->middle = 0.5; seg->right = 1.0; + seg->left_color_type = GIMP_GRADIENT_COLOR_FIXED; gimp_rgba_set (&seg->left_color, 0.0, 0.0, 0.0, 1.0); + + seg->right_color_type = GIMP_GRADIENT_COLOR_FIXED; gimp_rgba_set (&seg->right_color, 1.0, 1.0, 1.0, 1.0); seg->type = GIMP_GRADIENT_SEGMENT_LINEAR; @@ -550,6 +615,7 @@ gimp_gradient_segment_get_nth (GimpGradi void gimp_gradient_segment_split_midpoint (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *lseg, GimpGradientSegment **newl, GimpGradientSegment **newr) @@ -558,6 +624,7 @@ gimp_gradient_segment_split_midpoint (Gi GimpGradientSegment *newseg; g_return_if_fail (GIMP_IS_GRADIENT (gradient)); + g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context)); g_return_if_fail (lseg != NULL); g_return_if_fail (newl != NULL); g_return_if_fail (newr != NULL); @@ -565,7 +632,8 @@ gimp_gradient_segment_split_midpoint (Gi gimp_data_freeze (GIMP_DATA (gradient)); /* Get color at original segment's midpoint */ - gimp_gradient_get_color_at (gradient, lseg, lseg->middle, FALSE, &color); + gimp_gradient_get_color_at (gradient, context, lseg, lseg->middle, + FALSE, &color); /* Create a new segment and insert it in the list */ @@ -614,6 +682,7 @@ gimp_gradient_segment_split_midpoint (Gi void gimp_gradient_segment_split_uniform (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *lseg, gint parts, GimpGradientSegment **newl, @@ -624,6 +693,7 @@ gimp_gradient_segment_split_uniform (Gim gint i; g_return_if_fail (GIMP_IS_GRADIENT (gradient)); + g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context)); g_return_if_fail (lseg != NULL); g_return_if_fail (newl != NULL); g_return_if_fail (newr != NULL); @@ -647,9 +717,9 @@ gimp_gradient_segment_split_uniform (Gim seg->right = lseg->left + (i + 1) * seg_len; seg->middle = (seg->left + seg->right) / 2.0; - gimp_gradient_get_color_at (gradient, lseg, + gimp_gradient_get_color_at (gradient, context, lseg, seg->left, FALSE, &seg->left_color); - gimp_gradient_get_color_at (gradient, lseg, + gimp_gradient_get_color_at (gradient, context, lseg, seg->right, FALSE, &seg->right_color); seg->type = lseg->type; @@ -1305,6 +1375,7 @@ gimp_gradient_segment_range_replicate (G void gimp_gradient_segment_range_split_midpoint (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *start_seg, GimpGradientSegment *end_seg, GimpGradientSegment **final_start_seg, @@ -1313,6 +1384,7 @@ gimp_gradient_segment_range_split_midpoi GimpGradientSegment *seg, *lseg, *rseg; g_return_if_fail (GIMP_IS_GRADIENT (gradient)); + g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context)); gimp_data_freeze (GIMP_DATA (gradient)); @@ -1323,7 +1395,8 @@ gimp_gradient_segment_range_split_midpoi do { - gimp_gradient_segment_split_midpoint (gradient, seg, &lseg, &rseg); + gimp_gradient_segment_split_midpoint (gradient, context, + seg, &lseg, &rseg); seg = rseg->next; } while (lseg != end_seg); @@ -1339,6 +1412,7 @@ gimp_gradient_segment_range_split_midpoi void gimp_gradient_segment_range_split_uniform (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *start_seg, GimpGradientSegment *end_seg, gint parts, @@ -1348,6 +1422,7 @@ gimp_gradient_segment_range_split_unifor GimpGradientSegment *seg, *aseg, *lseg, *rseg, *lsel; g_return_if_fail (GIMP_IS_GRADIENT (gradient)); + g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context)); if (! end_seg) end_seg = gimp_gradient_segment_get_last (start_seg); @@ -1368,7 +1443,7 @@ gimp_gradient_segment_range_split_unifor { aseg = seg; - gimp_gradient_segment_split_uniform (gradient, seg, + gimp_gradient_segment_split_uniform (gradient, context, seg, parts, &lseg, &rseg); Index: app/core/gimpgradient.h =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpgradient.h,v retrieving revision 1.20 diff -u -p -r1.20 gimpgradient.h --- app/core/gimpgradient.h 8 Jun 2005 11:27:31 -0000 1.20 +++ app/core/gimpgradient.h 29 Aug 2006 20:43:07 -0000 @@ -32,8 +32,12 @@ struct _GimpGradientSegment { gdouble left, middle, right; + + GimpGradientColor left_color_type; GimpRGB left_color; + GimpGradientColor right_color_type; GimpRGB right_color; + GimpGradientSegmentType type; /* Segment's blending function */ GimpGradientSegmentColor color; /* Segment's coloring type */ @@ -71,6 +75,7 @@ GimpData * gimp_gradient_new GimpData * gimp_gradient_get_standard (void); GimpGradientSegment * gimp_gradient_get_color_at (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *seg, gdouble pos, gboolean reverse, @@ -91,10 +96,12 @@ void gimp_gradient_segm void gimp_gradient_segments_free (GimpGradientSegment *seg); void gimp_gradient_segment_split_midpoint (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *lseg, GimpGradientSegment **newl, GimpGradientSegment **newr); void gimp_gradient_segment_split_uniform (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *lseg, gint parts, GimpGradientSegment **newl, @@ -190,6 +197,7 @@ void gimp_gradient_segment_range_repl void gimp_gradient_segment_range_split_midpoint (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *start_seg, GimpGradientSegment *end_seg, GimpGradientSegment **final_start_seg, @@ -197,6 +205,7 @@ void gimp_gradient_segment_range_spli void gimp_gradient_segment_range_split_uniform (GimpGradient *gradient, + GimpContext *context, GimpGradientSegment *start_seg, GimpGradientSegment *end_seg, gint parts, Index: app/core/gimpimage-preview.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpimage-preview.c,v retrieving revision 1.12 diff -u -p -r1.12 gimpimage-preview.c --- app/core/gimpimage-preview.c 29 Aug 2006 14:46:22 -0000 1.12 +++ app/core/gimpimage-preview.c 29 Aug 2006 20:43:07 -0000 @@ -109,6 +109,7 @@ gimp_image_get_popup_size (GimpViewable TempBuf * gimp_image_get_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -134,8 +135,8 @@ gimp_image_get_preview (GimpViewable *vi * This might seem ridiculous, but it's actually the best way, given * a number of unsavory alternatives. */ - image->comp_preview = gimp_image_get_new_preview (viewable, - width, height); + image->comp_preview = gimp_image_get_new_preview (viewable, context, + width, height); image->comp_preview_valid = TRUE; @@ -145,6 +146,7 @@ gimp_image_get_preview (GimpViewable *vi TempBuf * gimp_image_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -284,7 +286,8 @@ gimp_image_get_new_preview (GimpViewable } else { - layer_buf = gimp_viewable_get_preview (GIMP_VIEWABLE (layer), w, h); + layer_buf = gimp_viewable_get_preview (GIMP_VIEWABLE (layer), + context, w, h); g_assert (layer_buf); g_assert (layer_buf->bytes <= comp->bytes); @@ -310,7 +313,7 @@ gimp_image_get_new_preview (GimpViewable else { mask_buf = gimp_viewable_get_preview (GIMP_VIEWABLE (layer->mask), - w, h); + context, w, h); pixel_region_init_temp_buf (&maskPR, mask_buf, x1 - x, y1 - y, src1PR.w, maskPR.h); Index: app/core/gimpimage-preview.h =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpimage-preview.h,v retrieving revision 1.2 diff -u -p -r1.2 gimpimage-preview.h --- app/core/gimpimage-preview.h 17 Jan 2006 12:43:39 -0000 1.2 +++ app/core/gimpimage-preview.h 29 Aug 2006 20:43:07 -0000 @@ -37,11 +37,13 @@ gboolean gimp_image_get_popup_size (G gint *popup_width, gint *popup_height); TempBuf * gimp_image_get_preview (GimpViewable *viewable, + GimpContext *context, + gint width, + gint height); +TempBuf * gimp_image_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); -TempBuf * gimp_image_get_new_preview (GimpViewable *viewable, - gint width, - gint height); #endif /* __GIMP_IMAGE_PREVIEW_H__ */ Index: app/core/gimpimagefile.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpimagefile.c,v retrieving revision 1.91 diff -u -p -r1.91 gimpimagefile.c --- app/core/gimpimagefile.c 8 Aug 2006 21:06:28 -0000 1.91 +++ app/core/gimpimagefile.c 29 Aug 2006 20:43:07 -0000 @@ -64,6 +64,7 @@ static void gimp_imagefile_notify GParamSpec *pspec); static GdkPixbuf * gimp_imagefile_get_new_pixbuf (GimpViewable *viewable, + GimpContext *context, gint width, gint height); static GdkPixbuf * gimp_imagefile_load_thumb (GimpImagefile *imagefile, @@ -438,6 +439,7 @@ gimp_imagefile_notify_thumbnail (GimpIma static GdkPixbuf * gimp_imagefile_get_new_pixbuf (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -758,7 +760,10 @@ gimp_imagefile_save_thumb (GimpImagefile } } - pixbuf = gimp_viewable_get_new_pixbuf (GIMP_VIEWABLE (image), width, height); + pixbuf = gimp_viewable_get_new_pixbuf (GIMP_VIEWABLE (image), + /* random context, unused */ + gimp_get_user_context (image->gimp), + width, height); /* when layer previews are disabled, we won't get a pixbuf */ if (! pixbuf) Index: app/core/gimppalette-import.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimppalette-import.c,v retrieving revision 1.34 diff -u -p -r1.34 gimppalette-import.c --- app/core/gimppalette-import.c 28 May 2006 14:51:05 -0000 1.34 +++ app/core/gimppalette-import.c 29 Aug 2006 20:43:07 -0000 @@ -45,9 +45,11 @@ #include "gimpchannel.h" #include "gimpcontainer.h" +#include "gimpcontext.h" #include "gimpgradient.h" #include "gimpimage.h" #include "gimppalette.h" +#include "gimppalette-import.h" #include "gimppickable.h" #include "gimp-intl.h" @@ -60,6 +62,7 @@ GimpPalette * gimp_palette_import_from_gradient (GimpGradient *gradient, + GimpContext *context, gboolean reverse, const gchar *palette_name, gint n_colors) @@ -71,6 +74,7 @@ gimp_palette_import_from_gradient (GimpG gint i; g_return_val_if_fail (GIMP_IS_GRADIENT (gradient), NULL); + g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (palette_name != NULL, NULL); g_return_val_if_fail (n_colors > 1, NULL); @@ -80,7 +84,8 @@ gimp_palette_import_from_gradient (GimpG for (i = 0, cur_x = 0; i < n_colors; i++, cur_x += dx) { - seg = gimp_gradient_get_color_at (gradient, seg, cur_x, reverse, &color); + seg = gimp_gradient_get_color_at (gradient, context, + seg, cur_x, reverse, &color); gimp_palette_add_entry (palette, -1, NULL, &color); } Index: app/core/gimppalette-import.h =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimppalette-import.h,v retrieving revision 1.7 diff -u -p -r1.7 gimppalette-import.h --- app/core/gimppalette-import.h 28 May 2006 14:51:05 -0000 1.7 +++ app/core/gimppalette-import.h 29 Aug 2006 20:43:07 -0000 @@ -21,6 +21,7 @@ GimpPalette * gimp_palette_import_from_gradient (GimpGradient *gradient, + GimpContext *context, gboolean reverse, const gchar *palette_name, gint n_colors); Index: app/core/gimppalette.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimppalette.c,v retrieving revision 1.66 diff -u -p -r1.66 gimppalette.c --- app/core/gimppalette.c 23 May 2006 15:39:45 -0000 1.66 +++ app/core/gimppalette.c 29 Aug 2006 20:43:07 -0000 @@ -61,6 +61,7 @@ static gboolean gimp_palette_get_popup gint *popup_width, gint *popup_height); static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); static gchar * gimp_palette_get_description (GimpViewable *viewable, @@ -193,6 +194,7 @@ gimp_palette_get_popup_size (GimpViewabl static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { Index: app/core/gimppattern.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimppattern.c,v retrieving revision 1.63 diff -u -p -r1.63 gimppattern.c --- app/core/gimppattern.c 15 May 2006 09:46:14 -0000 1.63 +++ app/core/gimppattern.c 29 Aug 2006 20:43:07 -0000 @@ -64,6 +64,7 @@ static gboolean gimp_pattern_get_size gint *width, gint *height); static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); static gchar * gimp_pattern_get_description (GimpViewable *viewable, @@ -147,6 +148,7 @@ gimp_pattern_get_size (GimpViewable *vie static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { Index: app/core/gimpundo.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpundo.c,v retrieving revision 1.38 diff -u -p -r1.38 gimpundo.c --- app/core/gimpundo.c 13 Jun 2006 02:03:44 -0000 1.38 +++ app/core/gimpundo.c 29 Aug 2006 20:43:07 -0000 @@ -31,6 +31,7 @@ #include "config/gimpcoreconfig.h" #include "gimp.h" +#include "gimpcontext.h" #include "gimpimage.h" #include "gimpmarshal.h" #include "gimpundo.h" @@ -82,6 +83,7 @@ static gboolean gimp_undo_get_popup_siz gint *popup_width, gint *popup_height); static TempBuf * gimp_undo_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); @@ -92,7 +94,8 @@ static void gimp_undo_real_free GimpUndoMode undo_mode); static gboolean gimp_undo_create_preview_idle (gpointer data); -static void gimp_undo_create_preview_private (GimpUndo *undo); +static void gimp_undo_create_preview_private (GimpUndo *undo, + GimpContext *context); G_DEFINE_TYPE (GimpUndo, gimp_undo, GIMP_TYPE_VIEWABLE) @@ -343,6 +346,7 @@ gimp_undo_get_popup_size (GimpViewable * static TempBuf * gimp_undo_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -426,16 +430,18 @@ gimp_undo_free (GimpUndo *undo, } void -gimp_undo_create_preview (GimpUndo *undo, - gboolean create_now) +gimp_undo_create_preview (GimpUndo *undo, + GimpContext *context, + gboolean create_now) { g_return_if_fail (GIMP_IS_UNDO (undo)); + g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context)); if (undo->preview || undo->preview_idle_id) return; if (create_now) - gimp_undo_create_preview_private (undo); + gimp_undo_create_preview_private (undo, context); else undo->preview_idle_id = g_idle_add (gimp_undo_create_preview_idle, undo); } @@ -447,7 +453,7 @@ gimp_undo_create_preview_idle (gpointer if (undo == gimp_undo_stack_peek (undo->image->undo_stack)) { - gimp_undo_create_preview_private (undo); + gimp_undo_create_preview_private (undo, NULL /* FIXME */); } undo->preview_idle_id = 0; @@ -456,7 +462,8 @@ gimp_undo_create_preview_idle (gpointer } static void -gimp_undo_create_preview_private (GimpUndo *undo) +gimp_undo_create_preview_private (GimpUndo *undo, + GimpContext *context) { GimpImage *image = undo->image; GimpViewable *preview_viewable; @@ -498,16 +505,18 @@ gimp_undo_create_preview_private (GimpUn } } - undo->preview = gimp_viewable_get_new_preview (preview_viewable, + undo->preview = gimp_viewable_get_new_preview (preview_viewable, context, width, height); gimp_viewable_invalidate_preview (GIMP_VIEWABLE (undo)); } void -gimp_undo_refresh_preview (GimpUndo *undo) +gimp_undo_refresh_preview (GimpUndo *undo, + GimpContext *context) { g_return_if_fail (GIMP_IS_UNDO (undo)); + g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context)); if (undo->preview_idle_id) return; @@ -516,7 +525,7 @@ gimp_undo_refresh_preview (GimpUndo *und { temp_buf_free (undo->preview); undo->preview = NULL; - gimp_undo_create_preview (undo, FALSE); + gimp_undo_create_preview (undo, context, FALSE); } } Index: app/core/gimpundo.h =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpundo.h,v retrieving revision 1.22 diff -u -p -r1.22 gimpundo.h --- app/core/gimpundo.h 13 Jun 2006 02:03:44 -0000 1.22 +++ app/core/gimpundo.h 29 Aug 2006 20:43:07 -0000 @@ -84,8 +84,10 @@ void gimp_undo_free GimpUndoMode undo_mode); void gimp_undo_create_preview (GimpUndo *undo, + GimpContext *context, gboolean create_now); -void gimp_undo_refresh_preview (GimpUndo *undo); +void gimp_undo_refresh_preview (GimpUndo *undo, + GimpContext *context); const gchar * gimp_undo_type_to_name (GimpUndoType type); Index: app/core/gimpviewable.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpviewable.c,v retrieving revision 1.50 diff -u -p -r1.50 gimpviewable.c --- app/core/gimpviewable.c 15 May 2006 09:46:15 -0000 1.50 +++ app/core/gimpviewable.c 29 Aug 2006 20:43:07 -0000 @@ -32,6 +32,7 @@ #include "base/temp-buf.h" #include "gimp-utils.h" +#include "gimpcontext.h" #include "gimpmarshal.h" #include "gimpviewable.h" @@ -70,6 +71,7 @@ static gint64 gimp_viewable_get_memsize static void gimp_viewable_real_invalidate_preview (GimpViewable *viewable); static GdkPixbuf * gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable, + GimpContext *context, gint width, gint height); static void gimp_viewable_real_get_preview_size (GimpViewable *viewable, @@ -103,6 +105,8 @@ static guint viewable_signals[LAST_SIGN static GQuark quark_preview_temp_buf = 0; static GQuark quark_preview_pixbuf = 0; +static gboolean debug_context = TRUE; + static void gimp_viewable_class_init (GimpViewableClass *klass) @@ -298,13 +302,14 @@ gimp_viewable_real_get_popup_size (GimpV static GdkPixbuf * gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { TempBuf *temp_buf; GdkPixbuf *pixbuf = NULL; - temp_buf = gimp_viewable_get_preview (viewable, width, height); + temp_buf = gimp_viewable_get_preview (viewable, context, width, height); if (temp_buf) { @@ -624,6 +629,7 @@ gimp_viewable_get_popup_size (GimpViewab /** * gimp_viewable_get_preview: * @viewable: The viewable object to get a preview for. + * @context: The context to render the preview for. * @width: desired width for the preview * @height: desired height for the preview * @@ -642,6 +648,7 @@ gimp_viewable_get_popup_size (GimpViewab **/ TempBuf * gimp_viewable_get_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -649,13 +656,17 @@ gimp_viewable_get_preview (GimpViewable TempBuf *temp_buf = NULL; g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL); + g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (width > 0, NULL); g_return_val_if_fail (height > 0, NULL); + if (debug_context && context == NULL) + g_warning ("%s: context is NULL", G_STRFUNC); + viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable); if (viewable_class->get_preview) - temp_buf = viewable_class->get_preview (viewable, width, height); + temp_buf = viewable_class->get_preview (viewable, context, width, height); if (temp_buf) return temp_buf; @@ -670,7 +681,8 @@ gimp_viewable_get_preview (GimpViewable temp_buf = NULL; if (viewable_class->get_new_preview) - temp_buf = viewable_class->get_new_preview (viewable, width, height); + temp_buf = viewable_class->get_new_preview (viewable, context, + width, height); g_object_set_qdata_full (G_OBJECT (viewable), quark_preview_temp_buf, temp_buf, @@ -696,6 +708,7 @@ gimp_viewable_get_preview (GimpViewable **/ TempBuf * gimp_viewable_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -703,19 +716,25 @@ gimp_viewable_get_new_preview (GimpViewa TempBuf *temp_buf = NULL; g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL); + g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (width > 0, NULL); g_return_val_if_fail (height > 0, NULL); + if (debug_context && context == NULL) + g_warning ("%s: context is NULL", G_STRFUNC); + viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable); if (viewable_class->get_new_preview) - temp_buf = viewable_class->get_new_preview (viewable, width, height); + temp_buf = viewable_class->get_new_preview (viewable, context, + width, height); if (temp_buf) return temp_buf; if (viewable_class->get_preview) - temp_buf = viewable_class->get_preview (viewable, width, height); + temp_buf = viewable_class->get_preview (viewable, context, + width, height); if (temp_buf) return temp_buf_copy (temp_buf, NULL); @@ -776,6 +795,7 @@ gimp_viewable_get_dummy_preview (GimpVie /** * gimp_viewable_get_pixbuf: * @viewable: The viewable object to get a pixbuf preview for. + * @context: The context to render the preview for. * @width: desired width for the preview * @height: desired height for the preview * @@ -794,6 +814,7 @@ gimp_viewable_get_dummy_preview (GimpVie **/ GdkPixbuf * gimp_viewable_get_pixbuf (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -801,13 +822,17 @@ gimp_viewable_get_pixbuf (GimpViewable * GdkPixbuf *pixbuf = NULL; g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL); + g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (width > 0, NULL); g_return_val_if_fail (height > 0, NULL); + if (debug_context && context == NULL) + g_warning ("%s: context is NULL", G_STRFUNC); + viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable); if (viewable_class->get_pixbuf) - pixbuf = viewable_class->get_pixbuf (viewable, width, height); + pixbuf = viewable_class->get_pixbuf (viewable, context, width, height); if (pixbuf) return pixbuf; @@ -822,7 +847,7 @@ gimp_viewable_get_pixbuf (GimpViewable * pixbuf = NULL; if (viewable_class->get_new_pixbuf) - pixbuf = viewable_class->get_new_pixbuf (viewable, width, height); + pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height); g_object_set_qdata_full (G_OBJECT (viewable), quark_preview_pixbuf, pixbuf, @@ -834,6 +859,7 @@ gimp_viewable_get_pixbuf (GimpViewable * /** * gimp_viewable_get_new_pixbuf: * @viewable: The viewable object to get a new pixbuf preview for. + * @context: The context to render the preview for. * @width: desired width for the pixbuf * @height: desired height for the pixbuf * @@ -848,6 +874,7 @@ gimp_viewable_get_pixbuf (GimpViewable * **/ GdkPixbuf * gimp_viewable_get_new_pixbuf (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { @@ -855,19 +882,23 @@ gimp_viewable_get_new_pixbuf (GimpViewab GdkPixbuf *pixbuf = NULL; g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL); + g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (width > 0, NULL); g_return_val_if_fail (height > 0, NULL); + if (debug_context && context == NULL) + g_warning ("%s: context is NULL", G_STRFUNC); + viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable); if (viewable_class->get_new_pixbuf) - pixbuf = viewable_class->get_new_pixbuf (viewable, width, height); + pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height); if (pixbuf) return pixbuf; if (viewable_class->get_pixbuf) - pixbuf = viewable_class->get_pixbuf (viewable, width, height); + pixbuf = viewable_class->get_pixbuf (viewable, context, width, height); if (pixbuf) return gdk_pixbuf_copy (pixbuf); Index: app/core/gimpviewable.h =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpviewable.h,v retrieving revision 1.22 diff -u -p -r1.22 gimpviewable.h --- app/core/gimpviewable.h 15 Aug 2006 17:10:41 -0000 1.22 +++ app/core/gimpviewable.h 29 Aug 2006 20:43:07 -0000 @@ -80,15 +80,19 @@ struct _GimpViewableClass gint *popup_width, gint *popup_height); TempBuf * (* get_preview) (GimpViewable *viewable, + GimpContext *context, gint width, gint height); TempBuf * (* get_new_preview) (GimpViewable *viewable, + GimpContext *context, gint width, gint height); GdkPixbuf * (* get_pixbuf) (GimpViewable *viewable, + GimpContext *context, gint width, gint height); GdkPixbuf * (* get_new_pixbuf) (GimpViewable *viewable, + GimpContext *context, gint width, gint height); gchar * (* get_description) (GimpViewable *viewable, @@ -129,9 +133,11 @@ gboolean gimp_viewable_get_popup_size gint *popup_height); TempBuf * gimp_viewable_get_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); TempBuf * gimp_viewable_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); @@ -141,9 +147,11 @@ TempBuf * gimp_viewable_get_dummy_prev gint bpp); GdkPixbuf * gimp_viewable_get_pixbuf (GimpViewable *viewable, + GimpContext *context, gint width, gint height); GdkPixbuf * gimp_viewable_get_new_pixbuf (GimpViewable *viewable, + GimpContext *context, gint width, gint height); Index: app/dialogs/dialogs-constructors.c =================================================================== RCS file: /cvs/gnome/gimp/app/dialogs/dialogs-constructors.c,v retrieving revision 1.179 diff -u -p -r1.179 dialogs-constructors.c --- app/dialogs/dialogs-constructors.c 28 May 2006 19:45:52 -0000 1.179 +++ app/dialogs/dialogs-constructors.c 29 Aug 2006 20:43:07 -0000 @@ -673,7 +673,7 @@ dialogs_brush_editor_get (GimpDialogFact GimpContext *context, gint view_size) { - return gimp_brush_editor_new (context->gimp, + return gimp_brush_editor_new (context, factory->menu_factory); } @@ -682,7 +682,7 @@ dialogs_gradient_editor_get (GimpDialogF GimpContext *context, gint view_size) { - return gimp_gradient_editor_new (context->gimp, + return gimp_gradient_editor_new (context, factory->menu_factory); } @@ -691,7 +691,7 @@ dialogs_palette_editor_get (GimpDialogFa GimpContext *context, gint view_size) { - return gimp_palette_editor_new (context->gimp, + return gimp_palette_editor_new (context, factory->menu_factory); } Index: app/dialogs/palette-import-dialog.c =================================================================== RCS file: /cvs/gnome/gimp/app/dialogs/palette-import-dialog.c,v retrieving revision 1.83 diff -u -p -r1.83 palette-import-dialog.c --- app/dialogs/palette-import-dialog.c 11 Aug 2006 12:56:25 -0000 1.83 +++ app/dialogs/palette-import-dialog.c 29 Aug 2006 20:43:07 -0000 @@ -396,7 +396,8 @@ palette_import_dialog_new (Gimp *gimp) gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0); gtk_widget_show (abox); - dialog->preview = gimp_view_new_full_by_types (GIMP_TYPE_VIEW, + dialog->preview = gimp_view_new_full_by_types (gimp_get_user_context (gimp), + GIMP_TYPE_VIEW, GIMP_TYPE_PALETTE, 192, 192, 1, TRUE, FALSE, FALSE); @@ -795,6 +796,7 @@ palette_import_make_palette (ImportDialo gradient = gimp_context_get_gradient (dialog->context); palette = gimp_palette_import_from_gradient (gradient, + dialog->context, FALSE, palette_name, n_colors); Index: app/dialogs/resize-dialog.c =================================================================== RCS file: /cvs/gnome/gimp/app/dialogs/resize-dialog.c,v retrieving revision 1.116 diff -u -p -r1.116 resize-dialog.c --- app/dialogs/resize-dialog.c 19 May 2006 14:50:44 -0000 1.116 +++ app/dialogs/resize-dialog.c 29 Aug 2006 20:43:07 -0000 @@ -25,6 +25,7 @@ #include "dialogs-types.h" +#include "core/gimp.h" #include "core/gimpimage.h" #include "core/gimplayer.h" @@ -259,7 +260,9 @@ resize_dialog_new (GimpViewable *v gtk_widget_show (private->area); gimp_viewable_get_preview_size (viewable, 200, FALSE, TRUE, &width, &height); - pixbuf = gimp_viewable_get_pixbuf (viewable, width, height); + pixbuf = gimp_viewable_get_pixbuf (viewable, + gimp_get_user_context (image->gimp), + width, height); if (pixbuf) gimp_offset_area_set_pixbuf (GIMP_OFFSET_AREA (private->area), pixbuf); Index: app/display/gimpdisplayshell-layer-select.c =================================================================== RCS file: /cvs/gnome/gimp/app/display/gimpdisplayshell-layer-select.c,v retrieving revision 1.58 diff -u -p -r1.58 gimpdisplayshell-layer-select.c --- app/display/gimpdisplayshell-layer-select.c 12 Apr 2006 12:49:21 -0000 1.58 +++ app/display/gimpdisplayshell-layer-select.c 29 Aug 2006 20:43:07 -0000 @@ -149,9 +149,11 @@ layer_select_new (GimpImage *image, gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0); gtk_widget_show (alignment); - layer_select->view = gimp_view_new_by_types (GIMP_TYPE_VIEW, - GIMP_TYPE_LAYER, - view_size, 1, FALSE); + layer_select->view = + gimp_view_new_by_types (gimp_get_user_context (image->gimp), + GIMP_TYPE_VIEW, + GIMP_TYPE_LAYER, + view_size, 1, FALSE); gimp_view_set_viewable (GIMP_VIEW (layer_select->view), GIMP_VIEWABLE (layer)); gtk_container_add (GTK_CONTAINER (alignment), layer_select->view); Index: app/display/gimpdisplayshell.c =================================================================== RCS file: /cvs/gnome/gimp/app/display/gimpdisplayshell.c,v retrieving revision 1.392 diff -u -p -r1.392 gimpdisplayshell.c --- app/display/gimpdisplayshell.c 29 Jun 2006 09:42:05 -0000 1.392 +++ app/display/gimpdisplayshell.c 29 Aug 2006 20:43:07 -0000 @@ -1444,14 +1444,17 @@ gimp_display_shell_resume (GimpDisplaySh void gimp_display_shell_update_icon (GimpDisplayShell *shell) { + GimpImage *image; GdkPixbuf *pixbuf; gint width, height; gdouble factor; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - factor = ((gdouble) gimp_image_get_height (shell->display->image) / - (gdouble) gimp_image_get_width (shell->display->image)); + image = shell->display->image; + + factor = ((gdouble) gimp_image_get_height (image) / + (gdouble) gimp_image_get_width (image)); if (factor >= 1) { @@ -1464,7 +1467,8 @@ gimp_display_shell_update_icon (GimpDisp width = MAX (shell->icon_size, 1); } - pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (shell->display->image), + pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image), + gimp_get_user_context (image->gimp), width, height); gtk_window_set_icon (GTK_WINDOW (shell), pixbuf); Index: app/display/gimpnavigationeditor.c =================================================================== RCS file: /cvs/gnome/gimp/app/display/gimpnavigationeditor.c,v retrieving revision 1.129 diff -u -p -r1.129 gimpnavigationeditor.c --- app/display/gimpnavigationeditor.c 29 Aug 2006 08:42:42 -0000 1.129 +++ app/display/gimpnavigationeditor.c 29 Aug 2006 20:43:07 -0000 @@ -55,20 +55,21 @@ #define MAX_SCALE_BUF 20 -static void gimp_navigation_editor_docked_iface_init (GimpDockedInterface *iface); -static void gimp_navigation_editor_set_context (GimpDocked *docked, - GimpContext *context); +static void gimp_navigation_editor_docked_iface_init (GimpDockedInterface *iface); -static void gimp_navigation_editor_destroy (GtkObject *object); +static void gimp_navigation_editor_destroy (GtkObject *object); -static GtkWidget * gimp_navigation_editor_new_private (GimpMenuFactory *menu_factory, - GimpDisplayShell *shell); +static void gimp_navigation_editor_set_context (GimpDocked *docked, + GimpContext *context); + +static GtkWidget * gimp_navigation_editor_new_private (GimpMenuFactory *menu_factory, + GimpDisplayShell *shell); static void gimp_navigation_editor_set_shell (GimpNavigationEditor *view, GimpDisplayShell *shell); -static gboolean gimp_navigation_editor_button_release (GtkWidget *widget, - GdkEventButton *bevent, - GimpDisplayShell *shell); +static gboolean gimp_navigation_editor_button_release (GtkWidget *widget, + GdkEventButton *bevent, + GimpDisplayShell *shell); static void gimp_navigation_editor_marker_changed (GimpNavigationView *view, gdouble x, gdouble y, @@ -109,18 +110,26 @@ gimp_navigation_editor_class_init (GimpN } static void +gimp_navigation_editor_docked_iface_init (GimpDockedInterface *iface) +{ + iface->set_context = gimp_navigation_editor_set_context; +} + +static void gimp_navigation_editor_init (GimpNavigationEditor *editor) { GtkWidget *frame; - editor->shell = NULL; + editor->context = NULL; + editor->shell = NULL; frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0); gtk_widget_show (frame); - editor->view = gimp_view_new_by_types (GIMP_TYPE_NAVIGATION_VIEW, + editor->view = gimp_view_new_by_types (NULL, + GIMP_TYPE_NAVIGATION_VIEW, GIMP_TYPE_IMAGE, GIMP_VIEW_SIZE_MEDIUM, 0, TRUE); gtk_container_add (GTK_CONTAINER (frame), editor->view); @@ -140,9 +149,14 @@ gimp_navigation_editor_init (GimpNavigat } static void -gimp_navigation_editor_docked_iface_init (GimpDockedInterface *iface) +gimp_navigation_editor_destroy (GtkObject *object) { - iface->set_context = gimp_navigation_editor_set_context; + GimpNavigationEditor *editor = GIMP_NAVIGATION_EDITOR (object); + + if (editor->shell) + gimp_navigation_editor_set_shell (editor, NULL); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void @@ -184,23 +198,15 @@ gimp_navigation_editor_set_context (Gimp display = gimp_context_get_display (context); } + gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer, + context); + if (display) shell = GIMP_DISPLAY_SHELL (display->shell); gimp_navigation_editor_set_shell (editor, shell); } -static void -gimp_navigation_editor_destroy (GtkObject *object) -{ - GimpNavigationEditor *editor = GIMP_NAVIGATION_EDITOR (object); - - if (editor->shell) - gimp_navigation_editor_set_shell (editor, NULL); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - /* public functions */ @@ -330,8 +336,11 @@ gimp_navigation_editor_new_private (Gimp gimp_view_renderer_set_size (view->renderer, config->nav_preview_size * 3, view->renderer->border_width); + gimp_view_renderer_set_context (view->renderer, + gimp_get_user_context (shell->display->image->gimp)); gimp_navigation_editor_set_shell (editor, shell); + } else { Index: app/paint/gimppaintoptions.c =================================================================== RCS file: /cvs/gnome/gimp/app/paint/gimppaintoptions.c,v retrieving revision 1.33 diff -u -p -r1.33 gimppaintoptions.c --- app/paint/gimppaintoptions.c 15 May 2006 09:46:17 -0000 1.33 +++ app/paint/gimppaintoptions.c 29 Aug 2006 20:43:07 -0000 @@ -626,7 +626,8 @@ gimp_paint_options_get_gradient_color (G if (pressure_options->color) { - gimp_gradient_get_color_at (gradient, NULL, pressure, + gimp_gradient_get_color_at (gradient, GIMP_CONTEXT (paint_options), + NULL, pressure, gradient_options->gradient_reverse, color); @@ -670,7 +671,8 @@ gimp_paint_options_get_gradient_color (G else pos = pos - (gint) pos; - gimp_gradient_get_color_at (gradient, NULL, pos, + gimp_gradient_get_color_at (gradient, GIMP_CONTEXT (paint_options), + NULL, pos, gradient_options->gradient_reverse, color); Index: app/pdb/drawable_cmds.c =================================================================== RCS file: /cvs/gnome/gimp/app/pdb/drawable_cmds.c,v retrieving revision 1.115 diff -u -p -r1.115 drawable_cmds.c --- app/pdb/drawable_cmds.c 8 Aug 2006 14:45:39 -0000 1.115 +++ app/pdb/drawable_cmds.c 29 Aug 2006 20:43:07 -0000 @@ -1011,7 +1011,7 @@ drawable_thumbnail_invoker (GimpProcedur width = MAX (1, (height * dwidth) / dheight); if (image->gimp->config->layer_previews) - buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), + buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context, width, height); else buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable), Index: app/pdb/gradient_cmds.c =================================================================== RCS file: /cvs/gnome/gimp/app/pdb/gradient_cmds.c,v retrieving revision 1.39 diff -u -p -r1.39 gradient_cmds.c --- app/pdb/gradient_cmds.c 8 Aug 2006 21:06:31 -0000 1.39 +++ app/pdb/gradient_cmds.c 29 Aug 2006 20:43:07 -0000 @@ -314,7 +314,8 @@ gradient_get_uniform_samples_invoker (Gi { GimpRGB color; - seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color); + seg = gimp_gradient_get_color_at (gradient, context, seg, + pos, reverse, &color); *sample++ = color.r; *sample++ = color.g; @@ -378,7 +379,8 @@ gradient_get_custom_samples_invoker (Gim { GimpRGB color; - seg = gimp_gradient_get_color_at (gradient, seg, *positions, + seg = gimp_gradient_get_color_at (gradient, context, + seg, *positions, reverse, &color); *sample++ = color.r; @@ -1072,7 +1074,7 @@ gradient_segment_range_split_midpoint_in if (start_seg && GIMP_DATA (gradient)->writable) { - gimp_gradient_segment_range_split_midpoint (gradient, + gimp_gradient_segment_range_split_midpoint (gradient, context, start_seg, end_seg, NULL, NULL); } @@ -1112,7 +1114,7 @@ gradient_segment_range_split_uniform_inv if (start_seg && GIMP_DATA (gradient)->writable) { - gimp_gradient_segment_range_split_uniform (gradient, + gimp_gradient_segment_range_split_uniform (gradient, context, start_seg, end_seg, split_parts, NULL, NULL); Index: app/pdb/gradients_cmds.c =================================================================== RCS file: /cvs/gnome/gimp/app/pdb/gradients_cmds.c,v retrieving revision 1.70 diff -u -p -r1.70 gradients_cmds.c --- app/pdb/gradients_cmds.c 18 May 2006 17:25:11 -0000 1.70 +++ app/pdb/gradients_cmds.c 29 Aug 2006 20:43:07 -0000 @@ -116,7 +116,8 @@ gradients_sample_uniform_invoker (GimpPr while (num_samples--) { - seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color); + seg = gimp_gradient_get_color_at (gradient, context, seg, + pos, reverse, &color); *pv++ = color.r; *pv++ = color.g; @@ -172,8 +173,8 @@ gradients_sample_custom_invoker (GimpPro while (num_samples--) { - seg = gimp_gradient_get_color_at (gradient, seg, *positions, - reverse, &color); + seg = gimp_gradient_get_color_at (gradient, context, seg, + *positions, reverse, &color); *pv++ = color.r; *pv++ = color.g; @@ -251,7 +252,8 @@ gradients_get_gradient_data_invoker (Gim while (sample_size) { - seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color); + seg = gimp_gradient_get_color_at (gradient, context, seg, + pos, reverse, &color); *pv++ = color.r; *pv++ = color.g; Index: app/pdb/image_cmds.c =================================================================== RCS file: /cvs/gnome/gimp/app/pdb/image_cmds.c,v retrieving revision 1.155 diff -u -p -r1.155 image_cmds.c --- app/pdb/image_cmds.c 8 Aug 2006 21:06:32 -0000 1.155 +++ app/pdb/image_cmds.c 29 Aug 2006 20:43:07 -0000 @@ -1434,7 +1434,7 @@ image_thumbnail_invoker (GimpProcedure width = MAX (1, (height * dwidth) / dheight); if (image->gimp->config->layer_previews) - buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (image), + buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (image), context, width, height); else buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (image), Index: app/text/gimpfont.c =================================================================== RCS file: /cvs/gnome/gimp/app/text/gimpfont.c,v retrieving revision 1.21 diff -u -p -r1.21 gimpfont.c --- app/text/gimpfont.c 15 May 2006 09:46:19 -0000 1.21 +++ app/text/gimpfont.c 29 Aug 2006 20:43:07 -0000 @@ -88,6 +88,7 @@ static gboolean gimp_font_get_popup_siz gint *popup_width, gint *popup_height); static TempBuf * gimp_font_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); @@ -227,6 +228,7 @@ gimp_font_get_popup_size (GimpViewable * static TempBuf * gimp_font_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { Index: app/tools/gimpeditselectiontool.c =================================================================== RCS file: /cvs/gnome/gimp/app/tools/gimpeditselectiontool.c,v retrieving revision 1.152 diff -u -p -r1.152 gimpeditselectiontool.c --- app/tools/gimpeditselectiontool.c 15 Aug 2006 21:15:49 -0000 1.152 +++ app/tools/gimpeditselectiontool.c 29 Aug 2006 20:43:07 -0000 @@ -1254,7 +1254,8 @@ gimp_edit_selection_tool_key_press (Gimp if (push_undo) gimp_image_undo_group_end (display->image); else - gimp_undo_refresh_preview (undo); + gimp_undo_refresh_preview (undo, + gimp_get_user_context (display->image->gimp)); gimp_image_flush (display->image); Index: app/tools/gimptexttool.c =================================================================== RCS file: /cvs/gnome/gimp/app/tools/gimptexttool.c,v retrieving revision 1.264 diff -u -p -r1.264 gimptexttool.c --- app/tools/gimptexttool.c 28 Aug 2006 15:26:23 -0000 1.264 +++ app/tools/gimptexttool.c 29 Aug 2006 20:43:07 -0000 @@ -552,7 +552,8 @@ gimp_text_tool_apply (GimpTextTool *text { push_undo = FALSE; undo->time = now; - gimp_undo_refresh_preview (undo); + gimp_undo_refresh_preview (undo, + gimp_get_user_context (image->gimp)); } } } Index: app/vectors/gimpvectors-preview.c =================================================================== RCS file: /cvs/gnome/gimp/app/vectors/gimpvectors-preview.c,v retrieving revision 1.7 diff -u -p -r1.7 gimpvectors-preview.c --- app/vectors/gimpvectors-preview.c 28 Mar 2006 17:08:34 -0000 1.7 +++ app/vectors/gimpvectors-preview.c 29 Aug 2006 20:43:07 -0000 @@ -37,6 +37,7 @@ TempBuf * gimp_vectors_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height) { Index: app/vectors/gimpvectors-preview.h =================================================================== RCS file: /cvs/gnome/gimp/app/vectors/gimpvectors-preview.h,v retrieving revision 1.2 diff -u -p -r1.2 gimpvectors-preview.h --- app/vectors/gimpvectors-preview.h 10 Sep 2003 13:05:00 -0000 1.2 +++ app/vectors/gimpvectors-preview.h 29 Aug 2006 20:43:07 -0000 @@ -25,6 +25,7 @@ */ TempBuf * gimp_vectors_get_new_preview (GimpViewable *viewable, + GimpContext *context, gint width, gint height); Index: app/widgets/gimpaction.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpaction.c,v retrieving revision 1.19 diff -u -p -r1.19 gimpaction.c --- app/widgets/gimpaction.c 16 May 2006 19:55:01 -0000 1.19 +++ app/widgets/gimpaction.c 29 Aug 2006 20:43:07 -0000 @@ -327,7 +327,8 @@ gimp_action_set_proxy (GimpAction *actio gtk_icon_size_lookup_for_settings (settings, size, &width, &height); - view = gimp_view_new_full (action->viewable, + view = gimp_view_new_full (NULL /* FIXME */, + action->viewable, width, height, border_width, FALSE, FALSE, FALSE); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), view); Index: app/widgets/gimpbrusheditor.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpbrusheditor.c,v retrieving revision 1.75 diff -u -p -r1.75 gimpbrusheditor.c --- app/widgets/gimpbrusheditor.c 15 May 2006 09:46:24 -0000 1.75 +++ app/widgets/gimpbrusheditor.c 29 Aug 2006 20:43:07 -0000 @@ -36,6 +36,7 @@ #include "gimpbrusheditor.h" #include "gimpdocked.h" #include "gimpview.h" +#include "gimpviewrenderer.h" #include "gimp-intl.h" @@ -46,6 +47,8 @@ /* local function prototypes */ +static void gimp_brush_editor_docked_iface_init (GimpDockedInterface *face); + static GObject * gimp_brush_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -53,6 +56,9 @@ static GObject * gimp_brush_editor_const static void gimp_brush_editor_set_data (GimpDataEditor *editor, GimpData *data); +static void gimp_brush_editor_set_context (GimpDocked *docked, + GimpContext *context); + static void gimp_brush_editor_update_brush (GtkAdjustment *adjustment, GimpBrushEditor *editor); static void gimp_brush_editor_update_shape (GtkWidget *widget, @@ -62,10 +68,15 @@ static void gimp_brush_editor_notify_b GimpBrushEditor *editor); -G_DEFINE_TYPE (GimpBrushEditor, gimp_brush_editor, GIMP_TYPE_DATA_EDITOR) +G_DEFINE_TYPE_WITH_CODE (GimpBrushEditor, gimp_brush_editor, + GIMP_TYPE_DATA_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_brush_editor_docked_iface_init)) #define parent_class gimp_brush_editor_parent_class +static GimpDockedInterface *parent_docked_iface = NULL; + static void gimp_brush_editor_class_init (GimpBrushEditorClass *klass) @@ -80,6 +91,17 @@ gimp_brush_editor_class_init (GimpBrushE } static void +gimp_brush_editor_docked_iface_init (GimpDockedInterface *iface) +{ + parent_docked_iface = g_type_interface_peek_parent (iface); + + if (! parent_docked_iface) + parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); + + iface->set_context = gimp_brush_editor_set_context; +} + +static void gimp_brush_editor_init (GimpBrushEditor *editor) { GtkWidget *frame; @@ -91,7 +113,8 @@ gimp_brush_editor_init (GimpBrushEditor gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0); gtk_widget_show (frame); - editor->view = gimp_view_new_full_by_types (GIMP_TYPE_VIEW, + editor->view = gimp_view_new_full_by_types (NULL, + GIMP_TYPE_VIEW, GIMP_TYPE_BRUSH, BRUSH_VIEW_WIDTH, BRUSH_VIEW_HEIGHT, 0, @@ -274,25 +297,34 @@ gimp_brush_editor_set_data (GimpDataEdit gtk_adjustment_set_value (brush_editor->spacing_data, spacing); } +static void +gimp_brush_editor_set_context (GimpDocked *docked, + GimpContext *context) +{ + GimpBrushEditor *editor = GIMP_BRUSH_EDITOR (docked); + + parent_docked_iface->set_context (docked, context); + + gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer, + context); +} + /* public functions */ GtkWidget * -gimp_brush_editor_new (Gimp *gimp, +gimp_brush_editor_new (GimpContext *context, GimpMenuFactory *menu_factory) { - GimpBrush *brush; - - g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); - - brush = gimp_context_get_brush (gimp_get_user_context (gimp)); + g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); return g_object_new (GIMP_TYPE_BRUSH_EDITOR, "menu-factory", menu_factory, "menu-identifier", "", "ui-path", "/brush-editor-popup", - "data-factory", gimp->brush_factory, - "data", brush, + "data-factory", context->gimp->brush_factory, + "context", context, + "data", gimp_context_get_brush (context), NULL); } Index: app/widgets/gimpbrusheditor.h =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpbrusheditor.h,v retrieving revision 1.19 diff -u -p -r1.19 gimpbrusheditor.h --- app/widgets/gimpbrusheditor.h 17 Jan 2006 10:08:48 -0000 1.19 +++ app/widgets/gimpbrusheditor.h 29 Aug 2006 20:43:07 -0000 @@ -60,7 +60,7 @@ struct _GimpBrushEditorClass GType gimp_brush_editor_get_type (void) G_GNUC_CONST; -GtkWidget * gimp_brush_editor_new (Gimp *gimp, +GtkWidget * gimp_brush_editor_new (GimpContext *context, GimpMenuFactory *menu_factory); Index: app/widgets/gimpbufferview.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpbufferview.c,v retrieving revision 1.46 diff -u -p -r1.46 gimpbufferview.c --- app/widgets/gimpbufferview.c 15 May 2006 09:46:24 -0000 1.46 +++ app/widgets/gimpbufferview.c 29 Aug 2006 20:43:07 -0000 @@ -36,6 +36,7 @@ #include "gimpcontainerview.h" #include "gimpbufferview.h" #include "gimpdnd.h" +#include "gimpdocked.h" #include "gimpeditor.h" #include "gimphelp-ids.h" #include "gimpview.h" @@ -45,20 +46,30 @@ #include "gimp-intl.h" -static void gimp_buffer_view_activate_item (GimpContainerEditor *editor, - GimpViewable *viewable); +static void gimp_buffer_view_docked_iface_init (GimpDockedInterface *iface); -static void gimp_buffer_view_buffer_changed (Gimp *gimp, - GimpBufferView *buffer_view); -static void gimp_buffer_view_view_notify (GimpContainerView *view, - GParamSpec *pspec, - GimpBufferView *buffer_view); +static void gimp_buffer_view_set_context (GimpDocked *docked, + GimpContext *context); +static void gimp_buffer_view_activate_item (GimpContainerEditor *editor, + GimpViewable *viewable); -G_DEFINE_TYPE (GimpBufferView, gimp_buffer_view, GIMP_TYPE_CONTAINER_EDITOR) +static void gimp_buffer_view_buffer_changed (Gimp *gimp, + GimpBufferView *buffer_view); +static void gimp_buffer_view_view_notify (GimpContainerView *view, + GParamSpec *pspec, + GimpBufferView *buffer_view); + + +G_DEFINE_TYPE_WITH_CODE (GimpBufferView, gimp_buffer_view, + GIMP_TYPE_CONTAINER_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_buffer_view_docked_iface_init)) #define parent_class gimp_buffer_view_parent_class +static GimpDockedInterface *parent_docked_iface = NULL; + static void gimp_buffer_view_class_init (GimpBufferViewClass *klass) @@ -69,6 +80,17 @@ gimp_buffer_view_class_init (GimpBufferV } static void +gimp_buffer_view_docked_iface_init (GimpDockedInterface *iface) +{ + parent_docked_iface = g_type_interface_peek_parent (iface); + + if (! parent_docked_iface) + parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); + + iface->set_context = gimp_buffer_view_set_context; +} + +static void gimp_buffer_view_init (GimpBufferView *view) { view->paste_button = NULL; @@ -77,6 +99,21 @@ gimp_buffer_view_init (GimpBufferView *v view->delete_button = NULL; } +static void +gimp_buffer_view_set_context (GimpDocked *docked, + GimpContext *context) +{ + GimpBufferView *view = GIMP_BUFFER_VIEW (docked); + + parent_docked_iface->set_context (docked, context); + + gimp_view_renderer_set_context (GIMP_VIEW (view->global_view)->renderer, + context); +} + + +/* public functions */ + GtkWidget * gimp_buffer_view_new (GimpViewType view_type, GimpContainer *container, @@ -117,7 +154,8 @@ gimp_buffer_view_new (GimpViewType v gtk_widget_show (hbox); buffer_view->global_view = - gimp_view_new_full_by_types (GIMP_TYPE_VIEW, + gimp_view_new_full_by_types (NULL, + GIMP_TYPE_VIEW, GIMP_TYPE_BUFFER, view_size, view_size, view_border_width, FALSE, FALSE, TRUE); @@ -176,6 +214,9 @@ gimp_buffer_view_new (GimpViewType v return GTK_WIDGET (buffer_view); } + + +/* private functions */ static void gimp_buffer_view_activate_item (GimpContainerEditor *editor, Index: app/widgets/gimpcellrendererviewable.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcellrendererviewable.c,v retrieving revision 1.22 diff -u -p -r1.22 gimpcellrendererviewable.c --- app/widgets/gimpcellrendererviewable.c 15 May 2006 09:46:24 -0000 1.22 +++ app/widgets/gimpcellrendererviewable.c 29 Aug 2006 20:43:07 -0000 @@ -333,6 +333,7 @@ gimp_cell_renderer_viewable_clicked (Gim { gimp_view_popup_show (gtk_get_event_widget (event), bevent, + cell->renderer->context, cell->renderer->viewable, cell->renderer->width, cell->renderer->height, Index: app/widgets/gimpchanneltreeview.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpchanneltreeview.c,v retrieving revision 1.75 diff -u -p -r1.75 gimpchanneltreeview.c --- app/widgets/gimpchanneltreeview.c 15 May 2006 09:46:24 -0000 1.75 +++ app/widgets/gimpchanneltreeview.c 29 Aug 2006 20:43:07 -0000 @@ -125,11 +125,6 @@ gimp_channel_tree_view_class_init (GimpC } static void -gimp_channel_tree_view_init (GimpChannelTreeView *view) -{ -} - -static void gimp_channel_tree_view_view_iface_init (GimpContainerViewInterface *view_iface) { parent_view_iface = g_type_interface_peek_parent (view_iface); @@ -143,6 +138,11 @@ gimp_channel_tree_view_docked_iface_init parent_docked_iface = g_type_interface_peek_parent (docked_iface); docked_iface->set_context = gimp_channel_tree_view_set_context; +} + +static void +gimp_channel_tree_view_init (GimpChannelTreeView *view) +{ } static GObject * Index: app/widgets/gimpclipboard.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpclipboard.c,v retrieving revision 1.21 diff -u -p -r1.21 gimpclipboard.c --- app/widgets/gimpclipboard.c 15 Apr 2006 16:49:59 -0000 1.21 +++ app/widgets/gimpclipboard.c 29 Aug 2006 20:43:07 -0000 @@ -693,6 +693,7 @@ gimp_clipboard_send_buffer (GtkClipboard gimp_set_busy (gimp); pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (gimp_clip->buffer), + gimp_get_user_context (gimp), gimp_buffer_get_width (gimp_clip->buffer), gimp_buffer_get_height (gimp_clip->buffer)); Index: app/widgets/gimpcoloreditor.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcoloreditor.c,v retrieving revision 1.27 diff -u -p -r1.27 gimpcoloreditor.c --- app/widgets/gimpcoloreditor.c 7 Jul 2006 11:19:51 -0000 1.27 +++ app/widgets/gimpcoloreditor.c 29 Aug 2006 20:43:07 -0000 @@ -68,6 +68,9 @@ static void gimp_color_editor_style_se static void gimp_color_editor_set_aux_info (GimpDocked *docked, GList *aux_info); static GList *gimp_color_editor_get_aux_info (GimpDocked *docked); +static GtkWidget *gimp_color_editor_get_preview (GimpDocked *docked, + GimpContext *context, + GtkIconSize size); static void gimp_color_editor_set_context (GimpDocked *docked, GimpContext *context); @@ -124,6 +127,20 @@ gimp_color_editor_class_init (GimpColorE } static void +gimp_color_editor_docked_iface_init (GimpDockedInterface *iface) +{ + parent_docked_iface = g_type_interface_peek_parent (iface); + + if (! parent_docked_iface) + parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); + + iface->get_preview = gimp_color_editor_get_preview; + iface->set_aux_info = gimp_color_editor_set_aux_info; + iface->get_aux_info = gimp_color_editor_get_aux_info; + iface->set_context = gimp_color_editor_set_context; +} + +static void gimp_color_editor_init (GimpColorEditor *editor) { GtkWidget *notebook; @@ -317,20 +334,6 @@ gimp_color_editor_get_preview (GimpDocke return preview; } -static void -gimp_color_editor_docked_iface_init (GimpDockedInterface *iface) -{ - parent_docked_iface = g_type_interface_peek_parent (iface); - - if (! parent_docked_iface) - parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); - - iface->get_preview = gimp_color_editor_get_preview; - iface->set_aux_info = gimp_color_editor_set_aux_info; - iface->get_aux_info = gimp_color_editor_get_aux_info; - iface->set_context = gimp_color_editor_set_context; -} - #define AUX_INFO_CURRENT_PAGE "current-page" static void @@ -415,14 +418,15 @@ gimp_color_editor_set_context (GimpDocke editor); g_object_unref (editor->context); - editor->context = NULL; } - if (context) + editor->context = context; + + if (editor->context) { GimpRGB rgb; - editor->context = g_object_ref (context); + g_object_ref (editor->context); g_signal_connect (editor->context, "foreground-changed", G_CALLBACK (gimp_color_editor_fg_changed), Index: app/widgets/gimpcomponenteditor.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcomponenteditor.c,v retrieving revision 1.32 diff -u -p -r1.32 gimpcomponenteditor.c --- app/widgets/gimpcomponenteditor.c 4 Jun 2006 11:49:30 -0000 1.32 +++ app/widgets/gimpcomponenteditor.c 29 Aug 2006 20:43:07 -0000 @@ -83,6 +83,7 @@ static void gimp_component_editor_active GimpChannelType channel, GimpComponentEditor *editor); static GimpImage * gimp_component_editor_drag_component (GtkWidget *widget, + GimpContext **context, GimpChannelType *channel, gpointer data); @@ -353,7 +354,8 @@ gimp_component_editor_create_components visible = gimp_image_get_component_visible (image, components[i]); - renderer = gimp_view_renderer_new (G_TYPE_FROM_INSTANCE (image), + renderer = gimp_view_renderer_new (GIMP_IMAGE_EDITOR (editor)->context, + G_TYPE_FROM_INSTANCE (image), editor->view_size, 1, FALSE); gimp_view_renderer_set_viewable (renderer, GIMP_VIEWABLE (image)); gimp_view_renderer_remove_idle (renderer); @@ -597,9 +599,10 @@ gimp_component_editor_active_changed (Gi } static GimpImage * -gimp_component_editor_drag_component (GtkWidget *widget, - GimpChannelType *channel, - gpointer data) +gimp_component_editor_drag_component (GtkWidget *widget, + GimpContext **context, + GimpChannelType *channel, + gpointer data) { GimpComponentEditor *editor = GIMP_COMPONENT_EDITOR (data); @@ -608,6 +611,9 @@ gimp_component_editor_drag_component (Gt { if (channel) *channel = editor->clicked_component; + + if (context) + *context = GIMP_IMAGE_EDITOR (editor)->context; return GIMP_IMAGE_EDITOR (editor)->image; } Index: app/widgets/gimpcontainerbox.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcontainerbox.c,v retrieving revision 1.19 diff -u -p -r1.19 gimpcontainerbox.c --- app/widgets/gimpcontainerbox.c 15 May 2006 09:46:26 -0000 1.19 +++ app/widgets/gimpcontainerbox.c 29 Aug 2006 20:43:07 -0000 @@ -175,7 +175,8 @@ gimp_container_box_get_preview (GimpDock prop_name = gimp_context_type_to_prop_name (container->children_type); - preview = gimp_prop_view_new (G_OBJECT (context), prop_name, height); + preview = gimp_prop_view_new (G_OBJECT (context), prop_name, + context, height); GIMP_VIEW (preview)->renderer->size = -1; gimp_container_view_get_view_size (view, &border_width); Index: app/widgets/gimpcontainercombobox.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcontainercombobox.c,v retrieving revision 1.13 diff -u -p -r1.13 gimpcontainercombobox.c --- app/widgets/gimpcontainercombobox.c 8 Aug 2006 22:15:46 -0000 1.13 +++ app/widgets/gimpcontainercombobox.c 29 Aug 2006 20:43:07 -0000 @@ -266,7 +266,8 @@ gimp_container_combo_box_set (GimpContai name = gimp_viewable_get_description (viewable, NULL); - renderer = gimp_view_renderer_new (G_TYPE_FROM_INSTANCE (viewable), + renderer = gimp_view_renderer_new (gimp_container_view_get_context (view), + G_TYPE_FROM_INSTANCE (viewable), view_size, border_width, FALSE); gimp_view_renderer_set_viewable (renderer, viewable); Index: app/widgets/gimpcontainereditor.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcontainereditor.c,v retrieving revision 1.47 diff -u -p -r1.47 gimpcontainereditor.c --- app/widgets/gimpcontainereditor.c 15 May 2006 09:46:26 -0000 1.47 +++ app/widgets/gimpcontainereditor.c 29 Aug 2006 20:43:07 -0000 @@ -41,7 +41,7 @@ #include "gimpuimanager.h" -static void gimp_container_editor_docked_iface_init (GimpDockedInterface *iface); +static void gimp_container_editor_docked_iface_init (GimpDockedInterface *iface); static gboolean gimp_container_editor_select_item (GtkWidget *widget, GimpViewable *viewable, @@ -90,12 +90,6 @@ gimp_container_editor_class_init (GimpCo } static void -gimp_container_editor_init (GimpContainerEditor *view) -{ - view->view = NULL; -} - -static void gimp_container_editor_docked_iface_init (GimpDockedInterface *iface) { iface->get_preview = gimp_container_editor_get_preview; @@ -104,6 +98,12 @@ gimp_container_editor_docked_iface_init iface->has_button_bar = gimp_container_editor_has_button_bar; iface->set_show_button_bar = gimp_container_editor_set_show_button_bar; iface->get_show_button_bar = gimp_container_editor_get_show_button_bar; +} + +static void +gimp_container_editor_init (GimpContainerEditor *view) +{ + view->view = NULL; } gboolean Index: app/widgets/gimpcontainerentry.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcontainerentry.c,v retrieving revision 1.9 diff -u -p -r1.9 gimpcontainerentry.c --- app/widgets/gimpcontainerentry.c 15 May 2006 09:46:26 -0000 1.9 +++ app/widgets/gimpcontainerentry.c 29 Aug 2006 20:43:07 -0000 @@ -188,7 +188,8 @@ gimp_container_entry_set (GimpContainerE view_size = gimp_container_view_get_view_size (view, &border_width); - renderer = gimp_view_renderer_new (G_TYPE_FROM_INSTANCE (viewable), + renderer = gimp_view_renderer_new (gimp_container_view_get_context (view), + G_TYPE_FROM_INSTANCE (viewable), view_size, border_width, FALSE); gimp_view_renderer_set_viewable (renderer, viewable); Index: app/widgets/gimpcontainergridview.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcontainergridview.c,v retrieving revision 1.86 diff -u -p -r1.86 gimpcontainergridview.c --- app/widgets/gimpcontainergridview.c 15 May 2006 09:46:26 -0000 1.86 +++ app/widgets/gimpcontainergridview.c 29 Aug 2006 20:43:07 -0000 @@ -36,6 +36,7 @@ #include "gimpcontainergridview.h" #include "gimpcontainerview.h" +#include "gimpdocked.h" #include "gimpview.h" #include "gimpviewrenderer.h" #include "gimpwidgets-utils.h" @@ -51,7 +52,8 @@ enum }; -static void gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface); +static void gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface); +static void gimp_container_grid_view_docked_iface_init (GimpDockedInterface *iface); static gboolean gimp_container_grid_view_move_cursor (GimpContainerGridView *view, GtkMovementStep step, @@ -78,6 +80,9 @@ static gboolean gimp_container_grid_vie gpointer insert_data); static void gimp_container_grid_view_clear_items (GimpContainerView *view); static void gimp_container_grid_view_set_view_size (GimpContainerView *view); +static void gimp_container_grid_view_set_context (GimpDocked *docked, + GimpContext *context); + static gboolean gimp_container_grid_view_item_selected(GtkWidget *widget, GdkEventButton *bevent, gpointer data); @@ -100,11 +105,14 @@ static gboolean gimp_container_grid_view G_DEFINE_TYPE_WITH_CODE (GimpContainerGridView, gimp_container_grid_view, GIMP_TYPE_CONTAINER_BOX, G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, - gimp_container_grid_view_view_iface_init)) + gimp_container_grid_view_view_iface_init) + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_container_grid_view_docked_iface_init)) #define parent_class gimp_container_grid_view_parent_class -static GimpContainerViewInterface *parent_view_iface = NULL; +static GimpContainerViewInterface *parent_view_iface = NULL; +static GimpDockedInterface *parent_docked_iface = NULL; static guint grid_view_signals[LAST_SIGNAL] = { 0 }; @@ -158,6 +166,31 @@ gimp_container_grid_view_class_init (Gim } static void +gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface) +{ + parent_view_iface = g_type_interface_peek_parent (iface); + + iface->insert_item = gimp_container_grid_view_insert_item; + iface->remove_item = gimp_container_grid_view_remove_item; + iface->reorder_item = gimp_container_grid_view_reorder_item; + iface->rename_item = gimp_container_grid_view_rename_item; + iface->select_item = gimp_container_grid_view_select_item; + iface->clear_items = gimp_container_grid_view_clear_items; + iface->set_view_size = gimp_container_grid_view_set_view_size; +} + +static void +gimp_container_grid_view_docked_iface_init (GimpDockedInterface *iface) +{ + parent_docked_iface = g_type_interface_peek_parent (iface); + + if (! parent_docked_iface) + parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); + + iface->set_context = gimp_container_grid_view_set_context; +} + +static void gimp_container_grid_view_init (GimpContainerGridView *grid_view) { GimpContainerBox *box = GIMP_CONTAINER_BOX (grid_view); @@ -191,20 +224,6 @@ gimp_container_grid_view_init (GimpConta GTK_WIDGET_SET_FLAGS (grid_view, GTK_CAN_FOCUS); } -static void -gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface) -{ - parent_view_iface = g_type_interface_peek_parent (iface); - - iface->insert_item = gimp_container_grid_view_insert_item; - iface->remove_item = gimp_container_grid_view_remove_item; - iface->reorder_item = gimp_container_grid_view_reorder_item; - iface->rename_item = gimp_container_grid_view_rename_item; - iface->select_item = gimp_container_grid_view_select_item; - iface->clear_items = gimp_container_grid_view_clear_items; - iface->set_view_size = gimp_container_grid_view_set_view_size; -} - GtkWidget * gimp_container_grid_view_new (GimpContainer *container, GimpContext *context, @@ -398,7 +417,8 @@ gimp_container_grid_view_insert_item (Gi view_size = gimp_container_view_get_view_size (container_view, NULL); - view = gimp_view_new_full (viewable, + view = gimp_view_new_full (gimp_container_view_get_context (container_view), + viewable, view_size, view_size, 1, FALSE, TRUE, TRUE); gimp_view_renderer_set_border_type (GIMP_VIEW (view)->renderer, @@ -516,6 +536,25 @@ gimp_container_grid_view_set_view_size ( } gtk_widget_queue_resize (grid_view->wrap_box); +} + +static void +gimp_container_grid_view_set_context (GimpDocked *docked, + GimpContext *context) +{ + GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (docked); + GtkWrapBoxChild *child; + + parent_docked_iface->set_context (docked, context); + + for (child = GTK_WRAP_BOX (grid_view->wrap_box)->children; + child; + child = child->next) + { + GimpView *view = GIMP_VIEW (child->widget); + + gimp_view_renderer_set_context (view->renderer, context); + } } static gboolean Index: app/widgets/gimpcontainertreeview.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcontainertreeview.c,v retrieving revision 1.83 diff -u -p -r1.83 gimpcontainertreeview.c --- app/widgets/gimpcontainertreeview.c 26 Jul 2006 09:47:05 -0000 1.83 +++ app/widgets/gimpcontainertreeview.c 29 Aug 2006 20:43:07 -0000 @@ -38,6 +38,7 @@ #include "gimpcontainertreeview-dnd.h" #include "gimpcontainerview.h" #include "gimpdnd.h" +#include "gimpdocked.h" #include "gimpviewrenderer.h" #include "gimpwidgets-utils.h" @@ -51,7 +52,8 @@ enum }; -static void gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface); +static void gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface); +static void gimp_container_tree_view_docked_iface_init (GimpDockedInterface *iface); static GObject *gimp_container_tree_view_constructor (GType type, guint n_params, @@ -60,9 +62,9 @@ static GObject *gimp_container_tree_view static void gimp_container_tree_view_unrealize (GtkWidget *widget); static void gimp_container_tree_view_unmap (GtkWidget *widget); static gboolean gimp_container_tree_view_popup_menu (GtkWidget *widget); + static void gimp_container_tree_view_set_container (GimpContainerView *view, GimpContainer *container); - static gpointer gimp_container_tree_view_insert_item (GimpContainerView *view, GimpViewable *viewable, gint index); @@ -85,6 +87,9 @@ static void gimp_container_tree_view_ static void gimp_container_tree_view_name_canceled (GtkCellRendererText *cell, GimpContainerTreeView *tree_view); +static void gimp_container_tree_view_set_context (GimpDocked *view, + GimpContext *context); + static void gimp_container_tree_view_selection_changed (GtkTreeSelection *sel, GimpContainerTreeView *tree_view); static gboolean gimp_container_tree_view_button_press (GtkWidget *widget, @@ -94,6 +99,7 @@ static void gimp_container_tree_view_ren GimpContainerTreeView *tree_view); static GimpViewable * gimp_container_tree_view_drag_viewable (GtkWidget *widget, + GimpContext **context, gpointer data); static GdkPixbuf * gimp_container_tree_view_drag_pixbuf (GtkWidget *widget, gpointer data); @@ -102,11 +108,14 @@ static GdkPixbuf * gimp_container_tre G_DEFINE_TYPE_WITH_CODE (GimpContainerTreeView, gimp_container_tree_view, GIMP_TYPE_CONTAINER_BOX, G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, - gimp_container_tree_view_view_iface_init)) + gimp_container_tree_view_view_iface_init) + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_container_tree_view_docked_iface_init)) #define parent_class gimp_container_tree_view_parent_class -static GimpContainerViewInterface *parent_view_iface = NULL; +static GimpContainerViewInterface *parent_view_iface = NULL; +static GimpDockedInterface *parent_docked_iface = NULL; static void @@ -131,6 +140,34 @@ gimp_container_tree_view_class_init (Gim } static void +gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface) +{ + parent_view_iface = g_type_interface_peek_parent (iface); + + iface->set_container = gimp_container_tree_view_set_container; + iface->insert_item = gimp_container_tree_view_insert_item; + iface->remove_item = gimp_container_tree_view_remove_item; + iface->reorder_item = gimp_container_tree_view_reorder_item; + iface->rename_item = gimp_container_tree_view_rename_item; + iface->select_item = gimp_container_tree_view_select_item; + iface->clear_items = gimp_container_tree_view_clear_items; + iface->set_view_size = gimp_container_tree_view_set_view_size; + + iface->insert_data_free = (GDestroyNotify) g_free; +} + +static void +gimp_container_tree_view_docked_iface_init (GimpDockedInterface *iface) +{ + parent_docked_iface = g_type_interface_peek_parent (iface); + + if (! parent_docked_iface) + parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); + + iface->set_context = gimp_container_tree_view_set_context; +} + +static void gimp_container_tree_view_init (GimpContainerTreeView *tree_view) { GimpContainerBox *box = GIMP_CONTAINER_BOX (tree_view); @@ -151,23 +188,6 @@ gimp_container_tree_view_init (GimpConta GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); } -static void -gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface) -{ - parent_view_iface = g_type_interface_peek_parent (iface); - - iface->set_container = gimp_container_tree_view_set_container; - iface->insert_item = gimp_container_tree_view_insert_item; - iface->remove_item = gimp_container_tree_view_remove_item; - iface->reorder_item = gimp_container_tree_view_reorder_item; - iface->rename_item = gimp_container_tree_view_rename_item; - iface->select_item = gimp_container_tree_view_select_item; - iface->clear_items = gimp_container_tree_view_clear_items; - iface->set_view_size = gimp_container_tree_view_set_view_size; - - iface->insert_data_free = (GDestroyNotify) g_free; -} - static GObject * gimp_container_tree_view_constructor (GType type, guint n_params, @@ -219,8 +239,8 @@ gimp_container_tree_view_constructor (GT tree_view->name_cell = gtk_cell_renderer_text_new (); g_object_set (tree_view->name_cell, "xalign", 0.0, NULL); gtk_tree_view_column_pack_end (tree_view->main_column, - tree_view->name_cell, - FALSE); + tree_view->name_cell, + FALSE); gtk_tree_view_column_set_attributes (tree_view->main_column, tree_view->name_cell, @@ -394,7 +414,8 @@ gimp_container_tree_view_set (GimpContai view_size = gimp_container_view_get_view_size (view, &border_width); - renderer = gimp_view_renderer_new (G_TYPE_FROM_INSTANCE (viewable), + renderer = gimp_view_renderer_new (gimp_container_view_get_context (view), + G_TYPE_FROM_INSTANCE (viewable), view_size, border_width, FALSE); gimp_view_renderer_set_viewable (renderer, viewable); @@ -681,9 +702,7 @@ gimp_container_tree_view_set_view_size ( { GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view); GtkWidget *tree_widget; - GtkTreeIter iter; GList *list; - gboolean iter_valid; gint view_size; gint border_width; @@ -691,6 +710,9 @@ gimp_container_tree_view_set_view_size ( if (tree_view->model) { + GtkTreeIter iter; + gboolean iter_valid; + for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter); iter_valid; iter_valid = gtk_tree_model_iter_next (tree_view->model, &iter)) @@ -738,6 +760,38 @@ gimp_container_tree_view_set_view_size ( } +/* GimpDocked methods */ + +static void +gimp_container_tree_view_set_context (GimpDocked *docked, + GimpContext *context) +{ + GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (docked); + + parent_docked_iface->set_context (docked, context); + + if (tree_view->model) + { + GtkTreeIter iter; + gboolean iter_valid; + + for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter); + iter_valid; + iter_valid = gtk_tree_model_iter_next (tree_view->model, &iter)) + { + GimpViewRenderer *renderer; + + gtk_tree_model_get (tree_view->model, &iter, + COLUMN_RENDERER, &renderer, + -1); + + gimp_view_renderer_set_context (renderer, context); + g_object_unref (renderer); + } + } +} + + /* callbacks */ static void @@ -838,7 +892,7 @@ gimp_container_tree_view_button_press (G GtkTreeViewColumn *column; GtkTreePath *path; - tree_view->dnd_viewable = NULL; + tree_view->dnd_renderer = NULL; if (! GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget); @@ -860,7 +914,7 @@ gimp_container_tree_view_button_press (G COLUMN_RENDERER, &renderer, -1); - tree_view->dnd_viewable = renderer->viewable; + tree_view->dnd_renderer = renderer; gtk_tree_view_get_background_area (tree_view->view, path, column, &column_area); @@ -1046,12 +1100,19 @@ gimp_container_tree_view_renderer_update } static GimpViewable * -gimp_container_tree_view_drag_viewable (GtkWidget *widget, - gpointer data) +gimp_container_tree_view_drag_viewable (GtkWidget *widget, + GimpContext **context, + gpointer data) { GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (data); - return tree_view->dnd_viewable; + if (context) + *context = gimp_container_view_get_context (GIMP_CONTAINER_VIEW (data)); + + if (tree_view->dnd_renderer) + return tree_view->dnd_renderer->viewable; + + return NULL; } static GdkPixbuf * @@ -1059,12 +1120,14 @@ gimp_container_tree_view_drag_pixbuf (Gt gpointer data) { GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (data); - GimpViewable *viewable = tree_view->dnd_viewable; + GimpViewRenderer *renderer = tree_view->dnd_renderer; gint width; gint height; - if (viewable && gimp_viewable_get_size (viewable, &width, &height)) - return gimp_viewable_get_new_pixbuf (viewable, width, height); + if (renderer && gimp_viewable_get_size (renderer->viewable, &width, &height)) + return gimp_viewable_get_new_pixbuf (renderer->viewable, + renderer->context, + width, height); return NULL; } Index: app/widgets/gimpcontainertreeview.h =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpcontainertreeview.h,v retrieving revision 1.24 diff -u -p -r1.24 gimpcontainertreeview.h --- app/widgets/gimpcontainertreeview.h 12 Apr 2006 12:49:27 -0000 1.24 +++ app/widgets/gimpcontainertreeview.h 29 Aug 2006 20:43:07 -0000 @@ -63,7 +63,7 @@ struct _GimpContainerTreeView gboolean dnd_drop_to_empty; Gimp *dnd_gimp; /* eek */ - GimpViewable *dnd_viewable; + GimpViewRenderer *dnd_renderer; guint scroll_timeout_id; guint scroll_timeout_interval; Index: app/widgets/gimpdataeditor.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpdataeditor.c,v retrieving revision 1.41 diff -u -p -r1.41 gimpdataeditor.c --- app/widgets/gimpdataeditor.c 30 May 2006 11:56:41 -0000 1.41 +++ app/widgets/gimpdataeditor.c 29 Aug 2006 20:43:07 -0000 @@ -49,6 +49,7 @@ enum { PROP_0, PROP_DATA_FACTORY, + PROP_CONTEXT, PROP_DATA }; @@ -68,6 +69,8 @@ static void gimp_data_editor_get_p GParamSpec *pspec); static void gimp_data_editor_dispose (GObject *object); +static void gimp_data_editor_set_context (GimpDocked *docked, + GimpContext *context); static void gimp_data_editor_set_aux_info (GimpDocked *docked, GList *aux_info); static GList * gimp_data_editor_get_aux_info (GimpDocked *docked); @@ -76,6 +79,9 @@ static gchar * gimp_data_editor_get_t static void gimp_data_editor_real_set_data (GimpDataEditor *editor, GimpData *data); +static void gimp_data_editor_data_changed (GimpContext *context, + GimpData *data, + GimpDataEditor *editor); static gboolean gimp_data_editor_name_key_press (GtkWidget *widget, GdkEventKey *kevent, GimpDataEditor *editor); @@ -123,6 +129,12 @@ gimp_data_editor_class_init (GimpDataEdi GIMP_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_CONTEXT, + g_param_spec_object ("context", + NULL, NULL, + GIMP_TYPE_CONTEXT, + GIMP_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_DATA, g_param_spec_object ("data", NULL, NULL, @@ -134,6 +146,7 @@ static void gimp_data_editor_init (GimpDataEditor *editor) { editor->data_factory = NULL; + editor->context = NULL; editor->data = NULL; editor->data_editable = FALSE; @@ -162,6 +175,7 @@ gimp_data_editor_docked_iface_init (Gimp if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); + iface->set_context = gimp_data_editor_set_context; iface->set_aux_info = gimp_data_editor_set_aux_info; iface->get_aux_info = gimp_data_editor_get_aux_info; iface->get_title = gimp_data_editor_get_title; @@ -219,9 +233,12 @@ gimp_data_editor_set_property (GObject case PROP_DATA_FACTORY: editor->data_factory = g_value_get_object (value); break; + case PROP_CONTEXT: + gimp_docked_set_context (GIMP_DOCKED (object), + g_value_get_object (value)); + break; case PROP_DATA: - gimp_data_editor_set_data (editor, - (GimpData *) g_value_get_object (value)); + gimp_data_editor_set_data (editor, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -242,6 +259,9 @@ gimp_data_editor_get_property (GObject case PROP_DATA_FACTORY: g_value_set_object (value, editor->data_factory); break; + case PROP_CONTEXT: + g_value_set_object (value, editor->context); + break; case PROP_DATA: g_value_set_object (value, editor->data); break; @@ -263,9 +283,54 @@ gimp_data_editor_dispose (GObject *objec gimp_data_editor_set_data (editor, NULL); } + if (editor->context) + gimp_docked_set_context (GIMP_DOCKED (editor), NULL); + G_OBJECT_CLASS (parent_class)->dispose (object); } +static void +gimp_data_editor_set_context (GimpDocked *docked, + GimpContext *context) +{ + GimpDataEditor *editor = GIMP_DATA_EDITOR (docked); + + if (context == editor->context) + return; + + if (parent_docked_iface->set_context) + parent_docked_iface->set_context (docked, context); + + if (editor->context) + { + g_signal_handlers_disconnect_by_func (editor->context, + gimp_data_editor_data_changed, + editor); + + g_object_unref (editor->context); + } + + editor->context = context; + + if (editor->context) + { + GType data_type; + GimpData *data; + + g_object_ref (editor->context); + + data_type = editor->data_factory->container->children_type; + data = GIMP_DATA (gimp_context_get_by_type (editor->context, data_type)); + + g_signal_connect (editor->context, + gimp_context_type_to_signal_name (data_type), + G_CALLBACK (gimp_data_editor_data_changed), + editor); + + gimp_data_editor_data_changed (editor->context, data, editor); + } +} + #define AUX_INFO_EDIT_ACTIVE "edit-active" #define AUX_INFO_CURRENT_DATA "current-data" @@ -427,33 +492,19 @@ gimp_data_editor_set_edit_active (GimpDa if (editor->edit_active != edit_active) { - GimpContext *user_context; - - user_context = gimp_get_user_context (editor->data_factory->gimp); - editor->edit_active = edit_active; - if (editor->edit_active) + if (editor->edit_active && editor->context) { GType data_type; GimpData *data; data_type = editor->data_factory->container->children_type; - data = GIMP_DATA (gimp_context_get_by_type (user_context, data_type)); - - g_signal_connect_object (user_context, - gimp_context_type_to_signal_name (data_type), - G_CALLBACK (gimp_data_editor_set_data), - editor, G_CONNECT_SWAPPED); + data = GIMP_DATA (gimp_context_get_by_type (editor->context, + data_type)); gimp_data_editor_set_data (editor, data); } - else - { - g_signal_handlers_disconnect_by_func (user_context, - gimp_data_editor_set_data, - editor); - } } } @@ -467,6 +518,15 @@ gimp_data_editor_get_edit_active (GimpDa /* private functions */ + +static void +gimp_data_editor_data_changed (GimpContext *context, + GimpData *data, + GimpDataEditor *editor) +{ + if (editor->edit_active) + gimp_data_editor_set_data (editor, data); +} static gboolean gimp_data_editor_name_key_press (GtkWidget *widget, Index: app/widgets/gimpdataeditor.h =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpdataeditor.h,v retrieving revision 1.9 diff -u -p -r1.9 gimpdataeditor.h --- app/widgets/gimpdataeditor.h 25 Oct 2005 21:38:00 -0000 1.9 +++ app/widgets/gimpdataeditor.h 29 Aug 2006 20:43:07 -0000 @@ -41,6 +41,7 @@ struct _GimpDataEditor GimpEditor parent_instance; GimpDataFactory *data_factory; + GimpContext *context; gboolean edit_active; GimpData *data; Index: app/widgets/gimpdevicestatus.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpdevicestatus.c,v retrieving revision 1.17 diff -u -p -r1.17 gimpdevicestatus.c --- app/widgets/gimpdevicestatus.c 15 May 2006 09:46:27 -0000 1.17 +++ app/widgets/gimpdevicestatus.c 29 Aug 2006 20:43:07 -0000 @@ -287,8 +287,8 @@ gimp_device_status_device_add (GimpConta /* the tool */ - entry->tool = gimp_prop_view_new (G_OBJECT (context), - "tool", CELL_SIZE); + entry->tool = gimp_prop_view_new (G_OBJECT (context), "tool", + context, CELL_SIZE); GIMP_VIEW (entry->tool)->clickable = TRUE; gtk_table_attach (GTK_TABLE (entry->table), entry->tool, 1, 2, 1, 2, 0, 0, 0, 0); @@ -324,8 +324,8 @@ gimp_device_status_device_add (GimpConta /* the brush */ - entry->brush = gimp_prop_view_new (G_OBJECT (context), - "brush", CELL_SIZE); + entry->brush = gimp_prop_view_new (G_OBJECT (context), "brush", + context, CELL_SIZE); GIMP_VIEW (entry->brush)->clickable = TRUE; GIMP_VIEW (entry->brush)->show_popup = TRUE; gtk_table_attach (GTK_TABLE (entry->table), entry->brush, @@ -338,8 +338,8 @@ gimp_device_status_device_add (GimpConta /* the pattern */ - entry->pattern = gimp_prop_view_new (G_OBJECT (context), - "pattern", CELL_SIZE); + entry->pattern = gimp_prop_view_new (G_OBJECT (context), "pattern", + context, CELL_SIZE); GIMP_VIEW (entry->pattern)->clickable = TRUE; GIMP_VIEW (entry->pattern)->show_popup = TRUE; gtk_table_attach (GTK_TABLE (entry->table), entry->pattern, @@ -352,8 +352,8 @@ gimp_device_status_device_add (GimpConta /* the gradient */ - entry->gradient = gimp_prop_view_new (G_OBJECT (context), - "gradient", 2 * CELL_SIZE); + entry->gradient = gimp_prop_view_new (G_OBJECT (context), "gradient", + context, 2 * CELL_SIZE); GIMP_VIEW (entry->gradient)->clickable = TRUE; GIMP_VIEW (entry->gradient)->show_popup = TRUE; gtk_table_attach (GTK_TABLE (entry->table), entry->gradient, Index: app/widgets/gimpdnd.c =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimpdnd.c,v retrieving revision 1.144 diff -u -p -r1.144 gimpdnd.c --- app/widgets/gimpdnd.c 28 Mar 2006 17:08:35 -0000 1.144 +++ app/widgets/gimpdnd.c 29 Aug 2006 20:43:07 -0000 @@ -1151,10 +1151,12 @@ gimp_dnd_get_xds_data (GtkWidget gpointer get_image_data, GtkSelectionData *selection) { - GimpImage *image; + GimpImage *image; + GimpContext *gimp_context; image = (GimpImage *) - (* (GimpDndDragViewableFunc) get_image_func) (widget, get_image_data); + (* (GimpDndDragViewableFunc) get_image_func) (widget, &gimp_context, + get_image_data); if (image) gimp_dnd_xds_save_image (context, image, selection); @@ -1175,8 +1177,12 @@ gimp_dnd_xds_drag_begin (GtkWidget if (get_data_func) { - GimpImage *image = (GimpImage *) - (* (GimpDndDragViewableFunc) get_data_func) (widget, get_data_data); + GimpImage *image; + GimpContext *gimp_context; + + image = (GimpImage *) + (* (GimpDndDragViewableFunc) get_data_func) (widget, &gimp_context, + get_data_data); gimp_dnd_xds_source_set (context, image); } @@ -1594,15 +1600,18 @@ gimp_dnd_get_component_icon (GtkWidget * { GtkWidget *view; GimpImage *image; + GimpContext *context; GimpChannelType channel; - image = (* (GimpDndDragComponentFunc) get_comp_func) (widget, &channel, + image = (* (GimpDndDragComponentFunc) get_comp_func) (widget, &context, + &channel, get_comp_data); if (! image) return NULL; - view = gimp_view_new (GIMP_VIEWABLE (image), DRAG_PREVIEW_SIZE, 0, TRUE); + view = gimp_view_new (context, GIMP_VIEWABLE (image), + DRAG_PREVIEW_SIZE, 0, TRUE); GIMP_VIEW_RENDERER_IMAGE (GIMP_VIEW (view)->renderer)->channel = channel; @@ -1617,9 +1626,11 @@ gimp_dnd_get_component_data (GtkWidget GtkSelectionData *selection) { Gi