From c628823cb4ee4a2e23f9ee56ccca7f641764f0f4 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Fri, 9 Jan 1998 02:05:18 +0000 Subject: [PATCH] do single cells git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@395 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/Makefile | 56 ++++++++++++++++++++++++++++++++++++++++ src/register/basiccell.c | 24 +++++++++++++++++ src/register/basiccell.h | 41 +++++++++++++++++++++++++++++ src/register/cellblock.c | 8 ++++++ 4 files changed, 129 insertions(+) create mode 100644 src/register/Makefile create mode 100644 src/register/basiccell.c create mode 100644 src/register/basiccell.h diff --git a/src/register/Makefile b/src/register/Makefile new file mode 100644 index 0000000000..bfb4546264 --- /dev/null +++ b/src/register/Makefile @@ -0,0 +1,56 @@ + +srcdir = . +CC = gcc +INCLPATH = -I/usr/include \ + -I/usr/X11R6/include/. \ + -I./../include \ + -I./../lib/ComboBox-1.33 \ + -I./../lib/XmHTML-1.1.0/src \ + -I./../lib/Xbae-4.6.2-linas + +# libhtmlw eliminated due to license restrictions +# and general brokenness +# -I./../lib/libhtmlw + +CFLAGS = -g -DCELL_WIDGETS=1 +LFLAGS = -O2 +LIBS = -lXpm -lXm -lXmu -lXt -lXext -lSM -lICE -lX11 -lpng -ljpeg -lz -lm +LIBPATH = -L/lib -L/usr/lib -L/usr/X11R6/lib/. +TARGET = xacc +STATIC = xacc-static + +# LIBHTMLW = ../lib/libhtmlw/libhtmlw.a +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 = single.c +OBJS = ${SRCS:.c=.o} +###################################################################### + +default: $(TARGET) + +$(TARGET): $(OBJS) + @echo "++++++" + $(CC) $(LFLAGS) $(OBJS) $(LIBPATH) $(LIBS) -o $@ + +static: $(STATIC) + +$(STATIC): $(OBJS) + @echo "++++++" + $(CC) $(LFLAGS) $(OBJS) $(LIBPATH) $(LIBS) -o $@ -static + +.c.o: + @echo "+++" + $(CC) -c $(CFLAGS) $(INCLPATH) $< + +depend: + makedepend -- $(INCLPATH) $(DEFN) -- $(SRCS) + +clean: + rm -f *.o *~ *.bak + +distclean: clean + rm -f $(TARGET) Makefile Makefile.bak config.h + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/register/basiccell.c b/src/register/basiccell.c new file mode 100644 index 0000000000..ef8c4dcf47 --- /dev/null +++ b/src/register/basiccell.c @@ -0,0 +1,24 @@ + +#include + +#include "single.h" + +SingleCell * xaccMallocSingleCell (void) +{ + SingleCell * cell; + cell = (SingleCell *) malloc (sizeof (SingleCell)); + xaccInitSingleCell (cell); + return cell; +} + +void xaccInitSingleCell (SingleCell *cell) +{ + cell->type = 0; + cell->row = 0; + cell->col = 0; + cell->width = 0; + cell->value = 0x0; + cell->modify_verify = NULL; +} + +/* ------------------ end of file ---------------------- */ diff --git a/src/register/basiccell.h b/src/register/basiccell.h new file mode 100644 index 0000000000..c88f239ff0 --- /dev/null +++ b/src/register/basiccell.h @@ -0,0 +1,41 @@ +/* + * single.h + */ + +#ifndef __XACC_SINGLE_H__ +#define __XACC_SINGLE_H__ +/* cell types */ +enum { + DATE, + PRICE, /* two-digit float point display */ + AMOUNT, /* three-digit float point display */ + TEXT, /* string text */ + COMBO, /* combobox */ +}; + + +/* The modify-verify callback is called when a user + * makes a change to a cell. The input is a changed string. + * It must return a string, or void if it rejects the change. + */ + +typedef struct _SingleCell { + + short type; /* cell type */ + short row; /* relative row position */ + short col; /* relative column position */ + short width; /* column width, in chars, not pixels */ + + char * value; /* current value */ + + char * (*modify_verify) (char *); /* modify verify callback */ + + +} SingleCell; + + +SingleCell * xaccMallocSingleCell (void); +void xaccInitSingleCell (SingleCell *); + +#endif /* __XACC_SINGLE_H__ */ +/* ------------------ end of file ---------------------- */ diff --git a/src/register/cellblock.c b/src/register/cellblock.c index 5473afe71c..8b2ef203c4 100644 --- a/src/register/cellblock.c +++ b/src/register/cellblock.c @@ -35,6 +35,7 @@ typedef struct _CellArray { SingleCell **cells; /* row-col array */ + Widget reg; /* the XbaeMatrix */ } CellArray; SingleCell * xaccMallocSingleCell (void); @@ -43,11 +44,18 @@ void xaccInitSingleCell (SingleCell *); CellArray * xaccMallocCellArray (void); void xaccInitCellArray (CellArray *, int numrows, int numcols); +void xaccDestroyCellArray (CellArray *); /* add a cell to the array */ void xaccAddCell (SingleCell *); +/* installs a callback to handle price recording */ +void xaccInitPriceCell (SingleCell *); + + + + SingleCell * xaccMallocSingleCell (void) {