More register cleanup.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5171 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-08-18 01:24:31 +00:00
parent e5af9794bb
commit 9c6209f360
5 changed files with 37 additions and 59 deletions

View File

@ -315,7 +315,7 @@ gnucash_ui_init(void)
NULL, "Register", NULL, "Register",
"Register hint font"); "Register hint font");
xaccRecnCellSetStringGetter(gnc_get_reconcile_str); gnc_recn_cell_set_string_getter (gnc_get_reconcile_str);
/* gnc_default_ui_start */ /* gnc_default_ui_start */
gnucash_style_init(); gnucash_style_init();

View File

@ -1286,7 +1286,7 @@ xaccSRSaveRegEntryToSCM (SplitRegister *reg, SCM trans_scm, SCM split_scm,
char flag; char flag;
cell = gnc_table_layout_get_cell (reg->table->layout, RECN_CELL); cell = gnc_table_layout_get_cell (reg->table->layout, RECN_CELL);
flag = xaccRecnCellGetFlag ((RecnCell *) cell); flag = gnc_recn_cell_get_flag ((RecnCell *) cell);
gnc_split_scm_set_reconcile_state(split_scm, flag); gnc_split_scm_set_reconcile_state(split_scm, flag);
} }
@ -2095,9 +2095,9 @@ xaccSRActuallySaveChangedCells (SplitRegister *reg,
cell = (RecnCell *) gnc_table_layout_get_cell (reg->table->layout, cell = (RecnCell *) gnc_table_layout_get_cell (reg->table->layout,
RECN_CELL); RECN_CELL);
DEBUG ("RECN: %c", xaccRecnCellGetFlag (cell)); DEBUG ("RECN: %c", gnc_recn_cell_get_flag (cell));
xaccSplitSetReconcile (split, xaccRecnCellGetFlag (cell)); xaccSplitSetReconcile (split, gnc_recn_cell_get_flag (cell));
} }
if (gnc_table_layout_get_cell_changed (reg->table->layout, ACTN_CELL, TRUE)) if (gnc_table_layout_get_cell_changed (reg->table->layout, ACTN_CELL, TRUE))
@ -3351,9 +3351,8 @@ xaccSRConfirmHandler (VirtualLocation virt_loc,
return TRUE; return TRUE;
if (gnc_table_layout_get_cell_changed (reg->table->layout, RECN_CELL, FALSE)) if (gnc_table_layout_get_cell_changed (reg->table->layout, RECN_CELL, FALSE))
recn = xaccRecnCellGetFlag ((RecnCell *) recn = gnc_recn_cell_get_flag
gnc_table_layout_get_cell (reg->table->layout, ((RecnCell *) gnc_table_layout_get_cell (reg->table->layout, RECN_CELL));
RECN_CELL));
else else
recn = xaccSplitGetReconcile (split); recn = xaccSplitGetReconcile (split);
@ -3879,7 +3878,7 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist,
gnc_get_account_separator ()); gnc_get_account_separator ());
/* set the confirmation callback for the reconcile cell */ /* set the confirmation callback for the reconcile cell */
xaccRecnCellSetConfirmCB gnc_recn_cell_set_confirm_cb
((RecnCell *) ((RecnCell *)
gnc_table_layout_get_cell (reg->table->layout, RECN_CELL), gnc_table_layout_get_cell (reg->table->layout, RECN_CELL),
recn_cell_confirm, reg); recn_cell_confirm, reg);

View File

@ -56,13 +56,11 @@ static RecnCellStringGetter string_getter = NULL;
/* This static indicates the debugging module that this .o belongs to. */ /* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_REGISTER; static short module = MOD_REGISTER;
static void RecnSetValue (BasicCell *_cell, const char *value); static void gnc_recn_cell_set_value (BasicCell *_cell, const char *value);
/* ================================================ */
static const char * static const char *
RecnCellGetString (char reconciled_flag) gnc_recn_cell_get_string (char reconciled_flag)
{ {
static char str[2] = { 0, 0 }; static char str[2] = { 0, 0 };
@ -74,13 +72,11 @@ RecnCellGetString (char reconciled_flag)
return str; return str;
} }
/* ================================================ */
static gboolean static gboolean
RecnEnter (BasicCell *_cell, gnc_recn_cell_enter (BasicCell *_cell,
int *cursor_position, int *cursor_position,
int *start_selection, int *start_selection,
int *end_selection) int *end_selection)
{ {
RecnCell *cell = (RecnCell *) _cell; RecnCell *cell = (RecnCell *) _cell;
@ -93,42 +89,38 @@ RecnEnter (BasicCell *_cell,
else else
cell->reconciled_flag = NREC; cell->reconciled_flag = NREC;
xaccRecnCellSetFlag (cell, cell->reconciled_flag); gnc_recn_cell_set_flag (cell, cell->reconciled_flag);
return FALSE; return FALSE;
} }
/* ================================================ */
static void static void
xaccInitRecnCell (RecnCell *cell) gnc_recn_cell_init (RecnCell *cell)
{ {
gnc_basic_cell_init (&cell->cell); gnc_basic_cell_init (&cell->cell);
xaccRecnCellSetFlag (cell, NREC); gnc_recn_cell_set_flag (cell, NREC);
cell->confirm_cb = NULL; cell->confirm_cb = NULL;
cell->cell.enter_cell = RecnEnter; cell->cell.enter_cell = gnc_recn_cell_enter;
cell->cell.set_value = RecnSetValue; cell->cell.set_value = gnc_recn_cell_set_value;
} }
BasicCell * BasicCell *
xaccMallocRecnCell (void) gnc_recn_cell_new (void)
{ {
RecnCell * cell; RecnCell * cell;
cell = g_new0 (RecnCell, 1); cell = g_new0 (RecnCell, 1);
xaccInitRecnCell (cell); gnc_recn_cell_init (cell);
return &cell->cell; return &cell->cell;
} }
/* ================================================ */
/* assumes we are given the untranslated form */ /* assumes we are given the untranslated form */
static void static void
RecnSetValue (BasicCell *_cell, const char *value) gnc_recn_cell_set_value (BasicCell *_cell, const char *value)
{ {
RecnCell *cell = (RecnCell *) _cell; RecnCell *cell = (RecnCell *) _cell;
char flag; char flag;
@ -155,13 +147,11 @@ RecnSetValue (BasicCell *_cell, const char *value)
break; break;
} }
xaccRecnCellSetFlag (cell, flag); gnc_recn_cell_set_flag (cell, flag);
} }
/* ================================================ */
void void
xaccRecnCellSetFlag (RecnCell *cell, char reconciled_flag) gnc_recn_cell_set_flag (RecnCell *cell, char reconciled_flag)
{ {
const char *string; const char *string;
@ -169,39 +159,31 @@ xaccRecnCellSetFlag (RecnCell *cell, char reconciled_flag)
cell->reconciled_flag = reconciled_flag; cell->reconciled_flag = reconciled_flag;
string = RecnCellGetString (reconciled_flag); string = gnc_recn_cell_get_string (reconciled_flag);
gnc_basic_cell_set_value_internal (&cell->cell, string); gnc_basic_cell_set_value_internal (&cell->cell, string);
} }
/* ================================================ */
char char
xaccRecnCellGetFlag (RecnCell *cell) gnc_recn_cell_get_flag (RecnCell *cell)
{ {
g_return_val_if_fail (cell != NULL, NREC); g_return_val_if_fail (cell != NULL, NREC);
return cell->reconciled_flag; return cell->reconciled_flag;
} }
/* ================================================ */
void void
xaccRecnCellSetStringGetter (RecnCellStringGetter getter) gnc_recn_cell_set_string_getter (RecnCellStringGetter getter)
{ {
string_getter = getter; string_getter = getter;
} }
/* ================================================ */
void void
xaccRecnCellSetConfirmCB (RecnCell *cell, RecnCellConfirm confirm_cb, gnc_recn_cell_set_confirm_cb (RecnCell *cell, RecnCellConfirm confirm_cb,
gpointer data) gpointer data)
{ {
g_return_if_fail (cell != NULL); g_return_if_fail (cell != NULL);
cell->confirm_cb = confirm_cb; cell->confirm_cb = confirm_cb;
cell->confirm_data = data; cell->confirm_data = data;
} }
/* --------------- end of file ---------------------- */

View File

@ -57,18 +57,15 @@ typedef struct _RecnCell
gpointer confirm_data; gpointer confirm_data;
} RecnCell; } RecnCell;
BasicCell * xaccMallocRecnCell (void); BasicCell * gnc_recn_cell_new (void);
void xaccRecnCellSetFlag (RecnCell *cell, char reconciled_flag); void gnc_recn_cell_set_flag (RecnCell *cell, char reconciled_flag);
char xaccRecnCellGetFlag (RecnCell *cell); char gnc_recn_cell_get_flag (RecnCell *cell);
void xaccRecnCellSetConfirmCB (RecnCell *cell, void gnc_recn_cell_set_confirm_cb (RecnCell *cell,
RecnCellConfirm confirm_cb, RecnCellConfirm confirm_cb,
gpointer data); gpointer data);
void xaccRecnCellSetStringGetter (RecnCellStringGetter getter); void gnc_recn_cell_set_string_getter (RecnCellStringGetter getter);
#endif
#endif /* __RECN_CELL_C__ */
/* --------------- end of file ---------------------- */

View File

@ -57,7 +57,7 @@ gnc_register_init (void)
gnc_register_add_cell_type (PRICE_CELL_TYPE_NAME, gnc_price_cell_new); gnc_register_add_cell_type (PRICE_CELL_TYPE_NAME, gnc_price_cell_new);
gnc_register_add_cell_type (RECN_CELL_TYPE_NAME, xaccMallocRecnCell); gnc_register_add_cell_type (RECN_CELL_TYPE_NAME, gnc_recn_cell_new);
gnc_register_add_cell_type (QUICKFILL_CELL_TYPE_NAME, gnc_register_add_cell_type (QUICKFILL_CELL_TYPE_NAME,
xaccMallocQuickFillCell); xaccMallocQuickFillCell);