call setup_scale when changing the resolution or unit, so the rulers

get updated correctly


--Sven
This commit is contained in:
Sven Neumann 2000-01-22 15:05:42 +00:00
parent cf7cf417e2
commit 489e5ab29e
14 changed files with 159 additions and 48 deletions

View File

@ -1,3 +1,11 @@
Sat Jan 22 16:00:52 CET 2000 Sven Neumann <sven@gimp.org>
* app/commands.c
* app/gdisplay.c
* app/gdisplay.h
* app/scale.c: call setup_scale when changing the resolution or unit,
so the rulers get updated correctly
Sat Jan 21 21:00:00 CST 2000 Seth Burgess <sjburges@gimp.org>
* app/transform_core.c: applied Steinar's

View File

@ -1311,9 +1311,11 @@ image_scale_callback (GtkWidget *widget,
{
ImageResize *image_scale;
GImage *gimage;
gboolean flush = FALSE; /* this is a bit ugly:
we hijack the flush variable to check if
an undo_group was already started */
gboolean rulers_flush = FALSE;
gboolean display_flush = FALSE; /* this is a bit ugly:
we hijack the flush variable
to check if an undo_group was
already started */
image_scale = (ImageResize *) client_data;
@ -1327,18 +1329,22 @@ image_scale_callback (GtkWidget *widget,
gimage_set_resolution (gimage,
image_scale->resize->resolution_x,
image_scale->resize->resolution_y);
flush = TRUE;
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->unit != gimage->unit)
{
if (!flush)
if (!display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimage_set_unit (gimage, image_scale->resize->unit);
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
flush = TRUE;
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->width != gimage->width ||
@ -1347,13 +1353,14 @@ image_scale_callback (GtkWidget *widget,
if (image_scale->resize->width > 0 &&
image_scale->resize->height > 0)
{
if (!flush)
if (!display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimage_scale (gimage,
image_scale->resize->width,
image_scale->resize->height);
flush = TRUE;
display_flush = TRUE;
}
else
{
@ -1363,7 +1370,13 @@ image_scale_callback (GtkWidget *widget,
}
}
if (flush)
if (rulers_flush)
{
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
}
if (display_flush)
{
undo_push_group_end (gimage);
gdisplays_flush ();

View File

@ -1311,9 +1311,11 @@ image_scale_callback (GtkWidget *widget,
{
ImageResize *image_scale;
GImage *gimage;
gboolean flush = FALSE; /* this is a bit ugly:
we hijack the flush variable to check if
an undo_group was already started */
gboolean rulers_flush = FALSE;
gboolean display_flush = FALSE; /* this is a bit ugly:
we hijack the flush variable
to check if an undo_group was
already started */
image_scale = (ImageResize *) client_data;
@ -1327,18 +1329,22 @@ image_scale_callback (GtkWidget *widget,
gimage_set_resolution (gimage,
image_scale->resize->resolution_x,
image_scale->resize->resolution_y);
flush = TRUE;
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->unit != gimage->unit)
{
if (!flush)
if (!display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimage_set_unit (gimage, image_scale->resize->unit);
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
flush = TRUE;
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->width != gimage->width ||
@ -1347,13 +1353,14 @@ image_scale_callback (GtkWidget *widget,
if (image_scale->resize->width > 0 &&
image_scale->resize->height > 0)
{
if (!flush)
if (!display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimage_scale (gimage,
image_scale->resize->width,
image_scale->resize->height);
flush = TRUE;
display_flush = TRUE;
}
else
{
@ -1363,7 +1370,13 @@ image_scale_callback (GtkWidget *widget,
}
}
if (flush)
if (rulers_flush)
{
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
}
if (display_flush)
{
undo_push_group_end (gimage);
gdisplays_flush ();

View File

@ -1881,6 +1881,23 @@ gdisplays_resize_cursor_label (GimpImage *gimage)
}
}
void
gdisplays_setup_scale (GimpImage *gimage)
{
GDisplay *gdisp;
GSList *list = display_list;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
setup_scale (gdisp);
list = g_slist_next (list);
}
}
void
gdisplays_update_area (GimpImage *gimage,
int x,

View File

@ -204,6 +204,7 @@ GDisplay * gdisplay_get_ID (int);
void gdisplay_update_title (GDisplay*);
void gdisplays_update_title (GimpImage*);
void gdisplays_resize_cursor_label (GimpImage*);
void gdisplays_setup_scale (GimpImage*);
void gdisplays_update_area (GimpImage*, int, int, int, int);
void gdisplays_expose_guides (GimpImage*);
void gdisplays_expose_guide (GimpImage*, Guide *);

View File

@ -155,7 +155,6 @@ change_scale (GDisplay *gdisp,
/* resize the image */
resize_display (gdisp, allow_resize_windows, TRUE);
}
}
@ -255,8 +254,8 @@ setup_scale (GDisplay *gdisp)
FUNSCALEY (gdisp, (double) gdisp->offset_y));
}
gtk_widget_draw (GTK_WIDGET (hruler), NULL);
gtk_widget_draw (GTK_WIDGET (vruler), NULL);
gtk_widget_queue_draw (GTK_WIDGET (hruler));
gtk_widget_queue_draw (GTK_WIDGET (vruler));
nav_window_update_window_marker(gdisp->window_nav_dialog);
nav_window_update_window_marker (gdisp->window_nav_dialog);
}

View File

@ -1881,6 +1881,23 @@ gdisplays_resize_cursor_label (GimpImage *gimage)
}
}
void
gdisplays_setup_scale (GimpImage *gimage)
{
GDisplay *gdisp;
GSList *list = display_list;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
setup_scale (gdisp);
list = g_slist_next (list);
}
}
void
gdisplays_update_area (GimpImage *gimage,
int x,

View File

@ -204,6 +204,7 @@ GDisplay * gdisplay_get_ID (int);
void gdisplay_update_title (GDisplay*);
void gdisplays_update_title (GimpImage*);
void gdisplays_resize_cursor_label (GimpImage*);
void gdisplays_setup_scale (GimpImage*);
void gdisplays_update_area (GimpImage*, int, int, int, int);
void gdisplays_expose_guides (GimpImage*);
void gdisplays_expose_guide (GimpImage*, Guide *);

View File

@ -155,7 +155,6 @@ change_scale (GDisplay *gdisp,
/* resize the image */
resize_display (gdisp, allow_resize_windows, TRUE);
}
}
@ -255,8 +254,8 @@ setup_scale (GDisplay *gdisp)
FUNSCALEY (gdisp, (double) gdisp->offset_y));
}
gtk_widget_draw (GTK_WIDGET (hruler), NULL);
gtk_widget_draw (GTK_WIDGET (vruler), NULL);
gtk_widget_queue_draw (GTK_WIDGET (hruler));
gtk_widget_queue_draw (GTK_WIDGET (vruler));
nav_window_update_window_marker(gdisp->window_nav_dialog);
nav_window_update_window_marker (gdisp->window_nav_dialog);
}

View File

@ -1881,6 +1881,23 @@ gdisplays_resize_cursor_label (GimpImage *gimage)
}
}
void
gdisplays_setup_scale (GimpImage *gimage)
{
GDisplay *gdisp;
GSList *list = display_list;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
setup_scale (gdisp);
list = g_slist_next (list);
}
}
void
gdisplays_update_area (GimpImage *gimage,
int x,

View File

@ -204,6 +204,7 @@ GDisplay * gdisplay_get_ID (int);
void gdisplay_update_title (GDisplay*);
void gdisplays_update_title (GimpImage*);
void gdisplays_resize_cursor_label (GimpImage*);
void gdisplays_setup_scale (GimpImage*);
void gdisplays_update_area (GimpImage*, int, int, int, int);
void gdisplays_expose_guides (GimpImage*);
void gdisplays_expose_guide (GimpImage*, Guide *);

View File

@ -1311,9 +1311,11 @@ image_scale_callback (GtkWidget *widget,
{
ImageResize *image_scale;
GImage *gimage;
gboolean flush = FALSE; /* this is a bit ugly:
we hijack the flush variable to check if
an undo_group was already started */
gboolean rulers_flush = FALSE;
gboolean display_flush = FALSE; /* this is a bit ugly:
we hijack the flush variable
to check if an undo_group was
already started */
image_scale = (ImageResize *) client_data;
@ -1327,18 +1329,22 @@ image_scale_callback (GtkWidget *widget,
gimage_set_resolution (gimage,
image_scale->resize->resolution_x,
image_scale->resize->resolution_y);
flush = TRUE;
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->unit != gimage->unit)
{
if (!flush)
if (!display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimage_set_unit (gimage, image_scale->resize->unit);
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
flush = TRUE;
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->width != gimage->width ||
@ -1347,13 +1353,14 @@ image_scale_callback (GtkWidget *widget,
if (image_scale->resize->width > 0 &&
image_scale->resize->height > 0)
{
if (!flush)
if (!display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimage_scale (gimage,
image_scale->resize->width,
image_scale->resize->height);
flush = TRUE;
display_flush = TRUE;
}
else
{
@ -1363,7 +1370,13 @@ image_scale_callback (GtkWidget *widget,
}
}
if (flush)
if (rulers_flush)
{
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
}
if (display_flush)
{
undo_push_group_end (gimage);
gdisplays_flush ();

View File

@ -1311,9 +1311,11 @@ image_scale_callback (GtkWidget *widget,
{
ImageResize *image_scale;
GImage *gimage;
gboolean flush = FALSE; /* this is a bit ugly:
we hijack the flush variable to check if
an undo_group was already started */
gboolean rulers_flush = FALSE;
gboolean display_flush = FALSE; /* this is a bit ugly:
we hijack the flush variable
to check if an undo_group was
already started */
image_scale = (ImageResize *) client_data;
@ -1327,18 +1329,22 @@ image_scale_callback (GtkWidget *widget,
gimage_set_resolution (gimage,
image_scale->resize->resolution_x,
image_scale->resize->resolution_y);
flush = TRUE;
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->unit != gimage->unit)
{
if (!flush)
if (!display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimage_set_unit (gimage, image_scale->resize->unit);
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
flush = TRUE;
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->width != gimage->width ||
@ -1347,13 +1353,14 @@ image_scale_callback (GtkWidget *widget,
if (image_scale->resize->width > 0 &&
image_scale->resize->height > 0)
{
if (!flush)
if (!display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimage_scale (gimage,
image_scale->resize->width,
image_scale->resize->height);
flush = TRUE;
display_flush = TRUE;
}
else
{
@ -1363,7 +1370,13 @@ image_scale_callback (GtkWidget *widget,
}
}
if (flush)
if (rulers_flush)
{
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
}
if (display_flush)
{
undo_push_group_end (gimage);
gdisplays_flush ();

View File

@ -155,7 +155,6 @@ change_scale (GDisplay *gdisp,
/* resize the image */
resize_display (gdisp, allow_resize_windows, TRUE);
}
}
@ -255,8 +254,8 @@ setup_scale (GDisplay *gdisp)
FUNSCALEY (gdisp, (double) gdisp->offset_y));
}
gtk_widget_draw (GTK_WIDGET (hruler), NULL);
gtk_widget_draw (GTK_WIDGET (vruler), NULL);
gtk_widget_queue_draw (GTK_WIDGET (hruler));
gtk_widget_queue_draw (GTK_WIDGET (vruler));
nav_window_update_window_marker(gdisp->window_nav_dialog);
nav_window_update_window_marker (gdisp->window_nav_dialog);
}