Commit cac3f7cb authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/apptypes.h app/brush_edit.c app/brush_select.c app/brushes_cmds.c

2001-01-14  Michael Natterer  <mitch@gimp.org>

	* app/apptypes.h
	* app/brush_edit.c
	* app/brush_select.c
	* app/brushes_cmds.c
	* app/channel.h
	* app/colormap_dialog.c
	* app/datafiles.[ch]
	* app/devices.c
	* app/docindex.c
	* app/fileops.c
	* app/gdisplay.c
	* app/gimage.c
	* app/gimpbrush.[ch]
	* app/gimpbrushgenerated.[ch]
	* app/gimpbrushlist.[ch]
	* app/gimpbrushpipe.[ch]
	* app/gimpcontext.[ch]
	* app/gimpcontextpreview.c
	* app/gimpdnd.c
	* app/gimpdrawable.h
	* app/gimpimage.[ch]
	* app/gimplist.h
	* app/gimpobject.h
	* app/gimpset.[ch]
	* app/gradient.c
	* app/info_window.c
	* app/layer.[ch]
	* app/module_db.c
	* app/palette.[ch]
	* app/patterns.[ch]
	* app/plug_in.[ch]
	* app/undo_history.c
	* app/xcf.c
	* tools/pdbgen/pdb/brushes.pdb

	- Removed the "name" argument from all objects and use
	  GimpObject's name.
	- Use the same code in all "uniquefy name" functions (this
	  functionality will be a method of the "GimpContainer" class).
	- Renamed the parent instances of all objects to "parent instance".
	- Added missing instance and class cast macros.
	- Changed some "gchar *" to "const gchar *" parameters.
parent fc121e6c
2001-01-14 Michael Natterer <mitch@gimp.org>
* app/apptypes.h
* app/brush_edit.c
* app/brush_select.c
* app/brushes_cmds.c
* app/channel.h
* app/colormap_dialog.c
* app/datafiles.[ch]
* app/devices.c
* app/docindex.c
* app/fileops.c
* app/gdisplay.c
* app/gimage.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontext.[ch]
* app/gimpcontextpreview.c
* app/gimpdnd.c
* app/gimpdrawable.h
* app/gimpimage.[ch]
* app/gimplist.h
* app/gimpobject.h
* app/gimpset.[ch]
* app/gradient.c
* app/info_window.c
* app/layer.[ch]
* app/module_db.c
* app/palette.[ch]
* app/patterns.[ch]
* app/plug_in.[ch]
* app/undo_history.c
* app/xcf.c
* tools/pdbgen/pdb/brushes.pdb
- Removed the "name" argument from all objects and use
GimpObject's name.
- Use the same code in all "uniquefy name" functions (this
functionality will be a method of the "GimpContainer" class).
- Renamed the parent instances of all objects to "parent instance".
- Added missing instance and class cast macros.
- Changed some "gchar *" to "const gchar *" parameters.
2001-01-12 Sven Neumann <sven@gimp.org> 2001-01-12 Sven Neumann <sven@gimp.org>
* TODO.xml: updated status * TODO.xml: updated status
......
...@@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); ...@@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_write_rc (gchar *filename); static void plug_in_write_rc (const gchar *filename);
static void plug_in_init_file (gchar *filename); static void plug_in_init_file (const gchar *filename);
static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_query (PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
...@@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, ...@@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name,
PlugInDef * PlugInDef *
plug_in_def_new (gchar *prog) plug_in_def_new (const gchar *prog)
{ {
PlugInDef *plug_in_def; PlugInDef *plug_in_def;
...@@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, ...@@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp,
} }
static void static void
plug_in_write_rc (gchar *filename) plug_in_write_rc (const gchar *filename)
{ {
FILE *fp; FILE *fp;
PlugInDef *plug_in_def; PlugInDef *plug_in_def;
...@@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) ...@@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename)
} }
static void static void
plug_in_init_file (gchar *filename) plug_in_init_file (const gchar *filename)
{ {
GSList *tmp; GSList *tmp;
PlugInDef *plug_in_def; PlugInDef *plug_in_def;
......
...@@ -88,9 +88,9 @@ typedef enum ...@@ -88,9 +88,9 @@ typedef enum
COLOR_MODE, COLOR_MODE,
VALUE_MODE, VALUE_MODE,
DIVIDE_MODE, DIVIDE_MODE,
DODGE_MODE, DODGE_MODE,
BURN_MODE, BURN_MODE,
HARDLIGHT_MODE, HARDLIGHT_MODE,
ERASE_MODE, /*< skip >*/ ERASE_MODE, /*< skip >*/
REPLACE_MODE, /*< skip >*/ REPLACE_MODE, /*< skip >*/
ANTI_ERASE_MODE /*< skip >*/ ANTI_ERASE_MODE /*< skip >*/
...@@ -152,7 +152,7 @@ typedef enum ...@@ -152,7 +152,7 @@ typedef enum
} InterpolationType; } InterpolationType;
typedef enum /*< skip >*/ typedef enum /*< skip >*/
{ {
ORIENTATION_UNKNOWN, ORIENTATION_UNKNOWN,
ORIENTATION_HORIZONTAL, ORIENTATION_HORIZONTAL,
ORIENTATION_VERTICAL ORIENTATION_VERTICAL
...@@ -203,7 +203,6 @@ typedef enum ...@@ -203,7 +203,6 @@ typedef enum
PDB_CANCEL PDB_CANCEL
} PDBStatusType; } PDBStatusType;
/* Procedure types */ /* Procedure types */
typedef enum /*< chop=PDB_ >*/ typedef enum /*< chop=PDB_ >*/
{ {
......
...@@ -140,11 +140,11 @@ brush_edit_brush_dirty_callback (GimpBrush *brush, ...@@ -140,11 +140,11 @@ brush_edit_brush_dirty_callback (GimpBrush *brush,
} }
static void static void
brush_renamed_callback (GtkWidget *widget, brush_name_changed_callback (GtkWidget *widget,
BrushEditGeneratedWindow *begw) BrushEditGeneratedWindow *begw)
{ {
gtk_entry_set_text (GTK_ENTRY (begw->name), gtk_entry_set_text (GTK_ENTRY (begw->name),
gimp_brush_get_name (GIMP_BRUSH (begw->brush))); gimp_object_get_name (GIMP_OBJECT (begw->brush)));
} }
void void
...@@ -178,8 +178,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw, ...@@ -178,8 +178,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
gtk_signal_connect (GTK_OBJECT (brush), "dirty", gtk_signal_connect (GTK_OBJECT (brush), "dirty",
GTK_SIGNAL_FUNC (brush_edit_brush_dirty_callback), GTK_SIGNAL_FUNC (brush_edit_brush_dirty_callback),
begw); begw);
gtk_signal_connect (GTK_OBJECT (brush), "rename", gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
GTK_SIGNAL_FUNC (brush_renamed_callback), GTK_SIGNAL_FUNC (brush_name_changed_callback),
begw); begw);
begw->brush = NULL; begw->brush = NULL;
...@@ -191,7 +191,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw, ...@@ -191,7 +191,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
gimp_brush_generated_get_angle (brush)); gimp_brush_generated_get_angle (brush));
gtk_adjustment_set_value (GTK_ADJUSTMENT (begw->aspect_ratio_data), gtk_adjustment_set_value (GTK_ADJUSTMENT (begw->aspect_ratio_data),
gimp_brush_generated_get_aspect_ratio (brush)); gimp_brush_generated_get_aspect_ratio (brush));
gtk_entry_set_text (GTK_ENTRY (begw->name), gimp_brush_get_name (gbrush)); gtk_entry_set_text (GTK_ENTRY (begw->name),
gimp_object_get_name (GIMP_OBJECT (gbrush)));
begw->brush = brush; begw->brush = brush;
gtk_object_ref (GTK_OBJECT (begw->brush)); gtk_object_ref (GTK_OBJECT (begw->brush));
...@@ -205,7 +206,7 @@ name_changed_func (GtkWidget *widget, ...@@ -205,7 +206,7 @@ name_changed_func (GtkWidget *widget,
gchar *entry_text; gchar *entry_text;
entry_text = gtk_entry_get_text (GTK_ENTRY (widget)); entry_text = gtk_entry_get_text (GTK_ENTRY (widget));
gimp_brush_set_name (GIMP_BRUSH (begw->brush), entry_text); gimp_object_set_name (GIMP_OBJECT (begw->brush), entry_text);
} }
void void
......
...@@ -676,10 +676,11 @@ static void ...@@ -676,10 +676,11 @@ static void
brush_change_callbacks (BrushSelect *bsp, brush_change_callbacks (BrushSelect *bsp,
gboolean closing) gboolean closing)
{ {
gchar *name; gchar *name;
ProcRecord *prec = NULL; ProcRecord *prec = NULL;
GimpBrush *brush; GimpBrush *brush;
gint nreturn_vals; gint nreturn_vals;
static gboolean busy = FALSE; static gboolean busy = FALSE;
/* Any procs registered to callback? */ /* Any procs registered to callback? */
...@@ -688,8 +689,8 @@ brush_change_callbacks (BrushSelect *bsp, ...@@ -688,8 +689,8 @@ brush_change_callbacks (BrushSelect *bsp,
if (!bsp || !bsp->callback_name || busy) if (!bsp || !bsp->callback_name || busy)
return; return;
busy = TRUE; busy = TRUE;
name = bsp->callback_name; name = bsp->callback_name;
brush = gimp_context_get_brush (bsp->context); brush = gimp_context_get_brush (bsp->context);
/* If its still registered run it */ /* If its still registered run it */
...@@ -700,7 +701,7 @@ brush_change_callbacks (BrushSelect *bsp, ...@@ -700,7 +701,7 @@ brush_change_callbacks (BrushSelect *bsp,
return_vals = return_vals =
procedural_db_run_proc (name, procedural_db_run_proc (name,
&nreturn_vals, &nreturn_vals,
PDB_STRING, brush->name, PDB_STRING, GIMP_OBJECT (brush)->name,
PDB_FLOAT, gimp_context_get_opacity (bsp->context), PDB_FLOAT, gimp_context_get_opacity (bsp->context),
PDB_INT32, bsp->spacing_value, PDB_INT32, bsp->spacing_value,
PDB_INT32, (gint) gimp_context_get_paint_mode (bsp->context), PDB_INT32, (gint) gimp_context_get_paint_mode (bsp->context),
...@@ -725,9 +726,9 @@ void ...@@ -725,9 +726,9 @@ void
brushes_check_dialogs (void) brushes_check_dialogs (void)
{ {
BrushSelect *bsp; BrushSelect *bsp;
GSList *list; GSList *list;
gchar *name; gchar *name;
ProcRecord *prec = NULL; ProcRecord *prec = NULL;
list = brush_active_dialogs; list = brush_active_dialogs;
...@@ -896,7 +897,7 @@ connect_signals_to_brush (GimpBrush *brush, ...@@ -896,7 +897,7 @@ connect_signals_to_brush (GimpBrush *brush,
gtk_signal_connect (GTK_OBJECT (brush), "dirty", gtk_signal_connect (GTK_OBJECT (brush), "dirty",
GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback), GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback),
bsp); bsp);
gtk_signal_connect (GTK_OBJECT (brush), "rename", gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback), GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback),
bsp); bsp);
} }
...@@ -1484,7 +1485,7 @@ update_active_brush_field (BrushSelect *bsp) ...@@ -1484,7 +1485,7 @@ update_active_brush_field (BrushSelect *bsp)
return; return;
/* Set brush name */ /* Set brush name */
gtk_label_set_text (GTK_LABEL (bsp->brush_name), brush->name); gtk_label_set_text (GTK_LABEL (bsp->brush_name), GIMP_OBJECT (brush)->name);
/* Set brush size */ /* Set brush size */
g_snprintf (buf, sizeof (buf), "(%d x %d)", g_snprintf (buf, sizeof (buf), "(%d x %d)",
......
...@@ -106,7 +106,7 @@ brushes_get_brush_invoker (Argument *args) ...@@ -106,7 +106,7 @@ brushes_get_brush_invoker (Argument *args)
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (brush->name); return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name);
return_args[2].value.pdb_int = brush->mask->width; return_args[2].value.pdb_int = brush->mask->width;
return_args[3].value.pdb_int = brush->mask->height; return_args[3].value.pdb_int = brush->mask->height;
return_args[4].value.pdb_int = brush->spacing; return_args[4].value.pdb_int = brush->spacing;
...@@ -450,7 +450,7 @@ brushes_list_invoker (Argument *args) ...@@ -450,7 +450,7 @@ brushes_list_invoker (Argument *args)
while (list) while (list)
{ {
brushes[i++] = g_strdup (((GimpBrush *) list->data)->name); brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
list = list->next; list = list->next;
} }
...@@ -521,7 +521,7 @@ brushes_get_brush_data_invoker (Argument *args) ...@@ -521,7 +521,7 @@ brushes_get_brush_data_invoker (Argument *args)
{ {
brush = (GimpBrush *) list->data; brush = (GimpBrush *) list->data;
if (!strcmp (brush->name, name)) if (!strcmp (GIMP_OBJECT (brush)->name, name))
{ {
success = TRUE; success = TRUE;
break; break;
...@@ -543,7 +543,7 @@ brushes_get_brush_data_invoker (Argument *args) ...@@ -543,7 +543,7 @@ brushes_get_brush_data_invoker (Argument *args)
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (brush->name); return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name);
return_args[2].value.pdb_float = 1.0; return_args[2].value.pdb_float = 1.0;
return_args[3].value.pdb_int = brush->spacing; return_args[3].value.pdb_int = brush->spacing;
return_args[4].value.pdb_int = 0; return_args[4].value.pdb_int = 0;
......
...@@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass; ...@@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass;
struct _GimpChannel struct _GimpChannel
{ {
GimpDrawable drawable; GimpDrawable parent_instance;
guchar col[3]; /* RGB triplet for channel color */ guchar col[3]; /* RGB triplet for channel color */
gint opacity; /* Channel opacity */ gint opacity; /* Channel opacity */
gboolean show_masked; /* Show masked areas--as */ gboolean show_masked; /* Show masked areas--as */
/* opposed to selected areas */ /* opposed to selected areas */
/* Selection mask variables */ /* Selection mask variables */
gboolean boundary_known; /* is the current boundary valid */ gboolean boundary_known; /* is the current boundary valid */
BoundSeg *segs_in; /* outline of selected region */ BoundSeg *segs_in; /* outline of selected region */
BoundSeg *segs_out; /* outline of selected region */ BoundSeg *segs_out; /* outline of selected region */
gint num_segs_in; /* number of lines in boundary */ gint num_segs_in; /* number of lines in boundary */
gint num_segs_out; /* number of lines in boundary */ gint num_segs_out; /* number of lines in boundary */
gboolean empty; /* is the region empty? */ gboolean empty; /* is the region empty? */
gboolean bounds_known; /* recalculate the bounds? */ gboolean bounds_known; /* recalculate the bounds? */
gint x1, y1; /* coordinates for bounding box */ gint x1, y1; /* coordinates for bounding box */
gint x2, y2; /* lower right hand coordinate */ gint x2, y2; /* lower right hand coordinate */
}; };
struct _GimpChannelClass struct _GimpChannelClass
{ {
GimpDrawableClass parent_class; GimpDrawableClass parent_class;
void (* removed) (GimpChannel *channel); void (* removed) (GimpChannel *channel);
}; };
......
...@@ -263,7 +263,7 @@ gimp_colormap_dialog_create (GimpSet *context) ...@@ -263,7 +263,7 @@ gimp_colormap_dialog_create (GimpSet *context)
image_cmap_change_cb, image_cmap_change_cb,
ipal); ipal);
ipal->rename_handler = gimp_set_add_handler (context, ipal->rename_handler = gimp_set_add_handler (context,
"rename", "name_changed",
image_rename_cb, image_rename_cb,
ipal); ipal);
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
enum enum
{ {
DIRTY, DIRTY,
RENAME,
LAST_SIGNAL LAST_SIGNAL
}; };
...@@ -78,7 +77,6 @@ gimp_brush_destroy (GtkObject *object) ...@@ -78,7 +77,6 @@ gimp_brush_destroy (GtkObject *object)
GimpBrush *brush = GIMP_BRUSH (object); GimpBrush *brush = GIMP_BRUSH (object);
g_free (brush->filename); g_free (brush->filename);
g_free (brush->name);
if (brush->mask) if (brush->mask)
temp_buf_free (brush->mask); temp_buf_free (brush->mask);
...@@ -105,21 +103,11 @@ gimp_brush_class_init (GimpBrushClass *klass) ...@@ -105,21 +103,11 @@ gimp_brush_class_init (GimpBrushClass *klass)
gtk_signal_default_marshaller, gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0); GTK_TYPE_NONE, 0);
gimp_brush_signals[RENAME] =
gtk_signal_new ("rename",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpBrushClass,
rename),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, gimp_brush_signals, LAST_SIGNAL); gtk_object_class_add_signals (object_class, gimp_brush_signals, LAST_SIGNAL);
object_class->destroy = gimp_brush_destroy; object_class->destroy = gimp_brush_destroy;
klass->dirty = NULL; klass->dirty = NULL;
klass->rename = NULL;
klass->select_brush = gimp_brush_select_brush; klass->select_brush = gimp_brush_select_brush;
klass->want_null_motion = gimp_brush_want_null_motion; klass->want_null_motion = gimp_brush_want_null_motion;
...@@ -129,7 +117,6 @@ void ...@@ -129,7 +117,6 @@ void
gimp_brush_init (GimpBrush *brush) gimp_brush_init (GimpBrush *brush)
{ {
brush->filename = NULL; brush->filename = NULL;
brush->name = NULL;
brush->spacing = 20; brush->spacing = 20;
brush->x_axis.x = 15.0; brush->x_axis.x = 15.0;
...@@ -167,7 +154,7 @@ gimp_brush_get_type (void) ...@@ -167,7 +154,7 @@ gimp_brush_get_type (void)
} }
GimpBrush * GimpBrush *
gimp_brush_load (gchar *filename) gimp_brush_load (const gchar *filename)
{ {
GimpBrush *brush; GimpBrush *brush;
gint fd; gint fd;
...@@ -208,7 +195,7 @@ gimp_brush_want_null_motion (PaintCore *paint_core) ...@@ -208,7 +195,7 @@ gimp_brush_want_null_motion (PaintCore *paint_core)
} }
TempBuf * TempBuf *
gimp_brush_get_mask (GimpBrush *brush) gimp_brush_get_mask (const GimpBrush *brush)
{ {
g_return_val_if_fail (brush != NULL, NULL); g_return_val_if_fail (brush != NULL, NULL);
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
...@@ -217,7 +204,7 @@ gimp_brush_get_mask (GimpBrush *brush) ...@@ -217,7 +204,7 @@ gimp_brush_get_mask (GimpBrush *brush)
} }
TempBuf * TempBuf *
gimp_brush_get_pixmap (GimpBrush *brush) gimp_brush_get_pixmap (const GimpBrush *brush)
{ {
g_return_val_if_fail (brush != NULL, NULL); g_return_val_if_fail (brush != NULL, NULL);
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
...@@ -225,34 +212,8 @@ gimp_brush_get_pixmap (GimpBrush *brush) ...@@ -225,34 +212,8 @@ gimp_brush_get_pixmap (GimpBrush *brush)
return brush->pixmap; return brush->pixmap;
} }
gchar *
gimp_brush_get_name (GimpBrush *brush)
{
g_return_val_if_fail (brush != NULL, NULL);
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
return brush->name;
}
void
gimp_brush_set_name (GimpBrush *brush,
gchar *name)
{
g_return_if_fail (brush != NULL);
g_return_if_fail (GIMP_IS_BRUSH (brush));
if (strcmp (brush->name, name) == 0)
return;
if (brush->name)
g_free (brush->name);
brush->name = g_strdup (name);
gtk_signal_emit (GTK_OBJECT (brush), gimp_brush_signals[RENAME]);
}
gint gint
gimp_brush_get_spacing (GimpBrush *brush) gimp_brush_get_spacing (const GimpBrush *brush)
{ {
g_return_val_if_fail (brush != NULL, 0); g_return_val_if_fail (brush != NULL, 0);
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0); g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0);
...@@ -271,8 +232,8 @@ gimp_brush_set_spacing (GimpBrush *brush, ...@@ -271,8 +232,8 @@ gimp_brush_set_spacing (GimpBrush *brush,
} }
GimpBrush * GimpBrush *
gimp_brush_load_brush (gint fd, gimp_brush_load_brush (gint fd,
gchar *filename) const gchar *filename)
{ {
GimpBrush *brush; GimpBrush *brush;
GPattern *pattern; GPattern *pattern;
...@@ -285,7 +246,7 @@ gimp_brush_load_brush (gint fd, ...@@ -285,7 +246,7 @@ gimp_brush_load_brush (gint fd,
g_return_val_if_fail (fd != -1, NULL); g_return_val_if_fail (fd != -1, NULL);
/* Read in the header size */ /* Read in the header size */
if (read (fd, &header, sizeof (header)) != sizeof (header)) if (read (fd, &header, sizeof (header)) != sizeof (header))
return NULL; return NULL;