diff --git a/ChangeLog b/ChangeLog index 199ea8a233..a03843fe4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ +2000-04-08 Dave Peticolas + + * src/SplitLedger.c (xaccLoadXferCell): == not = Doh!!! + 2000-04-07 Dave Peticolas + * src/engine/Query.c (PROLOG): move declaration of da and db + locals into the macros that actually use them. This gets rid + of some annoying warnings. + + * src/register/numcell.c: added method to set the last number + entered. The next number entered is now the last number + 1. + * Makefile.in: changed [ -e filename ] to [ -f filename ] * src/scm/report.scm: Changed the report format to be a record. diff --git a/src/SplitLedger.c b/src/SplitLedger.c index cbfe3cb9e1..d3b0df530f 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -1324,6 +1324,7 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *new_trans) if (MOD_NUM & changed) { DEBUG ("xaccSRSaveRegEntry(): MOD_NUM: %s\n", reg->numCell->cell.value); xaccTransSetNum (trans, reg->numCell->cell.value); + xaccSetNumCellLastNum(reg->numCell, reg->numCell->cell.value); } if (MOD_DESC & changed) { @@ -1356,8 +1357,8 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *new_trans) * and that's that. For a two-line display, we want to reparent * the "other" split, but only if there is one ... * XFRM is the straight split, MXFRM is the mirrored split. - * XTO is the straight split, too :) Only one should be in - * a given cursor. + * XTO is the straight split, too :) Only one of XFRM or XTO + * should be in a given cursor. */ if ((MOD_XFRM | MOD_XTO) & changed) { Account *old_acc=NULL, *new_acc=NULL; @@ -2408,7 +2409,7 @@ xaccLoadXferCell (ComboCell *cell, curr = xaccAccountGetCurrency (base_account); secu = xaccAccountGetSecurity (base_account); - if ((secu != NULL) && (secu[0] = 0)) + if ((secu != NULL) && (secu[0] == 0)) secu = NULL; xaccClearComboCellMenu (cell); diff --git a/src/engine/Query.c b/src/engine/Query.c index fca98dbe30..817da0d9a0 100644 --- a/src/engine/Query.c +++ b/src/engine/Query.c @@ -310,7 +310,6 @@ xaccQueryShowLatestDateFound (Query *q) */ #define PROLOG \ - char *da, *db; \ Transaction *ta; \ Transaction *tb; \ int retval; \ @@ -358,6 +357,7 @@ xaccQueryShowLatestDateFound (Query *q) #define CNUM { \ /* sort on transaction number */ \ + char *da, *db; \ unsigned long n1; \ unsigned long n2; \ da = ta->num; \ @@ -394,6 +394,7 @@ xaccQueryShowLatestDateFound (Query *q) #define CMEMO { \ /* sort on memo strings */ \ + char *da, *db; \ da = (*sa)->memo; \ db = (*sb)->memo; \ if (da && db) { \ @@ -411,6 +412,7 @@ xaccQueryShowLatestDateFound (Query *q) #define CDESC { \ /* sort on transaction strings */ \ + char *da, *db; \ da = ta->description; \ db = tb->description; \ if (da && db) { \ diff --git a/src/engine/README b/src/engine/README index 275f55f070..b3aaf6b636 100644 --- a/src/engine/README +++ b/src/engine/README @@ -9,6 +9,6 @@ any GUI elements or assumptions. For design documentation, please see the file "design.txt", and also, look at the header files carefully. The documentation -for each royutine is in the header files for that routine. +for each routine is in the header files for that routine. September 1998 diff --git a/src/register/numcell.c b/src/register/numcell.c index 359991be47..0f14b5a4c0 100644 --- a/src/register/numcell.c +++ b/src/register/numcell.c @@ -10,8 +10,12 @@ * 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. * + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * + * * \********************************************************************/ /* @@ -69,13 +73,14 @@ NumEnter (BasicCell *_cell, int *end_selection) { NumCell *cell = (NumCell *) _cell; - gncBoolean is_num; - long int number; - is_num = parse_num(curr, &number); + if (!cell->next_num_set) + { + long int number; - if (is_num && (number >= cell->max_num)) - cell->max_num = number + 1; + if (parse_num(curr, &number)) + cell->next_num = number + 1; + } return curr; } @@ -150,7 +155,7 @@ NumMV (BasicCell *_cell, char buff[128]; if (!is_num) - number = cell->max_num; + number = cell->next_num; strcpy(buff, ""); snprintf(buff, sizeof(buff), "%ld", number); @@ -177,13 +182,14 @@ 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 (!cell->next_num_set) + { + long int number; - if (is_num && (number >= cell->max_num)) - cell->max_num = number + 1; + if (parse_num(curr, &number)) + cell->next_num = number + 1; + } return NULL; } @@ -193,8 +199,10 @@ NumCell * xaccMallocNumCell (void) { NumCell *cell; - cell = (NumCell *) malloc (sizeof (NumCell)); + + cell = (NumCell *) malloc(sizeof(NumCell)); xaccInitNumCell (cell); + return cell; } @@ -210,13 +218,14 @@ 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 (!cell->next_num_set) + { + long int number; - if (is_num && (number >= cell->max_num)) - cell->max_num = number + 1; + if (parse_num(str, &number)) + cell->next_num = number + 1; + } if (cell->cell.value) free (cell->cell.value); cell->cell.value = strdup (str); @@ -229,13 +238,27 @@ xaccSetNumCellValue (NumCell *cell, const char *str) setNumCellValue(&cell->cell, str); } +/* ================================================ */ +void +xaccSetNumCellLastNum (NumCell *cell, const char *str) +{ + long int number; + + if (parse_num(str, &number)) + { + cell->next_num = number + 1; + cell->next_num_set = GNC_T; + } +} + /* ================================================ */ void xaccInitNumCell (NumCell *cell) { xaccInitBasicCell (&(cell->cell)); - cell->max_num = 0; + cell->next_num = 0; + cell->next_num_set = GNC_F; cell->cell.enter_cell = NumEnter; cell->cell.modify_verify = NumMV; diff --git a/src/register/numcell.h b/src/register/numcell.h index c28cf4fc6e..55eb585ad0 100644 --- a/src/register/numcell.h +++ b/src/register/numcell.h @@ -10,8 +10,12 @@ * 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. * + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * + * * \********************************************************************/ /* @@ -34,7 +38,8 @@ typedef struct _NumCell { BasicCell cell; - long int max_num; + long int next_num; + gncBoolean next_num_set; } NumCell; NumCell * xaccMallocNumCell (void); @@ -42,5 +47,6 @@ void xaccInitNumCell (NumCell *); void xaccDestroyNumCell (NumCell *); void xaccSetNumCellValue (NumCell *cell, const char *str); +void xaccSetNumCellLastNum (NumCell *cell, const char *str); #endif /* __GNC_NUM_CELL_H__ */