diff --git a/ChangeLog b/ChangeLog index 93b72b0531..51f3c89bf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Nov 19 21:17:19 MET 1998 Sven Neumann + + * app/gdisplay.[ch] + * app/interface.c: set a proper size for the coordinates display + in the statusbar + Wed Nov 18 17:35:38 MET 1998 Sven Neumann * app/app_procs.c: fixed a longstanding bug in the splash-screen. diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index 74dd7c50b2..08cc94b923 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -896,7 +896,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) } else { - g_snprintf (buffer, CURSOR_STR_LENGTH, " %d, %d ", t_x, t_y); + g_snprintf (buffer, CURSOR_STR_LENGTH, "%d, %d", t_x, t_y); gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer); } } @@ -909,6 +909,20 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) gdisplay_flush (gdisp); } +void +gdisplay_resize_cursor_label (GDisplay *gdisp) +{ + /* Set a proper size for the coordinates display in the statusbar. */ + char buffer[CURSOR_STR_LENGTH]; + int cursor_label_width; + + g_snprintf (buffer, sizeof(buffer), " %d,%d ", gdisp->gimage->width, gdisp->gimage->height); + cursor_label_width = + gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); + gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1); + gtk_widget_queue_resize (gdisp->statusarea); +} + void gdisplay_remove_and_delete (GDisplay *gdisp) { @@ -1408,6 +1422,7 @@ gdisplay_expose_full (GDisplay *gdisp) gdisplay_add_display_area (gdisp, 0, 0, gdisp->disp_width, gdisp->disp_height); + gdisplay_resize_cursor_label (gdisp); } /**************************************************/ diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h index 589cc1dddb..4b43b9941d 100644 --- a/app/core/gimpprojection.h +++ b/app/core/gimpprojection.h @@ -146,6 +146,7 @@ Guide* gdisplay_find_guide (GDisplay *, int, int); void gdisplay_snap_point (GDisplay *, double , double, double *, double *); void gdisplay_snap_rectangle (GDisplay *, int, int, int, int, int *, int *); void gdisplay_update_cursor (GDisplay *, int, int); +void gdisplay_resize_cursor_label (GDisplay *); /* function declarations */ diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index 74dd7c50b2..08cc94b923 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -896,7 +896,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) } else { - g_snprintf (buffer, CURSOR_STR_LENGTH, " %d, %d ", t_x, t_y); + g_snprintf (buffer, CURSOR_STR_LENGTH, "%d, %d", t_x, t_y); gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer); } } @@ -909,6 +909,20 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) gdisplay_flush (gdisp); } +void +gdisplay_resize_cursor_label (GDisplay *gdisp) +{ + /* Set a proper size for the coordinates display in the statusbar. */ + char buffer[CURSOR_STR_LENGTH]; + int cursor_label_width; + + g_snprintf (buffer, sizeof(buffer), " %d,%d ", gdisp->gimage->width, gdisp->gimage->height); + cursor_label_width = + gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); + gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1); + gtk_widget_queue_resize (gdisp->statusarea); +} + void gdisplay_remove_and_delete (GDisplay *gdisp) { @@ -1408,6 +1422,7 @@ gdisplay_expose_full (GDisplay *gdisp) gdisplay_add_display_area (gdisp, 0, 0, gdisp->disp_width, gdisp->disp_height); + gdisplay_resize_cursor_label (gdisp); } /**************************************************/ diff --git a/app/display/gimpdisplay.h b/app/display/gimpdisplay.h index 589cc1dddb..4b43b9941d 100644 --- a/app/display/gimpdisplay.h +++ b/app/display/gimpdisplay.h @@ -146,6 +146,7 @@ Guide* gdisplay_find_guide (GDisplay *, int, int); void gdisplay_snap_point (GDisplay *, double , double, double *, double *); void gdisplay_snap_rectangle (GDisplay *, int, int, int, int, int *, int *); void gdisplay_update_cursor (GDisplay *, int, int); +void gdisplay_resize_cursor_label (GDisplay *); /* function declarations */ diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index 81190af72b..67a4505120 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -558,11 +558,9 @@ create_display_shell (GDisplay* gdisp, int s_width, s_height; int scalesrc, scaledest; int contextid; - char buffer[CURSOR_STR_LENGTH]; - int cursor_label_width; - /* adjust the initial scale -- so that window fits on screen */ { + /* adjust the initial scale -- so that window fits on screen */ s_width = gdk_screen_width (); s_height = gdk_screen_height (); @@ -711,11 +709,7 @@ create_display_shell (GDisplay* gdisp, gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (gdisp->statusarea), frame, FALSE, TRUE, 0); - gdisp->cursor_label = gtk_label_new (" 0000, 0000 "); - - g_snprintf (buffer, sizeof(buffer), " %d, %d ", width, height); - cursor_label_width = gdk_string_measure ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); - gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1); + gdisp->cursor_label = gtk_label_new (" "); gtk_container_add (GTK_CONTAINER (frame), gdisp->cursor_label); gdisp->statusbar = gtk_statusbar_new (); @@ -769,6 +763,8 @@ create_display_shell (GDisplay* gdisp, gtk_widget_show (vbox); gtk_widget_show (gdisp->shell); + gdisplay_resize_cursor_label (gdisp); + #ifdef __GNUC__ #warning DODGY? #endif diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 81190af72b..67a4505120 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -558,11 +558,9 @@ create_display_shell (GDisplay* gdisp, int s_width, s_height; int scalesrc, scaledest; int contextid; - char buffer[CURSOR_STR_LENGTH]; - int cursor_label_width; - /* adjust the initial scale -- so that window fits on screen */ { + /* adjust the initial scale -- so that window fits on screen */ s_width = gdk_screen_width (); s_height = gdk_screen_height (); @@ -711,11 +709,7 @@ create_display_shell (GDisplay* gdisp, gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (gdisp->statusarea), frame, FALSE, TRUE, 0); - gdisp->cursor_label = gtk_label_new (" 0000, 0000 "); - - g_snprintf (buffer, sizeof(buffer), " %d, %d ", width, height); - cursor_label_width = gdk_string_measure ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); - gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1); + gdisp->cursor_label = gtk_label_new (" "); gtk_container_add (GTK_CONTAINER (frame), gdisp->cursor_label); gdisp->statusbar = gtk_statusbar_new (); @@ -769,6 +763,8 @@ create_display_shell (GDisplay* gdisp, gtk_widget_show (vbox); gtk_widget_show (gdisp->shell); + gdisplay_resize_cursor_label (gdisp); + #ifdef __GNUC__ #warning DODGY? #endif diff --git a/app/gdisplay.c b/app/gdisplay.c index 74dd7c50b2..08cc94b923 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -896,7 +896,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) } else { - g_snprintf (buffer, CURSOR_STR_LENGTH, " %d, %d ", t_x, t_y); + g_snprintf (buffer, CURSOR_STR_LENGTH, "%d, %d", t_x, t_y); gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer); } } @@ -909,6 +909,20 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y) gdisplay_flush (gdisp); } +void +gdisplay_resize_cursor_label (GDisplay *gdisp) +{ + /* Set a proper size for the coordinates display in the statusbar. */ + char buffer[CURSOR_STR_LENGTH]; + int cursor_label_width; + + g_snprintf (buffer, sizeof(buffer), " %d,%d ", gdisp->gimage->width, gdisp->gimage->height); + cursor_label_width = + gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); + gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1); + gtk_widget_queue_resize (gdisp->statusarea); +} + void gdisplay_remove_and_delete (GDisplay *gdisp) { @@ -1408,6 +1422,7 @@ gdisplay_expose_full (GDisplay *gdisp) gdisplay_add_display_area (gdisp, 0, 0, gdisp->disp_width, gdisp->disp_height); + gdisplay_resize_cursor_label (gdisp); } /**************************************************/ diff --git a/app/gdisplay.h b/app/gdisplay.h index 589cc1dddb..4b43b9941d 100644 --- a/app/gdisplay.h +++ b/app/gdisplay.h @@ -146,6 +146,7 @@ Guide* gdisplay_find_guide (GDisplay *, int, int); void gdisplay_snap_point (GDisplay *, double , double, double *, double *); void gdisplay_snap_rectangle (GDisplay *, int, int, int, int, int *, int *); void gdisplay_update_cursor (GDisplay *, int, int); +void gdisplay_resize_cursor_label (GDisplay *); /* function declarations */ diff --git a/app/interface.c b/app/interface.c index 81190af72b..67a4505120 100644 --- a/app/interface.c +++ b/app/interface.c @@ -558,11 +558,9 @@ create_display_shell (GDisplay* gdisp, int s_width, s_height; int scalesrc, scaledest; int contextid; - char buffer[CURSOR_STR_LENGTH]; - int cursor_label_width; - /* adjust the initial scale -- so that window fits on screen */ { + /* adjust the initial scale -- so that window fits on screen */ s_width = gdk_screen_width (); s_height = gdk_screen_height (); @@ -711,11 +709,7 @@ create_display_shell (GDisplay* gdisp, gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (gdisp->statusarea), frame, FALSE, TRUE, 0); - gdisp->cursor_label = gtk_label_new (" 0000, 0000 "); - - g_snprintf (buffer, sizeof(buffer), " %d, %d ", width, height); - cursor_label_width = gdk_string_measure ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer ); - gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1); + gdisp->cursor_label = gtk_label_new (" "); gtk_container_add (GTK_CONTAINER (frame), gdisp->cursor_label); gdisp->statusbar = gtk_statusbar_new (); @@ -769,6 +763,8 @@ create_display_shell (GDisplay* gdisp, gtk_widget_show (vbox); gtk_widget_show (gdisp->shell); + gdisplay_resize_cursor_label (gdisp); + #ifdef __GNUC__ #warning DODGY? #endif