Commit 87d7965c authored by Garry R. Osgood's avatar Garry R. Osgood Committed by Garry R. Osgood

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()
parent 6e83e1ba
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.
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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))
{
lw = (LayerWidget *) list->data;
lw->visited = FALSE;
}
/* Add any missing layers */
for (list = gimage->layers; list; list = g_slist_next (list))
else
{
layer = (Layer *) list->data;
lw = layer_widget_get_ID (layer);
/* 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;
}
/* 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;
}
/* Add any missing layers */
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
lw = layer_widget_get_ID (layer);
/* 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);
}
/* 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;
}
/* 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++);
}
/* 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);
}
/* Set the active layer */
if (layersD->active_layer != gimage->active_layer)
layersD->active_layer = gimage->active_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 channel */
if (layersD->active_channel != gimage->active_channel)
layersD->active_channel = gimage->active_channel;
/* Set the active layer */
if (layersD->active_layer != gimage->active_layer)
layersD->active_layer = gimage->active_layer;
/* set the menus if floating sel status has changed */
if (layersD->floating_sel != gimage->floating_sel)
layersD->floating_sel = gimage->floating_sel;
/* Set the active channel */
if (layersD->active_channel != gimage->active_channel)
layersD->active_channel = gimage->active_channel;
layers_dialog_set_menu_sensitivity ();
/* set the menus if floating sel status has changed */
if (layersD->floating_sel != gimage->floating_sel)
layersD->floating_sel = gimage->floating_sel;
gtk_container_foreach (GTK_CONTAINER (layersD->layer_list),
layer_widget_layer_flush, NULL);
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);
}
......
......@@ -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))
{
lw = (LayerWidget *) list->data;
lw->visited = FALSE;
}
/* Add any missing layers */
for (list = gimage->layers; list; list = g_slist_next (list))
else
{
layer = (Layer *) list->data;
lw = layer_widget_get_ID (layer);
/* 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;
}
/* 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;
}
/* Add any missing layers */
for (list = gimage->layers; list; list = g_slist_next (list))
{
layer = (Layer *) list->data;
lw = layer_widget_get_ID (layer);
/* 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);
}
/* 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;
}
/* 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++);
}
/* 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);
}
/* Set the active layer */
if (layersD->active_layer != gimage->active_layer)
layersD->active_layer = gimage->active_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 channel */
if (layersD->active_channel != gimage->active_channel)
layersD->active_channel = gimage->active_channel;
/* Set the active layer */
if (layersD->active_layer != gimage->active_layer)
layersD->active_layer = gimage->active_layer;
/* set the menus if floating sel status has changed */
if (layersD->floating_sel != gimage->floating_sel)
layersD->floating_sel = gimage->floating_sel;
/* Set the active channel */
if (layersD->active_channel != gimage->active_channel)
layersD->active_channel = gimage->active_channel;
layers_dialog_set_menu_sensitivity ();
/* set the menus if floating sel status has changed */
if (layersD->floating_sel != gimage->floating_sel)
layersD->floating_sel = gimage->floating_sel;
gtk_container_foreach (GTK_CONTAINER (layersD->layer_list),
layer_widget_layer_flush, NULL);
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment