mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
more quick-fill basic infrastructure
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@456 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
13654f3607
commit
0c110c0cda
@ -32,7 +32,7 @@ xaccLoadRegister (BasicRegister *reg, Split **slist)
|
||||
xaccSetBasicCellValue (reg->dateCell, buff);
|
||||
|
||||
xaccSetBasicCellValue (reg->numCell, trans->num);
|
||||
xaccSetBasicCellValue (reg->descCell, trans->description);
|
||||
xaccSetQuickFillCellValue (reg->descCell, trans->description);
|
||||
xaccSetBasicCellValue (reg->memoCell, split->memo);
|
||||
|
||||
buff[0] = split->reconciled;
|
||||
|
@ -55,7 +55,7 @@ LIBREG = libregister.a
|
||||
######################################################################
|
||||
SRCS = AccWindow.c Account.c AccountMenu.c AdjBWindow.c \
|
||||
BuildMenu.c Data.c Destroy.c FileBox.c FileIO.c HelpWindow.c \
|
||||
Ledger.c LedgerUtils.c MainWindow.c QIFIO.c QuickFill.c \
|
||||
Ledger.c LedgerUtils.c MainWindow.c QIFIO.c \
|
||||
RecnWindow.c RegWindow.c Reports.c TextBox.c Transaction.c \
|
||||
XferWindow.c date.c main.c util.c xtutil.c
|
||||
# OBJS = ${SRCS:.c=.o} $(LIBHTMLW) $(LIBXBAE) $(LIBCOMBO)
|
||||
|
@ -55,7 +55,7 @@ CHAR_TO_INDEX( char c )
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
QuickFill *
|
||||
mallocQuickFill( void )
|
||||
xaccMallocQuickFill( void )
|
||||
{
|
||||
int i;
|
||||
QuickFill *qf = (QuickFill *)_malloc(sizeof(QuickFill));
|
||||
@ -71,14 +71,14 @@ mallocQuickFill( void )
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
void
|
||||
freeQuickFill( QuickFill *qf )
|
||||
xaccFreeQuickFill( QuickFill *qf )
|
||||
{
|
||||
if( qf != NULL )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<QFNUM; i++ )
|
||||
freeQuickFill( qf->qf[i] );
|
||||
xaccFreeQuickFill( qf->qf[i] );
|
||||
|
||||
_free(qf);
|
||||
}
|
||||
@ -87,7 +87,7 @@ freeQuickFill( QuickFill *qf )
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
QuickFill *
|
||||
getQuickFill( QuickFill *qf, char c )
|
||||
xaccGetQuickFill( QuickFill *qf, char c )
|
||||
{
|
||||
if( qf != NULL )
|
||||
{
|
||||
@ -101,9 +101,9 @@ getQuickFill( QuickFill *qf, char c )
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
void
|
||||
qfInsertText( QuickFill *qf, const char * text )
|
||||
xaccQFInsertText( QuickFill *qf, const char * text )
|
||||
{
|
||||
qfInsertTransactionRec( qf, text, 0 );
|
||||
qfInsertTextRec( qf, text, 0 );
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@ -111,23 +111,23 @@ qfInsertText( QuickFill *qf, const char * text )
|
||||
static void
|
||||
qfInsertTextRec( QuickFill *qf, const char *text, int depth )
|
||||
{
|
||||
if( qf != NULL )
|
||||
if (NULL == qf) return;
|
||||
|
||||
if( text )
|
||||
{
|
||||
if( text )
|
||||
if( text[depth] != '\0' )
|
||||
{
|
||||
if( text[depth] != '\0' )
|
||||
{
|
||||
int index = CHAR_TO_INDEX( text[depth] );
|
||||
|
||||
if( qf->qf[index] == NULL )
|
||||
qf->qf[index] = mallocQuickFill();
|
||||
|
||||
qf->qf[index]->text = text;
|
||||
|
||||
qfInsertTransactionRec( qf->qf[index], text, ++depth );
|
||||
}
|
||||
int index = CHAR_TO_INDEX( text[depth] );
|
||||
|
||||
if( qf->qf[index] == NULL )
|
||||
qf->qf[index] = xaccMallocQuickFill();
|
||||
|
||||
qf->qf[index]->text = text;
|
||||
|
||||
qfInsertTextRec( qf->qf[index], text, ++depth );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/********************** END OF FILE *********************************\
|
||||
\********************************************************************/
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "MainWindow.h"
|
||||
#include "main.h"
|
||||
#include "messages.h"
|
||||
#include "QuickFill.h"
|
||||
#include "RecnWindow.h"
|
||||
#include "Transaction.h"
|
||||
#include "util.h"
|
||||
|
@ -4,19 +4,51 @@
|
||||
#include "basiccell.h"
|
||||
#include "quickfillcell.h"
|
||||
|
||||
/* ================================================ */
|
||||
/* when entering new cell, reset pointer to root */
|
||||
|
||||
static const char *
|
||||
quick_enter (struct _BasicCell *_cell,
|
||||
const char *val)
|
||||
{
|
||||
QuickFillCell *cell = (QuickFillCell *) _cell;
|
||||
|
||||
cell->qf = cell->qfRoot;
|
||||
return val;
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
/* by definition, all text is valid text. So accept
|
||||
* all modifications */
|
||||
|
||||
static const char *
|
||||
quickMV (struct _BasicCell *_cell,
|
||||
quick_modify (struct _BasicCell *_cell,
|
||||
const char *oldval,
|
||||
const char *change,
|
||||
const char *newval)
|
||||
{
|
||||
|
||||
printf ("change is %s \n", change);
|
||||
if (change) {
|
||||
}
|
||||
|
||||
return newval;
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
/* when leaving cell, make sure that text was put into the qf */
|
||||
|
||||
static const char *
|
||||
quick_leave (struct _BasicCell *_cell,
|
||||
const char *val)
|
||||
{
|
||||
QuickFillCell *cell = (QuickFillCell *) _cell;
|
||||
|
||||
cell->qf = cell->qfRoot;
|
||||
xaccQFInsertText (cell->qfRoot, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
|
||||
QuickFillCell *
|
||||
@ -26,7 +58,8 @@ xaccMallocQuickFillCell (void)
|
||||
cell = xaccMallocQuickFillCell();
|
||||
xaccInitBasicCell (&(cell->cell));
|
||||
|
||||
cell->qf = xaccMallocQuickFill();
|
||||
cell->qfRoot = xaccMallocQuickFill();
|
||||
cell->qf = cell->qfRoot;
|
||||
return cell;
|
||||
}
|
||||
|
||||
@ -35,7 +68,18 @@ xaccMallocQuickFillCell (void)
|
||||
void
|
||||
xaccInitQuickFillCell (QuickFillCell *cell)
|
||||
{
|
||||
cell->cell.modify_verify = quickMV;
|
||||
cell->cell.enter_cell = quick_enter;
|
||||
cell->cell.modify_verify = quick_modify;
|
||||
cell->cell.leave_cell = quick_leave;
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
|
||||
void
|
||||
xaccSetQuickFillCellValue (QuickFillCell *cell, char * value)
|
||||
{
|
||||
xaccQFInsertText (cell->qfRoot, value);
|
||||
xaccSetBasicCellValue (&(cell->cell), value);
|
||||
}
|
||||
|
||||
/* =============== END OF FILE ==================== */
|
||||
|
@ -4,7 +4,12 @@
|
||||
* quickfillcell.h
|
||||
*
|
||||
* FUNCTION:
|
||||
* implements a text cell with quick-fill capabilities
|
||||
* Implements a text cell with quick-fill capabilities.
|
||||
*
|
||||
* The xaccSetQuickFillCellValue() method sets the
|
||||
* current cell value to the indicated string,
|
||||
* simultaneously adding the string to the quick-fill
|
||||
* tree.
|
||||
*
|
||||
* HISTORY:
|
||||
* Copyright (c) 1997, 1998 Linas Vepstas
|
||||
@ -18,13 +23,16 @@
|
||||
|
||||
typedef struct _QuickFillCell {
|
||||
BasicCell cell;
|
||||
QuickFill *qf;
|
||||
QuickFill *qfRoot; /* root of quickfill-tree
|
||||
* handled by this cell */
|
||||
QuickFill *qf; /* current positin in tree */
|
||||
} QuickFillCell;
|
||||
|
||||
/* installs a callback to handle price recording */
|
||||
QuickFillCell * xaccMallocQuickFillCell (void);
|
||||
void xaccInitQuickFillCell (QuickFillCell *);
|
||||
|
||||
void xaccSetQuickFillCellValue (QuickFillCell *, char *);
|
||||
|
||||
#endif /* __XACC_FILL_CELL_C__ */
|
||||
|
||||
|
@ -129,10 +129,9 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
xaccAddCell (curs, cell, XFRM_CELL_R, XFRM_CELL_C);
|
||||
reg->xferCell = cell;
|
||||
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (curs, cell, DESC_CELL_R, DESC_CELL_C);
|
||||
reg->descCell = cell;
|
||||
reg->descCell = xaccMallocQuickFillCell();
|
||||
reg->descCell->cell.width = 9;
|
||||
xaccAddCell (curs, &(reg->descCell->cell), DESC_CELL_R, DESC_CELL_C);
|
||||
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 9;
|
||||
|
@ -8,25 +8,26 @@
|
||||
|
||||
#include "basiccell.h"
|
||||
#include "datecell.h"
|
||||
#include "quickfillcell.h"
|
||||
#include "pricecell.h"
|
||||
#include "table.h"
|
||||
#include "recncell.h"
|
||||
#include "textcell.h"
|
||||
|
||||
typedef struct _BasicRegister {
|
||||
Table * table;
|
||||
CellBlock * cursor;
|
||||
CellBlock * header;
|
||||
BasicCell * dateCell;
|
||||
BasicCell * numCell;
|
||||
BasicCell * actionCell;
|
||||
BasicCell * xferCell;
|
||||
BasicCell * descCell;
|
||||
BasicCell * memoCell;
|
||||
BasicCell * recnCell;
|
||||
PriceCell * creditCell;
|
||||
PriceCell * debitCell;
|
||||
PriceCell * balanceCell;
|
||||
Table * table;
|
||||
CellBlock * cursor;
|
||||
CellBlock * header;
|
||||
BasicCell * dateCell;
|
||||
BasicCell * numCell;
|
||||
BasicCell * actionCell;
|
||||
BasicCell * xferCell;
|
||||
QuickFillCell * descCell;
|
||||
BasicCell * memoCell;
|
||||
BasicCell * recnCell;
|
||||
PriceCell * creditCell;
|
||||
PriceCell * debitCell;
|
||||
PriceCell * balanceCell;
|
||||
|
||||
} BasicRegister;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user