From b985ba8b0415b3082bd32657ff5158282bc652a7 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Thu, 19 Apr 2001 10:06:33 +0000 Subject: [PATCH] * src/register/gnome/gnucash-item-edit.c (item_edit_draw_info): fix some left-right scrolling glitches git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3996 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 3 +++ src/register/gnome/gnucash-item-edit.c | 33 +++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d5e94bfc40..278d173afc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2001-04-19 Dave Peticolas + * src/register/gnome/gnucash-item-edit.c (item_edit_draw_info): fix + some left-right scrolling glitches + * src/gnome/dialog-tax-info.c: implement tax info api * src/gnome/account-tree.c: same as below diff --git a/src/register/gnome/gnucash-item-edit.c b/src/register/gnome/gnucash-item-edit.c index 24f37da58b..55f47623d6 100644 --- a/src/register/gnome/gnucash-item-edit.c +++ b/src/register/gnome/gnucash-item-edit.c @@ -140,6 +140,7 @@ item_edit_draw_info (ItemEdit *item_edit, int x, int y, TextDrawInfo *info) SheetBlock *block; SheetBlockStyle *style; GtkEditable *editable; + CellAlignment align; Table *table; gboolean hatching; @@ -219,7 +220,9 @@ item_edit_draw_info (ItemEdit *item_edit, int x, int y, TextDrawInfo *info) info->text_rect.width = wd - toggle_space; info->text_rect.height = hd - 2; - switch (gnc_table_get_align (table, item_edit->virt_loc)) + align = gnc_table_get_align (table, item_edit->virt_loc); + + switch (align) { case CELL_ALIGN_RIGHT: xoffset = info->text_rect.width - @@ -247,6 +250,34 @@ item_edit_draw_info (ItemEdit *item_edit, int x, int y, TextDrawInfo *info) xoffset = CELL_HPADDING - pre_cursor_width; } + switch (align) + { + case CELL_ALIGN_RIGHT: + if (xoffset > CELL_HPADDING && + xoffset + total_width > + info->text_rect.width - CELL_HPADDING) + xoffset = MAX (CELL_HPADDING, + (info->text_rect.width - + CELL_HPADDING) - total_width); + + if (xoffset + total_width < + info->text_rect.width - CELL_HPADDING) + xoffset = (info->text_rect.width - + CELL_HPADDING) - total_width; + + break; + + default: + xoffset = MIN (xoffset, CELL_HPADDING); + + if (xoffset < CELL_HPADDING && + xoffset + total_width < + info->text_rect.width - CELL_HPADDING) + xoffset = MIN (CELL_HPADDING, + (info->text_rect.width - + CELL_HPADDING) - total_width); + } + info->text_x1 = dx + xoffset; info->text_x2 = info->text_x1 + width_1; info->text_x3 = info->text_x2 + width_2;