diff --git a/ChangeLog b/ChangeLog index 90bea3c3c8..ad3c7f77b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,6 +44,15 @@ * src/backend/postgres/test/Makefile.am: include run-tests.sh in the distribution. + * src/register/register-gnome/gnucash-sheet.c: fix a fencepost + error where it assumed there would be at least two "visible + rows" per block, so search through the end rather than skipping + the last row. This fixes the page-up/page-down problem with + invoices. Also add more places where the visible range is computed. + + * src/business/business-ledger/gncEntryLedgerLoad.c: add code to + "show_range()" which should fix the page-up/page-down problem. + 2003-01-14 Derek Atkins * src/engine/QueryNew.h: add QUERY_PARAM_ACTIVE diff --git a/src/business/business-ledger/gncEntryLedgerLoad.c b/src/business/business-ledger/gncEntryLedgerLoad.c index 45d41b66ba..add6032335 100644 --- a/src/business/business-ledger/gncEntryLedgerLoad.c +++ b/src/business/business-ledger/gncEntryLedgerLoad.c @@ -140,6 +140,20 @@ static void load_taxtable_type_cells (GncEntryLedger *ledger) } } +static void +gnc_entry_ledger_show_entry (GncEntryLedger *ledger, + VirtualCellLocation start_loc) +{ + VirtualCellLocation end_loc; + int v_row; + + end_loc = start_loc; + v_row = end_loc.virt_row + 1; + end_loc.virt_row = MIN (v_row, ledger->table->num_virt_rows - 1); + + gnc_table_show_range (ledger->table, start_loc, end_loc); +} + void gnc_entry_ledger_load_xfer_cells (GncEntryLedger *ledger) { load_xfer_type_cells (ledger); @@ -388,8 +402,7 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list) gnc_table_refresh_gui (table, TRUE); - - /* Show_entry ??? */ + gnc_entry_ledger_show_entry (ledger, table->current_cursor_loc.vcell_loc); /* Set completion character */ gnc_combo_cell_set_complete_char @@ -404,7 +417,4 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list) /* enable callback for cursor user-driven moves */ gnc_table_control_allow_move (table->control, TRUE); - - /* Set the confirmation callbacks and load the combo cells */ } - diff --git a/src/register/register-gnome/gnucash-sheet.c b/src/register/register-gnome/gnucash-sheet.c index c662557e2a..bd05d4c9c3 100644 --- a/src/register/register-gnome/gnucash-sheet.c +++ b/src/register/register-gnome/gnucash-sheet.c @@ -313,7 +313,7 @@ gnucash_sheet_y_pixel_to_block (GnucashSheet *sheet, int y) VirtualCellLocation vcell_loc = { 1, 0 }; for (; - vcell_loc.virt_row < sheet->num_virt_rows - 1; + vcell_loc.virt_row < sheet->num_virt_rows; vcell_loc.virt_row++) { SheetBlock *block; @@ -352,7 +352,7 @@ gnucash_sheet_compute_visible_range (GnucashSheet *sheet) sheet->num_visible_phys_rows = 0; for ( vcell_loc.virt_row = sheet->top_block, vcell_loc.virt_col = 0; - vcell_loc.virt_row < sheet->num_virt_rows - 1; + vcell_loc.virt_row < sheet->num_virt_rows; vcell_loc.virt_row++ ) { SheetBlock *block; @@ -405,8 +405,10 @@ gnucash_sheet_show_row (GnucashSheet *sheet, gint virt_row) y = block->origin_y; block_height = block->style->dimensions->height; - if ((cy <= y) && (cy + height >= y + block_height)) + if ((cy <= y) && (cy + height >= y + block_height)) { + gnucash_sheet_compute_visible_range (sheet); return; + } if (y > cy) y -= height - MIN (block_height, height); @@ -477,8 +479,10 @@ gnucash_sheet_show_range (GnucashSheet *sheet, block_height = (end_block->origin_y + end_block->style->dimensions->height) - y; - if ((cy <= y) && (cy + height >= y + block_height)) + if ((cy <= y) && (cy + height >= y + block_height)) { + gnucash_sheet_compute_visible_range (sheet); return; + } if (y > cy) y -= height - MIN (block_height, height);