Commit 91cfa783 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added a boolean "internal" which indicates that the data object is an

2002-06-12  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdata.[ch]: added a boolean "internal" which
	indicates that the data object is an automatically created
	internal object. Changed the code to refuse saving to deleting
	internal objects.

	* app/core/Makefile.am
	* app/core/gimp-gradients.[ch]: new files implementing internal
	gradients (FG -> BG in RGB and HSV and FG -> transparent).

	* app/core/gimp.c: call gimp_gradients_init().

	* app/core/gimpdatafactory.c (gimp_data_factory_data_free): don't
	free internal objects so they stay there on "Refresh".

	* app/core/gimpdatalist.c: sort internal objects to the beginning
	of the list.

	* app/widgets/gimpdataeditor.c: refuse to change the name of
	internal objects.

	* app/widgets/gimpdatafactoryview.c: set the "Delete" button
	insensitive for internal objects.

	* app/widgets/gimpgradienteditor.c: refuse to edit internal
	gradients, just display them so color picking works.

	* app/gui/brushes-commands.c
	* app/gui/gradients-commands.c
	* app/gui/palettes-commands.c
	* app/gui/patterns-commands.c: set the "Delete" menu item
	insensitive for internal objects.

	* app/gui/gui.c: need to call render_setup() earlier because of
	you-dont-want-to-know-why. Will change it back once the previews
	have their own render buffers.

	* app/tools/gimpblendtool.c: Replaced the "Type" menu by a preview
	showing the active gradient. Clicking the preview pops up the
	gradient selection. Renamed the "Gradient" menu to "Shape". Removed
	"blend_mode" from the BlendOptions struct because we always use
	"custom" mode now.
parent f4e999fe
2002-06-12 Michael Natterer <mitch@gimp.org>
* app/core/gimpdata.[ch]: added a boolean "internal" which
indicates that the data object is an automatically created
internal object. Changed the code to refuse saving to deleting
internal objects.
* app/core/Makefile.am
* app/core/gimp-gradients.[ch]: new files implementing internal
gradients (FG -> BG in RGB and HSV and FG -> transparent).
* app/core/gimp.c: call gimp_gradients_init().
* app/core/gimpdatafactory.c (gimp_data_factory_data_free): don't
free internal objects so they stay there on "Refresh".
* app/core/gimpdatalist.c: sort internal objects to the beginning
of the list.
* app/widgets/gimpdataeditor.c: refuse to change the name of
internal objects.
* app/widgets/gimpdatafactoryview.c: set the "Delete" button
insensitive for internal objects.
* app/widgets/gimpgradienteditor.c: refuse to edit internal
gradients, just display them so color picking works.
* app/gui/brushes-commands.c
* app/gui/gradients-commands.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c: set the "Delete" menu item
insensitive for internal objects.
* app/gui/gui.c: need to call render_setup() earlier because of
you-dont-want-to-know-why. Will change it back once the previews
have their own render buffers.
* app/tools/gimpblendtool.c: Replaced the "Type" menu by a preview
showing the active gradient. Clicking the preview pops up the
gradient selection. Renamed the "Gradient" menu to "Shape". Removed
"blend_mode" from the BlendOptions struct because we always use
"custom" mode now.
2002-06-11 Sven Neumann <sven@gimp.org>
* plug-ins/helpbrowser/helpbrowser.c: implemented anchor handling.
......@@ -14,7 +58,7 @@
2002-06-10 Sven Neumann <sven@gimp.org>
* plug-ins/helpbrowser/Makefile.am
* plug-ins/helpbrowser/Makefile.am
* plug-ins/helpbrowser/uri.[ch]: added new files that implement
conversion of a relative URI and an absolute base URI to a new
absolute URI according to RFC 2396. This code has been kindly
......
......@@ -68,11 +68,15 @@ gradients_menu_update (GtkItemFactory *factory,
{
GimpContainerEditor *editor;
GimpGradient *gradient;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
gradient = gimp_context_get_gradient (editor->view->context);
if (gradient)
internal = GIMP_DATA (gradient)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
......@@ -81,7 +85,7 @@ gradients_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/Edit Gradient...",
gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Gradient...",
gradient);
gradient && ! internal);
SET_SENSITIVE ("/Save as POV-Ray...",
gradient);
......
......@@ -91,11 +91,15 @@ palettes_menu_update (GtkItemFactory *factory,
{
GimpContainerEditor *editor;
GimpPalette *palette;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
palette = gimp_context_get_palette (editor->view->context);
if (palette)
internal = GIMP_DATA (palette)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
......@@ -104,7 +108,7 @@ palettes_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/Edit Palette...",
palette && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Palette...",
palette);
palette && ! internal);
SET_SENSITIVE ("/Merge Palettes...",
FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */
......
......@@ -24,6 +24,8 @@ libappcore_a_sources = \
gimp.h \
gimp-documents.c \
gimp-documents.h \
gimp-gradients.c \
gimp-gradients.h \
gimp-parasites.c \
gimp-parasites.h \
gimpbrush.c \
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others
*
* gimp-gradients.c
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "libgimpcolor/gimpcolor.h"
#include "core-types.h"
#include "gimp.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "libgimp/gimpintl.h"
#define FG_BG_RGB_KEY "gimp-fg-bg-rgb-gradient"
#define FG_BG_HSV_CCW_KEY "gimp-fg-bg-hsv-ccw-gradient"
#define FG_BG_HSV_CW_KEY "gimp-fg-bg-hsv-cw-gradient"
#define FG_TRANSPARENT_KEY "gimp-fg-transparent-gradient"
/* 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);
/* public functions */
void
gimp_gradients_init (Gimp *gimp)
{
GimpGradient *gradient;
g_return_if_fail (GIMP_IS_GIMP (gimp));
gradient = gimp_gradients_add_gradient (gimp,
_("FG to BG (RGB)"),
FG_BG_RGB_KEY);
gimp_context_set_gradient (gimp->user_context, gradient);
gradient = gimp_gradients_add_gradient (gimp,
_("FG to BG (HSV counter-clockwise)"),
FG_BG_HSV_CCW_KEY);
gradient->segments->color = GIMP_GRAD_HSV_CCW;
gradient = gimp_gradients_add_gradient (gimp,
_("FG to BG (HSV clockwise hue)"),
FG_BG_HSV_CW_KEY);
gradient->segments->color = GIMP_GRAD_HSV_CW;
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);
g_signal_connect (G_OBJECT (gimp->user_context), "foreground_changed",
G_CALLBACK (gimp_gradients_foreground_changed),
gimp);
g_signal_connect (G_OBJECT (gimp->user_context), "background_changed",
G_CALLBACK (gimp_gradients_background_changed),
gimp);
}
/* private functions */
static GimpGradient *
gimp_gradients_add_gradient (Gimp *gimp,
const gchar *name,
const gchar *id)
{
GimpGradient *gradient;
gradient = GIMP_GRADIENT (gimp_gradient_new (name));
GIMP_DATA (gradient)->internal = TRUE;
gimp_context_get_foreground (gimp->user_context,
&gradient->segments->left_color);
gimp_context_get_background (gimp->user_context,
&gradient->segments->right_color);
gimp_container_add (gimp->gradient_factory->container,
GIMP_OBJECT (gradient));
g_object_unref (G_OBJECT (gradient));
g_object_set_data (G_OBJECT (gimp), id, gradient);
return gradient;
}
static void
gimp_gradients_foreground_changed (GimpContext *context,
const GimpRGB *fg,
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));
}
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));
}
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));
}
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));
}
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others
*
* gimp-gradients.h
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_GRADIENTS__
#define __GIMP_GRADIENTS__
void gimp_gradients_init (Gimp *gimp);
#endif /* __GIMP_GRADIENTS__ */
......@@ -35,6 +35,7 @@
#include "gimp.h"
#include "gimp-documents.h"
#include "gimp-gradients.h"
#include "gimp-parasites.h"
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
......@@ -227,14 +228,9 @@ gimp_finalize (GObject *object)
gimp = GIMP (object);
if (gimp->current_context)
gimp_set_current_context (gimp, NULL);
if (gimp->user_context)
gimp_set_user_context (gimp, NULL);
if (gimp->default_context)
gimp_set_default_context (gimp, NULL);
gimp_set_current_context (gimp, NULL);
gimp_set_user_context (gimp, NULL);
gimp_set_default_context (gimp, NULL);
if (gimp->standard_context)
{
......@@ -516,6 +512,9 @@ gimp_initialize (Gimp *gimp,
gimp_set_current_context (gimp, context);
/* add the builtin FG -> BG etc. gradients */
gimp_gradients_init (gimp);
/* register all internal procedures */
(* status_callback) (_("Procedural Database"), NULL, -1);
internal_procs_init (gimp, status_callback);
......
......@@ -155,6 +155,7 @@ gimp_data_init (GimpData *data)
{
data->filename = NULL;
data->dirty = FALSE;
data->internal = FALSE;
}
static void
......@@ -203,6 +204,12 @@ gimp_data_save (GimpData *data)
g_return_val_if_fail (GIMP_IS_DATA (data), FALSE);
if (data->internal)
{
data->dirty = FALSE;
return TRUE;
}
if (! data->filename)
{
g_warning ("%s(): can't save data with NULL filename",
......@@ -241,6 +248,9 @@ gimp_data_delete_from_disk (GimpData *data)
g_return_val_if_fail (GIMP_IS_DATA (data), FALSE);
g_return_val_if_fail (data->filename != NULL, FALSE);
if (data->internal)
return TRUE;
if (unlink (data->filename) == -1)
{
g_message ("%s(): could not unlink() %s: %s",
......@@ -270,6 +280,9 @@ gimp_data_set_filename (GimpData *data,
{
g_return_if_fail (GIMP_IS_DATA (data));
if (data->internal)
return;
g_free (data->filename);
data->filename = g_strdup (filename);
......
......@@ -42,6 +42,7 @@ struct _GimpData
gchar *filename;
gboolean dirty;
gboolean internal;
};
struct _GimpDataClass
......
......@@ -170,8 +170,7 @@ gimp_data_factory_data_init (GimpDataFactory *factory,
gimp_container_freeze (factory->container);
if (gimp_container_num_children (factory->container) > 0)
gimp_data_factory_data_free (factory);
gimp_data_factory_data_free (factory);
if (factory->data_path && *factory->data_path)
{
......@@ -233,10 +232,38 @@ gimp_data_factory_data_free (GimpDataFactory *factory)
gimp_container_freeze (factory->container);
while (list->list)
if (list->list)
{
gimp_container_remove (factory->container,
GIMP_OBJECT (list->list->data));
if (GIMP_DATA (list->list->data)->internal)
{
/* if there are internal objects in the list, skip them */
GList *glist;
for (glist = list->list; glist; glist = g_list_next (glist))
{
if (glist->next && ! GIMP_DATA (glist->next->data)->internal)
{
while (glist->next)
{
gimp_container_remove (factory->container,
GIMP_OBJECT (glist->next->data));
}
break;
}
}
}
else
{
/* otherwise delete everything */
while (list->list)
{
gimp_container_remove (factory->container,
GIMP_OBJECT (list->list->data));
}
}
}
gimp_container_thaw (factory->container);
......
......@@ -282,6 +282,13 @@ static gint
gimp_data_list_data_compare_func (gconstpointer first,
gconstpointer second)
{
GimpData *first_data = (GimpData *) first;
GimpData *second_data = (GimpData *) second;
/* move the internal objects (like the FG -> BG) gradient) to the top */
if (first_data->internal != second_data->internal)
return first_data->internal ? -1 : 1;
return strcmp (((const GimpObject *) first)->name,
((const GimpObject *) second)->name);
}
......@@ -25,8 +25,8 @@
#include "core/gimpbrushgenerated.h"
#include "core/gimpcontext.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "brushes-commands.h"
......@@ -42,20 +42,24 @@ brushes_menu_update (GtkItemFactory *factory,
{
GimpContainerEditor *editor;
GimpBrush *brush;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
brush = gimp_context_get_brush (editor->view->context);
if (brush)
internal = GIMP_DATA (brush)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Brush",
brush && GIMP_DATA_GET_CLASS (brush)->duplicate);
SET_SENSITIVE ("/Edit Brush...",
brush && GIMP_IS_BRUSH_GENERATED (brush));
brush && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Brush...",
brush);
brush && ! internal);
#undef SET_SENSITIVE
}
......@@ -68,11 +68,15 @@ gradients_menu_update (GtkItemFactory *factory,
{
GimpContainerEditor *editor;
GimpGradient *gradient;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
gradient = gimp_context_get_gradient (editor->view->context);
if (gradient)
internal = GIMP_DATA (gradient)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
......@@ -81,7 +85,7 @@ gradients_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/Edit Gradient...",
gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Gradient...",
gradient);
gradient && ! internal);
SET_SENSITIVE ("/Save as POV-Ray...",
gradient);
......
......@@ -184,6 +184,8 @@ gui_themes_init (Gimp *gimp)
gdk_rgb_set_install (gimprc.install_cmap);
gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
render_setup (gimprc.transparency_type, gimprc.transparency_size);
}
const gchar *
......@@ -228,7 +230,11 @@ gui_init (Gimp *gimp)
color_display_init ();
render_setup (gimprc.transparency_type, gimprc.transparency_size);
/* temporatily moved to gui_themes_init() until the previews have their
* own render buffers
*
* render_setup (gimprc.transparency_type, gimprc.transparency_size);
*/
dialogs_init (gimp);
......
......@@ -91,11 +91,15 @@ palettes_menu_update (GtkItemFactory *factory,
{
GimpContainerEditor *editor;
GimpPalette *palette;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
palette = gimp_context_get_palette (editor->view->context);
if (palette)
internal = GIMP_DATA (palette)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
......@@ -104,7 +108,7 @@ palettes_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/Edit Palette...",
palette && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Palette...",
palette);
palette && ! internal);
SET_SENSITIVE ("/Merge Palettes...",
FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */
......
......@@ -43,11 +43,15 @@ patterns_menu_update (GtkItemFactory *factory,
{
GimpContainerEditor *editor;
GimpPattern *pattern;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
pattern = gimp_context_get_pattern (editor->view->context);
if (pattern)
internal = GIMP_DATA (pattern)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
......@@ -56,7 +60,7 @@ patterns_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/Edit Pattern...",
pattern && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Pattern...",
pattern);
pattern && ! internal);
#undef SET_SENSITIVE
}
......@@ -41,7 +41,10 @@
#include "display/gimpprogress.h"
#include "widgets/gimpdnd.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpenummenu.h"
#include "widgets/gimppreview.h"
#include "gimpblendtool.h"
#include "paint_options.h"
......@@ -62,10 +65,6 @@ struct _BlendOptions
gdouble offset_d;
GtkObject *offset_w;
GimpBlendMode blend_mode;
GimpBlendMode blend_mode_d;
GtkWidget *blend_mode_w;
GimpGradientType gradient_type;
GimpGradientType gradient_type_d;
GtkWidget *gradient_type_w;
......@@ -118,6 +117,9 @@ static void gimp_blend_tool_draw (GimpDrawTool *draw_tool);
static GimpToolOptions * blend_options_new (GimpToolInfo *tool_info);
static void blend_options_reset (GimpToolOptions *tool_options);
static void blend_options_gradient_clicked (GtkWidget *widget,
gpointer data);
static void gradient_type_callback (GtkWidget *widget,
gpointer data);
static void blend_options_drop_gradient (GtkWidget *widget,
......@@ -294,7 +296,7 @@ gimp_blend_tool_button_release (GimpTool *tool,
NULL, NULL);
gimp_drawable_blend (gimp_image_active_drawable (gimage),
options->blend_mode,
GIMP_CUSTOM_MODE,
gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)),
options->gradient_type,
gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)),
......@@ -441,10 +443,12 @@ static GimpToolOptions *
blend_options_new (GimpToolInfo *tool_info)
{
BlendOptions *options;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *frame;
GimpContext *user_context;
GimpGradient *gradient;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *frame;
GtkWidget *preview;
/* the new blend tool options structure */
options = g_new0 (BlendOptions, 1);
......@@ -456,7 +460,6 @@ blend_options_new (GimpToolInfo *tool_info)
((GimpToolOptions *) options)->reset_func = blend_options_reset;
options->offset = options->offset_d = 0.0;
options->blend_mode = options->blend_mode_d = GIMP_FG_BG_RGB_MODE;
options->gradient_type = options->gradient_type_d = GIMP_LINEAR;
options->repeat = options->repeat_d = GIMP_REPEAT_NONE;
options->supersample = options->supersample_d = FALSE;
......@@ -487,6 +490,7 @@ blend_options_new (GimpToolInfo *tool_info)
table = gtk_table_new (4, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
......@@ -501,16 +505,24 @@ blend_options_new (GimpToolInfo *tool_info)
G_CALLBACK (gimp_double_adjustment_update),
&options->offset);
/* the blend mode menu */
options->blend_mode_w =
gimp_enum_option_menu_new (GIMP_TYPE_BLEND_MODE,
G_CALLBACK (gimp_menu_item_update),
&options->blend_mode);
gimp_option_menu_set_history (GTK_OPTION_MENU (options->blend_mode_w),
GINT_TO_POINTER (options->blend_mode));
/* the gradient preview */
user_context = gimp_get_user_context (tool_info->gimp);
gradient = gimp_context_get_gradient (user_context);
preview = gimp_preview_new_full (GIMP_VIEWABLE (gradient),
48, 16, 0,
FALSE, TRUE, TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Blend:"), 1.0, 0.5,
options->blend_mode_w, 2, TRUE);
_("Gradient:"), 1.0, 0.5,
preview, 2, TRUE);
g_signal_connect_object (G_OBJECT (user_context), "gradient_changed",
G_CALLBACK (gimp_preview_set_viewable),
G_OBJECT (preview),
G_CONNECT_SWAPPED);
g_signal_connect (G_OBJECT (preview), "clicked",
G_CALLBACK (blend_options_gradient_clicked),
NULL);
/* the gradient type menu */
options->gradient_type_w =
......@@ -520,7 +532,7 @@ blend_options_new (GimpToolInfo *tool_info)
gimp_option_menu_set_history (GTK_OPTION_MENU (options->gradient_type_w),
GINT_TO_POINTER (options->gradient_type));
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Gradient:"), 1.0, 0.5,
_("Shape:"), 1.0, 0.5,
options->gradient_type_w, 2, TRUE);
/* the repeat option */
......@@ -611,12 +623,9 @@ blend_options_reset (GimpToolOptions *tool_options)
paint_options_reset (tool_options);