updates to reflect new engine design

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@768 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-04-04 07:25:39 +00:00
parent 088931df8a
commit a9700af853

View File

@ -125,18 +125,21 @@ xaccSaveRegEntry (BasicRegister *reg)
Account * acc; Account * acc;
unsigned int changed; unsigned int changed;
/* use the changed flag to avoid heavy-weight updates
* of the split & transaction fields. This will help
* cut down on uneccessary register redraws. */
changed = xaccGetChangeFlag (reg);
if (!changed) return;
/* get the handle to the current split and transaction */ /* get the handle to the current split and transaction */
split = xaccGetCurrentSplit (reg); split = xaccGetCurrentSplit (reg);
if (!split) return; if (!split) return;
trans = xaccSplitGetParent (split); trans = xaccSplitGetParent (split);
/* use the changed flag to avoid heavy-weight updates
* of the split & transaction fields. This will help
* cut down on uneccessary register redraws. */
changed = xaccGetChangeFlag (reg);
/* copy the contents from the cursor to the split */ /* copy the contents from the cursor to the split */
xaccTransBeginEdit (trans);
if (MOD_DATE & changed) if (MOD_DATE & changed)
xaccTransSetDate (trans, reg->dateCell->date.tm_mday, xaccTransSetDate (trans, reg->dateCell->date.tm_mday,
reg->dateCell->date.tm_mon+1, reg->dateCell->date.tm_mon+1,
@ -155,17 +158,14 @@ xaccSaveRegEntry (BasicRegister *reg)
double new_amount; double new_amount;
new_amount = (reg->creditCell->amount) - (reg->debitCell->amount); new_amount = (reg->creditCell->amount) - (reg->debitCell->amount);
xaccSplitSetValue (split, new_amount); xaccSplitSetValue (split, new_amount);
xaccSplitRebalance (split);
} }
if (MOD_SHRS & changed) { if (MOD_SHRS & changed) {
xaccSplitSetShareAmount (split, reg->shrsCell->amount); xaccSplitSetShareAmount (split, reg->shrsCell->amount);
xaccSplitRebalance (split);
} }
if (MOD_PRIC & changed) { if (MOD_PRIC & changed) {
xaccSplitSetSharePrice (split, reg->priceCell->amount); xaccSplitSetSharePrice (split, reg->priceCell->amount);
xaccSplitRebalance (split);
} }
if (MOD_MEMO & changed) if (MOD_MEMO & changed)
@ -181,9 +181,9 @@ xaccSaveRegEntry (BasicRegister *reg)
if (MOD_XTO & changed) { if (MOD_XTO & changed) {
/* hack alert -- implement this */ /* hack alert -- implement this */
} }
xaccTransCommitEdit (trans);
printf ("finished saving %s \n", xaccTransGetDescription(trans)); printf ("finished saving %s \n", xaccTransGetDescription(trans));
if (changed) {
/* 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.
@ -198,7 +198,6 @@ printf ("finished saving %s \n", xaccTransGetDescription(trans));
acc = xaccSplitGetAccount (split); acc = xaccSplitGetAccount (split);
accRefresh (acc); accRefresh (acc);
} }
}
/* ======================================================== */ /* ======================================================== */