mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
minor work
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@419 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
15e6d5dfcf
commit
b9fa7389a7
@ -24,7 +24,8 @@ 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 datecell.c main.c price.c single.c recncell.c table.c textcell.c
|
||||
SRCS = cell.c datecell.c main.c pricecell.c single.c recncell.c \
|
||||
table.c textcell.c
|
||||
OBJS = ${SRCS:.c=.o} $(LIBXBAE)
|
||||
######################################################################
|
||||
|
||||
|
@ -5,12 +5,37 @@
|
||||
#include "datecell.h"
|
||||
#include "single.h"
|
||||
|
||||
/* ================================================ */
|
||||
|
||||
#define DATE_SEP '/'
|
||||
|
||||
/* ================================================ */
|
||||
|
||||
static const char *
|
||||
DateMV (const char * old, const char *change, const char *new)
|
||||
DateEnter (const char * curr)
|
||||
{
|
||||
short day, month, year;
|
||||
char * datestr;
|
||||
char * sep;
|
||||
|
||||
/* OK, we just entered a newval cell. Find out
|
||||
* what date that cell thinks it has.
|
||||
*/
|
||||
day = 1;
|
||||
month = 1;
|
||||
year = 1970;
|
||||
|
||||
printf ("curr is %p \n", curr);
|
||||
printf ("curr val is %s \n", curr);
|
||||
sscanf (curr, "%d/%d/%d", day, month, year);
|
||||
|
||||
printf ("enter parsed %d %d %d \n", day, month, year);
|
||||
|
||||
return curr;
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
|
||||
static const char *
|
||||
DateMV (const char * oldval, const char *change, const char *newval)
|
||||
{
|
||||
int accel=0;
|
||||
short day, month, year;
|
||||
@ -18,13 +43,13 @@ DateMV (const char * old, const char *change, const char *new)
|
||||
char * sep;
|
||||
|
||||
/* if user hit backspace, accept the change */
|
||||
if (!change) return new;
|
||||
if (!change) return newval;
|
||||
|
||||
/* accept any numeric input */
|
||||
if (isdigit (change[0])) return new;
|
||||
if (isdigit (change[0])) return newval;
|
||||
|
||||
/* accept the separator character */
|
||||
if (DATE_SEP == change[0]) return new;
|
||||
if (DATE_SEP == change[0]) return newval;
|
||||
|
||||
/* otherwise, maybe its an accelerator key.
|
||||
* parse the date string */
|
||||
@ -32,7 +57,7 @@ DateMV (const char * old, const char *change, const char *new)
|
||||
month = 1;
|
||||
year = 1970;
|
||||
|
||||
sscanf (new, "%d/%d/%d", day, month, year);
|
||||
sscanf (newval, "%d/%d/%d", day, month, year);
|
||||
|
||||
printf ("parsed %d %d %d \n", day, month, year);
|
||||
|
||||
@ -45,13 +70,36 @@ printf ("parsed %d %d %d \n", day, month, year);
|
||||
|
||||
default:
|
||||
/* accept any numeric input */
|
||||
if (isdigit (change[0])) return new;
|
||||
if (isdigit (change[0])) return newval;
|
||||
}
|
||||
|
||||
if (accel) {
|
||||
}
|
||||
|
||||
return new;
|
||||
return newval;
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
|
||||
static const char *
|
||||
DateLeave (const char * curr)
|
||||
{
|
||||
short day, month, year;
|
||||
char * datestr;
|
||||
char * sep;
|
||||
|
||||
/* otherwise, maybe its an accelerator key.
|
||||
* parse the date string */
|
||||
day = 1;
|
||||
month = 1;
|
||||
year = 1970;
|
||||
|
||||
sscanf (curr, "%d/%d/%d", day, month, year);
|
||||
|
||||
printf ("leave parsed %d %d %d \n", day, month, year);
|
||||
|
||||
|
||||
return curr;
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
@ -81,6 +129,7 @@ xaccInitDateCell (SingleCell *cell)
|
||||
if (cell->value) free (cell->value);
|
||||
cell ->value = strdup (buff);
|
||||
|
||||
cell ->enter_cell = DateEnter;
|
||||
cell ->modify_verify = DateMV;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,13 @@
|
||||
|
||||
#include "single.h"
|
||||
|
||||
/*
|
||||
typedef struct _DateCell {
|
||||
SingleCell cell;
|
||||
double amount;
|
||||
} DateCell;
|
||||
*/
|
||||
|
||||
/* installs a callback to handle date recording */
|
||||
SingleCell * xaccMallocDateCell (void);
|
||||
void xaccInitDateCell (SingleCell *);
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <Xm/MainW.h>
|
||||
|
||||
#include "datecell.h"
|
||||
#include "price.h"
|
||||
#include "pricecell.h"
|
||||
#include "table.h"
|
||||
#include "recncell.h"
|
||||
#include "textcell.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "price.h"
|
||||
#include "pricecell.h"
|
||||
#include "single.h"
|
||||
|
||||
#define DECIMAL_PT '.'
|
||||
|
@ -146,7 +146,6 @@ cellCB (Widget mw, XtPointer cd, XtPointer cb)
|
||||
|
||||
row = cbs->row;
|
||||
col = cbs->column;
|
||||
printf ("cell cb %d %d %d \n", row, col, cbs->reason);
|
||||
|
||||
/* can't edit outside of the physical space */
|
||||
invalid = (0 > row) || (0 > col) ;
|
||||
@ -367,6 +366,7 @@ modifyCB (Widget mw, XtPointer cd, XtPointer cb)
|
||||
free (table->entries[row][col]);
|
||||
table->entries[row][col] = strdup (newval);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -407,11 +407,13 @@ leaveCB (Widget mw, XtPointer cd, XtPointer cb)
|
||||
|
||||
val = cbs->value;
|
||||
retval = leave (val);
|
||||
if (val != retval) {
|
||||
if (table->entries[row][col]) free (table->entries[row][col]);
|
||||
table->entries[row][col] = (char *) retval;
|
||||
cbs->value = strdup (retval);
|
||||
}
|
||||
|
||||
if (NULL == retval) retval = "";
|
||||
|
||||
/* save whatever was returned */
|
||||
if (table->entries[row][col]) free (table->entries[row][col]);
|
||||
table->entries[row][col] = (char *) retval;
|
||||
cbs->value = strdup (retval);
|
||||
} else {
|
||||
if (table->entries[row][col]) free (table->entries[row][col]);
|
||||
table->entries[row][col] = strdup (cbs->value);
|
||||
|
Loading…
Reference in New Issue
Block a user