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

removed prototype of function which doesn't exist.

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

	* app/gimpimage.h: removed prototype of function which doesn't
	exist.

	* app/widgets/gimppreview.[ch]: new signal "extended_clicked"
	which is emitted instead of "clicked" if the user pressed shift,
	control or mod1 on button_press.

	* app/widgets/gimplayerlistitem.c: use the "extended_clicked"
	signal to toggle the layer mask's "show" and "apply" states.
parent a2530f59
2001-05-01 Michael Natterer <mitch@gimp.org>
* app/gimpimage.h: removed prototype of function which doesn't
exist.
* app/widgets/gimppreview.[ch]: new signal "extended_clicked"
which is emitted instead of "clicked" if the user pressed shift,
control or mod1 on button_press.
* app/widgets/gimplayerlistitem.c: use the "extended_clicked"
signal to toggle the layer mask's "show" and "apply" states.
2001-05-01 Michael Natterer <mitch@gimp.org>
* app/gimpdnd.[ch]: Made file/url DND work like the other DND types.
......
......@@ -450,9 +450,7 @@ TileManager * gimp_image_composite (GimpImage *gimage);
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
gint gimp_image_composite_bytes (const GimpImage *gimage);
gint gimp_image_preview_valid (const GimpImage *gimage);
void gimp_image_invalidate_previews (void);
gboolean gimp_image_preview_valid (const GimpImage *gimage);
#endif /* __GIMP_IMAGE_H__ */
......@@ -450,9 +450,7 @@ TileManager * gimp_image_composite (GimpImage *gimage);
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
gint gimp_image_composite_bytes (const GimpImage *gimage);
gint gimp_image_preview_valid (const GimpImage *gimage);
void gimp_image_invalidate_previews (void);
gboolean gimp_image_preview_valid (const GimpImage *gimage);
#endif /* __GIMP_IMAGE_H__ */
......@@ -450,9 +450,7 @@ TileManager * gimp_image_composite (GimpImage *gimage);
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
gint gimp_image_composite_bytes (const GimpImage *gimage);
gint gimp_image_preview_valid (const GimpImage *gimage);
void gimp_image_invalidate_previews (void);
gboolean gimp_image_preview_valid (const GimpImage *gimage);
#endif /* __GIMP_IMAGE_H__ */
......@@ -450,9 +450,7 @@ TileManager * gimp_image_composite (GimpImage *gimage);
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
gint gimp_image_composite_bytes (const GimpImage *gimage);
gint gimp_image_preview_valid (const GimpImage *gimage);
void gimp_image_invalidate_previews (void);
gboolean gimp_image_preview_valid (const GimpImage *gimage);
#endif /* __GIMP_IMAGE_H__ */
......@@ -450,9 +450,7 @@ TileManager * gimp_image_composite (GimpImage *gimage);
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
gint gimp_image_composite_bytes (const GimpImage *gimage);
gint gimp_image_preview_valid (const GimpImage *gimage);
void gimp_image_invalidate_previews (void);
gboolean gimp_image_preview_valid (const GimpImage *gimage);
#endif /* __GIMP_IMAGE_H__ */
......@@ -450,9 +450,7 @@ TileManager * gimp_image_composite (GimpImage *gimage);
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
gint gimp_image_composite_bytes (const GimpImage *gimage);
gint gimp_image_preview_valid (const GimpImage *gimage);
void gimp_image_invalidate_previews (void);
gboolean gimp_image_preview_valid (const GimpImage *gimage);
#endif /* __GIMP_IMAGE_H__ */
......@@ -450,9 +450,7 @@ TileManager * gimp_image_composite (GimpImage *gimage);
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
gint gimp_image_composite_bytes (const GimpImage *gimage);
gint gimp_image_preview_valid (const GimpImage *gimage);
void gimp_image_invalidate_previews (void);
gboolean gimp_image_preview_valid (const GimpImage *gimage);
#endif /* __GIMP_IMAGE_H__ */
......@@ -450,9 +450,7 @@ TileManager * gimp_image_composite (GimpImage *gimage);
GimpImageType gimp_image_composite_type (const GimpImage *gimage);
gint gimp_image_composite_bytes (const GimpImage *gimage);
gint gimp_image_preview_valid (const GimpImage *gimage);
void gimp_image_invalidate_previews (void);
gboolean gimp_image_preview_valid (const GimpImage *gimage);
#endif /* __GIMP_IMAGE_H__ */
......@@ -75,6 +75,10 @@ static void gimp_layer_list_item_layer_clicked (GtkWidget *widget,
GimpLayer *layer);
static void gimp_layer_list_item_mask_clicked (GtkWidget *widget,
GimpLayerMask *mask);
static void gimp_layer_list_item_mask_extended_clicked
(GtkWidget *widget,
guint state,
GimpLayerMask *mask);
static GimpDrawableListItemClass *parent_class = NULL;
......@@ -431,6 +435,9 @@ gimp_layer_list_item_mask_changed (GimpLayer *layer,
gtk_signal_connect (GTK_OBJECT (layer_item->mask_preview), "clicked",
GTK_SIGNAL_FUNC (gimp_layer_list_item_mask_clicked),
mask);
gtk_signal_connect (GTK_OBJECT (layer_item->mask_preview), "extended_clicked",
GTK_SIGNAL_FUNC (gimp_layer_list_item_mask_extended_clicked),
mask);
gtk_signal_connect_object
(GTK_OBJECT (mask), "apply_changed",
......@@ -464,32 +471,48 @@ gimp_layer_list_item_update_state (GtkWidget *widget)
GimpLayer *layer;
GimpLayerMask *mask;
GimpPreview *preview;
GimpRGB *layer_color = &black_color;
GimpRGB *mask_color = &black_color;
GimpRGB *layer_color;
GimpRGB *mask_color;
GimpRGB bg_color;
gimp_rgb_set_uchar (&bg_color,
widget->style->base[widget->state].red >> 8,
widget->style->base[widget->state].green >> 8,
widget->style->base[widget->state].blue >> 8);
layer_color = &bg_color;
mask_color = &bg_color;
layer_item = GIMP_LAYER_LIST_ITEM (widget);
list_item = GIMP_LIST_ITEM (widget);
layer = GIMP_LAYER (GIMP_PREVIEW (list_item->preview)->viewable);
mask = gimp_layer_get_mask (layer);
switch (widget->state)
if (! mask || (mask && ! gimp_layer_mask_get_edit (mask)))
{
case GTK_STATE_NORMAL:
break;
case GTK_STATE_SELECTED:
if (! mask || (mask && ! gimp_layer_mask_get_edit (mask)))
{
layer_color = &white_color;
}
if (widget->state == GTK_STATE_SELECTED)
layer_color = &white_color;
else
{
mask_color = &white_color;
}
break;
layer_color = &black_color;
}
default:
g_print ("%s(): unhandled state\n", G_GNUC_FUNCTION);
if (mask)
{
if (gimp_layer_mask_get_show (mask))
{
mask_color = &green_color;
}
else if (! gimp_layer_mask_get_apply (mask))
{
mask_color = &red_color;
}
else if (gimp_layer_mask_get_edit (mask))
{
if (widget->state == GTK_STATE_SELECTED)
mask_color = &white_color;
else
mask_color = &black_color;
}
}
preview = GIMP_PREVIEW (list_item->preview);
......@@ -510,8 +533,6 @@ gimp_layer_list_item_layer_clicked (GtkWidget *widget,
{
GimpLayerMask *mask;
g_print ("layer clicked\n");
mask = gimp_layer_get_mask (layer);
if (mask)
......@@ -525,8 +546,21 @@ static void
gimp_layer_list_item_mask_clicked (GtkWidget *widget,
GimpLayerMask *mask)
{
g_print ("mask clicked\n");
if (! gimp_layer_mask_get_edit (mask))
gimp_layer_mask_set_edit (mask, TRUE);
}
static void
gimp_layer_list_item_mask_extended_clicked (GtkWidget *widget,
guint state,
GimpLayerMask *mask)
{
if (state & GDK_MOD1_MASK)
{
gimp_layer_mask_set_show (mask, ! gimp_layer_mask_get_show (mask));
}
else if (state & GDK_CONTROL_MASK)
{
gimp_layer_mask_set_apply (mask, ! gimp_layer_mask_get_apply (mask));
}
}
......@@ -66,6 +66,7 @@ enum
{
CLICKED,
DOUBLE_CLICKED,
EXTENDED_CLICKED,
RENDER,
GET_SIZE,
NEEDS_POPUP,
......@@ -171,6 +172,16 @@ gimp_preview_class_init (GimpPreviewClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
preview_signals[EXTENDED_CLICKED] =
gtk_signal_new ("extended_clicked",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpPreviewClass,
extended_clicked),
gtk_marshal_NONE__UINT,
GTK_TYPE_NONE, 1,
GTK_TYPE_UINT);
preview_signals[RENDER] =
gtk_signal_new ("render",
GTK_RUN_LAST,
......@@ -220,12 +231,13 @@ gimp_preview_class_init (GimpPreviewClass *klass)
widget_class->enter_notify_event = gimp_preview_enter_notify_event;
widget_class->leave_notify_event = gimp_preview_leave_notify_event;
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->render = gimp_preview_real_render;
klass->get_size = gimp_preview_real_get_size;
klass->needs_popup = gimp_preview_real_needs_popup;
klass->create_popup = gimp_preview_real_create_popup;
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->extended_clicked = NULL;
klass->render = gimp_preview_real_render;
klass->get_size = gimp_preview_real_get_size;
klass->needs_popup = gimp_preview_real_needs_popup;
klass->create_popup = gimp_preview_real_create_popup;
}
static void
......@@ -551,6 +563,8 @@ gimp_preview_button_press_event (GtkWidget *widget,
{
gtk_grab_add (widget);
preview->press_state = bevent->state;
if (preview->show_popup && gimp_preview_needs_popup (preview))
{
gimp_preview_popup_show (preview,
......@@ -601,7 +615,17 @@ gimp_preview_button_release_event (GtkWidget *widget,
if (preview->clickable && click && preview->in_button)
{
gtk_signal_emit (GTK_OBJECT (widget), preview_signals[CLICKED]);
if (preview->press_state &
(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))
{
gtk_signal_emit (GTK_OBJECT (widget),
preview_signals[EXTENDED_CLICKED],
preview->press_state);
}
else
{
gtk_signal_emit (GTK_OBJECT (widget), preview_signals[CLICKED]);
}
}
}
else
......
......@@ -58,6 +58,7 @@ struct _GimpPreview
/*< private >*/
gboolean in_button;
guint press_state;
guint idle_id;
guint popup_id;
gint popup_x;
......@@ -68,15 +69,17 @@ struct _GimpPreviewClass
{
GtkPreviewClass parent_class;
void (* clicked) (GimpPreview *preview);
void (* double_clicked) (GimpPreview *preview);
void (* render) (GimpPreview *preview);
void (* get_size) (GimpPreview *preview,
gint size,
gint *width,
gint *height);
gboolean (* needs_popup) (GimpPreview *preview);
GtkWidget * (* create_popup) (GimpPreview *preview);
void (* clicked) (GimpPreview *preview);
void (* double_clicked) (GimpPreview *preview);
void (* extended_clicked) (GimpPreview *preview,
guint modifier_state);
void (* render) (GimpPreview *preview);
void (* get_size) (GimpPreview *preview,
gint size,
gint *width,
gint *height);
gboolean (* needs_popup) (GimpPreview *preview);
GtkWidget * (* create_popup) (GimpPreview *preview);
};
......
......@@ -66,6 +66,7 @@ enum
{
CLICKED,
DOUBLE_CLICKED,
EXTENDED_CLICKED,
RENDER,
GET_SIZE,
NEEDS_POPUP,
......@@ -171,6 +172,16 @@ gimp_preview_class_init (GimpPreviewClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
preview_signals[EXTENDED_CLICKED] =
gtk_signal_new ("extended_clicked",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpPreviewClass,
extended_clicked),
gtk_marshal_NONE__UINT,
GTK_TYPE_NONE, 1,
GTK_TYPE_UINT);
preview_signals[RENDER] =
gtk_signal_new ("render",
GTK_RUN_LAST,
......@@ -220,12 +231,13 @@ gimp_preview_class_init (GimpPreviewClass *klass)
widget_class->enter_notify_event = gimp_preview_enter_notify_event;
widget_class->leave_notify_event = gimp_preview_leave_notify_event;
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->render = gimp_preview_real_render;
klass->get_size = gimp_preview_real_get_size;
klass->needs_popup = gimp_preview_real_needs_popup;
klass->create_popup = gimp_preview_real_create_popup;
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->extended_clicked = NULL;
klass->render = gimp_preview_real_render;
klass->get_size = gimp_preview_real_get_size;
klass->needs_popup = gimp_preview_real_needs_popup;
klass->create_popup = gimp_preview_real_create_popup;
}
static void
......@@ -551,6 +563,8 @@ gimp_preview_button_press_event (GtkWidget *widget,
{
gtk_grab_add (widget);
preview->press_state = bevent->state;
if (preview->show_popup && gimp_preview_needs_popup (preview))
{
gimp_preview_popup_show (preview,
......@@ -601,7 +615,17 @@ gimp_preview_button_release_event (GtkWidget *widget,
if (preview->clickable && click && preview->in_button)
{
gtk_signal_emit (GTK_OBJECT (widget), preview_signals[CLICKED]);
if (preview->press_state &
(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))
{
gtk_signal_emit (GTK_OBJECT (widget),
preview_signals[EXTENDED_CLICKED],
preview->press_state);
}
else
{
gtk_signal_emit (GTK_OBJECT (widget), preview_signals[CLICKED]);
}
}
}
else
......
......@@ -58,6 +58,7 @@ struct _GimpPreview
/*< private >*/
gboolean in_button;
guint press_state;
guint idle_id;
guint popup_id;
gint popup_x;
......@@ -68,15 +69,17 @@ struct _GimpPreviewClass
{
GtkPreviewClass parent_class;
void (* clicked) (GimpPreview *preview);
void (* double_clicked) (GimpPreview *preview);
void (* render) (GimpPreview *preview);
void (* get_size) (GimpPreview *preview,
gint size,
gint *width,
gint *height);
gboolean (* needs_popup) (GimpPreview *preview);
GtkWidget * (* create_popup) (GimpPreview *preview);
void (* clicked) (GimpPreview *preview);
void (* double_clicked) (GimpPreview *preview);
void (* extended_clicked) (GimpPreview *preview,
guint modifier_state);
void (* render) (GimpPreview *preview);
void (* get_size) (GimpPreview *preview,
gint size,
gint *width,
gint *height);
gboolean (* needs_popup) (GimpPreview *preview);
GtkWidget * (* create_popup) (GimpPreview *preview);
};
......
......@@ -66,6 +66,7 @@ enum
{
CLICKED,
DOUBLE_CLICKED,
EXTENDED_CLICKED,
RENDER,
GET_SIZE,
NEEDS_POPUP,
......@@ -171,6 +172,16 @@ gimp_preview_class_init (GimpPreviewClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
preview_signals[EXTENDED_CLICKED] =
gtk_signal_new ("extended_clicked",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpPreviewClass,
extended_clicked),
gtk_marshal_NONE__UINT,
GTK_TYPE_NONE, 1,
GTK_TYPE_UINT);
preview_signals[RENDER] =
gtk_signal_new ("render",
GTK_RUN_LAST,
......@@ -220,12 +231,13 @@ gimp_preview_class_init (GimpPreviewClass *klass)
widget_class->enter_notify_event = gimp_preview_enter_notify_event;
widget_class->leave_notify_event = gimp_preview_leave_notify_event;
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->render = gimp_preview_real_render;
klass->get_size = gimp_preview_real_get_size;
klass->needs_popup = gimp_preview_real_needs_popup;
klass->create_popup = gimp_preview_real_create_popup;
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->extended_clicked = NULL;
klass->render = gimp_preview_real_render;
klass->get_size = gimp_preview_real_get_size;
klass->needs_popup = gimp_preview_real_needs_popup;
klass->create_popup = gimp_preview_real_create_popup;
}
static void
......@@ -551,6 +563,8 @@ gimp_preview_button_press_event (GtkWidget *widget,
{
gtk_grab_add (widget);
preview->press_state = bevent->state;
if (preview->show_popup && gimp_preview_needs_popup (preview))
{
gimp_preview_popup_show (preview,
......@@ -601,7 +615,17 @@ gimp_preview_button_release_event (GtkWidget *widget,
if (preview->clickable && click && preview->in_button)
{
gtk_signal_emit (GTK_OBJECT (widget), preview_signals[CLICKED]);
if (preview->press_state &
(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))
{
gtk_signal_emit (GTK_OBJECT (widget),
preview_signals[EXTENDED_CLICKED],
preview->press_state);
}
else
{
gtk_signal_emit (GTK_OBJECT (widget), preview_signals[CLICKED]);
}
}
}
else
......
......@@ -58,6 +58,7 @@ struct _GimpPreview
/*< private >*/
gboolean in_button;
guint press_state;
guint idle_id;
guint popup_id;
gint popup_x;
......@@ -68,15 +69,17 @@ struct _GimpPreviewClass
{
GtkPreviewClass parent_class;
void (* clicked) (GimpPreview *preview);
void (* double_clicked) (GimpPreview *preview);
void (* render) (GimpPreview *preview);
void (* get_size) (GimpPreview *preview,
gint size,
gint *width,
gint *height);
gboolean (* needs_popup) (GimpPreview *preview);
GtkWidget * (* create_popup) (GimpPreview *preview);
void (* clicked) (GimpPreview *preview);
void (* double_clicked) (GimpPreview *preview);
void (* extended_clicked) (GimpPreview *preview,
guint modifier_state);
void (* render) (GimpPreview *preview);
void (* get_size) (GimpPreview *preview,
gint size,
gint *width,
gint *height);
gboolean (* needs_popup) (GimpPreview *preview);
GtkWidget * (* create_popup) (GimpPreview *preview);
};
......
......@@ -66,6 +66,7 @@ enum
{
CLICKED,
DOUBLE_CLICKED,
EXTENDED_CLICKED,
RENDER,
GET_SIZE,
NEEDS_POPUP,
......@@ -171,6 +172,16 @@ gimp_preview_class_init (GimpPreviewClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
preview_signals[EXTENDED_CLICKED] =
gtk_signal_new ("extended_clicked",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpPreviewClass,
extended_clicked),
gtk_marshal_NONE__UINT,
GTK_TYPE_NONE, 1,
GTK_TYPE_UINT);
preview_signals[RENDER] =
gtk_signal_new ("render",
GTK_RUN_LAST,
......@@ -220,12 +231,13 @@ gimp_preview_class_init (GimpPreviewClass *klass)
widget_class->enter_notify_event = gimp_preview_enter_notify_event;
widget_class->leave_notify_event = gimp_preview_leave_notify_event;
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->render = gimp_preview_real_render;
klass->get_size = gimp_preview_real_get_size;
klass->needs_popup = gimp_preview_real_needs_popup;
klass->create_popup = gimp_preview_real_create_popup;
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->extended_clicked = NULL;
klass->render = gimp_preview_real_render;
klass->get_size = gimp_preview_real_get_size;
klass->needs_popup = gimp_preview_real_needs_popup;
klass->create_popup = gimp_preview_real_create_popup;
}
static void
......@@ -551,6 +563,8 @@ gimp_preview_button_press_event (GtkWidget *widget,
{
gtk_grab_add (widget);
preview->press_state = bevent->state;
if (preview->show_popup && gimp_preview_needs_popup (preview))
{
gimp_preview_popup_show (preview,
......@@ -601,7 +615,17 @@ gimp_preview_button_release_event (GtkWidget *widget,
if (preview->clickable && click && preview->in_button)
{
gtk_signal_emit (GTK_OBJECT (widget), preview_signals[CLICKED]);
if (preview->press_state &
(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))
{
gtk_signal_emit (GTK_OBJECT (widget),
preview_signals[EXTENDED_CLICKED],
preview->press_state);
}
else
{