[Gnucash-changes] r13692 - gnucash/trunk - Add vertical padding in register cells and align text, editable text and the text cursor vertically. This makes the cells taller and centers the text. Add one pixel to the horizontal padding.

Andreas Köhler andi5 at cvs.gnucash.org
Thu Mar 23 19:09:03 EST 2006


Author: andi5
Date: 2006-03-23 19:09:02 -0500 (Thu, 23 Mar 2006)
New Revision: 13692
Trac: http://svn.gnucash.org/trac/changeset/13692

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/register/register-gnome/gnucash-grid.c
   gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c
   gnucash/trunk/src/register/register-gnome/gnucash-sheet.h
   gnucash/trunk/src/register/register-gnome/gnucash-style.c
Log:
Add vertical padding in register cells and align text, editable text and the text cursor vertically. This makes the cells taller and centers the text. Add one pixel to the horizontal padding.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-23 21:40:12 UTC (rev 13691)
+++ gnucash/trunk/ChangeLog	2006-03-24 00:09:02 UTC (rev 13692)
@@ -1,3 +1,13 @@
+2006-03-24  Andreas Köhler  <andi5.py at gmx.net>
+
+	* src/register/register-gnome/gnucash-grid.c:
+	* src/register/register-gnome/gnucash-item-edit.c:
+	* src/register/register-gnome/gnucash-sheet.h:
+	* src/register/register-gnome/gnucash-style.c: Add vertical
+	  padding in register cells and align text, editable text and the
+	  text cursor vertically. This makes the cells taller and centers
+	  the text. Add one pixel to the horizontal padding.
+
 2006-03-23  David Hampton  <hampton at employees.org>
 
 	* numerous: Regularize capitalization of the word 'GnuCash' where

Modified: gnucash/trunk/src/register/register-gnome/gnucash-grid.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-grid.c	2006-03-23 21:40:12 UTC (rev 13691)
+++ gnucash/trunk/src/register/register-gnome/gnucash-grid.c	2006-03-24 00:09:02 UTC (rev 13692)
@@ -527,7 +527,7 @@
         gdk_draw_layout (drawable,
                          grid->gc,
                          x + CELL_HPADDING + x_offset,
-                         y + 1,
+                         y + CELL_VPADDING + 1,
                          layout);
 
         gdk_gc_set_clip_rectangle (grid->gc, NULL);

Modified: gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c	2006-03-23 21:40:12 UTC (rev 13691)
+++ gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c	2006-03-24 00:09:02 UTC (rev 13692)
@@ -263,7 +263,7 @@
         // pango_layout_set_ellipsize(...) as of pango 1.6 may be useful for
         // strings longer than the field width.
 
-	pango_layout_get_cursor_pos (info->layout, cursor_byte_pos, &strong_pos, NULL);
+        pango_layout_get_cursor_pos (info->layout, cursor_byte_pos, &strong_pos, NULL);
 
         info->cursor_rect.x = dx + PANGO_PIXELS (strong_pos.x);
         info->cursor_rect.y = dy + PANGO_PIXELS (strong_pos.y);
@@ -323,19 +323,18 @@
 
         gdk_gc_set_foreground (item_edit->gc, info.fg_color);
 
-	gdk_draw_layout (drawable,
-			 item_edit->gc,
-			 info.text_rect.x + CELL_HPADDING + 
-			 item_edit->x_offset,
-			 info.text_rect.y + 1,
-			 info.layout);
+        gdk_draw_layout (drawable,
+                         item_edit->gc,
+                         info.text_rect.x + CELL_HPADDING + item_edit->x_offset,
+                         info.text_rect.y + CELL_VPADDING,
+                         info.layout);
 
         gdk_draw_line (drawable,
                        item_edit->gc,
                        info.cursor_rect.x + CELL_HPADDING + item_edit->x_offset,
-                       info.cursor_rect.y,
+                       info.cursor_rect.y + CELL_VPADDING,
                        info.cursor_rect.x + CELL_HPADDING + item_edit->x_offset,
-                       info.cursor_rect.y + info.cursor_rect.height);
+                       info.cursor_rect.y + CELL_VPADDING + info.cursor_rect.height);
 
         gdk_gc_set_clip_rectangle (item_edit->gc, NULL);
 

Modified: gnucash/trunk/src/register/register-gnome/gnucash-sheet.h
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-sheet.h	2006-03-23 21:40:12 UTC (rev 13691)
+++ gnucash/trunk/src/register/register-gnome/gnucash-sheet.h	2006-03-24 00:09:02 UTC (rev 13692)
@@ -28,7 +28,7 @@
 #include "table-allgui.h"
 
 #define CELL_VPADDING 3
-#define CELL_HPADDING 4
+#define CELL_HPADDING 5
 
 
 #define GNUCASH_TYPE_REGISTER     (gnucash_register_get_type ())

Modified: gnucash/trunk/src/register/register-gnome/gnucash-style.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-style.c	2006-03-23 21:40:12 UTC (rev 13691)
+++ gnucash/trunk/src/register/register-gnome/gnucash-style.c	2006-03-24 00:09:02 UTC (rev 13692)
@@ -152,8 +152,8 @@
         /* GdkFont *font = GNUCASH_GRID(sheet->grid)->normal_font; */
         CellDimensions *cd;
         int row, col;
-	gint default_height = 0, max_height = -1;
-	PangoLayout *layout;
+        gint max_height = -1;
+        PangoLayout *layout;
 
         /* g_return_if_fail (font != NULL); */
 
@@ -168,11 +168,6 @@
                         cd = g_table_index (dimensions->cell_dimensions,
                                             row, col);
 
-                        /*cd->pixel_height = (font->ascent + font->descent +
-                                            (2 * CELL_VPADDING));*/
-			/* cd->pixel_height = (2 * CELL_VPADDING); */
-
-
                         cell = gnc_cellblock_get_cell (cursor, row, col);
                         if (!cell)
                                 continue;
@@ -183,25 +178,19 @@
 
                         if (text)
                         {
-				layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet), text);
-                                /* width = gdk_string_width (font, text); */
-				cd->pixel_height = 0;
-				pango_layout_get_pixel_size (layout, &width, &cd->pixel_height);
-				g_object_unref (layout);
+                                layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet), text);
+                                pango_layout_get_pixel_size (layout, &width, &cd->pixel_height);
+                                g_object_unref (layout);
                                 width += 2 * CELL_HPADDING;
+                                cd->pixel_height += 2 * CELL_VPADDING;
                         }
                         else
-			{
+                        {
                                 width = 0;
-				cd->pixel_height = (2 * CELL_VPADDING);
-			}
+                                cd->pixel_height = (2 * CELL_VPADDING);
+                        }
 
-			if (default_height == 0)
-				default_height = cd->pixel_height;
-			if (max_height < 0)
-				max_height = cd->pixel_height;
-			else
-				max_height = MAX(max_height, cd->pixel_height);
+                        max_height = MAX(max_height, cd->pixel_height);
 
                         if (cd->pixel_width > 0)
                                 continue;
@@ -223,9 +212,9 @@
                 {
                         cd = g_table_index (dimensions->cell_dimensions,
                                             row, col);
-			cd->pixel_height = max_height;
-		}
-	}
+                        cd->pixel_height = max_height;
+                }
+        }
 }
 
 



More information about the gnucash-changes mailing list