mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
fc121e6ce9
commit
cac3f7cb25
45
ChangeLog
45
ChangeLog
|
@ -1,3 +1,48 @@
|
|||
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>
|
||||
|
||||
* TODO.xml: updated status
|
||||
|
|
|
@ -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_install (GPProcInstall *proc_install);
|
||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||
static void plug_in_write_rc (gchar *filename);
|
||||
static void plug_in_init_file (gchar *filename);
|
||||
static void plug_in_write_rc (const gchar *filename);
|
||||
static void plug_in_init_file (const gchar *filename);
|
||||
static void plug_in_query (PlugInDef *plug_in_def);
|
||||
static void plug_in_add_to_db (void);
|
||||
static void plug_in_make_menu (void);
|
||||
|
@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name,
|
|||
|
||||
|
||||
PlugInDef *
|
||||
plug_in_def_new (gchar *prog)
|
||||
plug_in_def_new (const gchar *prog)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
|
||||
|
@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp,
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_write_rc (gchar *filename)
|
||||
plug_in_write_rc (const gchar *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename)
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_init_file (gchar *filename)
|
||||
plug_in_init_file (const gchar *filename)
|
||||
{
|
||||
GSList *tmp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
|
|
@ -88,9 +88,9 @@ typedef enum
|
|||
COLOR_MODE,
|
||||
VALUE_MODE,
|
||||
DIVIDE_MODE,
|
||||
DODGE_MODE,
|
||||
BURN_MODE,
|
||||
HARDLIGHT_MODE,
|
||||
DODGE_MODE,
|
||||
BURN_MODE,
|
||||
HARDLIGHT_MODE,
|
||||
ERASE_MODE, /*< skip >*/
|
||||
REPLACE_MODE, /*< skip >*/
|
||||
ANTI_ERASE_MODE /*< skip >*/
|
||||
|
@ -152,7 +152,7 @@ typedef enum
|
|||
} InterpolationType;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
{
|
||||
ORIENTATION_UNKNOWN,
|
||||
ORIENTATION_HORIZONTAL,
|
||||
ORIENTATION_VERTICAL
|
||||
|
@ -203,7 +203,6 @@ typedef enum
|
|||
PDB_CANCEL
|
||||
} PDBStatusType;
|
||||
|
||||
|
||||
/* Procedure types */
|
||||
typedef enum /*< chop=PDB_ >*/
|
||||
{
|
||||
|
|
|
@ -140,11 +140,11 @@ brush_edit_brush_dirty_callback (GimpBrush *brush,
|
|||
}
|
||||
|
||||
static void
|
||||
brush_renamed_callback (GtkWidget *widget,
|
||||
BrushEditGeneratedWindow *begw)
|
||||
brush_name_changed_callback (GtkWidget *widget,
|
||||
BrushEditGeneratedWindow *begw)
|
||||
{
|
||||
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
|
||||
|
@ -178,8 +178,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
|
|||
gtk_signal_connect (GTK_OBJECT (brush), "dirty",
|
||||
GTK_SIGNAL_FUNC (brush_edit_brush_dirty_callback),
|
||||
begw);
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "rename",
|
||||
GTK_SIGNAL_FUNC (brush_renamed_callback),
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
|
||||
GTK_SIGNAL_FUNC (brush_name_changed_callback),
|
||||
begw);
|
||||
|
||||
begw->brush = NULL;
|
||||
|
@ -191,7 +191,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
|
|||
gimp_brush_generated_get_angle (brush));
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (begw->aspect_ratio_data),
|
||||
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;
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (begw->brush));
|
||||
|
@ -205,7 +206,7 @@ name_changed_func (GtkWidget *widget,
|
|||
gchar *entry_text;
|
||||
|
||||
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
|
||||
|
|
|
@ -676,10 +676,11 @@ static void
|
|||
brush_change_callbacks (BrushSelect *bsp,
|
||||
gboolean closing)
|
||||
{
|
||||
gchar *name;
|
||||
gchar *name;
|
||||
ProcRecord *prec = NULL;
|
||||
GimpBrush *brush;
|
||||
gint nreturn_vals;
|
||||
GimpBrush *brush;
|
||||
gint nreturn_vals;
|
||||
|
||||
static gboolean busy = FALSE;
|
||||
|
||||
/* Any procs registered to callback? */
|
||||
|
@ -688,8 +689,8 @@ brush_change_callbacks (BrushSelect *bsp,
|
|||
if (!bsp || !bsp->callback_name || busy)
|
||||
return;
|
||||
|
||||
busy = TRUE;
|
||||
name = bsp->callback_name;
|
||||
busy = TRUE;
|
||||
name = bsp->callback_name;
|
||||
brush = gimp_context_get_brush (bsp->context);
|
||||
|
||||
/* If its still registered run it */
|
||||
|
@ -700,7 +701,7 @@ brush_change_callbacks (BrushSelect *bsp,
|
|||
return_vals =
|
||||
procedural_db_run_proc (name,
|
||||
&nreturn_vals,
|
||||
PDB_STRING, brush->name,
|
||||
PDB_STRING, GIMP_OBJECT (brush)->name,
|
||||
PDB_FLOAT, gimp_context_get_opacity (bsp->context),
|
||||
PDB_INT32, bsp->spacing_value,
|
||||
PDB_INT32, (gint) gimp_context_get_paint_mode (bsp->context),
|
||||
|
@ -725,9 +726,9 @@ void
|
|||
brushes_check_dialogs (void)
|
||||
{
|
||||
BrushSelect *bsp;
|
||||
GSList *list;
|
||||
gchar *name;
|
||||
ProcRecord *prec = NULL;
|
||||
GSList *list;
|
||||
gchar *name;
|
||||
ProcRecord *prec = NULL;
|
||||
|
||||
list = brush_active_dialogs;
|
||||
|
||||
|
@ -896,7 +897,7 @@ connect_signals_to_brush (GimpBrush *brush,
|
|||
gtk_signal_connect (GTK_OBJECT (brush), "dirty",
|
||||
GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback),
|
||||
bsp);
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
|
||||
GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback),
|
||||
bsp);
|
||||
}
|
||||
|
@ -1484,7 +1485,7 @@ update_active_brush_field (BrushSelect *bsp)
|
|||
return;
|
||||
|
||||
/* 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 */
|
||||
g_snprintf (buf, sizeof (buf), "(%d x %d)",
|
||||
|
|
|
@ -106,7 +106,7 @@ brushes_get_brush_invoker (Argument *args)
|
|||
|
||||
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[3].value.pdb_int = brush->mask->height;
|
||||
return_args[4].value.pdb_int = brush->spacing;
|
||||
|
@ -450,7 +450,7 @@ brushes_list_invoker (Argument *args)
|
|||
|
||||
while (list)
|
||||
{
|
||||
brushes[i++] = g_strdup (((GimpBrush *) list->data)->name);
|
||||
brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ brushes_get_brush_data_invoker (Argument *args)
|
|||
{
|
||||
brush = (GimpBrush *) list->data;
|
||||
|
||||
if (!strcmp (brush->name, name))
|
||||
if (!strcmp (GIMP_OBJECT (brush)->name, name))
|
||||
{
|
||||
success = TRUE;
|
||||
break;
|
||||
|
@ -543,7 +543,7 @@ brushes_get_brush_data_invoker (Argument *args)
|
|||
|
||||
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[3].value.pdb_int = brush->spacing;
|
||||
return_args[4].value.pdb_int = 0;
|
||||
|
|
|
@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass;
|
|||
|
||||
struct _GimpChannel
|
||||
{
|
||||
GimpDrawable drawable;
|
||||
GimpDrawable parent_instance;
|
||||
|
||||
guchar col[3]; /* RGB triplet for channel color */
|
||||
gint opacity; /* Channel opacity */
|
||||
gboolean show_masked; /* Show masked areas--as */
|
||||
/* opposed to selected areas */
|
||||
guchar col[3]; /* RGB triplet for channel color */
|
||||
gint opacity; /* Channel opacity */
|
||||
gboolean show_masked; /* Show masked areas--as */
|
||||
/* opposed to selected areas */
|
||||
|
||||
/* Selection mask variables */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs_in; /* outline of selected region */
|
||||
BoundSeg *segs_out; /* outline of selected region */
|
||||
gint num_segs_in; /* number of lines in boundary */
|
||||
gint num_segs_out; /* number of lines in boundary */
|
||||
gboolean empty; /* is the region empty? */
|
||||
gboolean bounds_known; /* recalculate the bounds? */
|
||||
gint x1, y1; /* coordinates for bounding box */
|
||||
gint x2, y2; /* lower right hand coordinate */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs_in; /* outline of selected region */
|
||||
BoundSeg *segs_out; /* outline of selected region */
|
||||
gint num_segs_in; /* number of lines in boundary */
|
||||
gint num_segs_out; /* number of lines in boundary */
|
||||
gboolean empty; /* is the region empty? */
|
||||
gboolean bounds_known; /* recalculate the bounds? */
|
||||
gint x1, y1; /* coordinates for bounding box */
|
||||
gint x2, y2; /* lower right hand coordinate */
|
||||
};
|
||||
|
||||
struct _GimpChannelClass
|
||||
{
|
||||
GimpDrawableClass parent_class;
|
||||
GimpDrawableClass parent_class;
|
||||
|
||||
void (* removed) (GimpChannel *channel);
|
||||
};
|
||||
|
|
|
@ -263,7 +263,7 @@ gimp_colormap_dialog_create (GimpSet *context)
|
|||
image_cmap_change_cb,
|
||||
ipal);
|
||||
ipal->rename_handler = gimp_set_add_handler (context,
|
||||
"rename",
|
||||
"name_changed",
|
||||
image_rename_cb,
|
||||
ipal);
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
enum
|
||||
{
|
||||
DIRTY,
|
||||
RENAME,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -78,7 +77,6 @@ gimp_brush_destroy (GtkObject *object)
|
|||
GimpBrush *brush = GIMP_BRUSH (object);
|
||||
|
||||
g_free (brush->filename);
|
||||
g_free (brush->name);
|
||||
|
||||
if (brush->mask)
|
||||
temp_buf_free (brush->mask);
|
||||
|
@ -105,21 +103,11 @@ gimp_brush_class_init (GimpBrushClass *klass)
|
|||
gtk_signal_default_marshaller,
|
||||
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);
|
||||
|
||||
object_class->destroy = gimp_brush_destroy;
|
||||
|
||||
klass->dirty = NULL;
|
||||
klass->rename = NULL;
|
||||
|
||||
klass->select_brush = gimp_brush_select_brush;
|
||||
klass->want_null_motion = gimp_brush_want_null_motion;
|
||||
|
@ -129,7 +117,6 @@ void
|
|||
gimp_brush_init (GimpBrush *brush)
|
||||
{
|
||||
brush->filename = NULL;
|
||||
brush->name = NULL;
|
||||
|
||||
brush->spacing = 20;
|
||||
brush->x_axis.x = 15.0;
|
||||
|
@ -167,7 +154,7 @@ gimp_brush_get_type (void)
|
|||
}
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_load (gchar *filename)
|
||||
gimp_brush_load (const gchar *filename)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
gint fd;
|
||||
|
@ -208,7 +195,7 @@ gimp_brush_want_null_motion (PaintCore *paint_core)
|
|||
}
|
||||
|
||||
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 (GIMP_IS_BRUSH (brush), NULL);
|
||||
|
@ -217,7 +204,7 @@ gimp_brush_get_mask (GimpBrush *brush)
|
|||
}
|
||||
|
||||
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 (GIMP_IS_BRUSH (brush), NULL);
|
||||
|
@ -225,34 +212,8 @@ gimp_brush_get_pixmap (GimpBrush *brush)
|
|||
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
|
||||
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 (GIMP_IS_BRUSH (brush), 0);
|
||||
|
@ -271,8 +232,8 @@ gimp_brush_set_spacing (GimpBrush *brush,
|
|||
}
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_load_brush (gint fd,
|
||||
gchar *filename)
|
||||
gimp_brush_load_brush (gint fd,
|
||||
const gchar *filename)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
GPattern *pattern;
|
||||
|
@ -285,7 +246,7 @@ gimp_brush_load_brush (gint fd,
|
|||
g_return_val_if_fail (fd != -1, NULL);
|
||||
|
||||
/* Read in the header size */
|
||||
if (read (fd, &header, sizeof (header)) != sizeof (header))
|
||||
if (read (fd, &header, sizeof (header)) != sizeof (header))
|
||||
return NULL;
|
||||
|
||||
/* rearrange the bytes in each unsigned int */
|
||||
|
@ -335,10 +296,10 @@ gimp_brush_load_brush (gint fd,
|
|||
switch (header.bytes)
|
||||
{
|
||||
case 1:
|
||||
brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ()));
|
||||
brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH));
|
||||
brush->mask = temp_buf_new (header.width, header.height, 1,
|
||||
0, 0, NULL);
|
||||
if (read (fd,
|
||||
if (read (fd,
|
||||
temp_buf_data (brush->mask), header.width * header.height) <
|
||||
header.width * header.height)
|
||||
{
|
||||
|
@ -348,7 +309,7 @@ gimp_brush_load_brush (gint fd,
|
|||
gtk_object_unref (GTK_OBJECT (brush));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* For backwards-compatibility, check if a pattern follows.
|
||||
The obsolete .gpb format did it this way. */
|
||||
pattern = pattern_load (fd, filename);
|
||||
|
@ -377,13 +338,13 @@ gimp_brush_load_brush (gint fd,
|
|||
break;
|
||||
|
||||
case 4:
|
||||
brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ()));
|
||||
brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH));
|
||||
brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL);
|
||||
brush->pixmap = temp_buf_new (header.width, header.height, 3, 0, 0, NULL);
|
||||
|
||||
for (i = 0; i < header.width * header.height; i++)
|
||||
{
|
||||
if (read (fd, temp_buf_data (brush->pixmap)
|
||||
if (read (fd, temp_buf_data (brush->pixmap)
|
||||
+ i * 3, 3) != 3 ||
|
||||
read (fd, temp_buf_data (brush->mask) + i, 1) != 1)
|
||||
{
|
||||
|
@ -403,7 +364,10 @@ gimp_brush_load_brush (gint fd,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
brush->name = name;
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), name);
|
||||
|
||||
g_free (name);
|
||||
|
||||
brush->spacing = header.spacing;
|
||||
brush->x_axis.x = header.width / 2.0;
|
||||
brush->x_axis.y = 0.0;
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
enum
|
||||
{
|
||||
DIRTY,
|
||||
RENAME,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -78,7 +77,6 @@ gimp_brush_destroy (GtkObject *object)
|
|||
GimpBrush *brush = GIMP_BRUSH (object);
|
||||
|
||||
g_free (brush->filename);
|
||||
g_free (brush->name);
|
||||
|
||||
if (brush->mask)
|
||||
temp_buf_free (brush->mask);
|
||||
|
@ -105,21 +103,11 @@ gimp_brush_class_init (GimpBrushClass *klass)
|
|||
gtk_signal_default_marshaller,
|
||||
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);
|
||||
|
||||
object_class->destroy = gimp_brush_destroy;
|
||||
|
||||
klass->dirty = NULL;
|
||||
klass->rename = NULL;
|
||||
|
||||
klass->select_brush = gimp_brush_select_brush;
|
||||
klass->want_null_motion = gimp_brush_want_null_motion;
|
||||
|
@ -129,7 +117,6 @@ void
|
|||
gimp_brush_init (GimpBrush *brush)
|
||||
{
|
||||
brush->filename = NULL;
|
||||
brush->name = NULL;
|
||||
|
||||
brush->spacing = 20;
|
||||
brush->x_axis.x = 15.0;
|
||||
|
@ -167,7 +154,7 @@ gimp_brush_get_type (void)
|
|||
}
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_load (gchar *filename)
|
||||
gimp_brush_load (const gchar *filename)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
gint fd;
|
||||
|
@ -208,7 +195,7 @@ gimp_brush_want_null_motion (PaintCore *paint_core)
|
|||
}
|
||||
|
||||
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 (GIMP_IS_BRUSH (brush), NULL);
|
||||
|
@ -217,7 +204,7 @@ gimp_brush_get_mask (GimpBrush *brush)
|
|||
}
|
||||
|
||||
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 (GIMP_IS_BRUSH (brush), NULL);
|
||||
|
@ -225,34 +212,8 @@ gimp_brush_get_pixmap (GimpBrush *brush)
|
|||
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
|
||||
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 (GIMP_IS_BRUSH (brush), 0);
|
||||
|
@ -271,8 +232,8 @@ gimp_brush_set_spacing (GimpBrush *brush,
|
|||
}
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_load_brush (gint fd,
|
||||
gchar *filename)
|
||||
gimp_brush_load_brush (gint fd,
|
||||
const gchar *filename)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
GPattern *pattern;
|
||||
|
@ -285,7 +246,7 @@ gimp_brush_load_brush (gint fd,
|
|||
g_return_val_if_fail (fd != -1, NULL);
|
||||
|
||||
/* Read in the header size */
|
||||
if (read (fd, &header, sizeof (header)) != sizeof (header))
|
||||
if (read (fd, &header, sizeof (header)) != sizeof (header))
|
||||
return NULL;
|
||||
|
||||
/* rearrange the bytes in each unsigned int */
|
||||
|
@ -335,10 +296,10 @@ gimp_brush_load_brush (gint fd,
|
|||
switch (header.bytes)
|
||||
{
|
||||
case 1:
|
||||
brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ()));
|
||||
brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH));
|
||||
brush->mask = temp_buf_new (header.width, header.height, 1,
|
||||
0, 0, NULL);
|
||||
if (read (fd,
|
||||
if (read (fd,
|
||||
temp_buf_data (brush->mask), header.width * header.height) <
|
||||
header.width * header.height)
|
||||
{
|
||||
|
@ -348,7 +309,7 @@ gimp_brush_load_brush (gint fd,
|
|||
gtk_object_unref (GTK_OBJECT (brush));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* For backwards-compatibility, check if a pattern follows.
|
||||
The obsolete .gpb format did it this way. */
|
||||
pattern = pattern_load (fd, filename);
|
||||
|
@ -377,13 +338,13 @@ gimp_brush_load_brush (gint fd,
|
|||
break;
|
||||
|
||||
case 4:
|
||||
brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ()));
|
||||
brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH));
|
||||
brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL);
|
||||
brush->pixmap = temp_buf_new (header.width, header.height, 3, 0, 0, NULL);
|
||||
|
||||
for (i = 0; i < header.width * header.height; i++)
|
||||
{
|
||||
if (read (fd, temp_buf_data (brush->pixmap)
|
||||
if (read (fd, temp_buf_data (brush->pixmap)
|
||||
+ i * 3, 3) != 3 ||
|
||||
read (fd, temp_buf_data (brush->mask) + i, 1) != 1)
|
||||
{
|
||||
|
@ -403,7 +364,10 @@ gimp_brush_load_brush (gint fd,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
brush->name = name;
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), name);
|
||||
|
||||
g_free (name);
|
||||
|
||||
brush->spacing = header.spacing;
|
||||
brush->x_axis.x = header.width / 2.0;
|
||||
brush->x_axis.y = 0.0;
|
||||
|
|
|
@ -23,20 +23,20 @@
|
|||
#include "gimpobject.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BRUSH (gimp_brush_get_type ())
|
||||
#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
|
||||
#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH))
|
||||
#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gimp_brush_get_type(), GimpBrushClass))
|
||||
#define GIMP_TYPE_BRUSH (gimp_brush_get_type ())
|
||||
#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
|
||||
#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH, GimpBrushClass))
|
||||
#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH))
|
||||
#define GIMP_IS_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH))
|
||||
|
||||
|
||||
typedef struct _GimpBrushClass GimpBrushClass;
|
||||
|
||||
struct _GimpBrush
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* actual filename--brush's location on disk */
|
||||
gchar *name; /* brush's name--for brush selection dialog */
|
||||
gint spacing; /* brush's spacing */
|
||||
GimpVector2 x_axis; /* for calculating brush spacing */
|
||||
GimpVector2 y_axis; /* for calculating brush spacing */
|
||||
|
@ -49,7 +49,6 @@ struct _GimpBrushClass
|
|||
GimpObjectClass parent_class;
|
||||
|
||||
void (* dirty) (GimpBrush *brush);
|
||||
void (* rename) (GimpBrush *brush);
|
||||
|
||||
/* FIXME: these are no virtual function pointers but bad hacks: */
|
||||
GimpBrush * (* select_brush) (PaintCore *paint_core);
|
||||
|
@ -58,21 +57,17 @@ struct _GimpBrushClass
|
|||
|
||||
|
||||
GtkType gimp_brush_get_type (void);
|
||||
GimpBrush * gimp_brush_load (gchar *filename);
|
||||
GimpBrush * gimp_brush_load (const gchar *filename);
|
||||
|
||||
GimpBrush * gimp_brush_load_brush (gint fd,
|
||||
gchar *filename);
|
||||
GimpBrush * gimp_brush_load_brush (gint fd,
|
||||
const gchar *filename);
|
||||
|
||||
TempBuf * gimp_brush_get_mask (GimpBrush *brush);
|
||||
TempBuf * gimp_brush_get_pixmap (GimpBrush *brush);
|
||||
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
|
||||
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
|
||||
|
||||
gchar * gimp_brush_get_name (GimpBrush *brush);
|
||||
void gimp_brush_set_name (GimpBrush *brush,
|
||||
gchar *name);
|
||||
|
||||
gint gimp_brush_get_spacing (GimpBrush *brush);
|
||||
void gimp_brush_set_spacing (GimpBrush *brush,
|
||||
gint spacing);
|
||||
gint gimp_brush_get_spacing (const GimpBrush *brush);
|
||||
void gimp_brush_set_spacing (GimpBrush *brush,
|
||||
gint spacing);
|
||||
|
||||
|
||||
#endif /* __GIMP_BRUSH_H__ */
|
||||
|
|
|
@ -113,10 +113,10 @@ gimp_brush_generated_new (gfloat radius,
|
|||
GimpBrushGenerated *brush;
|
||||
|
||||
/* set up normal brush data */
|
||||
brush =
|
||||
GIMP_BRUSH_GENERATED (gtk_type_new (gimp_brush_generated_get_type ()));
|
||||
brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED));
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), "Untitled");
|
||||
|
||||
GIMP_BRUSH (brush)->name = g_strdup ("Untitled");
|
||||
GIMP_BRUSH (brush)->spacing = 20;
|
||||
|
||||
/* set up gimp_brush_generated data */
|
||||
|
@ -166,7 +166,7 @@ gimp_brush_generated_load (const gchar *file_name)
|
|||
fgets (string, 255, fp);
|
||||
if (string[strlen (string) - 1] == '\n')
|
||||
string[strlen (string) - 1] = 0;
|
||||
GIMP_BRUSH (brush)->name = g_strdup (string);
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), string);
|
||||
|
||||
/* read brush spacing */
|
||||
fscanf (fp, "%f", &fl);
|
||||
|
@ -217,10 +217,10 @@ gimp_brush_generated_save (GimpBrushGenerated *brush,
|
|||
fprintf (fp, "1.0\n");
|
||||
|
||||
/* write name */
|
||||
fprintf (fp, "%.255s\n", GIMP_BRUSH (brush)->name);
|
||||
fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name);
|
||||
|
||||
/* write brush spacing */
|
||||
fprintf (fp, "%f\n", (float) GIMP_BRUSH (brush)->spacing);
|
||||
fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing);
|
||||
|
||||
/* write brush radius */
|
||||
fprintf (fp, "%f\n", brush->radius);
|
||||
|
|
|
@ -113,10 +113,10 @@ gimp_brush_generated_new (gfloat radius,
|
|||
GimpBrushGenerated *brush;
|
||||
|
||||
/* set up normal brush data */
|
||||
brush =
|
||||
GIMP_BRUSH_GENERATED (gtk_type_new (gimp_brush_generated_get_type ()));
|
||||
brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED));
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), "Untitled");
|
||||
|
||||
GIMP_BRUSH (brush)->name = g_strdup ("Untitled");
|
||||
GIMP_BRUSH (brush)->spacing = 20;
|
||||
|
||||
/* set up gimp_brush_generated data */
|
||||
|
@ -166,7 +166,7 @@ gimp_brush_generated_load (const gchar *file_name)
|
|||
fgets (string, 255, fp);
|
||||
if (string[strlen (string) - 1] == '\n')
|
||||
string[strlen (string) - 1] = 0;
|
||||
GIMP_BRUSH (brush)->name = g_strdup (string);
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), string);
|
||||
|
||||
/* read brush spacing */
|
||||
fscanf (fp, "%f", &fl);
|
||||
|
@ -217,10 +217,10 @@ gimp_brush_generated_save (GimpBrushGenerated *brush,
|
|||
fprintf (fp, "1.0\n");
|
||||
|
||||
/* write name */
|
||||
fprintf (fp, "%.255s\n", GIMP_BRUSH (brush)->name);
|
||||
fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name);
|
||||
|
||||
/* write brush spacing */
|
||||
fprintf (fp, "%f\n", (float) GIMP_BRUSH (brush)->spacing);
|
||||
fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing);
|
||||
|
||||
/* write brush radius */
|
||||
fprintf (fp, "%f\n", brush->radius);
|
||||
|
|
|
@ -113,10 +113,10 @@ gimp_brush_generated_new (gfloat radius,
|
|||
GimpBrushGenerated *brush;
|
||||
|
||||
/* set up normal brush data */
|
||||
brush =
|
||||
GIMP_BRUSH_GENERATED (gtk_type_new (gimp_brush_generated_get_type ()));
|
||||
brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED));
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), "Untitled");
|
||||
|
||||
GIMP_BRUSH (brush)->name = g_strdup ("Untitled");
|
||||
GIMP_BRUSH (brush)->spacing = 20;
|
||||
|
||||
/* set up gimp_brush_generated data */
|
||||
|
@ -166,7 +166,7 @@ gimp_brush_generated_load (const gchar *file_name)
|
|||
fgets (string, 255, fp);
|
||||
if (string[strlen (string) - 1] == '\n')
|
||||
string[strlen (string) - 1] = 0;
|
||||
GIMP_BRUSH (brush)->name = g_strdup (string);
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), string);
|
||||
|
||||
/* read brush spacing */
|
||||
fscanf (fp, "%f", &fl);
|
||||
|
@ -217,10 +217,10 @@ gimp_brush_generated_save (GimpBrushGenerated *brush,
|
|||
fprintf (fp, "1.0\n");
|
||||
|
||||
/* write name */
|
||||
fprintf (fp, "%.255s\n", GIMP_BRUSH (brush)->name);
|
||||
fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name);
|
||||
|
||||
/* write brush spacing */
|
||||
fprintf (fp, "%f\n", (float) GIMP_BRUSH (brush)->spacing);
|
||||
fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing);
|
||||
|
||||
/* write brush radius */
|
||||
fprintf (fp, "%f\n", brush->radius);
|
||||
|
|
|
@ -25,29 +25,31 @@
|
|||
#include "gimpbrush.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ())
|
||||
#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated))
|
||||
#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED))
|
||||
#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ())
|
||||
#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated))
|
||||
#define GIMP_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGeneratedClass))
|
||||
#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED))
|
||||
#define GIMP_IS_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_GENERATED))
|
||||
|
||||
|
||||
typedef struct _GimpBrushGeneratedClass GimpBrushGeneratedClass;
|
||||
|
||||
struct _GimpBrushGenerated
|
||||
{
|
||||
GimpBrush gbrush;
|
||||
GimpBrush parent_instance;
|
||||
|
||||
gfloat radius;
|
||||
gfloat hardness; /* 0.0 - 1.0 */
|
||||
gfloat angle; /* in degrees */
|
||||
gfloat aspect_ratio; /* y/x */
|
||||
gfloat radius;
|
||||
gfloat hardness; /* 0.0 - 1.0 */
|
||||
gfloat angle; /* in degrees */
|
||||
gfloat aspect_ratio; /* y/x */
|
||||
|
||||
/* private */
|
||||
gint freeze;
|
||||
|
||||
/*GSpline *profile_curve */ /* Some lazy day... */
|
||||
};
|
||||
|
||||
struct _GimpBrushGeneratedClass
|
||||
{
|
||||
GimpBrushClass parent_class;
|
||||
GimpBrushClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -68,8 +69,8 @@ static GimpBrush *
|
|||
gimp_brush_pipe_select_brush (PaintCore *paint_core)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i, brushix, ix;
|
||||
gdouble angle;
|
||||
gint i, brushix, ix;
|
||||
gdouble angle;
|
||||
|
||||
g_return_val_if_fail (paint_core != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), NULL);
|
||||
|
@ -133,7 +134,7 @@ static gboolean
|
|||
gimp_brush_pipe_want_null_motion (PaintCore *paint_core)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (paint_core != NULL, TRUE);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), TRUE);
|
||||
|
@ -154,7 +155,7 @@ static void
|
|||
gimp_brush_pipe_destroy (GtkObject *object)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GIMP_IS_BRUSH_PIPE (object));
|
||||
|
@ -231,20 +232,18 @@ gimp_brush_pipe_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_pipe_load (gchar *filename)
|
||||
gimp_brush_pipe_load (const gchar *filename)
|
||||
{
|
||||
GimpBrushPipe *pipe = NULL;
|
||||
GimpPixPipeParams params;
|
||||
gint i;
|
||||
gint num_of_brushes = 0;
|
||||
gint totalcells;
|
||||
gchar *paramstring;
|
||||
GString *buffer;
|
||||
gchar c;
|
||||
gint fd;
|
||||
gint i;
|
||||
gint num_of_brushes = 0;
|
||||
gint totalcells;
|
||||
gchar *paramstring;
|
||||
GString *buffer;
|
||||
gchar c;
|
||||
gint fd;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
|
@ -265,9 +264,9 @@ gimp_brush_pipe_load (gchar *filename)
|
|||
if (buffer->len > 0 && buffer->len < 1024)
|
||||
{
|
||||
pipe = GIMP_BRUSH_PIPE (gtk_type_new (GIMP_TYPE_BRUSH_PIPE));
|
||||
GIMP_BRUSH (pipe)->name = buffer->str;
|
||||
gimp_object_set_name (GIMP_OBJECT (pipe), buffer->str);
|
||||
}
|
||||
g_string_free (buffer, FALSE);
|
||||
g_string_free (buffer, TRUE);
|
||||
|
||||
if (!pipe)
|
||||
{
|
||||
|
@ -374,9 +373,9 @@ gimp_brush_pipe_load (gchar *filename)
|
|||
{
|
||||
gtk_object_ref (GTK_OBJECT (pipe->brushes[pipe->nbrushes]));
|
||||
gtk_object_sink (GTK_OBJECT (pipe->brushes[pipe->nbrushes]));
|
||||
|
||||
g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name);
|
||||
GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL;
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (pipe->brushes[pipe->nbrushes]),
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -68,8 +69,8 @@ static GimpBrush *
|
|||
gimp_brush_pipe_select_brush (PaintCore *paint_core)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i, brushix, ix;
|
||||
gdouble angle;
|
||||
gint i, brushix, ix;
|
||||
gdouble angle;
|
||||
|
||||
g_return_val_if_fail (paint_core != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), NULL);
|
||||
|
@ -133,7 +134,7 @@ static gboolean
|
|||
gimp_brush_pipe_want_null_motion (PaintCore *paint_core)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (paint_core != NULL, TRUE);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), TRUE);
|
||||
|
@ -154,7 +155,7 @@ static void
|
|||
gimp_brush_pipe_destroy (GtkObject *object)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GIMP_IS_BRUSH_PIPE (object));
|
||||
|
@ -231,20 +232,18 @@ gimp_brush_pipe_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_pipe_load (gchar *filename)
|
||||
gimp_brush_pipe_load (const gchar *filename)
|
||||
{
|
||||
GimpBrushPipe *pipe = NULL;
|
||||
GimpPixPipeParams params;
|
||||
gint i;
|
||||
gint num_of_brushes = 0;
|
||||
gint totalcells;
|
||||
gchar *paramstring;
|
||||
GString *buffer;
|
||||
gchar c;
|
||||
gint fd;
|
||||
gint i;
|
||||
gint num_of_brushes = 0;
|
||||
gint totalcells;
|
||||
gchar *paramstring;
|
||||
GString *buffer;
|
||||
gchar c;
|
||||
gint fd;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
|
@ -265,9 +264,9 @@ gimp_brush_pipe_load (gchar *filename)
|
|||
if (buffer->len > 0 && buffer->len < 1024)
|
||||
{
|
||||
pipe = GIMP_BRUSH_PIPE (gtk_type_new (GIMP_TYPE_BRUSH_PIPE));
|
||||
GIMP_BRUSH (pipe)->name = buffer->str;
|
||||
gimp_object_set_name (GIMP_OBJECT (pipe), buffer->str);
|
||||
}
|
||||
g_string_free (buffer, FALSE);
|
||||
g_string_free (buffer, TRUE);
|
||||
|
||||
if (!pipe)
|
||||
{
|
||||
|
@ -374,9 +373,9 @@ gimp_brush_pipe_load (gchar *filename)
|
|||
{
|
||||
gtk_object_ref (GTK_OBJECT (pipe->brushes[pipe->nbrushes]));
|
||||
gtk_object_sink (GTK_OBJECT (pipe->brushes[pipe->nbrushes]));
|
||||
|
||||
g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name);
|
||||
GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL;
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (pipe->brushes[pipe->nbrushes]),
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
#include "gimpbrush.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BRUSH_PIPE (gimp_brush_pipe_get_type ())
|
||||
#define GIMP_BRUSH_PIPE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipe))
|
||||
#define GIMP_IS_BRUSH_PIPE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIPE))
|
||||
#define GIMP_TYPE_BRUSH_PIPE (gimp_brush_pipe_get_type ())
|
||||
#define GIMP_BRUSH_PIPE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipe))
|
||||
#define GIMP_BRUSH_PIPE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipeClass))
|
||||
#define GIMP_IS_BRUSH_PIPE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIPE))
|
||||
#define GIMP_IS_BRUSH_PIPE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_PIPE))
|
||||
|
||||
|
||||
typedef enum
|
||||
|
@ -46,7 +48,7 @@ typedef struct _GimpBrushPipeClass GimpBrushPipeClass;
|
|||
|
||||
struct _GimpBrushPipe
|
||||
{
|
||||
GimpBrush gbrush; /* Also itself a brush */
|
||||
GimpBrush parent_instance;
|
||||
|
||||
gint dimension;
|
||||
gint *rank; /* Size in each dimension */
|
||||
|
@ -69,7 +71,7 @@ struct _GimpBrushPipeClass
|
|||
|
||||
GtkType gimp_brush_pipe_get_type (void);
|
||||
|
||||
GimpBrush * gimp_brush_pipe_load (gchar *filename);
|
||||
GimpBrush * gimp_brush_pipe_load (const gchar *filename);
|
||||
|
||||
|
||||
#endif /* __GIMP_BRUSH_PIPE_H__ */
|
||||
|
|
|
@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass;
|
|||
|
||||
struct _GimpChannel
|
||||
{
|
||||
GimpDrawable drawable;
|
||||
GimpDrawable parent_instance;
|
||||
|
||||
guchar col[3]; /* RGB triplet for channel color */
|
||||
gint opacity; /* Channel opacity */
|
||||
gboolean show_masked; /* Show masked areas--as */
|
||||
/* opposed to selected areas */
|
||||
guchar col[3]; /* RGB triplet for channel color */
|
||||
gint opacity; /* Channel opacity */
|
||||
gboolean show_masked; /* Show masked areas--as */
|
||||
/* opposed to selected areas */
|
||||
|
||||
/* Selection mask variables */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs_in; /* outline of selected region */
|
||||
BoundSeg *segs_out; /* outline of selected region */
|
||||
gint num_segs_in; /* number of lines in boundary */
|
||||
gint num_segs_out; /* number of lines in boundary */
|
||||
gboolean empty; /* is the region empty? */
|
||||
gboolean bounds_known; /* recalculate the bounds? */
|
||||
gint x1, y1; /* coordinates for bounding box */
|
||||
gint x2, y2; /* lower right hand coordinate */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs_in; /* outline of selected region */
|
||||
BoundSeg *segs_out; /* outline of selected region */
|
||||
gint num_segs_in; /* number of lines in boundary */
|
||||
gint num_segs_out; /* number of lines in boundary */
|
||||
gboolean empty; /* is the region empty? */
|
||||
gboolean bounds_known; /* recalculate the bounds? */
|
||||
gint x1, y1; /* coordinates for bounding box */
|
||||
gint x2, y2; /* lower right hand coordinate */
|
||||
};
|
||||
|
||||
struct _GimpChannelClass
|
||||
{
|
||||
GimpDrawableClass parent_class;
|
||||
GimpDrawableClass parent_class;
|
||||
|
||||
void (* removed) (GimpChannel *channel);
|
||||
};
|
||||
|
|
|
@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass;
|
|||
|
||||
struct _GimpChannel
|
||||
{
|
||||
GimpDrawable drawable;
|
||||
GimpDrawable parent_instance;
|
||||
|
||||
guchar col[3]; /* RGB triplet for channel color */
|
||||
gint opacity; /* Channel opacity */
|
||||
gboolean show_masked; /* Show masked areas--as */
|
||||
/* opposed to selected areas */
|
||||
guchar col[3]; /* RGB triplet for channel color */
|
||||
gint opacity; /* Channel opacity */
|
||||
gboolean show_masked; /* Show masked areas--as */
|
||||
/* opposed to selected areas */
|
||||
|
||||
/* Selection mask variables */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs_in; /* outline of selected region */
|
||||
BoundSeg *segs_out; /* outline of selected region */
|
||||
gint num_segs_in; /* number of lines in boundary */
|
||||
gint num_segs_out; /* number of lines in boundary */
|
||||
gboolean empty; /* is the region empty? */
|
||||
gboolean bounds_known; /* recalculate the bounds? */
|
||||
gint x1, y1; /* coordinates for bounding box */
|
||||
gint x2, y2; /* lower right hand coordinate */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs_in; /* outline of selected region */
|
||||
BoundSeg *segs_out; /* outline of selected region */
|
||||
gint num_segs_in; /* number of lines in boundary */
|
||||
gint num_segs_out; /* number of lines in boundary */
|
||||
gboolean empty; /* is the region empty? */
|
||||
gboolean bounds_known; /* recalculate the bounds? */
|
||||
gint x1, y1; /* coordinates for bounding box */
|
||||
gint x2, y2; /* lower right hand coordinate */
|
||||
};
|
||||
|
||||
struct _GimpChannelClass
|
||||
{
|
||||
GimpDrawableClass parent_class;
|
||||
GimpDrawableClass parent_class;
|
||||
|
||||
void (* removed) (GimpChannel *channel);
|
||||
};
|
||||
|
|
|
@ -347,12 +347,6 @@ gimp_context_destroy (GtkObject *object)
|
|||
if (context->parent)
|
||||
gimp_context_unset_parent (context);
|
||||
|
||||
if (context->name)
|
||||
{
|
||||
g_free (context->name);
|
||||
context->name = NULL;
|
||||
}
|
||||
|
||||
if (context->image)
|
||||
gtk_signal_disconnect_by_data (GTK_OBJECT (image_context), context);
|
||||
|
||||
|
@ -397,6 +391,8 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
gtk_object_add_arg_type (gimp_context_arg_names[IMAGE_CHANGED],
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_IMAGE);
|
||||
gtk_object_add_arg_type (gimp_context_arg_names[DISPLAY_CHANGED],
|
||||
|
@ -418,8 +414,6 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
gtk_object_add_arg_type (gimp_context_arg_names[GRADIENT_CHANGED],
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_GRADIENT);
|
||||
|
||||
parent_class = gtk_type_class (gimp_object_get_type ());
|
||||
|
||||
gimp_context_signals[IMAGE_CHANGED] =
|
||||
gtk_signal_new (gimp_context_signal_names[IMAGE_CHANGED],
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -546,7 +540,6 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
static void
|
||||
gimp_context_init (GimpContext *context)
|
||||
{
|
||||
context->name = NULL;
|
||||
context->parent = NULL;
|
||||
|
||||
context->defined_args = GIMP_CONTEXT_ALL_ARGS_MASK;
|
||||
|
@ -601,7 +594,7 @@ gimp_context_get_type (void)
|
|||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
context_type = gtk_type_unique (gimp_object_get_type (), &context_info);
|
||||
context_type = gtk_type_unique (GIMP_TYPE_OBJECT, &context_info);
|
||||
}
|
||||
|
||||
return context_type;
|
||||
|
@ -615,10 +608,13 @@ gimp_context_new (const gchar *name,
|
|||
|
||||
g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL);
|
||||
|
||||
context = gtk_type_new (gimp_context_get_type ());
|
||||
context = gtk_type_new (GIMP_TYPE_CONTEXT);
|
||||
|
||||
/* FIXME: need unique names here */
|
||||
context->name = g_strdup (name ? name : "Unnamed");
|
||||
if (! name)
|
||||
name = "Unnamed";
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (context), name);
|
||||
|
||||
if (template)
|
||||
{
|
||||
|
@ -685,13 +681,13 @@ gimp_context_get_standard (void)
|
|||
/*****************************************************************************/
|
||||
/* functions manipulating a single context *********************************/
|
||||
|
||||
gchar *
|
||||
gimp_context_get_name (GimpContext *context)
|
||||
const gchar *
|
||||
gimp_context_get_name (const GimpContext *context)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_val_if_fail (context, NULL);
|
||||
|
||||
return context->name;
|
||||
return gimp_object_get_name (GIMP_OBJECT (context));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -701,14 +697,14 @@ gimp_context_set_name (GimpContext *context,
|
|||
context_check_current (context);
|
||||
context_return_if_fail (context);
|
||||
|
||||
if (context->name)
|
||||
g_free (context->name);
|
||||
if (! name)
|
||||
name = "Unnamed";
|
||||
|
||||
context->name = g_strdup (name ? name : "Unnamed");
|
||||
gimp_object_set_name (GIMP_OBJECT (context), name);
|
||||
}
|
||||
|
||||
GimpContext *
|
||||
gimp_context_get_parent (GimpContext *context)
|
||||
gimp_context_get_parent (const GimpContext *context)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_val_if_fail (context, NULL);
|
||||
|
@ -1387,7 +1383,7 @@ gimp_context_brush_dirty (GimpBrush *brush,
|
|||
GimpContext *context)
|
||||
{
|
||||
g_free (context->brush_name);
|
||||
context->brush_name = g_strdup (brush->name);
|
||||
context->brush_name = g_strdup (GIMP_OBJECT (brush)->name);
|
||||
|
||||
gimp_context_brush_changed (context);
|
||||
}
|
||||
|
@ -1461,7 +1457,7 @@ gimp_context_real_set_brush (GimpContext *context,
|
|||
gtk_signal_connect (GTK_OBJECT (brush), "dirty",
|
||||
GTK_SIGNAL_FUNC (gimp_context_brush_dirty),
|
||||
context);
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_context_brush_dirty),
|
||||
context);
|
||||
|
||||
|
@ -1474,7 +1470,7 @@ gimp_context_real_set_brush (GimpContext *context,
|
|||
}
|
||||
|
||||
if (brush != standard_brush)
|
||||
context->brush_name = g_strdup (brush->name);
|
||||
context->brush_name = g_strdup (GIMP_OBJECT (brush)->name);
|
||||
}
|
||||
|
||||
gimp_context_brush_changed (context);
|
||||
|
|
|
@ -77,9 +77,8 @@ typedef struct _GimpContextClass GimpContextClass;
|
|||
|
||||
struct _GimpContext
|
||||
{
|
||||
GimpObject object;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *name;
|
||||
GimpContext *parent;
|
||||
|
||||
guint32 defined_args;
|
||||
|
@ -107,7 +106,7 @@ struct _GimpContext
|
|||
|
||||
struct _GimpContextClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* image_changed) (GimpContext *context,
|
||||
GimpImage *image);
|
||||
|
@ -168,14 +167,14 @@ GimpContext * gimp_context_get_standard (void);
|
|||
|
||||
/* functions for manipulating a single context
|
||||
*/
|
||||
gchar * gimp_context_get_name (GimpContext *context);
|
||||
void gimp_context_set_name (GimpContext *context,
|
||||
const gchar *name);
|
||||
const gchar * gimp_context_get_name (const GimpContext *context);
|
||||
void gimp_context_set_name (GimpContext *context,
|
||||
const gchar *name);
|
||||
|
||||
GimpContext * gimp_context_get_parent (GimpContext *context);
|
||||
void gimp_context_set_parent (GimpContext *context,
|
||||
GimpContext *parent);
|
||||
void gimp_context_unset_parent (GimpContext *context);
|
||||
GimpContext * gimp_context_get_parent (const GimpContext *context);
|
||||
void gimp_context_set_parent (GimpContext *context,
|
||||
GimpContext *parent);
|
||||
void gimp_context_unset_parent (GimpContext *context);
|
||||
|
||||
/* define / undefinine context arguments
|
||||
*
|
||||
|
|
|
@ -53,11 +53,10 @@
|
|||
#include "libgimp/gimpenv.h"
|
||||
|
||||
|
||||
/***** Functions *****/
|
||||
|
||||
static gboolean filestat_valid = FALSE;
|
||||
static struct stat filestat;
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/*
|
||||
* On Windows there is no concept like the Unix executable flag.
|
||||
|
@ -103,7 +102,7 @@ is_script (const gchar *filename)
|
|||
#endif
|
||||
|
||||
void
|
||||
datafiles_read_directories (gchar *path_str,
|
||||
datafiles_read_directories (const gchar *path_str,
|
||||
GimpDataFileLoaderFunc loader_func,
|
||||
GimpDataFileFlags flags)
|
||||
{
|
||||
|
@ -179,6 +178,7 @@ datafile_atime (void)
|
|||
{
|
||||
if (filestat_valid)
|
||||
return filestat.st_atime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -187,6 +187,7 @@ datafile_mtime (void)
|
|||
{
|
||||
if (filestat_valid)
|
||||
return filestat.st_mtime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -195,5 +196,6 @@ datafile_ctime (void)
|
|||
{
|
||||
if (filestat_valid)
|
||||
return filestat.st_ctime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,23 +29,21 @@ typedef enum
|
|||
MODE_EXECUTABLE = 1 << 1
|
||||
} GimpDataFileFlags;
|
||||
|
||||
typedef void (* GimpDataFileLoaderFunc) (gchar *filename);
|
||||
typedef void (* GimpDataFileLoaderFunc) (const gchar *filename);
|
||||
|
||||
|
||||
/***** Functions *****/
|
||||
|
||||
void datafiles_read_directories (gchar *path_str,
|
||||
GimpDataFileLoaderFunc loader_func,
|
||||
GimpDataFileFlags flags);
|
||||
void datafiles_read_directories (const gchar *path_str,
|
||||
GimpDataFileLoaderFunc loader_func,
|
||||
GimpDataFileFlags flags);
|
||||
|
||||
/* Return the current datafiles access, modification
|
||||
* or change time. The current datafile is the one for
|
||||
* which the "DataFileLoaderFunc" function has been called
|
||||
* on.
|
||||
*/
|
||||
time_t datafile_atime (void);
|
||||
time_t datafile_mtime (void);
|
||||
time_t datafile_ctime (void);
|
||||
time_t datafile_atime (void);
|
||||
time_t datafile_mtime (void);
|
||||
time_t datafile_ctime (void);
|
||||
|
||||
|
||||
#endif /* __DATAFILES_H__ */
|
||||
|
|
|
@ -34,7 +34,7 @@ typedef struct _GimpDrawableClass GimpDrawableClass;
|
|||
|
||||
struct _GimpDrawable
|
||||
{
|
||||
GimpObject data;
|
||||
GimpObject parent_instance;
|
||||
|
||||
TileManager *tiles; /* tiles for drawable data */
|
||||
gboolean visible; /* controls visibility */
|
||||
|
@ -57,7 +57,7 @@ struct _GimpDrawable
|
|||
|
||||
struct _GimpDrawableClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* invalidate_preview) (GimpDrawable *drawable);
|
||||
};
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_destroy (GtkObject *object);
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static void gimp_image_free_projection (GimpImage *gimage);
|
||||
static void gimp_image_allocate_shadow (GimpImage *gimage,
|
||||
gint width,
|
||||
|
@ -145,7 +146,6 @@ enum
|
|||
CLEAN,
|
||||
DIRTY,
|
||||
REPAINT,
|
||||
RENAME,
|
||||
RESIZE,
|
||||
RESTRUCTURE,
|
||||
COLORMAP_CHANGED,
|
||||
|
@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL;
|
|||
static void
|
||||
gimp_image_class_init (GimpImageClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
gimp_object_class = (GimpObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
|
@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
gimp_image_signals[RENAME] =
|
||||
gtk_signal_new ("rename",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpImageClass,
|
||||
rename),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gimp_image_signals[RESIZE] =
|
||||
gtk_signal_new ("resize",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
|
||||
object_class->destroy = gimp_image_destroy;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
|
||||
klass->clean = NULL;
|
||||
klass->dirty = NULL;
|
||||
klass->repaint = NULL;
|
||||
klass->rename = NULL;
|
||||
klass->resize = NULL;
|
||||
klass->restructure = NULL;
|
||||
klass->colormap_changed = NULL;
|
||||
|
@ -381,10 +375,9 @@ gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type)
|
||||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ()));
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE));
|
||||
gint i;
|
||||
|
||||
gimage->filename = NULL;
|
||||
gimage->width = width;
|
||||
gimage->height = height;
|
||||
gimage->base_type = base_type;
|
||||
|
@ -430,38 +423,32 @@ gimp_image_new (gint width,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename)
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *new_filename;
|
||||
gchar *old_filename;
|
||||
gboolean free_old;
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: this function will free the current filename even if you are
|
||||
* setting it to itself so any pointer you hold to the filename will be
|
||||
* invalid after this call. So please use with care.
|
||||
*/
|
||||
static void
|
||||
gimp_image_name_changed (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const gchar *name;
|
||||
|
||||
new_filename = g_strdup (filename);
|
||||
old_filename = gimage->filename;
|
||||
free_old = gimage->has_filename;
|
||||
gimage = GIMP_IMAGE (object);
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (filename && filename[0])
|
||||
if (name && name[0])
|
||||
{
|
||||
gimage->filename = new_filename;
|
||||
gimage->has_filename = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage->filename = NULL;
|
||||
gimage->has_filename = FALSE;
|
||||
}
|
||||
|
||||
if (free_old)
|
||||
g_free (old_filename);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]);
|
||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
|
||||
if (gimage->cmap)
|
||||
g_free (gimage->cmap);
|
||||
|
||||
if (gimage->has_filename)
|
||||
g_free (gimage->filename);
|
||||
|
||||
|
||||
gimp_image_free_layers (gimage);
|
||||
gimp_image_free_channels (gimage);
|
||||
|
||||
|
@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->has_filename)
|
||||
return gimage->filename;
|
||||
return gimp_object_get_name (GIMP_OBJECT (gimage));
|
||||
else
|
||||
return _("Untitled");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass;
|
|||
|
||||
struct _GimpImage
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* original filename */
|
||||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
|
@ -126,7 +125,6 @@ struct _GimpImageClass
|
|||
void (* clean) (GimpImage *gimage);
|
||||
void (* dirty) (GimpImage *gimage);
|
||||
void (* repaint) (GimpImage *gimage);
|
||||
void (* rename) (GimpImage *gimage);
|
||||
void (* resize) (GimpImage *gimage);
|
||||
void (* restructure) (GimpImage *gimage);
|
||||
void (* colormap_changed) (GimpImage *gimage);
|
||||
|
@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type);
|
||||
void gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename);
|
||||
const gchar *filename);
|
||||
void gimp_image_set_resolution (GimpImage *gimage,
|
||||
gdouble xres,
|
||||
gdouble yres);
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_destroy (GtkObject *object);
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static void gimp_image_free_projection (GimpImage *gimage);
|
||||
static void gimp_image_allocate_shadow (GimpImage *gimage,
|
||||
gint width,
|
||||
|
@ -145,7 +146,6 @@ enum
|
|||
CLEAN,
|
||||
DIRTY,
|
||||
REPAINT,
|
||||
RENAME,
|
||||
RESIZE,
|
||||
RESTRUCTURE,
|
||||
COLORMAP_CHANGED,
|
||||
|
@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL;
|
|||
static void
|
||||
gimp_image_class_init (GimpImageClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
gimp_object_class = (GimpObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
|
@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
gimp_image_signals[RENAME] =
|
||||
gtk_signal_new ("rename",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpImageClass,
|
||||
rename),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gimp_image_signals[RESIZE] =
|
||||
gtk_signal_new ("resize",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
|
||||
object_class->destroy = gimp_image_destroy;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
|
||||
klass->clean = NULL;
|
||||
klass->dirty = NULL;
|
||||
klass->repaint = NULL;
|
||||
klass->rename = NULL;
|
||||
klass->resize = NULL;
|
||||
klass->restructure = NULL;
|
||||
klass->colormap_changed = NULL;
|
||||
|
@ -381,10 +375,9 @@ gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type)
|
||||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ()));
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE));
|
||||
gint i;
|
||||
|
||||
gimage->filename = NULL;
|
||||
gimage->width = width;
|
||||
gimage->height = height;
|
||||
gimage->base_type = base_type;
|
||||
|
@ -430,38 +423,32 @@ gimp_image_new (gint width,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename)
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *new_filename;
|
||||
gchar *old_filename;
|
||||
gboolean free_old;
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: this function will free the current filename even if you are
|
||||
* setting it to itself so any pointer you hold to the filename will be
|
||||
* invalid after this call. So please use with care.
|
||||
*/
|
||||
static void
|
||||
gimp_image_name_changed (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const gchar *name;
|
||||
|
||||
new_filename = g_strdup (filename);
|
||||
old_filename = gimage->filename;
|
||||
free_old = gimage->has_filename;
|
||||
gimage = GIMP_IMAGE (object);
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (filename && filename[0])
|
||||
if (name && name[0])
|
||||
{
|
||||
gimage->filename = new_filename;
|
||||
gimage->has_filename = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage->filename = NULL;
|
||||
gimage->has_filename = FALSE;
|
||||
}
|
||||
|
||||
if (free_old)
|
||||
g_free (old_filename);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]);
|
||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
|
||||
if (gimage->cmap)
|
||||
g_free (gimage->cmap);
|
||||
|
||||
if (gimage->has_filename)
|
||||
g_free (gimage->filename);
|
||||
|
||||
|
||||
gimp_image_free_layers (gimage);
|
||||
gimp_image_free_channels (gimage);
|
||||
|
||||
|
@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->has_filename)
|
||||
return gimage->filename;
|
||||
return gimp_object_get_name (GIMP_OBJECT (gimage));
|
||||
else
|
||||
return _("Untitled");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass;
|
|||
|
||||
struct _GimpImage
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* original filename */
|
||||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
|
@ -126,7 +125,6 @@ struct _GimpImageClass
|
|||
void (* clean) (GimpImage *gimage);
|
||||
void (* dirty) (GimpImage *gimage);
|
||||
void (* repaint) (GimpImage *gimage);
|
||||
void (* rename) (GimpImage *gimage);
|
||||
void (* resize) (GimpImage *gimage);
|
||||
void (* restructure) (GimpImage *gimage);
|
||||
void (* colormap_changed) (GimpImage *gimage);
|
||||
|
@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type);
|
||||
void gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename);
|
||||
const gchar *filename);
|
||||
void gimp_image_set_resolution (GimpImage *gimage,
|
||||
gdouble xres,
|
||||
gdouble yres);
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_destroy (GtkObject *object);
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static void gimp_image_free_projection (GimpImage *gimage);
|
||||
static void gimp_image_allocate_shadow (GimpImage *gimage,
|
||||
gint width,
|
||||
|
@ -145,7 +146,6 @@ enum
|
|||
CLEAN,
|
||||
DIRTY,
|
||||
REPAINT,
|
||||
RENAME,
|
||||
RESIZE,
|
||||
RESTRUCTURE,
|
||||
COLORMAP_CHANGED,
|
||||
|
@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL;
|
|||
static void
|
||||
gimp_image_class_init (GimpImageClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
gimp_object_class = (GimpObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
|
@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
gimp_image_signals[RENAME] =
|
||||
gtk_signal_new ("rename",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpImageClass,
|
||||
rename),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gimp_image_signals[RESIZE] =
|
||||
gtk_signal_new ("resize",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
|
||||
object_class->destroy = gimp_image_destroy;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
|
||||
klass->clean = NULL;
|
||||
klass->dirty = NULL;
|
||||
klass->repaint = NULL;
|
||||
klass->rename = NULL;
|
||||
klass->resize = NULL;
|
||||
klass->restructure = NULL;
|
||||
klass->colormap_changed = NULL;
|
||||
|
@ -381,10 +375,9 @@ gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type)
|
||||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ()));
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE));
|
||||
gint i;
|
||||
|
||||
gimage->filename = NULL;
|
||||
gimage->width = width;
|
||||
gimage->height = height;
|
||||
gimage->base_type = base_type;
|
||||
|
@ -430,38 +423,32 @@ gimp_image_new (gint width,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename)
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *new_filename;
|
||||
gchar *old_filename;
|
||||
gboolean free_old;
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: this function will free the current filename even if you are
|
||||
* setting it to itself so any pointer you hold to the filename will be
|
||||
* invalid after this call. So please use with care.
|
||||
*/
|
||||
static void
|
||||
gimp_image_name_changed (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const gchar *name;
|
||||
|
||||
new_filename = g_strdup (filename);
|
||||
old_filename = gimage->filename;
|
||||
free_old = gimage->has_filename;
|
||||
gimage = GIMP_IMAGE (object);
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (filename && filename[0])
|
||||
if (name && name[0])
|
||||
{
|
||||
gimage->filename = new_filename;
|
||||
gimage->has_filename = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage->filename = NULL;
|
||||
gimage->has_filename = FALSE;
|
||||
}
|
||||
|
||||
if (free_old)
|
||||
g_free (old_filename);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]);
|
||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
|
||||
if (gimage->cmap)
|
||||
g_free (gimage->cmap);
|
||||
|
||||
if (gimage->has_filename)
|
||||
g_free (gimage->filename);
|
||||
|
||||
|
||||
gimp_image_free_layers (gimage);
|
||||
gimp_image_free_channels (gimage);
|
||||
|
||||
|
@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->has_filename)
|
||||
return gimage->filename;
|
||||
return gimp_object_get_name (GIMP_OBJECT (gimage));
|
||||
else
|
||||
return _("Untitled");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass;
|
|||
|
||||
struct _GimpImage
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* original filename */
|
||||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
|
@ -126,7 +125,6 @@ struct _GimpImageClass
|
|||
void (* clean) (GimpImage *gimage);
|
||||
void (* dirty) (GimpImage *gimage);
|
||||
void (* repaint) (GimpImage *gimage);
|
||||
void (* rename) (GimpImage *gimage);
|
||||
void (* resize) (GimpImage *gimage);
|
||||
void (* restructure) (GimpImage *gimage);
|
||||
void (* colormap_changed) (GimpImage *gimage);
|
||||
|
@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type);
|
||||
void gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename);
|
||||
const gchar *filename);
|
||||
void gimp_image_set_resolution (GimpImage *gimage,
|
||||
gdouble xres,
|
||||
gdouble yres);
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_destroy (GtkObject *object);
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static void gimp_image_free_projection (GimpImage *gimage);
|
||||
static void gimp_image_allocate_shadow (GimpImage *gimage,
|
||||
gint width,
|
||||
|
@ -145,7 +146,6 @@ enum
|
|||
CLEAN,
|
||||
DIRTY,
|
||||
REPAINT,
|
||||
RENAME,
|
||||
RESIZE,
|
||||
RESTRUCTURE,
|
||||
COLORMAP_CHANGED,
|
||||
|
@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL;
|
|||
static void
|
||||
gimp_image_class_init (GimpImageClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
gimp_object_class = (GimpObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
|
@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
gimp_image_signals[RENAME] =
|
||||
gtk_signal_new ("rename",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpImageClass,
|
||||
rename),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gimp_image_signals[RESIZE] =
|
||||
gtk_signal_new ("resize",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
|
||||
object_class->destroy = gimp_image_destroy;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
|
||||
klass->clean = NULL;
|
||||
klass->dirty = NULL;
|
||||
klass->repaint = NULL;
|
||||
klass->rename = NULL;
|
||||
klass->resize = NULL;
|
||||
klass->restructure = NULL;
|
||||
klass->colormap_changed = NULL;
|
||||
|
@ -381,10 +375,9 @@ gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type)
|
||||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ()));
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE));
|
||||
gint i;
|
||||
|
||||
gimage->filename = NULL;
|
||||
gimage->width = width;
|
||||
gimage->height = height;
|
||||
gimage->base_type = base_type;
|
||||
|
@ -430,38 +423,32 @@ gimp_image_new (gint width,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename)
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *new_filename;
|
||||
gchar *old_filename;
|
||||
gboolean free_old;
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: this function will free the current filename even if you are
|
||||
* setting it to itself so any pointer you hold to the filename will be
|
||||
* invalid after this call. So please use with care.
|
||||
*/
|
||||
static void
|
||||
gimp_image_name_changed (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const gchar *name;
|
||||
|
||||
new_filename = g_strdup (filename);
|
||||
old_filename = gimage->filename;
|
||||
free_old = gimage->has_filename;
|
||||
gimage = GIMP_IMAGE (object);
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (filename && filename[0])
|
||||
if (name && name[0])
|
||||
{
|
||||
gimage->filename = new_filename;
|
||||
gimage->has_filename = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage->filename = NULL;
|
||||
gimage->has_filename = FALSE;
|
||||
}
|
||||
|
||||
if (free_old)
|
||||
g_free (old_filename);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]);
|
||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
|
||||
if (gimage->cmap)
|
||||
g_free (gimage->cmap);
|
||||
|
||||
if (gimage->has_filename)
|
||||
g_free (gimage->filename);
|
||||
|
||||
|
||||
gimp_image_free_layers (gimage);
|
||||
gimp_image_free_channels (gimage);
|
||||
|
||||
|
@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->has_filename)
|
||||
return gimage->filename;
|
||||
return gimp_object_get_name (GIMP_OBJECT (gimage));
|
||||
else
|
||||
return _("Untitled");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass;
|
|||
|
||||
struct _GimpImage
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* original filename */
|
||||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
|
@ -126,7 +125,6 @@ struct _GimpImageClass
|
|||
void (* clean) (GimpImage *gimage);
|
||||
void (* dirty) (GimpImage *gimage);
|
||||
void (* repaint) (GimpImage *gimage);
|
||||
void (* rename) (GimpImage *gimage);
|
||||
void (* resize) (GimpImage *gimage);
|
||||
void (* restructure) (GimpImage *gimage);
|
||||
void (* colormap_changed) (GimpImage *gimage);
|
||||
|
@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type);
|
||||
void gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename);
|
||||
const gchar *filename);
|
||||
void gimp_image_set_resolution (GimpImage *gimage,
|
||||
gdouble xres,
|
||||
gdouble yres);
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_destroy (GtkObject *object);
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static void gimp_image_free_projection (GimpImage *gimage);
|
||||
static void gimp_image_allocate_shadow (GimpImage *gimage,
|
||||
gint width,
|
||||
|
@ -145,7 +146,6 @@ enum
|
|||
CLEAN,
|
||||
DIRTY,
|
||||
REPAINT,
|
||||
RENAME,
|
||||
RESIZE,
|
||||
RESTRUCTURE,
|
||||
COLORMAP_CHANGED,
|
||||
|
@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL;
|
|||
static void
|
||||
gimp_image_class_init (GimpImageClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
gimp_object_class = (GimpObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
|
@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
gimp_image_signals[RENAME] =
|
||||
gtk_signal_new ("rename",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpImageClass,
|
||||
rename),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gimp_image_signals[RESIZE] =
|
||||
gtk_signal_new ("resize",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
|
||||
object_class->destroy = gimp_image_destroy;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
|
||||
klass->clean = NULL;
|
||||
klass->dirty = NULL;
|
||||
klass->repaint = NULL;
|
||||
klass->rename = NULL;
|
||||
klass->resize = NULL;
|
||||
klass->restructure = NULL;
|
||||
klass->colormap_changed = NULL;
|
||||
|
@ -381,10 +375,9 @@ gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type)
|
||||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ()));
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE));
|
||||
gint i;
|
||||
|
||||
gimage->filename = NULL;
|
||||
gimage->width = width;
|
||||
gimage->height = height;
|
||||
gimage->base_type = base_type;
|
||||
|
@ -430,38 +423,32 @@ gimp_image_new (gint width,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename)
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *new_filename;
|
||||
gchar *old_filename;
|
||||
gboolean free_old;
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: this function will free the current filename even if you are
|
||||
* setting it to itself so any pointer you hold to the filename will be
|
||||
* invalid after this call. So please use with care.
|
||||
*/
|
||||
static void
|
||||
gimp_image_name_changed (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const gchar *name;
|
||||
|
||||
new_filename = g_strdup (filename);
|
||||
old_filename = gimage->filename;
|
||||
free_old = gimage->has_filename;
|
||||
gimage = GIMP_IMAGE (object);
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (filename && filename[0])
|
||||
if (name && name[0])
|
||||
{
|
||||
gimage->filename = new_filename;
|
||||
gimage->has_filename = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage->filename = NULL;
|
||||
gimage->has_filename = FALSE;
|
||||
}
|
||||
|
||||
if (free_old)
|
||||
g_free (old_filename);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]);
|
||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
|
||||
if (gimage->cmap)
|
||||
g_free (gimage->cmap);
|
||||
|
||||
if (gimage->has_filename)
|
||||
g_free (gimage->filename);
|
||||
|
||||
|
||||
gimp_image_free_layers (gimage);
|
||||
gimp_image_free_channels (gimage);
|
||||
|
||||
|
@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->has_filename)
|
||||
return gimage->filename;
|
||||
return gimp_object_get_name (GIMP_OBJECT (gimage));
|
||||
else
|
||||
return _("Untitled");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass;
|
|||
|
||||
struct _GimpImage
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* original filename */
|
||||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
|
@ -126,7 +125,6 @@ struct _GimpImageClass
|
|||
void (* clean) (GimpImage *gimage);
|
||||
void (* dirty) (GimpImage *gimage);
|
||||
void (* repaint) (GimpImage *gimage);
|
||||
void (* rename) (GimpImage *gimage);
|
||||
void (* resize) (GimpImage *gimage);
|
||||
void (* restructure) (GimpImage *gimage);
|
||||
void (* colormap_changed) (GimpImage *gimage);
|
||||
|
@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type);
|
||||
void gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename);
|
||||
const gchar *filename);
|
||||
void gimp_image_set_resolution (GimpImage *gimage,
|
||||
gdouble xres,
|
||||
gdouble yres);
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_destroy (GtkObject *object);
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static void gimp_image_free_projection (GimpImage *gimage);
|
||||
static void gimp_image_allocate_shadow (GimpImage *gimage,
|
||||
gint width,
|
||||
|
@ -145,7 +146,6 @@ enum
|
|||
CLEAN,
|
||||
DIRTY,
|
||||
REPAINT,
|
||||
RENAME,
|
||||
RESIZE,
|
||||
RESTRUCTURE,
|
||||
COLORMAP_CHANGED,
|
||||
|
@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL;
|
|||
static void
|
||||
gimp_image_class_init (GimpImageClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
gimp_object_class = (GimpObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
|
@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
gimp_image_signals[RENAME] =
|
||||
gtk_signal_new ("rename",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpImageClass,
|
||||
rename),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gimp_image_signals[RESIZE] =
|
||||
gtk_signal_new ("resize",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
|
||||
object_class->destroy = gimp_image_destroy;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
|
||||
klass->clean = NULL;
|
||||
klass->dirty = NULL;
|
||||
klass->repaint = NULL;
|
||||
klass->rename = NULL;
|
||||
klass->resize = NULL;
|
||||
klass->restructure = NULL;
|
||||
klass->colormap_changed = NULL;
|
||||
|
@ -381,10 +375,9 @@ gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type)
|
||||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ()));
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE));
|
||||
gint i;
|
||||
|
||||
gimage->filename = NULL;
|
||||
gimage->width = width;
|
||||
gimage->height = height;
|
||||
gimage->base_type = base_type;
|
||||
|
@ -430,38 +423,32 @@ gimp_image_new (gint width,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename)
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *new_filename;
|
||||
gchar *old_filename;
|
||||
gboolean free_old;
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: this function will free the current filename even if you are
|
||||
* setting it to itself so any pointer you hold to the filename will be
|
||||
* invalid after this call. So please use with care.
|
||||
*/
|
||||
static void
|
||||
gimp_image_name_changed (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const gchar *name;
|
||||
|
||||
new_filename = g_strdup (filename);
|
||||
old_filename = gimage->filename;
|
||||
free_old = gimage->has_filename;
|
||||
gimage = GIMP_IMAGE (object);
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (filename && filename[0])
|
||||
if (name && name[0])
|
||||
{
|
||||
gimage->filename = new_filename;
|
||||
gimage->has_filename = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage->filename = NULL;
|
||||
gimage->has_filename = FALSE;
|
||||
}
|
||||
|
||||
if (free_old)
|
||||
g_free (old_filename);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]);
|
||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
|
||||
if (gimage->cmap)
|
||||
g_free (gimage->cmap);
|
||||
|
||||
if (gimage->has_filename)
|
||||
g_free (gimage->filename);
|
||||
|
||||
|
||||
gimp_image_free_layers (gimage);
|
||||
gimp_image_free_channels (gimage);
|
||||
|
||||
|
@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->has_filename)
|
||||
return gimage->filename;
|
||||
return gimp_object_get_name (GIMP_OBJECT (gimage));
|
||||
else
|
||||
return _("Untitled");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass;
|
|||
|
||||
struct _GimpImage
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* original filename */
|
||||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
|
@ -126,7 +125,6 @@ struct _GimpImageClass
|
|||
void (* clean) (GimpImage *gimage);
|
||||
void (* dirty) (GimpImage *gimage);
|
||||
void (* repaint) (GimpImage *gimage);
|
||||
void (* rename) (GimpImage *gimage);
|
||||
void (* resize) (GimpImage *gimage);
|
||||
void (* restructure) (GimpImage *gimage);
|
||||
void (* colormap_changed) (GimpImage *gimage);
|
||||
|
@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type);
|
||||
void gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename);
|
||||
const gchar *filename);
|
||||
void gimp_image_set_resolution (GimpImage *gimage,
|
||||
gdouble xres,
|
||||
gdouble yres);
|
||||
|
|
|
@ -160,8 +160,7 @@ gimp_layer_mask_get_type (void)
|
|||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
layer_mask_type = gtk_type_unique (gimp_channel_get_type (),
|
||||
&layer_mask_info);
|
||||
layer_mask_type = gtk_type_unique (GIMP_TYPE_CHANNEL, &layer_mask_info);
|
||||
}
|
||||
|
||||
return layer_mask_type;
|
||||
|
@ -284,7 +283,7 @@ layer_new (GimpImage *gimage,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
layer = gtk_type_new (gimp_layer_get_type ());
|
||||
layer = gtk_type_new (GIMP_TYPE_LAYER);
|
||||
|
||||
gimp_drawable_configure (GIMP_DRAWABLE (layer),
|
||||
gimage, width, height, type, name);
|
||||
|
@ -1771,7 +1770,7 @@ layer_mask_new (GimpImage *gimage,
|
|||
LayerMask *layer_mask;
|
||||
gint i;
|
||||
|
||||
layer_mask = gtk_type_new (gimp_layer_mask_get_type ());
|
||||
layer_mask = gtk_type_new (GIMP_TYPE_LAYER_MASK);
|
||||
|
||||
gimp_drawable_configure (GIMP_DRAWABLE (layer_mask),
|
||||
gimage, width, height, GRAY_GIMAGE, name);
|
||||
|
|
|
@ -42,49 +42,49 @@ typedef struct _GimpLayerMaskClass GimpLayerMaskClass;
|
|||
|
||||
struct _GimpLayer
|
||||
{
|
||||
GimpDrawable drawable;
|
||||
GimpDrawable parent_instance;
|
||||
|
||||
gboolean linked; /* control linkage */
|
||||
gboolean preserve_trans; /* preserve transparency */
|
||||
gboolean linked; /* control linkage */
|
||||
gboolean preserve_trans; /* preserve transparency */
|
||||
|
||||
LayerMask *mask; /* possible layer mask */
|
||||
gint apply_mask; /* controls mask application */
|
||||
gboolean edit_mask; /* edit mask or layer? */
|
||||
gboolean show_mask; /* show mask or layer? */
|
||||
LayerMask *mask; /* possible layer mask */
|
||||
gint apply_mask; /* controls mask application */
|
||||
gboolean edit_mask; /* edit mask or layer? */
|
||||
gboolean show_mask; /* show mask or layer? */
|
||||
|
||||
gint opacity; /* layer opacity */
|
||||
LayerModeEffects mode; /* layer combination mode */
|
||||
gint opacity; /* layer opacity */
|
||||
LayerModeEffects mode; /* layer combination mode */
|
||||
|
||||
/* Floating selections */
|
||||
struct
|
||||
{
|
||||
TileManager *backing_store; /* for obscured regions */
|
||||
GimpDrawable *drawable; /* floating sel is attached to */
|
||||
gboolean initial; /* is fs composited yet? */
|
||||
TileManager *backing_store; /* for obscured regions */
|
||||
GimpDrawable *drawable; /* floating sel is attached to */
|
||||
gboolean initial; /* is fs composited yet? */
|
||||
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs; /* boundary of floating sel */
|
||||
gint num_segs; /* number of segs in boundary */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs; /* boundary of floating sel */
|
||||
gint num_segs; /* number of segs in boundary */
|
||||
} fs;
|
||||
};
|
||||
|
||||
struct _GimpLayerClass
|
||||
{
|
||||
GimpDrawableClass parent_class;
|
||||
GimpDrawableClass parent_class;
|
||||
|
||||
void (* removed) (GimpLayer *layer);
|
||||
};
|
||||
|
||||
struct _GimpLayerMask
|
||||
{
|
||||
GimpChannel drawable;
|
||||
GimpChannel parent_instance;
|
||||
|
||||
Layer *layer;
|
||||
Layer *layer;
|
||||
};
|
||||
|
||||
struct _GimpLayerMaskClass
|
||||
{
|
||||
GimpChannelClass parent_class;
|
||||
GimpChannelClass parent_class;
|
||||
};
|
||||
|
||||
/* Special undo types */
|
||||
|
|
|
@ -30,26 +30,27 @@
|
|||
*/
|
||||
|
||||
|
||||
#define GIMP_TYPE_LIST (gimp_list_get_type ())
|
||||
#define GIMP_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_LIST, GimpList))
|
||||
#define GIMP_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_LIST))
|
||||
#define GIMP_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LIST, GimpListClass))
|
||||
#define GIMP_TYPE_LIST (gimp_list_get_type ())
|
||||
#define GIMP_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_LIST, GimpList))
|
||||
#define GIMP_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LIST, GimpListClass))
|
||||
#define GIMP_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_LIST))
|
||||
#define GIMP_IS_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LIST))
|
||||
|
||||
|
||||
typedef struct _GimpListClass GimpListClass;
|
||||
|
||||
struct _GimpList
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
GtkType type;
|
||||
GSList *list;
|
||||
gboolean weak;
|
||||
GtkType type;
|
||||
GSList *list;
|
||||
gboolean weak;
|
||||
};
|
||||
|
||||
struct _GimpListClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* add) (GimpList *list,
|
||||
gpointer object);
|
||||
|
|
|
@ -34,14 +34,14 @@ typedef struct _GimpObjectClass GimpObjectClass;
|
|||
|
||||
struct _GimpObject
|
||||
{
|
||||
GtkObject object;
|
||||
GtkObject parent_instance;
|
||||
|
||||
gchar *name;
|
||||
gchar *name;
|
||||
};
|
||||
|
||||
struct _GimpObjectClass
|
||||
{
|
||||
GtkObjectClass parent_class;
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
void (* name_changed) (GimpObject *object);
|
||||
};
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_destroy (GtkObject *object);
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static void gimp_image_free_projection (GimpImage *gimage);
|
||||
static void gimp_image_allocate_shadow (GimpImage *gimage,
|
||||
gint width,
|
||||
|
@ -145,7 +146,6 @@ enum
|
|||
CLEAN,
|
||||
DIRTY,
|
||||
REPAINT,
|
||||
RENAME,
|
||||
RESIZE,
|
||||
RESTRUCTURE,
|
||||
COLORMAP_CHANGED,
|
||||
|
@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL;
|
|||
static void
|
||||
gimp_image_class_init (GimpImageClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
gimp_object_class = (GimpObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
|
@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
gimp_image_signals[RENAME] =
|
||||
gtk_signal_new ("rename",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpImageClass,
|
||||
rename),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gimp_image_signals[RESIZE] =
|
||||
gtk_signal_new ("resize",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
|
||||
object_class->destroy = gimp_image_destroy;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
|
||||
klass->clean = NULL;
|
||||
klass->dirty = NULL;
|
||||
klass->repaint = NULL;
|
||||
klass->rename = NULL;
|
||||
klass->resize = NULL;
|
||||
klass->restructure = NULL;
|
||||
klass->colormap_changed = NULL;
|
||||
|
@ -381,10 +375,9 @@ gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type)
|
||||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ()));
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE));
|
||||
gint i;
|
||||
|
||||
gimage->filename = NULL;
|
||||
gimage->width = width;
|
||||
gimage->height = height;
|
||||
gimage->base_type = base_type;
|
||||
|
@ -430,38 +423,32 @@ gimp_image_new (gint width,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename)
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *new_filename;
|
||||
gchar *old_filename;
|
||||
gboolean free_old;
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: this function will free the current filename even if you are
|
||||
* setting it to itself so any pointer you hold to the filename will be
|
||||
* invalid after this call. So please use with care.
|
||||
*/
|
||||
static void
|
||||
gimp_image_name_changed (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const gchar *name;
|
||||
|
||||
new_filename = g_strdup (filename);
|
||||
old_filename = gimage->filename;
|
||||
free_old = gimage->has_filename;
|
||||
gimage = GIMP_IMAGE (object);
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (filename && filename[0])
|
||||
if (name && name[0])
|
||||
{
|
||||
gimage->filename = new_filename;
|
||||
gimage->has_filename = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage->filename = NULL;
|
||||
gimage->has_filename = FALSE;
|
||||
}
|
||||
|
||||
if (free_old)
|
||||
g_free (old_filename);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]);
|
||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
|
||||
if (gimage->cmap)
|
||||
g_free (gimage->cmap);
|
||||
|
||||
if (gimage->has_filename)
|
||||
g_free (gimage->filename);
|
||||
|
||||
|
||||
gimp_image_free_layers (gimage);
|
||||
gimp_image_free_channels (gimage);
|
||||
|
||||
|
@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->has_filename)
|
||||
return gimage->filename;
|
||||
return gimp_object_get_name (GIMP_OBJECT (gimage));
|
||||
else
|
||||
return _("Untitled");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass;
|
|||
|
||||
struct _GimpImage
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* original filename */
|
||||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
|
@ -126,7 +125,6 @@ struct _GimpImageClass
|
|||
void (* clean) (GimpImage *gimage);
|
||||
void (* dirty) (GimpImage *gimage);
|
||||
void (* repaint) (GimpImage *gimage);
|
||||
void (* rename) (GimpImage *gimage);
|
||||
void (* resize) (GimpImage *gimage);
|
||||
void (* restructure) (GimpImage *gimage);
|
||||
void (* colormap_changed) (GimpImage *gimage);
|
||||
|
@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type);
|
||||
void gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename);
|
||||
const gchar *filename);
|
||||
void gimp_image_set_resolution (GimpImage *gimage,
|
||||
gdouble xres,
|
||||
gdouble yres);
|
||||
|
|
|
@ -1779,7 +1779,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
|||
SET_SENSITIVE ("File/Save", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->filename);
|
||||
SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->has_filename);
|
||||
SET_SENSITIVE ("File/Close", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Edit", gdisp);
|
||||
|
|
|
@ -53,11 +53,10 @@
|
|||
#include "libgimp/gimpenv.h"
|
||||
|
||||
|
||||
/***** Functions *****/
|
||||
|
||||
static gboolean filestat_valid = FALSE;
|
||||
static struct stat filestat;
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/*
|
||||
* On Windows there is no concept like the Unix executable flag.
|
||||
|
@ -103,7 +102,7 @@ is_script (const gchar *filename)
|
|||
#endif
|
||||
|
||||
void
|
||||
datafiles_read_directories (gchar *path_str,
|
||||
datafiles_read_directories (const gchar *path_str,
|
||||
GimpDataFileLoaderFunc loader_func,
|
||||
GimpDataFileFlags flags)
|
||||
{
|
||||
|
@ -179,6 +178,7 @@ datafile_atime (void)
|
|||
{
|
||||
if (filestat_valid)
|
||||
return filestat.st_atime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -187,6 +187,7 @@ datafile_mtime (void)
|
|||
{
|
||||
if (filestat_valid)
|
||||
return filestat.st_mtime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -195,5 +196,6 @@ datafile_ctime (void)
|
|||
{
|
||||
if (filestat_valid)
|
||||
return filestat.st_ctime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,23 +29,21 @@ typedef enum
|
|||
MODE_EXECUTABLE = 1 << 1
|
||||
} GimpDataFileFlags;
|
||||
|
||||
typedef void (* GimpDataFileLoaderFunc) (gchar *filename);
|
||||
typedef void (* GimpDataFileLoaderFunc) (const gchar *filename);
|
||||
|
||||
|
||||
/***** Functions *****/
|
||||
|
||||
void datafiles_read_directories (gchar *path_str,
|
||||
GimpDataFileLoaderFunc loader_func,
|
||||
GimpDataFileFlags flags);
|
||||
void datafiles_read_directories (const gchar *path_str,
|
||||
GimpDataFileLoaderFunc loader_func,
|
||||
GimpDataFileFlags flags);
|
||||
|
||||
/* Return the current datafiles access, modification
|
||||
* or change time. The current datafile is the one for
|
||||
* which the "DataFileLoaderFunc" function has been called
|
||||
* on.
|
||||
*/
|
||||
time_t datafile_atime (void);
|
||||
time_t datafile_mtime (void);
|
||||
time_t datafile_ctime (void);
|
||||
time_t datafile_atime (void);
|
||||
time_t datafile_mtime (void);
|
||||
time_t datafile_ctime (void);
|
||||
|
||||
|
||||
#endif /* __DATAFILES_H__ */
|
||||
|
|
|
@ -713,7 +713,7 @@ devices_write_rc_device (DeviceInfo *device_info,
|
|||
if (gimp_context_get_brush (device_info->context))
|
||||
{
|
||||
fprintf (fp, "\n (brush \"%s\")",
|
||||
gimp_context_get_brush (device_info->context)->name);
|
||||
GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name);
|
||||
}
|
||||
|
||||
if (gimp_context_get_pattern (device_info->context))
|
||||
|
|
|
@ -85,9 +85,9 @@ static void
|
|||
info_window_image_rename_callback (GimpImage *gimage,
|
||||
gpointer data)
|
||||
{
|
||||
InfoDialog *id;
|
||||
gchar *title;
|
||||
GDisplay * gdisp;
|
||||
InfoDialog *id;
|
||||
gchar *title;
|
||||
GDisplay *gdisp;
|
||||
InfoWinData *iwd;
|
||||
|
||||
id = (InfoDialog *) data;
|
||||
|
@ -302,7 +302,7 @@ info_window_create (GDisplay *gdisp)
|
|||
info_window_create_extended (info_win);
|
||||
|
||||
/* keep track of image name changes */
|
||||
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "name_changed",
|
||||
GTK_SIGNAL_FUNC (info_window_image_rename_callback),
|
||||
info_win);
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ gimp_main_funcs[] =
|
|||
/* one of these objects is kept per-module */
|
||||
typedef struct
|
||||
{
|
||||
GtkObject object;
|
||||
GtkObject parent_instance;
|
||||
|
||||
gchar *fullpath; /* path to the module */
|
||||
module_state state; /* what's happened to the module */
|
||||
|
@ -115,9 +115,9 @@ typedef struct
|
|||
|
||||
static guint module_info_get_type (void);
|
||||
|
||||
#define MODULE_INFO_TYPE module_info_get_type()
|
||||
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
|
||||
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
||||
#define MODULE_INFO_TYPE (module_info_get_type ())
|
||||
#define MODULE_INFO(obj) (GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo))
|
||||
#define IS_MODULE_INFO(obj) (GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE))
|
||||
|
||||
|
||||
#define NUM_INFO_LINES 7
|
||||
|
@ -138,7 +138,8 @@ static GimpSet *modules;
|
|||
static GimpSetHandlerId modules_handler;
|
||||
|
||||
/* If the inhibit state of any modules changes, we might need to
|
||||
* re-write the modulerc. */
|
||||
* re-write the modulerc.
|
||||
*/
|
||||
static gboolean need_to_rewrite_modulerc = FALSE;
|
||||
|
||||
|
||||
|
@ -157,7 +158,7 @@ static gboolean need_to_rewrite_modulerc = FALSE;
|
|||
|
||||
|
||||
/* prototypes */
|
||||
static void module_initialize (gchar *filename);
|
||||
static void module_initialize (const gchar *filename);
|
||||
static void mod_load (ModuleInfo *mod,
|
||||
gboolean verbose);
|
||||
static void mod_unload (ModuleInfo *mod,
|
||||
|
@ -389,24 +390,29 @@ module_db_browser_new (void)
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
/**************************/
|
||||
/* ModuleInfo object glue */
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
void (* modified) (ModuleInfo *module_info);
|
||||
} ModuleInfoClass;
|
||||
|
||||
enum
|
||||
{
|
||||
MODIFIED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
typedef struct _ModuleInfoClass ModuleInfoClass;
|
||||
|
||||
struct _ModuleInfoClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* modified) (ModuleInfo *module_info);
|
||||
};
|
||||
|
||||
|
||||
static guint module_info_signals[LAST_SIGNAL];
|
||||
|
||||
static GimpObjectClass *parent_class = NULL;
|
||||
|
||||
static void
|
||||
module_info_destroy (GtkObject *object)
|
||||
|
@ -419,6 +425,9 @@ module_info_destroy (GtkObject *object)
|
|||
if (mod->last_module_error)
|
||||
g_free (mod->last_module_error);
|
||||
g_free (mod->fullpath);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -428,6 +437,8 @@ module_info_class_init (ModuleInfoClass *klass)
|
|||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
module_info_signals[MODIFIED] =
|
||||
gtk_signal_new ("modified",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -469,8 +480,7 @@ module_info_get_type (void)
|
|||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
module_info_type =
|
||||
gtk_type_unique (gtk_object_get_type (), &module_info_info);
|
||||
module_info_type = gtk_type_unique (GIMP_TYPE_OBJECT, &module_info_info);
|
||||
}
|
||||
|
||||
return module_info_type;
|
||||
|
@ -506,7 +516,7 @@ static gboolean
|
|||
valid_module_name (const gchar *filename)
|
||||
{
|
||||
const gchar *basename;
|
||||
gint len;
|
||||
gint len;
|
||||
|
||||
basename = g_basename (filename);
|
||||
|
||||
|
@ -537,8 +547,8 @@ static gboolean
|
|||
module_inhibited (const gchar *fullpath,
|
||||
const gchar *inhibit_list)
|
||||
{
|
||||
gchar *p;
|
||||
gint pathlen;
|
||||
gchar *p;
|
||||
gint pathlen;
|
||||
const gchar *start;
|
||||
const gchar *end;
|
||||
|
||||
|
@ -570,7 +580,7 @@ module_inhibited (const gchar *fullpath,
|
|||
|
||||
|
||||
static void
|
||||
module_initialize (gchar *filename)
|
||||
module_initialize (const gchar *filename)
|
||||
{
|
||||
ModuleInfo *mod;
|
||||
|
||||
|
@ -583,23 +593,24 @@ module_initialize (gchar *filename)
|
|||
|
||||
mod = module_info_new ();
|
||||
|
||||
mod->fullpath = g_strdup (filename);
|
||||
mod->ondisk = TRUE;
|
||||
mod->state = ST_MODULE_ERROR;
|
||||
mod->fullpath = g_strdup (filename);
|
||||
mod->ondisk = TRUE;
|
||||
mod->state = ST_MODULE_ERROR;
|
||||
|
||||
mod->info = NULL;
|
||||
mod->module = NULL;
|
||||
mod->info = NULL;
|
||||
mod->module = NULL;
|
||||
mod->last_module_error = NULL;
|
||||
mod->init = NULL;
|
||||
mod->unload = NULL;
|
||||
mod->init = NULL;
|
||||
mod->unload = NULL;
|
||||
|
||||
/* Count of times main gimp is within the module. Normally, this
|
||||
* will be 1, and we assume that the module won't call its
|
||||
* unload callback until it is satisfied that it's not in use any
|
||||
* more. refs can be 2 temporarily while we're running the module's
|
||||
* unload function, to stop the module attempting to unload
|
||||
* itself. */
|
||||
mod->refs = 0;
|
||||
* itself.
|
||||
*/
|
||||
mod->refs = 0;
|
||||
|
||||
mod->load_inhibit = module_inhibited (mod->fullpath, module_db_load_inhibit);
|
||||
if (!mod->load_inhibit)
|
||||
|
@ -646,7 +657,7 @@ mod_load (ModuleInfo *mod,
|
|||
#ifdef __EMX__
|
||||
if (g_module_symbol (mod->module, "gimp_main_funcs", &symbol))
|
||||
{
|
||||
*(struct main_funcs_struc **)symbol = gimp_main_funcs;
|
||||
*(struct main_funcs_struc **) symbol = gimp_main_funcs;
|
||||
}
|
||||
#endif
|
||||
/* find the module_init symbol */
|
||||
|
@ -663,7 +674,7 @@ mod_load (ModuleInfo *mod,
|
|||
|
||||
g_module_close (mod->module);
|
||||
mod->module = NULL;
|
||||
mod->info = NULL;
|
||||
mod->info = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -692,7 +703,7 @@ mod_load (ModuleInfo *mod,
|
|||
|
||||
|
||||
static void
|
||||
mod_unload_completed_callback (void *data)
|
||||
mod_unload_completed_callback (gpointer data)
|
||||
{
|
||||
ModuleInfo *mod = data;
|
||||
|
||||
|
@ -1149,5 +1160,3 @@ gimp_module_unref (ModuleInfo *mod)
|
|||
mod->module = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of module_db.c */
|
||||
|
|
|
@ -1779,7 +1779,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
|||
SET_SENSITIVE ("File/Save", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->filename);
|
||||
SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->has_filename);
|
||||
SET_SENSITIVE ("File/Close", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Edit", gdisp);
|
||||
|
|
|
@ -486,7 +486,8 @@ raise_if_match (gpointer data,
|
|||
pair = (BoolCharPair *) user_data;
|
||||
|
||||
if (gdisp->gimage->has_filename &&
|
||||
strcmp (pair->string, gdisp->gimage->filename) == 0)
|
||||
strcmp (pair->string,
|
||||
gimp_object_get_name (GIMP_OBJECT (gdisp->gimage))) == 0)
|
||||
{
|
||||
pair->boole = TRUE;
|
||||
gdk_window_raise (gdisp->shell->window);
|
||||
|
|
|
@ -1303,7 +1303,7 @@ file_save (GimpImage *gimage,
|
|||
if (set_filename)
|
||||
{
|
||||
/* set the image title */
|
||||
gimp_image_set_filename (gimage, filename);
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
/* note: 'filename' may have been free'd by above call! */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1779,7 +1779,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
|||
SET_SENSITIVE ("File/Save", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->filename);
|
||||
SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->has_filename);
|
||||
SET_SENSITIVE ("File/Close", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Edit", gdisp);
|
||||
|
|
|
@ -69,7 +69,7 @@ gimage_new (gint width,
|
|||
gtk_signal_connect (GTK_OBJECT (gimage), "destroy",
|
||||
GTK_SIGNAL_FUNC (gimage_destroy_handler),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (gimage), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (gimage), "name_changed",
|
||||
GTK_SIGNAL_FUNC (gimage_rename_handler),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (gimage), "resize",
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
enum
|
||||
{
|
||||
DIRTY,
|
||||
RENAME,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -78,7 +77,6 @@ gimp_brush_destroy (GtkObject *object)
|
|||
GimpBrush *brush = GIMP_BRUSH (object);
|
||||
|
||||
g_free (brush->filename);
|
||||
g_free (brush->name);
|
||||
|
||||
if (brush->mask)
|
||||
temp_buf_free (brush->mask);
|
||||
|
@ -105,21 +103,11 @@ gimp_brush_class_init (GimpBrushClass *klass)
|
|||
gtk_signal_default_marshaller,
|
||||
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);
|
||||
|
||||
object_class->destroy = gimp_brush_destroy;
|
||||
|
||||
klass->dirty = NULL;
|
||||
klass->rename = NULL;
|
||||
|
||||
klass->select_brush = gimp_brush_select_brush;
|
||||
klass->want_null_motion = gimp_brush_want_null_motion;
|
||||
|
@ -129,7 +117,6 @@ void
|
|||
gimp_brush_init (GimpBrush *brush)
|
||||
{
|
||||
brush->filename = NULL;
|
||||
brush->name = NULL;
|
||||
|
||||
brush->spacing = 20;
|
||||
brush->x_axis.x = 15.0;
|
||||
|
@ -167,7 +154,7 @@ gimp_brush_get_type (void)
|
|||
}
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_load (gchar *filename)
|
||||
gimp_brush_load (const gchar *filename)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
gint fd;
|
||||
|
@ -208,7 +195,7 @@ gimp_brush_want_null_motion (PaintCore *paint_core)
|
|||
}
|
||||
|
||||
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 (GIMP_IS_BRUSH (brush), NULL);
|
||||
|
@ -217,7 +204,7 @@ gimp_brush_get_mask (GimpBrush *brush)
|
|||
}
|
||||
|
||||
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 (GIMP_IS_BRUSH (brush), NULL);
|
||||
|
@ -225,34 +212,8 @@ gimp_brush_get_pixmap (GimpBrush *brush)
|
|||
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
|
||||
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 (GIMP_IS_BRUSH (brush), 0);
|
||||
|
@ -271,8 +232,8 @@ gimp_brush_set_spacing (GimpBrush *brush,
|
|||
}
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_load_brush (gint fd,
|
||||
gchar *filename)
|
||||
gimp_brush_load_brush (gint fd,
|
||||
const gchar *filename)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
GPattern *pattern;
|
||||
|
@ -285,7 +246,7 @@ gimp_brush_load_brush (gint fd,
|
|||
g_return_val_if_fail (fd != -1, NULL);
|
||||
|
||||
/* Read in the header size */
|
||||
if (read (fd, &header, sizeof (header)) != sizeof (header))
|
||||
if (read (fd, &header, sizeof (header)) != sizeof (header))
|
||||
return NULL;
|
||||
|
||||
/* rearrange the bytes in each unsigned int */
|
||||
|
@ -335,10 +296,10 @@ gimp_brush_load_brush (gint fd,
|
|||
switch (header.bytes)
|
||||
{
|
||||
case 1:
|
||||
brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ()));
|
||||
brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH));
|
||||
brush->mask = temp_buf_new (header.width, header.height, 1,
|
||||
0, 0, NULL);
|
||||
if (read (fd,
|
||||
if (read (fd,
|
||||
temp_buf_data (brush->mask), header.width * header.height) <
|
||||
header.width * header.height)
|
||||
{
|
||||
|
@ -348,7 +309,7 @@ gimp_brush_load_brush (gint fd,
|
|||
gtk_object_unref (GTK_OBJECT (brush));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* For backwards-compatibility, check if a pattern follows.
|
||||
The obsolete .gpb format did it this way. */
|
||||
pattern = pattern_load (fd, filename);
|
||||
|
@ -377,13 +338,13 @@ gimp_brush_load_brush (gint fd,
|
|||
break;
|
||||
|
||||
case 4:
|
||||
brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ()));
|
||||
brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH));
|
||||
brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL);
|
||||
brush->pixmap = temp_buf_new (header.width, header.height, 3, 0, 0, NULL);
|
||||
|
||||
for (i = 0; i < header.width * header.height; i++)
|
||||
{
|
||||
if (read (fd, temp_buf_data (brush->pixmap)
|
||||
if (read (fd, temp_buf_data (brush->pixmap)
|
||||
+ i * 3, 3) != 3 ||
|
||||
read (fd, temp_buf_data (brush->mask) + i, 1) != 1)
|
||||
{
|
||||
|
@ -403,7 +364,10 @@ gimp_brush_load_brush (gint fd,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
brush->name = name;
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), name);
|
||||
|
||||
g_free (name);
|
||||
|
||||
brush->spacing = header.spacing;
|
||||
brush->x_axis.x = header.width / 2.0;
|
||||
brush->x_axis.y = 0.0;
|
||||
|
|
|
@ -23,20 +23,20 @@
|
|||
#include "gimpobject.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BRUSH (gimp_brush_get_type ())
|
||||
#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
|
||||
#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH))
|
||||
#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gimp_brush_get_type(), GimpBrushClass))
|
||||
#define GIMP_TYPE_BRUSH (gimp_brush_get_type ())
|
||||
#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
|
||||
#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH, GimpBrushClass))
|
||||
#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH))
|
||||
#define GIMP_IS_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH))
|
||||
|
||||
|
||||
typedef struct _GimpBrushClass GimpBrushClass;
|
||||
|
||||
struct _GimpBrush
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* actual filename--brush's location on disk */
|
||||
gchar *name; /* brush's name--for brush selection dialog */
|
||||
gint spacing; /* brush's spacing */
|
||||
GimpVector2 x_axis; /* for calculating brush spacing */
|
||||
GimpVector2 y_axis; /* for calculating brush spacing */
|
||||
|
@ -49,7 +49,6 @@ struct _GimpBrushClass
|
|||
GimpObjectClass parent_class;
|
||||
|
||||
void (* dirty) (GimpBrush *brush);
|
||||
void (* rename) (GimpBrush *brush);
|
||||
|
||||
/* FIXME: these are no virtual function pointers but bad hacks: */
|
||||
GimpBrush * (* select_brush) (PaintCore *paint_core);
|
||||
|
@ -58,21 +57,17 @@ struct _GimpBrushClass
|
|||
|
||||
|
||||
GtkType gimp_brush_get_type (void);
|
||||
GimpBrush * gimp_brush_load (gchar *filename);
|
||||
GimpBrush * gimp_brush_load (const gchar *filename);
|
||||
|
||||
GimpBrush * gimp_brush_load_brush (gint fd,
|
||||
gchar *filename);
|
||||
GimpBrush * gimp_brush_load_brush (gint fd,
|
||||
const gchar *filename);
|
||||
|
||||
TempBuf * gimp_brush_get_mask (GimpBrush *brush);
|
||||
TempBuf * gimp_brush_get_pixmap (GimpBrush *brush);
|
||||
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
|
||||
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
|
||||
|
||||
gchar * gimp_brush_get_name (GimpBrush *brush);
|
||||
void gimp_brush_set_name (GimpBrush *brush,
|
||||
gchar *name);
|
||||
|
||||
gint gimp_brush_get_spacing (GimpBrush *brush);
|
||||
void gimp_brush_set_spacing (GimpBrush *brush,
|
||||
gint spacing);
|
||||
gint gimp_brush_get_spacing (const GimpBrush *brush);
|
||||
void gimp_brush_set_spacing (GimpBrush *brush,
|
||||
gint spacing);
|
||||
|
||||
|
||||
#endif /* __GIMP_BRUSH_H__ */
|
||||
|
|
|
@ -113,10 +113,10 @@ gimp_brush_generated_new (gfloat radius,
|
|||
GimpBrushGenerated *brush;
|
||||
|
||||
/* set up normal brush data */
|
||||
brush =
|
||||
GIMP_BRUSH_GENERATED (gtk_type_new (gimp_brush_generated_get_type ()));
|
||||
brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED));
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), "Untitled");
|
||||
|
||||
GIMP_BRUSH (brush)->name = g_strdup ("Untitled");
|
||||
GIMP_BRUSH (brush)->spacing = 20;
|
||||
|
||||
/* set up gimp_brush_generated data */
|
||||
|
@ -166,7 +166,7 @@ gimp_brush_generated_load (const gchar *file_name)
|
|||
fgets (string, 255, fp);
|
||||
if (string[strlen (string) - 1] == '\n')
|
||||
string[strlen (string) - 1] = 0;
|
||||
GIMP_BRUSH (brush)->name = g_strdup (string);
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), string);
|
||||
|
||||
/* read brush spacing */
|
||||
fscanf (fp, "%f", &fl);
|
||||
|
@ -217,10 +217,10 @@ gimp_brush_generated_save (GimpBrushGenerated *brush,
|
|||
fprintf (fp, "1.0\n");
|
||||
|
||||
/* write name */
|
||||
fprintf (fp, "%.255s\n", GIMP_BRUSH (brush)->name);
|
||||
fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name);
|
||||
|
||||
/* write brush spacing */
|
||||
fprintf (fp, "%f\n", (float) GIMP_BRUSH (brush)->spacing);
|
||||
fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing);
|
||||
|
||||
/* write brush radius */
|
||||
fprintf (fp, "%f\n", brush->radius);
|
||||
|
|
|
@ -25,29 +25,31 @@
|
|||
#include "gimpbrush.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ())
|
||||
#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated))
|
||||
#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED))
|
||||
#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ())
|
||||
#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated))
|
||||
#define GIMP_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGeneratedClass))
|
||||
#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED))
|
||||
#define GIMP_IS_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_GENERATED))
|
||||
|
||||
|
||||
typedef struct _GimpBrushGeneratedClass GimpBrushGeneratedClass;
|
||||
|
||||
struct _GimpBrushGenerated
|
||||
{
|
||||
GimpBrush gbrush;
|
||||
GimpBrush parent_instance;
|
||||
|
||||
gfloat radius;
|
||||
gfloat hardness; /* 0.0 - 1.0 */
|
||||
gfloat angle; /* in degrees */
|
||||
gfloat aspect_ratio; /* y/x */
|
||||
gfloat radius;
|
||||
gfloat hardness; /* 0.0 - 1.0 */
|
||||
gfloat angle; /* in degrees */
|
||||
gfloat aspect_ratio; /* y/x */
|
||||
|
||||
/* private */
|
||||
gint freeze;
|
||||
|
||||
/*GSpline *profile_curve */ /* Some lazy day... */
|
||||
};
|
||||
|
||||
struct _GimpBrushGeneratedClass
|
||||
{
|
||||
GimpBrushClass parent_class;
|
||||
GimpBrushClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ GimpBrushList *brush_list = NULL;
|
|||
|
||||
|
||||
/* local function prototypes */
|
||||
static void brushes_brush_load (gchar *filename);
|
||||
static void brushes_brush_load (const gchar *filename);
|
||||
|
||||
static gint brush_compare_func (gconstpointer first,
|
||||
gconstpointer second);
|
||||
|
@ -174,7 +174,7 @@ brushes_get_standard_brush (void)
|
|||
standard_brush =
|
||||
GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
|
||||
|
||||
gimp_brush_set_name (standard_brush, "Standard");
|
||||
gimp_object_set_name (GIMP_OBJECT (standard_brush), "Standard");
|
||||
|
||||
/* set ref_count to 2 --> never swap the standard brush */
|
||||
gtk_object_ref (GTK_OBJECT (standard_brush));
|
||||
|
@ -186,7 +186,7 @@ brushes_get_standard_brush (void)
|
|||
}
|
||||
|
||||
static void
|
||||
brushes_brush_load (gchar *filename)
|
||||
brushes_brush_load (const gchar *filename)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
|
||||
|
@ -224,8 +224,8 @@ static gint
|
|||
brush_compare_func (gconstpointer first,
|
||||
gconstpointer second)
|
||||
{
|
||||
return strcmp (((const GimpBrush *) first)->name,
|
||||
((const GimpBrush *) second)->name);
|
||||
return strcmp (((const GimpObject *) first)->name,
|
||||
((const GimpObject *) second)->name);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -257,10 +257,11 @@ brushes_free (void)
|
|||
|
||||
if (vbr_dir)
|
||||
{
|
||||
char *safe_name;
|
||||
int i;
|
||||
gchar *safe_name;
|
||||
gint i;
|
||||
|
||||
/* make sure we don't create a naughty filename */
|
||||
safe_name = g_strdup(brush->name);
|
||||
safe_name = g_strdup (GIMP_OBJECT (brush)->name);
|
||||
if (safe_name[0] == '.')
|
||||
safe_name[0] = '_';
|
||||
for (i = 0; safe_name[i]; i++)
|
||||
|
@ -271,13 +272,13 @@ brushes_free (void)
|
|||
vbr_dir,
|
||||
safe_name);
|
||||
while ((tmp_fp = fopen (filename, "r")))
|
||||
{ /* make sure we don't overite an existing brush */
|
||||
fclose (tmp_fp);
|
||||
g_free (filename);
|
||||
filename = g_strdup_printf ("%s%s_%d.vbr",
|
||||
vbr_dir, safe_name, unum);
|
||||
unum++;
|
||||
}
|
||||
{ /* make sure we don't overite an existing brush */
|
||||
fclose (tmp_fp);
|
||||
g_free (filename);
|
||||
filename = g_strdup_printf ("%s%s_%d.vbr",
|
||||
vbr_dir, safe_name, unum);
|
||||
unum++;
|
||||
}
|
||||
g_free (safe_name);
|
||||
}
|
||||
}
|
||||
|
@ -337,69 +338,90 @@ gimp_brush_list_uniquefy_brush_name (GimpBrushList *brush_list,
|
|||
GimpBrush *brush)
|
||||
{
|
||||
GSList *list;
|
||||
GSList *listb;
|
||||
GimpBrush *brushb;
|
||||
gint number = 1;
|
||||
gchar *newname;
|
||||
gchar *oldname;
|
||||
GSList *list2;
|
||||
GSList *base_list;
|
||||
GimpBrush *brush2;
|
||||
gint unique_ext = 0;
|
||||
gchar *new_name = NULL;
|
||||
gchar *ext;
|
||||
|
||||
g_return_if_fail (GIMP_IS_BRUSH_LIST (brush_list));
|
||||
g_return_if_fail (GIMP_IS_BRUSH (brush));
|
||||
|
||||
for (list = GIMP_LIST (brush_list)->list; list; list = g_slist_next (list))
|
||||
base_list = GIMP_LIST (brush_list)->list;
|
||||
|
||||
for (list = base_list; list; list = g_slist_next (list))
|
||||
{
|
||||
brushb = GIMP_BRUSH (list->data);
|
||||
brush2 = GIMP_BRUSH (list->data);
|
||||
|
||||
if (brush != brushb &&
|
||||
strcmp (gimp_brush_get_name (brush),
|
||||
gimp_brush_get_name (brushb)) == 0)
|
||||
if (brush != brush2 &&
|
||||
strcmp (gimp_object_get_name (GIMP_OBJECT (brush)),
|
||||
gimp_object_get_name (GIMP_OBJECT (brush2))) == 0)
|
||||
{
|
||||
/* names conflict */
|
||||
oldname = gimp_brush_get_name (brush);
|
||||
newname = g_malloc (strlen (oldname) + 10); /* if this aint enough
|
||||
yer screwed */
|
||||
strcpy (newname, oldname);
|
||||
if ((ext = strrchr (newname, '#')))
|
||||
{
|
||||
number = atoi (ext + 1);
|
||||
ext = strrchr (GIMP_OBJECT (brush)->name, '#');
|
||||
|
||||
if (&ext[(gint)(log10 (number) + 1)] !=
|
||||
&newname[strlen (newname) - 1])
|
||||
{
|
||||
number = 1;
|
||||
ext = &newname[strlen (newname)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 1;
|
||||
ext = &newname[strlen (newname)];
|
||||
}
|
||||
sprintf (ext, "#%d", number + 1);
|
||||
for (listb = GIMP_LIST (brush_list)->list; listb; listb = listb->next)
|
||||
{
|
||||
brushb = GIMP_BRUSH (listb->data);
|
||||
if (ext)
|
||||
{
|
||||
gchar *ext_str;
|
||||
|
||||
unique_ext = atoi (ext + 1);
|
||||
|
||||
ext_str = g_strdup_printf ("%d", unique_ext);
|
||||
|
||||
/* check if the extension really is of the form "#<n>" */
|
||||
if (! strcmp (ext_str, ext + 1))
|
||||
{
|
||||
*ext = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
unique_ext = 0;
|
||||
}
|
||||
|
||||
g_free (ext_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
unique_ext = 0;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
unique_ext++;
|
||||
|
||||
g_free (new_name);
|
||||
|
||||
new_name = g_strdup_printf ("%s#%d",
|
||||
GIMP_OBJECT (brush)->name,
|
||||
unique_ext);
|
||||
|
||||
for (list2 = base_list; list2; list2 = g_slist_next (list2))
|
||||
{
|
||||
brush2 = GIMP_BRUSH (list2->data);
|
||||
|
||||
if (brush == brush2)
|
||||
continue;
|
||||
|
||||
if (! strcmp (GIMP_OBJECT (brush2)->name, new_name))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (list2);
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (brush), new_name);
|
||||
g_free (new_name);
|
||||
|
||||
if (brush != brushb &&
|
||||
strcmp (newname, gimp_brush_get_name (brushb)) == 0)
|
||||
{
|
||||
number++;
|
||||
sprintf (ext, "#%d", number+1);
|
||||
listb = GIMP_LIST (brush_list)->list;
|
||||
}
|
||||
}
|
||||
gimp_brush_set_name (brush, newname);
|
||||
g_free (newname);
|
||||
if (gimp_list_have (GIMP_LIST (brush_list), brush))
|
||||
{
|
||||
/* ought to have a better way than this to resort the brush */
|
||||
gtk_object_ref (GTK_OBJECT (brush));
|
||||
gimp_brush_list_remove (brush_list, brush);
|
||||
gimp_brush_list_add (brush_list, brush);
|
||||
gtk_object_unref (GTK_OBJECT (brush));
|
||||
}
|
||||
return;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +439,7 @@ gimp_brush_list_add (GimpBrushList *brush_list,
|
|||
{
|
||||
gimp_brush_list_uniquefy_brush_name (brush_list, brush);
|
||||
gimp_list_add (GIMP_LIST (brush_list), brush);
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
|
||||
GTK_SIGNAL_FUNC (brush_renamed),
|
||||
brush_list);
|
||||
}
|
||||
|
@ -441,20 +463,20 @@ gimp_brush_list_length (GimpBrushList *brush_list)
|
|||
|
||||
GimpBrush *
|
||||
gimp_brush_list_get_brush (GimpBrushList *blist,
|
||||
gchar *name)
|
||||
const gchar *name)
|
||||
{
|
||||
GimpBrush *brushp;
|
||||
GSList *list;
|
||||
GimpObject *object;
|
||||
GSList *list;
|
||||
|
||||
if (blist == NULL || name == NULL)
|
||||
return NULL;
|
||||
|
||||
for (list = GIMP_LIST (blist)->list; list; list = g_slist_next (list))
|
||||
{
|
||||
brushp = (GimpBrush *) list->data;
|
||||
object = (GimpObject *) list->data;
|
||||
|
||||
if (!strcmp (brushp->name, name))
|
||||
return brushp;
|
||||
if (!strcmp (object->name, name))
|
||||
return GIMP_BRUSH (object);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -23,19 +23,21 @@
|
|||
#include "gimplist.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BRUSH_LIST (gimp_brush_list_get_type ())
|
||||
#define GIMP_BRUSH_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_LIST, GimpBrushList))
|
||||
#define GIMP_IS_BRUSH_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_LIST))
|
||||
#define GIMP_BRUSH_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_BRUSH_LIST, GimpBrushListClass))
|
||||
#define GIMP_TYPE_BRUSH_LIST (gimp_brush_list_get_type ())
|
||||
#define GIMP_BRUSH_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_LIST, GimpBrushList))
|
||||
#define GIMP_BRUSH_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_BRUSH_LIST, GimpBrushListClass))
|
||||
#define GIMP_IS_BRUSH_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_LIST))
|
||||
#define GIMP_IS_BRUSH_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_LIST))
|
||||
|
||||
|
||||
|
||||
typedef struct _GimpBrushListClass GimpBrushListClass;
|
||||
|
||||
struct _GimpBrushList
|
||||
{
|
||||
GimpList gimplist;
|
||||
GimpList parent_instance;
|
||||
|
||||
gint num_brushes;
|
||||
gint num_brushes;
|
||||
};
|
||||
|
||||
struct _GimpBrushListClass
|
||||
|
@ -59,7 +61,7 @@ void gimp_brush_list_remove (GimpBrushList *list,
|
|||
GimpBrush *brush);
|
||||
|
||||
GimpBrush * gimp_brush_list_get_brush (GimpBrushList *list,
|
||||
gchar *name);
|
||||
const gchar *name);
|
||||
GimpBrush * gimp_brush_list_get_brush_by_index (GimpBrushList *list,
|
||||
gint index);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -68,8 +69,8 @@ static GimpBrush *
|
|||
gimp_brush_pipe_select_brush (PaintCore *paint_core)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i, brushix, ix;
|
||||
gdouble angle;
|
||||
gint i, brushix, ix;
|
||||
gdouble angle;
|
||||
|
||||
g_return_val_if_fail (paint_core != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), NULL);
|
||||
|
@ -133,7 +134,7 @@ static gboolean
|
|||
gimp_brush_pipe_want_null_motion (PaintCore *paint_core)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (paint_core != NULL, TRUE);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), TRUE);
|
||||
|
@ -154,7 +155,7 @@ static void
|
|||
gimp_brush_pipe_destroy (GtkObject *object)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gint i;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GIMP_IS_BRUSH_PIPE (object));
|
||||
|
@ -231,20 +232,18 @@ gimp_brush_pipe_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_pipe_load (gchar *filename)
|
||||
gimp_brush_pipe_load (const gchar *filename)
|
||||
{
|
||||
GimpBrushPipe *pipe = NULL;
|
||||
GimpPixPipeParams params;
|
||||
gint i;
|
||||
gint num_of_brushes = 0;
|
||||
gint totalcells;
|
||||
gchar *paramstring;
|
||||
GString *buffer;
|
||||
gchar c;
|
||||
gint fd;
|
||||
gint i;
|
||||
gint num_of_brushes = 0;
|
||||
gint totalcells;
|
||||
gchar *paramstring;
|
||||
GString *buffer;
|
||||
gchar c;
|
||||
gint fd;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
|
@ -265,9 +264,9 @@ gimp_brush_pipe_load (gchar *filename)
|
|||
if (buffer->len > 0 && buffer->len < 1024)
|
||||
{
|
||||
pipe = GIMP_BRUSH_PIPE (gtk_type_new (GIMP_TYPE_BRUSH_PIPE));
|
||||
GIMP_BRUSH (pipe)->name = buffer->str;
|
||||
gimp_object_set_name (GIMP_OBJECT (pipe), buffer->str);
|
||||
}
|
||||
g_string_free (buffer, FALSE);
|
||||
g_string_free (buffer, TRUE);
|
||||
|
||||
if (!pipe)
|
||||
{
|
||||
|
@ -374,9 +373,9 @@ gimp_brush_pipe_load (gchar *filename)
|
|||
{
|
||||
gtk_object_ref (GTK_OBJECT (pipe->brushes[pipe->nbrushes]));
|
||||
gtk_object_sink (GTK_OBJECT (pipe->brushes[pipe->nbrushes]));
|
||||
|
||||
g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name);
|
||||
GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL;
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (pipe->brushes[pipe->nbrushes]),
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
#include "gimpbrush.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BRUSH_PIPE (gimp_brush_pipe_get_type ())
|
||||
#define GIMP_BRUSH_PIPE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipe))
|
||||
#define GIMP_IS_BRUSH_PIPE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIPE))
|
||||
#define GIMP_TYPE_BRUSH_PIPE (gimp_brush_pipe_get_type ())
|
||||
#define GIMP_BRUSH_PIPE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipe))
|
||||
#define GIMP_BRUSH_PIPE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipeClass))
|
||||
#define GIMP_IS_BRUSH_PIPE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIPE))
|
||||
#define GIMP_IS_BRUSH_PIPE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_PIPE))
|
||||
|
||||
|
||||
typedef enum
|
||||
|
@ -46,7 +48,7 @@ typedef struct _GimpBrushPipeClass GimpBrushPipeClass;
|
|||
|
||||
struct _GimpBrushPipe
|
||||
{
|
||||
GimpBrush gbrush; /* Also itself a brush */
|
||||
GimpBrush parent_instance;
|
||||
|
||||
gint dimension;
|
||||
gint *rank; /* Size in each dimension */
|
||||
|
@ -69,7 +71,7 @@ struct _GimpBrushPipeClass
|
|||
|
||||
GtkType gimp_brush_pipe_get_type (void);
|
||||
|
||||
GimpBrush * gimp_brush_pipe_load (gchar *filename);
|
||||
GimpBrush * gimp_brush_pipe_load (const gchar *filename);
|
||||
|
||||
|
||||
#endif /* __GIMP_BRUSH_PIPE_H__ */
|
||||
|
|
|
@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass;
|
|||
|
||||
struct _GimpChannel
|
||||
{
|
||||
GimpDrawable drawable;
|
||||
GimpDrawable parent_instance;
|
||||
|
||||
guchar col[3]; /* RGB triplet for channel color */
|
||||
gint opacity; /* Channel opacity */
|
||||
gboolean show_masked; /* Show masked areas--as */
|
||||
/* opposed to selected areas */
|
||||
guchar col[3]; /* RGB triplet for channel color */
|
||||
gint opacity; /* Channel opacity */
|
||||
gboolean show_masked; /* Show masked areas--as */
|
||||
/* opposed to selected areas */
|
||||
|
||||
/* Selection mask variables */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs_in; /* outline of selected region */
|
||||
BoundSeg *segs_out; /* outline of selected region */
|
||||
gint num_segs_in; /* number of lines in boundary */
|
||||
gint num_segs_out; /* number of lines in boundary */
|
||||
gboolean empty; /* is the region empty? */
|
||||
gboolean bounds_known; /* recalculate the bounds? */
|
||||
gint x1, y1; /* coordinates for bounding box */
|
||||
gint x2, y2; /* lower right hand coordinate */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs_in; /* outline of selected region */
|
||||
BoundSeg *segs_out; /* outline of selected region */
|
||||
gint num_segs_in; /* number of lines in boundary */
|
||||
gint num_segs_out; /* number of lines in boundary */
|
||||
gboolean empty; /* is the region empty? */
|
||||
gboolean bounds_known; /* recalculate the bounds? */
|
||||
gint x1, y1; /* coordinates for bounding box */
|
||||
gint x2, y2; /* lower right hand coordinate */
|
||||
};
|
||||
|
||||
struct _GimpChannelClass
|
||||
{
|
||||
GimpDrawableClass parent_class;
|
||||
GimpDrawableClass parent_class;
|
||||
|
||||
void (* removed) (GimpChannel *channel);
|
||||
};
|
||||
|
|
|
@ -347,12 +347,6 @@ gimp_context_destroy (GtkObject *object)
|
|||
if (context->parent)
|
||||
gimp_context_unset_parent (context);
|
||||
|
||||
if (context->name)
|
||||
{
|
||||
g_free (context->name);
|
||||
context->name = NULL;
|
||||
}
|
||||
|
||||
if (context->image)
|
||||
gtk_signal_disconnect_by_data (GTK_OBJECT (image_context), context);
|
||||
|
||||
|
@ -397,6 +391,8 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
gtk_object_add_arg_type (gimp_context_arg_names[IMAGE_CHANGED],
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_IMAGE);
|
||||
gtk_object_add_arg_type (gimp_context_arg_names[DISPLAY_CHANGED],
|
||||
|
@ -418,8 +414,6 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
gtk_object_add_arg_type (gimp_context_arg_names[GRADIENT_CHANGED],
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_GRADIENT);
|
||||
|
||||
parent_class = gtk_type_class (gimp_object_get_type ());
|
||||
|
||||
gimp_context_signals[IMAGE_CHANGED] =
|
||||
gtk_signal_new (gimp_context_signal_names[IMAGE_CHANGED],
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -546,7 +540,6 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
static void
|
||||
gimp_context_init (GimpContext *context)
|
||||
{
|
||||
context->name = NULL;
|
||||
context->parent = NULL;
|
||||
|
||||
context->defined_args = GIMP_CONTEXT_ALL_ARGS_MASK;
|
||||
|
@ -601,7 +594,7 @@ gimp_context_get_type (void)
|
|||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
context_type = gtk_type_unique (gimp_object_get_type (), &context_info);
|
||||
context_type = gtk_type_unique (GIMP_TYPE_OBJECT, &context_info);
|
||||
}
|
||||
|
||||
return context_type;
|
||||
|
@ -615,10 +608,13 @@ gimp_context_new (const gchar *name,
|
|||
|
||||
g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL);
|
||||
|
||||
context = gtk_type_new (gimp_context_get_type ());
|
||||
context = gtk_type_new (GIMP_TYPE_CONTEXT);
|
||||
|
||||
/* FIXME: need unique names here */
|
||||
context->name = g_strdup (name ? name : "Unnamed");
|
||||
if (! name)
|
||||
name = "Unnamed";
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (context), name);
|
||||
|
||||
if (template)
|
||||
{
|
||||
|
@ -685,13 +681,13 @@ gimp_context_get_standard (void)
|
|||
/*****************************************************************************/
|
||||
/* functions manipulating a single context *********************************/
|
||||
|
||||
gchar *
|
||||
gimp_context_get_name (GimpContext *context)
|
||||
const gchar *
|
||||
gimp_context_get_name (const GimpContext *context)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_val_if_fail (context, NULL);
|
||||
|
||||
return context->name;
|
||||
return gimp_object_get_name (GIMP_OBJECT (context));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -701,14 +697,14 @@ gimp_context_set_name (GimpContext *context,
|
|||
context_check_current (context);
|
||||
context_return_if_fail (context);
|
||||
|
||||
if (context->name)
|
||||
g_free (context->name);
|
||||
if (! name)
|
||||
name = "Unnamed";
|
||||
|
||||
context->name = g_strdup (name ? name : "Unnamed");
|
||||
gimp_object_set_name (GIMP_OBJECT (context), name);
|
||||
}
|
||||
|
||||
GimpContext *
|
||||
gimp_context_get_parent (GimpContext *context)
|
||||
gimp_context_get_parent (const GimpContext *context)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_val_if_fail (context, NULL);
|
||||
|
@ -1387,7 +1383,7 @@ gimp_context_brush_dirty (GimpBrush *brush,
|
|||
GimpContext *context)
|
||||
{
|
||||
g_free (context->brush_name);
|
||||
context->brush_name = g_strdup (brush->name);
|
||||
context->brush_name = g_strdup (GIMP_OBJECT (brush)->name);
|
||||
|
||||
gimp_context_brush_changed (context);
|
||||
}
|
||||
|
@ -1461,7 +1457,7 @@ gimp_context_real_set_brush (GimpContext *context,
|
|||
gtk_signal_connect (GTK_OBJECT (brush), "dirty",
|
||||
GTK_SIGNAL_FUNC (gimp_context_brush_dirty),
|
||||
context);
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_context_brush_dirty),
|
||||
context);
|
||||
|
||||
|
@ -1474,7 +1470,7 @@ gimp_context_real_set_brush (GimpContext *context,
|
|||
}
|
||||
|
||||
if (brush != standard_brush)
|
||||
context->brush_name = g_strdup (brush->name);
|
||||
context->brush_name = g_strdup (GIMP_OBJECT (brush)->name);
|
||||
}
|
||||
|
||||
gimp_context_brush_changed (context);
|
||||
|
|
|
@ -77,9 +77,8 @@ typedef struct _GimpContextClass GimpContextClass;
|
|||
|
||||
struct _GimpContext
|
||||
{
|
||||
GimpObject object;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *name;
|
||||
GimpContext *parent;
|
||||
|
||||
guint32 defined_args;
|
||||
|
@ -107,7 +106,7 @@ struct _GimpContext
|
|||
|
||||
struct _GimpContextClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* image_changed) (GimpContext *context,
|
||||
GimpImage *image);
|
||||
|
@ -168,14 +167,14 @@ GimpContext * gimp_context_get_standard (void);
|
|||
|
||||
/* functions for manipulating a single context
|
||||
*/
|
||||
gchar * gimp_context_get_name (GimpContext *context);
|
||||
void gimp_context_set_name (GimpContext *context,
|
||||
const gchar *name);
|
||||
const gchar * gimp_context_get_name (const GimpContext *context);
|
||||
void gimp_context_set_name (GimpContext *context,
|
||||
const gchar *name);
|
||||
|
||||
GimpContext * gimp_context_get_parent (GimpContext *context);
|
||||
void gimp_context_set_parent (GimpContext *context,
|
||||
GimpContext *parent);
|
||||
void gimp_context_unset_parent (GimpContext *context);
|
||||
GimpContext * gimp_context_get_parent (const GimpContext *context);
|
||||
void gimp_context_set_parent (GimpContext *context,
|
||||
GimpContext *parent);
|
||||
void gimp_context_unset_parent (GimpContext *context);
|
||||
|
||||
/* define / undefinine context arguments
|
||||
*
|
||||
|
|
|
@ -344,7 +344,7 @@ gimp_context_preview_update (GimpContextPreview *gcp,
|
|||
gimp_context_preview_draw_brush (gcp);
|
||||
gtk_signal_connect (GTK_OBJECT (gcp->data), "dirty",
|
||||
GTK_SIGNAL_FUNC (brush_dirty_callback), gcp);
|
||||
gtk_signal_connect (GTK_OBJECT (gcp->data), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (gcp->data), "name_changed",
|
||||
GTK_SIGNAL_FUNC (brush_rename_callback), gcp);
|
||||
break;
|
||||
case GCP_PATTERN:
|
||||
|
@ -367,7 +367,7 @@ gimp_context_preview_update (GimpContextPreview *gcp,
|
|||
case GCP_BRUSH:
|
||||
{
|
||||
GimpBrush *brush = GIMP_BRUSH (gcp->data);
|
||||
name = brush->name;
|
||||
name = GIMP_OBJECT (brush)->name;
|
||||
}
|
||||
break;
|
||||
case GCP_PATTERN:
|
||||
|
@ -385,6 +385,7 @@ gimp_context_preview_update (GimpContextPreview *gcp,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_help_set_help_data (GTK_WIDGET (gcp), name, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -572,7 +573,7 @@ gimp_context_preview_popup_timeout (gpointer data)
|
|||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
gtk_widget_queue_draw (gcp_popup_preview);
|
||||
|
||||
return FALSE;
|
||||
|
@ -817,7 +818,7 @@ brush_rename_callback (GimpBrush *brush,
|
|||
GimpContextPreview *gcp)
|
||||
{
|
||||
if (gcp->show_tooltips)
|
||||
gimp_help_set_help_data (GTK_WIDGET (gcp), brush->name, NULL);
|
||||
gimp_help_set_help_data (GTK_WIDGET (gcp), GIMP_OBJECT (brush)->name, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -627,7 +627,7 @@ gimp_dnd_get_brush_data (GtkWidget *widget,
|
|||
if (! brush)
|
||||
return NULL;
|
||||
|
||||
name = g_strdup (gimp_brush_get_name (brush));
|
||||
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
|
||||
|
||||
if (! name)
|
||||
return NULL;
|
||||
|
|
|
@ -34,7 +34,7 @@ typedef struct _GimpDrawableClass GimpDrawableClass;
|
|||
|
||||
struct _GimpDrawable
|
||||
{
|
||||
GimpObject data;
|
||||
GimpObject parent_instance;
|
||||
|
||||
TileManager *tiles; /* tiles for drawable data */
|
||||
gboolean visible; /* controls visibility */
|
||||
|
@ -57,7 +57,7 @@ struct _GimpDrawable
|
|||
|
||||
struct _GimpDrawableClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* invalidate_preview) (GimpDrawable *drawable);
|
||||
};
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_destroy (GtkObject *object);
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static void gimp_image_free_projection (GimpImage *gimage);
|
||||
static void gimp_image_allocate_shadow (GimpImage *gimage,
|
||||
gint width,
|
||||
|
@ -145,7 +146,6 @@ enum
|
|||
CLEAN,
|
||||
DIRTY,
|
||||
REPAINT,
|
||||
RENAME,
|
||||
RESIZE,
|
||||
RESTRUCTURE,
|
||||
COLORMAP_CHANGED,
|
||||
|
@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL;
|
|||
static void
|
||||
gimp_image_class_init (GimpImageClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
gimp_object_class = (GimpObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
|
@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
gimp_image_signals[RENAME] =
|
||||
gtk_signal_new ("rename",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpImageClass,
|
||||
rename),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gimp_image_signals[RESIZE] =
|
||||
gtk_signal_new ("resize",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass)
|
|||
|
||||
object_class->destroy = gimp_image_destroy;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
|
||||
klass->clean = NULL;
|
||||
klass->dirty = NULL;
|
||||
klass->repaint = NULL;
|
||||
klass->rename = NULL;
|
||||
klass->resize = NULL;
|
||||
klass->restructure = NULL;
|
||||
klass->colormap_changed = NULL;
|
||||
|
@ -381,10 +375,9 @@ gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type)
|
||||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ()));
|
||||
GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE));
|
||||
gint i;
|
||||
|
||||
gimage->filename = NULL;
|
||||
gimage->width = width;
|
||||
gimage->height = height;
|
||||
gimage->base_type = base_type;
|
||||
|
@ -430,38 +423,32 @@ gimp_image_new (gint width,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename)
|
||||
gimp_image_set_filename (GimpImage *gimage,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *new_filename;
|
||||
gchar *old_filename;
|
||||
gboolean free_old;
|
||||
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: this function will free the current filename even if you are
|
||||
* setting it to itself so any pointer you hold to the filename will be
|
||||
* invalid after this call. So please use with care.
|
||||
*/
|
||||
static void
|
||||
gimp_image_name_changed (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const gchar *name;
|
||||
|
||||
new_filename = g_strdup (filename);
|
||||
old_filename = gimage->filename;
|
||||
free_old = gimage->has_filename;
|
||||
gimage = GIMP_IMAGE (object);
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (filename && filename[0])
|
||||
if (name && name[0])
|
||||
{
|
||||
gimage->filename = new_filename;
|
||||
gimage->has_filename = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage->filename = NULL;
|
||||
gimage->has_filename = FALSE;
|
||||
}
|
||||
|
||||
if (free_old)
|
||||
g_free (old_filename);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]);
|
||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
|
||||
if (gimage->cmap)
|
||||
g_free (gimage->cmap);
|
||||
|
||||
if (gimage->has_filename)
|
||||
g_free (gimage->filename);
|
||||
|
||||
|
||||
gimp_image_free_layers (gimage);
|
||||
gimp_image_free_channels (gimage);
|
||||
|
||||
|
@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if (gimage->has_filename)
|
||||
return gimage->filename;
|
||||
return gimp_object_get_name (GIMP_OBJECT (gimage));
|
||||
else
|
||||
return _("Untitled");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass;
|
|||
|
||||
struct _GimpImage
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
gchar *filename; /* original filename */
|
||||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
|
@ -126,7 +125,6 @@ struct _GimpImageClass
|
|||
void (* clean) (GimpImage *gimage);
|
||||
void (* dirty) (GimpImage *gimage);
|
||||
void (* repaint) (GimpImage *gimage);
|
||||
void (* rename) (GimpImage *gimage);
|
||||
void (* resize) (GimpImage *gimage);
|
||||
void (* restructure) (GimpImage *gimage);
|
||||
void (* colormap_changed) (GimpImage *gimage);
|
||||
|
@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width,
|
|||
gint height,
|
||||
GimpImageBaseType base_type);
|
||||
void gimp_image_set_filename (GimpImage *gimage,
|
||||
gchar *filename);
|
||||
const gchar *filename);
|
||||
void gimp_image_set_resolution (GimpImage *gimage,
|
||||
gdouble xres,
|
||||
gdouble yres);
|
||||
|
|
|
@ -160,8 +160,7 @@ gimp_layer_mask_get_type (void)
|
|||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
layer_mask_type = gtk_type_unique (gimp_channel_get_type (),
|
||||
&layer_mask_info);
|
||||
layer_mask_type = gtk_type_unique (GIMP_TYPE_CHANNEL, &layer_mask_info);
|
||||
}
|
||||
|
||||
return layer_mask_type;
|
||||
|
@ -284,7 +283,7 @@ layer_new (GimpImage *gimage,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
layer = gtk_type_new (gimp_layer_get_type ());
|
||||
layer = gtk_type_new (GIMP_TYPE_LAYER);
|
||||
|
||||
gimp_drawable_configure (GIMP_DRAWABLE (layer),
|
||||
gimage, width, height, type, name);
|
||||
|
@ -1771,7 +1770,7 @@ layer_mask_new (GimpImage *gimage,
|
|||
LayerMask *layer_mask;
|
||||
gint i;
|
||||
|
||||
layer_mask = gtk_type_new (gimp_layer_mask_get_type ());
|
||||
layer_mask = gtk_type_new (GIMP_TYPE_LAYER_MASK);
|
||||
|
||||
gimp_drawable_configure (GIMP_DRAWABLE (layer_mask),
|
||||
gimage, width, height, GRAY_GIMAGE, name);
|
||||
|
|
|
@ -42,49 +42,49 @@ typedef struct _GimpLayerMaskClass GimpLayerMaskClass;
|
|||
|
||||
struct _GimpLayer
|
||||
{
|
||||
GimpDrawable drawable;
|
||||
GimpDrawable parent_instance;
|
||||
|
||||
gboolean linked; /* control linkage */
|
||||
gboolean preserve_trans; /* preserve transparency */
|
||||
gboolean linked; /* control linkage */
|
||||
gboolean preserve_trans; /* preserve transparency */
|
||||
|
||||
LayerMask *mask; /* possible layer mask */
|
||||
gint apply_mask; /* controls mask application */
|
||||
gboolean edit_mask; /* edit mask or layer? */
|
||||
gboolean show_mask; /* show mask or layer? */
|
||||
LayerMask *mask; /* possible layer mask */
|
||||
gint apply_mask; /* controls mask application */
|
||||
gboolean edit_mask; /* edit mask or layer? */
|
||||
gboolean show_mask; /* show mask or layer? */
|
||||
|
||||
gint opacity; /* layer opacity */
|
||||
LayerModeEffects mode; /* layer combination mode */
|
||||
gint opacity; /* layer opacity */
|
||||
LayerModeEffects mode; /* layer combination mode */
|
||||
|
||||
/* Floating selections */
|
||||
struct
|
||||
{
|
||||
TileManager *backing_store; /* for obscured regions */
|
||||
GimpDrawable *drawable; /* floating sel is attached to */
|
||||
gboolean initial; /* is fs composited yet? */
|
||||
TileManager *backing_store; /* for obscured regions */
|
||||
GimpDrawable *drawable; /* floating sel is attached to */
|
||||
gboolean initial; /* is fs composited yet? */
|
||||
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs; /* boundary of floating sel */
|
||||
gint num_segs; /* number of segs in boundary */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs; /* boundary of floating sel */
|
||||
gint num_segs; /* number of segs in boundary */
|
||||
} fs;
|
||||
};
|
||||
|
||||
struct _GimpLayerClass
|
||||
{
|
||||
GimpDrawableClass parent_class;
|
||||
GimpDrawableClass parent_class;
|
||||
|
||||
void (* removed) (GimpLayer *layer);
|
||||
};
|
||||
|
||||
struct _GimpLayerMask
|
||||
{
|
||||
GimpChannel drawable;
|
||||
GimpChannel parent_instance;
|
||||
|
||||
Layer *layer;
|
||||
Layer *layer;
|
||||
};
|
||||
|
||||
struct _GimpLayerMaskClass
|
||||
{
|
||||
GimpChannelClass parent_class;
|
||||
GimpChannelClass parent_class;
|
||||
};
|
||||
|
||||
/* Special undo types */
|
||||
|
|
|
@ -30,26 +30,27 @@
|
|||
*/
|
||||
|
||||
|
||||
#define GIMP_TYPE_LIST (gimp_list_get_type ())
|
||||
#define GIMP_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_LIST, GimpList))
|
||||
#define GIMP_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_LIST))
|
||||
#define GIMP_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LIST, GimpListClass))
|
||||
#define GIMP_TYPE_LIST (gimp_list_get_type ())
|
||||
#define GIMP_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_LIST, GimpList))
|
||||
#define GIMP_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LIST, GimpListClass))
|
||||
#define GIMP_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_LIST))
|
||||
#define GIMP_IS_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LIST))
|
||||
|
||||
|
||||
typedef struct _GimpListClass GimpListClass;
|
||||
|
||||
struct _GimpList
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
GtkType type;
|
||||
GSList *list;
|
||||
gboolean weak;
|
||||
GtkType type;
|
||||
GSList *list;
|
||||
gboolean weak;
|
||||
};
|
||||
|
||||
struct _GimpListClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* add) (GimpList *list,
|
||||
gpointer object);
|
||||
|
|
|
@ -34,14 +34,14 @@ typedef struct _GimpObjectClass GimpObjectClass;
|
|||
|
||||
struct _GimpObject
|
||||
{
|
||||
GtkObject object;
|
||||
GtkObject parent_instance;
|
||||
|
||||
gchar *name;
|
||||
gchar *name;
|
||||
};
|
||||
|
||||
struct _GimpObjectClass
|
||||
{
|
||||
GtkObjectClass parent_class;
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
void (* name_changed) (GimpObject *object);
|
||||
};
|
||||
|
|
|
@ -172,7 +172,7 @@ gimp_set_new (GtkType type,
|
|||
*/
|
||||
g_assert (!(type == GTK_TYPE_NONE && weak == TRUE));
|
||||
|
||||
set = gtk_type_new (gimp_set_get_type ());
|
||||
set = gtk_type_new (GIMP_TYPE_SET);
|
||||
set->type = type;
|
||||
set->weak = weak;
|
||||
|
||||
|
|
|
@ -34,17 +34,18 @@
|
|||
* is also illegal to ask for a weak untyped gimpset.
|
||||
*/
|
||||
|
||||
#define GIMP_TYPE_SET (gimp_set_get_type ())
|
||||
#define GIMP_SET(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_SET, GimpSet))
|
||||
#define GIMP_IS_SET(obj) (GTK_CHECK_TYPE ((obj), gimp_set_get_type()))
|
||||
#define GIMP_SET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gimp_set_get_type(), GimpSetClass))
|
||||
#define GIMP_TYPE_SET (gimp_set_get_type ())
|
||||
#define GIMP_SET(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_SET, GimpSet))
|
||||
#define GIMP_SET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SET, GimpSetClass))
|
||||
#define GIMP_IS_SET(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_SET))
|
||||
#define GIMP_IS_SET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SET))
|
||||
|
||||
|
||||
typedef struct _GimpSetClass GimpSetClass;
|
||||
|
||||
struct _GimpSet
|
||||
{
|
||||
GimpObject gobject;
|
||||
GimpObject parent_instance;
|
||||
|
||||
GtkType type;
|
||||
GSList *list;
|
||||
|
@ -55,7 +56,7 @@ struct _GimpSet
|
|||
|
||||
struct _GimpSetClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* add) (GimpSet *gimpset,
|
||||
gpointer object);
|
||||
|
|
|
@ -575,20 +575,20 @@ static void cpopup_blend_endpoints (gdouble r0,
|
|||
/* Gradient functions */
|
||||
|
||||
static gradient_t * grad_new_gradient (void);
|
||||
static void grad_free_gradient (gradient_t *grad);
|
||||
static void grad_free_gradient (gradient_t *grad);
|
||||
static void grad_free_gradients (void);
|
||||
static void grad_load_gradient (gchar *filename);
|
||||
static void grad_save_gradient (gradient_t *grad,
|
||||
gchar *filename);
|
||||
static void grad_save_all (gboolean need_free);
|
||||
static void grad_load_gradient (const gchar *filename);
|
||||
static void grad_save_gradient (gradient_t *grad,
|
||||
const gchar *filename);
|
||||
static void grad_save_all (gboolean need_free);
|
||||
|
||||
static gradient_t * grad_create_default_gradient (void);
|
||||
|
||||
static gint grad_insert_in_gradients_list (gradient_t *grad);
|
||||
static gint grad_insert_in_gradients_list (gradient_t *grad);
|
||||
|
||||
static void grad_dump_gradient (gradient_t *grad,
|
||||
FILE *file);
|
||||
static void gradients_list_uniquefy_gradient_name (gradient_t *gradient);
|
||||
static void grad_dump_gradient (gradient_t *grad,
|
||||
FILE *file);
|
||||
static void gradients_list_uniquefy_gradient_name (gradient_t *gradient);
|
||||
|
||||
|
||||
/* Segment functions */
|
||||
|
@ -5844,7 +5844,7 @@ grad_free_gradients (void)
|
|||
/*****/
|
||||
|
||||
static void
|
||||
grad_load_gradient (gchar *filename)
|
||||
grad_load_gradient (const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
gradient_t *grad;
|
||||
|
@ -5922,11 +5922,11 @@ grad_load_gradient (gchar *filename)
|
|||
/*****/
|
||||
|
||||
static void
|
||||
grad_save_gradient (gradient_t *grad,
|
||||
char *filename)
|
||||
grad_save_gradient (gradient_t *grad,
|
||||
const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
int num_segments;
|
||||
gint num_segments;
|
||||
grad_segment_t *seg;
|
||||
|
||||
g_assert (grad != NULL);
|
||||
|
|
|
@ -575,20 +575,20 @@ static void cpopup_blend_endpoints (gdouble r0,
|
|||
/* Gradient functions */
|
||||
|
||||
static gradient_t * grad_new_gradient (void);
|
||||
static void grad_free_gradient (gradient_t *grad);
|
||||
static void grad_free_gradient (gradient_t *grad);
|
||||
static void grad_free_gradients (void);
|
||||
static void grad_load_gradient (gchar *filename);
|
||||
static void grad_save_gradient (gradient_t *grad,
|
||||
gchar *filename);
|
||||
static void grad_save_all (gboolean need_free);
|
||||
static void grad_load_gradient (const gchar *filename);
|
||||
static void grad_save_gradient (gradient_t *grad,
|
||||
const gchar *filename);
|
||||
static void grad_save_all (gboolean need_free);
|
||||
|
||||
static gradient_t * grad_create_default_gradient (void);
|
||||
|
||||
static gint grad_insert_in_gradients_list (gradient_t *grad);
|
||||
static gint grad_insert_in_gradients_list (gradient_t *grad);
|
||||
|
||||
static void grad_dump_gradient (gradient_t *grad,
|
||||
FILE *file);
|
||||
static void gradients_list_uniquefy_gradient_name (gradient_t *gradient);
|
||||
static void grad_dump_gradient (gradient_t *grad,
|
||||
FILE *file);
|
||||
static void gradients_list_uniquefy_gradient_name (gradient_t *gradient);
|
||||
|
||||
|
||||
/* Segment functions */
|
||||
|
@ -5844,7 +5844,7 @@ grad_free_gradients (void)
|
|||
/*****/
|
||||
|
||||
static void
|
||||
grad_load_gradient (gchar *filename)
|
||||
grad_load_gradient (const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
gradient_t *grad;
|
||||
|
@ -5922,11 +5922,11 @@ grad_load_gradient (gchar *filename)
|
|||
/*****/
|
||||
|
||||
static void
|
||||
grad_save_gradient (gradient_t *grad,
|
||||
char *filename)
|
||||
grad_save_gradient (gradient_t *grad,
|
||||
const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
int num_segments;
|
||||
gint num_segments;
|
||||
grad_segment_t *seg;
|
||||
|
||||
g_assert (grad != NULL);
|
||||
|
|
|
@ -140,11 +140,11 @@ brush_edit_brush_dirty_callback (GimpBrush *brush,
|
|||
}
|
||||
|
||||
static void
|
||||
brush_renamed_callback (GtkWidget *widget,
|
||||
BrushEditGeneratedWindow *begw)
|
||||
brush_name_changed_callback (GtkWidget *widget,
|
||||
BrushEditGeneratedWindow *begw)
|
||||
{
|
||||
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
|
||||
|
@ -178,8 +178,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
|
|||
gtk_signal_connect (GTK_OBJECT (brush), "dirty",
|
||||
GTK_SIGNAL_FUNC (brush_edit_brush_dirty_callback),
|
||||
begw);
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "rename",
|
||||
GTK_SIGNAL_FUNC (brush_renamed_callback),
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
|
||||
GTK_SIGNAL_FUNC (brush_name_changed_callback),
|
||||
begw);
|
||||
|
||||
begw->brush = NULL;
|
||||
|
@ -191,7 +191,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
|
|||
gimp_brush_generated_get_angle (brush));
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (begw->aspect_ratio_data),
|
||||
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;
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (begw->brush));
|
||||
|
@ -205,7 +206,7 @@ name_changed_func (GtkWidget *widget,
|
|||
gchar *entry_text;
|
||||
|
||||
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
|
||||
|
|
|
@ -676,10 +676,11 @@ static void
|
|||
brush_change_callbacks (BrushSelect *bsp,
|
||||
gboolean closing)
|
||||
{
|
||||
gchar *name;
|
||||
gchar *name;
|
||||
ProcRecord *prec = NULL;
|
||||
GimpBrush *brush;
|
||||
gint nreturn_vals;
|
||||
GimpBrush *brush;
|
||||
gint nreturn_vals;
|
||||
|
||||
static gboolean busy = FALSE;
|
||||
|
||||
/* Any procs registered to callback? */
|
||||
|
@ -688,8 +689,8 @@ brush_change_callbacks (BrushSelect *bsp,
|
|||
if (!bsp || !bsp->callback_name || busy)
|
||||
return;
|
||||
|
||||
busy = TRUE;
|
||||
name = bsp->callback_name;
|
||||
busy = TRUE;
|
||||
name = bsp->callback_name;
|
||||
brush = gimp_context_get_brush (bsp->context);
|
||||
|
||||
/* If its still registered run it */
|
||||
|
@ -700,7 +701,7 @@ brush_change_callbacks (BrushSelect *bsp,
|
|||
return_vals =
|
||||
procedural_db_run_proc (name,
|
||||
&nreturn_vals,
|
||||
PDB_STRING, brush->name,
|
||||
PDB_STRING, GIMP_OBJECT (brush)->name,
|
||||
PDB_FLOAT, gimp_context_get_opacity (bsp->context),
|
||||
PDB_INT32, bsp->spacing_value,
|
||||
PDB_INT32, (gint) gimp_context_get_paint_mode (bsp->context),
|
||||
|
@ -725,9 +726,9 @@ void
|
|||
brushes_check_dialogs (void)
|
||||
{
|
||||
BrushSelect *bsp;
|
||||
GSList *list;
|
||||
gchar *name;
|
||||
ProcRecord *prec = NULL;
|
||||
GSList *list;
|
||||
gchar *name;
|
||||
ProcRecord *prec = NULL;
|
||||
|
||||
list = brush_active_dialogs;
|
||||
|
||||
|
@ -896,7 +897,7 @@ connect_signals_to_brush (GimpBrush *brush,
|
|||
gtk_signal_connect (GTK_OBJECT (brush), "dirty",
|
||||
GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback),
|
||||
bsp);
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
|
||||
GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback),
|
||||
bsp);
|
||||
}
|
||||
|
@ -1484,7 +1485,7 @@ update_active_brush_field (BrushSelect *bsp)
|
|||
return;
|
||||
|
||||
/* 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 */
|
||||
g_snprintf (buf, sizeof (buf), "(%d x %d)",
|
||||
|
|
|
@ -263,7 +263,7 @@ gimp_colormap_dialog_create (GimpSet *context)
|
|||
image_cmap_change_cb,
|
||||
ipal);
|
||||
ipal->rename_handler = gimp_set_add_handler (context,
|
||||
"rename",
|
||||
"name_changed",
|
||||
image_rename_cb,
|
||||
ipal);
|
||||
|
||||
|
|
|
@ -713,7 +713,7 @@ devices_write_rc_device (DeviceInfo *device_info,
|
|||
if (gimp_context_get_brush (device_info->context))
|
||||
{
|
||||
fprintf (fp, "\n (brush \"%s\")",
|
||||
gimp_context_get_brush (device_info->context)->name);
|
||||
GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name);
|
||||
}
|
||||
|
||||
if (gimp_context_get_pattern (device_info->context))
|
||||
|
|
|
@ -575,20 +575,20 @@ static void cpopup_blend_endpoints (gdouble r0,
|
|||
/* Gradient functions */
|
||||
|
||||
static gradient_t * grad_new_gradient (void);
|
||||
static void grad_free_gradient (gradient_t *grad);
|
||||
static void grad_free_gradient (gradient_t *grad);
|
||||
static void grad_free_gradients (void);
|
||||
static void grad_load_gradient (gchar *filename);
|
||||
static void grad_save_gradient (gradient_t *grad,
|
||||
gchar *filename);
|
||||
static void grad_save_all (gboolean need_free);
|
||||
static void grad_load_gradient (const gchar *filename);
|
||||
static void grad_save_gradient (gradient_t *grad,
|
||||
const gchar *filename);
|
||||
static void grad_save_all (gboolean need_free);
|
||||
|
||||
static gradient_t * grad_create_default_gradient (void);
|
||||
|
||||
static gint grad_insert_in_gradients_list (gradient_t *grad);
|
||||
static gint grad_insert_in_gradients_list (gradient_t *grad);
|
||||
|
||||
static void grad_dump_gradient (gradient_t *grad,
|
||||
FILE *file);
|
||||
static void gradients_list_uniquefy_gradient_name (gradient_t *gradient);
|
||||
static void grad_dump_gradient (gradient_t *grad,
|
||||
FILE *file);
|
||||
static void gradients_list_uniquefy_gradient_name (gradient_t *gradient);
|
||||
|
||||
|
||||
/* Segment functions */
|
||||
|
@ -5844,7 +5844,7 @@ grad_free_gradients (void)
|
|||
/*****/
|
||||
|
||||
static void
|
||||
grad_load_gradient (gchar *filename)
|
||||
grad_load_gradient (const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
gradient_t *grad;
|
||||
|
@ -5922,11 +5922,11 @@ grad_load_gradient (gchar *filename)
|
|||
/*****/
|
||||
|
||||
static void
|
||||
grad_save_gradient (gradient_t *grad,
|
||||
char *filename)
|
||||
grad_save_gradient (gradient_t *grad,
|
||||
const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
int num_segments;
|
||||
gint num_segments;
|
||||
grad_segment_t *seg;
|
||||
|
||||
g_assert (grad != NULL);
|
||||
|
|
|
@ -85,9 +85,9 @@ static void
|
|||
info_window_image_rename_callback (GimpImage *gimage,
|
||||
gpointer data)
|
||||
{
|
||||
InfoDialog *id;
|
||||
gchar *title;
|
||||
GDisplay * gdisp;
|
||||
InfoDialog *id;
|
||||
gchar *title;
|
||||
GDisplay *gdisp;
|
||||
InfoWinData *iwd;
|
||||
|
||||
id = (InfoDialog *) data;
|
||||
|
@ -302,7 +302,7 @@ info_window_create (GDisplay *gdisp)
|
|||
info_window_create_extended (info_win);
|
||||
|
||||
/* keep track of image name changes */
|
||||
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "name_changed",
|
||||
GTK_SIGNAL_FUNC (info_window_image_rename_callback),
|
||||
info_win);
|
||||
|
||||
|
|
|
@ -713,7 +713,7 @@ devices_write_rc_device (DeviceInfo *device_info,
|
|||
if (gimp_context_get_brush (device_info->context))
|
||||
{
|
||||
fprintf (fp, "\n (brush \"%s\")",
|
||||
gimp_context_get_brush (device_info->context)->name);
|
||||
GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name);
|
||||
}
|
||||
|
||||
if (gimp_context_get_pattern (device_info->context))
|
||||
|
|
|
@ -95,7 +95,7 @@ gimp_main_funcs[] =
|
|||
/* one of these objects is kept per-module */
|
||||
typedef struct
|
||||
{
|
||||
GtkObject object;
|
||||
GtkObject parent_instance;
|
||||
|
||||
gchar *fullpath; /* path to the module */
|
||||
module_state state; /* what's happened to the module */
|
||||
|
@ -115,9 +115,9 @@ typedef struct
|
|||
|
||||
static guint module_info_get_type (void);
|
||||
|
||||
#define MODULE_INFO_TYPE module_info_get_type()
|
||||
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
|
||||
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
||||
#define MODULE_INFO_TYPE (module_info_get_type ())
|
||||
#define MODULE_INFO(obj) (GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo))
|
||||
#define IS_MODULE_INFO(obj) (GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE))
|
||||
|
||||
|
||||
#define NUM_INFO_LINES 7
|
||||
|
@ -138,7 +138,8 @@ static GimpSet *modules;
|
|||
static GimpSetHandlerId modules_handler;
|
||||
|
||||
/* If the inhibit state of any modules changes, we might need to
|
||||
* re-write the modulerc. */
|
||||
* re-write the modulerc.
|
||||
*/
|
||||
static gboolean need_to_rewrite_modulerc = FALSE;
|
||||
|
||||
|
||||
|
@ -157,7 +158,7 @@ static gboolean need_to_rewrite_modulerc = FALSE;
|
|||
|
||||
|
||||
/* prototypes */
|
||||
static void module_initialize (gchar *filename);
|
||||
static void module_initialize (const gchar *filename);
|
||||
static void mod_load (ModuleInfo *mod,
|
||||
gboolean verbose);
|
||||
static void mod_unload (ModuleInfo *mod,
|
||||
|
@ -389,24 +390,29 @@ module_db_browser_new (void)
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
/**************************/
|
||||
/* ModuleInfo object glue */
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
void (* modified) (ModuleInfo *module_info);
|
||||
} ModuleInfoClass;
|
||||
|
||||
enum
|
||||
{
|
||||
MODIFIED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
typedef struct _ModuleInfoClass ModuleInfoClass;
|
||||
|
||||
struct _ModuleInfoClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* modified) (ModuleInfo *module_info);
|
||||
};
|
||||
|
||||
|
||||
static guint module_info_signals[LAST_SIGNAL];
|
||||
|
||||
static GimpObjectClass *parent_class = NULL;
|
||||
|
||||
static void
|
||||
module_info_destroy (GtkObject *object)
|
||||
|
@ -419,6 +425,9 @@ module_info_destroy (GtkObject *object)
|
|||
if (mod->last_module_error)
|
||||
g_free (mod->last_module_error);
|
||||
g_free (mod->fullpath);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -428,6 +437,8 @@ module_info_class_init (ModuleInfoClass *klass)
|
|||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
module_info_signals[MODIFIED] =
|
||||
gtk_signal_new ("modified",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -469,8 +480,7 @@ module_info_get_type (void)
|
|||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
module_info_type =
|
||||
gtk_type_unique (gtk_object_get_type (), &module_info_info);
|
||||
module_info_type = gtk_type_unique (GIMP_TYPE_OBJECT, &module_info_info);
|
||||
}
|
||||
|
||||
return module_info_type;
|
||||
|
@ -506,7 +516,7 @@ static gboolean
|
|||
valid_module_name (const gchar *filename)
|
||||
{
|
||||
const gchar *basename;
|
||||
gint len;
|
||||
gint len;
|
||||
|
||||
basename = g_basename (filename);
|
||||
|
||||
|
@ -537,8 +547,8 @@ static gboolean
|
|||
module_inhibited (const gchar *fullpath,
|
||||
const gchar *inhibit_list)
|
||||
{
|
||||
gchar *p;
|
||||
gint pathlen;
|
||||
gchar *p;
|
||||
gint pathlen;
|
||||
const gchar *start;
|
||||
const gchar *end;
|
||||
|
||||
|
@ -570,7 +580,7 @@ module_inhibited (const gchar *fullpath,
|
|||
|
||||
|
||||
static void
|
||||
module_initialize (gchar *filename)
|
||||
module_initialize (const gchar *filename)
|
||||
{
|
||||
ModuleInfo *mod;
|
||||
|
||||
|
@ -583,23 +593,24 @@ module_initialize (gchar *filename)
|
|||
|
||||
mod = module_info_new ();
|
||||
|
||||
mod->fullpath = g_strdup (filename);
|
||||
mod->ondisk = TRUE;
|
||||
mod->state = ST_MODULE_ERROR;
|
||||
mod->fullpath = g_strdup (filename);
|
||||
mod->ondisk = TRUE;
|
||||
mod->state = ST_MODULE_ERROR;
|
||||
|
||||
mod->info = NULL;
|
||||
mod->module = NULL;
|
||||
mod->info = NULL;
|
||||
mod->module = NULL;
|
||||
mod->last_module_error = NULL;
|
||||
mod->init = NULL;
|
||||
mod->unload = NULL;
|
||||
mod->init = NULL;
|
||||
mod->unload = NULL;
|
||||
|
||||
/* Count of times main gimp is within the module. Normally, this
|
||||
* will be 1, and we assume that the module won't call its
|
||||
* unload callback until it is satisfied that it's not in use any
|
||||
* more. refs can be 2 temporarily while we're running the module's
|
||||
* unload function, to stop the module attempting to unload
|
||||
* itself. */
|
||||
mod->refs = 0;
|
||||
* itself.
|
||||
*/
|
||||
mod->refs = 0;
|
||||
|
||||
mod->load_inhibit = module_inhibited (mod->fullpath, module_db_load_inhibit);
|
||||
if (!mod->load_inhibit)
|
||||
|
@ -646,7 +657,7 @@ mod_load (ModuleInfo *mod,
|
|||
#ifdef __EMX__
|
||||
if (g_module_symbol (mod->module, "gimp_main_funcs", &symbol))
|
||||
{
|
||||
*(struct main_funcs_struc **)symbol = gimp_main_funcs;
|
||||
*(struct main_funcs_struc **) symbol = gimp_main_funcs;
|
||||
}
|
||||
#endif
|
||||
/* find the module_init symbol */
|
||||
|
@ -663,7 +674,7 @@ mod_load (ModuleInfo *mod,
|
|||
|
||||
g_module_close (mod->module);
|
||||
mod->module = NULL;
|
||||
mod->info = NULL;
|
||||
mod->info = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -692,7 +703,7 @@ mod_load (ModuleInfo *mod,
|
|||
|
||||
|
||||
static void
|
||||
mod_unload_completed_callback (void *data)
|
||||
mod_unload_completed_callback (gpointer data)
|
||||
{
|
||||
ModuleInfo *mod = data;
|
||||
|
||||
|
@ -1149,5 +1160,3 @@ gimp_module_unref (ModuleInfo *mod)
|
|||
mod->module = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of module_db.c */
|
||||
|
|
|
@ -146,19 +146,20 @@ struct _PaletteDialog
|
|||
};
|
||||
|
||||
/* local function prototypes */
|
||||
static void palette_entry_free (PaletteEntry *);
|
||||
static void palette_entries_free (PaletteEntries *);
|
||||
static void palette_entries_load (gchar *);
|
||||
static void palette_entries_save (PaletteEntries *, gchar *);
|
||||
static void palette_save_palettes (void);
|
||||
static void palette_entry_free (PaletteEntry *entry);
|
||||
static void palette_entries_free (PaletteEntries *entries);
|
||||
static void palette_entries_load (const gchar *filename);
|
||||
static void palette_entries_save (PaletteEntries *entries,
|
||||
const gchar *filename);
|
||||
static void palette_save_palettes (void);
|
||||
|
||||
static void palette_entries_list_insert (PaletteEntries *entries);
|
||||
|
||||
static void palette_dialog_draw_entries (PaletteDialog *palette,
|
||||
gint row_start,
|
||||
gint column_highlight);
|
||||
static void palette_dialog_redraw (PaletteDialog *palette);
|
||||
static void palette_dialog_scroll_top_left (PaletteDialog *palette);
|
||||
static void palette_dialog_draw_entries (PaletteDialog *palette,
|
||||
gint row_start,
|
||||
gint column_highlight);
|
||||
static void palette_dialog_redraw (PaletteDialog *palette);
|
||||
static void palette_dialog_scroll_top_left (PaletteDialog *palette);
|
||||
|
||||
static PaletteDialog * palette_dialog_new (gboolean editor);
|
||||
static ImportDialog * palette_import_dialog_new (PaletteDialog *palette);
|
||||
|
@ -375,7 +376,7 @@ palette_entries_add_entry (PaletteEntries *entries,
|
|||
}
|
||||
|
||||
static void
|
||||
palette_entries_load (gchar *filename)
|
||||
palette_entries_load (const gchar *filename)
|
||||
{
|
||||
PaletteEntries *entries;
|
||||
gchar str[512];
|
||||
|
@ -505,11 +506,11 @@ palette_entries_delete (gchar *filename)
|
|||
|
||||
static void
|
||||
palette_entries_save (PaletteEntries *palette,
|
||||
gchar *filename)
|
||||
const gchar *filename)
|
||||
{
|
||||
PaletteEntry *entry;
|
||||
GSList *list;
|
||||
FILE *fp;
|
||||
GSList *list;
|
||||
FILE *fp;
|
||||
|
||||
if (! filename)
|
||||
return;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define COLOR_UPDATE_NEW 1
|
||||
#define COLOR_UPDATE 2
|
||||
|
||||
|
||||
void palettes_init (gboolean no_data);
|
||||
void palettes_free (void);
|
||||
|
||||
|
|
|
@ -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_install (GPProcInstall *proc_install);
|
||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||
static void plug_in_write_rc (gchar *filename);
|
||||
static void plug_in_init_file (gchar *filename);
|
||||
static void plug_in_write_rc (const gchar *filename);
|
||||
static void plug_in_init_file (const gchar *filename);
|
||||
static void plug_in_query (PlugInDef *plug_in_def);
|
||||
static void plug_in_add_to_db (void);
|
||||
static void plug_in_make_menu (void);
|
||||
|
@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name,
|
|||
|
||||
|
||||
PlugInDef *
|
||||
plug_in_def_new (gchar *prog)
|
||||
plug_in_def_new (const gchar *prog)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
|
||||
|
@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp,
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_write_rc (gchar *filename)
|
||||
plug_in_write_rc (const gchar *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename)
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_init_file (gchar *filename)
|
||||
plug_in_init_file (const gchar *filename)
|
||||
{
|
||||
GSList *tmp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
|
|
@ -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_install (GPProcInstall *proc_install);
|
||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||
static void plug_in_write_rc (gchar *filename);
|
||||
static void plug_in_init_file (gchar *filename);
|
||||
static void plug_in_write_rc (const gchar *filename);
|
||||
static void plug_in_init_file (const gchar *filename);
|
||||
static void plug_in_query (PlugInDef *plug_in_def);
|
||||
static void plug_in_add_to_db (void);
|
||||
static void plug_in_make_menu (void);
|
||||
|
@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name,
|
|||
|
||||
|
||||
PlugInDef *
|
||||
plug_in_def_new (gchar *prog)
|
||||
plug_in_def_new (const gchar *prog)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
|
||||
|
@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp,
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_write_rc (gchar *filename)
|
||||
plug_in_write_rc (const gchar *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename)
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_init_file (gchar *filename)
|
||||
plug_in_init_file (const gchar *filename)
|
||||
{
|
||||
GSList *tmp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
|
|
@ -85,9 +85,9 @@ static void
|
|||
info_window_image_rename_callback (GimpImage *gimage,
|
||||
gpointer data)
|
||||
{
|
||||
InfoDialog *id;
|
||||
gchar *title;
|
||||
GDisplay * gdisp;
|
||||
InfoDialog *id;
|
||||
gchar *title;
|
||||
GDisplay *gdisp;
|
||||
InfoWinData *iwd;
|
||||
|
||||
id = (InfoDialog *) data;
|
||||
|
@ -302,7 +302,7 @@ info_window_create (GDisplay *gdisp)
|
|||
info_window_create_extended (info_win);
|
||||
|
||||
/* keep track of image name changes */
|
||||
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "rename",
|
||||
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "name_changed",
|
||||
GTK_SIGNAL_FUNC (info_window_image_rename_callback),
|
||||
info_win);
|
||||
|
||||
|
|
|
@ -160,8 +160,7 @@ gimp_layer_mask_get_type (void)
|
|||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
layer_mask_type = gtk_type_unique (gimp_channel_get_type (),
|
||||
&layer_mask_info);
|
||||
layer_mask_type = gtk_type_unique (GIMP_TYPE_CHANNEL, &layer_mask_info);
|
||||
}
|
||||
|
||||
return layer_mask_type;
|
||||
|
@ -284,7 +283,7 @@ layer_new (GimpImage *gimage,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
layer = gtk_type_new (gimp_layer_get_type ());
|
||||
layer = gtk_type_new (GIMP_TYPE_LAYER);
|
||||
|
||||
gimp_drawable_configure (GIMP_DRAWABLE (layer),
|
||||
gimage, width, height, type, name);
|
||||
|
@ -1771,7 +1770,7 @@ layer_mask_new (GimpImage *gimage,
|
|||
LayerMask *layer_mask;
|
||||
gint i;
|
||||
|
||||
layer_mask = gtk_type_new (gimp_layer_mask_get_type ());
|
||||
layer_mask = gtk_type_new (GIMP_TYPE_LAYER_MASK);
|
||||
|
||||
gimp_drawable_configure (GIMP_DRAWABLE (layer_mask),
|
||||
gimage, width, height, GRAY_GIMAGE, name);
|
||||
|
|
38
app/layer.h
38
app/layer.h
|
@ -42,49 +42,49 @@ typedef struct _GimpLayerMaskClass GimpLayerMaskClass;
|
|||
|
||||
struct _GimpLayer
|
||||
{
|
||||
GimpDrawable drawable;
|
||||
GimpDrawable parent_instance;
|
||||
|
||||
gboolean linked; /* control linkage */
|
||||
gboolean preserve_trans; /* preserve transparency */
|
||||
gboolean linked; /* control linkage */
|
||||
gboolean preserve_trans; /* preserve transparency */
|
||||
|
||||
LayerMask *mask; /* possible layer mask */
|
||||
gint apply_mask; /* controls mask application */
|
||||
gboolean edit_mask; /* edit mask or layer? */
|
||||
gboolean show_mask; /* show mask or layer? */
|
||||
LayerMask *mask; /* possible layer mask */
|
||||
gint apply_mask; /* controls mask application */
|
||||
gboolean edit_mask; /* edit mask or layer? */
|
||||
gboolean show_mask; /* show mask or layer? */
|
||||
|
||||
gint opacity; /* layer opacity */
|
||||
LayerModeEffects mode; /* layer combination mode */
|
||||
gint opacity; /* layer opacity */
|
||||
LayerModeEffects mode; /* layer combination mode */
|
||||
|
||||
/* Floating selections */
|
||||
struct
|
||||
{
|
||||
TileManager *backing_store; /* for obscured regions */
|
||||
GimpDrawable *drawable; /* floating sel is attached to */
|
||||
gboolean initial; /* is fs composited yet? */
|
||||
TileManager *backing_store; /* for obscured regions */
|
||||
GimpDrawable *drawable; /* floating sel is attached to */
|
||||
gboolean initial; /* is fs composited yet? */
|
||||
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs; /* boundary of floating sel */
|
||||
gint num_segs; /* number of segs in boundary */
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs; /* boundary of floating sel */
|
||||
gint num_segs; /* number of segs in boundary */
|
||||
} fs;
|
||||
};
|
||||
|
||||
struct _GimpLayerClass
|
||||
{
|
||||
GimpDrawableClass parent_class;
|
||||
GimpDrawableClass parent_class;
|
||||
|
||||
void (* removed) (GimpLayer *layer);
|
||||
};
|
||||
|
||||
struct _GimpLayerMask
|
||||
{
|
||||
GimpChannel drawable;
|
||||
GimpChannel parent_instance;
|
||||
|
||||
Layer *layer;
|
||||
Layer *layer;
|
||||
};
|
||||
|
||||
struct _GimpLayerMaskClass
|
||||
{
|
||||
GimpChannelClass parent_class;
|
||||
GimpChannelClass parent_class;
|
||||
};
|
||||
|
||||
/* Special undo types */
|
||||
|
|
|
@ -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_install (GPProcInstall *proc_install);
|
||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||
static void plug_in_write_rc (gchar *filename);
|
||||
static void plug_in_init_file (gchar *filename);
|
||||
static void plug_in_write_rc (const gchar *filename);
|
||||
static void plug_in_init_file (const gchar *filename);
|
||||
static void plug_in_query (PlugInDef *plug_in_def);
|
||||
static void plug_in_add_to_db (void);
|
||||
static void plug_in_make_menu (void);
|
||||
|
@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name,
|
|||
|
||||
|
||||
PlugInDef *
|
||||
plug_in_def_new (gchar *prog)
|
||||
plug_in_def_new (const gchar *prog)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
|
||||
|
@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp,
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_write_rc (gchar *filename)
|
||||
plug_in_write_rc (const gchar *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename)
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_init_file (gchar *filename)
|
||||
plug_in_init_file (const gchar *filename)
|
||||
{
|
||||
GSList *tmp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
|
|
@ -95,7 +95,7 @@ gimp_main_funcs[] =
|
|||
/* one of these objects is kept per-module */
|
||||
typedef struct
|
||||
{
|
||||
GtkObject object;
|
||||
GtkObject parent_instance;
|
||||
|
||||
gchar *fullpath; /* path to the module */
|
||||
module_state state; /* what's happened to the module */
|
||||
|
@ -115,9 +115,9 @@ typedef struct
|
|||
|
||||
static guint module_info_get_type (void);
|
||||
|
||||
#define MODULE_INFO_TYPE module_info_get_type()
|
||||
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
|
||||
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
||||
#define MODULE_INFO_TYPE (module_info_get_type ())
|
||||
#define MODULE_INFO(obj) (GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo))
|
||||
#define IS_MODULE_INFO(obj) (GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE))
|
||||
|
||||
|
||||
#define NUM_INFO_LINES 7
|
||||
|
@ -138,7 +138,8 @@ static GimpSet *modules;
|
|||
static GimpSetHandlerId modules_handler;
|
||||
|
||||
/* If the inhibit state of any modules changes, we might need to
|
||||
* re-write the modulerc. */
|
||||
* re-write the modulerc.
|
||||
*/
|
||||
static gboolean need_to_rewrite_modulerc = FALSE;
|
||||
|
||||
|
||||
|
@ -157,7 +158,7 @@ static gboolean need_to_rewrite_modulerc = FALSE;
|
|||
|
||||
|
||||
/* prototypes */
|
||||
static void module_initialize (gchar *filename);
|
||||
static void module_initialize (const gchar *filename);
|
||||
static void mod_load (ModuleInfo *mod,
|
||||
gboolean verbose);
|
||||
static void mod_unload (ModuleInfo *mod,
|
||||
|
@ -389,24 +390,29 @@ module_db_browser_new (void)
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
/**************************/
|
||||
/* ModuleInfo object glue */
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
void (* modified) (ModuleInfo *module_info);
|
||||
} ModuleInfoClass;
|
||||
|
||||
enum
|
||||
{
|
||||
MODIFIED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
typedef struct _ModuleInfoClass ModuleInfoClass;
|
||||
|
||||
struct _ModuleInfoClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* modified) (ModuleInfo *module_info);
|
||||
};
|
||||
|
||||
|
||||
static guint module_info_signals[LAST_SIGNAL];
|
||||
|
||||
static GimpObjectClass *parent_class = NULL;
|
||||
|
||||
static void
|
||||
module_info_destroy (GtkObject *object)
|
||||
|
@ -419,6 +425,9 @@ module_info_destroy (GtkObject *object)
|
|||
if (mod->last_module_error)
|
||||
g_free (mod->last_module_error);
|
||||
g_free (mod->fullpath);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -428,6 +437,8 @@ module_info_class_init (ModuleInfoClass *klass)
|
|||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
|
||||
|
||||
module_info_signals[MODIFIED] =
|
||||
gtk_signal_new ("modified",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -469,8 +480,7 @@ module_info_get_type (void)
|
|||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
module_info_type =
|
||||
gtk_type_unique (gtk_object_get_type (), &module_info_info);
|
||||
module_info_type = gtk_type_unique (GIMP_TYPE_OBJECT, &module_info_info);
|
||||
}
|
||||
|
||||
return module_info_type;
|
||||
|
@ -506,7 +516,7 @@ static gboolean
|
|||
valid_module_name (const gchar *filename)
|
||||
{
|
||||
const gchar *basename;
|
||||
gint len;
|
||||
gint len;
|
||||
|
||||
basename = g_basename (filename);
|
||||
|
||||
|
@ -537,8 +547,8 @@ static gboolean
|
|||
module_inhibited (const gchar *fullpath,
|
||||
const gchar *inhibit_list)
|
||||
{
|
||||
gchar *p;
|
||||
gint pathlen;
|
||||
gchar *p;
|
||||
gint pathlen;
|
||||
const gchar *start;
|
||||
const gchar *end;
|
||||
|
||||
|
@ -570,7 +580,7 @@ module_inhibited (const gchar *fullpath,
|
|||
|
||||
|
||||
static void
|
||||
module_initialize (gchar *filename)
|
||||
module_initialize (const gchar *filename)
|
||||
{
|
||||
ModuleInfo *mod;
|
||||
|
||||
|
@ -583,23 +593,24 @@ module_initialize (gchar *filename)
|
|||
|
||||
mod = module_info_new ();
|
||||
|
||||
mod->fullpath = g_strdup (filename);
|
||||
mod->ondisk = TRUE;
|
||||
mod->state = ST_MODULE_ERROR;
|
||||
mod->fullpath = g_strdup (filename);
|
||||
mod->ondisk = TRUE;
|
||||
mod->state = ST_MODULE_ERROR;
|
||||
|
||||
mod->info = NULL;
|
||||
mod->module = NULL;
|
||||
mod->info = NULL;
|
||||
mod->module = NULL;
|
||||
mod->last_module_error = NULL;
|
||||
mod->init = NULL;
|
||||
mod->unload = NULL;
|
||||
mod->init = NULL;
|
||||
mod->unload = NULL;
|
||||
|
||||
/* Count of times main gimp is within the module. Normally, this
|
||||
* will be 1, and we assume that the module won't call its
|
||||
* unload callback until it is satisfied that it's not in use any
|
||||
* more. refs can be 2 temporarily while we're running the module's
|
||||
* unload function, to stop the module attempting to unload
|
||||
* itself. */
|
||||
mod->refs = 0;
|
||||
* itself.
|
||||
*/
|
||||
mod->refs = 0;
|
||||
|
||||
mod->load_inhibit = module_inhibited (mod->fullpath, module_db_load_inhibit);
|
||||
if (!mod->load_inhibit)
|
||||
|
@ -646,7 +657,7 @@ mod_load (ModuleInfo *mod,
|
|||
#ifdef __EMX__
|
||||
if (g_module_symbol (mod->module, "gimp_main_funcs", &symbol))
|
||||
{
|
||||
*(struct main_funcs_struc **)symbol = gimp_main_funcs;
|
||||
*(struct main_funcs_struc **) symbol = gimp_main_funcs;
|
||||
}
|
||||
#endif
|
||||
/* find the module_init symbol */
|
||||
|
@ -663,7 +674,7 @@ mod_load (ModuleInfo *mod,
|
|||
|
||||
g_module_close (mod->module);
|
||||
mod->module = NULL;
|
||||
mod->info = NULL;
|
||||
mod->info = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -692,7 +703,7 @@ mod_load (ModuleInfo *mod,
|
|||
|
||||
|
||||
static void
|
||||
mod_unload_completed_callback (void *data)
|
||||
mod_unload_completed_callback (gpointer data)
|
||||
{
|
||||
ModuleInfo *mod = data;
|
||||
|
||||
|
@ -1149,5 +1160,3 @@ gimp_module_unref (ModuleInfo *mod)
|
|||
mod->module = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of module_db.c */
|
||||
|
|
|
@ -146,19 +146,20 @@ struct _PaletteDialog
|
|||
};
|
||||
|
||||
/* local function prototypes */
|
||||
static void palette_entry_free (PaletteEntry *);
|
||||
static void palette_entries_free (PaletteEntries *);
|
||||
static void palette_entries_load (gchar *);
|
||||
static void palette_entries_save (PaletteEntries *, gchar *);
|
||||
static void palette_save_palettes (void);
|
||||
static void palette_entry_free (PaletteEntry *entry);
|
||||
static void palette_entries_free (PaletteEntries *entries);
|
||||
static void palette_entries_load (const gchar *filename);
|
||||
static void palette_entries_save (PaletteEntries *entries,
|
||||
const gchar *filename);
|
||||
static void palette_save_palettes (void);
|
||||
|
||||
static void palette_entries_list_insert (PaletteEntries *entries);
|
||||
|
||||
static void palette_dialog_draw_entries (PaletteDialog *palette,
|
||||
gint row_start,
|
||||
gint column_highlight);
|
||||
static void palette_dialog_redraw (PaletteDialog *palette);
|
||||
static void palette_dialog_scroll_top_left (PaletteDialog *palette);
|
||||
static void palette_dialog_draw_entries (PaletteDialog *palette,
|
||||
gint row_start,
|
||||
gint column_highlight);
|
||||
static void palette_dialog_redraw (PaletteDialog *palette);
|
||||
static void palette_dialog_scroll_top_left (PaletteDialog *palette);
|
||||
|
||||
static PaletteDialog * palette_dialog_new (gboolean editor);
|
||||
static ImportDialog * palette_import_dialog_new (PaletteDialog *palette);
|
||||
|
@ -375,7 +376,7 @@ palette_entries_add_entry (PaletteEntries *entries,
|
|||
}
|
||||
|
||||
static void
|
||||
palette_entries_load (gchar *filename)
|
||||
palette_entries_load (const gchar *filename)
|
||||
{
|
||||
PaletteEntries *entries;
|
||||
gchar str[512];
|
||||
|
@ -505,11 +506,11 @@ palette_entries_delete (gchar *filename)
|
|||
|
||||
static void
|
||||
palette_entries_save (PaletteEntries *palette,
|
||||
gchar *filename)
|
||||
const gchar *filename)
|
||||
{
|
||||
PaletteEntry *entry;
|
||||
GSList *list;
|
||||
FILE *fp;
|
||||
GSList *list;
|
||||
FILE *fp;
|
||||
|
||||
if (! filename)
|
||||
return;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define COLOR_UPDATE_NEW 1
|
||||
#define COLOR_UPDATE 2
|
||||
|
||||
|
||||
void palettes_init (gboolean no_data);
|
||||
void palettes_free (void);
|
||||
|
||||
|
|
|
@ -67,9 +67,9 @@ static GPattern *standard_pattern = NULL;
|
|||
|
||||
/* local function prototypes */
|
||||
static GPattern * pattern_load_real (gint fd,
|
||||
gchar *filename,
|
||||
const gchar *filename,
|
||||
gboolean quiet);
|
||||
static void load_pattern (gchar *filename);
|
||||
static void load_pattern (const gchar *filename);
|
||||
static void pattern_free_func (gpointer data,
|
||||
gpointer dummy);
|
||||
static gint pattern_compare_func (gconstpointer second,
|
||||
|
@ -153,8 +153,8 @@ pattern_list_get_pattern_by_index (GSList *list,
|
|||
}
|
||||
|
||||
GPattern *
|
||||
pattern_list_get_pattern (GSList *list,
|
||||
gchar *name)
|
||||
pattern_list_get_pattern (GSList *list,
|
||||
const gchar *name)
|
||||
{
|
||||
GPattern *pattern;
|
||||
|
||||
|
@ -173,21 +173,21 @@ pattern_list_get_pattern (GSList *list,
|
|||
}
|
||||
|
||||
GPattern *
|
||||
pattern_load (gint fd,
|
||||
gchar *filename)
|
||||
pattern_load (gint fd,
|
||||
const gchar *filename)
|
||||
{
|
||||
return pattern_load_real (fd, filename, TRUE);
|
||||
}
|
||||
|
||||
static GPattern *
|
||||
pattern_load_real (gint fd,
|
||||
gchar *filename,
|
||||
gboolean quiet)
|
||||
pattern_load_real (gint fd,
|
||||
const gchar *filename,
|
||||
gboolean quiet)
|
||||
{
|
||||
GPattern *pattern;
|
||||
PatternHeader header;
|
||||
gint bn_size;
|
||||
gchar *name;
|
||||
gint bn_size;
|
||||
gchar *name;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
g_return_val_if_fail (fd != -1, NULL);
|
||||
|
@ -260,10 +260,9 @@ pattern_free (GPattern *pattern)
|
|||
{
|
||||
if (pattern->mask)
|
||||
temp_buf_free (pattern->mask);
|
||||
if (pattern->filename)
|
||||
g_free (pattern->filename);
|
||||
if (pattern->name)
|
||||
g_free (pattern->name);
|
||||
|
||||
g_free (pattern->filename);
|
||||
g_free (pattern->name);
|
||||
|
||||
g_free (pattern);
|
||||
}
|
||||
|
@ -286,7 +285,7 @@ pattern_compare_func (gconstpointer first,
|
|||
}
|
||||
|
||||
static void
|
||||
load_pattern (gchar *filename)
|
||||
load_pattern (const gchar *filename)
|
||||
{
|
||||
GPattern *pattern;
|
||||
gint fd;
|
||||
|
@ -299,7 +298,7 @@ load_pattern (gchar *filename)
|
|||
g_return_if_fail (filename != NULL);
|
||||
|
||||
fd = open (filename, O_RDONLY | _O_BINARY);
|
||||
if (fd == -1)
|
||||
if (fd == -1)
|
||||
return;
|
||||
|
||||
pattern = pattern_load_real (fd, filename, FALSE);
|
||||
|
|
|
@ -22,29 +22,29 @@
|
|||
|
||||
struct _GPattern
|
||||
{
|
||||
gchar * filename; /* actual filename--pattern's location on disk */
|
||||
gchar * name; /* pattern's name--for pattern selection dialog */
|
||||
gint index; /* pattern's index... */
|
||||
TempBuf * mask; /* the actual mask... */
|
||||
gchar *filename; /* actual filename--pattern's location on disk */
|
||||
gchar *name; /* pattern's name--for pattern selection dialog */
|
||||
gint index; /* pattern's index... */
|
||||
TempBuf *mask; /* the actual mask... */
|
||||
};
|
||||
|
||||
/* global variables */
|
||||
extern GSList * pattern_list;
|
||||
extern gint num_patterns;
|
||||
extern GSList *pattern_list;
|
||||
extern gint num_patterns;
|
||||
|
||||
void patterns_init (gboolean no_data);
|
||||
void patterns_init (gboolean no_data);
|
||||
void patterns_free (void);
|
||||
GPattern * patterns_get_standard_pattern (void);
|
||||
|
||||
GPattern * pattern_list_get_pattern_by_index (GSList *list,
|
||||
gint index);
|
||||
GPattern * pattern_list_get_pattern (GSList *list,
|
||||
gchar *name);
|
||||
GPattern * pattern_list_get_pattern_by_index (GSList *list,
|
||||
gint index);
|
||||
GPattern * pattern_list_get_pattern (GSList *list,
|
||||
const gchar *name);
|
||||
|
||||
/* this is useful for pixmap brushes etc. */
|
||||
GPattern * pattern_load (gint fd,
|
||||
gchar *filename);
|
||||
void pattern_free (GPattern *pattern);
|
||||
GPattern * pattern_load (gint fd,
|
||||
const gchar *filename);
|
||||
void pattern_free (GPattern *pattern);
|
||||
|
||||
|
||||
#endif /* __PATTERNS_H__ */
|
||||
|
|
|
@ -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_install (GPProcInstall *proc_install);
|
||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||
static void plug_in_write_rc (gchar *filename);
|
||||
static void plug_in_init_file (gchar *filename);
|
||||
static void plug_in_write_rc (const gchar *filename);
|
||||
static void plug_in_init_file (const gchar *filename);
|
||||
static void plug_in_query (PlugInDef *plug_in_def);
|
||||
static void plug_in_add_to_db (void);
|
||||
static void plug_in_make_menu (void);
|
||||
|
@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name,
|
|||
|
||||
|
||||
PlugInDef *
|
||||
plug_in_def_new (gchar *prog)
|
||||
plug_in_def_new (const gchar *prog)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
|
||||
|
@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp,
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_write_rc (gchar *filename)
|
||||
plug_in_write_rc (const gchar *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename)
|
|||
}
|
||||
|
||||
static void
|
||||
plug_in_init_file (gchar *filename)
|
||||
plug_in_init_file (const gchar *filename)
|
||||
{
|
||||
GSList *tmp;
|
||||
PlugInDef *plug_in_def;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue