*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2044 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-03-01 10:09:57 +00:00
parent 647b419e0f
commit 8b0838e075
29 changed files with 566 additions and 333 deletions

View File

@ -1,5 +1,45 @@
2000-03-01 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/scm/extensions.scm: add the extensions menu if debugging.
* src/scm/bootstrap.scm: new function to check debugging status.
* src/FileDialog.c (gncFileQIFImport): set the busy cursor when
reading and processing the qif.
* src/SplitLedger.c: added a sign-reversal callback.
* src/gnome/dialog-utils.c (gnc_ui_get_account_full_balance): used
the sign-reversal option in computation.
* src/gnome/top-level.c: implement the sign-reversal configuration
and callbacks.
* src/gnome/window-main.c (gnc_ui_refresh_statusbar): used
sign-reversal option in computation.
* src/scm/prefs.scm: add an option to choose how accounts
are sign-reversed.
2000-02-29 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/gnome/cursors.c (gnc_ui_set_cursor): let the gtk main loop
catch up before we exit. This makes sure the cursor gets changed
before we return.
* src/gnome/dialog-filebox.c: hide the window before exiting
the gtk main loop.
* src/scm/prefs.scm: added a new option for expanding parent
accounts with double-clicks instead of opening them.
* src/gnome/window-main.c (gnc_account_tree_activate_cb): use
expansion option to decide whether to open or expand.
* src/SplitLedger.c: check for common currency when saving a
register entry. If there is none, don't perform the split
insertion; instead show a warning dialog.
* src/scm/prefs.scm: converted account type and account field
options to list options.

36
README
View File

@ -93,18 +93,18 @@ http://www.gnucash.org/source_code.php3
Running:
--------
Only the Motif version of GnuCash is currently functional. The Gnome version
will give you a taste for Gnome, and is coming along fine, but is probably not
stable enough for regular use. The qt/kde version doesn't compile, most
functions are missing. See below for OS's other than GNU/Linux/*BSD support.
Only the Motif version of GnuCash is currently stable. The Gnome
version is a development version, but will soon be stable enough for
regular use. Development of the Motif version has ceased. The qt/kde
version doesn't compile, most functions are missing. See below for
OS's other than GNU/Linux/*BSD support.
The following packages are required to be installed to run the gnucash
Motif binary:
guile -- Provides main extension language infrastructure.
This is used extensively in gnucash for initialization & startup.
Require version 1.3.4 or later.
The guile-1.3.4-1 rpm works.
Require version 1.3 or later. The guile-1.3-7 rpm works.
Motif or Lesstif --
Either a commercial Motif, or the free software clone Lesstif is
@ -123,7 +123,9 @@ Motif or Lesstif --
Lesstif 0.88.1 works
Lesstif 0.89.0 works
XmHTML -- Provides HTML display capabilities. Used for Help Dialogues, Reports.
XmHTML -- Provides HTML display capabilities.
Used for Help Dialogues and Reports.
Require version 1.1.4 or later
http://www.llp.fu-berlin.de/lsoft/F/5/XMHTML.html
http://www.xs4all.nl/~ripley/XmHTML/XmHTML.html
@ -132,9 +134,9 @@ XmHTML -- Provides HTML display capabilities. Used for Help Dialogues, Reports.
Note: some precompiled versions of XmHTML have been compiled with
Motif. When used with most precompiled versions of Lesstif, you
will get a "undefined symbol XmeDrawShadows" error. There are several
solutions; the simplest is probably to download the XmHTML source
package and compile it yourself.
will get a "undefined symbol XmeDrawShadows" error. There are
several solutions; the simplest is probably to download the
XmHTML source package and compile it yourself.
slib -- scheme libraries for guile. Need version slib2c4 or later.
@ -167,6 +169,17 @@ perl-HTML/HTML-Parser-2.20
http://www.cpan.org/CPAN.html
The following packages are required to be installed to run the GnuCash
Gnome binary:
gnome-libs -- version 1.0.40 or higher should work. These libraries
require numerous other supporting libraries, such as
gtk and glib.
guile -- same as Motif
slib -- same as Motif
Invocation:
-----------
You can start GnuCash at the command-line, with "gnucash" or "gnucash
@ -245,7 +258,8 @@ here).
Building & Installing:
----------------------
These steps does not apply to binary distributions; only to source distributions.
These steps does not apply to binary distributions; only to source
distributions.
Prior to building GnuCash, you will have to obtain and install the following
packages:

View File

@ -1,70 +0,0 @@
From sk@xgm.de Thu Jan 14 12:39:26 1999
Date: Thu, 14 Jan 1999 18:25:11 +0100
From: Sven Kuenzler <sk@xgm.de>
Installing GnuCash Motif on a SuSE Linux Distribution
-----------------------------------------------------
Installing GunCash on SuSE is a little tricky. There are a couple of
necessary components missing. This README describes how I got I working.
This does not mean that it's the only (or optimal) way of getting GnuCash
ready. But there are several other options which are worse (and I happened
to "test" some of them...)
To get GnuCash compiled you will need
gnucash-1.1.25.tar.gz ("NOT REALLY??")
eperl-2.2.14.tar.gz
Xbaelin-4.6.2.4.tar.gz
guile-core-19980818.tar.gz
XmHTML-1.1.5-1-rh51.i386.rpm
The packages named above can be downloaded directly from GnuCash's ftp site
at ftp.gnucash.org. The rpm files can be installed using SuSE's YaST, the
.tar.gz files can be unpacked with tar xfvz file.tar.gz. They can be
configured and installed as described in their READMEs, I did not experience
any difficulties with them.
a1 libz
gra libgif
gra libjpeg
These are packages from the distribution from the a1 and gra series
(This is true for SuSE 6.0, on older versions they may be located
elsewhere). YaST installs the linker related stuff in /usr/X11R6/lib.
GnuCash won't find them there so you either edit GnuCash configure script
(then you're on your own) or you symlink the files like this:
ln -s /usr/X11R6/lib/libz.a /usr/lib
libpng.a
libjpg.a
swig1.1p5.tar.gz http://www.swig.org
readline-2.1-5.i386.rpm http://rufus.w3.org/linux/RPM/redhat/5.0/i386/readline-2.1-5.i386.html
nana-2.3.tar.gz http://www.cs.ntu.edu.au/homepages/pjm/nana-home/
These files can be obtained from their different locations. They compile and
install without any problems.
Then there was LessTif ...
To compile the Motif version of GnuCash, you will need LessTif, the freeware
clone of this GUI library. It's not the problem LessTif on the net, it's
rather the question of finding an *appropriate* version.
I had luck with the lesstif-0.86.0.tar.gz from
ftp.lesstif.org/pub/hungry/lesstif/srcdist/obsolete/ This one is stored
in a directory named "obsolete", but GnuCash or its components depend on
some calls which are kind of "gone" in later versions so you should
stick with this one. If you can get GnuCash running with any later LessTif
version, report this, so this file can be updated.
The file lesstif-0.86.0.tar.gz contains the source of lesstif which requires
several MBs of disk space to compile so don't forget "make clean" after
you installed it ;)
That's it! "configure; make motif" and GnuCash should be ready.
Have fun,
Sven Kuenzler <sk@xgm.de>

View File

@ -1,57 +0,0 @@
The main xacc web site is at http://www.cs.hmc.edu/~rclark/xacc/
This site holds development versions & other miscellania.
Current development alpha: xacc-1.1.3.tar.gz
-- DO NOT USE THIS CODE for production use.
It is very very broken. Use 1.0.17 instead.
Current production code: xacc-1.0.17.tar.gz
-- since 1.0.16 -- assorted core dump fixes
-- MS Money QIF import fixes
-- sco unixware & openserver build files
-- since 1.0.15 -- leap-year patch
-- debian build files
-- since 1.0b11 -- includes date sorting, QIF, Solaris patches
Binaries:
All binary distributions do *not* include source code,
except where otherwise noted.
xacc-1.0.17-linux-i386-bin.tar.gz
-- precompiled binary-only distribution, for Linux/Intel
-- contains version linked statically and dynamically w/ Motif
xacc_1.0.15-1_i386.deb
-- precompiled binary-only distribution, for Linux/Intel
-- use debian package manager to install
xacc-1.0.16-linux-ppc-bin.tar.gz
-- precompiled distribution, for Linux/PowerPC PowerMAC
-- contains dynamically linked lesstif version only
-- includes source code
xacc-1.0.16-ibm-aix415.exe
-- precompiled binary for IBM AIX 4.1.5
-- To install, chmod ugo+x xacc-1.0.16-ibm-aix.exe,
then run it, then use SMIT to complete installation.
-- For more info, see http://www.bull.de/pub/
xacc-1.0.16-sco-osr.vols.tar
-- precompiled binary-only for SCO OpenServer 5.0.4
-- dynamically linked motif version only
-- for more info, see
http://www.sco.com/skunkware/osr5/x11/apps/xacc/
xacc-1.0.16-sco-uw7.pkg.gz
-- precompiled binary-only for UnixWare 7
-- dynamically linked motif version only
-- use pkgadd to install
-- for more info, see
http://www.sco.com/skunkware/uw7/x11/apps/xacc/
xacc-1.0b7-sgi-irix.inst.tar
-- SGI-Irix distribution, in SGI install format
-- Warning: old, various important bugs fixed since then.

View File

@ -21,7 +21,7 @@
#include <errno.h>
#include "config.h"
#include "top-level.h"
#include "FileBox.h"
#include "FileDialog.h"
@ -105,10 +105,10 @@ static AccountGroup *topgroup = NULL; /* the current top of the heriarchy */
void
gncFileNew (void)
{
{
Session *sess;
AccountGroup *grp;
/* If user attempts to start a new session before saving
* results of the last one, prompt them to clean up thier
* act. */
@ -137,16 +137,16 @@ gncFileNew (void)
xaccLogEnable();
grp = xaccMallocAccountGroup();
topgroup = grp;
}
}
/* ======================================================== */
void
gncFileQuerySave (void)
{
{
Session *sess;
AccountGroup *grp;
sess = current_session;
grp = xaccSessionGetGroup (sess);
/* if session not yet started ... */
@ -159,29 +159,29 @@ gncFileQuerySave (void)
* instead, give them another chance to say "no" to the verify box.
*/
while ( xaccAccountGroupNotSaved (grp) )
{
{
if( gnc_verify_dialog( FMB_SAVE_MSG, GNC_T ) )
{
{
gncFileSave ();
}
else
return;
}
else
return;
}
}
/* ======================================================== */
/* private utilities for file open; done in two stages */
static void
gncPostFileOpen (const char * filename)
{
{
Session *newsess;
AccountGroup *oldgrp;
int io_error, uh_oh=0;
char buf[BUFSIZE];
AccountGroup *newgrp;
char * newfile;
if (!filename) return;
newfile = xaccResolveFilePath (filename);
if (!newfile) return;
@ -221,10 +221,10 @@ gncPostFileOpen (const char * filename)
uh_oh = 1;
}
}
/* going down -- abandon ship */
if (uh_oh)
{
{
xaccSessionEnd (newsess);
xaccSessionDestroy (newsess);
@ -235,12 +235,12 @@ gncPostFileOpen (const char * filename)
* because if user continues, then bad things will happen ...
*/
if (NULL == topgroup)
{
{
topgroup = xaccMallocAccountGroup();
}
}
free (newfile);
return;
}
}
/* if we got to here, then we've successfully gotten a new session */
/* close up the old file session (if any) */
@ -259,15 +259,15 @@ gncPostFileOpen (const char * filename)
xaccLogEnable();
free (newfile);
}
}
/* ======================================================== */
void
gncFileOpen (void)
{
{
char * newfile;
gncFileQuerySave ();
newfile = fileBox( OPEN_STR, "*.xac");
gncPostFileOpen (newfile);
@ -279,35 +279,42 @@ gncFileOpen (void)
* Don't leave thier ass in a sling, give them what they need.
*/
if (NULL == topgroup)
{
{
topgroup = xaccMallocAccountGroup();
}
}
}
void
gncFileOpenFile (const char * newfile)
{
{
if (!newfile) return;
gncFileQuerySave ();
gncPostFileOpen (newfile);
}
}
/* ======================================================== */
void
gncFileQIFImport (void)
{
{
char * newfile;
char buf[BUFSIZE];
int io_error, uh_oh = 0;
AccountGroup *newgrp;
gncUIWidget app;
app = gnc_get_ui_data();
newfile = fileBox(IMPORT_QIF_STR, "*.qif");
if (!newfile) return;
gnc_set_busy_cursor(app);
/* load the accounts from the file the user specified */
newgrp = xaccReadQIFAccountGroup (newfile);
gnc_unset_busy_cursor(app);
/* check for i/o error, put up appropriate error message */
io_error = xaccGetQIFIOError();
SHOW_IO_ERR_MSG(io_error);
@ -319,19 +326,23 @@ gncFileQIFImport (void)
topgroup = xaccMallocAccountGroup();
}
gnc_set_busy_cursor(app);
/* since quicken will not export all accounts
* into one file, we must merge them in one by one */
xaccConcatGroups (topgroup, newgrp);
xaccMergeAccounts (topgroup);
xaccConsolidateGrpTransactions (topgroup);
}
gnc_unset_busy_cursor(app);
}
/* ======================================================== */
static int been_here_before = 0;
void
gncFileSave (void)
{
{
AccountGroup *newgrp = NULL;
char * newfile;
char buf[BUFSIZE];
@ -342,10 +353,10 @@ gncFileSave (void)
* to save to. Get one now. */
if ((NULL == current_session) ||
(NULL == xaccSessionGetGroup (current_session)))
{
{
gncFileSaveAs();
return;
}
}
/* use the current session to save to file */
xaccSessionSave (current_session);
@ -354,13 +365,13 @@ gncFileSave (void)
* we're gonna check and handle ... */
norr = xaccSessionGetError (current_session);
if (norr)
{
{
if (been_here_before) return;
been_here_before = 1;
gncFileSaveAs(); /* been_here prevents infinite recuirsion */
been_here_before = 0;
return;
}
}
/* check for i/o error, put up appropriate error message */
io_error = xaccGetFileIOError();
@ -371,13 +382,13 @@ gncFileSave (void)
if (uh_oh) return;
xaccAccountGroupMarkSaved (topgroup);
}
}
/* ======================================================== */
void
gncFileSaveAs (void)
{
{
Session *newsess;
AccountGroup *oldgrp;
char * newfile;
@ -385,7 +396,7 @@ gncFileSaveAs (void)
char * oldfile;
char buf[BUFSIZE];
int io_error, uh_oh = 0;
newfile = fileBox( SAVE_STR, "*.xac");
if (!newfile) return;
@ -398,11 +409,11 @@ gncFileSaveAs (void)
assert (newfile); /* deep doodoo if resolve failed */
oldfile = xaccSessionGetFilePath (current_session);
if (oldfile && !strcmp (oldfile, newfile))
{
{
free (newfile);
gncFileSave ();
return;
}
}
/* -------------- BEGIN CORE SESSION CODE ------------- */
/* -- this code identical in FileOpen and FileSaveAs -- */
@ -432,7 +443,7 @@ gncFileSaveAs (void)
/* going down -- abandon ship */
if (uh_oh)
{
{
xaccSessionEnd (newsess);
xaccSessionDestroy (newsess);
@ -443,12 +454,12 @@ gncFileSaveAs (void)
* because if user continues, then bad things will happen ...
*/
if (NULL == topgroup)
{
{
topgroup = xaccMallocAccountGroup();
}
}
free (newfile);
return;
}
}
/* if we got to here, then we've successfully gotten a new session */
/* close up the old file session (if any) */
@ -459,7 +470,7 @@ gncFileSaveAs (void)
/* oops ... file already exists ... ask user what to do... */
if (newgrp)
{
{
char *tmpmsg;
tmpmsg = alloca (strlen (FMB_EEXIST_MSG) + strlen (newfile));
sprintf (tmpmsg, FMB_EEXIST_MSG, newfile);
@ -473,20 +484,20 @@ gncFileSaveAs (void)
xaccSessionSetGroup (newsess, NULL);
/* xaccLogDisable(); no don't disable, keep logging on */
xaccFreeAccountGroup (newgrp);
}
}
/* OK, save the data to the file ... */
xaccLogSetBaseName (newfile);
xaccSessionSetGroup (newsess, oldgrp);
gncFileSave ();
free (newfile);
}
}
/* ======================================================== */
void
gncFileQuit (void)
{
{
AccountGroup *grp;
grp = xaccSessionGetGroup (current_session);
@ -500,11 +511,10 @@ gncFileQuit (void)
xaccSessionEnd (current_session);
xaccSessionDestroy (current_session);
current_session = NULL;
// xaccGroupWindowDestroy (grp);
// xaccGroupWindowDestroy (grp);
xaccFreeAccountGroup (grp);
topgroup = NULL;
}
}
/* ======================================================== */

View File

@ -56,22 +56,22 @@
* Open two registers, showing each account. Change the amount in one window.
* Note that the other window also redraws, to show the new correct amount.
*
* Since you changed an amount value, potentially *all* displayed balances change
* in *both* register windows (as well as the ledger balance in the main window).
* Three or more windows may be involved if you have e.g. windows open for bank,
* employer, taxes and your entering a paycheck... (or correcting a typo in an
* old paycheck)... changing a date might even cause all entries in all three
* windows to be re-ordered.
*
* The only thing I can think of is a bit stored with every table entry, stating
* 'this entry has changed since lst time, redraw it'. But that still doesn't
* avoid the overhead of reloading the table from the engine.
*
* Since you changed an amount value, potentially *all* displayed
* balances change in *both* register windows (as well as the ledger
* balance in the main window). Three or more windows may be involved
* if you have e.g. windows open for bank, employer, taxes and your
* entering a paycheck (or correcting a typo in an old paycheck).
* Changing a date might even cause all entries in all three windows
* to be re-ordered.
*
* The only thing I can think of is a bit stored with every table
* entry, stating 'this entry has changed since lst time, redraw it'.
* But that still doesn't avoid the overhead of reloading the table
* from the engine.
*
*
* HISTORY:
* Copyright (c) 1998,1999 Linas Vepstas
*/
* Copyright (c) 1998-2000 Linas Vepstas */
/********************************************************************\
* This program is free software; you can redistribute it and/or *
@ -89,6 +89,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#define _GNU_SOURCE
#include <stdio.h>
#include <time.h>
@ -162,6 +164,9 @@ static short module = MOD_LEDGER;
/* The character used to separate accounts. */
static char account_separator = ':';
/* The reverse balance callback, if any. */
static SRReverseBalanceCallback reverse_balance = NULL;
/* static prototypes */
static Transaction * xaccSRGetTrans (SplitRegister *reg,
int phys_row, int phys_col);
@ -243,6 +248,13 @@ xaccSRSetAccountSeparator(char separator)
account_separator = separator;
}
void
xaccSRSetReverseBalanceCallback(SRReverseBalanceCallback callback)
{
reverse_balance = callback;
}
/* ======================================================== */
/* this callback gets called when the user clicks on the gui
* in such a way as to leave the current transaction, and to
@ -338,10 +350,6 @@ LedgerTraverse (Table *table,
void * client_data)
{
#ifdef GNOME
static const char *message =
"You have made changes to the current transaction.\n"
"Do you want to record your changes?";
SplitRegister *reg = client_data;
SRInfo *info = xaccSRGetInfo(reg);
Transaction *trans, *new_trans;
@ -381,7 +389,8 @@ LedgerTraverse (Table *table,
* changed. See what the user wants to do. */
result = gnc_verify_cancel_dialog_parented(xaccSRGetParent(reg),
message, GNC_VERIFY_YES);
TRANS_CHANGED_MSG,
GNC_VERIFY_YES);
switch (result)
{
@ -971,7 +980,8 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
}
if (MOD_DESC & changed) {
DEBUG ("xaccSRSaveRegEntry(): MOD_DESC: %s\n", reg->descCell->cell.value);
DEBUG ("xaccSRSaveRegEntry(): MOD_DESC: %s\n",
reg->descCell->cell.value);
xaccTransSetDescription (trans, reg->descCell->cell.value);
}
@ -981,12 +991,14 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
}
if (MOD_ACTN & changed) {
DEBUG ("xaccSRSaveRegEntry(): MOD_ACTN: %s\n", reg->actionCell->cell.value);
DEBUG ("xaccSRSaveRegEntry(): MOD_ACTN: %s\n",
reg->actionCell->cell.value);
xaccSplitSetAction (split, reg->actionCell->cell.value);
}
if (MOD_MEMO & changed) {
DEBUG ("xaccSRSaveRegEntry(): MOD_MEMO: %s\n", reg->memoCell->cell.value);
DEBUG ("xaccSRSaveRegEntry(): MOD_MEMO: %s\n",
reg->memoCell->cell.value);
xaccSplitSetMemo (split, reg->memoCell->cell.value);
}
@ -1000,7 +1012,9 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
*/
if (MOD_XFRM & changed) {
Account *old_acc=NULL, *new_acc=NULL;
DEBUG ("xaccSRSaveRegEntry(): MOD_XFRM: %s\n", reg->xfrmCell->cell.value);
DEBUG ("xaccSRSaveRegEntry(): MOD_XFRM: %s\n",
reg->xfrmCell->cell.value);
/* do some reparenting. Insertion into new account will automatically
* delete this split from the old account */
@ -1008,9 +1022,33 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
new_acc = xaccGetAccountByFullName (trans, reg->xfrmCell->cell.value,
account_separator);
if (old_acc != new_acc)
if ((new_acc != NULL) && (old_acc != new_acc))
{
xaccAccountInsertSplit (new_acc, split);
char *currency = NULL;
char *security = NULL;
currency = xaccAccountGetCurrency(new_acc);
currency = xaccTransIsCommonCurrency(trans, currency);
if (currency == NULL) {
security = xaccAccountGetSecurity(new_acc);
security = xaccTransIsCommonCurrency(trans, security);
}
if ((currency != NULL) || (security != NULL))
xaccAccountInsertSplit (new_acc, split);
else {
#ifdef GNOME
char *message = NULL;
asprintf(&message, REG_CURR_MSG, xaccAccountGetName(new_acc));
assert(message != NULL);
gnc_warning_dialog_parented(xaccSRGetParent(reg), message);
free(message);
#endif
}
/* make sure any open windows of the old account get redrawn */
gnc_account_ui_refresh(old_acc);
@ -1020,7 +1058,9 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
if (MOD_MXFRM & changed) {
Split *other_split = NULL;
DEBUG ("xaccSRSaveRegEntry(): MOD_MXFRM: %s\n", reg->mxfrmCell->cell.value);
DEBUG ("xaccSRSaveRegEntry(): MOD_MXFRM: %s\n",
reg->mxfrmCell->cell.value);
other_split = xaccGetOtherSplit(split);
@ -1039,10 +1079,13 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
if (!other_split) {
double amt = xaccSplitGetShareAmount (split);
double prc = xaccSplitGetSharePrice (split);
other_split = xaccMallocSplit ();
xaccSplitSetMemo (other_split, xaccSplitGetMemo (split));
xaccSplitSetAction (other_split, xaccSplitGetAction (split));
xaccSplitSetSharePriceAndAmount (other_split, prc, -amt);
xaccTransAppendSplit (trans, other_split);
}
}
@ -1056,9 +1099,32 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
new_acc = xaccGetAccountByFullName (trans, reg->mxfrmCell->cell.value,
account_separator);
if (old_acc != new_acc)
if ((new_acc != NULL) && (old_acc != new_acc))
{
xaccAccountInsertSplit (new_acc, other_split);
char *currency = NULL;
char *security = NULL;
currency = xaccAccountGetCurrency(new_acc);
currency = xaccTransIsCommonCurrency(trans, currency);
if (currency == NULL) {
security = xaccAccountGetSecurity(new_acc);
security = xaccTransIsCommonCurrency(trans, security);
}
if ((currency != NULL) || (security != NULL))
xaccAccountInsertSplit (new_acc, other_split);
else {
#ifdef GNOME
char *message = NULL;
asprintf(&message, REG_CURR_MSG, xaccAccountGetName(new_acc));
assert(message != NULL);
gnc_warning_dialog_parented(xaccSRGetParent(reg), message);
free(message);
#endif
}
/* make sure any open windows of the old account get redrawn */
gnc_account_ui_refresh(old_acc);
@ -1178,9 +1244,10 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
static void
xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
{
SRInfo *info = xaccSRGetInfo(reg);
int typo = reg->type & REG_TYPE_MASK;
char buff[2];
double baln;
int typo = reg->type & REG_TYPE_MASK;
/* don't even bother doing a load if there is no current cursor */
if (!(reg->table->current_cursor)) return;
@ -1217,25 +1284,33 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
xaccSetDateCellValueSecsL (reg->dateCell, secs);
xaccSetBasicCellValue (reg->numCell, xaccTransGetNum (trans));
xaccSetQuickFillCellValue (reg->descCell, xaccTransGetDescription (trans));
xaccSetQuickFillCellValue (reg->descCell,
xaccTransGetDescription (trans));
buff[0] = xaccSplitGetReconcile (split);
buff[1] = 0x0;
xaccSetBasicCellValue (reg->recnCell, buff);
/* For income and expense acounts, we have to reverse
* the meaning of balance, since, in a dual entry
* system, income will show up as a credit to a
* bank account, and a debit to the income account.
* Thus, positive and negative are interchanged */
/* If the reverse_balance callback is present use that.
* Otherwise, reverse income and expense by default. */
baln = xaccSplitGetBalance (split);
if ((INCOME_REGISTER == typo) ||
(EXPENSE_REGISTER == typo)) {
if (reverse_balance != NULL) {
Account *account;
account = xaccSplitGetAccount(split);
if (account == NULL)
account = info->default_source_account;
if (reverse_balance(account))
baln = -baln;
}
else if ((INCOME_REGISTER == typo) ||
(EXPENSE_REGISTER == typo)) {
baln = -baln;
}
xaccSetPriceCellValue (reg->balanceCell, baln);
xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split));
xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split));
xaccSetComboCellValue (reg->actionCell, xaccSplitGetAction (split));
@ -1264,22 +1339,22 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
* or more splits, or whether there is only one ... */
s = xaccTransGetSplit (xaccSplitGetParent(split), 1);
if (s) {
accname = SPLIT_STR; /* three or more .. */
accname = SPLIT_STR; /* three or more .. */
} else {
accname = ""; /* none ... */
accname = ""; /* none ... */
}
}
xaccSetComboCellValue (reg->mxfrmCell, accname);
if (need_to_free)
free(accname);
}
xaccSetQuickFillCellValue (reg->memoCell, xaccSplitGetMemo (split));
buff[0] = xaccSplitGetReconcile (split);
buff[1] = 0x0;
xaccSetBasicCellValue (reg->recnCell, buff);
if ((EQUITY_REGISTER == typo) ||
(STOCK_REGISTER == typo) ||
(CURRENCY_REGISTER == typo) ||
@ -1289,6 +1364,7 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
} else {
amt = xaccSplitGetValue (split);
}
xaccSetDebCredCellValue (reg->debitCell, reg->creditCell, amt);
xaccSetDebCredCellValue (reg->ndebitCell, reg->ncreditCell, -amt);
xaccSetPriceCellValue (reg->priceCell, xaccSplitGetSharePrice (split));
@ -1301,6 +1377,7 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
if (do_commit) {
xaccCommitCursor (reg->table);
}
LEAVE("SRLoadTransEntry():\n");
}

View File

@ -1,6 +1,6 @@
/********************************************************************\
* AccInfo.h -- the Account Info data structures *
* Copyright (C) 1998, 1999 Linas Vepstas *
* Copyright (C) 1998-2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -74,9 +74,10 @@ enum
*/
CURRENCY = 7,
/* The currency account type indicates that the account is a currency trading
* account. In many ways, a currency trading account is like a stock trading
* account, where both quantities and prices are set.
/* The currency account type indicates that the account is a
* currency trading account. In many ways, a currency trading
* account is like a stock trading account, where both quantities
* and prices are set.
*/
INCOME = 8,
@ -97,8 +98,6 @@ enum
SAVINGS = 12,
MONEYMRKT = 13,
CREDITLINE = 14, /* line of credit */
};
char * xaccAccountGetTypeStr (int type); /* GUI names */

View File

@ -1,7 +1,7 @@
/********************************************************************\
* Group.c -- the main data structure of the program *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1997, 1998 Linas Vepstas *
* Copyright (C) 1997-2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -38,7 +38,7 @@
/********************************************************************\
* Because I can't use C++ for this project, doesn't mean that I *
* can't pretend to! These functions perform actions on the *
* can't pretend to! These functions perform actions on the *
* AccountGroup data structure, in order to encapsulate the *
* knowledge of the internals of the AccountGroup in one file. *
\********************************************************************/
@ -47,7 +47,7 @@
\********************************************************************/
void
xaccInitializeAccountGroup (AccountGroup *grp)
{
{
grp->saved = GNC_T;
grp->parent = NULL;
@ -56,19 +56,19 @@ xaccInitializeAccountGroup (AccountGroup *grp)
grp->account[0] = NULL; /* null-terminated array */
grp->balance = 0.0;
}
}
/********************************************************************\
\********************************************************************/
AccountGroup *
xaccMallocAccountGroup( void )
{
{
AccountGroup *grp = (AccountGroup *)_malloc(sizeof(AccountGroup));
xaccInitializeAccountGroup (grp);
return grp;
}
}
/********************************************************************\
\********************************************************************/

View File

@ -104,7 +104,7 @@ int xaccGroupGetDepth (AccountGroup *grp);
*
* The xaccFillInAccounts() routine performs the same function as the
* above routine, except that it fills in the array provided by the
* user. The array provioded by the user *must* be large enough,
* user. The array provided by the user *must* be large enough,
* including a terminating NULL pointer.
*/
Account ** xaccGetAccounts (AccountGroup *grp);
@ -135,7 +135,7 @@ int xaccFillInAccounts ( AccountGroup *root, Account **arr );
* in the same AccountGroup anchor group. It returns NULL if the
* account was not found.
*
* The xaccGetPeerAccountFromFullName() subroute works like
* The xaccGetPeerAccountFromFullName() subroutine works like
* xaccGetPeerAccountFromName, but uses fully-qualified
* names using the given separator.
*/
@ -147,9 +147,9 @@ Account *xaccGetAccountFromFullName (AccountGroup *,
const char *name,
const char separator);
Account *xaccGetPeerAccountFromName (Account *, const char *);
Account * xaccGetPeerAccountFromFullName (Account *acc,
const char * name,
const char separator);
Account *xaccGetPeerAccountFromFullName (Account *acc,
const char * name,
const char separator);
/*
* The xaccRecomputeGroupBalance() subroutine recursively totals
@ -178,7 +178,7 @@ AccountGroup * xaccGetAccountRoot (Account *);
* duplicates may occur when accounts from multiple sources are
* merged. Note that this can be a dangerous operation to perform
*
* Note that this suborutine merely walks the acount group
* Note that this subroutine merely walks the account group
* tree, and calls ConsolidateTransacations on each account
*/
@ -203,8 +203,8 @@ Account * xaccGroupGetParentAccount (AccountGroup *);
* are blank. It uses the algorithm used in xaccAccountAutoCode()
* to pick an account code.
*
* The xaccGroupDepthAutoCode() first measures teh depth of the account
* tree, and uses that depth to pck the number of digits in the account
* The xaccGroupDepthAutoCode() first measures the depth of the account
* tree, and uses that depth to pick the number of digits in the account
* code.
*/
@ -247,7 +247,7 @@ void xaccGroupDepthAutoCode (AccountGroup *grp);
* FileIO.c.
*
* Note that currently, there is a hard limit of 256 stages, which
* can be changed by enlarging "marker" in the tranaction struct.
* can be changed by enlarging "marker" in the transaction struct.
* */
/* xaccGroupBeginStagedTransactionTraversals() resets the traversal

View File

@ -421,8 +421,6 @@ xaccParseQIFDate (char * str)
if (!str) return 0; /* If the string is null, we're done. */
fprintf(stderr, "1: %s\n", str);
/* First, figure out the delimiter. */
/* Choices: "." or "-" or "/" */
favechar = FindDateDelimiter(str);
@ -454,8 +452,6 @@ xaccParseQIFDate (char * str)
if (add_2k)
dat.tm_year += 2000;
fprintf(stderr, "2: %s\n", str);
TryToFixDate(&dat);
/* a quickie Y2K fix: assume two digit dates with

View File

@ -642,11 +642,11 @@ FindCommonCurrency (Split **slist, char * ra, char * rb)
if (!slist) return NULL;
if (rb && (0x0==rb[0])) rb = 0x0;
i=0; s = slist[0];
while (s) {
char *sa, *sb;
/* Novice/casual users may not want or use the double entry
* features of this engine. Because of this, there
* may be the occasional split without a parent account.
@ -658,7 +658,7 @@ FindCommonCurrency (Split **slist, char * ra, char * rb)
if (NULL == s->acc) {
i++; s=slist[i]; continue;
}
sa = s->acc->currency;
sb = s->acc->security;
if (sb && (0x0==sb[0])) sb = 0x0;
@ -816,7 +816,7 @@ xaccSplitRebalance (Split *split)
if (force_double_entry) {
if (! (DEQ (0.0, split->damount))) {
value = split->share_price * split->damount;
/* malloc a new split, mirror it to the source split */
s = xaccMallocSplit ();
s->damount = -value;
@ -824,7 +824,7 @@ xaccSplitRebalance (Split *split)
s->memo = strdup (split->memo);
free (s->action);
s->action = strdup (split->action);
/* insert the new split into the transaction and
* the same account as the source split */
MARK_SPLIT (s);
@ -837,7 +837,7 @@ xaccSplitRebalance (Split *split)
/* The indicated split is a destination split.
* Compute grand total of all destination splits,
* and force the source split to blanace.
* and force the source split to balance.
*/
s = trans->splits[0];
value = ComputeValue (trans->splits, s, base_currency);

View File

@ -56,7 +56,7 @@ typedef struct _split Split;
typedef struct _transaction Transaction;
/* struct timespec64 is just like timespec except that we use
* a 64-bit signed int to store the seconds. This should adequetely
* a 64-bit signed int to store the seconds. This should adequately
* cover dates in the distant future as well as the distant past, as long
* as they're not more than a couple dozen times the age of the universe.
* Note that both gcc and the IBM Toronto xlC compiler (aka CSet,
@ -119,7 +119,7 @@ void xaccTransDestroy (Transaction *);
* are made to a transaction or any of its component splits. If
* this is not done, errors will result. If the defer flag is set,
* then the automated re-balancing of all splits in this transaction
* is defered until the xaccTransCommitEdit() call. This allows
* is deferred until the xaccTransCommitEdit() call. This allows
* multiple splits to be edited, and prices fiddled with, and the whole
* system sent temporarily out of balance, up until the Commit
* call is made when double-entry is once again enforced.
@ -194,14 +194,14 @@ void xaccTransSetDocref (Transaction *, const char *);
/*
* The xaccTransAppendSplit() method will append the indicated
* split to the collection of splits in this transaction.
* If the split is alredy a part of another transaction,
* If the split is already a part of another transaction,
* it will be removed from that transaction first.
*/
void xaccTransAppendSplit (Transaction *, Split *);
/*
* The xaccSplitDestroy() method will update its parent account and
* transaction in a consistent maner, resulting in the complete
* transaction in a consistent manner, resulting in the complete
* unlinking of the split, and the freeing of its associated memory.
* The goal of this routine is to perform the removal and destruction
* of the split in an atomic fashion, with no chance of accidentally
@ -222,8 +222,8 @@ void xaccSplitDestroy (Split *);
/* The xaccTransGetSplit() method returns a pointer to each of the
* splits in this transaction. Valid values for i are zero to
* (number_of__splits-1). An invalid value of i will cause NULL to
* be returned. A conenient way of cycling through all splits is
* to start at zero, and kep incrementing until a null value is returned.
* be returned. A convenient way of cycling through all splits is
* to start at zero, and keep incrementing until a null value is returned.
*/
Split * xaccTransGetSplit (Transaction *trans, int i);
@ -256,7 +256,7 @@ gncBoolean xaccIsCommonCurrency(char *currency_1, char *security_1,
* indicating a currency denomination that all of the splits in this
* transaction have in common. This routine is useful in dealing
* with currency trading accounts and/or with "stock boxes", where
* securities of differing types are moved accross accounts.
* securities of differing types are moved across accounts.
* It returns NULL if the transaction is internally inconsistent.
* (This should never ??? happen, as it would be an internal error).
*
@ -271,7 +271,7 @@ char * xaccTransFindCommonCurrency (Transaction *trans);
* all the splits, otherwise, it returns NULL.
*
* Note that this routine is *not* merely a string compare on the
* value returned by cTransFindCommonCurrency(). This is because
* value returned by TransFindCommonCurrency(). This is because
* all of the splits in a transaction may share *both* a common
* currency and a common security. If the desired match is the
* security, a simple string match won't reveal this fact.
@ -279,7 +279,7 @@ char * xaccTransFindCommonCurrency (Transaction *trans);
* This routine is useful in dealing
* with currency trading accounts and/or with "stock boxes", where
* transaction have in common. This routine is useful in dealing
* securities of differing types are moved accross accounts.
* securities of differing types are moved across accounts.
*/
char * xaccTransIsCommonCurrency (Transaction *trans, char * currency);
@ -341,7 +341,7 @@ void xaccSplitGetDateReconciledTS (Split *, Timespec *);
* update the share price and the number of shares. This
* is a utility routine that is equivalent to a xaccSplitSetSharePrice()
* followed by and xaccSplitSetAmount(), except that it incurs the
* processing overhead of balancing only once, instead of twise.
* processing overhead of balancing only once, instead of twice.
*/
void xaccSplitSetSharePriceAndAmount (Split *, double price,

View File

@ -348,7 +348,7 @@ gnc_account_tree_refresh_all()
void
gnc_account_tree_set_view_info(GNCAccountTree *tree, AccountViewInfo *info)
{
assert(GTK_IS_GNC_ACCOUNT_TREE(tree));
assert(IS_GNC_ACCOUNT_TREE(tree));
assert(info != NULL);
tree->avi = *info;
@ -368,19 +368,32 @@ gnc_account_tree_set_view_info(GNCAccountTree *tree, AccountViewInfo *info)
void
gnc_account_tree_get_view_info(GNCAccountTree *tree, AccountViewInfo *info)
{
assert(GTK_IS_GNC_ACCOUNT_TREE(tree));
assert(IS_GNC_ACCOUNT_TREE(tree));
assert(info != NULL);
*info = tree->avi;
}
/********************************************************************\
* gnc_account_tree_expand_account *
* expand the account node *
* *
* Args: tree - the tree to expand an account for *
* accout - the account to expand *
* Returns: nothing *
\********************************************************************/
void
gnc_account_tree_expand_account(GNCAccountTree *tree, Account *account)
{
GtkCTree *ctree = GTK_CTREE(tree);
GtkCTree *ctree;
GtkCTreeNode *node;
g_return_if_fail(tree != NULL);
g_return_if_fail(IS_GNC_ACCOUNT_TREE(tree));
ctree = GTK_CTREE(tree);
/* Get the node with the account */
node = gtk_ctree_find_by_row_data(ctree, NULL, account);
if (node == NULL)
@ -390,6 +403,35 @@ gnc_account_tree_expand_account(GNCAccountTree *tree, Account *account)
}
/********************************************************************\
* gnc_account_tree_toggle_account_expansion *
* toggle the expansion status for the given account *
* *
* Args: tree - the tree to toggle expansion status for *
* accout - the account to toggle expansion status *
* Returns: nothing *
\********************************************************************/
void
gnc_account_tree_toggle_account_expansion (GNCAccountTree *tree,
Account *account)
{
GtkCTree *ctree;
GtkCTreeNode *node;
g_return_if_fail(tree != NULL);
g_return_if_fail(IS_GNC_ACCOUNT_TREE(tree));
ctree = GTK_CTREE(tree);
/* Get the node with the account */
node = gtk_ctree_find_by_row_data(ctree, NULL, account);
if (node == NULL)
return;
gtk_ctree_toggle_expansion(ctree, node);
}
/********************************************************************\
* gnc_account_tree_select_account *
* select an account in the tree and expands the tree to make *
@ -672,7 +714,7 @@ gnc_account_tree_set_filter(GNCAccountTree *tree,
gpointer user_data)
{
g_return_if_fail(tree != NULL);
g_return_if_fail(GTK_IS_GNC_ACCOUNT_TREE(tree));
g_return_if_fail(IS_GNC_ACCOUNT_TREE(tree));
tree->filter = filter;
tree->filter_data = user_data;

View File

@ -31,8 +31,8 @@ extern "C" {
#define GTK_TYPE_GNC_ACCOUNT_TREE (gnc_account_tree_get_type ())
#define GNC_ACCOUNT_TREE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_GNC_ACCOUNT_TREE, GNCAccountTree))
#define GNC_ACCOUNT_TREE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_GNC_ACCOUNT_TREE, GNCAccountTreeClass))
#define GTK_IS_GNC_ACCOUNT_TREE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_GNC_ACCOUNT_TREE))
#define GTK_IS_GNC_ACCOUNT_TREE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GNC_ACCOUNT_TREE))
#define IS_GNC_ACCOUNT_TREE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_GNC_ACCOUNT_TREE))
#define IS_GNC_ACCOUNT_TREE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GNC_ACCOUNT_TREE))
typedef struct _GNCAccountTree GNCAccountTree;
typedef struct _GNCAccountTreeClass GNCAccountTreeClass;
@ -112,6 +112,9 @@ gboolean gnc_account_tree_select_accounts(GNCAccountTree *tree,
void gnc_account_tree_expand_account (GNCAccountTree *tree,
Account *account);
void gnc_account_tree_toggle_account_expansion (GNCAccountTree *tree,
Account *account);
void gnc_account_tree_insert_account (GNCAccountTree *tree,
Account *account);

View File

@ -2,6 +2,7 @@
* cursor.c -- functions for changing cursors *
* *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1998-2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -52,13 +53,16 @@ gnc_ui_set_cursor (GdkWindow *win, int type)
gdk_window_set_cursor (win, cursor);
while (gtk_events_pending())
gtk_main_iteration();
if (type != GNC_CURSOR_NORMAL)
gdk_cursor_destroy(cursor);
}
/********************************************************************\
* gnc_set_busy_cursor *
* gnc_set_busy_cursor *
* sets the cursor to the busy watch *
* *
* Args: w - the widget over which to make cursor busy *
@ -73,7 +77,7 @@ gnc_set_busy_cursor(GtkWidget *w)
/********************************************************************\
* gnc_unset_busy_cursor *
* gnc_unset_busy_cursor *
* sets the cursor to the default cursor *
* *
* Args: w - the widget over which to make cursor normal *

View File

@ -2,6 +2,7 @@
* dialog-filebox.c -- the file dialog box *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1998-99 Rob Browning <rlb@cs.utexas.edu> *
* Copyright (C) 2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -78,13 +79,14 @@ fileBox(const char * title, const char * filter)
fb_info.file_box = GTK_FILE_SELECTION(gtk_file_selection_new(title));
fb_info.file_name = NULL;
/* hack alert - this was filtering directory names as well as file
* names, so I think we should not do this by default (rgmerk)
*/
/* hack alert - this was filtering directory names as well as file
* names, so I think we should not do this by default (rgmerk) */
#if 0
if (filter != NULL)
gtk_file_selection_complete(fb_info.file_box, filter);
#endif
gtk_window_set_modal(GTK_WINDOW(fb_info.file_box), TRUE);
gtk_window_set_transient_for(GTK_WINDOW(fb_info.file_box),
GTK_WINDOW(gnc_get_ui_data()));
@ -142,12 +144,16 @@ store_filename(GtkWidget *w, gpointer data)
static void
gnc_file_box_close_cb(GtkWidget *w, gpointer data)
{
gtk_widget_hide(GTK_WIDGET(fb_info.file_box));
gtk_main_quit();
}
static gboolean
gnc_file_box_delete_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
gtk_widget_hide(GTK_WIDGET(fb_info.file_box));
gtk_main_quit();
/* Don't delete the window, we'll handle things ourselves. */

View File

@ -283,6 +283,8 @@ gnc_option_get_ui_value(GNCOption *option)
if (selected)
result = gh_cons(gnc_option_permissible_value(option, row), result);
}
result = gh_reverse(result);
}
else if (safe_strcmp(type, "number-range") == 0)
{

View File

@ -1,7 +1,7 @@
/********************************************************************\
* dialog-utils.c -- utility functions for creating dialogs *
* for GnuCash *
* Copyright (C) 1999 Linas Vepstas *
* Copyright (C) 1999-2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -20,6 +20,7 @@
#include "top-level.h"
#include "gnome-top-level.h"
#include "account-tree.h"
#include "dialog-utils.h"
#include "global-options.h"
@ -27,7 +28,7 @@
#include "util.h"
/* This static indicates the debugging module that this .o belongs to. */
/* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_GUI;
@ -607,11 +608,8 @@ gnc_ui_get_account_full_balance(Account *account)
if (acc_children)
balance += xaccGroupGetBalance(acc_children);
/* the meaning of "balance" for income and expense
* accounts is reversed, since a deposit of a paycheck in a
* bank account will appear as a debit of the corresponding
* amount in the income account */
if ((type == EXPENSE) || (type == INCOME))
/* reverse sign if needed */
if (gnc_reverse_balance(account))
balance = -balance;
return balance;

View File

@ -0,0 +1,28 @@
/********************************************************************\
* top-level.h -- Gnome GUI main for GnuCash *
* Copyright (C) 2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
* *
\********************************************************************/
#ifndef __GNOME_TOP_LEVEL_H_
#define __GNOME_TOP_LEVEL_H_
#include "Account.h"
gncBoolean gnc_reverse_balance(Account *account);
#endif

View File

@ -356,7 +356,7 @@ gnc_info_dialog_parented(GtkWindow *parent, const char *message)
void
gnc_warning_dialog(const char *message)
{
gnc_warning_dialog_parented(GTK_WINDOW(gnc_get_ui_data()), message);
gnc_warning_dialog_parented(gnc_get_ui_data(), message);
}
/********************************************************************\
@ -368,11 +368,11 @@ gnc_warning_dialog(const char *message)
* Return: none *
\********************************************************************/
void
gnc_warning_dialog_parented(GtkWindow *parent, const char *message)
gnc_warning_dialog_parented(GtkWidget *parent, const char *message)
{
GtkWidget *warning_box = NULL;
warning_box = gnome_warning_dialog_parented(message, parent);
warning_box = gnome_warning_dialog_parented(message, GTK_WINDOW(parent));
gnome_dialog_run_and_close(GNOME_DIALOG(warning_box));
}

View File

@ -18,7 +18,6 @@ void gnc_info_dialog(const char *message);
void gnc_info_dialog_parented(GtkWindow *parent, const char *message);
void gnc_warning_dialog(const char *message);
void gnc_warning_dialog_parented(GtkWindow *parent, const char *message);
void gnc_error_dialog_parented(GtkWindow *parent, const char *message);

View File

@ -1,7 +1,7 @@
/********************************************************************\
* top-level.c -- Gnome GUI main for GnuCash *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1998 Linas Vepstas *
* Copyright (C) 1998-2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -25,6 +25,7 @@
#include <guile/gh.h>
#include <gnome.h>
#include "gnome-top-level.h"
#include "window-main.h"
#include "global-options.h"
#include "gnucash-sheet.h"
@ -60,6 +61,8 @@ static void gnc_configure_register_colors_cb(void *);
static void gnc_configure_register_colors(void);
static void gnc_configure_register_borders_cb(void *);
static void gnc_configure_register_borders(void);
static void gnc_configure_reverse_balance_cb(void *);
static void gnc_configure_reverse_balance(void);
/** GLOBALS *********************************************************/
/* This static indicates the debugging module that this .o belongs to. */
@ -76,25 +79,29 @@ static SCM currency_callback_id = SCM_UNDEFINED;
static SCM account_separator_callback_id = SCM_UNDEFINED;
static SCM register_colors_callback_id = SCM_UNDEFINED;
static SCM register_borders_callback_id = SCM_UNDEFINED;
static SCM reverse_balance_callback_id = SCM_UNDEFINED;
/* ============================================================== */
int
gnucash_ui_is_running() {
gnucash_ui_is_running()
{
return gnome_is_running;
}
/* ============================================================== */
int
gnucash_ui_is_terminating() {
gnucash_ui_is_terminating()
{
return gnome_is_terminating;
}
/* ============================================================== */
gncUIWidget
gnc_get_ui_data() {
gnc_get_ui_data()
{
return app;
}
@ -151,6 +158,11 @@ gnucash_ui_init()
gnc_register_option_change_callback(gnc_configure_register_borders_cb,
NULL, "Register", NULL);
gnc_configure_reverse_balance();
reverse_balance_callback_id =
gnc_register_option_change_callback(gnc_configure_reverse_balance_cb,
NULL, "General",
"Reversed-balance account types");
mainWindow();
@ -201,6 +213,7 @@ gnc_ui_destroy (void)
gnc_unregister_option_change_callback_id(account_separator_callback_id);
gnc_unregister_option_change_callback_id(register_colors_callback_id);
gnc_unregister_option_change_callback_id(register_borders_callback_id);
gnc_unregister_option_change_callback_id(reverse_balance_callback_id);
if (app != NULL)
{
@ -234,14 +247,14 @@ gnc_ui_main()
return 0;
}
/* hack alert -- all we do below is rename some functions ... fix this someday */
/* hack alert -- all we do below is rename some functions. fix this someday */
/* ============================================================== */
int
gnucash_ui_open_file(const char name[])
{
gncFileOpenFile(name);
return (1);
return 1;
}
/* ============================================================== */
@ -250,7 +263,7 @@ int
gnucash_ui_select_file()
{
gncFileOpen();
return (1);
return 1;
}
/* ============================================================== */
@ -258,7 +271,7 @@ gnucash_ui_select_file()
/* gnc_configure_date_format_cb
* Callback called when options change - sets dateFormat to the current
* value on the scheme side and refreshes register windows
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -272,7 +285,7 @@ gnc_configure_date_format_cb(void *data)
/* gnc_configure_date_format
* sets dateFormat to the current value on the scheme side
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -325,7 +338,7 @@ gnc_configure_date_format (void)
/* gnc_configure_date_format_cb
* Callback called when options change - sets default currency to
* the current value on the scheme side
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -338,7 +351,7 @@ gnc_configure_newacc_currency_cb(void *data)
/* gnc_configure_newacc_currency
* sets the default currency for new accounts to the
* current value on the scheme side
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -358,7 +371,7 @@ gnc_configure_newacc_currency(void)
/* gnc_configure_account_separator_cb
* Callback called when options change - sets account separator
* to the current value on the scheme side
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -372,7 +385,7 @@ gnc_configure_account_separator_cb(void *data)
/* gnc_configure_account_separator
* sets the accoutn separator to the
* current value on the scheme side
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -387,7 +400,7 @@ gnc_configure_account_separator(void)
/* gnc_configure_register_colors_cb
* Callback called when options change - sets
* register colors to their guile values
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -400,7 +413,7 @@ gnc_configure_register_colors_cb(void *data)
/* gnc_configure_register_colors_cb
* sets register colors to their guile values
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -476,7 +489,7 @@ gnc_configure_register_colors(void)
/* gnc_configure_register_borders_cb
* Callback called when options change - sets
* register borders to their guile values
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -487,9 +500,9 @@ gnc_configure_register_borders_cb(void *data)
gnc_group_ui_refresh(gncGetCurrentGroup());
}
/* gnc_configure_register_colors_cb
/* gnc_configure_register_border
* sets register borders to their guile values
*
*
* Args: Nothing
* Returns: Nothing
*/
@ -511,5 +524,83 @@ gnc_configure_register_borders(void)
gnucash_style_set_register_borders (reg_borders);
}
/* gnc_configure_reverse_balance_cb
* Callback called when options change - sets
* reverse balance info for the callback
*
* Args: Nothing
* Returns: Nothing
*/
static void
gnc_configure_reverse_balance_cb(void *not_used)
{
gnc_configure_reverse_balance();
gnc_group_ui_refresh(gncGetCurrentGroup());
gnc_refresh_main_window();
}
static gncBoolean reverse_type[NUM_ACCOUNT_TYPES];
gncBoolean
gnc_reverse_balance(Account *account)
{
int type;
if (account == NULL)
return GNC_F;
type = xaccAccountGetType(account);
if ((type < 0) || (type >= NUM_ACCOUNT_TYPES))
return GNC_F;
return reverse_type[type];
}
/* gnc_configure_reverse_balance
* sets reverse balance info for the callback
*
* Args: Nothing
* Returns: Nothing
*/
static void
gnc_configure_reverse_balance(void)
{
gchar *choice;
gint i;
xaccSRSetReverseBalanceCallback(gnc_reverse_balance);
for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
reverse_type[i] = GNC_F;
choice = gnc_lookup_multichoice_option("General",
"Reversed-balance account types",
"default");
if (safe_strcmp(choice, "default") == 0)
{
reverse_type[INCOME] = GNC_T;
reverse_type[EXPENSE] = GNC_T;
}
else if (safe_strcmp(choice, "credit") == 0)
{
reverse_type[LIABILITY] = GNC_T;
reverse_type[EQUITY] = GNC_T;
reverse_type[INCOME] = GNC_T;
}
else if (safe_strcmp(choice, "none") == 0)
{
}
else
{
PERR("gnc_configure_reverse_balance: bad value\n");
reverse_type[INCOME] = GNC_T;
reverse_type[EXPENSE] = GNC_T;
}
if (choice != NULL)
free(choice);
}
/****************** END OF FILE **********************/

View File

@ -3,6 +3,7 @@
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1998 Linas Vepstas *
* Copyright (C) 1999 Jeremy Collins ( gtk-xmhtml port ) *
* Copyright (C) 2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *

View File

@ -25,6 +25,7 @@
#include <guile/gh.h>
#include <string.h>
#include "gnome-top-level.h"
#include "AccWindow.h"
#include "AdjBWindow.h"
#include "global-options.h"
@ -69,6 +70,7 @@ gnc_ui_refresh_statusbar()
GNCMainInfo *main_info;
double assets = 0.0;
double profits = 0.0;
double amount;
AccountGroup *group;
AccountGroup *children;
Account *account;
@ -100,17 +102,28 @@ gnc_ui_refresh_statusbar()
case MUTUAL:
case CREDIT:
case LIABILITY:
assets += xaccAccountGetBalance(account);
amount = xaccAccountGetBalance(account);
if (children != NULL)
assets += xaccGroupGetBalance(children);
amount += xaccGroupGetBalance(children);
if (gnc_reverse_balance(account))
amount = -amount;
assets += amount;
break;
case INCOME:
case EXPENSE:
profits -= xaccAccountGetBalance(account); /* flip the sign !! */
amount = xaccAccountGetBalance(account);
if (children != NULL)
profits -= xaccGroupGetBalance(children); /* flip the sign !! */
amount += xaccGroupGetBalance(children);
if (gnc_reverse_balance(account))
amount = -amount;
profits += amount;
break;
case EQUITY:
case CURRENCY:
default:
break;
}
@ -462,6 +475,23 @@ gnc_account_tree_activate_cb(GNCAccountTree *tree,
gpointer user_data)
{
RegWindow *regData;
gboolean expand;
expand = gnc_lookup_boolean_option("Main Window",
"Double click expands parent accounts",
FALSE);
if (expand)
{
AccountGroup *group;
group = xaccAccountGetChildren(account);
if (xaccGroupGetNumAccounts(group) > 0)
{
gnc_account_tree_toggle_account_expansion(tree, account);
return;
}
}
regData = regWindowSimple(account);
gnc_register_raise(regData);

View File

@ -24,10 +24,6 @@
* Huntington Beach, CA 92648-4632 *
\********************************************************************/
/* hack alert -- much of the code in here should be chopped
* it is moving to the device-independent MultiLedger.c file
*/
#define _GNU_SOURCE
#include "top-level.h"

View File

@ -81,6 +81,13 @@
(define gnc:*load-path* #f)
(define gnc:*debugging?* (if (getenv "GNC_DEBUG") #t #f))
;; Function to get debugging
(define (gnc:debugging?)
(if (boolean? gnc:*debugging?*)
gnc:*debugging?*
(gnc:config-var-value-get gnc:*debugging?*)))
;;;; Status output functions.
(define (gnc:warn . items)
@ -99,14 +106,12 @@
(newline))
(define (gnc:debug . items)
(let ((debugging? (if (boolean? gnc:*debugging?*)
gnc:*debugging?*
(gnc:config-var-value-get gnc:*debugging?*))))
(if debugging?
(begin
(display "gnucash: [D] ")
(for-each (lambda (i) (write i)) items)
(newline)))))
(if (gnc:debugging?)
(begin
(display "gnucash: [D] ")
(for-each (lambda (i) (write i)) items)
(newline))))
;;; Set up gnc:load.

View File

@ -63,7 +63,9 @@
(gnc:add-extension export-item)
(gnc:add-extension qif-item))
;(gnc:hook-add-dangler gnc:*main-window-opened-hook* gnc:extensions-menu-setup)
(if (gnc:debugging?)
(gnc:hook-add-dangler gnc:*main-window-opened-hook*
gnc:extensions-menu-setup))
;; Automatically pick accelerators for menu names
(define (gnc:new-menu-namer)

View File

@ -69,12 +69,18 @@
;; Main Window options
(gnc:register-configuration-option
(gnc:make-simple-boolean-option
"Main Window" "Double click expands parent accounts"
"a" "Double clicking on an account with children expands \
the account instead of opening a register." #f))
(gnc:register-configuration-option
(gnc:make-list-option
"Main Window" "Account types to display"
"a" ""
(list 'equity 'expense 'income 'currency 'mutual
'stock 'liability 'asset 'credit 'cash 'bank)
"b" ""
(list 'bank 'cash 'credit 'asset 'liability 'stock
'mutual 'currency 'income 'expense 'equity)
(list #(bank "Bank" "")
#(cash "Cash" "")
#(credit "Credit" "")
@ -90,8 +96,8 @@
(gnc:register-configuration-option
(gnc:make-list-option
"Main Window" "Account fields to display"
"b" ""
(list 'balance 'description)
"c" ""
(list 'description 'balance)
(list #(type "Type" "")
#(code "Code" "")
#(description "Description" "")
@ -298,6 +304,15 @@
#(dash "- (Dash)" "Income-Salary-Taxable")
#(period ". (Period)" "Income.Salary.Taxable"))))
(gnc:register-configuration-option
(gnc:make-multichoice-option
"General" "Reversed-balance account types"
"d" "The types of accounts for which balances are sign-reversed"
'default
(list #(default "Income & Expense" "Reverse Income and Expense Accounts")
#(credit "Credit Accounts" "Reverse Liability, Equity, and Income Accounts")
#(none "None" "Don't reverse any accounts"))))
;; Configuation variables

View File

@ -43,6 +43,8 @@ gnc_verify_cancel_dialog_parented(gncUIWidget parent,
const char *message,
GNCVerifyResult default_result);
void gnc_warning_dialog_parented(gncUIWidget parent, const char *message);
gncBoolean gnc_verify_dialog( const char *message,
gncBoolean yes_is_default );
void gnc_error_dialog( const char *message );