On Wed, Jul 25, 2007 at 08:52:40PM +0200, Maurice van der Pot wrote: > Kurt, can you check if this doesn't make things worse for you? You seem > to have determined the old value empirically. After trying it out with planner on Windows I can say that my earlier patch made matters worse there. I have a new version that works equally well on my Linux and Windows machines. As you can see in the following screenshot the resource text is vertically aligned perfectly with the task names in the task tree. http://griffon26.kfk4ever.com/~griffon26/planner_text_alignment.png The only difference is that on Windows there is more space above the text than there is below it. This may be just how text is rendered on Windows, I don't know. I don't think that it's worth investigating, do you? Best regards, Maurice. -- Maurice van der Pot Gentoo Linux Developer griffon26 gentoo org http://www.gentoo.org Creator of BiteMe! griffon26 kfk4ever com http://www.kfk4ever.com
Index: src/planner-gantt-row.c =================================================================== --- src/planner-gantt-row.c (revision 846) +++ src/planner-gantt-row.c (working copy) @@ -162,6 +162,7 @@ gdouble bar_top; /* Top y position of the bar. */ gdouble bar_bot; /* Bottom y position of the bar. */ gdouble text_width; + gdouble text_height; /* Cached positions of each assigned resource. */ GArray *resource_widths; @@ -493,7 +494,7 @@ { PlannerGanttRowPriv *priv; GnomeCanvasItem *item; - gint width; + gint width, height; mrptime t; MrpTaskType type; gdouble old_x, old_x_start, old_width; @@ -511,13 +512,14 @@ pango_layout_get_pixel_size (priv->layout, &width, - NULL); - + &height); + if (width > 0) { width += TEXT_PADDING; } priv->text_width = width; + priv->text_height = height; t = mrp_task_get_work_start (priv->task); priv->x = t * priv->scale; @@ -742,7 +744,7 @@ pango_layout_set_text (priv->layout, ", ", 2); pango_layout_get_extents (priv->layout, NULL, &rect); spacing = rect.width / PANGO_SCALE; - + x = 0; resources = mrp_task_get_assigned_resources (priv->task); @@ -1955,14 +1957,15 @@ rx2 = MIN (cx2 + TEXT_PADDING + priv->text_width, width); if (priv->layout != NULL && rx1 < rx2) { - /* NOTE: cy1 - priv->bar_top: report to the top of the cell, - + 3: is an empirical value to realign with task-tree result of the - default gtkcellrenderertext ypad property (2) + 1 ??? ;). */ + /* NOTE: cy1 is the pixel coordinate of the top of the bar. + subtract round(priv->bar_top) to bring us to the top of the row + add priv->height / 2 to get to the center of the row + subtract priv->text_height / 2 to get to the top of the text */ draw_cut_layout (drawable, GTK_WIDGET (item->canvas)->style->text_gc[GTK_STATE_NORMAL], cx2 + TEXT_PADDING, - cy1 - priv->bar_top + 3, + cy1 - (gint)(priv->bar_top + 0.5) + (priv->height - priv->text_height) / 2, priv->layout); if (priv->mouse_over_index != -1) {
Attachment:
pgpSLABQb4LXp.pgp
Description: PGP signature