From 06ef3213dc2a95d3f28b13596c9baf6fcbf77dc3 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Mon, 8 May 2000 11:17:05 +0000 Subject: [PATCH] Don't blank zero values in the balance column of register. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2275 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 13 +++++++++++++ src/SplitLedger.c | 6 +++++- src/gnome/window-main.c | 2 +- src/messages_i18n.h | 4 ++++ src/register/pricecell.c | 34 ++++++++++++++++++++++++++++++---- src/register/pricecell.h | 3 +++ src/register/splitreg.c | 3 +++ 7 files changed, 59 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7bf5810e1..5f61bf7e39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2000-05-08 Dave Peticolas + + * src/register/pricecell.c: allow the cell to be blanked directly. + + * src/SplitLedger.c (xaccSRLoadRegEntry): explicitly blank the + balance cell for the blank split. + + * src/register/splitreg.c (xaccInitSplitRegister): don't blank zeros + on the balance cell by default. + + * src/gnome/window-main.c (gnc_main_create_menus): rename the + 'Help' menu item to 'Manual'. + 2000-05-07 Dave Peticolas * src/guile/i18n.h.in: always include locale.h diff --git a/src/SplitLedger.c b/src/SplitLedger.c index d592833d57..7f9f607b14 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -1759,7 +1759,11 @@ xaccSRLoadRegEntry (SplitRegister *reg, Split *split) (EXPENSE_REGISTER == typo)) { baln = -baln; } - xaccSetPriceCellValue (reg->balanceCell, baln); + + if (split == info->blank_split) + xaccSetPriceCellBlank (reg->balanceCell); + else + xaccSetPriceCellValue (reg->balanceCell, baln); xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split)); diff --git a/src/gnome/window-main.c b/src/gnome/window-main.c index 2ebec0514d..0e62d3c7dc 100644 --- a/src/gnome/window-main.c +++ b/src/gnome/window-main.c @@ -915,7 +915,7 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, static GnomeUIInfo helpmenu[] = { { GNOME_APP_UI_ITEM, - HELP_MENU_STR_N, TOOLTIP_HELP_N, + MAN_MENU_STR_N, TOOLTIP_MAN_N, gnc_ui_help_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL diff --git a/src/messages_i18n.h b/src/messages_i18n.h index e8d59d4a8a..9a286db166 100644 --- a/src/messages_i18n.h +++ b/src/messages_i18n.h @@ -218,6 +218,8 @@ #define TOOLTIP_JUMP_TRANS_N N_("Jump to the corresponding transaction in "\ "the other account") #define TOOLTIP_JUMP_TRANS _(TOOLTIP_JUMP_TRANS_N) +#define TOOLTIP_MAN_N N_("Open the GnuCash Manual") +#define TOOLTIP_MAN _(TOOLTIP_MAN_N) #define TOOLTIP_MULTI_LINE_N N_("Show transactions on multiple lines with "\ "one line for each split") #define TOOLTIP_MULTI_LINE _(TOOLTIP_MULTI_LINE_N) @@ -338,6 +340,8 @@ #define HELP_MENU_STR _(HELP_MENU_STR_N) #define JUMP_MENU_STR_N N_("_Jump") #define JUMP_MENU_STR _(JUMP_MENU_STR_N) +#define MAN_MENU_STR_N N_("_Manual") +#define MAN_MENU_STR _(MAN_MENU_STR_N) #define NEW_MENU_STR_N N_("_New") #define NEW_MENU_STR _(NEW_MENU_STR_N) #define NEW_ACC_MENU_STR _("_New Account") diff --git a/src/register/pricecell.c b/src/register/pricecell.c index 86eb76260b..d1f52fd376 100644 --- a/src/register/pricecell.c +++ b/src/register/pricecell.c @@ -239,15 +239,20 @@ xaccPriceCellPrintValue (PriceCell *cell) double xaccGetPriceCellValue (PriceCell *cell) { - assert(cell != NULL); + if (cell == NULL) + return 0.0; return cell->amount; } -void xaccSetPriceCellValue (PriceCell * cell, double amt) +void +xaccSetPriceCellValue (PriceCell * cell, double amt) { char *buff; + if (cell == NULL) + return; + cell->amount = amt; buff = xaccPriceCellPrintValue (cell); @@ -257,6 +262,19 @@ void xaccSetPriceCellValue (PriceCell * cell, double amt) COLORIZE (cell, amt); } +void +xaccSetPriceCellBlank (PriceCell *cell) +{ + if (cell == NULL) + return; + + cell->amount = 0.0; + + SET ( &(cell->cell), ""); + + COLORIZE (cell, 0.0); +} + /* ================================================ */ void @@ -318,9 +336,17 @@ static void PriceSetValue (BasicCell *_cell, const char *str) { PriceCell *cell = (PriceCell *) _cell; - double amt = xaccParseAmount (str, cell->monetary); + double amount; - xaccSetPriceCellValue (cell, amt); + if (str == NULL) + str = ""; + + if (!cell->blank_zero && (*str == '\0')) + xaccSetPriceCellBlank(cell); + else { + amount = xaccParseAmount (str, cell->monetary); + xaccSetPriceCellValue (cell, amount); + } } /* --------------- end of file ---------------------- */ diff --git a/src/register/pricecell.h b/src/register/pricecell.h index 5fb8c0c7ff..f1773636c0 100644 --- a/src/register/pricecell.h +++ b/src/register/pricecell.h @@ -76,6 +76,9 @@ double xaccGetPriceCellValue (PriceCell *cell); /* updates amount, string format is three decimal places */ void xaccSetPriceCellValue (PriceCell *cell, double amount); +/* Sets the cell as blank, regardless of the blank_zero value */ +void xaccSetPriceCellBlank (PriceCell *cell); + /* determines whether 0 values are left blank or printed. * defaults to true. */ void xaccSetPriceCellBlankZero (PriceCell *cell, gncBoolean); diff --git a/src/register/splitreg.c b/src/register/splitreg.c index 20eec605b0..bc0109b038 100644 --- a/src/register/splitreg.c +++ b/src/register/splitreg.c @@ -1120,6 +1120,9 @@ xaccInitSplitRegister (SplitRegister *reg, int type) reg->balanceCell->cell.input_output = XACC_CELL_ALLOW_SHADOW; reg->shrsCell->cell.input_output = XACC_CELL_ALLOW_SHADOW; + /* by default, don't blank zeros on the balance cell. */ + xaccSetPriceCellBlankZero(reg->balanceCell, GNC_F); + /* The reconcile cell should only be entered with the pointer, * and only then when the user clicks directly on the cell. */