mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
c0aefd4a8b
commit
c0388c9881
@ -14,9 +14,7 @@ BasicCell * xaccMallocBasicCell (void)
|
|||||||
|
|
||||||
void xaccInitBasicCell (BasicCell *cell)
|
void xaccInitBasicCell (BasicCell *cell)
|
||||||
{
|
{
|
||||||
cell->type = 0;
|
cell->input_output = 1;
|
||||||
cell->row = 0;
|
|
||||||
cell->col = 0;
|
|
||||||
cell->width = 0;
|
cell->width = 0;
|
||||||
cell->alignment = 0;
|
cell->alignment = 0;
|
||||||
cell->value = 0x0;
|
cell->value = 0x0;
|
||||||
|
@ -5,17 +5,12 @@
|
|||||||
#ifndef __XACC_BASIC_CELL_H__
|
#ifndef __XACC_BASIC_CELL_H__
|
||||||
#define __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
|
* The enter_cell() callback is called when the user first
|
||||||
* makes a move to enter a cell. The current value of the
|
* makes a move to enter a cell. The current value of the
|
||||||
* cell is passed as the argument. If the callback wishes
|
* cell is passed as the argument. If the callback wishes
|
||||||
@ -55,11 +50,9 @@ enum {
|
|||||||
|
|
||||||
typedef struct _BasicCell {
|
typedef struct _BasicCell {
|
||||||
|
|
||||||
short type; /* cell type */
|
short width; /* column width, in chars, not pixels */
|
||||||
short row; /* relative row position */
|
|
||||||
short col; /* relative column position */
|
|
||||||
short width; /* column width, in chars, not pixels */
|
|
||||||
short alignment; /* column text alignment */
|
short alignment; /* column text alignment */
|
||||||
|
char input_output; /* zero if output-only */
|
||||||
|
|
||||||
/* private data */
|
/* private data */
|
||||||
char * value; /* current value */
|
char * value; /* current value */
|
||||||
|
@ -64,9 +64,6 @@ xaccAddCell (CellBlock *arr, BasicCell *cell, int row, int col)
|
|||||||
if (!arr) return;
|
if (!arr) return;
|
||||||
if (!cell) return;
|
if (!cell) return;
|
||||||
|
|
||||||
cell->row = row;
|
|
||||||
cell->col = col;
|
|
||||||
|
|
||||||
/* avoid embarrasement if cell incorrectly specified */
|
/* avoid embarrasement if cell incorrectly specified */
|
||||||
if ((0 > row) || (0 > col)) return;
|
if ((0 > row) || (0 > col)) return;
|
||||||
if ((row >= arr->numRows) || (col >= arr->numCols)) return;
|
if ((row >= arr->numRows) || (col >= arr->numCols)) return;
|
||||||
|
@ -140,6 +140,7 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
|||||||
|
|
||||||
reg->balanceCell = xaccMallocPriceCell();
|
reg->balanceCell = xaccMallocPriceCell();
|
||||||
reg->balanceCell->cell.width = 9;
|
reg->balanceCell->cell.width = 9;
|
||||||
|
reg->balanceCell->cell.input_output = 0;
|
||||||
xaccAddCell (curs, &(reg->balanceCell->cell), BALN_CELL_R, BALN_CELL_C);
|
xaccAddCell (curs, &(reg->balanceCell->cell), BALN_CELL_R, BALN_CELL_C);
|
||||||
|
|
||||||
table = xaccMallocTable (0, 0);
|
table = xaccMallocTable (0, 0);
|
||||||
|
@ -208,7 +208,16 @@ cellCB (Widget mw, XtPointer cd, XtPointer cb)
|
|||||||
if (arr && !invalid) {
|
if (arr && !invalid) {
|
||||||
rel_row %= (arr->numRows);
|
rel_row %= (arr->numRows);
|
||||||
rel_col %= (arr->numCols);
|
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 {
|
} else {
|
||||||
invalid = TRUE;
|
invalid = TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user