Commit b0e05cda authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added GimpPaletteEntry typedef.

2002-03-08  Michael Natterer  <mitch@gimp.org>

	* app/core/core-types.h: added GimpPaletteEntry typedef.

	* app/core/gimppalette.h: removed it here.

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpeditor.[ch]: new widget which is the base class
	for everything which is a vbox and has a button area at the
	bottom.

	* app/widgets/gimpcontainerview.[ch]: derived from GimpEditor now.

	* app/widgets/gimpdataeditor.[ch]: a GimpEditor subclass which is
	the base class for the new data editors below.

	* app/widgets/gimpbrushfactoryview.c
	* app/widgets/gimpbufferview.c
	* app/widgets/gimpchannellistview.c
	* app/widgets/gimpdatafactoryview.c
	* app/widgets/gimpdocumentview.c
	* app/widgets/gimpitemlistview.c
	* app/widgets/gimplayerlistview.c
	* app/widgets/gimpvectorslistview.c
	* themes/Default/gtkrc: chagec accordingly.

	* app/gui/Makefile.am
	* app/gui/brush-editor.[ch]
	* app/gui/gradient-editor.[ch]
	* app/gui/palette-editor.[ch]: removed...

	* app/widgets/gimpbrusheditor.[ch]
	* app/widgets/gimpgradienteditor.[ch]
	* app/widgets/gimppaletteeditor.[ch]: ...and added back as
	GimpDataEditor subclasses. Lots of cleanup and stuff...

	* app/gui/dialogs-constructors.[ch]
	* app/gui/dialogs.c
	* app/gui/gradient-editor-commands.c
	* app/gui/gui-types.h
	* app/gui/palette-select.c
	* app/tools/gimpcolorpickertool.c: changed accordingly.
parent e062b608
2002-03-08 Michael Natterer <mitch@gimp.org>
* app/core/core-types.h: added GimpPaletteEntry typedef.
* app/core/gimppalette.h: removed it here.
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimpeditor.[ch]: new widget which is the base class
for everything which is a vbox and has a button area at the
bottom.
* app/widgets/gimpcontainerview.[ch]: derived from GimpEditor now.
* app/widgets/gimpdataeditor.[ch]: a GimpEditor subclass which is
the base class for the new data editors below.
* app/widgets/gimpbrushfactoryview.c
* app/widgets/gimpbufferview.c
* app/widgets/gimpchannellistview.c
* app/widgets/gimpdatafactoryview.c
* app/widgets/gimpdocumentview.c
* app/widgets/gimpitemlistview.c
* app/widgets/gimplayerlistview.c
* app/widgets/gimpvectorslistview.c
* themes/Default/gtkrc: chagec accordingly.
* app/gui/Makefile.am
* app/gui/brush-editor.[ch]
* app/gui/gradient-editor.[ch]
* app/gui/palette-editor.[ch]: removed...
* app/widgets/gimpbrusheditor.[ch]
* app/widgets/gimpgradienteditor.[ch]
* app/widgets/gimppaletteeditor.[ch]: ...and added back as
GimpDataEditor subclasses. Lots of cleanup and stuff...
* app/gui/dialogs-constructors.[ch]
* app/gui/dialogs.c
* app/gui/gradient-editor-commands.c
* app/gui/gui-types.h
* app/gui/palette-select.c
* app/tools/gimpcolorpickertool.c: changed accordingly.
2002-03-07 Sven Neumann <sven@gimp.org>
* app/gui/splash.c: back to a still splash image.
......
This diff is collapsed.
......@@ -246,6 +246,8 @@ typedef struct _GimpProgress GimpProgress;
typedef guint32 GimpTattoo;
typedef struct _GimpPaletteEntry GimpPaletteEntry;
/* EEK stuff */
......
......@@ -34,8 +34,6 @@
#define GIMP_PALETTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PALETTE, GimpPaletteClass))
typedef struct _GimpPaletteEntry GimpPaletteEntry;
struct _GimpPaletteEntry
{
GimpRGB color;
......
......@@ -37,10 +37,12 @@
#include "vectors/gimpvectors.h"
#include "widgets/gimpbrusheditor.h"
#include "widgets/gimpbrushfactoryview.h"
#include "widgets/gimpbufferview.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpcontainergridview.h"
#include "widgets/gimpdataeditor.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpimagedock.h"
......@@ -49,12 +51,13 @@
#include "widgets/gimpdockable.h"
#include "widgets/gimpdockbook.h"
#include "widgets/gimpdocumentview.h"
#include "widgets/gimpgradienteditor.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimppreview.h"
#include "widgets/gimpvectorslistview.h"
#include "about-dialog.h"
#include "brush-editor.h"
#include "brush-select.h"
#include "brushes-commands.h"
#include "buffers-commands.h"
......@@ -66,13 +69,11 @@
#include "dialogs-constructors.h"
#include "documents-commands.h"
#include "error-console-dialog.h"
#include "gradient-editor.h"
#include "gradient-select.h"
#include "gradients-commands.h"
#include "layers-commands.h"
#include "menus.h"
#include "module-browser.h"
#include "palette-editor.h"
#include "palette-select.h"
#include "palettes-commands.h"
#include "paths-dialog.h"
......@@ -281,121 +282,6 @@ dialogs_about_get (GimpDialogFactory *factory,
}
/* editors */
#ifdef __GNUC__
#warning: FIXME: remove EEKWrapper (make editors dockable)
#endif
typedef struct
{
GtkWidget *shell;
} EEKWrapper;
/* the brush editor */
static BrushEditor *brush_editor_dialog = NULL;
GtkWidget *
dialogs_brush_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
if (! brush_editor_dialog)
{
brush_editor_dialog = brush_editor_new (context->gimp);
}
return ((EEKWrapper *) brush_editor_dialog)->shell;
}
void
dialogs_edit_brush_func (GimpData *data)
{
GimpBrush *brush;
brush = GIMP_BRUSH (data);
if (GIMP_IS_BRUSH_GENERATED (brush))
{
gimp_dialog_factory_dialog_raise (global_dialog_factory,
"gimp:brush-editor",
-1);
brush_editor_set_brush (brush_editor_dialog, brush);
}
else
{
g_message (_("This brush cannot be edited."));
}
}
/* the gradient editor */
static GradientEditor *gradient_editor_dialog = NULL;
GtkWidget *
dialogs_gradient_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
if (! gradient_editor_dialog)
{
gradient_editor_dialog = gradient_editor_new (context->gimp);
}
return ((EEKWrapper *) gradient_editor_dialog)->shell;
}
void
dialogs_edit_gradient_func (GimpData *data)
{
GimpGradient *gradient;
gradient = GIMP_GRADIENT (data);
gimp_dialog_factory_dialog_raise (global_dialog_factory,
"gimp:gradient-editor",
-1);
gradient_editor_set_gradient (gradient_editor_dialog, gradient);
}
/* the palette editor */
static PaletteEditor *palette_editor_dialog = NULL;
GtkWidget *
dialogs_palette_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
if (! palette_editor_dialog)
{
palette_editor_dialog = palette_editor_new (context->gimp);
}
return ((EEKWrapper *) palette_editor_dialog)->shell;
}
void
dialogs_edit_palette_func (GimpData *data)
{
GimpPalette *palette;
palette = GIMP_PALETTE (data);
gimp_dialog_factory_dialog_raise (global_dialog_factory,
"gimp:palette-editor",
-1);
palette_editor_set_palette (palette_editor_dialog, palette);
}
/* docks */
GtkWidget *
......@@ -888,6 +774,89 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
}
/* editors */
/* the brush editor */
static GimpDataEditor *brush_editor = NULL;
GtkWidget *
dialogs_brush_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
brush_editor = gimp_brush_editor_new (context->gimp);
return dialogs_dockable_new (GTK_WIDGET (brush_editor),
"Brush Editor", "Brush Editor",
NULL, NULL);
}
void
dialogs_edit_brush_func (GimpData *data)
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
"gimp:brush-editor",
-1);
gimp_data_editor_set_data (brush_editor, data);
}
/* the gradient editor */
static GimpDataEditor *gradient_editor = NULL;
GtkWidget *
dialogs_gradient_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
gradient_editor = gimp_gradient_editor_new (context->gimp);
return dialogs_dockable_new (GTK_WIDGET (gradient_editor),
"Gradient Editor", "Gradient Editor",
NULL, NULL);
}
void
dialogs_edit_gradient_func (GimpData *data)
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
"gimp:gradient-editor",
-1);
gimp_data_editor_set_data (gradient_editor, data);
}
/* the palette editor */
static GimpDataEditor *palette_editor = NULL;
GtkWidget *
dialogs_palette_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
palette_editor = gimp_palette_editor_new (context->gimp);
return dialogs_dockable_new (GTK_WIDGET (palette_editor),
"Palette Editor", "Palette Editor",
NULL, NULL);
}
void
dialogs_edit_palette_func (GimpData *data)
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
"gimp:palette-editor",
-1);
gimp_data_editor_set_data (palette_editor, data);
}
/* misc dockables */
GtkWidget *
......
......@@ -20,6 +20,8 @@
#define __DIALOGS_CONSTRUCTORS_H__
/* toplevel dialogs */
GtkWidget * dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......@@ -60,20 +62,8 @@ GtkWidget * dialogs_about_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_brush_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
void dialogs_edit_brush_func (GimpData *data);
GtkWidget * dialogs_gradient_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
void dialogs_edit_gradient_func (GimpData *data);
GtkWidget * dialogs_palette_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
void dialogs_edit_palette_func (GimpData *data);
/* docks & dockables */
GtkWidget * dialogs_dock_new (GimpDialogFactory *factory,
GimpContext *context,
......@@ -143,6 +133,21 @@ GtkWidget * dialogs_document_history_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_brush_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
void dialogs_edit_brush_func (GimpData *data);
GtkWidget * dialogs_gradient_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
void dialogs_edit_gradient_func (GimpData *data);
GtkWidget * dialogs_palette_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
void dialogs_edit_palette_func (GimpData *data);
GtkWidget * dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......
......@@ -50,11 +50,7 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp:undo-history-dialog", dialogs_undo_history_get, 32, FALSE, FALSE, FALSE, TRUE },
{ "gimp:display-filters-dialog", dialogs_display_filters_get, 32, FALSE, FALSE, FALSE, TRUE },
{ "gimp:tips-dialog", dialogs_tips_get, 32, TRUE, FALSE, FALSE, TRUE },
{ "gimp:about-dialog", dialogs_about_get, 32, TRUE, FALSE, FALSE, TRUE },
{ "gimp:brush-editor", dialogs_brush_editor_get, 32, TRUE, TRUE, TRUE, FALSE },
{ "gimp:gradient-editor", dialogs_gradient_editor_get, 32, TRUE, TRUE, TRUE, FALSE },
{ "gimp:palette-editor", dialogs_palette_editor_get, 32, TRUE, TRUE, TRUE, FALSE }
{ "gimp:about-dialog", dialogs_about_get, 32, TRUE, FALSE, FALSE, TRUE }
};
static const GimpDialogFactoryEntry dock_entries[] =
......@@ -83,7 +79,11 @@ static const GimpDialogFactoryEntry dock_entries[] =
{ "gimp:document-history", dialogs_document_history_new, 48, FALSE, FALSE, FALSE, TRUE },
{ "gimp:error-console", dialogs_error_console_get, 32, TRUE, FALSE, FALSE, TRUE }
{ "gimp:brush-editor", dialogs_brush_editor_get, 0, TRUE, FALSE, FALSE, TRUE },
{ "gimp:gradient-editor", dialogs_gradient_editor_get, 0, TRUE, FALSE, FALSE, TRUE },
{ "gimp:palette-editor", dialogs_palette_editor_get, 0, TRUE, FALSE, FALSE, TRUE },
{ "gimp:error-console", dialogs_error_console_get, 0, TRUE, FALSE, FALSE, TRUE }
};
......@@ -128,9 +128,15 @@ dialogs_init (Gimp *gimp)
void
dialogs_exit (Gimp *gimp)
{
g_object_unref (G_OBJECT (global_dialog_factory));
g_object_unref (G_OBJECT (global_dock_factory));
global_dialog_factory = NULL;
global_dock_factory = NULL;
if (global_dialog_factory)
{
g_object_unref (G_OBJECT (global_dialog_factory));
global_dialog_factory = NULL;
}
if (global_dock_factory)
{
g_object_unref (G_OBJECT (global_dock_factory));
global_dock_factory = NULL;
}
}
......@@ -6,8 +6,6 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
about-dialog.c \
about-dialog.h \
authors.h \
brush-editor.c \
brush-editor.h \
brush-select.c \
brush-select.h \
brushes-commands.c \
......@@ -56,8 +54,6 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
file-open-dialog.h \
file-save-dialog.c \
file-save-dialog.h \
gradient-editor.c \
gradient-editor.h \
gradient-editor-commands.c \
gradient-editor-commands.h \
gradient-select.h \
......@@ -83,8 +79,6 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
module-browser.h \
offset-dialog.c \
offset-dialog.h \
palette-editor.c \
palette-editor.h \
palette-import-dialog.c \
palette-import-dialog.h \
palette-select.c \
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* brush-editor.c
* Copyright 1998 Jay Cox <jaycox@earthlink.net>
*
* 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 <string.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "base/temp-buf.h"
#include "core/gimpbrushgenerated.h"
#include "brush-editor.h"
#include "libgimp/gimpintl.h"
struct _BrushEditor
{
GtkWidget *shell;
GtkWidget *frame;
GtkWidget *preview;
GtkWidget *scale_label;
GtkWidget *options_box;
GtkWidget *name;
GtkAdjustment *radius_data;
GtkAdjustment *hardness_data;
GtkAdjustment *angle_data;
GtkAdjustment *aspect_ratio_data;
/* Brush preview */
GtkWidget *brush_preview;
GimpBrushGenerated *brush;
gint scale;
};
static void brush_editor_close_callback (GtkWidget *widget,
gpointer data);
static void brush_editor_name_activate (GtkWidget *widget,
BrushEditor *brush_editor);
static gboolean brush_editor_name_focus_out (GtkWidget *widget,
GdkEventFocus *fevent,
BrushEditor *brush_editor);
static void brush_editor_update_brush (GtkAdjustment *adjustment,
BrushEditor *brush_editor);
static void brush_editor_preview_resize (GtkWidget *widget,
GtkAllocation *allocation,
BrushEditor *brush_editor);
static void brush_editor_clear_preview (BrushEditor *brush_editor);
static void brush_editor_brush_dirty (GimpBrush *brush,
BrushEditor *brush_editor);
static void brush_editor_brush_name_changed (GtkWidget *widget,
BrushEditor *brush_editor);
/* public functions */
BrushEditor *
brush_editor_new (Gimp *gimp)
{
BrushEditor *brush_editor;
GtkWidget *vbox;
GtkWidget *slider;
GtkWidget *table;
brush_editor = g_new0 (BrushEditor, 1);
brush_editor->shell =
gimp_dialog_new (_("Brush Editor"), "generated_brush_editor",
gimp_standard_help_func,
"dialogs/brush_editor.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
"_delete_event_", brush_editor_close_callback,
brush_editor, NULL, NULL, TRUE, TRUE,
NULL);
gtk_dialog_set_has_separator (GTK_DIALOG (brush_editor->shell), FALSE);
gtk_widget_hide (GTK_DIALOG (brush_editor->shell)->action_area);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (brush_editor->shell)->vbox),
vbox);
/* Brush's name */
brush_editor->name = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), brush_editor->name, FALSE, FALSE, 0);
gtk_widget_show (brush_editor->name);
g_signal_connect (G_OBJECT (brush_editor->name), "activate",
G_CALLBACK (brush_editor_name_activate),
brush_editor);
g_signal_connect (G_OBJECT (brush_editor->name), "focus_out_event",
G_CALLBACK (brush_editor_name_focus_out),
brush_editor);
/* brush's preview widget w/frame */
brush_editor->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (brush_editor->frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), brush_editor->frame, TRUE, TRUE, 0);
gtk_widget_show (brush_editor->frame);
brush_editor->preview = gtk_preview_new (GTK_PREVIEW_GRAYSCALE);
gtk_preview_size (GTK_PREVIEW (brush_editor->preview), 125, 100);
/* Enable auto-resizing of the preview but ensure a minimal size */
gtk_widget_set_size_request (brush_editor->preview, 125, 100);
gtk_preview_set_expand (GTK_PREVIEW (brush_editor->preview), TRUE);
gtk_container_add (GTK_CONTAINER (brush_editor->frame), brush_editor->preview);
gtk_widget_show (brush_editor->preview);
g_signal_connect_after (G_OBJECT (brush_editor->frame), "size_allocate",
G_CALLBACK (brush_editor_preview_resize),
brush_editor);
/* table for sliders/labels */
brush_editor->scale_label = gtk_label_new ("-1:1");
gtk_box_pack_start (GTK_BOX (vbox), brush_editor->scale_label,
FALSE, FALSE, 0);
gtk_widget_show (brush_editor->scale_label);
brush_editor->scale = -1;
/* table for sliders/labels */
table = gtk_table_new (4, 2, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
/* brush radius scale */
brush_editor->radius_data =
GTK_ADJUSTMENT (gtk_adjustment_new (10.0, 0.0, 100.0, 0.1, 1.0, 0.0));
slider = gtk_hscale_new (brush_editor->radius_data);
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
g_signal_connect (G_OBJECT (brush_editor->radius_data), "value_changed",
G_CALLBACK (brush_editor_update_brush),
brush_editor);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Radius:"), 1.0, 1.0,
slider, 1, FALSE);
/* brush hardness scale */
brush_editor->hardness_data =
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.01, 0.0));
slider = gtk_hscale_new (brush_editor->hardness_data);
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
g_signal_connect (G_OBJECT (brush_editor->hardness_data), "value_changed",
G_CALLBACK (brush_editor_update_brush),
brush_editor);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Hardness:"), 1.0, 1.0,
slider, 1, FALSE);
/* brush aspect ratio scale */
brush_editor->aspect_ratio_data =
GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 1.0, 20.0, 0.1, 1.0, 0.0));
slider = gtk_hscale_new (brush_editor->aspect_ratio_data);
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
g_signal_connect (G_OBJECT (brush_editor->aspect_ratio_data),"value_changed",
G_CALLBACK (brush_editor_update_brush),
brush_editor);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
_("Aspect Ratio:"), 1.0, 1.0,
slider, 1, FALSE);
/* brush angle scale */
brush_editor->angle_data =
GTK_ADJUSTMENT (gtk_adjustment_new (00.0, 0.0, 180.0, 0.1, 1.0, 0.0));
slider = gtk_hscale_new (brush_editor->angle_data);
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
g_signal_connect (G_OBJECT (brush_editor->angle_data), "value_changed",
G_CALLBACK (brush_editor_update_brush),
brush_editor);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Angle:"), 1.0, 1.0,
slider, 1, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (brush_editor->shell);
return brush_editor;
}
void
brush_editor_set_brush (BrushEditor *brush_editor,
GimpBrush *gbrush)
{
GimpBrushGenerated *brush = NULL;
g_return_if_fail (brush_editor != NULL);
g_return_if_fail (GIMP_IS_BRUSH_GENERATED (gbrush));
if (brush_editor->brush)
{
g_signal_handlers_disconnect_by_func (G_OBJECT (brush_editor->brush),
brush_editor_brush_dirty,
brush_editor);
g_signal_handlers_disconnect_by_func (G_OBJECT (brush_editor->brush),
brush_editor_brush_name_changed,
brush_editor);
g_object_unref (G_OBJECT (brush_editor->brush));
brush_editor->brush = NULL;
}
brush = GIMP_BRUSH_GENERATED (gbrush);
g_signal_connect (G_OBJECT (brush), "invalidate_preview",
G_CALLBACK (brush_editor_brush_dirty),
brush_editor);
g_signal_connect (G_OBJECT (brush), "name_changed",
G_CALLBACK (brush_editor_brush_name_changed),
brush_editor);
gtk_adjustment_set_value (GTK_ADJUSTMENT (brush_editor->radius_data),
gimp_brush_generated_get_radius (brush));
gtk_adjustment_set_value (GTK_ADJUSTMENT (brush_editor->hardness_data),
gimp_brush_generated_get_hardness (brush));
gtk_adjustment_set_value (GTK_ADJUSTMENT (brush_editor->angle_data),
gimp_brush_generated_get_angle (brush));
gtk_adjustment_set_value (GTK_ADJUSTMENT (brush_editor->aspect_ratio_data),
gimp_brush_generated_get_aspect_ratio (brush));
gtk_entry_set_text (GTK_ENTRY (brush_editor->name),
gimp_object_get_name (GIMP_OBJECT (gbrush)));
brush_editor->brush = brush;
g_object_ref (G_OBJECT (brush_editor->brush));
brush_editor_brush_dirty (GIMP_BRUSH (brush), brush_editor);
}
/* private functions */
static void
brush_editor_close_callback (GtkWidget *widget,
gpointer data)
{
BrushEditor *brush_editor = (BrushEditor *) data;