From c0388c98817dc0afc73fdadc5145b5668d349793 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Mon, 26 Jan 1998 06:54:36 +0000 Subject: [PATCH] mark some cells as being output-only git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@443 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/basiccell.c | 4 +--- src/register/basiccell.h | 21 +++++++-------------- src/register/cellblock.c | 3 --- src/register/register.c | 1 + src/register/table.c | 11 ++++++++++- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/register/basiccell.c b/src/register/basiccell.c index 358356c06d..fb96d72336 100644 --- a/src/register/basiccell.c +++ b/src/register/basiccell.c @@ -14,9 +14,7 @@ BasicCell * xaccMallocBasicCell (void) void xaccInitBasicCell (BasicCell *cell) { - cell->type = 0; - cell->row = 0; - cell->col = 0; + cell->input_output = 1; cell->width = 0; cell->alignment = 0; cell->value = 0x0; diff --git a/src/register/basiccell.h b/src/register/basiccell.h index f258b8afa0..9d4db7f404 100644 --- a/src/register/basiccell.h +++ b/src/register/basiccell.h @@ -5,17 +5,12 @@ #ifndef __XACC_BASIC_CELL_H__ #define __XACC_BASIC_CELL_H__ -/* cell types */ -enum { - DATE, - PRICE, /* two-digit float point display */ - AMOUNT, /* three-digit float point display */ - TEXT, /* string text */ - COMBO, /* combobox */ -}; - - /* + * The input_output member is zero if the cell is supposed + * to only display values, but not accept user input. If + * non-zero, then the callbacks below are used to when the + * cell is entered. + * * The enter_cell() callback is called when the user first * makes a move to enter a cell. The current value of the * cell is passed as the argument. If the callback wishes @@ -55,11 +50,9 @@ enum { typedef struct _BasicCell { - short type; /* cell type */ - short row; /* relative row position */ - short col; /* relative column position */ - short width; /* column width, in chars, not pixels */ + short width; /* column width, in chars, not pixels */ short alignment; /* column text alignment */ + char input_output; /* zero if output-only */ /* private data */ char * value; /* current value */ diff --git a/src/register/cellblock.c b/src/register/cellblock.c index f589cfd29f..9de86c6c7f 100644 --- a/src/register/cellblock.c +++ b/src/register/cellblock.c @@ -64,9 +64,6 @@ xaccAddCell (CellBlock *arr, BasicCell *cell, int row, int col) if (!arr) return; if (!cell) return; - cell->row = row; - cell->col = col; - /* avoid embarrasement if cell incorrectly specified */ if ((0 > row) || (0 > col)) return; if ((row >= arr->numRows) || (col >= arr->numCols)) return; diff --git a/src/register/register.c b/src/register/register.c index 2ba402adf1..f9c28fd33f 100644 --- a/src/register/register.c +++ b/src/register/register.c @@ -140,6 +140,7 @@ void xaccInitBasicRegister (BasicRegister *reg) reg->balanceCell = xaccMallocPriceCell(); reg->balanceCell->cell.width = 9; + reg->balanceCell->cell.input_output = 0; xaccAddCell (curs, &(reg->balanceCell->cell), BALN_CELL_R, BALN_CELL_C); table = xaccMallocTable (0, 0); diff --git a/src/register/table.c b/src/register/table.c index a3414f5992..32e85e857a 100644 --- a/src/register/table.c +++ b/src/register/table.c @@ -208,7 +208,16 @@ cellCB (Widget mw, XtPointer cd, XtPointer cb) if (arr && !invalid) { rel_row %= (arr->numRows); rel_col %= (arr->numCols); - if (! (arr->cells[rel_row][rel_col])) invalid = TRUE; + if (! (arr->cells[rel_row][rel_col])) { + invalid = TRUE; + } else { + /* if cell is marked as output-only, + * then don't call callbacks */ + if (0 == (arr->cells[rel_row][rel_col])->input_output) { + invalid = TRUE; + } + } + } else { invalid = TRUE; }