mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
remove last remaining traces of gui stuff from account structures.
Note that this still leaves the file RegWindow quite broken. Will fix later. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@478 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
63395a85ac
commit
917cb045bf
@ -33,6 +33,14 @@
|
|||||||
|
|
||||||
int next_free_unique_account_id = 0;
|
int next_free_unique_account_id = 0;
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* Because I can't use C++ for this project, doesn't mean that I *
|
* Because I can't use C++ for this project, doesn't mean that I *
|
||||||
* can't pretend too! These functions perform actions on the *
|
* can't pretend too! These functions perform actions on the *
|
||||||
@ -69,13 +77,6 @@ mallocAccount( void )
|
|||||||
acc->splits = (Split **) _malloc (sizeof (Split *));
|
acc->splits = (Split **) _malloc (sizeof (Split *));
|
||||||
acc->splits[0] = NULL;
|
acc->splits[0] = NULL;
|
||||||
|
|
||||||
/* private data */
|
|
||||||
acc->arrowb = NULL;
|
|
||||||
acc->expand = 0;
|
|
||||||
acc->regData = NULL;
|
|
||||||
acc->regLedger = NULL;
|
|
||||||
acc->ledgerList = NULL;
|
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,15 +150,6 @@ freeAccount( Account *acc )
|
|||||||
acc->description = NULL;
|
acc->description = NULL;
|
||||||
acc->notes = NULL;
|
acc->notes = NULL;
|
||||||
|
|
||||||
/* hack alert -- shouldn't we destroy this widget ??? */
|
|
||||||
acc->arrowb = NULL;
|
|
||||||
acc->expand = 0;
|
|
||||||
acc->regData = NULL;
|
|
||||||
acc->regLedger = NULL;
|
|
||||||
|
|
||||||
if (acc->ledgerList) _free (acc->ledgerList);
|
|
||||||
acc->ledgerList = NULL;
|
|
||||||
|
|
||||||
_free(acc);
|
_free(acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +170,7 @@ void
|
|||||||
xaccInsertSplit ( Account *acc, Split *split )
|
xaccInsertSplit ( Account *acc, Split *split )
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
int inserted = False;
|
int inserted = FALSE;
|
||||||
Split **oldsplits;
|
Split **oldsplits;
|
||||||
Transaction *trans;
|
Transaction *trans;
|
||||||
|
|
||||||
@ -186,7 +178,7 @@ xaccInsertSplit ( Account *acc, Split *split )
|
|||||||
if (!split) return;
|
if (!split) return;
|
||||||
|
|
||||||
/* mark the data file as needing to be saved: */
|
/* mark the data file as needing to be saved: */
|
||||||
if( acc->parent != NULL ) acc->parent->saved = False;
|
if( acc->parent != NULL ) acc->parent->saved = FALSE;
|
||||||
|
|
||||||
split->acc = (struct _account *) acc;
|
split->acc = (struct _account *) acc;
|
||||||
|
|
||||||
@ -214,7 +206,7 @@ xaccInsertSplit ( Account *acc, Split *split )
|
|||||||
if (xaccTransOrder (&ot,&trans) > 0) {
|
if (xaccTransOrder (&ot,&trans) > 0) {
|
||||||
acc->splits[i] = split;
|
acc->splits[i] = split;
|
||||||
j--;
|
j--;
|
||||||
inserted = True;
|
inserted = TRUE;
|
||||||
} else {
|
} else {
|
||||||
acc->splits[i] = oldsplits[j];
|
acc->splits[i] = oldsplits[j];
|
||||||
}
|
}
|
||||||
@ -243,7 +235,7 @@ xaccRemoveSplit ( Account *acc, Split *split )
|
|||||||
if (!split) return;
|
if (!split) return;
|
||||||
|
|
||||||
/* mark the data file as needing to be saved: */
|
/* mark the data file as needing to be saved: */
|
||||||
if( acc->parent != NULL ) acc->parent->saved = False;
|
if( acc->parent != NULL ) acc->parent->saved = FALSE;
|
||||||
|
|
||||||
for( i=0,j=0; j<acc->numSplits; i++,j++ ) {
|
for( i=0,j=0; j<acc->numSplits; i++,j++ ) {
|
||||||
acc->splits[i] = acc->splits[j];
|
acc->splits[i] = acc->splits[j];
|
||||||
@ -405,10 +397,10 @@ xaccCheckDateOrder (Account * acc, Split *split )
|
|||||||
|
|
||||||
/* figure out if the transactions are out of order */
|
/* figure out if the transactions are out of order */
|
||||||
if (NULL != prevSplit) {
|
if (NULL != prevSplit) {
|
||||||
if( xaccTransOrder (&(prevSplit->parent), &(split->parent)) >0 ) outOfOrder = True;
|
if( xaccTransOrder (&(prevSplit->parent), &(split->parent)) >0 ) outOfOrder = TRUE;
|
||||||
}
|
}
|
||||||
if (NULL != nextSplit) {
|
if (NULL != nextSplit) {
|
||||||
if( xaccTransOrder (&(split->parent), &(nextSplit->parent)) >0 ) outOfOrder = True;
|
if( xaccTransOrder (&(split->parent), &(nextSplit->parent)) >0 ) outOfOrder = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* take care of re-ordering, if necessary */
|
/* take care of re-ordering, if necessary */
|
||||||
|
@ -321,7 +321,7 @@ adjBOkCB( Widget mw, XtPointer cd, XtPointer cb )
|
|||||||
xaccSetAmount (&(trans->credit_split), dcurrAmount - themount);
|
xaccSetAmount (&(trans->credit_split), dcurrAmount - themount);
|
||||||
|
|
||||||
/* Refresh the account register window */
|
/* Refresh the account register window */
|
||||||
regRefresh(acc->regData);
|
regRefresh(acc);
|
||||||
|
|
||||||
/* Refresh the account reconcile window */
|
/* Refresh the account reconcile window */
|
||||||
recnRefresh (acc);
|
recnRefresh (acc);
|
||||||
|
24
src/Data.c
24
src/Data.c
@ -29,6 +29,14 @@
|
|||||||
#include "Data.h"
|
#include "Data.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* Because I can't use C++ for this project, doesn't mean that I *
|
* Because I can't use C++ for this project, doesn't mean that I *
|
||||||
* can't pretend too! These functions perform actions on the *
|
* can't pretend too! These functions perform actions on the *
|
||||||
@ -43,8 +51,8 @@ AccountGroup *topgroup = 0x0;
|
|||||||
void
|
void
|
||||||
xaccInitializeAccountGroup (AccountGroup *grp)
|
xaccInitializeAccountGroup (AccountGroup *grp)
|
||||||
{
|
{
|
||||||
grp->saved = True;
|
grp->saved = TRUE;
|
||||||
grp->new = False;
|
grp->new = FALSE;
|
||||||
|
|
||||||
grp->parent = NULL;
|
grp->parent = NULL;
|
||||||
grp->numAcc = 0;
|
grp->numAcc = 0;
|
||||||
@ -96,7 +104,7 @@ xaccAccountGroupMarkSaved (AccountGroup *grp)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!grp) return;
|
if (!grp) return;
|
||||||
grp->saved = True;
|
grp->saved = TRUE;
|
||||||
|
|
||||||
for (i=0; i<grp->numAcc; i++) {
|
for (i=0; i<grp->numAcc; i++) {
|
||||||
xaccAccountGroupMarkSaved (grp->account[i]->children);
|
xaccAccountGroupMarkSaved (grp->account[i]->children);
|
||||||
@ -112,7 +120,7 @@ xaccAccountGroupNotSaved (AccountGroup *grp)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!grp) return 0;
|
if (!grp) return 0;
|
||||||
if (False == grp->saved) return 1;
|
if (FALSE == grp->saved) return 1;
|
||||||
|
|
||||||
for (i=0; i<grp->numAcc; i++) {
|
for (i=0; i<grp->numAcc; i++) {
|
||||||
not_saved = xaccAccountGroupNotSaved (grp->account[i]->children);
|
not_saved = xaccAccountGroupNotSaved (grp->account[i]->children);
|
||||||
@ -296,7 +304,7 @@ removeAccount( AccountGroup *grp, int num )
|
|||||||
int i,j;
|
int i,j;
|
||||||
Account **oldAcc = grp->account;
|
Account **oldAcc = grp->account;
|
||||||
|
|
||||||
grp->saved = False;
|
grp->saved = FALSE;
|
||||||
|
|
||||||
grp->numAcc--;
|
grp->numAcc--;
|
||||||
grp->account = (Account **)_malloc((grp->numAcc)*sizeof(Account *));
|
grp->account = (Account **)_malloc((grp->numAcc)*sizeof(Account *));
|
||||||
@ -340,7 +348,7 @@ xaccRemoveGroup (AccountGroup *grp)
|
|||||||
grp = acc -> parent;
|
grp = acc -> parent;
|
||||||
if (!grp) return;
|
if (!grp) return;
|
||||||
|
|
||||||
grp->saved = False;
|
grp->saved = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@ -363,7 +371,7 @@ xaccRemoveAccount (Account *acc)
|
|||||||
|
|
||||||
oldAcc = grp->account;
|
oldAcc = grp->account;
|
||||||
|
|
||||||
grp->saved = False;
|
grp->saved = FALSE;
|
||||||
|
|
||||||
grp->numAcc--;
|
grp->numAcc--;
|
||||||
|
|
||||||
@ -429,7 +437,7 @@ insertAccount( AccountGroup *grp, Account *acc )
|
|||||||
|
|
||||||
oldAcc = grp->account;
|
oldAcc = grp->account;
|
||||||
|
|
||||||
grp->saved = False;
|
grp->saved = FALSE;
|
||||||
|
|
||||||
grp->numAcc++;
|
grp->numAcc++;
|
||||||
grp->account = (Account **)_malloc((grp->numAcc)*sizeof(Account *));
|
grp->account = (Account **)_malloc((grp->numAcc)*sizeof(Account *));
|
||||||
|
@ -45,8 +45,7 @@ xaccAccountWindowDestroy (Account *acc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xaccDestroyRegWindow (acc->regData);
|
xaccDestroyRegWindow (acc);
|
||||||
xaccDestroyRegWindow (acc->regLedger);
|
|
||||||
xaccDestroyRecnWindow (acc);
|
xaccDestroyRecnWindow (acc);
|
||||||
xaccDestroyAdjBWindow (acc);
|
xaccDestroyAdjBWindow (acc);
|
||||||
xaccDestroyEditAccWindow (acc);
|
xaccDestroyEditAccWindow (acc);
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include "Transaction.h"
|
#include "Transaction.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
typedef struct _RegWindow xxxRegWindow;
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
int accListCount (Account **list)
|
int accListCount (Account **list)
|
||||||
@ -200,7 +202,7 @@ ledgerListAdd (Account * acc, struct _RegWindow *addreg)
|
|||||||
if (!acc) return;
|
if (!acc) return;
|
||||||
if (!addreg) return;
|
if (!addreg) return;
|
||||||
|
|
||||||
oldlist = acc->ledgerList;
|
/* oldlist = acc->ledgerList; */
|
||||||
n = ledgerListCount (oldlist);
|
n = ledgerListCount (oldlist);
|
||||||
|
|
||||||
newlist = (struct _RegWindow **)
|
newlist = (struct _RegWindow **)
|
||||||
@ -219,7 +221,7 @@ ledgerListAdd (Account * acc, struct _RegWindow *addreg)
|
|||||||
newlist[n] = addreg;
|
newlist[n] = addreg;
|
||||||
newlist[n+1] = NULL;
|
newlist[n+1] = NULL;
|
||||||
|
|
||||||
acc->ledgerList = newlist;
|
/* acc->ledgerList = newlist; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
@ -235,7 +237,7 @@ ledgerListRemove (Account * acc, struct _RegWindow *delreg)
|
|||||||
if (!acc) return;
|
if (!acc) return;
|
||||||
if (!delreg) return;
|
if (!delreg) return;
|
||||||
|
|
||||||
oldlist = acc->ledgerList;
|
/* oldlist = acc->ledgerList; */
|
||||||
n = ledgerListCount (oldlist);
|
n = ledgerListCount (oldlist);
|
||||||
|
|
||||||
newlist = (struct _RegWindow **)
|
newlist = (struct _RegWindow **)
|
||||||
@ -256,7 +258,7 @@ ledgerListRemove (Account * acc, struct _RegWindow *delreg)
|
|||||||
}
|
}
|
||||||
newlist[i] = NULL;
|
newlist[i] = NULL;
|
||||||
|
|
||||||
acc->ledgerList = newlist;
|
/* acc->ledgerList = newlist; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
@ -271,7 +273,7 @@ ledgerListIsMember (Account * acc, struct _RegWindow *memreg)
|
|||||||
if (!acc) return 0;
|
if (!acc) return 0;
|
||||||
if (!memreg) return 0;
|
if (!memreg) return 0;
|
||||||
|
|
||||||
list = acc->ledgerList;
|
/* list = acc->ledgerList; */
|
||||||
if (!list) return 0;
|
if (!list) return 0;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
|
150
src/MainWindow.c
150
src/MainWindow.c
@ -56,6 +56,17 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "XferWindow.h"
|
#include "XferWindow.h"
|
||||||
|
|
||||||
|
typedef struct _MainArrow {
|
||||||
|
|
||||||
|
Account *account;
|
||||||
|
Widget arrowb; /* arrow button in the main window */
|
||||||
|
short expand; /* expand display of subaccounts in main window */
|
||||||
|
int PreviousArrowReason; /* arrow workaround */
|
||||||
|
|
||||||
|
} MainArrow;
|
||||||
|
|
||||||
|
static MainArrow **arrowList = NULL;
|
||||||
|
|
||||||
/** PROTOTYPES ******************************************************/
|
/** PROTOTYPES ******************************************************/
|
||||||
static void xaccMainWindowRedisplayBalance (void);
|
static void xaccMainWindowRedisplayBalance (void);
|
||||||
static void closeMainWindow ( Widget mw, XtPointer cd, XtPointer cb );
|
static void closeMainWindow ( Widget mw, XtPointer cd, XtPointer cb );
|
||||||
@ -97,6 +108,73 @@ Boolean havePixels = False;
|
|||||||
#define XACC_MAIN_ACC_BALN 3
|
#define XACC_MAIN_ACC_BALN 3
|
||||||
#define XACC_MAIN_NUM_COLS 4
|
#define XACC_MAIN_NUM_COLS 4
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
\********************************************************************/
|
||||||
|
|
||||||
|
MainArrow *
|
||||||
|
xaccMainArrow (Widget acctrix, Account *acc )
|
||||||
|
{
|
||||||
|
MainArrow *arrowData;
|
||||||
|
int height;
|
||||||
|
|
||||||
|
FETCH_FROM_LIST (MainArrow, arrowList, acc, account, arrowData);
|
||||||
|
|
||||||
|
/* adjust arrow size for font size */
|
||||||
|
height = XbaeMatrixGetRowPixelHeight (acctrix);
|
||||||
|
arrowData->arrowb = XtVaCreateManagedWidget ("accarrow",
|
||||||
|
xmArrowButtonWidgetClass, acctrix,
|
||||||
|
XmNwidth, height,
|
||||||
|
XmNheight, height,
|
||||||
|
XmNshadowThickness, 0,
|
||||||
|
XmNarrowDirection, XmARROW_DOWN,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
XtAddCallback (arrowData->arrowb, XmNactivateCallback,
|
||||||
|
expandListCB, (XtPointer *) arrowData);
|
||||||
|
|
||||||
|
#define __XACC_DO_ARROW_CALLBACK
|
||||||
|
#ifdef __XACC_DO_ARROW_CALLBACK
|
||||||
|
/* add a button press event handler just in case the
|
||||||
|
* XmNactivate callback is broken. See notes for the
|
||||||
|
* ArrowEventCallback for details. -- Linas */
|
||||||
|
arrowData->PreviousArrowReason = 0;
|
||||||
|
XtAddEventHandler(arrowData->arrowb,
|
||||||
|
ButtonPressMask | ButtonReleaseMask,
|
||||||
|
False, (XtEventHandler) ArrowEventCallback,
|
||||||
|
(XtPointer) arrowData);
|
||||||
|
#endif /* __XACC_DO_ARROW_CALLBACK */
|
||||||
|
|
||||||
|
return arrowData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
\********************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
xaccDestroyMainArrow (Account *acc )
|
||||||
|
{
|
||||||
|
MainArrow *arrowData;
|
||||||
|
|
||||||
|
REMOVE_FROM_LIST (MainArrow, arrowList, acc, account, arrowData);
|
||||||
|
|
||||||
|
if (!arrowData) return;
|
||||||
|
|
||||||
|
XtRemoveCallback (arrowData->arrowb, XmNactivateCallback,
|
||||||
|
expandListCB, (XtPointer *) arrowData);
|
||||||
|
|
||||||
|
#ifdef __XACC_DO_ARROW_CALLBACK
|
||||||
|
arrowData->PreviousArrowReason = 0;
|
||||||
|
XtRemoveEventHandler (arrowData->arrowb,
|
||||||
|
ButtonPressMask | ButtonReleaseMask,
|
||||||
|
False, (XtEventHandler) ArrowEventCallback,
|
||||||
|
(XtPointer) arrowData);
|
||||||
|
#endif /* __XACC_DO_ARROW_CALLBACK */
|
||||||
|
XtUnmanageChild (arrowData->arrowb);
|
||||||
|
XtDestroyWidget (arrowData->arrowb);
|
||||||
|
arrowData->arrowb = NULL;
|
||||||
|
free (arrowData);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* xaccMainWindowAddAcct *
|
* xaccMainWindowAddAcct *
|
||||||
* *
|
* *
|
||||||
@ -175,40 +253,14 @@ xaccMainWindowAddAcct (Widget acctrix, AccountGroup *grp, int depth )
|
|||||||
* will be a cell-wdiget, and will be stored with the account
|
* will be a cell-wdiget, and will be stored with the account
|
||||||
* structure */
|
* structure */
|
||||||
if (acc->children) {
|
if (acc->children) {
|
||||||
/* if the arrow button doesn't exist, add it */
|
MainArrow *arrowData;
|
||||||
if (NULL == acc->arrowb) {
|
|
||||||
int height;
|
|
||||||
/* adjust arrow size for font size */
|
|
||||||
height = XbaeMatrixGetRowPixelHeight (acctrix);
|
|
||||||
acc->arrowb = XtVaCreateManagedWidget ("accarrow",
|
|
||||||
xmArrowButtonWidgetClass, acctrix,
|
|
||||||
XmNwidth, height,
|
|
||||||
XmNheight, height,
|
|
||||||
XmNshadowThickness, 0,
|
|
||||||
XmNarrowDirection, XmARROW_DOWN,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
XtAddCallback (acc->arrowb, XmNactivateCallback,
|
arrowData = xaccMainArrow (acctrix, acc);
|
||||||
expandListCB, (XtPointer *) acc);
|
XbaeMatrixSetCellWidget (acctrix, currow, XACC_MAIN_ACC_ARRW, arrowData->arrowb);
|
||||||
|
XtManageChild (arrowData->arrowb);
|
||||||
#define __XACC_DO_ARROW_CALLBACK
|
|
||||||
#ifdef __XACC_DO_ARROW_CALLBACK
|
|
||||||
/* add a button press event handler just in case the
|
|
||||||
* XmNactivate callback is broken. See notes for the
|
|
||||||
* ArrowEventCallback for details. -- Linas */
|
|
||||||
acc->PreviousArrowReason = 0;
|
|
||||||
XtAddEventHandler(acc->arrowb,
|
|
||||||
ButtonPressMask | ButtonReleaseMask,
|
|
||||||
False, (XtEventHandler) ArrowEventCallback,
|
|
||||||
(XtPointer) acc);
|
|
||||||
#endif /* __XACC_DO_ARROW_CALLBACK */
|
|
||||||
|
|
||||||
}
|
|
||||||
XbaeMatrixSetCellWidget (acctrix, currow, XACC_MAIN_ACC_ARRW, acc->arrowb);
|
|
||||||
XtManageChild (acc->arrowb);
|
|
||||||
|
|
||||||
/* recursively display children accounts */
|
/* recursively display children accounts */
|
||||||
if (acc->expand) {
|
if (arrowData->expand) {
|
||||||
xaccMainWindowAddAcct (acctrix, acc->children, depth+1);
|
xaccMainWindowAddAcct (acctrix, acc->children, depth+1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -216,22 +268,8 @@ xaccMainWindowAddAcct (Widget acctrix, AccountGroup *grp, int depth )
|
|||||||
* arrow too. This situation can occur if a sub-account
|
* arrow too. This situation can occur if a sub-account
|
||||||
* has been deleted.
|
* has been deleted.
|
||||||
*/
|
*/
|
||||||
if (acc->arrowb) {
|
XbaeMatrixSetCellWidget (acctrix, currow, XACC_MAIN_ACC_ARRW, NULL);
|
||||||
XbaeMatrixSetCellWidget (acctrix, currow, XACC_MAIN_ACC_ARRW, NULL);
|
xaccDestroyMainArrow (acc);
|
||||||
XtRemoveCallback (acc->arrowb, XmNactivateCallback,
|
|
||||||
expandListCB, (XtPointer *) acc);
|
|
||||||
|
|
||||||
#ifdef __XACC_DO_ARROW_CALLBACK
|
|
||||||
acc->PreviousArrowReason = 0;
|
|
||||||
XtRemoveEventHandler(acc->arrowb,
|
|
||||||
ButtonPressMask | ButtonReleaseMask,
|
|
||||||
False, (XtEventHandler) ArrowEventCallback,
|
|
||||||
(XtPointer) acc);
|
|
||||||
#endif /* __XACC_DO_ARROW_CALLBACK */
|
|
||||||
XtUnmanageChild (acc->arrowb);
|
|
||||||
XtDestroyWidget (acc->arrowb);
|
|
||||||
acc->arrowb = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,39 +403,39 @@ static void
|
|||||||
expandListCB( Widget mw, XtPointer pClientData, XtPointer cb)
|
expandListCB( Widget mw, XtPointer pClientData, XtPointer cb)
|
||||||
{
|
{
|
||||||
XmAnyCallbackStruct *info = (XmAnyCallbackStruct *) cb;
|
XmAnyCallbackStruct *info = (XmAnyCallbackStruct *) cb;
|
||||||
Account *acc = (Account *)pClientData;
|
MainArrow *ad = (MainArrow *)pClientData;
|
||||||
|
|
||||||
/* a "fix" to avoid double invocation */
|
/* a "fix" to avoid double invocation */
|
||||||
switch ( info->reason ) {
|
switch ( info->reason ) {
|
||||||
case XmCR_ACTIVATE:
|
case XmCR_ACTIVATE:
|
||||||
/* avoid double invocation */
|
/* avoid double invocation */
|
||||||
if (XmCR_ACTIVATE == acc->PreviousArrowReason) return;
|
if (XmCR_ACTIVATE == ad->PreviousArrowReason) return;
|
||||||
acc -> PreviousArrowReason = XmCR_ACTIVATE;
|
ad -> PreviousArrowReason = XmCR_ACTIVATE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case XmCR_ARM:
|
case XmCR_ARM:
|
||||||
/* avoid double invocation */
|
/* avoid double invocation */
|
||||||
if (XmCR_ARM == acc->PreviousArrowReason) return;
|
if (XmCR_ARM == ad->PreviousArrowReason) return;
|
||||||
acc -> PreviousArrowReason = XmCR_ARM;
|
ad -> PreviousArrowReason = XmCR_ARM;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* change arrow direction, mark account as needing expansion */
|
/* change arrow direction, mark account as needing expansion */
|
||||||
if (acc->expand) {
|
if (ad->expand) {
|
||||||
acc->expand = 0;
|
ad->expand = 0;
|
||||||
XtVaSetValues (mw,
|
XtVaSetValues (mw,
|
||||||
XmNarrowDirection, XmARROW_DOWN,
|
XmNarrowDirection, XmARROW_DOWN,
|
||||||
NULL);
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
acc->expand = 1;
|
ad->expand = 1;
|
||||||
XtVaSetValues (mw,
|
XtVaSetValues (mw,
|
||||||
XmNarrowDirection, XmARROW_UP,
|
XmNarrowDirection, XmARROW_UP,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* redraw the main window */
|
/* redraw the main window */
|
||||||
selected_acc = acc;
|
selected_acc = ad->account;
|
||||||
refreshMainWindow ();
|
refreshMainWindow ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,10 +456,9 @@ recnWindow( Widget parent, Account *acc )
|
|||||||
if( !startRecnWindow(parent,acc,&ddiff) )
|
if( !startRecnWindow(parent,acc,&ddiff) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
setBusyCursor(parent);
|
FETCH_FROM_LIST (RecnWindow, recnList, acc, acc, recnData);
|
||||||
|
|
||||||
recnData = (RecnWindow *)_malloc(sizeof(RecnWindow));
|
setBusyCursor(parent);
|
||||||
recnData->acc = acc;
|
|
||||||
recnData->ddiff = ddiff;
|
recnData->ddiff = ddiff;
|
||||||
|
|
||||||
sprintf( title, "%s: %s", acc->accountName, RECONCILE_STR);
|
sprintf( title, "%s: %s", acc->accountName, RECONCILE_STR);
|
||||||
@ -840,7 +839,7 @@ recnOkCB( Widget mw, XtPointer cd, XtPointer cb )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* refresh the register window */
|
/* refresh the register window */
|
||||||
regRefresh(recnData->acc->regData);
|
regRefresh(recnData->acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
|
@ -78,10 +78,15 @@ typedef struct _RegWindow {
|
|||||||
} RegWindow;
|
} RegWindow;
|
||||||
|
|
||||||
|
|
||||||
|
/** GLOBALS *********************************************************/
|
||||||
|
extern Widget toplevel;
|
||||||
|
|
||||||
|
static RegWindow **regList = NULL; /* single-account registers */
|
||||||
|
static RegWindow **ledgerList = NULL; /* multiple-account registers */
|
||||||
|
|
||||||
/** PROTOTYPES ******************************************************/
|
/** PROTOTYPES ******************************************************/
|
||||||
RegWindow * regWindowLedger( Widget parent, Account **acclist, int type);
|
RegWindow * regWindowLedger( Widget parent, Account **acclist, int type);
|
||||||
void regRefresh (RegWindow * regData);
|
void regRefresh (Account *acc);
|
||||||
|
|
||||||
static void closeRegWindow( Widget mw, XtPointer cd, XtPointer cb );
|
static void closeRegWindow( Widget mw, XtPointer cd, XtPointer cb );
|
||||||
static void startRecnCB( Widget mw, XtPointer cd, XtPointer cb );
|
static void startRecnCB( Widget mw, XtPointer cd, XtPointer cb );
|
||||||
@ -90,24 +95,6 @@ static void recordCB( Widget mw, XtPointer cd, XtPointer cb );
|
|||||||
static void deleteCB( Widget mw, XtPointer cd, XtPointer cb );
|
static void deleteCB( Widget mw, XtPointer cd, XtPointer cb );
|
||||||
static void cancelCB( Widget mw, XtPointer cd, XtPointer cb );
|
static void cancelCB( Widget mw, XtPointer cd, XtPointer cb );
|
||||||
|
|
||||||
|
|
||||||
/** GLOBALS *********************************************************/
|
|
||||||
extern Widget toplevel;
|
|
||||||
|
|
||||||
/********************************************************************\
|
|
||||||
* xaccDestroyRegWindow()
|
|
||||||
* It is enought to call just XtDestroy Widget. Any allocated
|
|
||||||
* memory will be freed by the close callbacks.
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
xaccDestroyRegWindow (RegWindow *regData)
|
|
||||||
{
|
|
||||||
if (!regData) return;
|
|
||||||
XtDestroyWidget(regData->dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* regWindowSimple *
|
* regWindowSimple *
|
||||||
* opens up a register window for Account account *
|
* opens up a register window for Account account *
|
||||||
@ -125,11 +112,6 @@ regWindowSimple( Widget parent, Account *acc )
|
|||||||
acclist[0] = acc;
|
acclist[0] = acc;
|
||||||
acclist[1] = NULL;
|
acclist[1] = NULL;
|
||||||
|
|
||||||
/* don't allow more than one regster window for this account */
|
|
||||||
/* hack alert -- we should raise this window to the top, if
|
|
||||||
* we are called, and the register already exists */
|
|
||||||
if (acc->regData) return acc->regData;
|
|
||||||
|
|
||||||
retval = regWindowLedger (parent, acclist, acc->type);
|
retval = regWindowLedger (parent, acclist, acc->type);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -151,11 +133,7 @@ regWindowAccGroup( Widget parent, Account *acc )
|
|||||||
Account *le;
|
Account *le;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* don't allow more than one ledger window for this account */
|
/* hack alert -- should search in the ledger list */
|
||||||
/* hack alert -- we should raise this window to the top, if
|
|
||||||
* we are called, and the ledger already exists */
|
|
||||||
if (acc->regLedger) return acc->regLedger;
|
|
||||||
|
|
||||||
list = xaccGroupToList (acc);
|
list = xaccGroupToList (acc);
|
||||||
|
|
||||||
switch (acc->type) {
|
switch (acc->type) {
|
||||||
@ -280,9 +258,8 @@ regWindowLedger( Widget parent, Account **acclist, int ledger_type )
|
|||||||
* create regData, compute register display type *
|
* create regData, compute register display type *
|
||||||
\******************************************************************/
|
\******************************************************************/
|
||||||
|
|
||||||
setBusyCursor( parent );
|
/* hack this aint right quite */
|
||||||
|
FETCH_FROM_LIST (RegWindow, regList, acclist[0], blackacc[0], regData);
|
||||||
regData = (RegWindow *)_malloc(sizeof(RegWindow));
|
|
||||||
|
|
||||||
/* count the number of accounts we are supposed to display,
|
/* count the number of accounts we are supposed to display,
|
||||||
* and then, store them. */
|
* and then, store them. */
|
||||||
@ -296,11 +273,11 @@ regWindowLedger( Widget parent, Account **acclist, int ledger_type )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBusyCursor( parent );
|
||||||
|
|
||||||
regData->type = ledger_type;
|
regData->type = ledger_type;
|
||||||
|
|
||||||
if (1 == regData->numAcc) {
|
if (1 == regData->numAcc) {
|
||||||
/* avoid having two open registers for one account */
|
|
||||||
regData->blackacc[0]->regData = regData;
|
|
||||||
windowname = regData->blackacc[0]->accountName;
|
windowname = regData->blackacc[0]->accountName;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -539,7 +516,8 @@ regWindowLedger( Widget parent, Account **acclist, int ledger_type )
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
XtManageChild(pane);
|
XtManageChild(pane);
|
||||||
|
|
||||||
regRefresh( regData );
|
/* hack alert -- this is wrong */
|
||||||
|
regRefresh (regData->blackacc[0]);
|
||||||
|
|
||||||
XtPopup( regData->dialog, XtGrabNone );
|
XtPopup( regData->dialog, XtGrabNone );
|
||||||
|
|
||||||
@ -551,8 +529,12 @@ regWindowLedger( Widget parent, Account **acclist, int ledger_type )
|
|||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
void regRefresh (RegWindow * regData)
|
void regRefresh (Account *acc)
|
||||||
{
|
{
|
||||||
|
RegWindow *regData;
|
||||||
|
|
||||||
|
FIND_IN_LIST (RegWindow, regList, acc, blackacc[0], regData);
|
||||||
|
|
||||||
/* complete GUI initialization */
|
/* complete GUI initialization */
|
||||||
xaccLoadXferCell (regData->ledger->xfrmCell, regData->blackacc[0]->parent);
|
xaccLoadXferCell (regData->ledger->xfrmCell, regData->blackacc[0]->parent);
|
||||||
|
|
||||||
@ -560,6 +542,24 @@ void regRefresh (RegWindow * regData)
|
|||||||
xaccLoadRegister (regData->ledger, regData->blackacc[0]->splits);
|
xaccLoadRegister (regData->ledger, regData->blackacc[0]->splits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* xaccDestroyRegWindow()
|
||||||
|
* It is enought to call just XtDestroy Widget. Any allocated
|
||||||
|
* memory will be freed by the close callbacks.
|
||||||
|
\********************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
xaccDestroyRegWindow (Account *acc)
|
||||||
|
{
|
||||||
|
RegWindow *regData;
|
||||||
|
|
||||||
|
/* hack alert -- this is not correct yeah */
|
||||||
|
REMOVE_FROM_LIST (RegWindow, regList, acc, blackacc[0], regData);
|
||||||
|
|
||||||
|
XtDestroyWidget(regData->dialog);
|
||||||
|
free (regData);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* closeRegWindow *
|
* closeRegWindow *
|
||||||
* frees memory allocated for an regWindow, and other cleanup *
|
* frees memory allocated for an regWindow, and other cleanup *
|
||||||
@ -572,20 +572,19 @@ void regRefresh (RegWindow * regData)
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
static void
|
static void
|
||||||
closeRegWindow( Widget mw, XtPointer cd, XtPointer cb )
|
closeRegWindow( Widget mw, XtPointer cd, XtPointer cb )
|
||||||
{
|
{
|
||||||
RegWindow *regData = (RegWindow *)cd;
|
RegWindow *regData = (RegWindow *)cd;
|
||||||
|
|
||||||
/* Save any unsaved changes */
|
/* Save any unsaved changes */
|
||||||
xaccSaveRegEntry (regData->ledger);
|
xaccSaveRegEntry (regData->ledger);
|
||||||
|
|
||||||
regData->blackacc[0]->regData = NULL;
|
|
||||||
regData->blackacc[0]->regLedger = NULL;
|
regData->blackacc[0]->regLedger = NULL;
|
||||||
|
|
||||||
ledgerListRemoveList (regData->blackacc, regData);
|
ledgerListRemoveList (regData->blackacc, regData);
|
||||||
_free(regData);
|
free(regData);
|
||||||
|
|
||||||
DEBUG("closed RegWindow\n");
|
DEBUG("closed RegWindow\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* startAdjBCB -- open up the adjust balance window... called *
|
* startAdjBCB -- open up the adjust balance window... called *
|
||||||
|
@ -483,7 +483,7 @@ xferCB( Widget mw, XtPointer cd, XtPointer cb )
|
|||||||
xaccInsertSplit (((Account *) (split->acc)), split);
|
xaccInsertSplit (((Account *) (split->acc)), split);
|
||||||
|
|
||||||
/* Refresh the "from" account register window */
|
/* Refresh the "from" account register window */
|
||||||
regRefresh(acc->regData);
|
regRefresh(acc);
|
||||||
/* Refresh the "from" account reconcile window */
|
/* Refresh the "from" account reconcile window */
|
||||||
recnRefresh(acc);
|
recnRefresh(acc);
|
||||||
|
|
||||||
@ -491,7 +491,7 @@ xferCB( Widget mw, XtPointer cd, XtPointer cb )
|
|||||||
xaccInsertSplit (((Account *) (trans->credit_split.acc)), &(trans->credit_split));
|
xaccInsertSplit (((Account *) (trans->credit_split.acc)), &(trans->credit_split));
|
||||||
|
|
||||||
/* Refresh the "to" account register window */
|
/* Refresh the "to" account register window */
|
||||||
regRefresh(acc->regData);
|
regRefresh(acc);
|
||||||
/* Refresh the "to" account reconcile window */
|
/* Refresh the "to" account reconcile window */
|
||||||
recnRefresh(acc);
|
recnRefresh(acc);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user