2001-04-27 Dave Peticolas <dave@krondo.com>

* src/SplitLedger.c (xaccSRExpandCurrentTrans): if expanding
	a transaction, try to show all of it

	* src/register/table-gnome.c (gnc_table_show_range): new func

	* src/register/gnome/gnucash-sheet.c (gnucash_sheet_show_range):
	new func


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4075 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-04-27 10:25:35 +00:00
parent 4e58a9a9db
commit 002ec86337
6 changed files with 130 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2001-04-27 Dave Peticolas <dave@krondo.com>
* src/SplitLedger.c (xaccSRExpandCurrentTrans): if expanding
a transaction, try to show all of it
* src/register/table-gnome.c (gnc_table_show_range): new func
* src/register/gnome/gnucash-sheet.c (gnucash_sheet_show_range):
new func
2001-04-27 Christian Stimming <stimming@tuhh.de>
* src/scm/report/balance-sheet.scm: Added option to choose the

View File

@ -780,6 +780,37 @@ xaccSRExpandCurrentTrans (SplitRegister *reg, gboolean expand)
}
gnc_table_refresh_gui (reg->table, TRUE);
if (expand)
{
VirtualCellLocation start_loc;
VirtualCellLocation end_loc;
int v_row;
start_loc = reg->table->current_cursor_loc.vcell_loc;
end_loc = reg->table->current_cursor_loc.vcell_loc;
for (v_row = end_loc.virt_row + 1;
v_row < reg->table->num_virt_rows; v_row++)
{
VirtualCellLocation vc_loc = { v_row, 0 };
CursorClass cursor_class;
cursor_class = xaccSplitRegisterGetCursorClass (reg, vc_loc);
if (cursor_class == CURSOR_CLASS_TRANS)
break;
if (cursor_class != CURSOR_CLASS_SPLIT)
{
v_row--;
break;
}
}
end_loc.virt_row = MIN (v_row, reg->table->num_virt_rows - 1);
gnc_table_show_range (reg->table, start_loc, end_loc);
}
}
gboolean

View File

@ -414,7 +414,7 @@ gnucash_sheet_show_row (GnucashSheet *sheet, gint virt_row)
return;
if (y > cy)
y -= height - block_height;
y -= height - MIN (block_height, height);
if ((sheet->height - y) < height)
y = sheet->height - height;
@ -447,6 +447,63 @@ gnucash_sheet_make_cell_visible (GnucashSheet *sheet, VirtualLocation virt_loc)
}
void
gnucash_sheet_show_range (GnucashSheet *sheet,
VirtualCellLocation start_loc,
VirtualCellLocation end_loc)
{
SheetBlock *start_block;
SheetBlock *end_block;
gint block_height;
gint height;
gint cx, cy;
gint x, y;
g_return_if_fail (sheet != NULL);
g_return_if_fail (GNUCASH_IS_SHEET(sheet));
start_loc.virt_row = MAX (start_loc.virt_row, 1);
start_loc.virt_row = MIN (start_loc.virt_row,
sheet->num_virt_rows - 1);
end_loc.virt_row = MAX (end_loc.virt_row, 1);
end_loc.virt_row = MIN (end_loc.virt_row,
sheet->num_virt_rows - 1);
gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), &cx, &cy);
x = cx;
height = GTK_WIDGET(sheet)->allocation.height;
start_block = gnucash_sheet_get_block (sheet, start_loc);
end_block = gnucash_sheet_get_block (sheet, end_loc);
y = start_block->origin_y;
block_height = (end_block->origin_y +
end_block->style->dimensions->height) - y;
if ((cy <= y) && (cy + height >= y + block_height))
return;
if (y > cy)
y -= height - MIN (block_height, height);
if ((sheet->height - y) < height)
y = sheet->height - height;
if (y < 0)
y = 0;
if (y != cy)
gtk_adjustment_set_value (sheet->vadj, y);
if (x != cx)
gtk_adjustment_set_value (sheet->hadj, x);
gnucash_sheet_compute_visible_range (sheet);
gnucash_sheet_update_adjustments (sheet);
}
void
gnucash_sheet_update_adjustments (GnucashSheet *sheet)
{

View File

@ -174,6 +174,10 @@ void gnucash_sheet_compute_visible_range (GnucashSheet *sheet);
void gnucash_sheet_make_cell_visible (GnucashSheet *sheet,
VirtualLocation virt_loc);
void gnucash_sheet_show_range (GnucashSheet *sheet,
VirtualCellLocation start_loc,
VirtualCellLocation end_loc);
void gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor);
void gnucash_sheet_update_adjustments (GnucashSheet *sheet);

View File

@ -389,6 +389,10 @@ void gnc_table_refresh_current_cursor_gui (Table * table,
/* Refresh the whole GUI from the table. */
void gnc_table_refresh_gui (Table *table, gboolean do_scroll);
/* Try to show the whole range in the register. */
void gnc_table_show_range (Table *table,
VirtualCellLocation start_loc,
VirtualCellLocation end_loc);
/* ==================================================== */

View File

@ -220,7 +220,6 @@ gnc_table_refresh_cursor_gui (Table * table,
g_return_if_fail (GNUCASH_IS_SHEET (table->ui_data));
/* if the current cursor is undefined, there is nothing to do. */
if (gnc_table_virtual_cell_out_of_bounds (table, vcell_loc))
return;
@ -239,6 +238,29 @@ gnc_table_refresh_cursor_gui (Table * table,
gnucash_sheet_redraw_block (sheet, vcell_loc);
}
void
gnc_table_show_range (Table *table,
VirtualCellLocation start_loc,
VirtualCellLocation end_loc)
{
GnucashSheet *sheet;
if (!table)
return;
g_return_if_fail (GNUCASH_IS_SHEET (table->ui_data));
if (gnc_table_virtual_cell_out_of_bounds (table, start_loc))
return;
if (gnc_table_virtual_cell_out_of_bounds (table, end_loc))
return;
sheet = GNUCASH_SHEET (table->ui_data);
gnucash_sheet_show_range (sheet, start_loc, end_loc);
}
/* ================== end of file ======================= */