remove accidentally committed debugging spew

Mon Jul  7 16:50:32 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtk/gtkcellrenderertext.c
	(gtk_cell_renderer_text_class_init): remove accidentally committed
	debugging spew

	* gtk/gtktoolbar.c
	(gtk_toolbar_paint_space_line): remove this function
	(gtk_toolbar_expose): always propagate expose, even if the item is
	a separator item

	* gtk/gtkseparatortoolitem.c
	(gtk_separator_tool_item_expose): moved here from gtktoolbar.c
	(get_space_size): new function.
	(get_space_style): new function
This commit is contained in:
Soeren Sandmann 2003-07-07 14:35:31 +00:00 committed by Søren Sandmann Pedersen
parent c084f54145
commit 71ff822803
8 changed files with 181 additions and 64 deletions

View File

@ -1,3 +1,19 @@
Mon Jul 7 16:50:32 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_class_init): remove accidentally committed
debugging spew
* gtk/gtktoolbar.c
(gtk_toolbar_paint_space_line): remove this function
(gtk_toolbar_expose): always propagate expose, even if the item is
a separator item
* gtk/gtkseparatortoolitem.c
(gtk_separator_tool_item_expose): moved here from gtktoolbar.c
(get_space_size): new function.
(get_space_style): new function
Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com> Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (_gtk_drag_source_handle_event) * gtk/gtkdnd.c (_gtk_drag_source_handle_event)

View File

@ -1,3 +1,19 @@
Mon Jul 7 16:50:32 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_class_init): remove accidentally committed
debugging spew
* gtk/gtktoolbar.c
(gtk_toolbar_paint_space_line): remove this function
(gtk_toolbar_expose): always propagate expose, even if the item is
a separator item
* gtk/gtkseparatortoolitem.c
(gtk_separator_tool_item_expose): moved here from gtktoolbar.c
(get_space_size): new function.
(get_space_style): new function
Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com> Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (_gtk_drag_source_handle_event) * gtk/gtkdnd.c (_gtk_drag_source_handle_event)

View File

@ -1,3 +1,19 @@
Mon Jul 7 16:50:32 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_class_init): remove accidentally committed
debugging spew
* gtk/gtktoolbar.c
(gtk_toolbar_paint_space_line): remove this function
(gtk_toolbar_expose): always propagate expose, even if the item is
a separator item
* gtk/gtkseparatortoolitem.c
(gtk_separator_tool_item_expose): moved here from gtktoolbar.c
(get_space_size): new function.
(get_space_style): new function
Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com> Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (_gtk_drag_source_handle_event) * gtk/gtkdnd.c (_gtk_drag_source_handle_event)

View File

@ -1,3 +1,19 @@
Mon Jul 7 16:50:32 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_class_init): remove accidentally committed
debugging spew
* gtk/gtktoolbar.c
(gtk_toolbar_paint_space_line): remove this function
(gtk_toolbar_expose): always propagate expose, even if the item is
a separator item
* gtk/gtkseparatortoolitem.c
(gtk_separator_tool_item_expose): moved here from gtktoolbar.c
(get_space_size): new function.
(get_space_style): new function
Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com> Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (_gtk_drag_source_handle_event) * gtk/gtkdnd.c (_gtk_drag_source_handle_event)

View File

@ -1,3 +1,19 @@
Mon Jul 7 16:50:32 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_class_init): remove accidentally committed
debugging spew
* gtk/gtktoolbar.c
(gtk_toolbar_paint_space_line): remove this function
(gtk_toolbar_expose): always propagate expose, even if the item is
a separator item
* gtk/gtkseparatortoolitem.c
(gtk_separator_tool_item_expose): moved here from gtktoolbar.c
(get_space_size): new function.
(get_space_style): new function
Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com> Sun Jul 6 13:00:20 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (_gtk_drag_source_handle_event) * gtk/gtkdnd.c (_gtk_drag_source_handle_event)

View File

@ -201,7 +201,6 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
NULL, NULL,
G_PARAM_WRITABLE)); G_PARAM_WRITABLE));
g_print ("installing background gdk\n");
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_BACKGROUND_GDK, PROP_BACKGROUND_GDK,
g_param_spec_boxed ("background_gdk", g_param_spec_boxed ("background_gdk",

View File

@ -19,14 +19,28 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#undef GTK_DISABLE_DEPRECATED
#include "gtkseparatormenuitem.h" #include "gtkseparatormenuitem.h"
#include "gtkseparatortoolitem.h" #include "gtkseparatortoolitem.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtktoolbar.h"
static void gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass*class); /* note: keep in sync with DEFAULT_SPACE_SIZE and DEFAULT_SPACE_STYLE in gtktoolbar.c */
#define DEFAULT_SPACE_SIZE 5
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
static void gtk_separator_tool_item_add (GtkContainer *container, #define SPACE_LINE_DIVISION 10
GtkWidget *child); #define SPACE_LINE_START 3
#define SPACE_LINE_END 7
static void gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class);
static gboolean gtk_separator_tool_item_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_separator_tool_item_add (GtkContainer *container,
GtkWidget *child);
static GtkToolbarSpaceStyle get_space_style (GtkToolItem *tool_item);
static gint get_space_size (GtkToolItem *tool_item);
static GObjectClass *parent_class = NULL; static GObjectClass *parent_class = NULL;
@ -57,17 +71,52 @@ gtk_separator_tool_item_get_type (void)
return type; return type;
} }
static GtkToolbarSpaceStyle
get_space_style (GtkToolItem *tool_item)
{
GtkToolbarSpaceStyle space_style = DEFAULT_SPACE_STYLE;
GtkWidget *parent = GTK_WIDGET (tool_item)->parent;
if (GTK_IS_TOOLBAR (parent))
{
gtk_widget_style_get (parent,
"space_style", &space_style,
NULL);
}
return space_style;
}
static gint
get_space_size (GtkToolItem *tool_item)
{
gint space_size = DEFAULT_SPACE_SIZE;
GtkWidget *parent = GTK_WIDGET (tool_item)->parent;
if (GTK_IS_TOOLBAR (parent))
{
gtk_widget_style_get (parent,
"space_size", &space_size,
NULL);
}
return space_size;
}
static void static void
gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class) gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
{ {
GtkContainerClass *container_class; GtkContainerClass *container_class;
GtkToolItemClass *toolitem_class; GtkToolItemClass *toolitem_class;
GtkWidgetClass *widget_class;
parent_class = g_type_class_peek_parent (class); parent_class = g_type_class_peek_parent (class);
container_class = (GtkContainerClass *)class; container_class = (GtkContainerClass *)class;
toolitem_class = (GtkToolItemClass *)class; toolitem_class = (GtkToolItemClass *)class;
widget_class = (GtkWidgetClass *)class;
widget_class->expose_event = gtk_separator_tool_item_expose;
container_class->add = gtk_separator_tool_item_add; container_class->add = gtk_separator_tool_item_add;
} }
@ -78,6 +127,50 @@ gtk_separator_tool_item_add (GtkContainer *container,
g_warning("attempt to add a child to an GtkSeparatorToolItem"); g_warning("attempt to add a child to an GtkSeparatorToolItem");
} }
static gboolean
gtk_separator_tool_item_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkToolItem *tool_item = GTK_TOOL_ITEM (widget);
gint space_size;
GtkAllocation *allocation;
GtkOrientation orientation;
GdkRectangle *area;
if (get_space_style (tool_item) == GTK_TOOLBAR_SPACE_LINE)
{
space_size = get_space_size (tool_item);
allocation = &(widget->allocation);
orientation = gtk_tool_item_get_orientation (tool_item);
area = &(event->area);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_paint_vline (widget->style, widget->window,
GTK_WIDGET_STATE (widget), area, widget,
"separator_tool_item",
allocation->y + allocation->height *
SPACE_LINE_START / SPACE_LINE_DIVISION,
allocation->y + allocation->height *
SPACE_LINE_END / SPACE_LINE_DIVISION,
allocation->x + (space_size - widget->style->xthickness) / 2);
}
else if (orientation == GTK_ORIENTATION_VERTICAL)
{
gtk_paint_hline (widget->style, widget->window,
GTK_WIDGET_STATE (widget), area, widget,
"separator_tool_item",
allocation->x + allocation->width *
SPACE_LINE_START / SPACE_LINE_DIVISION,
allocation->x + allocation->width *
SPACE_LINE_END / SPACE_LINE_DIVISION,
allocation->y + (space_size - widget->style->ythickness) / 2);
}
}
return TRUE;
}
GtkToolItem * GtkToolItem *
gtk_separator_tool_item_new (void) gtk_separator_tool_item_new (void)
{ {

View File

@ -49,16 +49,14 @@
#include <string.h> #include <string.h>
#define DEFAULT_IPADDING 0 #define DEFAULT_IPADDING 0
/* note: keep in sync with DEFAULT_SPACE_SIZE and DEFAULT_SPACE_STYLE in gtkseparatortoolitem.c */
#define DEFAULT_SPACE_SIZE 5 #define DEFAULT_SPACE_SIZE 5
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE #define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR #define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
#define DEFAULT_TOOLBAR_STYLE GTK_TOOLBAR_BOTH #define DEFAULT_TOOLBAR_STYLE GTK_TOOLBAR_BOTH
#define SPACE_LINE_DIVISION 10
#define SPACE_LINE_START 3
#define SPACE_LINE_END 7
enum { enum {
PROP_0, PROP_0,
PROP_ORIENTATION, PROP_ORIENTATION,
@ -164,7 +162,6 @@ static void gtk_toolbar_arrow_button_clicked (GtkWidget *bu
static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar); static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar);
static GtkReliefStyle get_button_relief (GtkToolbar *toolbar); static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
static gint get_space_size (GtkToolbar *toolbar); static gint get_space_size (GtkToolbar *toolbar);
static GtkToolbarSpaceStyle get_space_style (GtkToolbar *toolbar);
static gint get_internal_padding (GtkToolbar *toolbar); static gint get_internal_padding (GtkToolbar *toolbar);
static void gtk_toolbar_remove_tool_item (GtkToolbar *toolbar, static void gtk_toolbar_remove_tool_item (GtkToolbar *toolbar,
GtkToolItem *item); GtkToolItem *item);
@ -638,42 +635,6 @@ gtk_toolbar_unmap (GtkWidget *widget)
GTK_WIDGET_CLASS (parent_class)->unmap (widget); GTK_WIDGET_CLASS (parent_class)->unmap (widget);
} }
static void
gtk_toolbar_paint_space_line (GtkWidget *widget,
GdkRectangle *area,
GtkToolItem *item)
{
GtkToolbar *toolbar;
GtkAllocation *allocation;
gint space_size;
g_return_if_fail (GTK_BIN (item)->child == NULL);
toolbar = GTK_TOOLBAR (widget);
allocation = &GTK_WIDGET (item)->allocation;
space_size = get_space_size (toolbar);
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_paint_vline (widget->style, widget->window,
GTK_WIDGET_STATE (widget), area, widget,
"toolbar",
allocation->y + allocation->height *
SPACE_LINE_START / SPACE_LINE_DIVISION,
allocation->y + allocation->height *
SPACE_LINE_END / SPACE_LINE_DIVISION,
allocation->x + (space_size-widget->style->xthickness)/2);
else if (toolbar->orientation == GTK_ORIENTATION_VERTICAL)
gtk_paint_hline (widget->style, widget->window,
GTK_WIDGET_STATE (widget), area, widget,
"toolbar",
allocation->x + allocation->width *
SPACE_LINE_START / SPACE_LINE_DIVISION,
allocation->x + allocation->width *
SPACE_LINE_END / SPACE_LINE_DIVISION,
allocation->y + (space_size-widget->style->ythickness)/2);
}
static void static void
gtk_toolbar_realize (GtkWidget *widget) gtk_toolbar_realize (GtkWidget *widget)
{ {
@ -773,12 +734,9 @@ gtk_toolbar_expose (GtkWidget *widget,
{ {
GtkToolItem *item = GTK_TOOL_ITEM (items->data); GtkToolItem *item = GTK_TOOL_ITEM (items->data);
if (GTK_BIN (item)->child) gtk_container_propagate_expose (GTK_CONTAINER (widget),
gtk_container_propagate_expose (GTK_CONTAINER (widget), GTK_WIDGET (item),
GTK_WIDGET (item), event);
event);
else if (GTK_WIDGET_MAPPED (item) && get_space_style (toolbar) == GTK_TOOLBAR_SPACE_LINE)
gtk_toolbar_paint_space_line (widget, &event->area, item);
items = items->next; items = items->next;
} }
@ -2053,19 +2011,6 @@ get_space_size (GtkToolbar *toolbar)
return space_size; return space_size;
} }
static GtkToolbarSpaceStyle
get_space_style (GtkToolbar *toolbar)
{
GtkToolbarSpaceStyle space_style = DEFAULT_SPACE_STYLE;
gtk_widget_style_get (GTK_WIDGET (toolbar),
"space_style", &space_style,
NULL);
return space_style;
}
static gint static gint
get_internal_padding (GtkToolbar *toolbar) get_internal_padding (GtkToolbar *toolbar)
{ {