mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add reconcile abilities
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@415 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
79e3f02d5b
commit
67bfbd0735
@ -24,7 +24,7 @@ LIBXMHTML= ../lib/XmHTML-1.1.0/src/libXmHTML.a
|
|||||||
LIBXBAE = ../../lib/Xbae-4.6.2-linas/libXbae.a
|
LIBXBAE = ../../lib/Xbae-4.6.2-linas/libXbae.a
|
||||||
LIBCOMBO = ../lib/ComboBox-1.33/libComboBox.a
|
LIBCOMBO = ../lib/ComboBox-1.33/libComboBox.a
|
||||||
######################################################################
|
######################################################################
|
||||||
SRCS = cell.c datecell.c main.c price.c single.c table.c textcell.c
|
SRCS = cell.c datecell.c main.c price.c single.c recncell.c table.c textcell.c
|
||||||
OBJS = ${SRCS:.c=.o} $(LIBXBAE)
|
OBJS = ${SRCS:.c=.o} $(LIBXBAE)
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "datecell.h"
|
#include "datecell.h"
|
||||||
#include "price.h"
|
#include "price.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
|
#include "recncell.h"
|
||||||
#include "textcell.h"
|
#include "textcell.h"
|
||||||
|
|
||||||
#define DATE_CELL_C 0
|
#define DATE_CELL_C 0
|
||||||
@ -17,12 +18,20 @@
|
|||||||
#define MEMO_CELL_C 2
|
#define MEMO_CELL_C 2
|
||||||
#define MEMO_CELL_R 1
|
#define MEMO_CELL_R 1
|
||||||
|
|
||||||
#define CRED_CELL_C 3
|
#define RECN_CELL_C 3
|
||||||
|
#define RECN_CELL_R 0
|
||||||
|
|
||||||
|
#define CRED_CELL_C 4
|
||||||
#define CRED_CELL_R 0
|
#define CRED_CELL_R 0
|
||||||
|
|
||||||
#define DEBT_CELL_C 4
|
#define DEBT_CELL_C 5
|
||||||
#define DEBT_CELL_R 0
|
#define DEBT_CELL_R 0
|
||||||
|
|
||||||
|
#define BALN_CELL_C 6
|
||||||
|
#define BALN_CELL_R 0
|
||||||
|
|
||||||
|
#define MAX_COLS 7
|
||||||
|
|
||||||
typedef struct _BasicRegister {
|
typedef struct _BasicRegister {
|
||||||
Table * table;
|
Table * table;
|
||||||
CellBlock * cursor;
|
CellBlock * cursor;
|
||||||
@ -30,6 +39,7 @@ typedef struct _BasicRegister {
|
|||||||
SingleCell * dateCell;
|
SingleCell * dateCell;
|
||||||
SingleCell * descCell;
|
SingleCell * descCell;
|
||||||
SingleCell * memoCell;
|
SingleCell * memoCell;
|
||||||
|
SingleCell * recnCell;
|
||||||
PriceCell * creditCell;
|
PriceCell * creditCell;
|
||||||
PriceCell * debitCell;
|
PriceCell * debitCell;
|
||||||
|
|
||||||
@ -58,7 +68,7 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
|||||||
|
|
||||||
/* define the header */
|
/* define the header */
|
||||||
|
|
||||||
header = xaccMallocCellBlock (1, 10);
|
header = xaccMallocCellBlock (1, MAX_COLS);
|
||||||
reg->header = header;
|
reg->header = header;
|
||||||
|
|
||||||
cell = xaccMallocDateCell();
|
cell = xaccMallocDateCell();
|
||||||
@ -71,6 +81,11 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
|||||||
xaccAddCell (header, cell, 0, DESC_CELL_C);
|
xaccAddCell (header, cell, 0, DESC_CELL_C);
|
||||||
xaccSetSingleCellValue (cell, "Description");
|
xaccSetSingleCellValue (cell, "Description");
|
||||||
|
|
||||||
|
cell = xaccMallocRecnCell();
|
||||||
|
cell->width = 1;
|
||||||
|
xaccAddCell (header, cell, 0, RECN_CELL_C);
|
||||||
|
xaccSetSingleCellValue (cell, "R");
|
||||||
|
|
||||||
cell = (SingleCell *) xaccMallocPriceCell();
|
cell = (SingleCell *) xaccMallocPriceCell();
|
||||||
cell->width = 9;
|
cell->width = 9;
|
||||||
xaccAddCell (header, cell, 0, CRED_CELL_C);
|
xaccAddCell (header, cell, 0, CRED_CELL_C);
|
||||||
@ -81,9 +96,14 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
|||||||
xaccAddCell (header, cell, 0, DEBT_CELL_C);
|
xaccAddCell (header, cell, 0, DEBT_CELL_C);
|
||||||
xaccSetSingleCellValue (cell, "Debit");
|
xaccSetSingleCellValue (cell, "Debit");
|
||||||
|
|
||||||
|
cell = (SingleCell *) xaccMallocPriceCell();
|
||||||
|
cell->width = 9;
|
||||||
|
xaccAddCell (header, cell, 0, BALN_CELL_C);
|
||||||
|
xaccSetSingleCellValue (cell, "Balance");
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------- */
|
/* --------------------------- */
|
||||||
curs = xaccMallocCellBlock (2, 10);
|
curs = xaccMallocCellBlock (2, MAX_COLS);
|
||||||
reg->cursor = curs;
|
reg->cursor = curs;
|
||||||
|
|
||||||
cell = xaccMallocDateCell();
|
cell = xaccMallocDateCell();
|
||||||
@ -101,6 +121,11 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
|||||||
xaccAddCell (curs, cell, MEMO_CELL_R, MEMO_CELL_C);
|
xaccAddCell (curs, cell, MEMO_CELL_R, MEMO_CELL_C);
|
||||||
reg->memoCell = cell;
|
reg->memoCell = cell;
|
||||||
|
|
||||||
|
cell = xaccMallocRecnCell();
|
||||||
|
cell->width = 1;
|
||||||
|
xaccAddCell (curs, cell, RECN_CELL_R, RECN_CELL_C);
|
||||||
|
reg->memoCell = cell;
|
||||||
|
|
||||||
reg->creditCell = xaccMallocPriceCell();
|
reg->creditCell = xaccMallocPriceCell();
|
||||||
reg->creditCell->cell.width = 9;
|
reg->creditCell->cell.width = 9;
|
||||||
xaccAddCell (curs, &(reg->creditCell->cell), CRED_CELL_R, CRED_CELL_C);
|
xaccAddCell (curs, &(reg->creditCell->cell), CRED_CELL_R, CRED_CELL_C);
|
||||||
@ -112,7 +137,7 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
|||||||
table = xaccMallocTable (0, 0);
|
table = xaccMallocTable (0, 0);
|
||||||
table -> header = header;
|
table -> header = header;
|
||||||
xaccSetCursor (table, curs);
|
xaccSetCursor (table, curs);
|
||||||
xaccInitTable (table, 15, 1);
|
xaccInitTable (table, 5, 1);
|
||||||
reg->table = table;
|
reg->table = table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
56
src/register/recncell.c
Normal file
56
src/register/recncell.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "recncell.h"
|
||||||
|
#include "single.h"
|
||||||
|
|
||||||
|
/* hack alert -- temp defs should include Transaction.h */
|
||||||
|
#define NREC 'n'
|
||||||
|
#define CREC 'y'
|
||||||
|
|
||||||
|
/* ================================================ */
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
ToggleRecn (const char *cur_val)
|
||||||
|
{
|
||||||
|
char buff[2];
|
||||||
|
|
||||||
|
if (NREC == cur_val[0]) {
|
||||||
|
buff[0] = CREC;
|
||||||
|
} else {
|
||||||
|
buff[0] = NREC;
|
||||||
|
}
|
||||||
|
buff[1] = 0x0;
|
||||||
|
|
||||||
|
return strdup (buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================ */
|
||||||
|
|
||||||
|
SingleCell *
|
||||||
|
xaccMallocRecnCell (void)
|
||||||
|
{
|
||||||
|
SingleCell *cell;
|
||||||
|
cell = xaccMallocSingleCell();
|
||||||
|
xaccInitRecnCell (cell);
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================ */
|
||||||
|
|
||||||
|
void
|
||||||
|
xaccInitRecnCell (SingleCell *cell)
|
||||||
|
{
|
||||||
|
char buff[2];
|
||||||
|
|
||||||
|
buff[0] = NREC;
|
||||||
|
buff[1] = 0x0;
|
||||||
|
|
||||||
|
if (cell->value) free (cell->value);
|
||||||
|
cell ->value = strdup (buff);
|
||||||
|
|
||||||
|
cell->enter_cell = ToggleRecn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------- end of file ---------------------- */
|
13
src/register/recncell.h
Normal file
13
src/register/recncell.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
#ifndef __XACC_RECN_CELL_C__
|
||||||
|
#define __XACC_RECN_CELL_C__
|
||||||
|
|
||||||
|
#include "single.h"
|
||||||
|
|
||||||
|
/* installs a callback to handle reconcile flag */
|
||||||
|
SingleCell * xaccMallocRecnCell (void);
|
||||||
|
void xaccInitRecnCell (SingleCell *);
|
||||||
|
|
||||||
|
#endif /* __XACC_RECN_CELL_C__ */
|
||||||
|
|
||||||
|
/* --------------- end of file ---------------------- */
|
@ -273,6 +273,10 @@ enterCB (Widget mw, XtPointer cd, XtPointer cb)
|
|||||||
table->entries[row][col] = (char *) retval;
|
table->entries[row][col] = (char *) retval;
|
||||||
XbaeMatrixSetCell (mw, row, col, (char *) retval);
|
XbaeMatrixSetCell (mw, row, col, (char *) retval);
|
||||||
XbaeMatrixRefreshCell (mw, row, col);
|
XbaeMatrixRefreshCell (mw, row, col);
|
||||||
|
|
||||||
|
/* don't map a text widget */
|
||||||
|
cbs->map = False;
|
||||||
|
cbs->doit = False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user