app/layers_dialog.c layers_dialog_flush() now has only one entry and exit

2000-01-15  Garry R. Osgood <gosgood@idt.net>
* app/layers_dialog.c
* app/global_edit.c
layers_dialog.c:layers_dialog_flush() now has
only one entry and exit point, so that
suspend_gimage_notify is properly maintained.
Has bearing on (but likely does not fully solve)
bugs #4031, #4914, and #4927. see
http://idt.net/~gosgood/gimp-patch/patch04.html
and bug reports.
global_edit.c: edit_paste_as_new() now checks
if it has a valid layer from layer_new_from_tiles()
This commit is contained in:
Garry R. Osgood 2000-01-15 16:32:02 +00:00 committed by Garry R. Osgood
parent 6e83e1ba0a
commit 87d7965c22
6 changed files with 164 additions and 147 deletions

View File

@ -1,3 +1,18 @@
2000-01-15 Garry R. Osgood <gosgood@idt.net>
* app/layers_dialog.c
* app/global_edit.c
layers_dialog.c:layers_dialog_flush() now has
only one entry and exit point, so that
suspend_gimage_notify is properly maintained.
Has bearing on (but likely does not fully solve)
bugs #4031, #4914, and #4927. (Layers and
Channel Dialog with sticky layers. See
http://idt.net/~gosgood/gimp-patch/patch04.html
and bug reports.
global_edit.c: edit_paste_as_new() now checks
if it has a valid layer from layer_new_from_tiles()
2000-01-15 Michael Natterer <mitch@gimp.org>
* libgimp/gimpwidgets.[ch]: added a float adjustment callback.

View File

@ -358,16 +358,20 @@ edit_paste_as_new (GImage *invoke,
layer = layer_new_from_tiles (gimage, gimp_image_base_type_with_alpha (gimage), paste,
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
/* add the new layer to the image */
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
gimage_add_layer (gimage, layer, 0);
if(layer)
{
/* add the new layer to the image */
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
gimage_add_layer (gimage, layer, 0);
gimage_enable_undo (gimage);
gimage_enable_undo (gimage);
gdisp = gdisplay_new (gimage, 0x0101);
gimp_context_set_display (gimp_context_get_user (), gdisp);
gdisp = gdisplay_new (gimage, 0x0101);
gimp_context_set_display (gimp_context_get_user (), gdisp);
return TRUE;
return TRUE;
}
else return FALSE;
}
gboolean

View File

@ -358,16 +358,20 @@ edit_paste_as_new (GImage *invoke,
layer = layer_new_from_tiles (gimage, gimp_image_base_type_with_alpha (gimage), paste,
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
/* add the new layer to the image */
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
gimage_add_layer (gimage, layer, 0);
if(layer)
{
/* add the new layer to the image */
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
gimage_add_layer (gimage, layer, 0);
gimage_enable_undo (gimage);
gimage_enable_undo (gimage);
gdisp = gdisplay_new (gimage, 0x0101);
gimp_context_set_display (gimp_context_get_user (), gdisp);
gdisp = gdisplay_new (gimage, 0x0101);
gimp_context_set_display (gimp_context_get_user (), gdisp);
return TRUE;
return TRUE;
}
else return FALSE;
}
gboolean

View File

@ -358,16 +358,20 @@ edit_paste_as_new (GImage *invoke,
layer = layer_new_from_tiles (gimage, gimp_image_base_type_with_alpha (gimage), paste,
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
/* add the new layer to the image */
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
gimage_add_layer (gimage, layer, 0);
if(layer)
{
/* add the new layer to the image */
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
gimage_add_layer (gimage, layer, 0);
gimage_enable_undo (gimage);
gimage_enable_undo (gimage);
gdisp = gdisplay_new (gimage, 0x0101);
gimp_context_set_display (gimp_context_get_user (), gdisp);
gdisp = gdisplay_new (gimage, 0x0101);
gimp_context_set_display (gimp_context_get_user (), gdisp);
return TRUE;
return TRUE;
}
else return FALSE;
}
gboolean

View File

@ -607,68 +607,67 @@ layers_dialog_flush (void)
{
layersD->gimage = NULL;
layers_dialog_update (gimage);
return;
}
/* Set all current layer widgets to visited = FALSE */
for (list = layersD->layer_widgets; list; list = g_slist_next (list))
else
{
lw = (LayerWidget *) list->data;
lw->visited = FALSE;
/* Set all current layer widgets to visited = FALSE */
for (list = layersD->layer_widgets; list; list = g_slist_next (list))
{
lw = (LayerWidget *) list->data;
lw->visited = FALSE;
}
/* Add any missing layers */
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
lw = layer_widget_get_ID (layer);
/* If the layer isn't in the layer widget list, add it */
if (lw == NULL)
{
/* sets visited = TRUE */
layers_dialog_add_layer (layer);
}
else
lw->visited = TRUE;
}
/* Remove any extraneous layers */
list = layersD->layer_widgets;
while (list)
{
lw = (LayerWidget *) list->data;
list = g_slist_next (list);
if (lw->visited == FALSE)
layers_dialog_remove_layer (lw->layer);
}
/* Switch positions of items if necessary */
pos = 0;
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
layers_dialog_position_layer (layer, pos++);
}
/* Set the active layer */
if (layersD->active_layer != gimage->active_layer)
layersD->active_layer = gimage->active_layer;
/* Set the active channel */
if (layersD->active_channel != gimage->active_channel)
layersD->active_channel = gimage->active_channel;
/* set the menus if floating sel status has changed */
if (layersD->floating_sel != gimage->floating_sel)
layersD->floating_sel = gimage->floating_sel;
layers_dialog_set_menu_sensitivity ();
gtk_container_foreach (GTK_CONTAINER (layersD->layer_list),
layer_widget_layer_flush, NULL);
}
/* Add any missing layers */
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
lw = layer_widget_get_ID (layer);
/* If the layer isn't in the layer widget list, add it */
if (lw == NULL)
{
/* sets visited = TRUE */
layers_dialog_add_layer (layer);
}
else
lw->visited = TRUE;
}
/* Remove any extraneous layers */
list = layersD->layer_widgets;
while (list)
{
lw = (LayerWidget *) list->data;
list = g_slist_next (list);
if (lw->visited == FALSE)
layers_dialog_remove_layer (lw->layer);
}
/* Switch positions of items if necessary */
pos = 0;
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
layers_dialog_position_layer (layer, pos++);
}
/* Set the active layer */
if (layersD->active_layer != gimage->active_layer)
layersD->active_layer = gimage->active_layer;
/* Set the active channel */
if (layersD->active_channel != gimage->active_channel)
layersD->active_channel = gimage->active_channel;
/* set the menus if floating sel status has changed */
if (layersD->floating_sel != gimage->floating_sel)
layersD->floating_sel = gimage->floating_sel;
layers_dialog_set_menu_sensitivity ();
gtk_container_foreach (GTK_CONTAINER (layersD->layer_list),
layer_widget_layer_flush, NULL);
suspend_gimage_notify--;
}
@ -3638,12 +3637,8 @@ layers_dialog_add_mask_query (Layer *layer)
(gpointer) ADD_BLACK_MASK, NULL,
_("Layer's Alpha Channel"),
(gpointer) ADD_ALPHA_MASK, NULL,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}

View File

@ -607,68 +607,67 @@ layers_dialog_flush (void)
{
layersD->gimage = NULL;
layers_dialog_update (gimage);
return;
}
/* Set all current layer widgets to visited = FALSE */
for (list = layersD->layer_widgets; list; list = g_slist_next (list))
else
{
lw = (LayerWidget *) list->data;
lw->visited = FALSE;
/* Set all current layer widgets to visited = FALSE */
for (list = layersD->layer_widgets; list; list = g_slist_next (list))
{
lw = (LayerWidget *) list->data;
lw->visited = FALSE;
}
/* Add any missing layers */
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
lw = layer_widget_get_ID (layer);
/* If the layer isn't in the layer widget list, add it */
if (lw == NULL)
{
/* sets visited = TRUE */
layers_dialog_add_layer (layer);
}
else
lw->visited = TRUE;
}
/* Remove any extraneous layers */
list = layersD->layer_widgets;
while (list)
{
lw = (LayerWidget *) list->data;
list = g_slist_next (list);
if (lw->visited == FALSE)
layers_dialog_remove_layer (lw->layer);
}
/* Switch positions of items if necessary */
pos = 0;
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
layers_dialog_position_layer (layer, pos++);
}
/* Set the active layer */
if (layersD->active_layer != gimage->active_layer)
layersD->active_layer = gimage->active_layer;
/* Set the active channel */
if (layersD->active_channel != gimage->active_channel)
layersD->active_channel = gimage->active_channel;
/* set the menus if floating sel status has changed */
if (layersD->floating_sel != gimage->floating_sel)
layersD->floating_sel = gimage->floating_sel;
layers_dialog_set_menu_sensitivity ();
gtk_container_foreach (GTK_CONTAINER (layersD->layer_list),
layer_widget_layer_flush, NULL);
}
/* Add any missing layers */
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
lw = layer_widget_get_ID (layer);
/* If the layer isn't in the layer widget list, add it */
if (lw == NULL)
{
/* sets visited = TRUE */
layers_dialog_add_layer (layer);
}
else
lw->visited = TRUE;
}
/* Remove any extraneous layers */
list = layersD->layer_widgets;
while (list)
{
lw = (LayerWidget *) list->data;
list = g_slist_next (list);
if (lw->visited == FALSE)
layers_dialog_remove_layer (lw->layer);
}
/* Switch positions of items if necessary */
pos = 0;
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
layers_dialog_position_layer (layer, pos++);
}
/* Set the active layer */
if (layersD->active_layer != gimage->active_layer)
layersD->active_layer = gimage->active_layer;
/* Set the active channel */
if (layersD->active_channel != gimage->active_channel)
layersD->active_channel = gimage->active_channel;
/* set the menus if floating sel status has changed */
if (layersD->floating_sel != gimage->floating_sel)
layersD->floating_sel = gimage->floating_sel;
layers_dialog_set_menu_sensitivity ();
gtk_container_foreach (GTK_CONTAINER (layersD->layer_list),
layer_widget_layer_flush, NULL);
suspend_gimage_notify--;
}
@ -3638,12 +3637,8 @@ layers_dialog_add_mask_query (Layer *layer)
(gpointer) ADD_BLACK_MASK, NULL,
_("Layer's Alpha Channel"),
(gpointer) ADD_ALPHA_MASK, NULL,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}