mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
first try at crude inheritance
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@412 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
0167a5aa1a
commit
fba652b072
@ -30,8 +30,8 @@ typedef struct _BasicRegister {
|
||||
SingleCell * dateCell;
|
||||
SingleCell * descCell;
|
||||
SingleCell * memoCell;
|
||||
SingleCell * creditCell;
|
||||
SingleCell * debitCell;
|
||||
PriceCell * creditCell;
|
||||
PriceCell * debitCell;
|
||||
|
||||
} BasicRegister;
|
||||
|
||||
@ -71,12 +71,12 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
xaccAddCell (header, cell, 0, DESC_CELL_C);
|
||||
xaccSetSingleCellValue (cell, "Description");
|
||||
|
||||
cell = xaccMallocPriceCell();
|
||||
cell = (SingleCell *) xaccMallocPriceCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (header, cell, 0, CRED_CELL_C);
|
||||
xaccSetSingleCellValue (cell, "Credit");
|
||||
|
||||
cell = xaccMallocPriceCell();
|
||||
cell = (SingleCell *) xaccMallocPriceCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (header, cell, 0, DEBT_CELL_C);
|
||||
xaccSetSingleCellValue (cell, "Debit");
|
||||
@ -101,15 +101,13 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
xaccAddCell (curs, cell, MEMO_CELL_R, MEMO_CELL_C);
|
||||
reg->memoCell = cell;
|
||||
|
||||
cell = xaccMallocPriceCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (curs, cell, CRED_CELL_R, CRED_CELL_C);
|
||||
reg->creditCell = cell;
|
||||
reg->creditCell = xaccMallocPriceCell();
|
||||
reg->creditCell->cell.width = 9;
|
||||
xaccAddCell (curs, &(reg->creditCell->cell), CRED_CELL_R, CRED_CELL_C);
|
||||
|
||||
cell = xaccMallocPriceCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (curs, cell, DEBT_CELL_R, DEBT_CELL_C);
|
||||
reg->debitCell = cell;
|
||||
reg->debitCell = xaccMallocPriceCell();
|
||||
reg->debitCell->cell.width = 9;
|
||||
xaccAddCell (curs, &(reg->debitCell->cell), DEBT_CELL_R, DEBT_CELL_C);
|
||||
|
||||
table = xaccMallocTable (0, 0);
|
||||
table -> header = header;
|
||||
|
@ -36,11 +36,11 @@ PriceMV (const char * old, const char *change, const char *new)
|
||||
|
||||
/* ================================================ */
|
||||
|
||||
SingleCell *
|
||||
PriceCell *
|
||||
xaccMallocPriceCell (void)
|
||||
{
|
||||
SingleCell *cell;
|
||||
cell = xaccMallocSingleCell();
|
||||
PriceCell *cell;
|
||||
cell = (PriceCell *) malloc (sizeof (PriceCell));
|
||||
xaccInitPriceCell (cell);
|
||||
return cell;
|
||||
}
|
||||
@ -48,12 +48,14 @@ xaccMallocPriceCell (void)
|
||||
/* ================================================ */
|
||||
|
||||
void
|
||||
xaccInitPriceCell (SingleCell *cell)
|
||||
xaccInitPriceCell (PriceCell *cell)
|
||||
{
|
||||
if (cell->value) free (cell->value);
|
||||
cell ->value = strdup ("0.0");
|
||||
xaccInitSingleCell( &(cell->cell));
|
||||
cell->amount = 0.0;
|
||||
|
||||
cell ->modify_verify = PriceMV;
|
||||
xaccSetSingleCellValue ( &(cell->cell), "0.0");
|
||||
|
||||
cell->cell.modify_verify = PriceMV;
|
||||
}
|
||||
|
||||
/* --------------- end of file ---------------------- */
|
||||
|
@ -4,9 +4,14 @@
|
||||
|
||||
#include "single.h"
|
||||
|
||||
typedef struct _PriceCell {
|
||||
SingleCell cell;
|
||||
double amount;
|
||||
} PriceCell;
|
||||
|
||||
/* installs a callback to handle price recording */
|
||||
SingleCell * xaccMallocPriceCell (void);
|
||||
void xaccInitPriceCell (SingleCell *);
|
||||
PriceCell * xaccMallocPriceCell (void);
|
||||
void xaccInitPriceCell (PriceCell *);
|
||||
|
||||
#endif /* __XACC_PRICE_C__ */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user