Commit 311c83b0 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

app/Makefile.am new file containing the dnd data definitions.

1999-08-19  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/Makefile.am
	* app/gimpdnd.h: new file containing the dnd data definitions.

	* app/disp_callbacks.[ch]
	* app/interface.c: drop layers on the toolbox to create a new
	image and on the display to copy it to the image's layer stack.

	* app/layers_dialog.c: drop layer on the "New" button to create an
	empty layer with the dropped layer's properties, to "Duplicate" to
	duplicate it and on the trashcan to delete it.
	Thanks to Andy for the ultra-cool dnd preview pixmap patch.

	* app/layer.[ch]
	* app/undo.c: renamed layer_mask() to layer_get_mask(). Prototyped
	some function headers.

	* app/disp_callbacks.c: Wheelmouse stuff: Shift+wheel scales the
	display.

	* app/airbrush.c
	* app/eraser.c
	* app/paint_options.h
	* app/paintbrush.c
	* app/pencil.c
	* app/tool_options.c: moved the "Incremental" toggle to the
	PaintOptions structure because it is used more often now.
parent e7c1e756
1999-08-19 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/Makefile.am
* app/gimpdnd.h: new file containing the dnd data definitions.
* app/disp_callbacks.[ch]
* app/interface.c: drop layers on the toolbox to create a new
image and on the display to copy it to the image's layer stack.
* app/layers_dialog.c: drop layer on the "New" button to create an
empty layer with the dropped layer's properties, to "Duplicate" to
duplicate it and on the trashcan to delete it.
Thanks to Andy for the ultra-cool dnd preview pixmap patch.
* app/layer.[ch]
* app/undo.c: renamed layer_mask() to layer_get_mask(). Prototyped
some function headers.
* app/disp_callbacks.c: Wheelmouse stuff: Shift+wheel scales the
display.
* app/airbrush.c
* app/eraser.c
* app/paint_options.h
* app/paintbrush.c
* app/pencil.c
* app/tool_options.c: moved the "Incremental" toggle to the
PaintOptions structure because it is used more often now.
Thu Aug 19 18:27:42 MEST 1999 Sven Neumann <sven@gimp.org>
* app/measure.c: use <Ctrl> and/or <Alt> to add horizontal
......
......@@ -197,6 +197,7 @@ gimp_SOURCES = \
gimpbrushlistP.h \
gimpcontext.c \
gimpcontext.h \
gimpdnd.h \
gimphistogram.c \
gimphistogram.h \
gimphistogramP.h \
......
......@@ -40,7 +40,7 @@
#define MAX_PRESSURE 0.075
/* Default pressure setting */
#define AIRBRUSH_PRESSURE_DEFAULT 10.0
#define AIRBRUSH_PRESSURE_DEFAULT 10.0
#define AIRBRUSH_INCREMENTAL_DEFAULT FALSE
#define OFF 0
......@@ -51,7 +51,7 @@
typedef struct _AirbrushTimeout AirbrushTimeout;
struct _AirbrushTimeout
{
PaintCore *paint_core;
PaintCore *paint_core;
GimpDrawable *drawable;
};
......@@ -67,10 +67,6 @@ struct _AirbrushOptions
double pressure;
double pressure_d;
GtkObject *pressure_w;
gboolean incremental;
gboolean incremental_d;
GtkWidget *incremental_w;
};
......@@ -103,9 +99,6 @@ airbrush_options_reset (void)
options->rate_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
}
static AirbrushOptions *
......@@ -125,8 +118,6 @@ airbrush_options_new (void)
airbrush_options_reset);
options->rate = options->rate_d = 80.0;
options->pressure = options->pressure_d = AIRBRUSH_PRESSURE_DEFAULT;
options->incremental =
options->incremental_d = AIRBRUSH_INCREMENTAL_DEFAULT;
/* the main vbox */
vbox = ((ToolOptions *) options)->main_vbox;
......@@ -172,14 +163,6 @@ airbrush_options_new (void)
&options->pressure);
gtk_widget_show (scale);
/* the incremental toggle */
options->incremental_w = gtk_check_button_new_with_label (_("Incremental"));
gtk_box_pack_start (GTK_BOX (vbox), options->incremental_w, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->incremental);
gtk_widget_show (options->incremental_w);
gtk_widget_show (table);
return options;
......@@ -208,9 +191,9 @@ tools_new_airbrush ()
}
void *
airbrush_paint_func (PaintCore *paint_core,
airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
int state)
{
GimpBrushP brush;
......@@ -236,16 +219,17 @@ airbrush_paint_func (PaintCore *paint_core,
timer_state = OFF;
airbrush_motion (paint_core, drawable, airbrush_options->pressure,
airbrush_options->incremental ? INCREMENTAL : CONSTANT);
airbrush_options->paint_options.incremental ?
INCREMENTAL : CONSTANT);
if (airbrush_options->rate != 0.0)
{
airbrush_timeout.paint_core = paint_core;
airbrush_timeout.drawable = drawable;
timer = gtk_timeout_add ((10000 / airbrush_options->rate),
airbrush_time_out, NULL);
timer_state = ON;
}
{
airbrush_timeout.paint_core = paint_core;
airbrush_timeout.drawable = drawable;
timer = gtk_timeout_add ((10000 / airbrush_options->rate),
airbrush_time_out, NULL);
timer_state = ON;
}
break;
case FINISH_PAINT :
......@@ -280,7 +264,8 @@ airbrush_time_out (gpointer client_data)
airbrush_motion (airbrush_timeout.paint_core,
airbrush_timeout.drawable,
airbrush_options->pressure,
airbrush_options->incremental ? INCREMENTAL : CONSTANT);
airbrush_options->paint_options.incremental ?
INCREMENTAL : CONSTANT);
gdisplays_flush ();
/* restart the timer */
......
......@@ -121,8 +121,8 @@ layer_size (Layer *layer)
GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height * GIMP_DRAWABLE(layer)->bytes +
strlen (GIMP_DRAWABLE(layer)->name);
if (layer_mask (layer))
size += channel_size (GIMP_CHANNEL (layer_mask (layer)));
if (layer_get_mask (layer))
size += channel_size (GIMP_CHANNEL (layer_get_mask (layer)));
return size;
}
......
......@@ -196,11 +196,11 @@ layer_invalidate_preview (GtkObject *object)
}
static void
transform_color (GImage * gimage,
PixelRegion * layerPR,
PixelRegion * bufPR,
GimpDrawable *drawable,
GimpImageBaseType type)
transform_color (GImage *gimage,
PixelRegion *layerPR,
PixelRegion *bufPR,
GimpDrawable *drawable,
GimpImageBaseType type)
{
int i, h;
unsigned char * s, * d;
......@@ -234,13 +234,13 @@ transform_color (GImage * gimage,
Layer *
layer_new (GimpImage* gimage,
int width,
int height,
GimpImageType type,
char * name,
int opacity,
LayerModeEffects mode)
layer_new (GimpImage *gimage,
gint width,
gint height,
GimpImageType type,
gchar *name,
gint opacity,
LayerModeEffects mode)
{
Layer * layer;
......@@ -297,9 +297,8 @@ layer_unref (Layer *layer)
Layer *
layer_copy (layer, add_alpha)
Layer * layer;
int add_alpha;
layer_copy (Layer *layer,
gint add_alpha)
{
char * layer_name;
Layer * new_layer;
......@@ -397,12 +396,12 @@ layer_copy (layer, add_alpha)
Layer *
layer_from_tiles (void *gimage_ptr,
GimpDrawable *drawable,
TileManager *tiles,
char *name,
int opacity,
LayerModeEffects mode)
layer_from_tiles (void *gimage_ptr,
GimpDrawable *drawable,
TileManager *tiles,
gchar *name,
gint opacity,
LayerModeEffects mode)
{
GImage * gimage;
Layer * new_layer;
......@@ -449,9 +448,8 @@ layer_from_tiles (void *gimage_ptr,
LayerMask *
layer_add_mask (layer, mask)
Layer * layer;
LayerMask * mask;
layer_add_mask (Layer *layer,
LayerMask *mask)
{
if (layer->mask)
return NULL;
......@@ -471,9 +469,8 @@ layer_add_mask (layer, mask)
LayerMask *
layer_create_mask (layer, add_mask_type)
Layer * layer;
AddMaskType add_mask_type;
layer_create_mask (Layer *layer,
AddMaskType add_mask_type)
{
PixelRegion maskPR, layerPR;
LayerMask *mask;
......@@ -516,8 +513,7 @@ layer_create_mask (layer, add_mask_type)
Layer *
layer_get_ID (ID)
int ID;
layer_get_ID (gint ID)
{
GimpDrawable *drawable;
drawable = drawable_get_ID (ID);
......@@ -529,7 +525,7 @@ layer_get_ID (ID)
void
layer_delete (Layer * layer)
layer_delete (Layer *layer)
{
gtk_object_unref (GTK_OBJECT (layer));
}
......@@ -569,7 +565,8 @@ gimp_layer_destroy (GtkObject *object)
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
layer_removed (Layer *layer, gpointer image)
layer_removed (Layer *layer,
gpointer image)
{
g_return_if_fail (layer != NULL);
g_return_if_fail (GIMP_IS_LAYER (layer));
......@@ -578,9 +575,8 @@ layer_removed (Layer *layer, gpointer image)
}
void
layer_apply_mask (layer, mode)
Layer * layer;
int mode;
layer_apply_mask (Layer *layer,
gint mode)
{
PixelRegion srcPR, maskPR;
......@@ -620,13 +616,11 @@ layer_apply_mask (layer, mode)
}
}
static void
layer_translate_lowlevel (layer, off_x, off_y, temporary)
Layer * layer;
int off_x, off_y;
gboolean temporary;
layer_translate_lowlevel (Layer *layer,
gint off_x,
gint off_y,
gboolean temporary)
{
if (!temporary)
{
......@@ -666,28 +660,23 @@ layer_translate_lowlevel (layer, off_x, off_y, temporary)
void
layer_temporarily_translate (layer, off_x, off_y)
Layer * layer;
int off_x, off_y;
layer_temporarily_translate (Layer *layer,
gint off_x,
gint off_y)
{
layer_translate_lowlevel (layer, off_x, off_y, TRUE);
}
void
layer_translate (layer, off_x, off_y)
Layer * layer;
int off_x, off_y;
layer_translate (Layer *layer,
gint off_x,
gint off_y)
{
layer_translate_lowlevel (layer, off_x, off_y, FALSE);
}
void
layer_add_alpha (layer)
Layer *layer;
layer_add_alpha (Layer *layer)
{
PixelRegion srcPR, destPR;
TileManager *new_tiles;
......@@ -739,10 +728,10 @@ layer_add_alpha (layer)
void
layer_scale (layer, new_width, new_height, local_origin)
Layer *layer;
int new_width, new_height;
int local_origin;
layer_scale (Layer *layer,
gint new_width,
gint new_height,
gint local_origin)
{
PixelRegion srcPR, destPR;
TileManager *new_tiles;
......@@ -813,10 +802,11 @@ layer_scale (layer, new_width, new_height, local_origin)
void
layer_resize (layer, new_width, new_height, offx, offy)
Layer *layer;
int new_width, new_height;
int offx, offy;
layer_resize (Layer *layer,
gint new_width,
gint new_height,
gint offx,
gint offy)
{
PixelRegion srcPR, destPR;
TileManager *new_tiles;
......@@ -907,9 +897,8 @@ layer_resize (layer, new_width, new_height, offx, offy)
BoundSeg *
layer_boundary (layer, num_segs)
Layer *layer;
int *num_segs;
layer_boundary (Layer *layer,
gint *num_segs)
{
BoundSeg *new_segs;
......@@ -962,8 +951,7 @@ layer_boundary (layer, num_segs)
void
layer_invalidate_boundary (layer)
Layer *layer;
layer_invalidate_boundary (Layer *layer)
{
GImage *gimage;
Channel *mask;
......@@ -993,9 +981,9 @@ layer_invalidate_boundary (layer)
int
layer_pick_correlate (layer, x, y)
Layer *layer;
int x, y;
layer_pick_correlate (Layer *layer,
gint x,
gint y)
{
Tile *tile;
Tile *mask_tile;
......@@ -1048,34 +1036,33 @@ layer_pick_correlate (layer, x, y)
/* access functions */
void
layer_set_name (Layer *layer, char *name)
layer_set_name (Layer *layer,
gchar *name)
{
gimp_drawable_set_name(GIMP_DRAWABLE(layer), name);
gimp_drawable_set_name (GIMP_DRAWABLE (layer), name);
}
char *
gchar *
layer_get_name (Layer *layer)
{
return gimp_drawable_get_name(GIMP_DRAWABLE(layer));
return gimp_drawable_get_name (GIMP_DRAWABLE (layer));
}
unsigned char *
layer_data (Layer * layer)
guchar *
layer_data (Layer *layer)
{
return NULL;
}
LayerMask *
layer_mask (Layer * layer)
layer_get_mask (Layer *layer)
{
return layer->mask;
}
int
layer_has_alpha (Layer * layer)
layer_has_alpha (Layer *layer)
{
if (GIMP_DRAWABLE(layer)->type == RGBA_GIMAGE ||
GIMP_DRAWABLE(layer)->type == GRAYA_GIMAGE ||
......@@ -1085,7 +1072,6 @@ layer_has_alpha (Layer * layer)
return 0;
}
int
layer_is_floating_sel (Layer *layer)
{
......@@ -1103,8 +1089,8 @@ layer_linked (Layer *layer)
TempBuf *
layer_preview (Layer *layer,
int w,
int h)
gint w,
gint h)
{
GImage *gimage;
TempBuf *preview_buf;
......@@ -1174,9 +1160,9 @@ layer_preview (Layer *layer,
TempBuf *
layer_mask_preview (layer, w, h)
Layer *layer;
int w, h;
layer_mask_preview (Layer *layer,
gint w,
gint h)
{
TempBuf *preview_buf;
LayerMask *mask;
......@@ -1226,9 +1212,9 @@ layer_mask_preview (layer, w, h)
}
Tattoo
layer_get_tattoo(const Layer *layer)
layer_get_tattoo (const Layer *layer)
{
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(layer)));
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer)));
}
void
......@@ -1251,12 +1237,11 @@ layer_invalidate_previews (GimpImage* gimage)
static void
layer_preview_scale (type, cmap, srcPR, destPR, subsample)
int type;
unsigned char *cmap;
PixelRegion *srcPR;
PixelRegion *destPR;
int subsample;
layer_preview_scale (gint type,
guchar *cmap,
PixelRegion *srcPR,
PixelRegion *destPR,
gint subsample)
{
#define EPSILON 0.000001
unsigned char * src, * s;
......@@ -1438,8 +1423,12 @@ gimp_layer_mask_destroy (GtkObject *object)
}
LayerMask *
layer_mask_new (GimpImage* gimage, int width, int height, char *name, int opacity,
unsigned char *col)
layer_mask_new (GimpImage *gimage,
gint width,
gint height,
gchar *name,
gint opacity,
guchar *col)
{
LayerMask * layer_mask;
int i;
......@@ -1507,7 +1496,7 @@ layer_mask_copy (LayerMask *layer_mask)
LayerMask *
layer_mask_get_ID (int ID)
layer_mask_get_ID (gint ID)
{
GimpDrawable *drawable;
drawable = drawable_get_ID (ID);
......@@ -1518,7 +1507,7 @@ layer_mask_get_ID (int ID)
}
void
layer_mask_delete (LayerMask * layermask)
layer_mask_delete (LayerMask *layermask)
{
gtk_object_unref (GTK_OBJECT (layermask));
}
......@@ -1539,7 +1528,8 @@ layer_mask_unref (LayerMask *mask)
}
void
channel_layer_mask (Channel *mask, Layer * layer)
channel_layer_mask (Channel *mask,
Layer *layer)
{
PixelRegion srcPR, destPR;
unsigned char empty = 0;
......
......@@ -115,7 +115,7 @@ void layer_mask_unref (LayerMask *);
void layer_set_name (Layer *, char *);
char * layer_get_name (Layer *);
unsigned char * layer_data (Layer *);
LayerMask * layer_mask (Layer *);
LayerMask * layer_get_mask (Layer *);
int layer_has_alpha (Layer *);
int layer_is_floating_sel (Layer *);
int layer_linked (Layer *);
......
......@@ -38,9 +38,9 @@ tool_options_toggle_update (GtkWidget *widget,
gpointer data)
{
GtkWidget *set_sensitive;
int *toggle_val;
gboolean *toggle_val;
toggle_val = (int *) data;
toggle_val = (gboolean *) data;
*toggle_val = (GTK_TOGGLE_BUTTON (widget)->active) ? TRUE : FALSE;
/* a tool options toggle button can set the sensitive state of
......@@ -70,9 +70,9 @@ void
tool_options_int_adjustment_update (GtkWidget *widget,
gpointer data)
{
int *val;
gint *val;
val = (int *) data;
val = (gint *) data;
*val = GTK_ADJUSTMENT (widget)->value;
}
......@@ -80,9 +80,9 @@ void
tool_options_double_adjustment_update (GtkWidget *widget,
gpointer data)
{
double *val;
gdouble *val;
val = (double *) data;
val = (gdouble *) data;
*val = GTK_ADJUSTMENT (widget)->value;
}
......@@ -112,7 +112,7 @@ tool_options_unitmenu_update (GtkWidget *widget,
{
GUnit *val;
GtkWidget *spinbutton;
int digits;
gint digits;
val = (GUnit *) data;
*val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
......@@ -134,14 +134,15 @@ static void
tool_options_radio_buttons_update (GtkWidget *widget,
gpointer data)
{
int *toggle_val;
gint *toggle_val;
toggle_val = (int *) data;
toggle_val = (gint *) data;
if (GTK_TOGGLE_BUTTON (widget)->active)
*toggle_val = (int) gtk_object_get_data (GTK_OBJECT (widget), "toggle_value");
*toggle_val = (gint) gtk_object_get_data (GTK_OBJECT (widget),
"toggle_value");
}
GtkWidget*
GtkWidget *
tool_options_radio_buttons_new (gchar* label,
gpointer toggle_val,
GtkWidget* button_widget[],
......@@ -154,7 +155,7 @@ tool_options_radio_buttons_new (gchar* label,
GSList *group = NULL;
gint i;
frame = gtk_frame_new (_(label));
frame = gtk_frame_new (label);
g_return_val_if_fail (toggle_val != NULL, frame);
......@@ -164,8 +165,8 @@ tool_options_radio_buttons_new (gchar* label,
for (i=0; i<num; i++)
{
button_widget[i] = gtk_radio_button_new_with_label (group,
gettext (button_label[i]));
button_widget[i] =
gtk_radio_button_new_with_label (group, gettext (button_label[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button_widget[i]));
gtk_box_pack_start (GTK_BOX (vbox), button_widget[i], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button_widget[i]), "toggled",
......@@ -189,7 +190,7 @@ tool_options_init (ToolOptions *options,
ToolOptionsResetFunc reset_func)
{
options->main_vbox = gtk_vbox_new (FALSE, 2);
options->title = _(title);
options->title = title;
options->reset_func = reset_func;
}
......@@ -576,9 +577,12 @@ paint_options_init (PaintOptions *options,
reset_func);
/* initialize the paint options structure */
options->global = NULL;
options->opacity_w = NULL;
options->paint_mode_w = NULL;
options->incremental = options->incremental_d = FALSE;
options->global = NULL;
options->opacity_w = NULL;
options->paint_mode_w = NULL;
options->incremental_w = NULL;
/* the main vbox */
vbox = gtk_vbox_new (FALSE, 2);
......@@ -659,17 +663,72 @@ paint_options_init (PaintOptions *options,
/* show the main table */
gtk_widget_show (table);
/* a separator after the common paint options */
if (tool_type != PENCIL)
/* a separator after the common paint options which can be global */
switch (tool_type)
{
case BUCKET_FILL:
case BLEND:
case CLONE:
case CONVOLVE:
case INK:
case DODGEBURN:
case SMUDGE:
case PIXMAPBRUSH:
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
gtk_widget_show (separator);
break;
case AIRBRUSH:
case ERASER:
case PAINTBRUSH:
case PENCIL:
break;
default:
break;
}
if (! global_paint_options)
gtk_widget_show (vbox);
/* the "incremental" toggle */
switch (tool_type)
{
case AIRBRUSH:
case ERASER:
case PAINTBRUSH:
case PENCIL:
options->incremental_w =
gtk_check_button_new_with_label (_("Incremental"));
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->incremental_w, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->incremental);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
gtk_widget_show (options->incremental_w);
/* a separator after the common paint options which can't be global */
if (tool_type != PENCIL)
{
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
separator, FALSE, FALSE, 0);
gtk_widget_show (separator);
}
break;
case BUCKET_FILL:
case BLEND:
case CLONE:
case CONVOLVE:
case DODGEBURN:
case SMUDGE:
case PIXMAPBRUSH:
break;
default:
break;
}
/* register this Paintoptions structure */