assorted minor updates

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@435 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-01-17 06:20:41 +00:00
parent 6c556c9709
commit 7d5f89b8b2
4 changed files with 63 additions and 7 deletions

View File

@ -1,6 +1,7 @@
srcdir = .
CC = gcc
RANLIB = ranlib
INCLPATH = -I/usr/include \
-I/usr/X11R6/include/. \
-I./../../include \
@ -17,7 +18,7 @@ LFLAGS = -O2
# LIBS = -lXpm -lXm -lXmu -lXt -lXext -lSM -lICE -lX11 -lm -lefence
LIBS = -lXpm -lXm -lXmu -lXt -lXext -lSM -lICE -lX11 -lm
LIBPATH = -L/lib -L/usr/lib -L/usr/X11R6/lib/.
TARGET = demo
TARGET = ../libregister.a
# LIBHTMLW = ../lib/libhtmlw/libhtmlw.a
LIBXMHTML= ../lib/XmHTML-1.1.0/src/libXmHTML.a
@ -25,16 +26,17 @@ LIBXBAE = ../../lib/Xbae-4.6.2-linas/libXbae.a
LIBCOMBO = ../lib/ComboBox-1.33/libComboBox.a
LIBTRANS = ../Account.o ../Data.o ../FileIO.o ../Transaction.o ../date.o
######################################################################
SRCS = basiccell.c cellblock.c datecell.c main.c pricecell.c \
SRCS = basiccell.c cellblock.c datecell.c pricecell.c \
recncell.c register.c table.c textcell.c
OBJS = ${SRCS:.c=.o} $(LIBTRANS) $(LIBXBAE)
OBJS = ${SRCS:.c=.o}
######################################################################
default: $(TARGET)
$(TARGET): $(OBJS)
@echo "++++++"
$(CC) $(LFLAGS) $(OBJS) $(LIBPATH) $(LIBS) -o $@
$(AR) rv $(TARGET) $(OBJS)
$(RANLIB) $(TARGET)
static: $(STATIC)

View File

@ -38,10 +38,12 @@ xaccLoadRegister (BasicRegister *reg, Split **slist)
buff[1] = 0x0;
xaccSetBasicCellValue (reg->recnCell, buff);
xaccSetDebCredCellValue (reg->debitCell,
reg->creditCell, split->damount);
xaccSetAmountCellValue (reg->balanceCell, split->balance);
xaccCommitEdits (reg->table);
/*
reg->PriceCell
*/
i++;
split = slist[i];
}

View File

@ -61,4 +61,44 @@ xaccInitPriceCell (PriceCell *cell)
cell->cell.modify_verify = PriceMV;
}
/* ================================================ */
void xaccSetPriceCellValue (PriceCell * cell, double amt)
{
char buff[40];
cell->amount = amt;
sprintf (buff, "%.3f", amt);
xaccSetBasicCellValue ( &(cell->cell), buff);
}
/* ================================================ */
void xaccSetAmountCellValue (PriceCell * cell, double amt)
{
char buff[40];
cell->amount = amt;
sprintf (buff, "%.2f", amt);
xaccSetBasicCellValue ( &(cell->cell), buff);
}
/* ================================================ */
void xaccSetDebCredCellValue (PriceCell * deb,
PriceCell * cred, double amt)
{
char buff[40];
deb->amount = -amt;
cred->amount = amt;
if (0.0 <= amt) {
sprintf (buff, "%.2f", amt);
xaccSetBasicCellValue ( &(cred->cell), buff);
xaccSetBasicCellValue ( &(deb->cell), "");
} else {
sprintf (buff, "%.2f", -amt);
xaccSetBasicCellValue ( &(cred->cell), "");
xaccSetBasicCellValue ( &(deb->cell), buff);
}
}
/* --------------- end of file ---------------------- */

View File

@ -13,6 +13,18 @@ typedef struct _PriceCell {
PriceCell * xaccMallocPriceCell (void);
void xaccInitPriceCell (PriceCell *);
/* updates amount, string format is three decimal places */
void xaccSetPriceCellValue (PriceCell *, double amount);
/* updates amount, string format is two decimal places */
void xaccSetAmountCellValue (PriceCell *, double amount);
/* updates two cells; the deb cell if amt is negative,
* the credit cell if amount is positive, and makes the other cell
* blank. */
void xaccSetDebCredCellValue (PriceCell *deb,
PriceCell *cred, double amount);
#endif /* __XACC_PRICE_CELL_C__ */
/* --------------- end of file ---------------------- */