*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2114 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-03-24 09:47:27 +00:00
parent cbb60d3362
commit 8484d9030e
14 changed files with 462 additions and 149 deletions

View File

@ -1,3 +1,9 @@
2000-03-24 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/register/numcell.c: new cell for entering numbers. Handles
accelerators for increasing/decreasing the number and remembers
the largest number for auto-filling.
2000-03-23 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/scm/report/average-balance.scm: fixed many things and i18n'd

View File

@ -1,12 +1,12 @@
# Messages en francais pour Gnucash
# Copyright (C) 1999 Free Software Foundation, Inc.
# Yannick LE NY <y-le-ny@ifrance.com>, 1998,1999,2000.
# Copyright (C) 1998,1999,2000 Free Software Foundation, Inc.
# Copyright (C) 1998,1999,2000 Yannick LE NY <y-le-ny@ifrance.com>,
#
msgid ""
msgstr ""
"Project-Id-Version: gnucash 1.3.3\n"
"POT-Creation-Date: 2000-03-23 03:24-0800\n"
"PO-Revision-Date: 2000-03-20 16:47+0200\n"
"PO-Revision-Date: 2000-03-23 22:24+0200\n"
"Last-Translator: Yannick LE NY <y-le-ny@ifrance.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
@ -52,7 +52,7 @@ msgid ""
msgstr ""
"Voulez-vous créer un nouveau compte?\n"
"Sinon, sélectionnez alors un compte\n"
"fuzzà ouvrir dans la fenetre principale.\n"
"à ouvrir dans la fenêtre principale.\n"
#: messages-i18n.c:15
msgid ""
@ -147,7 +147,7 @@ msgid ""
"Are You Sure?\n"
msgstr ""
"Il est dangereux de changer le type de monnaie\n"
"d'un compte. Vous demandez a le changer\n"
"d'un compte. Vous demandez à le changer\n"
"de %s vers %s\n"
"Etes-vous sur?\n"
@ -240,7 +240,7 @@ msgstr ""
#: messages-i18n.c:39
msgid "Changes have been made since the last Save. Save the data to file?"
msgstr ""
"Des changements ont été fait depuis la derniere sauvegarde.\n"
"Des changements ont été fait depuis la dernière sauvegarde.\n"
"Enregistrer les changements dans le fichier?"
#: messages-i18n.c:40
@ -282,16 +282,16 @@ msgstr ""
#: messages-i18n.c:43
msgid "You need to install the gnome-print library."
msgstr ""
msgstr "Vous avez besoin d'installer la librairie gnome-print."
#: messages-i18n.c:44
#, c-format
msgid "QIF file load failed. %s"
msgstr ""
msgstr "Le chargement du fichier QIF a échoué."
#: messages-i18n.c:45
msgid "QIF file load failed. Check settings and reload."
msgstr ""
msgstr "Le chargement du fichier QIF a échoué.Vérifiez les paramètres et rechargez"
#: messages-i18n.c:46
msgid "The source for price quotes"
@ -410,7 +410,7 @@ msgstr ""
#: messages-i18n.c:62
msgid "You can't transfer from and to the same account!"
msgstr "Vous ne pouvez pas transférer depuis et vers le meme compte!"
msgstr "Vous ne pouvez pas transférer depuis et vers le même compte!"
#: messages-i18n.c:63
msgid ""
@ -566,7 +566,7 @@ msgstr "Ouvrir la bo
#: messages-i18n.c:98
msgid "Print a check using a standard format"
msgstr ""
msgstr "Imprimer un chèque en utilisant un format standard"
#: messages-i18n.c:99
msgid "Reconcile the selected account"
@ -766,7 +766,7 @@ msgstr "Pr
#: messages-i18n.c:148
msgid "_Print Check (unfinished!)"
msgstr ""
msgstr "Imprimer chèques (non terminé!)"
#: messages-i18n.c:149
msgid "_Reconcile"
@ -1701,7 +1701,7 @@ msgstr "Trier par date"
#: po/guile_strings.txt:34
#, c-format
msgid "Report for %s and all subaccounts."
msgstr ""
msgstr "Rapport pour %s et tous les sous-comptes."
#: po/guile_strings.txt:35
msgid "Account types to display"
@ -1736,9 +1736,8 @@ msgid "US-style: mm/dd/yyyy"
msgstr "Style-US: mm/jj/aaaa"
#: po/guile_strings.txt:43
#, fuzzy
msgid "You have not selected an account."
msgstr "Vous devez sélectionner un type de compte."
msgstr "Vous n'avez pas sélectionné un compte."
#: po/guile_strings.txt:44
msgid "By default, show every transaction in an account."
@ -1785,9 +1784,8 @@ msgid "Display the Hello, World report."
msgstr "Affiche le rapport Bonjour,tout le monde"
#: po/guile_strings.txt:58
#, fuzzy
msgid "Gain"
msgstr "Gain net"
msgstr ""
#: po/guile_strings.txt:59
msgid "Hello Again"
@ -1844,7 +1842,7 @@ msgstr ""
#: po/guile_strings.txt:72
msgid "Import QIF File - Scripted in Guile."
msgstr "Importer des fichiers QIF - lu par Guile."
msgstr "Importer des fichiers QIF - écrit en Guile."
#: po/guile_strings.txt:73
msgid "Show Horizontal Borders"
@ -1884,9 +1882,8 @@ msgid "The background color for the active transaction in single mode"
msgstr "La couleur de l'arrière-plan pour la transaction active en mode simple"
#: po/guile_strings.txt:81
#, fuzzy
msgid "Loss"
msgstr "Gain/Pertes"
msgstr "Pertes"
#: po/guile_strings.txt:82
msgid "Credit Accounts"
@ -1915,7 +1912,7 @@ msgstr "Options de num
#: po/guile_strings.txt:89
#, fuzzy, c-format
msgid "Report for %s."
msgstr "Rapports"
msgstr "Rapports pour %s."
#: po/guile_strings.txt:90
msgid "Reverse Income and Expense Accounts"
@ -2006,9 +2003,8 @@ msgid "Date Format Display"
msgstr "Affichage du format de date"
#: po/guile_strings.txt:114
#, fuzzy
msgid "Ending"
msgstr "Ascendant"
msgstr "Final"
#: po/guile_strings.txt:115
msgid "Reversed-balance account types"
@ -2028,7 +2024,7 @@ msgstr "Options du rapport"
#: po/guile_strings.txt:122
msgid "Calculate balance sheet up to this date"
msgstr "Calculer la feuille du solde/bilan jsqu'à cette date"
msgstr "Calculer la feuille du solde/bilan jusqu'à cette date"
#: po/guile_strings.txt:123
msgid "Alternate the even and odd colors with each transaction, not each row"
@ -2286,7 +2282,7 @@ msgstr "vrai"
#: po/guile_strings.txt:191
msgid "Period Ending"
msgstr ""
msgstr "Période finale"
#: po/guile_strings.txt:192
msgid "Income.Salary.Taxable"
@ -2334,7 +2330,7 @@ msgid ""
"This is a sample GnuCash report. See the guile (scheme) source code in %s "
"for details on writing your own reports, or extending existing reports."
msgstr ""
"C'est un exemple de rapport de Gnucash. Regardez le code source de Guile "
"C'est un exemple de rapport de Gnucash. Regardez le code source en Guile "
"(scheme) dans %s pour les détails sur l'écriture de vos propres rapports, ou "
"étendez les rapports existants."
@ -2350,7 +2346,7 @@ msgstr ""
#: po/guile_strings.txt:207
msgid "Display the Budget report."
msgstr "Affiche le rapport de la feuille du solde/bilan"
msgstr "Affiche le rapport du budget."
#: po/guile_strings.txt:208
msgid "_Hello, World"
@ -2613,7 +2609,7 @@ msgstr "El
#: po/guile_strings.txt:275
msgid "Beginning"
msgstr ""
msgstr "Début"
#: po/guile_strings.txt:276
#, c-format
@ -2631,7 +2627,7 @@ msgid ""
"The background color for an active transaction in multi-line mode and the "
"auto modes"
msgstr ""
"L'arrière-plan en couleur pour une répartition active en mode multi ligneset "
"L'arrière-plan en couleur pour une répartition active en mode multi lignes et "
"en modes auto"
#: po/guile_strings.txt:278
@ -2801,24 +2797,20 @@ msgid "Mutual"
msgstr "Fonds communs"
#: src/gnome/glade-gnc-dialogs.c:763
#, fuzzy
msgid "Print Check"
msgstr "Vérifier"
msgstr "Imprimer chèque"
#: src/gnome/glade-gnc-dialogs.c:778
#, fuzzy
msgid "Select Printer"
msgstr "Sélectionner un fichier"
msgstr "Sélectionner une imprimante"
#: src/gnome/glade-gnc-dialogs.c:785
#, fuzzy
msgid "Preview"
msgstr "Cours"
msgstr "Prévisualisation"
#: src/gnome/print-session.c:118
#, fuzzy
msgid "You must select a printer first."
msgstr "Vous devez sélectionner un type de compte."
msgstr "Vous devez dabord sélectionner une imprimante."
#~ msgid "Failed to load QIF file. Are you sure it's a QIF file?"
#~ msgstr ""

View File

@ -1171,10 +1171,10 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
}
if (MOD_NUM & changed) {
DEBUG ("xaccSRSaveRegEntry(): MOD_NUM: %s\n", reg->numCell->value);
xaccTransSetNum (trans, reg->numCell->value);
DEBUG ("xaccSRSaveRegEntry(): MOD_NUM: %s\n", reg->numCell->cell.value);
xaccTransSetNum (trans, reg->numCell->cell.value);
}
if (MOD_DESC & changed) {
DEBUG ("xaccSRSaveRegEntry(): MOD_DESC: %s\n",
reg->descCell->cell.value);
@ -1447,7 +1447,7 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
if (!split) {
/* we interpret a NULL split as a blank split */
xaccSetDateCellValueSecs (reg->dateCell, 0);
xaccSetBasicCellValue (reg->numCell, "");
xaccSetNumCellValue (reg->numCell, "");
xaccSetQuickFillCellValue (reg->descCell, "");
xaccSetBasicCellValue (reg->recnCell, "");
xaccSetPriceCellValue (reg->shrsCell, 0.0);
@ -1473,7 +1473,7 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
secs = xaccTransGetDateL (trans);
xaccSetDateCellValueSecsL (reg->dateCell, secs);
xaccSetBasicCellValue (reg->numCell, xaccTransGetNum (trans));
xaccSetNumCellValue (reg->numCell, xaccTransGetNum (trans));
xaccSetQuickFillCellValue (reg->descCell,
xaccTransGetDescription (trans));

View File

@ -32,7 +32,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <ctype.h>
#include "config.h"
@ -354,31 +353,6 @@ xaccQueryShowLatestDateFound (Query *q)
} \
}
static gncBoolean
gnc_strisnum(char *s)
{
if (s == NULL) return GNC_F;
if (*s == 0) return GNC_F;
while (*s && isspace(*s))
s++;
if (*s == 0) return GNC_F;
if (!isdigit(*s)) return GNC_F;
while (*s && isdigit(*s))
s++;
if (*s == 0) return GNC_T;
while (*s && isspace(*s))
s++;
if (*s == 0) return GNC_T;
return GNC_F;
}
#define CNUM { \
/* sort on transaction number */ \
unsigned long n1; \

View File

@ -28,6 +28,7 @@
#include <math.h>
#include <string.h>
#include <locale.h>
#include <ctype.h>
/* #include <glib.h> */
@ -193,6 +194,35 @@ util_fptostr(char *buf, double val, int prec)
return strlen(buf);
}
/********************************************************************\
* returns GNC_T if the string is a number, possibly with whitespace
\********************************************************************/
gncBoolean
gnc_strisnum(const char *s)
{
if (s == NULL) return GNC_F;
if (*s == 0) return GNC_F;
while (*s && isspace(*s))
s++;
if (*s == 0) return GNC_F;
if (!isdigit(*s)) return GNC_F;
while (*s && isdigit(*s))
s++;
if (*s == 0) return GNC_T;
while (*s && isspace(*s))
s++;
if (*s == 0) return GNC_T;
return GNC_F;
}
/********************************************************************\
* stpcpy for those platforms that don't have it.
\********************************************************************/

View File

@ -130,6 +130,9 @@ int safe_strcmp (const char * da, const char * db);
char * ultostr (unsigned long val, int base);
/* Returns true if string s is a number, possibly
* surrounded by whitespace. */
gncBoolean gnc_strisnum(const char *s);
/* The gnc_localeconv() subroutine returns an lconv structure
* containing locale information. If no locale is set, the

View File

@ -1,6 +1,6 @@
# Makefile -- makefile for xacc/src/register
# Copyright (C) 1997 Robin Clark
# Copyright (C) 1998 Linas Vepstas
# Copyright (C) 1998, 1999, 2000 Linas Vepstas
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@ -40,7 +40,7 @@ CFLAGS := @CFLAGS@ @X_CFLAGS@ -DCELL_WIDGETS=1 ${INCLPATH} ${CPPFLAGS}
# See Makefile.common for information about these variables.
COMMON_SRCS := basiccell.c cellblock.c \
datecell.c pricecell.c QuickFill.c quickfillcell.c \
recncell.c splitreg.c \
recncell.c splitreg.c numcell.c \
table-allgui.c table-html.c textcell.c
MOTIF_SRCS := table-motif.c combocell-motif.c quickfillcell-motif.c
GNOME_SRCS := table-gnome.c

View File

@ -1,3 +1,19 @@
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
/*
* FILE:
* basiccell.h
@ -13,7 +29,7 @@
* by the "user". In the text below, the "user" is the
* person controlling the mouse and keyboard. Thus, when
* the user makes a move, it means that they have somehow
* intereacted with the cell, by clikcing with mouse or by
* interacted with the cell, by clicking with mouse or by
* typing at the keyboard. This class provides three
* callbacks which allow the programmer to understand what
* the user is doing.
@ -45,7 +61,7 @@
* of register cells.
*
* If ALLOW_INPUT is not set, the cell is supposed to
* to only display values, but not accept user input. If
* to only display values, but not accept user input. If
* set, then the callbacks below are used to when the
* cell is entered.
*
@ -94,7 +110,7 @@
*
* The arguments passed in are :
* "old", the string prior to user's attempted modification,
* "add", the string the user is attemptiong to add
* "add", the string the user is attempting to add
* (will be null if text is being deleted).
* "new", the string that would result is user's changes
* are accepted.
@ -139,7 +155,7 @@
* initialization & changes.
*
* The realize() callback will be called when GUI-specific
* initalization needs to be done. For Xt/Motif, the second
* initialization needs to be done. For Xt/Motif, the second
* argument will be cast to the parent widget. The third
* argument passes in the desired pixel-width for the GUI
* element. (Yes, the pixel-size thing is a hack that we
@ -151,7 +167,7 @@
* The move() callback will be called when the GUI element needs
* to be positioned to a new location within the table grid.
* The second and third arguments are the physical (not virtual)
* row and column that the GUI elemnt should be moved to.
* row and column that the GUI element should be moved to.
*
* The gui_private member may be used by the derived class to
* store any additional GUI-specific data.
@ -166,22 +182,6 @@
* Copyright (c) 1998 Linas Vepstas
*/
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#ifndef __XACC_BASIC_CELL_H__
#define __XACC_BASIC_CELL_H__

View File

@ -1,14 +1,3 @@
/*
* FILE:
* datecell.c
*
* FUNCTION:
* implements a gui-independent date handling cell.
*
* HISTORY:
* Copyright (C) 1997 Robin D. Clark
* Copyright (c) 1998 Linas Vepstas
*/
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -30,6 +19,18 @@
* Huntington Beach, CA 92648-4632 *
\********************************************************************/
/*
* FILE:
* datecell.c
*
* FUNCTION:
* implements a gui-independent date handling cell.
*
* HISTORY:
* Copyright (C) 1997 Robin D. Clark
* Copyright (c) 1998, 1999, 2000 Linas Vepstas
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@ -477,7 +478,7 @@ xaccSetDateCellValueSecsL (DateCell *cell, long long secs)
/* try to deal with dates earlier than December 1901
* or later than Jan 2038. Note that xaccValidateDate
* should be handling centential (non-) leap years.
* The suffix LL indicates that consts shouold be handled
* The suffix LL indicates that consts should be handled
* long long 64-bit consts.
*/
if ((0x80000000LL > secs) || (0x7fffffffLL < secs))

View File

@ -1,3 +1,19 @@
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
/*
* FILE:
* datecell.h
@ -65,7 +81,7 @@
* on the "commit" button. This is the troutine to call for that.
*
* HISTORY:
* Copyright (c) 1998 Linas Vepstas
* Copyright (c) 1998, 1999, 2000 Linas Vepstas
*/
#ifndef __XACC_DATE_CELL_C__

244
src/register/numcell.c Normal file
View File

@ -0,0 +1,244 @@
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
/*
* FILE:
* numcell.c
*
* FUNCTION:
* implements a gui-independent number handling cell.
*
* HISTORY:
* Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu>
*/
#include <stdlib.h>
#include <string.h>
#include "numcell.h"
#include "util.h"
/* This static indicates the debugging module that this .o belongs to. */
/* static short module = MOD_REGISTER; */
/* ================================================ */
/* Parses the string value and returns true if it is a
* number. In that case, *num is set to the value parsed. */
static gncBoolean
parse_num(const char *string, long int *num)
{
long int number;
if (string == NULL)
return GNC_F;
if (!gnc_strisnum(string))
return GNC_F;
number = strtol(string, NULL, 10);
if ((number == LONG_MIN) || (number == LONG_MAX))
return GNC_F;
if (num != NULL)
*num = number;
return GNC_T;
}
/* ================================================ */
static const char *
NumEnter (BasicCell *_cell,
const char * curr,
int *cursor_position,
int *start_selection,
int *end_selection)
{
NumCell *cell = (NumCell *) _cell;
gncBoolean is_num;
long int number;
is_num = parse_num(curr, &number);
if (is_num && (number >= cell->max_num))
cell->max_num = number + 1;
return curr;
}
/* ================================================ */
static const char *
NumMV (BasicCell *_cell,
const char *oldval,
const char *change,
const char *newval,
int *cursor_position,
int *start_selection,
int *end_selection)
{
NumCell *cell = (NumCell *) _cell;
gncBoolean accel = GNC_F;
gncBoolean is_num;
long int number = 0;
if ((change == NULL) || (change[0] == 0) || /* if we are deleting */
(strlen(change) > 1)) /* or entering > 1 char */
/* then just accept the proposed change */
{
if (cell->cell.value) free (cell->cell.value);
cell->cell.value = strdup (newval);
return newval;
}
/* otherwise, it may be an accelerator key. */
is_num = parse_num(oldval, &number);
if (is_num && (number < 0))
is_num = GNC_F;
switch (change[0])
{
case '+':
case '=':
number++;
accel = GNC_T;
break;
case '_':
case '-':
number--;
accel = GNC_T;
break;
case '}':
case ']':
number += 10;
accel = GNC_T;
break;
case '{':
case '[':
number -= 10;
accel = GNC_T;
break;
}
if (number < 0)
number = 0;
/* If there is already a non-number there, don't accelerate. */
if (accel && !is_num && (safe_strcmp(oldval, "") != 0))
accel = GNC_F;
if (accel)
{
char buff[128];
if (!is_num)
number = cell->max_num;
strcpy(buff, "");
snprintf(buff, sizeof(buff), "%ld", number);
if (safe_strcmp(buff, "") == 0)
return NULL;
if (cell->cell.value) free (cell->cell.value);
cell->cell.value = strdup (buff);
*cursor_position = -1;
return strdup(buff);
}
if (cell->cell.value) free (cell->cell.value);
cell->cell.value = strdup (newval);
return newval;
}
/* ================================================ */
static const char *
NumLeave (BasicCell *_cell, const char * curr)
{
NumCell *cell = (NumCell *) _cell;
gncBoolean is_num;
long int number;
is_num = parse_num(curr, &number);
if (is_num && (number >= cell->max_num))
cell->max_num = number + 1;
return NULL;
}
/* ================================================ */
NumCell *
xaccMallocNumCell (void)
{
NumCell *cell;
cell = (NumCell *) malloc (sizeof (NumCell));
xaccInitNumCell (cell);
return cell;
}
/* ================================================ */
void
xaccDestroyNumCell (NumCell *cell)
{
xaccDestroyBasicCell (&(cell->cell));
}
/* ================================================ */
static void
setNumCellValue (BasicCell *_cell, const char *str)
{
NumCell *cell = (NumCell *) _cell;
gncBoolean is_num;
long int number;
is_num = parse_num(str, &number);
if (is_num && (number >= cell->max_num))
cell->max_num = number + 1;
if (cell->cell.value) free (cell->cell.value);
cell->cell.value = strdup (str);
}
/* ================================================ */
void
xaccSetNumCellValue (NumCell *cell, const char *str)
{
setNumCellValue(&cell->cell, str);
}
/* ================================================ */
void
xaccInitNumCell (NumCell *cell)
{
xaccInitBasicCell (&(cell->cell));
cell->max_num = 0;
cell->cell.enter_cell = NumEnter;
cell->cell.modify_verify = NumMV;
cell->cell.leave_cell = NumLeave;
cell->cell.set_value = setNumCellValue;
}

46
src/register/numcell.h Normal file
View File

@ -0,0 +1,46 @@
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
/*
* FILE:
* numcell.h
*
* FUNCTION:
* The NumCell object implements a number handling cell. It
* supports a number of accelerator keys for number entry.
*
* HISTORY:
* Copyright (c) 2000 Dave Peticolas <peticola@cs.ucdavis.edu>
*/
#ifndef __GNC_NUM_CELL_H__
#define __GNC_NUM_CELL_H__
#include "basiccell.h"
typedef struct _NumCell
{
BasicCell cell;
long int max_num;
} NumCell;
NumCell * xaccMallocNumCell (void);
void xaccInitNumCell (NumCell *);
void xaccDestroyNumCell (NumCell *);
void xaccSetNumCellValue (NumCell *cell, const char *str);
#endif /* __GNC_NUM_CELL_H__ */

View File

@ -1,19 +1,3 @@
/*
* FILE:
* splitreg.c
*
* FUNCTION:
* Implements the register object.
* Specifies the physical layout of the register cells.
* See the header file for additional documentation.
*
* hack alert -- most of the code in this file should be
* replaced by a guile/scheme based config file.
*
* HISTORY:
* Copyright (c) 1998 Linas Vepstas
*/
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -30,6 +14,22 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
/*
* FILE:
* splitreg.c
*
* FUNCTION:
* Implements the register object.
* Specifies the physical layout of the register cells.
* See the header file for additional documentation.
*
* hack alert -- most of the code in this file should be
* replaced by a guile/scheme based config file.
*
* HISTORY:
* Copyright (c) 1998, 1999, 2000 Linas Vepstas
*/
#include <stdio.h>
#include <stdlib.h>
@ -371,7 +371,7 @@ configLayout (SplitRegister *reg)
{
curs = reg->double_cursor;
FANCY (DATE, date, 0, 0);
BASIC (NUM, num, 1, 0);
FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0);
FANCY (MXFRM, mxfrm, 3, 0);
BASIC (RECN, recn, 4, 0);
@ -384,7 +384,7 @@ configLayout (SplitRegister *reg)
curs = reg->trans_cursor;
FANCY (DATE, date, 0, 0);
BASIC (NUM, num, 1, 0);
FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0);
BASIC (RECN, recn, 4, 0);
FANCY (DEBT, debit, 5, 0);
@ -401,7 +401,7 @@ configLayout (SplitRegister *reg)
/* basic common 8 column config */
curs = reg->single_cursor;
FANCY (DATE, date, 0, 0);
BASIC (NUM, num, 1, 0);
FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0);
FANCY (MXFRM, mxfrm, 3, 0);
BASIC (RECN, recn, 4, 0);
@ -420,7 +420,7 @@ configLayout (SplitRegister *reg)
/* prep the second row of the double style */
curs = reg->double_cursor;
FANCY (DATE, date, 0, 0);
BASIC (NUM, num, 1, 0);
FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0);
FANCY (MXFRM, mxfrm, 3, 0);
BASIC (RECN, recn, 4, 0);
@ -437,7 +437,7 @@ configLayout (SplitRegister *reg)
/* only the transaction cursor gets used */
curs = reg->trans_cursor;
FANCY (DATE, date, 0, 0);
BASIC (NUM, num, 1, 0);
FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0);
BASIC (RECN, recn, 4, 0);
FANCY (DEBT, debit, 5, 0);
@ -457,7 +457,7 @@ configLayout (SplitRegister *reg)
/* 11 column config */
curs = reg->single_cursor;
FANCY (DATE, date, 0, 0);
BASIC (NUM, num, 1, 0);
FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0);
FANCY (MXFRM, mxfrm, 3, 0);
BASIC (RECN, recn, 4, 0);
@ -907,7 +907,7 @@ xaccInitSplitRegister (SplitRegister *reg, int type)
NEW (null, Basic);
NEW (date, Date);
NEW (num, Text);
NEW (num, Num);
NEW (desc, QuickFill);
NEW (recn, Recn);
NEW (shrs, Price);
@ -952,7 +952,7 @@ xaccInitSplitRegister (SplitRegister *reg, int type)
xaccSetBasicCellValue (reg->nullCell, "");
/* The num cell is the transaction number */
xaccSetBasicCellBlankHelp (reg->numCell, NUM_CELL_HELP);
xaccSetBasicCellBlankHelp (&reg->numCell->cell, NUM_CELL_HELP);
/* the xfer cells */
xaccSetBasicCellBlankHelp (&reg->mxfrmCell->cell, XFER_CELL_HELP);
@ -1101,7 +1101,7 @@ xaccDestroySplitRegister (SplitRegister *reg)
reg->split_cursor = NULL;
xaccDestroyDateCell (reg->dateCell);
xaccDestroyBasicCell (reg->numCell);
xaccDestroyNumCell (reg->numCell);
xaccDestroyQuickFillCell (reg->descCell);
xaccDestroyBasicCell (reg->recnCell);
xaccDestroyPriceCell (reg->shrsCell);
@ -1154,7 +1154,7 @@ xaccSplitRegisterGetChangeFlag (SplitRegister *reg)
/* be careful to use bitwise ands and ors to assemble bit flag */
changed |= MOD_DATE & reg->dateCell->cell.changed;
changed |= MOD_NUM & reg->numCell->changed;
changed |= MOD_NUM & reg->numCell->cell.changed;
changed |= MOD_DESC & reg->descCell->cell.changed;
changed |= MOD_RECN & reg->recnCell->changed;
@ -1180,7 +1180,7 @@ void
xaccSplitRegisterClearChangeFlag (SplitRegister *reg)
{
reg->dateCell->cell.changed = 0;
reg->numCell->changed = 0;
reg->numCell->cell.changed = 0;
reg->descCell->cell.changed = 0;
reg->recnCell->changed = 0;

View File

@ -1,3 +1,19 @@
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
/*
* FILE:
* splitreg.h
@ -23,25 +39,9 @@
* file. Might make good sense to use scheme/guile for the layout.
*
* HISTORY:
* Copyright (c) 1998 Linas Vepstas
* Copyright (c) 1998, 1999, 2000 Linas Vepstas
*/
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#ifndef __XACC_SPLITREG_H__
#define __XACC_SPLITREG_H__
@ -51,6 +51,7 @@
#include "datecell.h"
#include "quickfillcell.h"
#include "pricecell.h"
#include "numcell.h"
#include "table-allgui.h"
/* defined register types */
@ -132,7 +133,7 @@ struct _SplitRegister {
CellBlock * header;
DateCell * dateCell;
BasicCell * numCell;
NumCell * numCell;
QuickFillCell * descCell;
BasicCell * recnCell; /* main transaction line reconcile */
PriceCell * shrsCell;