mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
088931df8a
commit
a9700af853
41
src/Ledger.c
41
src/Ledger.c
@ -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,23 +181,22 @@ 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.
|
||||||
* Set user_hook to null, so that we can be sure of
|
* Set user_hook to null, so that we can be sure of
|
||||||
* getting a new split.
|
* getting a new split.
|
||||||
*/
|
*/
|
||||||
if (split == ((Split *) (reg->user_hook))) {
|
if (split == ((Split *) (reg->user_hook))) {
|
||||||
reg->user_hook = NULL;
|
reg->user_hook = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* refresh the register windows *only* if something changed */
|
|
||||||
acc = xaccSplitGetAccount (split);
|
|
||||||
accRefresh (acc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* refresh the register windows *only* if something changed */
|
||||||
|
acc = xaccSplitGetAccount (split);
|
||||||
|
accRefresh (acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
|
Loading…
Reference in New Issue
Block a user