do single cells

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@395 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-01-09 02:05:18 +00:00
parent 38c2694313
commit c628823cb4
4 changed files with 129 additions and 0 deletions

56
src/register/Makefile Normal file
View File

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

24
src/register/basiccell.c Normal file
View File

@ -0,0 +1,24 @@
#include <stdlib.h>
#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 ---------------------- */

41
src/register/basiccell.h Normal file
View File

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

View File

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