rename single-cell to basic-cell

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@427 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-01-14 06:02:25 +00:00
parent 9ca5ea0999
commit 1911c33a0a
16 changed files with 88 additions and 86 deletions

View File

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

View File

@ -2,17 +2,17 @@
#include <stdlib.h>
#include <string.h>
#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);

View File

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

View File

@ -1,6 +1,6 @@
#include <stdlib.h>
#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; i<numrows; i++) {
(arr->cells)[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;

View File

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

View File

@ -2,8 +2,8 @@
#include <string.h>
#include <time.h>
#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);

View File

@ -3,10 +3,10 @@
#define __XACC_DATE_CELL_C__
#include <time.h>
#include "single.h"
#include "basiccell.h"
typedef struct _DateCell {
SingleCell cell;
BasicCell cell;
struct tm date;
} DateCell;

View File

@ -3,6 +3,7 @@
#include <Xm/Form.h>
#include <Xm/MainW.h>
#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;

View File

@ -1,8 +1,8 @@
#include <string.h>
#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;
}

View File

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

View File

@ -2,8 +2,8 @@
#include <string.h>
#include <time.h>
#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];

View File

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

View File

@ -3,7 +3,7 @@
#include <Xbae/Matrix.h>
#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;

View File

@ -3,8 +3,8 @@
#define __XACC_TABLE_H__
#include <Xm/Xm.h>
#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

View File

@ -1,15 +1,15 @@
#include <string.h>
#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 ("");

View File

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