From 2b5a089e2d8b9cd7737e8400d4e97f3df31f13fe Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Tue, 3 Oct 2000 01:03:58 +0000 Subject: [PATCH] Remove unused functions. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3007 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/SplitLedger.c | 33 +++++++------- src/register/splitreg.c | 17 ++----- src/register/table-allgui.c | 89 +------------------------------------ src/register/table-allgui.h | 64 +++++++++----------------- 4 files changed, 41 insertions(+), 162 deletions(-) diff --git a/src/SplitLedger.c b/src/SplitLedger.c index 2ae2e7c817..ae95fcbc8a 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -227,8 +227,7 @@ static gboolean xaccSRGetTransSplitVirtLoc (SplitRegister *reg, Transaction *trans, Split *trans_split, Split *split, VirtualCellLocation *vcell_loc); -static Split * sr_get_split_virtual (SplitRegister *reg, - VirtualCellLocation vcell_loc); +static Split * sr_get_split (SplitRegister *reg, VirtualCellLocation vcell_loc); /** implementations *******************************************************/ @@ -559,7 +558,7 @@ gnc_find_split_in_reg_by_memo(SplitRegister *reg, const char *memo, Transaction *trans; VirtualCellLocation vcell_loc = { virt_row, virt_col }; - split = sr_get_split_virtual (reg, vcell_loc); + split = sr_get_split (reg, vcell_loc); trans = xaccSplitGetParent(split); if (trans == last_trans) @@ -601,7 +600,7 @@ gnc_find_trans_in_reg_by_desc(SplitRegister *reg, const char *description) Transaction *trans; VirtualCellLocation vcell_loc = { virt_row, virt_col }; - split = sr_get_split_virtual (reg, vcell_loc); + split = sr_get_split (reg, vcell_loc); trans = xaccSplitGetParent(split); if (trans == last_trans) @@ -617,14 +616,14 @@ gnc_find_trans_in_reg_by_desc(SplitRegister *reg, const char *description) } static Split * -sr_get_split_virtual (SplitRegister *reg, VirtualCellLocation vcell_loc) +sr_get_split (SplitRegister *reg, VirtualCellLocation vcell_loc) { GUID *guid; if (reg == NULL) return NULL; - guid = gnc_table_get_vcell_data_virtual (reg->table, vcell_loc); + guid = gnc_table_get_vcell_data (reg->table, vcell_loc); if (guid == NULL) return NULL; @@ -679,7 +678,7 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc) new_trans = xaccSRGetTrans(reg, new_virt_loc.vcell_loc); /* The split we are moving to */ - new_split = sr_get_split_virtual(reg, new_virt_loc.vcell_loc); + new_split = sr_get_split(reg, new_virt_loc.vcell_loc); /* The split at the transaction line we are moving to */ new_trans_split = xaccSRGetTransSplit(reg, new_virt_loc.vcell_loc); @@ -747,7 +746,7 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc) new_trans_split = xaccSRGetTransSplit(reg, new_virt_loc.vcell_loc); info->cursor_hint_trans_split = new_trans_split; - new_split = sr_get_split_virtual (reg, new_virt_loc.vcell_loc); + new_split = sr_get_split (reg, new_virt_loc.vcell_loc); info->cursor_hint_split = new_split; info->cursor_hint_phys_col = new_virt_loc.phys_col_offset; @@ -1095,7 +1094,7 @@ LedgerTraverse (Table *table, if ((result == GNC_VERIFY_YES) && xaccSRCheckReconciled (reg)) break; - new_split = sr_get_split_virtual(reg, virt_loc.vcell_loc); + new_split = sr_get_split(reg, virt_loc.vcell_loc); trans_split = xaccSRGetTransSplit(reg, virt_loc.vcell_loc); xaccSRCancelCursorTransChanges(reg); @@ -1186,7 +1185,7 @@ xaccSRGetTrans (SplitRegister *reg, VirtualCellLocation vcell_loc) if (reg == NULL) return NULL; - split = sr_get_split_virtual (reg, vcell_loc); + split = sr_get_split (reg, vcell_loc); if (split != NULL) return xaccSplitGetParent(split); @@ -1199,7 +1198,7 @@ xaccSRGetTrans (SplitRegister *reg, VirtualCellLocation vcell_loc) return NULL; } - split = sr_get_split_virtual (reg, vcell_loc); + split = sr_get_split (reg, vcell_loc); if (split == NULL) { PERR ("no parent \n"); return NULL; @@ -1223,7 +1222,7 @@ xaccSRGetTransSplit (SplitRegister *reg, VirtualCellLocation vcell_loc) cursor_class = xaccSplitRegisterGetCursorClass (reg, vcell_loc); if (cursor_class == CURSOR_TRANS) - return sr_get_split_virtual (reg, vcell_loc); + return sr_get_split (reg, vcell_loc); vcell_loc.virt_row--; @@ -1268,7 +1267,7 @@ xaccSRGetCurrentTransSplit (SplitRegister *reg) cursor_class = xaccSplitRegisterGetCursorClass (reg, vcell_loc); if (cursor_class == CURSOR_TRANS) - return sr_get_split_virtual (reg, vcell_loc); + return sr_get_split (reg, vcell_loc); } } @@ -1297,7 +1296,7 @@ xaccSRGetCurrentTrans (SplitRegister *reg) return NULL; } - split = sr_get_split_virtual (reg, vcell_loc); + split = sr_get_split (reg, vcell_loc); return xaccSplitGetParent(split); } @@ -1310,7 +1309,7 @@ xaccSRGetCurrentSplit (SplitRegister *reg) if (reg == NULL) return NULL; - return sr_get_split_virtual (reg, reg->table->current_cursor_loc.vcell_loc); + return sr_get_split (reg, reg->table->current_cursor_loc.vcell_loc); } /* ======================================================== */ @@ -1345,7 +1344,7 @@ xaccSRGetSplitVirtLoc (SplitRegister *reg, Split *split, { VirtualCellLocation vc_loc = { v_row, v_col }; - s = sr_get_split_virtual (reg, vc_loc); + s = sr_get_split (reg, vc_loc); if ((s == split) && (vcell_loc != NULL)) { @@ -1422,7 +1421,7 @@ xaccSRGetTransSplitVirtLoc (SplitRegister *reg, Transaction *trans, { VirtualCellLocation vc_loc = { v_row, v_col }; - s = sr_get_split_virtual (reg, vc_loc); + s = sr_get_split (reg, vc_loc); t = xaccSplitGetParent(s); cursor_class = xaccSplitRegisterGetCursorClass(reg, vc_loc); diff --git a/src/register/splitreg.c b/src/register/splitreg.c index e0660b3746..87991a9d02 100644 --- a/src/register/splitreg.c +++ b/src/register/splitreg.c @@ -915,28 +915,17 @@ xaccInitSplitRegister (SplitRegister *reg, gnc_table_set_cursor (table, header, ploc, vcell_loc); } - /* The call below is for practical purposes useless. It installs - * a cursor (the single-line cursor, but it could have been any of - * them), and moves it to the first editable row. Whoop-de-doo, - * since this is promptly over-ridden when real data gets - * loaded. It's here as a fail-safe fallback, in case someone - * creates a register but doesn't do anything with it. Don't - * want to freak out any programmers. */ + /* Set up default configuration. */ { PhysicalLocation ploc = { 1, 0 }; - VirtualCellLocation vcell_loc = { reg->cursor_virt_row, 0 }; - - gnc_table_set_cursor (table, reg->single_cursor, ploc, vcell_loc); - } - - { VirtualLocation vloc; - vloc.vcell_loc.virt_row = 1; + vloc.vcell_loc.virt_row = reg->cursor_virt_row; vloc.vcell_loc.virt_col = 0; vloc.phys_row_offset = 0; vloc.phys_col_offset = 0; + gnc_table_set_cursor (table, reg->single_cursor, ploc, vloc.vcell_loc); gnc_table_move_cursor (table, vloc); } diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index dea1ed73c5..fa0ecc2828 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -780,28 +780,7 @@ gnc_table_verify_cursor_position (Table *table, VirtualLocation virt_loc) /* ==================================================== */ void * -gnc_table_get_vcell_data_physical (Table *table, PhysicalLocation phys_loc) -{ - PhysicalCell *pcell; - VirtualCell *vcell; - - if (!table) return NULL; - - pcell = gnc_table_get_physical_cell (table, phys_loc); - if (pcell == NULL) - return NULL; - - vcell = gnc_table_get_virtual_cell (table, pcell->virt_loc.vcell_loc); - if (vcell == NULL) - return NULL; - - return vcell->vcell_data; -} - -/* ==================================================== */ - -void * -gnc_table_get_vcell_data_virtual (Table *table, VirtualCellLocation vcell_loc) +gnc_table_get_vcell_data (Table *table, VirtualCellLocation vcell_loc) { VirtualCell *vcell; @@ -880,72 +859,6 @@ gnc_table_refresh_current_cursor_gui (Table * table, gboolean do_scroll) /* ==================================================== */ -gboolean -gnc_table_physical_cell_valid(Table *table, - PhysicalLocation phys_loc, - gboolean exact_cell) -{ - BasicCell *cell; - VirtualCell *vcell; - PhysicalCell *pcell; - CellBlockCell *cb_cell; - VirtualLocation virt_loc; - - if (!table) return FALSE; - - pcell = gnc_table_get_physical_cell(table, phys_loc); - - /* can't edit outside of the physical space */ - if (pcell == NULL) - return FALSE; - - /* header rows cannot be modified */ - vcell = gnc_table_get_header_cell (table); - if (vcell == NULL) - return FALSE; - - if (phys_loc.phys_row < vcell->cellblock->num_rows) - return FALSE; - - /* compute the cell location */ - virt_loc = pcell->virt_loc; - - vcell = gnc_table_get_virtual_cell(table, virt_loc.vcell_loc); - if (vcell == NULL) - return FALSE; - - /* verify that offsets are valid. This may occur if the app that is - * using the table has a paritally initialized cursor. (probably due - * to a programming error, but maybe they meant to do this). */ - if ((0 > virt_loc.phys_row_offset) || (0 > virt_loc.phys_col_offset)) - return FALSE; - - /* check for a cell handler, but only if cell address is valid */ - if (vcell->cellblock == NULL) return FALSE; - - cb_cell = gnc_cellblock_get_cell (vcell->cellblock, - virt_loc.phys_row_offset, - virt_loc.phys_col_offset); - if (cb_cell == NULL) - return FALSE; - - cell = cb_cell->cell; - if (cell == NULL) - return FALSE; - - /* if cell is marked as output-only, you can't enter */ - if (0 == (XACC_CELL_ALLOW_INPUT & cell->input_output)) return FALSE; - - /* if cell is pointer only and this is not an exact pointer test, - * it cannot be entered. */ - if (!exact_cell && ((XACC_CELL_ALLOW_EXACT_ONLY & cell->input_output) != 0)) - return FALSE; - - return TRUE; -} - -/* ==================================================== */ - gboolean gnc_table_virtual_loc_valid(Table *table, VirtualLocation virt_loc, diff --git a/src/register/table-allgui.h b/src/register/table-allgui.h index 5df491b2c5..cdfc92666a 100644 --- a/src/register/table-allgui.h +++ b/src/register/table-allgui.h @@ -332,17 +332,11 @@ void gnc_table_move_cursor_gui (Table *table, VirtualLocation virt_loc); gboolean gnc_table_verify_cursor_position (Table *table, VirtualLocation virt_loc); -/* The gnc_table_get_user_data_physical() method returns the user data - * associated with a cursor located at the given physical coords, or - * NULL if the coords are out of bounds. */ -gpointer gnc_table_get_vcell_data_physical (Table *table, - PhysicalLocation phys_loc); - -/* The gnc_table_get_user_data_virtual() method returns the user data +/* The gnc_table_get_vcell_data() method returns the virtual cell data * associated with a cursor located at the given virtual coords, or * NULL if the coords are out of bounds. */ -gpointer gnc_table_get_vcell_data_virtual (Table *table, - VirtualCellLocation vcell_loc); +gpointer gnc_table_get_vcell_data (Table *table, + VirtualCellLocation vcell_loc); gboolean gnc_table_find_close_valid_cell (Table *table, VirtualLocation *virt_loc, @@ -375,46 +369,30 @@ void gnc_table_refresh_gui (Table *table); /* ==================================================== */ -void gnc_table_wrap_verify_cursor_position (Table *table, - VirtualLocation virt_loc); +void gnc_table_wrap_verify_cursor_position (Table *table, + VirtualLocation virt_loc); -gboolean gnc_table_physical_cell_valid(Table *table, - PhysicalLocation phys_loc, +gboolean gnc_table_virtual_loc_valid(Table *table, + VirtualLocation virt_loc, gboolean exact_pointer); -gboolean gnc_table_virtual_loc_valid(Table *table, - VirtualLocation virt_loc, - gboolean exact_pointer); +void gnc_table_refresh_cursor_gui (Table * table, + VirtualCellLocation vcell_loc, + gboolean do_scroll); -void gnc_table_refresh_cursor_gui (Table * table, - VirtualCellLocation vcell_loc, - gboolean do_scroll); +gboolean gnc_table_move_tab (Table *table, + VirtualLocation *virt_loc, + gboolean move_right); -gboolean gnc_table_move_tab (Table *table, - VirtualLocation *virt_loc, - gboolean move_right); +gboolean gnc_table_move_vertical_position (Table *table, + VirtualLocation *virt_loc, + int phys_row_offset); -gboolean gnc_table_move_vertical_position (Table *table, - VirtualLocation *virt_loc, - int phys_row_offset); - - -/* gnc_table_enter_update() is a utility function used to determine - * how the gui will respond. If it returns NULL, then the GUI will - * map an editing widget onto this cell, and allow user input. If it - * returns non-null, then the returned value will be used as the new - * cell value, and an editor for the cell will not be mapped (viz, - * the user will be prevented from updating the cell). The function - * is also passed pointers to the current cursor position, start - * selection position, and end selection position. If the function - * returns NULL, then it may change any of those values and the - * mapped editing widget will be modified accordingly. - */ -gboolean gnc_table_enter_update(Table *table, - VirtualLocation virt_loc, - int *cursor_position, - int *start_selection, - int *end_selection); +gboolean gnc_table_enter_update(Table *table, + VirtualLocation virt_loc, + int *cursor_position, + int *start_selection, + int *end_selection); const char * gnc_table_leave_update(Table *table, VirtualLocation virt_loc);