Commit 7d362aad authored by GMT 1999 Adam D. Moss's avatar GMT 1999 Adam D. Moss Committed by Adam D. Moss

app/gimage_cmds.c app/gimpimage.c app/layers_dialog.c

Sun Jan 17 20:36:45 GMT 1999 Adam D. Moss <adam@gimp.org>

	* app/gimage_cmds.c app/gimpimage.c app/layers_dialog.c

	Guides are now duplicated upon image duplication.
	Guides are now scaled upon image scaling.
	Lowering, raising, and renaming a layer now correctly
	mark the image as dirty.
parent 9277932a
Sun Jan 17 20:36:45 GMT 1999 Adam D. Moss <adam@gimp.org>
* app/gimage_cmds.c app/gimpimage.c app/layers_dialog.c
Guides are now duplicated upon image duplication.
Guides are now scaled upon image scaling.
Lowering, raising, and renaming a layer now correctly
mark the image as dirty.
Sun Jan 17 18:28:58 GMT 1999 Adam D. Moss <adam@gimp.org>
* app/gdisplay.c app/paint_funcs.c: Fixed a thinko/bug
......
......@@ -410,6 +410,8 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
Layer *layer;
Layer *floating_layer;
GSList *list;
GList *glist;
Guide *guide;
int old_width, old_height;
int layer_width, layer_height;
......@@ -458,7 +460,25 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
list = g_slist_next (list);
}
#warning NEED TO SCALE GUIDES ALSO
/* Scale any Guides */
glist = gimage->guides;
while (glist)
{
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
guide->position = (guide->position * new_height) / old_height;
break;
case VERTICAL_GUIDE:
guide->position = (guide->position * new_width) / old_width;
break;
default:
g_error("Unknown guide orientation II.\n");
}
}
/* Make sure the projection matches the gimage size */
gimp_image_projection_realloc (gimage);
......@@ -1746,6 +1766,8 @@ gimp_image_raise_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return prev_layer;
}
else
......@@ -1818,6 +1840,8 @@ gimp_image_lower_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return next_layer;
}
else
......@@ -1896,6 +1920,8 @@ gimp_image_raise_layer_to_top (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer;
}
......@@ -1989,6 +2015,9 @@ gimp_image_lower_layer_to_bottom (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer_arg;
}
......
......@@ -410,6 +410,8 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
Layer *layer;
Layer *floating_layer;
GSList *list;
GList *glist;
Guide *guide;
int old_width, old_height;
int layer_width, layer_height;
......@@ -458,7 +460,25 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
list = g_slist_next (list);
}
#warning NEED TO SCALE GUIDES ALSO
/* Scale any Guides */
glist = gimage->guides;
while (glist)
{
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
guide->position = (guide->position * new_height) / old_height;
break;
case VERTICAL_GUIDE:
guide->position = (guide->position * new_width) / old_width;
break;
default:
g_error("Unknown guide orientation II.\n");
}
}
/* Make sure the projection matches the gimage size */
gimp_image_projection_realloc (gimage);
......@@ -1746,6 +1766,8 @@ gimp_image_raise_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return prev_layer;
}
else
......@@ -1818,6 +1840,8 @@ gimp_image_lower_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return next_layer;
}
else
......@@ -1896,6 +1920,8 @@ gimp_image_raise_layer_to_top (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer;
}
......@@ -1989,6 +2015,9 @@ gimp_image_lower_layer_to_bottom (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer_arg;
}
......
......@@ -410,6 +410,8 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
Layer *layer;
Layer *floating_layer;
GSList *list;
GList *glist;
Guide *guide;
int old_width, old_height;
int layer_width, layer_height;
......@@ -458,7 +460,25 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
list = g_slist_next (list);
}
#warning NEED TO SCALE GUIDES ALSO
/* Scale any Guides */
glist = gimage->guides;
while (glist)
{
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
guide->position = (guide->position * new_height) / old_height;
break;
case VERTICAL_GUIDE:
guide->position = (guide->position * new_width) / old_width;
break;
default:
g_error("Unknown guide orientation II.\n");
}
}
/* Make sure the projection matches the gimage size */
gimp_image_projection_realloc (gimage);
......@@ -1746,6 +1766,8 @@ gimp_image_raise_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return prev_layer;
}
else
......@@ -1818,6 +1840,8 @@ gimp_image_lower_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return next_layer;
}
else
......@@ -1896,6 +1920,8 @@ gimp_image_raise_layer_to_top (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer;
}
......@@ -1989,6 +2015,9 @@ gimp_image_lower_layer_to_bottom (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer_arg;
}
......
......@@ -410,6 +410,8 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
Layer *layer;
Layer *floating_layer;
GSList *list;
GList *glist;
Guide *guide;
int old_width, old_height;
int layer_width, layer_height;
......@@ -458,7 +460,25 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
list = g_slist_next (list);
}
#warning NEED TO SCALE GUIDES ALSO
/* Scale any Guides */
glist = gimage->guides;
while (glist)
{
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
guide->position = (guide->position * new_height) / old_height;
break;
case VERTICAL_GUIDE:
guide->position = (guide->position * new_width) / old_width;
break;
default:
g_error("Unknown guide orientation II.\n");
}
}
/* Make sure the projection matches the gimage size */
gimp_image_projection_realloc (gimage);
......@@ -1746,6 +1766,8 @@ gimp_image_raise_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return prev_layer;
}
else
......@@ -1818,6 +1840,8 @@ gimp_image_lower_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return next_layer;
}
else
......@@ -1896,6 +1920,8 @@ gimp_image_raise_layer_to_top (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer;
}
......@@ -1989,6 +2015,9 @@ gimp_image_lower_layer_to_bottom (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer_arg;
}
......
......@@ -410,6 +410,8 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
Layer *layer;
Layer *floating_layer;
GSList *list;
GList *glist;
Guide *guide;
int old_width, old_height;
int layer_width, layer_height;
......@@ -458,7 +460,25 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
list = g_slist_next (list);
}
#warning NEED TO SCALE GUIDES ALSO
/* Scale any Guides */
glist = gimage->guides;
while (glist)
{
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
guide->position = (guide->position * new_height) / old_height;
break;
case VERTICAL_GUIDE:
guide->position = (guide->position * new_width) / old_width;
break;
default:
g_error("Unknown guide orientation II.\n");
}
}
/* Make sure the projection matches the gimage size */
gimp_image_projection_realloc (gimage);
......@@ -1746,6 +1766,8 @@ gimp_image_raise_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return prev_layer;
}
else
......@@ -1818,6 +1840,8 @@ gimp_image_lower_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return next_layer;
}
else
......@@ -1896,6 +1920,8 @@ gimp_image_raise_layer_to_top (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer;
}
......@@ -1989,6 +2015,9 @@ gimp_image_lower_layer_to_bottom (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer_arg;
}
......
......@@ -410,6 +410,8 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
Layer *layer;
Layer *floating_layer;
GSList *list;
GList *glist;
Guide *guide;
int old_width, old_height;
int layer_width, layer_height;
......@@ -458,7 +460,25 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
list = g_slist_next (list);
}
#warning NEED TO SCALE GUIDES ALSO
/* Scale any Guides */
glist = gimage->guides;
while (glist)
{
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
guide->position = (guide->position * new_height) / old_height;
break;
case VERTICAL_GUIDE:
guide->position = (guide->position * new_width) / old_width;
break;
default:
g_error("Unknown guide orientation II.\n");
}
}
/* Make sure the projection matches the gimage size */
gimp_image_projection_realloc (gimage);
......@@ -1746,6 +1766,8 @@ gimp_image_raise_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return prev_layer;
}
else
......@@ -1818,6 +1840,8 @@ gimp_image_lower_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return next_layer;
}
else
......@@ -1896,6 +1920,8 @@ gimp_image_raise_layer_to_top (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer;
}
......@@ -1989,6 +2015,9 @@ gimp_image_lower_layer_to_bottom (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer_arg;
}
......
......@@ -410,6 +410,8 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
Layer *layer;
Layer *floating_layer;
GSList *list;
GList *glist;
Guide *guide;
int old_width, old_height;
int layer_width, layer_height;
......@@ -458,7 +460,25 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
list = g_slist_next (list);
}
#warning NEED TO SCALE GUIDES ALSO
/* Scale any Guides */
glist = gimage->guides;
while (glist)
{
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
guide->position = (guide->position * new_height) / old_height;
break;
case VERTICAL_GUIDE:
guide->position = (guide->position * new_width) / old_width;
break;
default:
g_error("Unknown guide orientation II.\n");
}
}
/* Make sure the projection matches the gimage size */
gimp_image_projection_realloc (gimage);
......@@ -1746,6 +1766,8 @@ gimp_image_raise_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return prev_layer;
}
else
......@@ -1818,6 +1840,8 @@ gimp_image_lower_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return next_layer;
}
else
......@@ -1896,6 +1920,8 @@ gimp_image_raise_layer_to_top (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer;
}
......@@ -1989,6 +2015,9 @@ gimp_image_lower_layer_to_bottom (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer_arg;
}
......
......@@ -3708,6 +3708,8 @@ duplicate (GImage *gimage)
Layer *floating_layer;
Channel *channel, *new_channel;
GSList *list;
GList *glist;
Guide *guide = NULL;
Layer *active_layer = NULL;
Channel *active_channel = NULL;
GimpDrawable *new_floating_sel_drawable = NULL;
......@@ -3818,7 +3820,29 @@ duplicate (GImage *gimage)
new_gimage->active[count] = gimage->active[count];
}
#warning NEED TO COPY GUIDES ALSO
/* Copy any Guides */
glist = gimage->guides;
while (glist)
{
Guide* new_guide;
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
new_guide = gimp_image_add_hguide(new_gimage);
new_guide->position = guide->position;
break;
case VERTICAL_GUIDE:
new_guide = gimp_image_add_vguide(new_gimage);
new_guide->position = guide->position;
break;
default:
g_error("Unknown guide orientation.\n");
}
}
gimage_enable_undo (new_gimage);
......
......@@ -410,6 +410,8 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
Layer *layer;
Layer *floating_layer;
GSList *list;
GList *glist;
Guide *guide;
int old_width, old_height;
int layer_width, layer_height;
......@@ -458,7 +460,25 @@ gimp_image_scale (GimpImage *gimage, int new_width, int new_height)
list = g_slist_next (list);
}
#warning NEED TO SCALE GUIDES ALSO
/* Scale any Guides */
glist = gimage->guides;
while (glist)
{
guide = (Guide*) glist->data;
glist = g_list_next (glist);
switch (guide->orientation)
{
case HORIZONTAL_GUIDE:
guide->position = (guide->position * new_height) / old_height;
break;
case VERTICAL_GUIDE:
guide->position = (guide->position * new_width) / old_width;
break;
default:
g_error("Unknown guide orientation II.\n");
}
}
/* Make sure the projection matches the gimage size */
gimp_image_projection_realloc (gimage);
......@@ -1746,6 +1766,8 @@ gimp_image_raise_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return prev_layer;
}
else
......@@ -1818,6 +1840,8 @@ gimp_image_lower_layer (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty(gimage);
return next_layer;
}
else
......@@ -1896,6 +1920,8 @@ gimp_image_raise_layer_to_top (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer;
}
......@@ -1989,6 +2015,9 @@ gimp_image_lower_layer_to_bottom (GimpImage *gimage, Layer *layer_arg)
/* invalidate the composite preview */
gimp_image_invalidate_preview (gimage);
gimp_image_dirty (gimage);
return layer_arg;
}
......
......@@ -1659,6 +1659,7 @@ layers_dialog_lower_layer_callback (GtkWidget *w,
return;
gimage_lower_layer (gimage, gimage->active_layer);
gdisplays_flush ();
}
......@@ -3273,6 +3274,7 @@ struct _EditLayerOptions {
GtkWidget *query_box;
GtkWidget *name_entry;
GimpLayer *layer;
GImage *gimage;
};
static void
......@@ -3296,6 +3298,7 @@ edit_layer_query_ok_callback (GtkWidget *w,
}
}
layer_set_name(layer, gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
gimage_dirty (options->gimage);
}
gdisplays_flush ();
......@@ -3342,6 +3345,7 @@ layers_dialog_edit_layer_query (LayerWidget *layer_widget)
/* the new options structure */
options = (EditLayerOptions *) g_malloc (sizeof (EditLayerOptions));
options->layer = layer_widget->layer;
options->gimage = layer_widget->gimage;
/* the dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "edit_layer_attrributes", "Gimp");
......
......@@ -1659,6 +1659,7 @@ layers_dialog_lower_layer_callback (GtkWidget *w,
return;
gimage_lower_layer (gimage, gimage->active_layer);
gdisplays_flush ();
}
......@@ -3273,6 +3274,7 @@ struct _EditLayerOptions {
GtkWidget *query_box;
GtkWidget *name_entry;
GimpLayer *layer;
GImage *gimage;
};
static void
......@@ -3296,6 +3298,7 @@ edit_layer_query_ok_callback (GtkWidget *w,
}
}
layer_set_name(layer, gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
gimage_dirty (options->gimage);
}
gdisplays_flush ();
......@@ -3342,6 +3345,7 @@ layers_dialog_edit_layer_query (LayerWidget *layer_widget)
/* the new options structure */
options = (EditLayerOptions *) g_malloc (sizeof (EditLayerOptions));
options->layer = layer_widget->layer;
options->gimage = layer_widget->gimage;
/* the dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "edit_layer_attrributes", "Gimp");
......
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