X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fgtk-contrib%2Fgtkxpaned.c;h=7b30bfa1f58b3ab26486dd2dc8d08546ac2a7d9b;hb=0fe886a656b0ee57b4d542b7c16b3c56288b6fc6;hp=e350295a3e3f40bbcf687ca3f3bcf7438bec217c;hpb=14aac9fe7a7efbb6c9bded2ed5969a643cb76645;p=pspp diff --git a/lib/gtk-contrib/gtkxpaned.c b/lib/gtk-contrib/gtkxpaned.c index e350295a3e..7b30bfa1f5 100644 --- a/lib/gtk-contrib/gtkxpaned.c +++ b/lib/gtk-contrib/gtkxpaned.c @@ -3,6 +3,7 @@ ** 10 20 30 40 50 60 70 80 ** ** library for GtkXPaned-widget, a 2x2 grid-like variation of GtkPaned of gtk+ +** Copyright (C) 2012 Free Software Foundation, Inc. ** Copyright (C) 2005-2006 Mirco "MacSlow" Müller ** ** This library is free software; you can redistribute it and/or @@ -31,12 +32,11 @@ #include #include "gtkxpaned.h" + +#include #include -#include -#include #include -#include -#include + enum WidgetProperties { @@ -660,7 +660,7 @@ static void gtk_xpaned_size_request (GtkWidget* widget, requisition->width = 0; requisition->height = 0; - if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child)) + if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child)) { gtk_widget_size_request (xpaned->top_left_child, &child_requisition); @@ -668,7 +668,7 @@ static void gtk_xpaned_size_request (GtkWidget* widget, requisition->height = child_requisition.height; } - if (xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child)) + if (xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child)) { gtk_widget_size_request (xpaned->top_right_child, &child_requisition); @@ -676,7 +676,7 @@ static void gtk_xpaned_size_request (GtkWidget* widget, requisition->height = MAX (requisition->height, child_requisition.height); } - if (xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child)) + if (xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child)) { gtk_widget_size_request (xpaned->bottom_left_child, &child_requisition); @@ -684,12 +684,12 @@ static void gtk_xpaned_size_request (GtkWidget* widget, requisition->height += child_requisition.height; } - if (xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child)) + if (xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child)) { gtk_widget_size_request (xpaned->bottom_right_child, &child_requisition); - requisition->width = MAX (requisition->width, child_requisition.width); - requisition->height = MAX (requisition->height, child_requisition.height); + requisition->width = child_requisition.width; + requisition->height = child_requisition.height; } /* add 2 times the set border-width to the GtkXPaneds requisition */ @@ -697,10 +697,10 @@ static void gtk_xpaned_size_request (GtkWidget* widget, requisition->height += GTK_CONTAINER (xpaned)->border_width * 2; /* also add the handle "thickness" to GtkXPaneds width- and height-requisitions */ - if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) && - xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) && - xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) && - xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child)) + if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) && + xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) && + xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) && + xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child)) { gint handle_size; @@ -739,10 +739,10 @@ static void gtk_xpaned_size_allocate (GtkWidget* widget, widget->allocation = *allocation; - if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) && - xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) && - xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) && - xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child)) + if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) && + xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) && + xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) && + xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child)) { /* what sizes do the children want to be at least at */ gtk_widget_get_child_requisition (xpaned->top_left_child, @@ -815,9 +815,9 @@ static void gtk_xpaned_size_allocate (GtkWidget* widget, bottom_right_child_allocation.width = xpaned->handle_pos_east.width; bottom_right_child_allocation.height = xpaned->handle_pos_south.height; - if (GTK_WIDGET_REALIZED (widget)) + if (gtk_widget_get_realized (widget)) { - if (GTK_WIDGET_MAPPED (widget)) + if (gtk_widget_get_mapped (widget)) { gdk_window_show (xpaned->handle_east); gdk_window_show (xpaned->handle_west); @@ -860,7 +860,7 @@ static void gtk_xpaned_size_allocate (GtkWidget* widget, /* Now allocate the childen, making sure, when resizing not to * overlap the windows */ - if (GTK_WIDGET_MAPPED (widget)) + if (gtk_widget_get_mapped (widget)) { gtk_widget_size_allocate (xpaned->top_right_child, &top_right_child_allocation); gtk_widget_size_allocate (xpaned->top_left_child, &top_left_child_allocation); @@ -1216,10 +1216,10 @@ static void gtk_xpaned_realize (GtkWidget* widget) widget->style = gtk_style_attach (widget->style, widget->window); - if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) && - xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) && - xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) && - xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child)) + if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) && + xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) && + xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) && + xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child)) { gdk_window_show (xpaned->handle_east); gdk_window_show (xpaned->handle_west); @@ -1325,11 +1325,11 @@ static gboolean gtk_xpaned_expose (GtkWidget* widget, /* I want the handle-"thickness" to be at least 3 */ g_assert (handle_size >= 3); - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) && - xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) && - xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) && - xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) && - xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child)) + if (gtk_widget_get_visible (widget) && gtk_widget_get_mapped (widget) && + xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) && + xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) && + xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) && + xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child)) { GtkStateType state; @@ -1338,7 +1338,7 @@ static gboolean gtk_xpaned_expose (GtkWidget* widget, else if (xpaned->handle_prelit) state = GTK_STATE_PRELIGHT; else - state = GTK_WIDGET_STATE (widget); + state = gtk_widget_get_state (widget); horizontalClipArea.x = xpaned->handle_pos_west.x; horizontalClipArea.y = xpaned->handle_pos_west.y; @@ -1930,7 +1930,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget) gboolean was_visible; xpaned = GTK_XPANED (container); - was_visible = GTK_WIDGET_VISIBLE (widget); + was_visible = gtk_widget_get_visible (widget); if (xpaned->top_left_child == widget) { @@ -1938,7 +1938,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget) xpaned->top_left_child = NULL; - if (was_visible && GTK_WIDGET_VISIBLE (container)) + if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container))) gtk_widget_queue_resize (GTK_WIDGET (container)); } else if (xpaned->top_right_child == widget) @@ -1947,7 +1947,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget) xpaned->top_right_child = NULL; - if (was_visible && GTK_WIDGET_VISIBLE (container)) + if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container))) gtk_widget_queue_resize (GTK_WIDGET (container)); } else if (xpaned->bottom_left_child == widget) @@ -1956,7 +1956,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget) xpaned->bottom_left_child = NULL; - if (was_visible && GTK_WIDGET_VISIBLE (container)) + if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container))) gtk_widget_queue_resize (GTK_WIDGET (container)); } else if (xpaned->bottom_right_child == widget) @@ -1965,7 +1965,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget) xpaned->bottom_right_child = NULL; - if (was_visible && GTK_WIDGET_VISIBLE (container)) + if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container))) gtk_widget_queue_resize (GTK_WIDGET (container)); } else @@ -2413,8 +2413,6 @@ gtk_xpaned_compute_position (GtkXPaned* xpaned, GdkPoint old_max_position; gint handle_size; gint border_width = GTK_CONTAINER (xpaned)->border_width; - float fX; - float fY; g_return_if_fail (GTK_IS_XPANED (xpaned)); @@ -2425,9 +2423,6 @@ gtk_xpaned_compute_position (GtkXPaned* xpaned, old_max_position.x = xpaned->max_position.x; old_max_position.y = xpaned->max_position.y; - fX = 100.0f * (float) old_position.x / (float) allocation->width; - fY = 100.0f * (float) old_position.y / (float) allocation->height; - xpaned->min_position.x = xpaned->top_left_child_shrink ? 0 : top_left_child_req->width; xpaned->min_position.y = xpaned->top_left_child_shrink ? 0 : top_left_child_req->height; @@ -2451,14 +2446,6 @@ gtk_xpaned_compute_position (GtkXPaned* xpaned, xpaned->top_left_child_size.width = top_left_child_req->width; xpaned->top_left_child_size.height = top_left_child_req->height; } - else if (top_left_child_req->width + top_right_child_req->width != 0) - { - xpaned->top_left_child_size.width = allocation->width * ((gdouble)top_left_child_req->width / (top_left_child_req->width + top_right_child_req->width)) + 0.5; - } - else if (top_left_child_req->height + top_right_child_req->height != 0) - { - xpaned->top_left_child_size.height = allocation->height * ((gdouble)top_left_child_req->height / (top_left_child_req->height + top_right_child_req->height)) + 0.5; - } else { xpaned->top_left_child_size.width = allocation->width * 0.5 + 0.5; @@ -2575,9 +2562,6 @@ gtk_xpaned_compute_position (GtkXPaned* xpaned, xpaned->last_allocation.width = allocation->width; xpaned->last_allocation.height = allocation->height; - - fX = 100.0f * (float) old_position.x / (float) allocation->width; - fY = 100.0f * (float) old_position.y / (float) allocation->height; } static void gtk_xpaned_set_saved_focus (GtkXPaned* xpaned, GtkWidget* widget) @@ -2668,7 +2652,7 @@ static GtkWidget* xpaned_get_focus_widget (GtkXPaned* xpaned) GtkWidget* toplevel; toplevel = gtk_widget_get_toplevel (GTK_WIDGET (xpaned)); - if (GTK_WIDGET_TOPLEVEL (toplevel)) + if (gtk_widget_is_toplevel (toplevel)) return GTK_WINDOW (toplevel)->focus_widget; return NULL; @@ -3059,7 +3043,7 @@ static void gtk_xpaned_restore_focus (GtkXPaned* xpaned) if (gtk_widget_is_focus (GTK_WIDGET (xpaned))) { if (xpaned->priv->saved_focus && - GTK_WIDGET_SENSITIVE (xpaned->priv->saved_focus)) + gtk_widget_get_sensitive (xpaned->priv->saved_focus)) { gtk_widget_grab_focus (xpaned->priv->saved_focus); }