Use a proper size for the coordinates display in the statusbar.

I still don't know why those statusbar is sometimes not updated. The labels
are definitely set, but are sometimes not drawn. I guess this is a GTK
problem.


--Sven
This commit is contained in:
Sven Neumann 1998-11-19 20:20:46 +00:00
parent 397463980a
commit b593a1592f
10 changed files with 69 additions and 27 deletions

View File

@ -1,3 +1,9 @@
Thu Nov 19 21:17:19 MET 1998 Sven Neumann <sven@gimp.org>
* 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 <sven@gimp.org>
* app/app_procs.c: fixed a longstanding bug in the splash-screen.

View File

@ -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);
}
/**************************************************/

View File

@ -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 */

View File

@ -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);
}
/**************************************************/

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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);
}
/**************************************************/

View File

@ -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 */

View File

@ -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