Mon Nov 24 1997 Jay Painter <jpaint@serv.net>

gtk-dairiki-971117-2.patch
        gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
        computing new dimensions of the subwidget, round to nearest
        integer rather than truncating.

Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
        gtk-dairiki-971117-1.patch
        * gtk/gtkvruler.c (gtk_vruler_draw_ticks):
        * gtk/gtkhruler.c (gtk_hruler_draw_ticks): Ensure that subticks
        always are drawn when they should be (sometimes they were getting
        drawn with zero length --- invisible).  Also clear rectangle
        behind text labels to ensure they don't touch or overlap ticks.

Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
        * gtk/gtkaspectframe.c (gtk_aspect_frame_set):
        gtk-dairiki-971117-0.patch
        Clear window when aspect ratio or alignment is changed.
This commit is contained in:
Gnome CVS User 1997-11-25 07:15:41 +00:00
parent c82e82dafc
commit 33b9431580
10 changed files with 163 additions and 44 deletions

View File

@ -1,3 +1,17 @@
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-2.patch
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
computing new dimensions of the subwidget, round to nearest
integer rather than truncating.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-1.patch
* gtk/gtkvruler.c (gtk_vruler_draw_ticks):
* gtk/gtkhruler.c (gtk_hruler_draw_ticks): Ensure that subticks
always are drawn when they should be (sometimes they were getting
drawn with zero length --- invisible). Also clear rectangle
behind text labels to ensure they don't touch or overlap ticks.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkaspectframe.c (gtk_aspect_frame_set):
gtk-dairiki-971117-0.patch
@ -7,10 +21,10 @@ Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkobject.h: fixed GTK_OBJECT_NSIGNALS macro
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtklabel.h: modified gtklabel to clip it's drawing to
it's given area, now it will allways draw in the area it's
* gtk/gtklabel.h: modified gtklabel to clip its drawing to
its given area, now it will always draw in the area it's
been given and clip accordingly. Note: this may cause
the a label to dissappear on widgets which don't give their
the a label to disappear on widgets which don't give their
child labels proper area!
Mon Nov 17 1997 Jay Painter <jpaint@serv.net>

View File

@ -1,3 +1,17 @@
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-2.patch
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
computing new dimensions of the subwidget, round to nearest
integer rather than truncating.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-1.patch
* gtk/gtkvruler.c (gtk_vruler_draw_ticks):
* gtk/gtkhruler.c (gtk_hruler_draw_ticks): Ensure that subticks
always are drawn when they should be (sometimes they were getting
drawn with zero length --- invisible). Also clear rectangle
behind text labels to ensure they don't touch or overlap ticks.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkaspectframe.c (gtk_aspect_frame_set):
gtk-dairiki-971117-0.patch
@ -7,10 +21,10 @@ Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkobject.h: fixed GTK_OBJECT_NSIGNALS macro
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtklabel.h: modified gtklabel to clip it's drawing to
it's given area, now it will allways draw in the area it's
* gtk/gtklabel.h: modified gtklabel to clip its drawing to
its given area, now it will always draw in the area it's
been given and clip accordingly. Note: this may cause
the a label to dissappear on widgets which don't give their
the a label to disappear on widgets which don't give their
child labels proper area!
Mon Nov 17 1997 Jay Painter <jpaint@serv.net>

View File

@ -1,3 +1,17 @@
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-2.patch
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
computing new dimensions of the subwidget, round to nearest
integer rather than truncating.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-1.patch
* gtk/gtkvruler.c (gtk_vruler_draw_ticks):
* gtk/gtkhruler.c (gtk_hruler_draw_ticks): Ensure that subticks
always are drawn when they should be (sometimes they were getting
drawn with zero length --- invisible). Also clear rectangle
behind text labels to ensure they don't touch or overlap ticks.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkaspectframe.c (gtk_aspect_frame_set):
gtk-dairiki-971117-0.patch
@ -7,10 +21,10 @@ Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkobject.h: fixed GTK_OBJECT_NSIGNALS macro
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtklabel.h: modified gtklabel to clip it's drawing to
it's given area, now it will allways draw in the area it's
* gtk/gtklabel.h: modified gtklabel to clip its drawing to
its given area, now it will always draw in the area it's
been given and clip accordingly. Note: this may cause
the a label to dissappear on widgets which don't give their
the a label to disappear on widgets which don't give their
child labels proper area!
Mon Nov 17 1997 Jay Painter <jpaint@serv.net>

View File

@ -1,3 +1,17 @@
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-2.patch
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
computing new dimensions of the subwidget, round to nearest
integer rather than truncating.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-1.patch
* gtk/gtkvruler.c (gtk_vruler_draw_ticks):
* gtk/gtkhruler.c (gtk_hruler_draw_ticks): Ensure that subticks
always are drawn when they should be (sometimes they were getting
drawn with zero length --- invisible). Also clear rectangle
behind text labels to ensure they don't touch or overlap ticks.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkaspectframe.c (gtk_aspect_frame_set):
gtk-dairiki-971117-0.patch
@ -7,10 +21,10 @@ Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkobject.h: fixed GTK_OBJECT_NSIGNALS macro
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtklabel.h: modified gtklabel to clip it's drawing to
it's given area, now it will allways draw in the area it's
* gtk/gtklabel.h: modified gtklabel to clip its drawing to
its given area, now it will always draw in the area it's
been given and clip accordingly. Note: this may cause
the a label to dissappear on widgets which don't give their
the a label to disappear on widgets which don't give their
child labels proper area!
Mon Nov 17 1997 Jay Painter <jpaint@serv.net>

View File

@ -1,3 +1,17 @@
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-2.patch
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
computing new dimensions of the subwidget, round to nearest
integer rather than truncating.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-1.patch
* gtk/gtkvruler.c (gtk_vruler_draw_ticks):
* gtk/gtkhruler.c (gtk_hruler_draw_ticks): Ensure that subticks
always are drawn when they should be (sometimes they were getting
drawn with zero length --- invisible). Also clear rectangle
behind text labels to ensure they don't touch or overlap ticks.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkaspectframe.c (gtk_aspect_frame_set):
gtk-dairiki-971117-0.patch
@ -7,10 +21,10 @@ Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkobject.h: fixed GTK_OBJECT_NSIGNALS macro
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtklabel.h: modified gtklabel to clip it's drawing to
it's given area, now it will allways draw in the area it's
* gtk/gtklabel.h: modified gtklabel to clip its drawing to
its given area, now it will always draw in the area it's
been given and clip accordingly. Note: this may cause
the a label to dissappear on widgets which don't give their
the a label to disappear on widgets which don't give their
child labels proper area!
Mon Nov 17 1997 Jay Painter <jpaint@serv.net>

View File

@ -1,3 +1,17 @@
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-2.patch
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
computing new dimensions of the subwidget, round to nearest
integer rather than truncating.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-1.patch
* gtk/gtkvruler.c (gtk_vruler_draw_ticks):
* gtk/gtkhruler.c (gtk_hruler_draw_ticks): Ensure that subticks
always are drawn when they should be (sometimes they were getting
drawn with zero length --- invisible). Also clear rectangle
behind text labels to ensure they don't touch or overlap ticks.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkaspectframe.c (gtk_aspect_frame_set):
gtk-dairiki-971117-0.patch
@ -7,10 +21,10 @@ Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkobject.h: fixed GTK_OBJECT_NSIGNALS macro
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtklabel.h: modified gtklabel to clip it's drawing to
it's given area, now it will allways draw in the area it's
* gtk/gtklabel.h: modified gtklabel to clip its drawing to
its given area, now it will always draw in the area it's
been given and clip accordingly. Note: this may cause
the a label to dissappear on widgets which don't give their
the a label to disappear on widgets which don't give their
child labels proper area!
Mon Nov 17 1997 Jay Painter <jpaint@serv.net>

View File

@ -1,3 +1,17 @@
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-2.patch
gtk/gtkaspectframe.c (gtk_aspect_frame_size_allocate): When
computing new dimensions of the subwidget, round to nearest
integer rather than truncating.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
gtk-dairiki-971117-1.patch
* gtk/gtkvruler.c (gtk_vruler_draw_ticks):
* gtk/gtkhruler.c (gtk_hruler_draw_ticks): Ensure that subticks
always are drawn when they should be (sometimes they were getting
drawn with zero length --- invisible). Also clear rectangle
behind text labels to ensure they don't touch or overlap ticks.
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkaspectframe.c (gtk_aspect_frame_set):
gtk-dairiki-971117-0.patch
@ -7,10 +21,10 @@ Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtkobject.h: fixed GTK_OBJECT_NSIGNALS macro
Mon Nov 24 1997 Jay Painter <jpaint@serv.net>
* gtk/gtklabel.h: modified gtklabel to clip it's drawing to
it's given area, now it will allways draw in the area it's
* gtk/gtklabel.h: modified gtklabel to clip its drawing to
its given area, now it will always draw in the area it's
been given and clip accordingly. Note: this may cause
the a label to dissappear on widgets which don't give their
the a label to disappear on widgets which don't give their
child labels proper area!
Mon Nov 17 1997 Jay Painter <jpaint@serv.net>

View File

@ -319,14 +319,14 @@ gtk_aspect_frame_size_allocate (GtkWidget *widget,
GTK_CONTAINER (frame)->border_width -
GTK_WIDGET (frame)->style->klass->ythickness);
if (ratio * height > width)
if (height > width / ratio)
{
child_allocation.width = width;
child_allocation.height = width/ratio;
child_allocation.height = width/ratio + 0.5;
}
else
else if (width > height * ratio)
{
child_allocation.width = ratio*height;
child_allocation.width = ratio * height + 0.5;
child_allocation.height = height;
}

View File

@ -123,12 +123,13 @@ static void
gtk_hruler_draw_ticks (GtkRuler *ruler)
{
GtkWidget *widget;
GdkGC *gc;
GdkGC *gc, *bg_gc;
GdkFont *font;
gint i;
gint width, height;
gint xthickness;
gint ythickness;
gint length;
gint length, ideal_length;
gfloat subd_incr;
gfloat step_incr;
gfloat increment;
@ -147,9 +148,12 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
widget = GTK_WIDGET (ruler);
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
font = widget->style->font;
xthickness = widget->style->klass->xthickness;
ythickness = widget->style->klass->ythickness;
digit_height = widget->style->font->ascent;
digit_height = font->ascent; /* assume descent == 0? */
width = widget->allocation.width;
height = widget->allocation.height - ythickness * 2;
@ -181,19 +185,20 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
if (scale == MAXIMUM_SCALES)
scale = MAXIMUM_SCALES - 1;
for (i = 0; i < MAXIMUM_SUBDIVIDE; i++)
length = 0;
for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--)
{
subd_incr = (gfloat) ruler->metric->ruler_scale[scale] / (gfloat) ruler->metric->subdivide[i];
step_incr = subd_incr * increment;
if (step_incr <= MINIMUM_INCR)
break;
continue;
start = floor ((ruler->lower / ruler->metric->pixels_per_unit) / subd_incr) * subd_incr;
end = ceil ((ruler->upper / ruler->metric->pixels_per_unit) / subd_incr) * subd_incr;
length = height / (i + 1) - 1;
if (i > 0)
length -= 2;
ideal_length = height / (i + 1) - 1;
if (ideal_length > ++length)
length = ideal_length;
cur = start;
while (cur <= end)
@ -206,9 +211,13 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
if (i == 0)
{
sprintf (unit_str, "%d", (int) cur);
gdk_draw_string (ruler->backing_store, widget->style->font, gc,
pos + 2,
ythickness + digit_height - 1,
gdk_draw_rectangle (ruler->backing_store,
bg_gc, TRUE,
pos + 1, ythickness,
gdk_string_width(font, unit_str) + 1,
digit_height);
gdk_draw_string (ruler->backing_store, font, gc,
pos + 2, ythickness + font->ascent - 1,
unit_str);
}

View File

@ -123,12 +123,13 @@ static void
gtk_vruler_draw_ticks (GtkRuler *ruler)
{
GtkWidget *widget;
GdkGC *gc;
GdkGC *gc, *bg_gc;
GdkFont * font;
gint i, j;
gint width, height;
gint xthickness;
gint ythickness;
gint length;
gint length, ideal_length;
gfloat subd_incr;
gfloat step_incr;
gfloat increment;
@ -148,9 +149,11 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
widget = GTK_WIDGET (ruler);
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
font = widget->style->font;
xthickness = widget->style->klass->xthickness;
ythickness = widget->style->klass->ythickness;
digit_height = widget->style->font->ascent;
digit_height = font->ascent; /* Assume descent == 0 ? */
width = widget->allocation.height;
height = widget->allocation.width - ythickness * 2;
@ -182,17 +185,20 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
if (scale == MAXIMUM_SCALES)
scale = MAXIMUM_SCALES - 1;
for (i = 0; i < MAXIMUM_SUBDIVIDE; i++)
length = 0;
for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--)
{
subd_incr = (gfloat) ruler->metric->ruler_scale[scale] / (gfloat) ruler->metric->subdivide[i];
step_incr = subd_incr * increment;
if (step_incr <= MINIMUM_INCR)
break;
continue;
start = floor ((ruler->lower / ruler->metric->pixels_per_unit) / subd_incr) * subd_incr;
end = ceil ((ruler->upper / ruler->metric->pixels_per_unit) / subd_incr) * subd_incr;
length = height / (i + 1) - 1;
ideal_length = height / (i + 1) - 1;
if (ideal_length > ++length)
length = ideal_length;
cur = start;
while (cur <= end)
@ -211,7 +217,13 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
for (j = 0; j < (int) strlen (unit_str); j++)
{
digit_str[0] = unit_str[j];
gdk_draw_string (ruler->backing_store, widget->style->font, gc,
gdk_draw_rectangle (ruler->backing_store,
bg_gc, TRUE,
xthickness + 1,
pos + digit_height * j + 1,
gdk_string_width(font, digit_str),
digit_height);
gdk_draw_string (ruler->backing_store, font, gc,
xthickness + 1,
pos + digit_height * (j + 1) + 1,
digit_str);