mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13692 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
5aa2cc3552
commit
974f037a11
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2006-03-24 Andreas Köhler <andi5.py@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@employees.org>
|
||||
|
||||
* numerous: Regularize capitalization of the word 'GnuCash' where
|
||||
|
@ -527,7 +527,7 @@ draw_cell (GnucashGrid *grid,
|
||||
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);
|
||||
|
@ -263,7 +263,7 @@ gnc_item_edit_draw_info (GncItemEdit *item_edit, int x, int y, TextDrawInfo *inf
|
||||
// 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 @@ gnc_item_edit_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
|
||||
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);
|
||||
|
||||
|
@ -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 ())
|
||||
|
@ -152,8 +152,8 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
|
||||
/* 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 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
|
||||
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 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
|
||||
|
||||
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 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
|
||||
{
|
||||
cd = g_table_index (dimensions->cell_dimensions,
|
||||
row, col);
|
||||
cd->pixel_height = max_height;
|
||||
}
|
||||
}
|
||||
cd->pixel_height = max_height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user