diff --git a/src/register/Makefile b/src/register/Makefile index 09f76023d5..8dac261aa3 100644 --- a/src/register/Makefile +++ b/src/register/Makefile @@ -25,7 +25,7 @@ LIBXMHTML= ../lib/XmHTML-1.1.0/src/libXmHTML.a LIBXBAE = ../../lib/Xbae-4.6.2-linas/libXbae.a LIBCOMBO = ../lib/ComboBox-1.33/libComboBox.a ###################################################################### -SRCS = cell.c datecell.c main.c pricecell.c single.c recncell.c \ +SRCS = basiccell.c cellblock.c datecell.c main.c pricecell.c recncell.c \ table.c textcell.c OBJS = ${SRCS:.c=.o} $(LIBXBAE) ###################################################################### diff --git a/src/register/basiccell.c b/src/register/basiccell.c index 65a2c6b823..358356c06d 100644 --- a/src/register/basiccell.c +++ b/src/register/basiccell.c @@ -2,17 +2,17 @@ #include #include -#include "single.h" +#include "basiccell.h" -SingleCell * xaccMallocSingleCell (void) +BasicCell * xaccMallocBasicCell (void) { - SingleCell * cell; - cell = (SingleCell *) malloc (sizeof (SingleCell)); - xaccInitSingleCell (cell); + BasicCell * cell; + cell = (BasicCell *) malloc (sizeof (BasicCell)); + xaccInitBasicCell (cell); return cell; } -void xaccInitSingleCell (SingleCell *cell) +void xaccInitBasicCell (BasicCell *cell) { cell->type = 0; cell->row = 0; @@ -26,7 +26,7 @@ void xaccInitSingleCell (SingleCell *cell) cell->block = NULL; } -void xaccSetSingleCellValue (SingleCell *cell, char *val) +void xaccSetBasicCellValue (BasicCell *cell, char *val) { if (cell->value) free (cell->value); diff --git a/src/register/basiccell.h b/src/register/basiccell.h index 3510a86f53..f258b8afa0 100644 --- a/src/register/basiccell.h +++ b/src/register/basiccell.h @@ -1,9 +1,10 @@ /* - * single.h + * basiccell.h */ -#ifndef __XACC_SINGLE_H__ -#define __XACC_SINGLE_H__ +#ifndef __XACC_BASIC_CELL_H__ +#define __XACC_BASIC_CELL_H__ + /* cell types */ enum { DATE, @@ -52,7 +53,7 @@ enum { * to worry about garbage collection. */ -typedef struct _SingleCell { +typedef struct _BasicCell { short type; /* cell type */ short row; /* relative row position */ @@ -63,23 +64,23 @@ typedef struct _SingleCell { /* private data */ char * value; /* current value */ - const char * (*enter_cell) (struct _SingleCell *, + const char * (*enter_cell) (struct _BasicCell *, const char * current); - const char * (*modify_verify) (struct _SingleCell *, + const char * (*modify_verify) (struct _BasicCell *, const char *old, const char *add, const char *new); - const char * (*leave_cell) (struct _SingleCell *, + const char * (*leave_cell) (struct _BasicCell *, const char * current); struct _CellBlock *block; /* back-pointer to parent container */ -} SingleCell; +} BasicCell; -SingleCell * xaccMallocSingleCell (void); -void xaccInitSingleCell (SingleCell *); +BasicCell * xaccMallocBasicCell (void); +void xaccInitBasicCell (BasicCell *); -void xaccSetSingleCellValue (SingleCell *, char *); +void xaccSetBasicCellValue (BasicCell *, char *); -#endif /* __XACC_SINGLE_H__ */ +#endif /* __XACC_BASIC_CELL_H__ */ /* ------------------ end of file ---------------------- */ diff --git a/src/register/cellblock.c b/src/register/cellblock.c index c8619ae80b..f589cfd29f 100644 --- a/src/register/cellblock.c +++ b/src/register/cellblock.c @@ -1,6 +1,6 @@ #include -#include "cell.h" +#include "cellblock.h" CellBlock * xaccMallocCellBlock (int numrows, int numcols) { @@ -38,9 +38,9 @@ xaccInitCellBlock (CellBlock *arr, int numrows, int numcols) /* malloc new cell array */ - arr->cells = (SingleCell ***) malloc (numrows * sizeof (SingleCell **)); + arr->cells = (BasicCell ***) malloc (numrows * sizeof (BasicCell **)); for (i=0; icells)[i] = (SingleCell **) malloc (numcols * sizeof (SingleCell *)); + (arr->cells)[i] = (BasicCell **) malloc (numcols * sizeof (BasicCell *)); } /* free old widths, alignments */ @@ -59,7 +59,7 @@ xaccInitCellBlock (CellBlock *arr, int numrows, int numcols) /* =================================================== */ void -xaccAddCell (CellBlock *arr, SingleCell *cell, int row, int col) +xaccAddCell (CellBlock *arr, BasicCell *cell, int row, int col) { if (!arr) return; if (!cell) return; diff --git a/src/register/cellblock.h b/src/register/cellblock.h index fce3393914..1c49969fca 100644 --- a/src/register/cellblock.h +++ b/src/register/cellblock.h @@ -1,8 +1,8 @@ -#ifndef __XACC_CELL_H__ -#define __XACC_CELL_H__ +#ifndef __XACC_CELL_BLOCK_H__ +#define __XACC_CELL_BLOCK_H__ -#include "single.h" +#include "basiccell.h" /* a cell array is a traversal group for one entry in the register */ @@ -11,7 +11,7 @@ typedef struct _CellBlock { short numRows; short numCols; - SingleCell ***cells; /* row-col array */ + BasicCell ***cells; /* row-col array */ /* private, utility cahced data */ short *widths; /* column widths */ @@ -25,6 +25,6 @@ CellBlock * xaccMallocCellBlock (int numrows, int numcols); void xaccInitCellBlock (CellBlock *, int numrows, int numcols); /* add a cell to the array */ -void xaccAddCell (CellBlock *, SingleCell *, int row, int col); +void xaccAddCell (CellBlock *, BasicCell *, int row, int col); -#endif __XACC_CELL_H__ +#endif __XACC_CELL_BLOCK_H__ diff --git a/src/register/datecell.c b/src/register/datecell.c index 952f3cfe2b..487d9c21a6 100644 --- a/src/register/datecell.c +++ b/src/register/datecell.c @@ -2,8 +2,8 @@ #include #include +#include "basiccell.h" #include "datecell.h" -#include "single.h" #define DATE_SEP '/' @@ -122,7 +122,7 @@ xaccValidateDate (struct tm *date, int recur) /* ================================================ */ static const char * -DateEnter (struct _SingleCell *_cell, const char * curr) +DateEnter (struct _BasicCell *_cell, const char * curr) { DateCell *cell = (DateCell *) _cell; @@ -136,7 +136,7 @@ DateEnter (struct _SingleCell *_cell, const char * curr) /* ================================================ */ static const char * -DateMV (struct _SingleCell *_cell, +DateMV (struct _BasicCell *_cell, const char *oldval, const char *change, const char *newval) @@ -247,7 +247,7 @@ DateMV (struct _SingleCell *_cell, /* ================================================ */ static const char * -DateLeave (struct _SingleCell *_cell, const char * curr) +DateLeave (struct _BasicCell *_cell, const char * curr) { DateCell *cell = (DateCell *) _cell; char buff[30]; @@ -285,7 +285,7 @@ xaccInitDateCell (DateCell *cell) struct tm *now; char buff[30]; - xaccInitSingleCell (&(cell->cell)); + xaccInitBasicCell (&(cell->cell)); /* default value is today's date */ time (&secs); diff --git a/src/register/datecell.h b/src/register/datecell.h index 361d030b18..87d77812da 100644 --- a/src/register/datecell.h +++ b/src/register/datecell.h @@ -3,10 +3,10 @@ #define __XACC_DATE_CELL_C__ #include -#include "single.h" +#include "basiccell.h" typedef struct _DateCell { - SingleCell cell; + BasicCell cell; struct tm date; } DateCell; diff --git a/src/register/main.c b/src/register/main.c index ebea0d5ee5..fb0b376c95 100644 --- a/src/register/main.c +++ b/src/register/main.c @@ -3,6 +3,7 @@ #include #include +#include "basiccell.h" #include "datecell.h" #include "pricecell.h" #include "table.h" @@ -36,10 +37,10 @@ typedef struct _BasicRegister { Table * table; CellBlock * cursor; CellBlock * header; - SingleCell * dateCell; - SingleCell * descCell; - SingleCell * memoCell; - SingleCell * recnCell; + BasicCell * dateCell; + BasicCell * descCell; + BasicCell * memoCell; + BasicCell * recnCell; PriceCell * creditCell; PriceCell * debitCell; @@ -64,49 +65,49 @@ void xaccInitBasicRegister (BasicRegister *reg) { Table * table; CellBlock *curs, *header; - SingleCell *cell; + BasicCell *cell; /* define the header */ header = xaccMallocCellBlock (1, MAX_COLS); reg->header = header; - cell = (SingleCell *) xaccMallocDateCell(); + cell = (BasicCell *) xaccMallocDateCell(); cell->width = 11; xaccAddCell (header, cell, 0, DATE_CELL_C); - xaccSetSingleCellValue (cell, "Date"); + xaccSetBasicCellValue (cell, "Date"); cell = xaccMallocTextCell(); cell->width = 19; xaccAddCell (header, cell, 0, DESC_CELL_C); - xaccSetSingleCellValue (cell, "Description"); + xaccSetBasicCellValue (cell, "Description"); cell = xaccMallocRecnCell(); cell->width = 1; xaccAddCell (header, cell, 0, RECN_CELL_C); - xaccSetSingleCellValue (cell, "R"); + xaccSetBasicCellValue (cell, "R"); - cell = (SingleCell *) xaccMallocPriceCell(); + cell = (BasicCell *) xaccMallocPriceCell(); cell->width = 9; xaccAddCell (header, cell, 0, CRED_CELL_C); - xaccSetSingleCellValue (cell, "Credit"); + xaccSetBasicCellValue (cell, "Credit"); - cell = (SingleCell *) xaccMallocPriceCell(); + cell = (BasicCell *) xaccMallocPriceCell(); cell->width = 9; xaccAddCell (header, cell, 0, DEBT_CELL_C); - xaccSetSingleCellValue (cell, "Debit"); + xaccSetBasicCellValue (cell, "Debit"); - cell = (SingleCell *) xaccMallocPriceCell(); + cell = (BasicCell *) xaccMallocPriceCell(); cell->width = 9; xaccAddCell (header, cell, 0, BALN_CELL_C); - xaccSetSingleCellValue (cell, "Balance"); + xaccSetBasicCellValue (cell, "Balance"); /* --------------------------- */ curs = xaccMallocCellBlock (2, MAX_COLS); reg->cursor = curs; - cell = (SingleCell *) xaccMallocDateCell(); + cell = (BasicCell *) xaccMallocDateCell(); cell->width = 9; xaccAddCell (curs, cell, DATE_CELL_R, DATE_CELL_C); reg->dateCell = cell; diff --git a/src/register/pricecell.c b/src/register/pricecell.c index f301b10ee9..b701d0cc4a 100644 --- a/src/register/pricecell.c +++ b/src/register/pricecell.c @@ -1,8 +1,8 @@ #include +#include "basiccell.h" #include "pricecell.h" -#include "single.h" #define DECIMAL_PT '.' @@ -11,7 +11,7 @@ * decimal point in them */ static const char * -PriceMV (struct _SingleCell *_cell, +PriceMV (struct _BasicCell *_cell, const char * oldval, const char *change, const char *newval) @@ -53,10 +53,10 @@ xaccMallocPriceCell (void) void xaccInitPriceCell (PriceCell *cell) { - xaccInitSingleCell( &(cell->cell)); + xaccInitBasicCell( &(cell->cell)); cell->amount = 0.0; - xaccSetSingleCellValue ( &(cell->cell), "0.0"); + xaccSetBasicCellValue ( &(cell->cell), "0.0"); cell->cell.modify_verify = PriceMV; } diff --git a/src/register/pricecell.h b/src/register/pricecell.h index 115716ec1a..978fce8fb2 100644 --- a/src/register/pricecell.h +++ b/src/register/pricecell.h @@ -1,11 +1,11 @@ -#ifndef __XACC_PRICE_C__ -#define __XACC_PRICE_C__ +#ifndef __XACC_PRICE_CELL_C__ +#define __XACC_PRICE_CELL_C__ -#include "single.h" +#include "basiccell.h" typedef struct _PriceCell { - SingleCell cell; + BasicCell cell; double amount; } PriceCell; @@ -13,6 +13,6 @@ typedef struct _PriceCell { PriceCell * xaccMallocPriceCell (void); void xaccInitPriceCell (PriceCell *); -#endif /* __XACC_PRICE_C__ */ +#endif /* __XACC_PRICE_CELL_C__ */ /* --------------- end of file ---------------------- */ diff --git a/src/register/recncell.c b/src/register/recncell.c index cddba5f5b7..cac07d0e6e 100644 --- a/src/register/recncell.c +++ b/src/register/recncell.c @@ -2,8 +2,8 @@ #include #include +#include "basiccell.h" #include "recncell.h" -#include "single.h" /* hack alert -- temp defs should include Transaction.h */ #define NREC 'n' @@ -12,7 +12,7 @@ /* ================================================ */ static const char * -ToggleRecn (struct _SingleCell *_cell, const char *cur_val) +ToggleRecn (struct _BasicCell *_cell, const char *cur_val) { char buff[2]; @@ -28,11 +28,11 @@ ToggleRecn (struct _SingleCell *_cell, const char *cur_val) /* ================================================ */ -SingleCell * +BasicCell * xaccMallocRecnCell (void) { - SingleCell *cell; - cell = xaccMallocSingleCell(); + BasicCell *cell; + cell = xaccMallocBasicCell(); xaccInitRecnCell (cell); return cell; } @@ -40,7 +40,7 @@ xaccMallocRecnCell (void) /* ================================================ */ void -xaccInitRecnCell (SingleCell *cell) +xaccInitRecnCell (BasicCell *cell) { char buff[2]; diff --git a/src/register/recncell.h b/src/register/recncell.h index e8e959e5cc..88bd6d8b45 100644 --- a/src/register/recncell.h +++ b/src/register/recncell.h @@ -2,11 +2,11 @@ #ifndef __XACC_RECN_CELL_C__ #define __XACC_RECN_CELL_C__ -#include "single.h" +#include "basiccell.h" /* installs a callback to handle reconcile flag */ -SingleCell * xaccMallocRecnCell (void); -void xaccInitRecnCell (SingleCell *); +BasicCell * xaccMallocRecnCell (void); +void xaccInitRecnCell (BasicCell *); #endif /* __XACC_RECN_CELL_C__ */ diff --git a/src/register/table.c b/src/register/table.c index f165eb9810..f760b2ff5e 100644 --- a/src/register/table.c +++ b/src/register/table.c @@ -3,7 +3,7 @@ #include -#include "cell.h" +#include "cellblock.h" #include "table.h" static void enterCB (Widget mw, XtPointer cd, XtPointer cb); @@ -243,7 +243,7 @@ enterCB (Widget mw, XtPointer cd, XtPointer cb) XbaeMatrixEnterCellCallbackStruct *cbs; int row, col; int rel_row, rel_col; - const char * (*enter) (struct _SingleCell *, const char *); + const char * (*enter) (struct _BasicCell *, const char *); table = (Table *) cd; arr = table->cursor; @@ -296,7 +296,7 @@ modifyCB (Widget mw, XtPointer cd, XtPointer cb) XbaeMatrixModifyVerifyCallbackStruct *cbs; int row, col; int rel_row, rel_col; - const char * (*mv) (struct _SingleCell *, + const char * (*mv) (struct _BasicCell *, const char *, const char *, const char *); @@ -386,7 +386,7 @@ leaveCB (Widget mw, XtPointer cd, XtPointer cb) XbaeMatrixLeaveCellCallbackStruct *cbs; int row, col; int rel_row, rel_col; - const char * (*leave) (struct _SingleCell *, const char *); + const char * (*leave) (struct _BasicCell *, const char *); char * newval; table = (Table *) cd; diff --git a/src/register/table.h b/src/register/table.h index 53301804e1..a1d3ff6091 100644 --- a/src/register/table.h +++ b/src/register/table.h @@ -3,8 +3,8 @@ #define __XACC_TABLE_H__ #include -#include "cell.h" -#include "single.h" +#include "basiccell.h" +#include "cellblock.h" /* the table is the complete, displayed table. */ /* It consists of a header, followed by a simple diff --git a/src/register/textcell.c b/src/register/textcell.c index fb236476ca..80594d9e19 100644 --- a/src/register/textcell.c +++ b/src/register/textcell.c @@ -1,15 +1,15 @@ #include +#include "basiccell.h" #include "textcell.h" -#include "single.h" /* ================================================ */ /* by definition, all text is valid text. So accept * all modifications */ static const char * -TextMV (struct _SingleCell *_cell, +TextMV (struct _BasicCell *_cell, const char *oldval, const char *change, const char *newval) @@ -19,11 +19,11 @@ TextMV (struct _SingleCell *_cell, /* ================================================ */ -SingleCell * +BasicCell * xaccMallocTextCell (void) { - SingleCell *cell; - cell = xaccMallocSingleCell(); + BasicCell *cell; + cell = xaccMallocBasicCell(); xaccInitTextCell (cell); return cell; } @@ -31,7 +31,7 @@ xaccMallocTextCell (void) /* ================================================ */ void -xaccInitTextCell (SingleCell *cell) +xaccInitTextCell (BasicCell *cell) { if (cell->value) free (cell->value); cell->value = strdup (""); diff --git a/src/register/textcell.h b/src/register/textcell.h index 1c6aa6db2d..52ffebe04c 100644 --- a/src/register/textcell.h +++ b/src/register/textcell.h @@ -2,11 +2,11 @@ #ifndef __XACC_TEXT_CELL_C__ #define __XACC_TEXT_CELL_C__ -#include "single.h" +#include "basiccell.h" /* installs a callback to handle text recording */ -SingleCell * xaccMallocTextCell (void); -void xaccInitTextCell (SingleCell *); +BasicCell * xaccMallocTextCell (void); +void xaccInitTextCell (BasicCell *); #endif /* __XACC_TEXT_CELL_C__ */