mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
ledger-list related fixes
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@481 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -379,13 +379,10 @@ regWindowLedger( Widget parent, Account *lead_acc, Account **acclist, int ledger
|
|||||||
* and then, store them. */
|
* and then, store them. */
|
||||||
regData->numAcc = accListCount (acclist);
|
regData->numAcc = accListCount (acclist);
|
||||||
regData->blackacc = accListCopy (acclist);
|
regData->blackacc = accListCopy (acclist);
|
||||||
|
|
||||||
ledgerListAddList (regData->blackacc, regData);
|
|
||||||
|
|
||||||
setBusyCursor( parent );
|
|
||||||
|
|
||||||
regData->type = ledger_type;
|
regData->type = ledger_type;
|
||||||
|
|
||||||
|
fullList = ledgerListAdd (fullList, regData);
|
||||||
|
|
||||||
/******************************************************************\
|
/******************************************************************\
|
||||||
* Start creating the Motif Widgets ... *
|
* Start creating the Motif Widgets ... *
|
||||||
\******************************************************************/
|
\******************************************************************/
|
||||||
@@ -409,6 +406,8 @@ regWindowLedger( Widget parent, Account *lead_acc, Account **acclist, int ledger
|
|||||||
windowname = "General Ledger";
|
windowname = "General Ledger";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBusyCursor( parent );
|
||||||
|
|
||||||
regData->dialog =
|
regData->dialog =
|
||||||
XtVaCreatePopupShell( "dialog",
|
XtVaCreatePopupShell( "dialog",
|
||||||
xmDialogShellWidgetClass, parent,
|
xmDialogShellWidgetClass, parent,
|
||||||
@@ -495,6 +494,10 @@ regWindowLedger( Widget parent, Account *lead_acc, Account **acclist, int ledger
|
|||||||
|
|
||||||
regData->reg = reg;
|
regData->reg = reg;
|
||||||
|
|
||||||
|
/* complete GUI initialization */
|
||||||
|
/* hack alert ------- wrong list of accounts */
|
||||||
|
xaccLoadXferCell (regData->ledger->xfrmCell, regData->blackacc[0]->parent);
|
||||||
|
|
||||||
XtManageChild (reg);
|
XtManageChild (reg);
|
||||||
XtManageChild (frame);
|
XtManageChild (frame);
|
||||||
XtManageChild (pane);
|
XtManageChild (pane);
|
||||||
@@ -634,19 +637,31 @@ regWindowLedger( Widget parent, Account *lead_acc, Account **acclist, int ledger
|
|||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
|
* refresh *all* register windows which contain this account *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
void regRefresh (Account *acc)
|
void regRefresh (Account *acc)
|
||||||
{
|
{
|
||||||
RegWindow *regData;
|
RegWindow *regData;
|
||||||
|
int n;
|
||||||
|
|
||||||
FIND_IN_LIST (RegWindow, regList, acc, blackacc[0], regData);
|
xaccRecomputeBalance (acc);
|
||||||
|
|
||||||
/* complete GUI initialization */
|
/* find all registers whch contain this account */
|
||||||
xaccLoadXferCell (regData->ledger->xfrmCell, regData->blackacc[0]->parent);
|
n = 0;
|
||||||
|
regData = fullList[n];
|
||||||
|
while (regData) {
|
||||||
|
int got_one;
|
||||||
|
|
||||||
xaccRecomputeBalance (regData->blackacc[0]);
|
got_one = ledgerIsMember (regData, acc);
|
||||||
xaccLoadRegister (regData->ledger, regData->blackacc[0]->splits);
|
if (got_one) {
|
||||||
|
/* hack alert -- should be recomputing the list of splits */
|
||||||
|
/* and problbly the balance too */
|
||||||
|
xaccLoadRegister (regData->ledger, acc->splits);
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
regData = fullList[n];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@@ -659,12 +674,27 @@ void
|
|||||||
xaccDestroyRegWindow (Account *acc)
|
xaccDestroyRegWindow (Account *acc)
|
||||||
{
|
{
|
||||||
RegWindow *regData;
|
RegWindow *regData;
|
||||||
|
int n;
|
||||||
|
|
||||||
/* hack alert -- this is not correct yeah */
|
/* find the single-account window for this account, if any */
|
||||||
REMOVE_FROM_LIST (RegWindow, regList, acc, blackacc[0], regData);
|
FIND_IN_LIST (RegWindow, regList, acc, leader, regData);
|
||||||
|
if (regData) XtDestroyWidget(regData->dialog);
|
||||||
|
|
||||||
XtDestroyWidget(regData->dialog);
|
/* find the multiple-account window for this account, if any */
|
||||||
free (regData);
|
FIND_IN_LIST (RegWindow, ledgerList, acc, leader, regData);
|
||||||
|
if (regData) XtDestroyWidget(regData->dialog);
|
||||||
|
|
||||||
|
/* cruise throught the miscellanous account windows */
|
||||||
|
n = 0;
|
||||||
|
regData = fullList[n];
|
||||||
|
while (regData) {
|
||||||
|
int got_one;
|
||||||
|
|
||||||
|
got_one = ledgerIsMember (regData, acc);
|
||||||
|
if (got_one) XtDestroyWidget(regData->dialog);
|
||||||
|
n++;
|
||||||
|
regData = fullList[n];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@@ -681,13 +711,18 @@ static void
|
|||||||
closeRegWindow( Widget mw, XtPointer cd, XtPointer cb )
|
closeRegWindow( Widget mw, XtPointer cd, XtPointer cb )
|
||||||
{
|
{
|
||||||
RegWindow *regData = (RegWindow *)cd;
|
RegWindow *regData = (RegWindow *)cd;
|
||||||
|
Account *acc = regData->leader;
|
||||||
|
|
||||||
/* Save any unsaved changes */
|
/* Save any unsaved changes */
|
||||||
xaccSaveRegEntry (regData->ledger);
|
xaccSaveRegEntry (regData->ledger);
|
||||||
|
|
||||||
ledgerListRemoveList (regData->blackacc, regData);
|
/* whether this is a single or multi-account window, remove it */
|
||||||
free(regData);
|
REMOVE_FROM_LIST (RegWindow, regList, acc, leader);
|
||||||
|
REMOVE_FROM_LIST (RegWindow, ledgerList, acc, leader);
|
||||||
|
|
||||||
|
ledgerListRemove (fullList, regData);
|
||||||
|
|
||||||
|
free(regData);
|
||||||
DEBUG("closed RegWindow\n");
|
DEBUG("closed RegWindow\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -702,7 +737,7 @@ closeRegWindow( Widget mw, XtPointer cd, XtPointer cb )
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
static void
|
static void
|
||||||
startAdjBCB( Widget mw, XtPointer cd, XtPointer cb )
|
startAdjBCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||||
{
|
{
|
||||||
RegWindow *regData = (RegWindow *)cd;
|
RegWindow *regData = (RegWindow *)cd;
|
||||||
Account *acc;
|
Account *acc;
|
||||||
|
|
||||||
@@ -710,11 +745,14 @@ startAdjBCB( Widget mw, XtPointer cd, XtPointer cb )
|
|||||||
* then this callback should never have been called,
|
* then this callback should never have been called,
|
||||||
* since the menu entry is supposed to be greyed out.
|
* since the menu entry is supposed to be greyed out.
|
||||||
*/
|
*/
|
||||||
if (1 != regData->numAcc) return;
|
if (regData->leader) {
|
||||||
|
acc = regData->leader;
|
||||||
acc = regData->blackacc[0];
|
} else {
|
||||||
adjBWindow( toplevel, acc );
|
if (1 != regData->numAcc) return;
|
||||||
|
acc = regData->blackacc[0];
|
||||||
}
|
}
|
||||||
|
adjBWindow( toplevel, acc );
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* startRecnCB -- open up the reconcile window... called from *
|
* startRecnCB -- open up the reconcile window... called from *
|
||||||
@@ -727,7 +765,7 @@ startAdjBCB( Widget mw, XtPointer cd, XtPointer cb )
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
static void
|
static void
|
||||||
startRecnCB( Widget mw, XtPointer cd, XtPointer cb )
|
startRecnCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||||
{
|
{
|
||||||
RegWindow *regData = (RegWindow *)cd;
|
RegWindow *regData = (RegWindow *)cd;
|
||||||
Account *acc;
|
Account *acc;
|
||||||
|
|
||||||
@@ -735,11 +773,14 @@ startRecnCB( Widget mw, XtPointer cd, XtPointer cb )
|
|||||||
* then this callback should never have been called,
|
* then this callback should never have been called,
|
||||||
* since the menu entry is supposed to be greyed out.
|
* since the menu entry is supposed to be greyed out.
|
||||||
*/
|
*/
|
||||||
if (1 != regData->numAcc) return;
|
if (regData->leader) {
|
||||||
|
acc = regData->leader;
|
||||||
acc = regData->blackacc[0];
|
} else {
|
||||||
recnWindow( toplevel, acc );
|
if (1 != regData->numAcc) return;
|
||||||
|
acc = regData->blackacc[0];
|
||||||
}
|
}
|
||||||
|
recnWindow( toplevel, acc );
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* recordCB *
|
* recordCB *
|
||||||
|
|||||||
Reference in New Issue
Block a user