DND cleanup part 1:
2002-09-02 Michael Natterer <mitch@gimp.org> DND cleanup part 1: * app/widgets/gimpdnd.[ch]: changed all gimp_dnd_*_dest_set() and _unset() functions to _dest_add() and _dest_remove(). Switch from using static arrays of GtkTargetEntries to dynamic GtkTargetLists. The _add() and _remove() functions configure the drag dest automatically if not already done, so there is no need to call gtk_drag_dest_set() on the widget any more. Drag source cleanup will follow... Renamed silly function names gimp_gtk_* to gimp_dnd_* * app/display/gimpdisplayshell.c * app/tools/gimpblendtool.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimplistitem.c * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimpselectioneditor.c * app/widgets/gimptoolbox-color-area.c * app/widgets/gimptoolbox-indicator-area.c * app/widgets/gimptoolbox.c * app/gui/about-dialog.c * app/gui/color-select.c * app/gui/device-status-dialog.c * app/gui/tool-options-dialog.c: changed accordingly. Removed all calls to gtk_drag_dest_set() and their GtkTargetEntry tables. * app/widgets/gimpchannellistitem.c: enabled some commented out dnd code (which will not work since dnd needs more love...) * app/widgets/gimpitemlistview.[ch]: added a third "gboolean interactive" parameter to GimpItemNewFunc. * app/gui/channels-commands.[ch] * app/gui/layers-commands.[ch] * app/gui/vectors-commands.[ch]: if the new_item_func is called with "interactive == FALSE", don't pop up a dialog but silently create a new item of the image's size. * app/widgets/gimpdrawablelistview.c: use the new feature to allow color and pattern drops to the "New" button, which creates a new layer/channel filled with the color/pattern. (special feature for drc ;-) * app/widgets/gimppaletteeditor.c: fixed event handling so we see the context menu again. Also, don't redraw on "expose", since GtkPreview does that for us.
This commit is contained in:

committed by
Michael Natterer

parent
e6a9cc4de1
commit
c5d4b7020b
@ -181,7 +181,7 @@ layers_new_cmd_callback (GtkWidget *widget,
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
|
||||
layers_new_layer_query (gimage, NULL);
|
||||
layers_new_layer_query (gimage, NULL, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -514,7 +514,8 @@ new_layer_query_ok_callback (GtkWidget *widget,
|
||||
|
||||
void
|
||||
layers_new_layer_query (GimpImage *gimage,
|
||||
GimpLayer *template)
|
||||
GimpLayer *template,
|
||||
gboolean interactive)
|
||||
{
|
||||
NewLayerOptions *options;
|
||||
GimpLayer *floating_sel;
|
||||
@ -539,15 +540,31 @@ layers_new_layer_query (GimpImage *gimage,
|
||||
return;
|
||||
}
|
||||
|
||||
if (template)
|
||||
if (template || ! interactive)
|
||||
{
|
||||
GimpLayer *new_layer;
|
||||
gint width, height;
|
||||
gint off_x, off_y;
|
||||
GimpLayer *new_layer;
|
||||
gint width, height;
|
||||
gint off_x, off_y;
|
||||
gdouble opacity;
|
||||
GimpLayerModeEffects mode;
|
||||
|
||||
width = gimp_drawable_width (GIMP_DRAWABLE (template));
|
||||
height = gimp_drawable_height (GIMP_DRAWABLE (template));
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
|
||||
if (template)
|
||||
{
|
||||
width = gimp_drawable_width (GIMP_DRAWABLE (template));
|
||||
height = gimp_drawable_height (GIMP_DRAWABLE (template));
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
|
||||
opacity = template->opacity;
|
||||
mode = template->mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gimp_image_get_width (gimage);
|
||||
height = gimp_image_get_height (gimage);
|
||||
off_x = 0;
|
||||
off_y = 0;
|
||||
opacity = 1.0;
|
||||
mode = GIMP_NORMAL_MODE;
|
||||
}
|
||||
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO_GROUP);
|
||||
|
||||
@ -556,18 +573,20 @@ layers_new_layer_query (GimpImage *gimage,
|
||||
height,
|
||||
gimp_image_base_type_with_alpha (gimage),
|
||||
_("Empty Layer Copy"),
|
||||
template->opacity,
|
||||
template->mode);
|
||||
opacity,
|
||||
mode);
|
||||
|
||||
if (template)
|
||||
{
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer),
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
GIMP_TRANSPARENT_FILL);
|
||||
gimp_layer_translate (new_layer, off_x, off_y);
|
||||
}
|
||||
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer),
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
GIMP_TRANSPARENT_FILL);
|
||||
gimp_layer_translate (new_layer, off_x, off_y);
|
||||
gimp_image_add_layer (gimage, new_layer, -1);
|
||||
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
gimp_image_flush (gimage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user