2001-07-12 Dave Peticolas <dave@krondo.com>

* src/register/splitreg.[hc]: same as below

	* src/SplitLedger.c: remove share balance cells, they are now
	redundant


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4949 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-07-13 00:11:29 +00:00
parent b1a236d0a1
commit efd666edb2
4 changed files with 27 additions and 120 deletions

View File

@ -1,5 +1,10 @@
2001-07-12 Dave Peticolas <dave@krondo.com>
* src/register/splitreg.[hc]: same as below
* src/SplitLedger.c: remove share balance cells, they are now
redundant
* accounts/*/*: currency->commodity
* src/scm/engine-interface.scm: quantity->amount

View File

@ -3552,40 +3552,7 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
/* ======================================================== */
static gnc_numeric
get_trans_total_value (SplitRegister *reg, Transaction *trans)
{
GList *node;
Account *account;
gnc_commodity *currency;
gnc_numeric total = gnc_numeric_zero ();
account = sr_get_default_account (reg);
if (!account)
return total;
currency = xaccTransGetCurrency (trans);
if (!currency)
currency = gnc_default_currency ();
total = gnc_numeric_convert (total, gnc_commodity_get_fraction (currency),
GNC_RND_ROUND);
for (node = xaccTransGetSplitList (trans); node; node = node->next)
{
Split *split = node->data;
if (xaccSplitGetAccount (split) != account)
continue;
total = gnc_numeric_add_fixed (total, xaccSplitGetValue (split));
}
return total;
}
static gnc_numeric
get_trans_total_shares (SplitRegister *reg, Transaction *trans)
get_trans_total_amount (SplitRegister *reg, Transaction *trans)
{
GList *node;
Account *account;
@ -3923,26 +3890,6 @@ xaccSRGetEntryHandler (VirtualLocation virt_loc, gboolean translate,
}
break;
case SHRBALN_CELL:
case TSHRBALN_CELL:
{
SRInfo *info = xaccSRGetInfo(reg);
Split *blank_split = xaccSplitLookup(&info->blank_split_guid);
gnc_numeric balance;
if (split == blank_split)
return "";
if (cell_type == SHRBALN_CELL)
balance = xaccSplitGetBalance (split);
else
balance = get_trans_total_balance (reg, trans);
return xaccPrintAmount (balance,
gnc_split_amount_print_info (split, FALSE));
}
break;
case BALN_CELL:
case TBALN_CELL:
{
@ -4080,7 +4027,7 @@ xaccSRGetEntryHandler (VirtualLocation virt_loc, gboolean translate,
{
gnc_numeric total;
total = get_trans_total_value (reg, trans);
total = get_trans_total_amount (reg, trans);
if (gnc_numeric_zero_p (total))
return "";
@ -4093,7 +4040,7 @@ xaccSRGetEntryHandler (VirtualLocation virt_loc, gboolean translate,
total = gnc_numeric_abs (total);
return xaccPrintAmount (total,
gnc_split_value_print_info (split, FALSE));
gnc_split_amount_print_info (split, FALSE));
}
break;
@ -4101,7 +4048,7 @@ xaccSRGetEntryHandler (VirtualLocation virt_loc, gboolean translate,
{
gnc_numeric total;
total = get_trans_total_shares (reg, trans);
total = get_trans_total_amount (reg, trans);
return xaccPrintAmount (total,
gnc_split_amount_print_info (split, FALSE));
@ -4211,9 +4158,6 @@ xaccSRGetLabelHandler (VirtualLocation virt_loc, gpointer user_data)
case RECN_CELL:
return _("Reconciled:R") + 11;
case SHRBALN_CELL:
return _("Share Balance");
case BALN_CELL:
return _("Balance");
@ -4284,9 +4228,6 @@ xaccSRGetLabelHandler (VirtualLocation virt_loc, gpointer user_data)
case TSHRS_CELL:
return _("Tot Shares");
case TSHRBALN_CELL:
return _("Share Balance");
case TBALN_CELL:
return _("Balance");
@ -4403,7 +4344,7 @@ xaccSRGetFGColorHandler (VirtualLocation virt_loc, gpointer user_data)
gnc_numeric shares;
if (cell_type == TSHRS_CELL)
shares = get_trans_total_shares (reg, trans);
shares = get_trans_total_amount (reg, trans);
else if (is_current)
shares = xaccGetPriceCellValue (reg->sharesCell);
else
@ -4416,23 +4357,6 @@ xaccSRGetFGColorHandler (VirtualLocation virt_loc, gpointer user_data)
}
break;
case SHRBALN_CELL:
case TSHRBALN_CELL:
{
gnc_numeric balance;
if (cell_type == SHRBALN_CELL)
balance = xaccSplitGetBalance (split);
else
balance = get_trans_total_balance (reg, trans);
if (gnc_numeric_negative_p (balance))
return red;
return black;
}
break;
case BALN_CELL:
case TBALN_CELL:
{

View File

@ -69,7 +69,6 @@ struct _SplitRegisterBuffer
CellBuffer numCell;
CellBuffer descCell;
CellBuffer recnCell;
CellBuffer shrbalnCell;
CellBuffer balanceCell;
CellBuffer actionCell;
CellBuffer xfrmCell;
@ -96,7 +95,6 @@ static sample_string cell_sample_strings[] =
{ N_("sample:99999"), 7}, /* num cell */
{ N_("sample:Description of a transaction"), 7}, /* desc cell */
{ N_("Reconciled:R"), 11}, /* recn cell */
{ N_("sample:999,999.000"), 7}, /* share balance cell */
{ N_("sample:999,999.000"), 7}, /* balance cell */
{ N_("Transfer"), 0}, /* action cell */
{ N_("sample:Expenses:Automobile:Gasoline"), 7}, /* xfrm cell */
@ -109,7 +107,6 @@ static sample_string cell_sample_strings[] =
{ N_("sample:999,999.000"), 7}, /* tcredit cell */
{ N_("sample:999,999.000"), 7}, /* tdebit cell */
{ N_("sample:999,999.000"), 7}, /* tshares cell */
{ N_("sample:999,999.000"), 7}, /* tshrbaln cell */
{ N_("sample:999,999.000"), 7}, /* tbalance cell */
{ N_("sample:Notes field sample text string"), 7}, /* notes cell */
{ N_("sample:(x + 0.33 * y + (x+y) )"), 7 }, /* formula credit cell */
@ -122,7 +119,6 @@ static CellAlignment cell_alignments[] =
CELL_ALIGN_LEFT, /* num cell */
CELL_ALIGN_LEFT, /* desc cell */
CELL_ALIGN_CENTER, /* recn cell */
CELL_ALIGN_RIGHT, /* share balance cell */
CELL_ALIGN_RIGHT, /* balance cell */
CELL_ALIGN_LEFT, /* action cell */
CELL_ALIGN_RIGHT, /* xfrm cell */
@ -135,7 +131,6 @@ static CellAlignment cell_alignments[] =
CELL_ALIGN_RIGHT, /* tcredit cell */
CELL_ALIGN_RIGHT, /* tdebit cell */
CELL_ALIGN_RIGHT, /* tshares cell */
CELL_ALIGN_RIGHT, /* tshrbaln cell */
CELL_ALIGN_RIGHT, /* tbalance cell */
CELL_ALIGN_LEFT, /* notes cell */
CELL_ALIGN_LEFT, /* formula credit cell */
@ -476,16 +471,16 @@ configLayout (SplitRegister *reg)
case CURRENCY_REGISTER:
{
curs = reg->cursor_ledger_single;
set_cell (reg, curs, DATE_CELL, 0, 0);
set_cell (reg, curs, NUM_CELL, 0, 1);
set_cell (reg, curs, DESC_CELL, 0, 2);
set_cell (reg, curs, MXFRM_CELL, 0, 3);
set_cell (reg, curs, RECN_CELL, 0, 4);
set_cell (reg, curs, SHRS_CELL, 0, 5);
set_cell (reg, curs, PRIC_CELL, 0, 6);
set_cell (reg, curs, DEBT_CELL, 0, 7);
set_cell (reg, curs, CRED_CELL, 0, 8);
set_cell (reg, curs, SHRBALN_CELL, 0, 9);
set_cell (reg, curs, DATE_CELL, 0, 0);
set_cell (reg, curs, NUM_CELL, 0, 1);
set_cell (reg, curs, DESC_CELL, 0, 2);
set_cell (reg, curs, MXFRM_CELL, 0, 3);
set_cell (reg, curs, RECN_CELL, 0, 4);
set_cell (reg, curs, SHRS_CELL, 0, 5);
set_cell (reg, curs, PRIC_CELL, 0, 6);
set_cell (reg, curs, DEBT_CELL, 0, 7);
set_cell (reg, curs, CRED_CELL, 0, 8);
set_cell (reg, curs, BALN_CELL, 0, 9);
curs = reg->cursor_ledger_double;
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
@ -494,13 +489,13 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, NOTES_CELL, 1, 2);
curs = reg->cursor_journal_single;
set_cell (reg, curs, DATE_CELL, 0, 0);
set_cell (reg, curs, NUM_CELL, 0, 1);
set_cell (reg, curs, DESC_CELL, 0, 2);
set_cell (reg, curs, TSHRS_CELL, 0, 5);
set_cell (reg, curs, TDEBT_CELL, 0, 7);
set_cell (reg, curs, TCRED_CELL, 0, 8);
set_cell (reg, curs, TSHRBALN_CELL, 0, 9);
set_cell (reg, curs, DATE_CELL, 0, 0);
set_cell (reg, curs, NUM_CELL, 0, 1);
set_cell (reg, curs, DESC_CELL, 0, 2);
set_cell (reg, curs, TSHRS_CELL, 0, 5);
set_cell (reg, curs, TDEBT_CELL, 0, 7);
set_cell (reg, curs, TCRED_CELL, 0, 8);
set_cell (reg, curs, TBALN_CELL, 0, 9);
curs = reg->cursor_journal_double;
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
@ -708,7 +703,6 @@ xaccInitSplitRegister (SplitRegister *reg,
NEW (NUM, num, Num);
NEW (DESC, desc, QuickFill);
NEW (RECN, recn, Recn);
NEW (SHRBALN, shrbaln, Price);
NEW (BALN, balance, Price);
NEW (XFRM, xfrm, Combo);
NEW (ACTN, action, Combo);
@ -721,7 +715,6 @@ xaccInitSplitRegister (SplitRegister *reg,
NEW (TCRED, tcredit, Price);
NEW (TDEBT, tdebit, Price);
NEW (TSHRS, tshares, Price);
NEW (TSHRBALN, tshrbaln, Price);
NEW (TBALN, tbalance, Price);
NEW (NOTES, notes, QuickFill);
NEW (FCRED, formCredit, QuickFill);
@ -801,10 +794,6 @@ xaccInitSplitRegister (SplitRegister *reg,
(reg->sharesCell, gnc_default_share_print_info ());
xaccSetPriceCellPrintInfo
(reg->tsharesCell, gnc_default_share_print_info ());
xaccSetPriceCellPrintInfo
(reg->shrbalnCell, gnc_default_share_print_info ());
xaccSetPriceCellPrintInfo
(reg->tshrbalnCell, gnc_default_share_print_info ());
/* The action cell should accept strings not in the list */
xaccComboCellSetStrict (reg->actionCell, FALSE);
@ -928,7 +917,6 @@ xaccDestroySplitRegister (SplitRegister *reg)
xaccDestroyNumCell (reg->numCell);
xaccDestroyQuickFillCell (reg->descCell);
xaccDestroyRecnCell (reg->recnCell);
xaccDestroyPriceCell (reg->shrbalnCell);
xaccDestroyPriceCell (reg->balanceCell);
xaccDestroyComboCell (reg->actionCell);
xaccDestroyComboCell (reg->xfrmCell);
@ -941,7 +929,6 @@ xaccDestroySplitRegister (SplitRegister *reg)
xaccDestroyPriceCell (reg->tcreditCell);
xaccDestroyPriceCell (reg->tdebitCell);
xaccDestroyPriceCell (reg->tsharesCell);
xaccDestroyPriceCell (reg->tshrbalnCell);
xaccDestroyPriceCell (reg->tbalanceCell);
xaccDestroyQuickFillCell (reg->notesCell);
xaccDestroyQuickFillCell (reg->formCreditCell);
@ -952,7 +939,6 @@ xaccDestroySplitRegister (SplitRegister *reg)
reg->numCell = NULL;
reg->descCell = NULL;
reg->recnCell = NULL;
reg->shrbalnCell = NULL;
reg->balanceCell = NULL;
reg->actionCell = NULL;
reg->xfrmCell = NULL;
@ -965,7 +951,6 @@ xaccDestroySplitRegister (SplitRegister *reg)
reg->tcreditCell = NULL;
reg->tdebitCell = NULL;
reg->tsharesCell = NULL;
reg->tshrbalnCell = NULL;
reg->tbalanceCell = NULL;
reg->notesCell = NULL;
reg->formCreditCell = NULL;
@ -1336,7 +1321,6 @@ xaccDestroySplitRegisterBuffer (SplitRegisterBuffer *srb)
destroyCellBuffer(&srb->numCell);
destroyCellBuffer(&srb->descCell);
destroyCellBuffer(&srb->recnCell);
destroyCellBuffer(&srb->shrbalnCell);
destroyCellBuffer(&srb->balanceCell);
destroyCellBuffer(&srb->actionCell);
destroyCellBuffer(&srb->xfrmCell);
@ -1378,7 +1362,6 @@ xaccSplitRegisterSaveCursor(SplitRegister *sr, SplitRegisterBuffer *srb)
saveCell(&sr->numCell->cell, &srb->numCell);
saveCell(&sr->descCell->cell, &srb->descCell);
saveCell(&sr->recnCell->cell, &srb->recnCell);
saveCell(&sr->shrbalnCell->cell, &srb->shrbalnCell);
saveCell(&sr->balanceCell->cell, &srb->balanceCell);
saveCell(&sr->actionCell->cell, &srb->actionCell);
saveCell(&sr->xfrmCell->cell, &srb->xfrmCell);
@ -1443,7 +1426,6 @@ xaccSplitRegisterRestoreCursorChanged(SplitRegister *sr,
restoreCellChanged(&sr->numCell->cell, &srb->numCell, cursor);
restoreCellChanged(&sr->descCell->cell, &srb->descCell, cursor);
restoreCellChanged(&sr->recnCell->cell, &srb->recnCell, cursor);
restoreCellChanged(&sr->shrbalnCell->cell, &srb->shrbalnCell, cursor);
restoreCellChanged(&sr->balanceCell->cell, &srb->balanceCell, cursor);
restoreCellChanged(&sr->actionCell->cell, &srb->actionCell, cursor);
restoreCellChanged(&sr->xfrmCell->cell, &srb->xfrmCell, cursor);

View File

@ -88,7 +88,6 @@ typedef enum
NUM_CELL,
DESC_CELL,
RECN_CELL,
SHRBALN_CELL,
BALN_CELL,
ACTN_CELL,
XFRM_CELL,
@ -101,7 +100,6 @@ typedef enum
TCRED_CELL, /* T* cells are transaction summary cells */
TDEBT_CELL,
TSHRS_CELL,
TSHRBALN_CELL,
TBALN_CELL,
NOTES_CELL,
FCRED_CELL, // formula credit, used by the template ledger
@ -192,7 +190,6 @@ struct _SplitRegister
NumCell * numCell;
QuickFillCell * descCell;
RecnCell * recnCell;
PriceCell * shrbalnCell;
PriceCell * balanceCell;
ComboCell * actionCell;
ComboCell * xfrmCell;
@ -205,7 +202,6 @@ struct _SplitRegister
PriceCell * tcreditCell;
PriceCell * tdebitCell;
PriceCell * tsharesCell;
PriceCell * tshrbalnCell;
PriceCell * tbalanceCell;
QuickFillCell * notesCell;