diff options
author | Gnome CVS User <gnomecvs@src.gnome.org> | 1997-11-25 07:15:41 +0000 |
---|---|---|
committer | Gnome CVS User <gnomecvs@src.gnome.org> | 1997-11-25 07:15:41 +0000 |
commit | 33b94315803c6a7c9fe3826f0d4b11a26392137a (patch) | |
tree | 48c12426b37871cf7863595503e27f0f3472e8d3 | |
parent | c82e82dafc507469f48547702841f0946a888104 (diff) | |
download | gtk+-33b94315803c6a7c9fe3826f0d4b11a26392137a.tar.gz |
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.
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 20 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 20 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 20 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 20 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 20 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 20 | ||||
-rw-r--r-- | gtk/gtkaspectframe.c | 8 | ||||
-rw-r--r-- | gtk/gtkhruler.c | 33 | ||||
-rw-r--r-- | gtk/gtkvruler.c | 26 |
10 files changed, 163 insertions, 44 deletions
@@ -1,4 +1,18 @@ 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. @@ -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> diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 252d02a93b..d9ef79b8bd 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,4 +1,18 @@ 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. @@ -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> diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 252d02a93b..d9ef79b8bd 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,4 +1,18 @@ 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. @@ -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> diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 252d02a93b..d9ef79b8bd 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,4 +1,18 @@ 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. @@ -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> diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 252d02a93b..d9ef79b8bd 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,4 +1,18 @@ 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. @@ -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> diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 252d02a93b..d9ef79b8bd 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,4 +1,18 @@ 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. @@ -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> diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 252d02a93b..d9ef79b8bd 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,4 +1,18 @@ 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. @@ -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> diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c index 2e6594fea8..16feba5f02 100644 --- a/gtk/gtkaspectframe.c +++ b/gtk/gtkaspectframe.c @@ -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; } diff --git a/gtk/gtkhruler.c b/gtk/gtkhruler.c index ab6e69199e..83f1c7a6e4 100644 --- a/gtk/gtkhruler.c +++ b/gtk/gtkhruler.c @@ -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,20 +185,21 @@ 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); } diff --git a/gtk/gtkvruler.c b/gtk/gtkvruler.c index 43fe16bb7b..5de5099a5f 100644 --- a/gtk/gtkvruler.c +++ b/gtk/gtkvruler.c @@ -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); |