a few more cell types

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@408 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-01-11 07:08:33 +00:00
parent f1a28a5528
commit 6ef3b1590d
6 changed files with 128 additions and 1 deletions

View File

@ -24,7 +24,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 main.c price.c single.c table.c
SRCS = cell.c datecell.c main.c price.c single.c table.c textcell.c
OBJS = ${SRCS:.c=.o} $(LIBXBAE)
######################################################################

37
src/register/datecell.c Normal file
View File

@ -0,0 +1,37 @@
#include <string.h>
#include "datecell.h"
#include "single.h"
/* ================================================ */
static const char *
DateMV (const char * old, const char *change, const char *new)
{
return new;
}
/* ================================================ */
SingleCell *
xaccMallocDateCell (void)
{
SingleCell *cell;
cell = xaccMallocSingleCell();
xaccInitDateCell (cell);
return cell;
}
/* ================================================ */
void
xaccInitDateCell (SingleCell *cell)
{
if (cell->value) free (cell->value);
cell ->value = strdup ("1/1/70");
cell ->modify_verify = DateMV;
}
/* --------------- end of file ---------------------- */

13
src/register/datecell.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef __XACC_DATE_CELL_C__
#define __XACC_DATE_CELL_C__
#include "single.h"
/* installs a callback to handle date recording */
SingleCell * xaccMallocDateCell (void);
void xaccInitDateCell (SingleCell *);
#endif /* __XACC_DATE_CELL_C__ */
/* --------------- end of file ---------------------- */

View File

@ -3,8 +3,15 @@
#include <Xm/Form.h>
#include <Xm/MainW.h>
#include "datecell.h"
#include "price.h"
#include "table.h"
#include "textcell.h"
#define DESC_CELL_C 2
#define DESC_CELL_R 0
#define MEMO_CELL_C 2
#define MEMO_CELL_R 1
Table *
CreateReg(Widget parent ) {
@ -34,6 +41,24 @@ CreateReg(Widget parent ) {
cell->width = 9;
xaccAddCell (curs, cell);
cell = xaccMallocDateCell();
cell->row = 0;
cell->col = 0;
cell->width = 9;
xaccAddCell (curs, cell);
cell = xaccMallocTextCell();
cell->row = DESC_CELL_R;
cell->col = DESC_CELL_C;
cell->width = 9;
xaccAddCell (curs, cell);
cell = xaccMallocTextCell();
cell->row = MEMO_CELL_R;
cell->col = MEMO_CELL_C;
cell->width = 9;
xaccAddCell (curs, cell);
table = xaccMallocTable (0, 0);
table -> cursor = curs;

39
src/register/textcell.c Normal file
View File

@ -0,0 +1,39 @@
#include <string.h>
#include "textcell.h"
#include "single.h"
/* ================================================ */
/* by definition, all text is valid text. So accept
* all modifications */
static const char *
TextMV (const char * old, const char *change, const char *new)
{
return new;
}
/* ================================================ */
SingleCell *
xaccMallocTextCell (void)
{
SingleCell *cell;
cell = xaccMallocSingleCell();
xaccInitTextCell (cell);
return cell;
}
/* ================================================ */
void
xaccInitTextCell (SingleCell *cell)
{
if (cell->value) free (cell->value);
cell->value = strdup ("");
cell->modify_verify = TextMV;
}
/* --------------- end of file ---------------------- */

13
src/register/textcell.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef __XACC_TEXT_CELL_C__
#define __XACC_TEXT_CELL_C__
#include "single.h"
/* installs a callback to handle text recording */
SingleCell * xaccMallocTextCell (void);
void xaccInitTextCell (SingleCell *);
#endif /* __XACC_TEXT_CELL_C__ */
/* --------------- end of file ---------------------- */