price cell renaming, also, bug fix w.r.t. window refresh

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@956 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-08-08 20:41:25 +00:00
parent d69a292ae3
commit 4609ca5aa3
2 changed files with 39 additions and 16 deletions

View File

@ -4,6 +4,11 @@
* *
* FUNCTION: * FUNCTION:
* copy transaction data from engine into ledger object * copy transaction data from engine into ledger object
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
HACK ALERT -- THIS CODE IS MORE OR LESS OBSOLESCENT, AND HAS BEEN
REPLACED BY SPLITLEDGER.C IT SHOULD BE DELETED BEFORE TOO LONG.
* *
* HISTORY: * HISTORY:
* Copyright (c) 1998 Linas Vepstas * Copyright (c) 1998 Linas Vepstas
@ -237,11 +242,11 @@ xaccBRLoadRegEntry (BasicRegister *reg, Split *split)
(EXPENSE_REGISTER == reg->type)) { (EXPENSE_REGISTER == reg->type)) {
baln = -baln; baln = -baln;
} }
xaccSetAmountCellValue (reg->balanceCell, baln); xaccSetPriceCellValue (reg->balanceCell, baln);
xaccSetAmountCellValue (reg->priceCell, xaccSplitGetSharePrice (split)); xaccSetPriceCellValue (reg->priceCell, xaccSplitGetSharePrice (split));
xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split)); xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split));
xaccSetAmountCellValue (reg->valueCell, xaccSplitGetValue (split)); xaccSetPriceCellValue (reg->valueCell, xaccSplitGetValue (split));
reg->table->current_cursor->user_data = (void *) split; reg->table->current_cursor->user_data = (void *) split;

View File

@ -108,6 +108,7 @@ xaccSRSaveRegEntry (SplitRegister *reg)
Transaction *trans; Transaction *trans;
Account * acc; Account * acc;
unsigned int changed; unsigned int changed;
int i;
/* use the changed flag to avoid heavy-weight updates /* use the changed flag to avoid heavy-weight updates
* of the split & transaction fields. This will help * of the split & transaction fields. This will help
@ -124,8 +125,8 @@ printf ("save split is %p \n", split);
/* If we were asked to save data for a row for which there /* If we were asked to save data for a row for which there
* is no associated split, then assume that this was a row * is no associated split, then assume that this was a row
* that was set aside for adding splits to an existing * that was set aside for adding splits to an existing
* transaction. The pre-existing trransaction will be the * transaction. The pre-existing transaction will be the
* one in the row(s) iediately above. Therefore, get * one in the row(s) immediately above. Therefore, get
* the cursor location; subtract one row, and get the * the cursor location; subtract one row, and get the
* associated transaction. We will then create a new * associated transaction. We will then create a new
* split, copy the row contents to that split, and * split, copy the row contents to that split, and
@ -197,6 +198,9 @@ printf ("save split is %p \n", split);
old_acc = xaccSplitGetAccount (split); old_acc = xaccSplitGetAccount (split);
new_acc = xaccGetPeerAccountFromName (old_acc, reg->xfrmCell->cell.value); new_acc = xaccGetPeerAccountFromName (old_acc, reg->xfrmCell->cell.value);
xaccAccountInsertSplit (new_acc, split); xaccAccountInsertSplit (new_acc, split);
/* make sure any open windows of the old account get redrawn */
accRefresh (old_acc);
} }
@ -205,7 +209,9 @@ printf ("save split is %p \n", split);
} }
xaccTransCommitEdit (trans); xaccTransCommitEdit (trans);
printf ("finished saving %s \n", xaccTransGetDescription(trans)); printf ("finished saving split %s of trans %s \n",
xaccSplitGetMemo(split),
xaccTransGetDescription(trans));
/* if the modified split is the "blank split", /* if the modified split is the "blank split",
* then it is now an official part of the account. * then it is now an official part of the account.
@ -216,9 +222,21 @@ printf ("finished saving %s \n", xaccTransGetDescription(trans));
reg->user_hook = NULL; reg->user_hook = NULL;
} }
/* refresh the register windows *only* if something changed */ /* refresh the register windows */
acc = xaccSplitGetAccount (split); /* This split belongs to a transaction that might be displayed
accRefresh (acc); * in any number of windows. Changing any one split is likely
* to affect any account windows associated with the other splits
* in this transaction. So basically, send redraw events to all
* of the splits.
*/
i = 0;
split = xaccTransGetSplit (trans, i);
while (split) {
acc = xaccSplitGetAccount (split);
accRefresh (acc);
i++;
split = xaccTransGetSplit (trans, i);
}
} }
/* ======================================================== */ /* ======================================================== */
@ -243,10 +261,10 @@ xaccSRLoadRegEntry (SplitRegister *reg, Split *split)
xaccSetComboCellValue (reg->xfrmCell, ""); xaccSetComboCellValue (reg->xfrmCell, "");
xaccSetDebCredCellValue (reg->debitCell, xaccSetDebCredCellValue (reg->debitCell,
reg->creditCell, 0.0); reg->creditCell, 0.0);
xaccSetAmountCellValue (reg->balanceCell, 0.0); xaccSetPriceCellValue (reg->balanceCell, 0.0);
xaccSetAmountCellValue (reg->priceCell, 0.0); xaccSetPriceCellValue (reg->priceCell, 0.0);
xaccSetPriceCellValue (reg->shrsCell, 0.0); xaccSetPriceCellValue (reg->shrsCell, 0.0);
xaccSetAmountCellValue (reg->valueCell, 0.0); xaccSetPriceCellValue (reg->valueCell, 0.0);
} else { } else {
trans = xaccSplitGetParent (split); trans = xaccSplitGetParent (split);
@ -280,11 +298,11 @@ xaccSRLoadRegEntry (SplitRegister *reg, Split *split)
(EXPENSE_REGISTER == reg->type)) { (EXPENSE_REGISTER == reg->type)) {
baln = -baln; baln = -baln;
} }
xaccSetAmountCellValue (reg->balanceCell, baln); xaccSetPriceCellValue (reg->balanceCell, baln);
xaccSetAmountCellValue (reg->priceCell, xaccSplitGetSharePrice (split)); xaccSetPriceCellValue (reg->priceCell, xaccSplitGetSharePrice (split));
xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split)); xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split));
xaccSetAmountCellValue (reg->valueCell, -xaccSplitGetValue (split)); xaccSetPriceCellValue (reg->valueCell, -xaccSplitGetValue (split));
} }
reg->table->current_cursor->user_data = (void *) split; reg->table->current_cursor->user_data = (void *) split;