mark some cells as being output-only

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@443 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-01-26 06:54:36 +00:00
parent c0aefd4a8b
commit c0388c9881
5 changed files with 19 additions and 21 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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;
}