[gtk+/extended-layout-jhs: 25/64] Make baseline alignment work, by ignoring the uniform height constraint a



commit 2f75edbe15b235962ac7dff380ff6261a06a5948
Author: Mathias Hasselmann <mathias hasselmann gmx de>
Date:   Sun Jul 1 09:23:44 2007 +0000

    Make baseline alignment work, by ignoring the uniform height constraint a
    
    2007-07-01  Mathias Hasselmann  <mathias hasselmann gmx de>
    
    	* gtk/gtkhbox.c: Make baseline alignment work, by ignoring the uniform
    	height constraint a GtkHBox implies. TODO: Obey that constraint.
    
    svn path=/branches/extended-layout/; revision=18321

 ChangeLog.gtk-extended-layout |    5 +++++
 gtk/gtkhbox.c                 |   24 +++++++++++++-----------
 2 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog.gtk-extended-layout b/ChangeLog.gtk-extended-layout
index 9ea3265..fc29b68 100644
--- a/ChangeLog.gtk-extended-layout
+++ b/ChangeLog.gtk-extended-layout
@@ -1,5 +1,10 @@
 2007-07-01  Mathias Hasselmann  <mathias hasselmann gmx de>
 
+	* gtk/gtkhbox.c: Make baseline alignment work, by ignoring the uniform
+	height constraint a GtkHBox implies. TODO: Obey that constraint.
+
+2007-07-01  Mathias Hasselmann  <mathias hasselmann gmx de>
+
 	* gtk/gtkhbox.c: Rudimentary implementation of GtkExtendLayout.
 
 2007-06-30  Mathias Hasselmann  <mathias hasselmann gmx de>
diff --git a/gtk/gtkhbox.c b/gtk/gtkhbox.c
index 62615f1..9540f48 100644
--- a/gtk/gtkhbox.c
+++ b/gtk/gtkhbox.c
@@ -350,7 +350,7 @@ gtk_hbox_size_allocate (GtkWidget     *widget,
 
       for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
         {
-          gint x, dy;
+          gint x;
 
           if (GTK_PACK_START == packing)
             x = allocation->x + GTK_CONTAINER (box)->border_width;
@@ -369,7 +369,7 @@ gtk_hbox_size_allocate (GtkWidget     *widget,
                   if ((child->pack == packing))
                     {
                       GtkRequisition child_requisition;
-                      gint child_width;
+                      gint child_width, dy;
 
                       gtk_widget_get_child_requisition (child->widget, &child_requisition);
 
@@ -416,20 +416,22 @@ gtk_hbox_size_allocate (GtkWidget     *widget,
                       if (GTK_TEXT_DIR_RTL == direction)
                         child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
 
-                      dy = MAX (0, (priv->effective_baseline - priv->baselines[i_child]));
 
-if (debug_wanted (child->widget))
-  g_debug("%s[%d:%s]: dy=%d, y=%d, height:%d", 
-    gtk_widget_get_name (widget), i_child, G_OBJECT_TYPE_NAME (child->widget), 
-    dy, child_allocation.y, child_allocation.height);
+                      if (GTK_BASELINE_NONE != priv->baseline_policy)
+                        {
+                          GtkRequisition child_requisition;
 
-                      child_allocation.y += dy;
-                      child_allocation.height -= dy;
+                          dy = MAX (0, (priv->effective_baseline - priv->baselines[i_child]));
+                          gtk_widget_size_request (child->widget, &child_requisition);
+
+                          child_allocation.y += dy;
+                          child_allocation.height = child_requisition.height;
+                        }
 
                       gtk_widget_size_allocate (child->widget, &child_allocation);
 
-                      child_allocation.height += dy;
-                      child_allocation.y -= dy;
+                      if (GTK_BASELINE_NONE != priv->baseline_policy)
+                        child_allocation.y -= dy;
 
                       if (GTK_PACK_START == packing)
                         x += child_width + box->spacing;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]