diff options
author | Jonathan Blandford <jrb@redhat.com> | 2000-02-23 22:55:27 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2000-02-23 22:55:27 +0000 |
commit | 6654a22891abb31fab2a68e9b67d2c3e46f79d69 (patch) | |
tree | 9e8dcccc44a36cc11ba0886aaf81437e07e343cf | |
parent | 2444c80ff76ee2d04fc66fcdf1ba09885912b5fe (diff) | |
download | gdk-pixbuf-6654a22891abb31fab2a68e9b67d2c3e46f79d69.tar.gz |
add a 'paned' mode to the function to let it draw the seven dots, instead
2000-02-23 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkstyle.c (gtk_default_draw_handle): add a 'paned' mode to
the function to let it draw the seven dots, instead of the old,
much maligned, method.
(draw_dot): New function to draw a dot.
* gtk/gtkhpaned.c (gtk_hpaned_size_allocate): changed allocation
to draw the handle inside the border width as opposed to outside.
Use paint function instead of gdk_draw_point.
* gtk/gtkvpaned.c (gtk_vpaned_size_allocate): changed allocation
to draw the handle inside the border width as opposed to outside.
Use paint function instead of gdk_draw_point.
* gtk/gtkfilesel.c (gtk_file_selection_update_history_menu):
Change indenting to be more GTK like.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 18 | ||||
-rw-r--r-- | gtk/gtkfilesel.c | 13 | ||||
-rw-r--r-- | gtk/gtkhpaned.c | 86 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 99 | ||||
-rw-r--r-- | gtk/gtkvpaned.c | 87 |
11 files changed, 240 insertions, 171 deletions
@@ -1,3 +1,21 @@ +2000-02-23 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtkstyle.c (gtk_default_draw_handle): add a 'paned' mode to + the function to let it draw the seven dots, instead of the old, + much maligned, method. + (draw_dot): New function to draw a dot. + + * gtk/gtkhpaned.c (gtk_hpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkvpaned.c (gtk_vpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkfilesel.c (gtk_file_selection_update_history_menu): + Change indenting to be more GTK like. + Wed Feb 23 10:54:14 GMT 2000 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: New section on GtkCalendar diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 5db5532b5..27306256e 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,21 @@ +2000-02-23 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtkstyle.c (gtk_default_draw_handle): add a 'paned' mode to + the function to let it draw the seven dots, instead of the old, + much maligned, method. + (draw_dot): New function to draw a dot. + + * gtk/gtkhpaned.c (gtk_hpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkvpaned.c (gtk_vpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkfilesel.c (gtk_file_selection_update_history_menu): + Change indenting to be more GTK like. + Wed Feb 23 10:54:14 GMT 2000 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: New section on GtkCalendar diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 5db5532b5..27306256e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,21 @@ +2000-02-23 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtkstyle.c (gtk_default_draw_handle): add a 'paned' mode to + the function to let it draw the seven dots, instead of the old, + much maligned, method. + (draw_dot): New function to draw a dot. + + * gtk/gtkhpaned.c (gtk_hpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkvpaned.c (gtk_vpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkfilesel.c (gtk_file_selection_update_history_menu): + Change indenting to be more GTK like. + Wed Feb 23 10:54:14 GMT 2000 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: New section on GtkCalendar diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 5db5532b5..27306256e 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,21 @@ +2000-02-23 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtkstyle.c (gtk_default_draw_handle): add a 'paned' mode to + the function to let it draw the seven dots, instead of the old, + much maligned, method. + (draw_dot): New function to draw a dot. + + * gtk/gtkhpaned.c (gtk_hpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkvpaned.c (gtk_vpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkfilesel.c (gtk_file_selection_update_history_menu): + Change indenting to be more GTK like. + Wed Feb 23 10:54:14 GMT 2000 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: New section on GtkCalendar diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 5db5532b5..27306256e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,21 @@ +2000-02-23 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtkstyle.c (gtk_default_draw_handle): add a 'paned' mode to + the function to let it draw the seven dots, instead of the old, + much maligned, method. + (draw_dot): New function to draw a dot. + + * gtk/gtkhpaned.c (gtk_hpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkvpaned.c (gtk_vpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkfilesel.c (gtk_file_selection_update_history_menu): + Change indenting to be more GTK like. + Wed Feb 23 10:54:14 GMT 2000 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: New section on GtkCalendar diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 5db5532b5..27306256e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,21 @@ +2000-02-23 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtkstyle.c (gtk_default_draw_handle): add a 'paned' mode to + the function to let it draw the seven dots, instead of the old, + much maligned, method. + (draw_dot): New function to draw a dot. + + * gtk/gtkhpaned.c (gtk_hpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkvpaned.c (gtk_vpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkfilesel.c (gtk_file_selection_update_history_menu): + Change indenting to be more GTK like. + Wed Feb 23 10:54:14 GMT 2000 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: New section on GtkCalendar diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 5db5532b5..27306256e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,21 @@ +2000-02-23 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtkstyle.c (gtk_default_draw_handle): add a 'paned' mode to + the function to let it draw the seven dots, instead of the old, + much maligned, method. + (draw_dot): New function to draw a dot. + + * gtk/gtkhpaned.c (gtk_hpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkvpaned.c (gtk_vpaned_size_allocate): changed allocation + to draw the handle inside the border width as opposed to outside. + Use paint function instead of gdk_draw_point. + + * gtk/gtkfilesel.c (gtk_file_selection_update_history_menu): + Change indenting to be more GTK like. + Wed Feb 23 10:54:14 GMT 2000 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: New section on GtkCalendar diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index 2f41642f6..f39b9d763 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -1303,11 +1303,14 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs, /* since the autocompletion gets confused if you don't * supply a trailing '/' on a dir entry, set the full * (current) path to "" which just refreshes the filesel */ - if (dir_len == i) { - callback_arg->directory = g_strdup (""); - } else { - callback_arg->directory = g_strdup (current_dir); - } + if (dir_len == i) + { + callback_arg->directory = g_strdup (""); + } + else + { + callback_arg->directory = g_strdup (current_dir); + } fs->history_list = g_list_append (fs->history_list, callback_arg); diff --git a/gtk/gtkhpaned.c b/gtk/gtkhpaned.c index b757907f6..8f9cd035a 100644 --- a/gtk/gtkhpaned.c +++ b/gtk/gtkhpaned.c @@ -1,4 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * @@ -181,9 +180,9 @@ gtk_hpaned_size_allocate (GtkWidget *widget, /* Move the handle before the children so we don't get extra expose events */ paned->handle_xpos = paned->child1_size + border_width; - paned->handle_ypos = 0; + paned->handle_ypos = border_width; paned->handle_width = paned->handle_size; - paned->handle_height = widget->allocation.height; + paned->handle_height = widget->allocation.height - 2 * border_width; if (GTK_WIDGET_REALIZED (widget)) { @@ -253,74 +252,19 @@ gtk_hpaned_draw (GtkWidget *widget, if (gdk_rectangle_intersect (&handle_area, area, &child_area)) { - if (widget->allocation.height > 2) - { - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_size/2, - paned->handle_height/2); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_size/2 - 1, - paned->handle_height/2 - 1); - } - if (widget->allocation.height > 11) - { - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_size/2, - paned->handle_height/2 + 5); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_size/2 - 1, - paned->handle_height/2 + 4); - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_size/2, - paned->handle_height/2 - 5); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_size/2 - 1, - paned->handle_height/2 - 6); - } - if (widget->allocation.height > 20) - { - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_size/2, - paned->handle_height/2 - 10); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_size/2 - 1, - paned->handle_height/2 - 11); - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_size/2, - paned->handle_height/2 + 10); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_size/2 - 1, - paned->handle_height/2 + 9); - } - if (widget->allocation.height > 30) - { - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_size/2, - paned->handle_height/2 - 15); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_size/2 - 1, - paned->handle_height/2 - 16); - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_size/2, - paned->handle_height/2 + 15); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_size/2 - 1, - paned->handle_height/2 + 14); - } + child_area.x -= paned->handle_xpos; + child_area.y -= paned->handle_ypos; + + gtk_paint_handle (widget->style, + paned->handle, + GTK_STATE_NORMAL, + GTK_SHADOW_NONE, + &child_area, + widget, + "paned", + 0, 0, -1, -1, + GTK_ORIENTATION_VERTICAL); + } /* Redraw the children */ diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 40e6e61b1..1efb032ee 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -3079,6 +3079,33 @@ gtk_default_draw_slider (GtkStyle *style, width - style->klass->xthickness - 1, height / 2); } +static void +draw_dot (GdkWindow *window, + GdkGC *light_gc, + GdkGC *dark_gc, + gint x, + gint y, + gushort size) +{ + + size = CLAMP (size, 2, 3); + + if (size == 2) + { + gdk_draw_point (window, light_gc, x, y); + gdk_draw_point (window, light_gc, x+1, y+1); + } + else if (size == 3); + { + gdk_draw_point (window, light_gc, x, y); + gdk_draw_point (window, light_gc, x+1, y); + gdk_draw_point (window, light_gc, x, y+1); + gdk_draw_point (window, dark_gc, x+1, y+2); + gdk_draw_point (window, dark_gc, x+2, y+1); + gdk_draw_point (window, dark_gc, x+2, y+2); + } +} + static void gtk_default_draw_handle (GtkStyle *style, GdkWindow *window, @@ -3113,11 +3140,24 @@ gtk_default_draw_handle (GtkStyle *style, gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); - light_gc = style->light_gc[state_type]; - dark_gc = style->dark_gc[state_type]; - - xthick = style->klass->xthickness; - ythick = style->klass->ythickness; + + if (!strcmp (detail, "paned")) + { + /* we want to ignore the shadow border in paned widgets */ + xthick = 0; + ythick = 0; + + light_gc = style->light_gc[state_type]; + dark_gc = style->black_gc; + } + else + { + xthick = style->klass->xthickness; + ythick = style->klass->ythickness; + + light_gc = style->light_gc[state_type]; + dark_gc = style->dark_gc[state_type]; + } rect.x = x + xthick; rect.y = y + ythick; @@ -3125,7 +3165,7 @@ gtk_default_draw_handle (GtkStyle *style, rect.height = height - (ythick * 2); if (area) - intersect = gdk_rectangle_intersect (area, &rect, &dest); + intersect = gdk_rectangle_intersect (area, &rect, &dest); else { intersect = TRUE; @@ -3135,24 +3175,35 @@ gtk_default_draw_handle (GtkStyle *style, if (!intersect) return; -#define DRAW_POINT(w, gc, clip, xx, yy) \ - { \ - if ((xx) >= (clip).x \ - && (yy) >= (clip).y \ - && (xx) < (clip).x + (clip).width \ - && (yy) < (clip).y + (clip).height) \ - gdk_draw_point ((w), (gc), (xx), (yy)); \ - } - - for (yy = y + ythick; yy < (y + height - ythick); yy += 3) - for (xx = x + xthick; xx < (x + width - xthick); xx += 6) - { - DRAW_POINT (window, light_gc, dest, xx, yy); - DRAW_POINT (window, dark_gc, dest, xx + 1, yy + 1); - - DRAW_POINT (window, light_gc, dest, xx + 3, yy + 1); - DRAW_POINT (window, dark_gc, dest, xx + 4, yy + 2); - } + gdk_gc_set_clip_rectangle (light_gc, &dest); + gdk_gc_set_clip_rectangle (dark_gc, &dest); + + if (!strcmp (detail, "paned")) + { + gint window_width; + gint window_height; + + gdk_window_get_size (window, &window_width, &window_height); + + if (orientation == GTK_ORIENTATION_HORIZONTAL) + for (xx = window_width/2 - 15; xx <= window_width/2 + 15; xx += 5) + draw_dot (window, light_gc, dark_gc, xx, window_height/2 - 1, 3); + else + for (yy = window_height/2 - 15; yy <= window_height/2 + 15; yy += 5) + draw_dot (window, light_gc, dark_gc, window_width/2 - 1, yy, 3); + } + else + { + for (yy = y + ythick; yy < (y + height - ythick); yy += 3) + for (xx = x + xthick; xx < (x + width - xthick); xx += 6) + { + draw_dot (window, light_gc, dark_gc, xx, yy, 2); + draw_dot (window, light_gc, dark_gc, xx + 3, yy + 1, 2); + } + } + + gdk_gc_set_clip_rectangle (light_gc, NULL); + gdk_gc_set_clip_rectangle (dark_gc, NULL); } static void diff --git a/gtk/gtkvpaned.c b/gtk/gtkvpaned.c index 30b3ac4fa..6a7e113e1 100644 --- a/gtk/gtkvpaned.c +++ b/gtk/gtkvpaned.c @@ -179,9 +179,9 @@ gtk_vpaned_size_allocate (GtkWidget *widget, /* Move the handle before the children so we don't get extra expose events */ - paned->handle_xpos = 0; + paned->handle_xpos = border_width; paned->handle_ypos = paned->child1_size + border_width; - paned->handle_width = widget->allocation.width; + paned->handle_width = widget->allocation.width - 2 * border_width; paned->handle_height = paned->handle_size; if (GTK_WIDGET_REALIZED(widget)) @@ -247,79 +247,24 @@ gtk_vpaned_draw (GtkWidget *widget, handle_area.x = paned->handle_xpos; handle_area.y = paned->handle_ypos; - handle_area.width = paned->handle_height; + handle_area.width = paned->handle_width; handle_area.height = paned->handle_size; if (gdk_rectangle_intersect (&handle_area, area, &child_area)) { - if (widget->allocation.height > 2) - { - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_width/2, - paned->handle_size/2); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_width/2 - 1, - paned->handle_size/2 - 1); - } - if (widget->allocation.height > 11) - { - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_width/2 + 5, - paned->handle_size/2); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_width/2 + 4, - paned->handle_size/2 - 1); - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_width/2 - 5, - paned->handle_size/2); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_width/2 - 6, - paned->handle_size/2 - 1); - } - if (widget->allocation.height > 20) - { - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_width/2 - 10, - paned->handle_size/2); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_width/2 - 11, - paned->handle_size/2 - 1); - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_width/2 + 10, - paned->handle_size/2); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_width/2 + 9, - paned->handle_size/2 - 1); - } - if (widget->allocation.height > 30) - { - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_width/2 - 15, - paned->handle_size/2); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_width/2 - 16, - paned->handle_size/2 - 1); - gdk_draw_point (paned->handle, - widget->style->fg_gc[GTK_STATE_NORMAL], - paned->handle_width/2 + 15, - paned->handle_size/2); - gdk_draw_point (paned->handle, - widget->style->bg_gc[GTK_STATE_PRELIGHT], - paned->handle_width/2 + 14, - paned->handle_size/2 - 1); - } + child_area.x -= paned->handle_xpos; + child_area.y -= paned->handle_ypos; + + gtk_paint_handle (widget->style, + paned->handle, + GTK_STATE_NORMAL, + GTK_SHADOW_NONE, + &child_area, + widget, + "paned", + 0, 0, -1, -1, + GTK_ORIENTATION_HORIZONTAL); + } /* Redraw the children */ |