mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
daves patches of Sun, 09 Jan 2000 03:18:52 -0800
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2000 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
0ac5892064
commit
c8c4ffa54e
143
ChangeLog
143
ChangeLog
@ -1,3 +1,146 @@
|
|||||||
|
2000-01-09 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* src/scm/prefs.scm: modified the account list option so
|
||||||
|
that it returns the default-getter value until explicitly
|
||||||
|
set.
|
||||||
|
|
||||||
|
2000-01-09 Robert Graham Merkel <rgmerk@mira.net>
|
||||||
|
|
||||||
|
* src/scm/report/transaction-report.scm: Added a pile of stuff,
|
||||||
|
should now produce a HTML formatted report containing basic info.
|
||||||
|
Unfortunately, crashes gtk-xmhtml at this stage.
|
||||||
|
|
||||||
|
2000-01-08 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* src/scm/bootstrap.scm.in: Added a check for slib.
|
||||||
|
|
||||||
|
2000-01-07 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* make-gnucash-patch: changed aclocal.m4 to lib/g-wrap/aclocal.m4
|
||||||
|
in the exclude list, so people can patch the main aclocal.m4 file.
|
||||||
|
|
||||||
|
2000-01-07 Jan Schrage <jan.schrage@urz.uni-heidelberg.de>
|
||||||
|
|
||||||
|
* configure.in: for --opt-style-install add $prefix/include
|
||||||
|
and $prefix/lib to $CPPFLAGS and $CFLAGS respectively to fix
|
||||||
|
broken check for nana.
|
||||||
|
|
||||||
|
2000-01-06 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* various and sundry: apply Laurent P{'e}lecq's i18n with gettext
|
||||||
|
patch. Move raw strings from gnome code into message database.
|
||||||
|
|
||||||
|
* src/gnome/window-report.c: modify for changes to window-html.
|
||||||
|
Make sure properties dialog callback only changes the window if
|
||||||
|
we are on that page.
|
||||||
|
|
||||||
|
* src/gnome/window-help.c: modify for the changes to window-html
|
||||||
|
|
||||||
|
* src/gnome/window-html.c: enhance window. Titles and buttons
|
||||||
|
are now associated with each history item, not the whole window.
|
||||||
|
|
||||||
|
* src/gnome/dialog-options.c: added support for account list
|
||||||
|
guile options.
|
||||||
|
|
||||||
|
2000-01-05 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* src/gnome/option-util.c: new functions for sending and receiving
|
||||||
|
lists of accounts to guile.
|
||||||
|
|
||||||
|
* src/gnome/account-tree.c: modified this widget so that
|
||||||
|
it keeps track of a list of selected accounts. Normal mode
|
||||||
|
is still single selection.
|
||||||
|
|
||||||
|
2000-01-04 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* src/gnome/dialog-add.c (gnc_ui_accWindow_list_select_cb):
|
||||||
|
prevent user from selecting illegal account types.
|
||||||
|
|
||||||
|
2000-01-02 Peter Pointner <peter@wuzel.m.isar.de>
|
||||||
|
|
||||||
|
* configure.in: disable qt build by default. --enable-qt enables it.
|
||||||
|
|
||||||
|
* Makefile.in: new targets qt.static and qt.disable
|
||||||
|
|
||||||
|
* make-gnucash-patch: exclude *.moc
|
||||||
|
|
||||||
|
* src/g-wrap/gnc.gwp (current-gnc-compile-flavor): add flavor qt.static
|
||||||
|
|
||||||
|
* src/qt/* and src/register/*-qt.*: assorted changes to make the
|
||||||
|
qt version compile.
|
||||||
|
|
||||||
|
2000-01-02 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* src/gnome/window-register.c: redid this window. Put style, sort
|
||||||
|
order, and date range into menu bar. Put toolbar under menu.
|
||||||
|
Added status bar at bottom.
|
||||||
|
|
||||||
|
* src/register/table-allgui.c (xaccVerifyCursorPosition): return
|
||||||
|
boolean indicating whether cursor was repositioned.
|
||||||
|
(wrapVerifyCursorPosition): use return value from above in
|
||||||
|
deciding whether to refresh UI.
|
||||||
|
|
||||||
|
* src/SplitLedger.c (xaccSRCancelCursorSplitChanges): move off of
|
||||||
|
an EXACT_ONLY cell, if on one.
|
||||||
|
|
||||||
|
2000-01-01 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* src/register/splitreg.h: uses ints, not shorts for values.
|
||||||
|
|
||||||
|
* src/SplitLedger.c (xaccSRLoadRegister): use the function below
|
||||||
|
to find the cell where to land on.
|
||||||
|
(xaccSRLoadRegister): fix a bug with auto mode to single/double
|
||||||
|
mode transition.
|
||||||
|
|
||||||
|
* src/register/table-allgui.c (gnc_table_find_valid_cell_horiz):
|
||||||
|
new function. Find a valid cell in the row, starting at the
|
||||||
|
given coordinates and fanning out.
|
||||||
|
|
||||||
|
* src/register/basiccell.h: add a new kind of io_flag.
|
||||||
|
XACC_CELL_ALLOW_EXACT_ONLY means a cell can only be entered
|
||||||
|
when the user specifically indicates that cell. Right now,
|
||||||
|
this means only a mouse pointer clicked on that cell. This
|
||||||
|
is used to prevent the reconcile cell from acting strangely.
|
||||||
|
|
||||||
|
* src/register/table-allgui.c (gnc_table_traverse_update): do left
|
||||||
|
traversals a little better.
|
||||||
|
|
||||||
|
* src/gnome/window-html.c (htmlKeyCB): handle keyboard horizontal
|
||||||
|
scrolling.
|
||||||
|
|
||||||
|
1999-12-31 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* Code cleanup with -Wall. Deleted unused variables. Added missing
|
||||||
|
#include's and missing function declarations.
|
||||||
|
|
||||||
|
* src/engine/QIFIO.c (FavorDateType): Christopher Browne's QIF
|
||||||
|
import patch.
|
||||||
|
|
||||||
|
* configure.in: Albert Chin-A-Young's patch to configure.in for
|
||||||
|
perl config.
|
||||||
|
|
||||||
|
* src/MultiLedger.c: nix xaccRegisterCountHack.
|
||||||
|
It is no longer needed.
|
||||||
|
|
||||||
|
* Docs/En/xacc-about.html: added contributors.
|
||||||
|
|
||||||
|
* make-gnucash-patch: new script. Make a patch for submission.
|
||||||
|
|
||||||
|
* README: added contributors. Added sections on gnucash
|
||||||
|
development and submitting patches.
|
||||||
|
|
||||||
|
1999-12-30 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
* src/SplitLedger.c (xaccSRGetCurrentTrans): Fix error messages.
|
||||||
|
|
||||||
|
1999-12-29 Peter Pointner <peter@wuzel.m.isar.de>
|
||||||
|
|
||||||
|
* src/motif/FileBox.c (closeBoxCB): reset fileName only if !done.
|
||||||
|
This fixes the FileBox problems with lesstiff 0.89.1, at least
|
||||||
|
for me.
|
||||||
|
|
||||||
|
* configure.in: change CPPFLAGS used to search for gtk-xmhtml
|
||||||
|
|
||||||
1999-12-26 Dave Peticolas <peticola@cs.ucdavis.edu>
|
1999-12-26 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
* src/gnome/window-report.c (reportWindow): Add a properties
|
* src/gnome/window-report.c (reportWindow): Add a properties
|
||||||
|
@ -103,7 +103,3 @@ dist:
|
|||||||
# Get dependencies (if existent).
|
# Get dependencies (if existent).
|
||||||
|
|
||||||
-include $(shell if [ -e obj ]; then find obj -name "*.d"; fi) ""
|
-include $(shell if [ -e obj ]; then find obj -name "*.d"; fi) ""
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width: 2
|
|
||||||
# End:
|
|
||||||
|
31
Makefile.in
31
Makefile.in
@ -41,6 +41,7 @@ default:
|
|||||||
@echo "gnome gnome/gtk version"
|
@echo "gnome gnome/gtk version"
|
||||||
@echo "gnome-static gnome/gtk statically linked version"
|
@echo "gnome-static gnome/gtk statically linked version"
|
||||||
@echo "qt kde/qt version"
|
@echo "qt kde/qt version"
|
||||||
|
@echo "qt-static kde/qt statically linked version"
|
||||||
@echo " "
|
@echo " "
|
||||||
|
|
||||||
# This inclusion must come after the first target, and after the
|
# This inclusion must come after the first target, and after the
|
||||||
@ -50,6 +51,7 @@ include @top_srcdir@/Makefile.common
|
|||||||
# Aliases
|
# Aliases
|
||||||
motif-static: motif.static
|
motif-static: motif.static
|
||||||
gnome-static: gnome.static
|
gnome-static: gnome.static
|
||||||
|
qt-static: qt.static
|
||||||
|
|
||||||
build-flavor: config.status
|
build-flavor: config.status
|
||||||
@cd lib; $(MAKE) ${FLAVOR}
|
@cd lib; $(MAKE) ${FLAVOR}
|
||||||
@ -82,8 +84,23 @@ gnome.disable:
|
|||||||
false
|
false
|
||||||
|
|
||||||
qt:
|
qt:
|
||||||
|
${MAKE} @QT_TARGET@
|
||||||
|
|
||||||
|
qt.static:
|
||||||
|
${MAKE} @QT_STATIC_TARGET@
|
||||||
|
|
||||||
|
qt.real:
|
||||||
${MAKE} FLAVOR=qt build-flavor
|
${MAKE} FLAVOR=qt build-flavor
|
||||||
|
|
||||||
|
qt.static.real:
|
||||||
|
${MAKE} FLAVOR=qt.static build-flavor
|
||||||
|
|
||||||
|
#QT_TARGET if qt build disabled by configure
|
||||||
|
|
||||||
|
qt.disable:
|
||||||
|
echo "Qt build disabled by configure. Try configure --enable-qt"
|
||||||
|
false
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
@echo make depend is now superfluous.
|
@echo make depend is now superfluous.
|
||||||
|
|
||||||
@ -98,12 +115,13 @@ config.status: configure
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLEAN_SUBDIRS += lib src
|
CLEAN_SUBDIRS += lib src po
|
||||||
TRASH += TAGS *~ *.o *.bak
|
TRASH += TAGS *~ *.o *.bak
|
||||||
|
|
||||||
DIST_TRASH += Makefile *~ *.o *.bak share/scm gnucash.bin
|
DIST_TRASH += Makefile *~ *.o *.bak share/scm gnucash.bin
|
||||||
DIST_TRASH += gnucash.motif gnucash.motif.static
|
DIST_TRASH += gnucash.motif gnucash.motif.static
|
||||||
DIST_TRASH += gnucash.gnome gnucash.gnome.static gnucash.qt gnucash-shell
|
DIST_TRASH += gnucash.gnome gnucash.gnome.static
|
||||||
|
DIST_TRASH += gnucash.qt gnucash.qt.static gnucash-shell
|
||||||
DIST_TRASH += config.cache config.log config.status config.h
|
DIST_TRASH += config.cache config.log config.status config.h
|
||||||
|
|
||||||
tagsfiles := $(shell find . -name "*.[ch]" -print)
|
tagsfiles := $(shell find . -name "*.[ch]" -print)
|
||||||
@ -120,6 +138,8 @@ install:
|
|||||||
|
|
||||||
# Put these in the opposite order of precedence. Final bin/gnucash link will
|
# Put these in the opposite order of precedence. Final bin/gnucash link will
|
||||||
# point to the last one that exists...
|
# point to the last one that exists...
|
||||||
|
-[ -e gnucash.qt.static ] && \
|
||||||
|
${MAKE} FLAVOR=qt.static GNC_BINDIR=${GNC_BINDIR} install-bin
|
||||||
-[ -e gnucash.qt ] && ${MAKE} FLAVOR=qt GNC_BINDIR=${GNC_BINDIR} install-bin
|
-[ -e gnucash.qt ] && ${MAKE} FLAVOR=qt GNC_BINDIR=${GNC_BINDIR} install-bin
|
||||||
-[ -e gnucash.gnome.static ] && \
|
-[ -e gnucash.gnome.static ] && \
|
||||||
${MAKE} FLAVOR=gnome.static GNC_BINDIR=${GNC_BINDIR} install-bin
|
${MAKE} FLAVOR=gnome.static GNC_BINDIR=${GNC_BINDIR} install-bin
|
||||||
@ -134,7 +154,8 @@ install:
|
|||||||
-e ${GNC_BINDIR}/gnucash.motif.static -o \
|
-e ${GNC_BINDIR}/gnucash.motif.static -o \
|
||||||
-e ${GNC_BINDIR}/gnucash.gnome -o \
|
-e ${GNC_BINDIR}/gnucash.gnome -o \
|
||||||
-e ${GNC_BINDIR}/gnucash.gnome.static -o \
|
-e ${GNC_BINDIR}/gnucash.gnome.static -o \
|
||||||
-e ${GNC_BINDIR}/gnucash.qt \
|
-e ${GNC_BINDIR}/gnucash.qt -o \
|
||||||
|
-e ${GNC_BINDIR}/gnucash.qt.static \
|
||||||
]
|
]
|
||||||
$(INSTALL) src/quotes/gnc-prices ${GNC_BINDIR}
|
$(INSTALL) src/quotes/gnc-prices ${GNC_BINDIR}
|
||||||
|
|
||||||
@ -202,6 +223,8 @@ install:
|
|||||||
|
|
||||||
$(INSTALL_DATA) etc/conf* ${GNC_SHAREDIR}
|
$(INSTALL_DATA) etc/conf* ${GNC_SHAREDIR}
|
||||||
|
|
||||||
|
$(MAKE) -C po install
|
||||||
|
|
||||||
# # Config directory
|
# # Config directory
|
||||||
# @mkdir -p ${GNC_CONFIGDIR}
|
# @mkdir -p ${GNC_CONFIGDIR}
|
||||||
#
|
#
|
||||||
@ -218,5 +241,5 @@ install:
|
|||||||
# done
|
# done
|
||||||
|
|
||||||
.PHONY: default install-private install
|
.PHONY: default install-private install
|
||||||
.PHONY: motif motif-static motif.static gnome gnome-static gnome.static qt
|
.PHONY: motif motif-static motif.static gnome gnome-static gnome.static qt qt.static
|
||||||
.PHONY: depend dist clean distclean
|
.PHONY: depend dist clean distclean
|
||||||
|
98
README
98
README
@ -4,7 +4,7 @@
|
|||||||
The version 1.3.x series of GnuCash are experimental development
|
The version 1.3.x series of GnuCash are experimental development
|
||||||
releases. They may or may not work. Use at your own risk.
|
releases. They may or may not work. Use at your own risk.
|
||||||
|
|
||||||
The last stable, production version was gnucash-1.2.0
|
The last stable, production version was gnucash-1.2.5
|
||||||
The next stable, production version will be gnucash-1.4.x
|
The next stable, production version will be gnucash-1.4.x
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
@ -90,6 +90,7 @@ ftp://ftp.ultra.net/pub/eugene/RPMS/i386/
|
|||||||
Development versions:
|
Development versions:
|
||||||
http://linas.org/linux/gnucash/
|
http://linas.org/linux/gnucash/
|
||||||
|
|
||||||
|
|
||||||
Running:
|
Running:
|
||||||
--------
|
--------
|
||||||
Only the Motif version of GnuCash is currently functional. The Gnome version
|
Only the Motif version of GnuCash is currently functional. The Gnome version
|
||||||
@ -122,7 +123,7 @@ Motif or Lesstif --
|
|||||||
Lesstif 0.86.9 works ... but some menus come out 2 pixels high.(?)
|
Lesstif 0.86.9 works ... but some menus come out 2 pixels high.(?)
|
||||||
Lesstif 0.87.0: broken (missing symbols for XmeDrawShadows, etc.)
|
Lesstif 0.87.0: broken (missing symbols for XmeDrawShadows, etc.)
|
||||||
Lesstif 0.88.1 works
|
Lesstif 0.88.1 works
|
||||||
Lesstif 0.89.0 broken (FileSelectionDialog in src/motif/FileBox.c broken)
|
Lesstif 0.89.0 works?
|
||||||
|
|
||||||
XmHTML -- Provides HTML display capabilities. Used for Help Dialogues, Reports.
|
XmHTML -- Provides HTML display capabilities. Used for Help Dialogues, Reports.
|
||||||
Require version 1.1.4 or later
|
Require version 1.1.4 or later
|
||||||
@ -137,6 +138,8 @@ XmHTML -- Provides HTML display capabilities. Used for Help Dialogues, Reports.
|
|||||||
solutions; the simplest is probably to download the XmHTML source
|
solutions; the simplest is probably to download the XmHTML source
|
||||||
package and compile it yourself.
|
package and compile it yourself.
|
||||||
|
|
||||||
|
slib -- scheme libraries for guile. Need version slib2c6 or later.
|
||||||
|
|
||||||
libpng -- portable network graphics library. Any version.
|
libpng -- portable network graphics library. Any version.
|
||||||
libjpeg -- JPEG image handling library. Any version.
|
libjpeg -- JPEG image handling library. Any version.
|
||||||
libz -- compression library. Any version.
|
libz -- compression library. Any version.
|
||||||
@ -166,7 +169,6 @@ perl-HTML/HTML-Parser-2.20
|
|||||||
http://www.cpan.org/CPAN.html
|
http://www.cpan.org/CPAN.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Invocation:
|
Invocation:
|
||||||
-----------
|
-----------
|
||||||
You can start GnuCash at the command-line, with "gnucash" or "gnucash
|
You can start GnuCash at the command-line, with "gnucash" or "gnucash
|
||||||
@ -212,6 +214,7 @@ at http://www.zeta.org.au/~grahamc/xacc_rpts.html.
|
|||||||
A tool to cleanup & import Quicken files can be found at (insert the url
|
A tool to cleanup & import Quicken files can be found at (insert the url
|
||||||
here).
|
here).
|
||||||
|
|
||||||
|
|
||||||
Building & Installing:
|
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.
|
||||||
@ -377,6 +380,86 @@ tree do a
|
|||||||
cvs -z3 -Pd :pserver:cvs@cvs.gnucash.org:/home/cvs/cvsroot checkout -rxacc-12-patch gnucash
|
cvs -z3 -Pd :pserver:cvs@cvs.gnucash.org:/home/cvs/cvsroot checkout -rxacc-12-patch gnucash
|
||||||
|
|
||||||
|
|
||||||
|
Developing GnuCash
|
||||||
|
------------------
|
||||||
|
Before you start developing GnuCash, you should do the following:
|
||||||
|
|
||||||
|
1. Read the file src/coding-style.txt to learn about the coding-styles
|
||||||
|
used in the GnuCash source code.
|
||||||
|
|
||||||
|
2. Several of the directories under src contain files called design.txt
|
||||||
|
which explain many aspects of GnuCash's design. Read those.
|
||||||
|
|
||||||
|
3. Go to the gnucash website and skim the archives of the gnucash
|
||||||
|
development mailing list.
|
||||||
|
|
||||||
|
4. Join the GnuCash development mailing list. See the gnucash website
|
||||||
|
for details on how to do this.
|
||||||
|
|
||||||
|
|
||||||
|
Submitting a Patch
|
||||||
|
------------------
|
||||||
|
Once you have done some work that you would like to submit, you need
|
||||||
|
to send a patch. There is a perl script called make-gnucash-patch
|
||||||
|
provided with the distribution that you can use to create the
|
||||||
|
patch. Here is how to use that perl script.
|
||||||
|
|
||||||
|
First, set up your development directories as follows:
|
||||||
|
|
||||||
|
< GnuCash home development directory >
|
||||||
|
|
|
||||||
|
|---- < directory containing original GnuCash sources >
|
||||||
|
|
|
||||||
|
|---- < directory containing your modified GnuCash sources >
|
||||||
|
|
||||||
|
A concrete example of those directories might be:
|
||||||
|
|
||||||
|
/home/me/gnucash
|
||||||
|
|
|
||||||
|
|---- /home/me/gnucash/gnucash.pristine (original sources)
|
||||||
|
|
|
||||||
|
|---- /home/me/gnucash/gnucash.mywork (original sources + my edits)
|
||||||
|
|
||||||
|
Copy the make-gnucash-patch script to the home development directory
|
||||||
|
(/home/me/gnucash above). Now edit three variables at the top of that
|
||||||
|
file to reflect the names of your directories. Given the names above,
|
||||||
|
you would use
|
||||||
|
|
||||||
|
my $old = 'gnucash.pristine';
|
||||||
|
my $new = 'gnucash.mywork';
|
||||||
|
my $gnc_home = '/home/me/gnucash';
|
||||||
|
|
||||||
|
Now run the script. Note that this script requires the programs
|
||||||
|
'makepatch', 'gzip', 'diff', and 'uuencode' (and, of course, 'perl')
|
||||||
|
to run.
|
||||||
|
|
||||||
|
When you run the script, three files will be generated:
|
||||||
|
|
||||||
|
gnc.diff - This file is an ascii text file containing the differences
|
||||||
|
between the original sources and your edits. At the bottom
|
||||||
|
of this file is a list of the files which were added,
|
||||||
|
changed, or deleted.
|
||||||
|
|
||||||
|
Please examine this file (especially the list at the bottom)
|
||||||
|
to make sure that all of your changes (and no other changes)
|
||||||
|
are present in the file.
|
||||||
|
|
||||||
|
Do not submit this file!
|
||||||
|
|
||||||
|
gnucash.diff.gz - This is a gzipped version of the above file.
|
||||||
|
|
||||||
|
Do not submit this file!
|
||||||
|
|
||||||
|
gnucash.diff.gz.uue - This is a uuencoded (ascii-encoded) version
|
||||||
|
of the above file.
|
||||||
|
|
||||||
|
This is the file you submit.
|
||||||
|
|
||||||
|
Send gnucash.diff.gz.uue to gnucash-patches@gnucash.org
|
||||||
|
|
||||||
|
Thanks in advance for your contribution!
|
||||||
|
|
||||||
|
|
||||||
Main Developers:
|
Main Developers:
|
||||||
----------------
|
----------------
|
||||||
Robin Clark <rclark@hmc.edu> wrote the original X-Accountant in Motif
|
Robin Clark <rclark@hmc.edu> wrote the original X-Accountant in Motif
|
||||||
@ -414,6 +497,7 @@ Per Bojsen <bojsen@worldnet.att.net> several core dump fixes
|
|||||||
Christopher B. Browne <cbbrowne@hex.net> for perl, scheme scripts
|
Christopher B. Browne <cbbrowne@hex.net> for perl, scheme scripts
|
||||||
Graham Chapman <grahamc@zeta.org.au> for the xacc-rpts addon package
|
Graham Chapman <grahamc@zeta.org.au> for the xacc-rpts addon package
|
||||||
George Chen <georgec@sco.com> for MS-Money QIF's & fixes
|
George Chen <georgec@sco.com> for MS-Money QIF's & fixes
|
||||||
|
Albert Chin-A-Young <china@thewrittenword.com> configure.in patch
|
||||||
Jeremey Collins <jcollins@gnucash.org> for GnoMoney & GTK port
|
Jeremey Collins <jcollins@gnucash.org> for GnoMoney & GTK port
|
||||||
Patrick Condron <pcondon@rackspace.com> for webserver and T1 connection.
|
Patrick Condron <pcondon@rackspace.com> for webserver and T1 connection.
|
||||||
Ciaran Deignan <Ciaran.Deignan@bull.net> for AIX binary version
|
Ciaran Deignan <Ciaran.Deignan@bull.net> for AIX binary version
|
||||||
@ -433,22 +517,26 @@ Sven Kuenzler <sk@xgm.de> for SuSE README file
|
|||||||
Graham Leggett <minfrin@sharp.fm> for fixing a hang
|
Graham Leggett <minfrin@sharp.fm> for fixing a hang
|
||||||
Ted Lemon <mellon@andare.fugue.com> for NetBSD port
|
Ted Lemon <mellon@andare.fugue.com> for NetBSD port
|
||||||
Yannick Le Ny <y-le-ny@ifrance.com> pour la traduction en francais
|
Yannick Le Ny <y-le-ny@ifrance.com> pour la traduction en francais
|
||||||
Heath Martin <martinh@pegasus.cc.ucf.edu> for extensive gtk fixes
|
Grant Likely <glikely@nortelnetworks.com> gnome and engine patches
|
||||||
|
Heath Martin <martinh@pegasus.cc.ucf.edu> gnome and register patches
|
||||||
|
Robert Graham Merkel <rgmerk@mira.net> reporting, gnome, and config patches.
|
||||||
Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu> port to alpha-dec-osf4.0f
|
Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu> port to alpha-dec-osf4.0f
|
||||||
G. Allen Morris III <gam3@ann.softgams.com> for QIF core dump
|
G. Allen Morris III <gam3@ann.softgams.com> for QIF core dump
|
||||||
Peter Norton <spacey@inch.com> for a valiant attempt at a GTK port
|
Peter Norton <spacey@inch.com> for a valiant attempt at a GTK port
|
||||||
OmNiBuS <webmaster@obsidian.uia.net> web site graphics & content
|
OmNiBuS <webmaster@obsidian.uia.net> web site graphics & content
|
||||||
Myroslav Opyr <mopyr@IPM.Lviv.UA> for misc patches
|
Myroslav Opyr <mopyr@IPM.Lviv.UA> for misc patches
|
||||||
Dave Peticolas <peticola@morpheus.cs.ucdavis.edu> extensive intelligent patches
|
Dave Peticolas <peticola@morpheus.cs.ucdavis.edu> extensive intelligent patches
|
||||||
|
Laurent P{'e}lecq <laurent.pelecq@wanadoo.fr> i18n patches with gettext
|
||||||
Alain Peyrat <Alain.Peyrat@nmu.alcatel.fr> for configure.in patches
|
Alain Peyrat <Alain.Peyrat@nmu.alcatel.fr> for configure.in patches
|
||||||
Peter Pointner <peter@wuzel.m.isar.de> QIF import fixes, Qt patches
|
Peter Pointner <peter@wuzel.m.isar.de> QIF import fixes, Qt patches
|
||||||
Gavin Porter <maufk@csv.warwick.ac.uk> for euro style dates
|
Gavin Porter <maufk@csv.warwick.ac.uk> for euro style dates
|
||||||
Ron Record <rr@sco.com> for SCO Unixware & OpenServer binaries
|
Ron Record <rr@sco.com> for SCO Unixware & OpenServer binaries
|
||||||
|
Jan Schrage <jan.schrage@urz.uni-heidelberg.de> documentation patches
|
||||||
Christopher Seawood <cls@seawood.org> for XbaeMatrix core dump
|
Christopher Seawood <cls@seawood.org> for XbaeMatrix core dump
|
||||||
Mike Simons <msimons@fsimons01.erols.com> misc configure.in patches
|
Mike Simons <msimons@fsimons01.erols.com> misc configure.in patches
|
||||||
Richard Skelton <rich@brake.demon.co.uk> for Solaris cleanup
|
Richard Skelton <rich@brake.demon.co.uk> for Solaris cleanup
|
||||||
Henning Spruth <spruth@bigfoot.com> for German text & euro date rework
|
Henning Spruth <spruth@bigfoot.com> for German text & euro date rework
|
||||||
|
Rob Walker <rob@valinux.com> guile and register patches
|
||||||
Ken Yamaguchi <gooch@ic.EECS.Berkeley.EDU> QIF import fixes; MYM import
|
Ken Yamaguchi <gooch@ic.EECS.Berkeley.EDU> QIF import fixes; MYM import
|
||||||
|
|
||||||
... and I am sure that I have missed many others ...
|
... and I am sure that I have missed many others ...
|
||||||
|
|
||||||
|
95
README.SuSE-6.3
Normal file
95
README.SuSE-6.3
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
How to install gnucash-1.2.5 on SuSE-6.3
|
||||||
|
========================================
|
||||||
|
(written 2000-01-07 by Peter Pointner <peter@wuzel.m.isar.de>)
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- This is only one way to get GnuCash running on SuSE 6.3. I did test
|
||||||
|
that, but there might be errors anyway, and of course you do all at
|
||||||
|
your own risk. If you find errors, you might report them to the
|
||||||
|
gnucash mailing list (gnucash-devel@gnucash.org)
|
||||||
|
|
||||||
|
- This is definitely for SuSE 6.3 (Intel). Earlier SuSE distributions
|
||||||
|
lack some required packages. Later SuSE distributions didn't exist
|
||||||
|
at the time of writing.
|
||||||
|
|
||||||
|
Let's go:
|
||||||
|
|
||||||
|
* Make sure you have a running system, including X. For my tests I
|
||||||
|
started with a default installation and removed some packages to
|
||||||
|
save diskspace.
|
||||||
|
|
||||||
|
* Install the following packages:
|
||||||
|
+ from series d
|
||||||
|
eperl guile nana swig xmhtml xmhtmld
|
||||||
|
and optionally
|
||||||
|
autoconf automake libtool
|
||||||
|
(You must install libtool if you have autoconf/automake
|
||||||
|
installed!)
|
||||||
|
+ from series x
|
||||||
|
xdevel
|
||||||
|
+ from series xdev
|
||||||
|
lesstiff lesstifd
|
||||||
|
|
||||||
|
* Download slib from
|
||||||
|
ftp://ftp.gnu.org/pub/gnu/jacal/slib2c7.zip
|
||||||
|
and install it by unpacking it to /usr/share/guile (this will
|
||||||
|
create a sub-directory slib):
|
||||||
|
cd /usr/share/guile
|
||||||
|
su root -c "unzip -L /tmp/slib2c7"
|
||||||
|
|
||||||
|
* Download GnuCash from
|
||||||
|
http://www.gnucash.org/pub/gnucash/sources/stable/gnucash-1.2.5.tar.gz
|
||||||
|
and unpack it
|
||||||
|
tar xzf gnucash-1.2.5.tar.gz
|
||||||
|
|
||||||
|
* Now apply the patch at the end of this file. The first hunk will
|
||||||
|
make the file selection box work with lesstiff-0.89.1, the version
|
||||||
|
which comes with SuSE 6.3. It should not hurt with other versions.
|
||||||
|
The second hunk changes a hardcoded path to match the default
|
||||||
|
installation prefix. This change stops gnucash from crashing when
|
||||||
|
showing a report. You can apply this patch by something like
|
||||||
|
cd gnucash-1.2.5
|
||||||
|
patch -p1 < ../README-SuSE-6.3
|
||||||
|
|
||||||
|
* Configure, build and install gnucash. Installation must probably be
|
||||||
|
done as root, the files go to various places in /usr/local.
|
||||||
|
|
||||||
|
cd gnucash-1.2.5
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
su root -c "make install"
|
||||||
|
|
||||||
|
|
||||||
|
=================== patch follows ========================
|
||||||
|
|
||||||
|
diff -ru gnucash-1.2.5/src/motif/FileBox.c gnucash-1.2.5.patched/src/motif/File
|
||||||
|
Box.c
|
||||||
|
--- gnucash-1.2.5/src/motif/FileBox.c Mon Oct 18 06:18:29 1999
|
||||||
|
+++ gnucash-1.2.5.patched/src/motif/FileBox.c Fri Jan 7 22:25:17 2000
|
||||||
|
@@ -208,8 +208,10 @@
|
||||||
|
{
|
||||||
|
char **fileName = (char **)cd;
|
||||||
|
ENTER("closeBoxCB");
|
||||||
|
- *fileName = NULL;
|
||||||
|
- done = True;
|
||||||
|
+ if (! done) {
|
||||||
|
+ *fileName = NULL;
|
||||||
|
+ done = True;
|
||||||
|
+ }
|
||||||
|
LEAVE("closeBoxCB");
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -ru gnucash-1.2.5/src/reports/Sheet.c gnucash-1.2.5.patched/src/reports/Sh
|
||||||
|
eet.c
|
||||||
|
--- gnucash-1.2.5/src/reports/Sheet.c Tue Jul 6 08:44:52 1999
|
||||||
|
+++ gnucash-1.2.5.patched/src/reports/Sheet.c Fri Jan 7 22:40:35 2000
|
||||||
|
@@ -235,7 +235,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
/* hack afreakin lert -- this path should not be hard-coded ... */
|
||||||
|
- fullpath = strdup ("/usr/lib/gnucash/");
|
||||||
|
+ fullpath = strdup ("/usr/local/lib/gnucash/");
|
||||||
|
|
||||||
|
fprintf (to_perl,
|
||||||
|
"<: \n"
|
438
aclocal.m4
vendored
438
aclocal.m4
vendored
@ -48,3 +48,441 @@ ifelse([$4], , , [$4
|
|||||||
])dnl
|
])dnl
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
# Search path for a program which passes the given test.
|
||||||
|
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
#
|
||||||
|
# This file can be copied and used freely without restrictions. It can
|
||||||
|
# be used in projects which are not available under the GNU Public License
|
||||||
|
# but which still want to provide support for the GNU gettext functionality.
|
||||||
|
# Please note that the actual code is *not* freely available.
|
||||||
|
|
||||||
|
# serial 1
|
||||||
|
|
||||||
|
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||||
|
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||||
|
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||||
|
[# Extract the first word of "$2", so it can be a program name with args.
|
||||||
|
set dummy $2; ac_word=[$]2
|
||||||
|
AC_MSG_CHECKING([for $ac_word])
|
||||||
|
AC_CACHE_VAL(ac_cv_path_$1,
|
||||||
|
[case "[$]$1" in
|
||||||
|
/*)
|
||||||
|
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||||
|
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||||
|
test -z "$ac_dir" && ac_dir=.
|
||||||
|
if test -f $ac_dir/$ac_word; then
|
||||||
|
if [$3]; then
|
||||||
|
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS="$ac_save_ifs"
|
||||||
|
dnl If no 4th arg is given, leave the cache variable unset,
|
||||||
|
dnl so AC_PATH_PROGS will keep looking.
|
||||||
|
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||||
|
])dnl
|
||||||
|
;;
|
||||||
|
esac])dnl
|
||||||
|
$1="$ac_cv_path_$1"
|
||||||
|
if test -n "[$]$1"; then
|
||||||
|
AC_MSG_RESULT([$]$1)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
AC_SUBST($1)dnl
|
||||||
|
])
|
||||||
|
# Macro to add for using GNU gettext.
|
||||||
|
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||||
|
#
|
||||||
|
# This file can be copied and used freely without restrictions. It can
|
||||||
|
# be used in projects which are not available under the GNU Public License
|
||||||
|
# but which still want to provide support for the GNU gettext functionality.
|
||||||
|
# Please note that the actual code is *not* freely available.
|
||||||
|
|
||||||
|
# serial 5
|
||||||
|
|
||||||
|
AC_DEFUN(AM_WITH_NLS,
|
||||||
|
[AC_MSG_CHECKING([whether NLS is requested])
|
||||||
|
dnl Default is enabled NLS
|
||||||
|
AC_ARG_ENABLE(nls,
|
||||||
|
[ --disable-nls do not use Native Language Support],
|
||||||
|
USE_NLS=$enableval, USE_NLS=yes)
|
||||||
|
AC_MSG_RESULT($USE_NLS)
|
||||||
|
AC_SUBST(USE_NLS)
|
||||||
|
|
||||||
|
USE_INCLUDED_LIBINTL=no
|
||||||
|
|
||||||
|
dnl If we use NLS figure out what method
|
||||||
|
if test "$USE_NLS" = "yes"; then
|
||||||
|
AC_DEFINE(ENABLE_NLS)
|
||||||
|
AC_MSG_CHECKING([whether included gettext is requested])
|
||||||
|
AC_ARG_WITH(included-gettext,
|
||||||
|
[ --with-included-gettext use the GNU gettext library included here],
|
||||||
|
nls_cv_force_use_gnu_gettext=$withval,
|
||||||
|
nls_cv_force_use_gnu_gettext=no)
|
||||||
|
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||||
|
|
||||||
|
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||||
|
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||||
|
dnl User does not insist on using GNU NLS library. Figure out what
|
||||||
|
dnl to use. If gettext or catgets are available (in this order) we
|
||||||
|
dnl use this. Else we have to fall back to GNU NLS library.
|
||||||
|
dnl catgets is only used if permitted by option --with-catgets.
|
||||||
|
nls_cv_header_intl=
|
||||||
|
nls_cv_header_libgt=
|
||||||
|
CATOBJEXT=NONE
|
||||||
|
|
||||||
|
AC_CHECK_HEADER(libintl.h,
|
||||||
|
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||||
|
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||||
|
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||||
|
|
||||||
|
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||||
|
AC_CHECK_LIB(intl, bindtextdomain,
|
||||||
|
[AC_CACHE_CHECK([for gettext in libintl],
|
||||||
|
gt_cv_func_gettext_libintl,
|
||||||
|
[AC_CHECK_LIB(intl, gettext,
|
||||||
|
gt_cv_func_gettext_libintl=yes,
|
||||||
|
gt_cv_func_gettext_libintl=no)],
|
||||||
|
gt_cv_func_gettext_libintl=no)])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||||
|
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_GETTEXT)
|
||||||
|
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||||
|
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||||
|
if test "$MSGFMT" != "no"; then
|
||||||
|
AC_CHECK_FUNCS(dcgettext)
|
||||||
|
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||||
|
AC_PATH_PROG(GMSGMERGE, msgmerge, :)
|
||||||
|
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||||
|
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||||
|
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||||
|
return _nl_msg_cat_cntr],
|
||||||
|
[CATOBJEXT=.gmo
|
||||||
|
DATADIRNAME=share],
|
||||||
|
[CATOBJEXT=.mo
|
||||||
|
DATADIRNAME=lib])
|
||||||
|
INSTOBJEXT=.mo
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "$CATOBJEXT" = "NONE"; then
|
||||||
|
AC_MSG_CHECKING([whether catgets can be used])
|
||||||
|
AC_ARG_WITH(catgets,
|
||||||
|
[ --with-catgets use catgets functions if available],
|
||||||
|
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
|
||||||
|
AC_MSG_RESULT($nls_cv_use_catgets)
|
||||||
|
|
||||||
|
if test "$nls_cv_use_catgets" = "yes"; then
|
||||||
|
dnl No gettext in C library. Try catgets next.
|
||||||
|
AC_CHECK_LIB(i, main)
|
||||||
|
AC_CHECK_FUNC(catgets,
|
||||||
|
[AC_DEFINE(HAVE_CATGETS)
|
||||||
|
INTLOBJS="\$(CATOBJS)"
|
||||||
|
AC_PATH_PROG(GENCAT, gencat, no)dnl
|
||||||
|
if test "$GENCAT" != "no"; then
|
||||||
|
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
|
||||||
|
if test "$GMSGFMT" = "no"; then
|
||||||
|
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
|
||||||
|
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
|
||||||
|
fi
|
||||||
|
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||||
|
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||||
|
USE_INCLUDED_LIBINTL=yes
|
||||||
|
CATOBJEXT=.cat
|
||||||
|
INSTOBJEXT=.cat
|
||||||
|
DATADIRNAME=lib
|
||||||
|
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||||
|
INTLLIBS=$INTLDEPS
|
||||||
|
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||||
|
nls_cv_header_intl=intl/libintl.h
|
||||||
|
nls_cv_header_libgt=intl/libgettext.h
|
||||||
|
fi])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$CATOBJEXT" = "NONE"; then
|
||||||
|
dnl Neither gettext nor catgets in included in the C library.
|
||||||
|
dnl Fall back on GNU gettext library.
|
||||||
|
nls_cv_use_gnu_gettext=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||||
|
dnl Mark actions used to generate GNU NLS library.
|
||||||
|
INTLOBJS="\$(GETTOBJS)"
|
||||||
|
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||||
|
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||||
|
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||||
|
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||||
|
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||||
|
AC_SUBST(MSGFMT)
|
||||||
|
USE_INCLUDED_LIBINTL=yes
|
||||||
|
CATOBJEXT=.gmo
|
||||||
|
INSTOBJEXT=.mo
|
||||||
|
DATADIRNAME=share
|
||||||
|
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||||
|
INTLLIBS=$INTLDEPS
|
||||||
|
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||||
|
nls_cv_header_intl=intl/libintl.h
|
||||||
|
nls_cv_header_libgt=intl/libgettext.h
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl Test whether we really found GNU xgettext.
|
||||||
|
if test "$XGETTEXT" != ":"; then
|
||||||
|
dnl If it is no GNU xgettext we define it as : so that the
|
||||||
|
dnl Makefiles still can work.
|
||||||
|
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||||
|
: ;
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(
|
||||||
|
[found xgettext program is not GNU xgettext; ignore it])
|
||||||
|
XGETTEXT=":"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We need to process the po/ directory.
|
||||||
|
POSUB=po
|
||||||
|
else
|
||||||
|
DATADIRNAME=share
|
||||||
|
nls_cv_header_intl=intl/libintl.h
|
||||||
|
nls_cv_header_libgt=intl/libgettext.h
|
||||||
|
fi
|
||||||
|
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
|
||||||
|
AC_OUTPUT_COMMANDS(
|
||||||
|
[case "$CONFIG_FILES" in *po/Makefile.in*)
|
||||||
|
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
|
||||||
|
esac])
|
||||||
|
|
||||||
|
|
||||||
|
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||||
|
# because some of the sources are only built for this goal.
|
||||||
|
if test "$PACKAGE" = gettext; then
|
||||||
|
USE_NLS=yes
|
||||||
|
USE_INCLUDED_LIBINTL=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl These rules are solely for the distribution goal. While doing this
|
||||||
|
dnl we only have to keep exactly one list of the available catalogs
|
||||||
|
dnl in configure.in.
|
||||||
|
for lang in $ALL_LINGUAS; do
|
||||||
|
GMOFILES="$GMOFILES $lang.gmo"
|
||||||
|
POFILES="$POFILES $lang.po"
|
||||||
|
POXFILES="$POXFILES $lang.pox"
|
||||||
|
done
|
||||||
|
|
||||||
|
dnl Make all variables we use known to autoconf.
|
||||||
|
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||||
|
AC_SUBST(CATALOGS)
|
||||||
|
AC_SUBST(CATOBJEXT)
|
||||||
|
AC_SUBST(DATADIRNAME)
|
||||||
|
AC_SUBST(GMOFILES)
|
||||||
|
AC_SUBST(INSTOBJEXT)
|
||||||
|
AC_SUBST(INTLDEPS)
|
||||||
|
AC_SUBST(INTLLIBS)
|
||||||
|
AC_SUBST(INTLOBJS)
|
||||||
|
AC_SUBST(POFILES)
|
||||||
|
AC_SUBST(POXFILES)
|
||||||
|
AC_SUBST(POSUB)
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN(AC_CAN_USE_GNU_GETTEXT,
|
||||||
|
[AM_LC_MESSAGES
|
||||||
|
AM_WITH_NLS
|
||||||
|
|
||||||
|
if test "x$CATOBJEXT" != "x"; then
|
||||||
|
if test "x$ALL_LINGUAS" = "x"; then
|
||||||
|
LINGUAS=
|
||||||
|
else
|
||||||
|
AC_MSG_CHECKING(for catalogs to be installed)
|
||||||
|
NEW_LINGUAS=
|
||||||
|
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||||
|
case "$ALL_LINGUAS" in
|
||||||
|
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
LINGUAS=$NEW_LINGUAS
|
||||||
|
AC_MSG_RESULT($LINGUAS)
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl Construct list of names of catalog files to be constructed.
|
||||||
|
if test -n "$LINGUAS"; then
|
||||||
|
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl The reference to <locale.h> in the installed <libintl.h> file
|
||||||
|
dnl must be resolved because we cannot expect the users of this
|
||||||
|
dnl to define HAVE_LOCALE_H.
|
||||||
|
if test "$ac_cv_header_locale_h" = yes; then
|
||||||
|
INCLUDE_LOCALE_H="#include <locale.h>"
|
||||||
|
else
|
||||||
|
INCLUDE_LOCALE_H="\
|
||||||
|
/* The system does not provide the header <locale.h>. Take care yourself. */"
|
||||||
|
fi
|
||||||
|
AC_SUBST(INCLUDE_LOCALE_H)
|
||||||
|
|
||||||
|
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
||||||
|
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
|
||||||
|
dnl Try to locate is.
|
||||||
|
MKINSTALLDIRS=
|
||||||
|
if test -n "$ac_aux_dir"; then
|
||||||
|
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
||||||
|
fi
|
||||||
|
if test -z "$MKINSTALLDIRS"; then
|
||||||
|
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
||||||
|
fi
|
||||||
|
AC_SUBST(MKINSTALLDIRS)
|
||||||
|
|
||||||
|
dnl Generate list of files to be processed by xgettext which will
|
||||||
|
dnl be included in po/Makefile.
|
||||||
|
test -d po || mkdir po
|
||||||
|
if test "x$srcdir" != "x."; then
|
||||||
|
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||||
|
posrcprefix="$srcdir/"
|
||||||
|
else
|
||||||
|
posrcprefix="../$srcdir/"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
posrcprefix="../"
|
||||||
|
fi
|
||||||
|
rm -f po/POTFILES
|
||||||
|
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||||
|
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||||
|
])
|
||||||
|
|
||||||
|
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||||
|
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||||
|
#
|
||||||
|
# This file can be copied and used freely without restrictions. It can
|
||||||
|
# be used in projects which are not available under the GNU Public License
|
||||||
|
# but which still want to provide support for the GNU gettext functionality.
|
||||||
|
# Please note that the actual code is *not* freely available.
|
||||||
|
|
||||||
|
# serial 1
|
||||||
|
|
||||||
|
AC_DEFUN(AM_LC_MESSAGES,
|
||||||
|
[if test "$ac_cv_header_locale_h" = yes; then
|
||||||
|
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||||
|
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||||
|
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||||
|
if test "$am_cv_val_LC_MESSAGES" = yes; then
|
||||||
|
AC_DEFINE(HAVE_LC_MESSAGES)
|
||||||
|
fi
|
||||||
|
fi])
|
||||||
|
|
||||||
|
# Do all the work for Automake. This macro actually does too much --
|
||||||
|
# some checks are only needed if your package does certain things.
|
||||||
|
# But this isn't really a big deal.
|
||||||
|
|
||||||
|
# serial 1
|
||||||
|
|
||||||
|
dnl Usage:
|
||||||
|
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||||
|
|
||||||
|
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||||
|
[AC_REQUIRE([AM_PROG_INSTALL])
|
||||||
|
PACKAGE=[$1]
|
||||||
|
AC_SUBST(PACKAGE)
|
||||||
|
VERSION=[$2]
|
||||||
|
AC_SUBST(VERSION)
|
||||||
|
dnl test to see if srcdir already configured
|
||||||
|
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||||
|
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||||
|
fi
|
||||||
|
ifelse([$3],,
|
||||||
|
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||||
|
AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
|
||||||
|
AC_REQUIRE([AM_SANITY_CHECK])
|
||||||
|
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||||
|
dnl FIXME This is truly gross.
|
||||||
|
missing_dir=`cd $ac_aux_dir && pwd`
|
||||||
|
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||||
|
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||||
|
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||||
|
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||||
|
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||||
|
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||||
|
|
||||||
|
## --------------------------------------------------------- ##
|
||||||
|
## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
|
||||||
|
## substitution. ##
|
||||||
|
## From Franc,ois Pinard ##
|
||||||
|
## --------------------------------------------------------- ##
|
||||||
|
|
||||||
|
# serial 1
|
||||||
|
|
||||||
|
AC_DEFUN(AM_PROG_INSTALL,
|
||||||
|
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||||
|
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||||
|
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check to make sure that the build environment is sane.
|
||||||
|
#
|
||||||
|
|
||||||
|
AC_DEFUN(AM_SANITY_CHECK,
|
||||||
|
[AC_MSG_CHECKING([whether build environment is sane])
|
||||||
|
# Just in case
|
||||||
|
sleep 1
|
||||||
|
echo timestamp > conftestfile
|
||||||
|
# Do `set' in a subshell so we don't clobber the current shell's
|
||||||
|
# arguments. Must try -L first in case configure is actually a
|
||||||
|
# symlink; some systems play weird games with the mod time of symlinks
|
||||||
|
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||||
|
# directory).
|
||||||
|
if (
|
||||||
|
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||||
|
if test "[$]*" = "X"; then
|
||||||
|
# -L didn't work.
|
||||||
|
set X `ls -t $srcdir/configure conftestfile`
|
||||||
|
fi
|
||||||
|
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
||||||
|
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
||||||
|
|
||||||
|
# If neither matched, then we have a broken ls. This can happen
|
||||||
|
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||||
|
# broken ls alias from the environment. This has actually
|
||||||
|
# happened. Such a system could not be considered "sane".
|
||||||
|
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||||
|
alias in your environment])
|
||||||
|
fi
|
||||||
|
|
||||||
|
test "[$]2" = conftestfile
|
||||||
|
)
|
||||||
|
then
|
||||||
|
# Ok.
|
||||||
|
:
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||||
|
Check your system clock])
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
AC_MSG_RESULT(yes)])
|
||||||
|
|
||||||
|
## --------------------------------------------------------- ##
|
||||||
|
## Fake the existence of programs that GNU maintainers use. ##
|
||||||
|
## --------------------------------------------------------- ##
|
||||||
|
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||||
|
dnl The program must properly implement --version.
|
||||||
|
AC_DEFUN(AM_MISSING_PROG,
|
||||||
|
[AC_MSG_CHECKING(for working $2)
|
||||||
|
# Run test in a subshell; some versions of sh will print an error if
|
||||||
|
# an executable is not found, even if stderr is redirected.
|
||||||
|
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||||
|
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||||
|
$1=$2
|
||||||
|
AC_MSG_RESULT(found)
|
||||||
|
else
|
||||||
|
$1="$3/missing $2"
|
||||||
|
AC_MSG_RESULT(missing)
|
||||||
|
fi
|
||||||
|
AC_SUBST($1)])
|
||||||
|
23
config.h.in
23
config.h.in
@ -26,6 +26,10 @@
|
|||||||
#ifndef __XACC_CONFIG_H__
|
#ifndef __XACC_CONFIG_H__
|
||||||
#define __XACC_CONFIG_H__
|
#define __XACC_CONFIG_H__
|
||||||
|
|
||||||
|
/* Package name and version number */
|
||||||
|
#undef PACKAGE
|
||||||
|
#undef VERSION
|
||||||
|
|
||||||
/* Are we bigendian -- needed for reading binary file format */
|
/* Are we bigendian -- needed for reading binary file format */
|
||||||
#undef WORDS_BIGENDIAN
|
#undef WORDS_BIGENDIAN
|
||||||
|
|
||||||
@ -65,4 +69,23 @@
|
|||||||
/* Configure found the function malloc_usable_size */
|
/* Configure found the function malloc_usable_size */
|
||||||
#define HAVE_MALLOC_USABLE_SIZE
|
#define HAVE_MALLOC_USABLE_SIZE
|
||||||
|
|
||||||
|
/*** Begin i18n ***/
|
||||||
|
|
||||||
|
/* internationalization with gettext */
|
||||||
|
#undef HAVE_GETTEXT
|
||||||
|
|
||||||
|
/* internationalization with catgets */
|
||||||
|
#undef HAVE_CATGETS
|
||||||
|
|
||||||
|
/* locale.h contains LC_MESSAGES */
|
||||||
|
#undef HAVE_LC_MESSAGES
|
||||||
|
|
||||||
|
/* specific locale directory */
|
||||||
|
#undef HAVE_LOCALE_DIR
|
||||||
|
|
||||||
|
/* defined if NLS is available */
|
||||||
|
#undef ENABLE_NLS
|
||||||
|
|
||||||
|
/*** End i18n ***/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
873
config.sub
vendored
873
config.sub
vendored
@ -1,873 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
# Configuration validation subroutine script, version 1.1.
|
|
||||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
|
||||||
# can handle that machine. It does not imply ALL GNU software can.
|
|
||||||
#
|
|
||||||
# This file 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., 59 Temple Place - Suite 330,
|
|
||||||
# Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
|
||||||
# distribute this file as part of a program that contains a
|
|
||||||
# configuration script generated by Autoconf, you may include it under
|
|
||||||
# the same distribution terms that you use for the rest of that program.
|
|
||||||
|
|
||||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
|
||||||
# Supply the specified configuration type as an argument.
|
|
||||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
|
||||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
|
||||||
|
|
||||||
# This file is supposed to be the same for all GNU packages
|
|
||||||
# and recognize all the CPU types, system types and aliases
|
|
||||||
# that are meaningful with *any* GNU software.
|
|
||||||
# Each package is responsible for reporting which valid configurations
|
|
||||||
# it does not support. The user should be able to distinguish
|
|
||||||
# a failure to support a valid configuration from a meaningless
|
|
||||||
# configuration.
|
|
||||||
|
|
||||||
# The goal of this file is to map all the various variations of a given
|
|
||||||
# machine specification into a single specification in the form:
|
|
||||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
|
||||||
# It is wrong to echo any other type of specification.
|
|
||||||
|
|
||||||
if [ x$1 = x ]
|
|
||||||
then
|
|
||||||
echo Configuration name missing. 1>&2
|
|
||||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
|
||||||
echo "or $0 ALIAS" 1>&2
|
|
||||||
echo where ALIAS is a recognized configuration type. 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# First pass through any local machine types.
|
|
||||||
case $1 in
|
|
||||||
*local*)
|
|
||||||
echo $1
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Separate what the user gave into CPU-COMPANY and OS (if any).
|
|
||||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
|
||||||
if [ $basic_machine != $1 ]
|
|
||||||
then os=`echo $1 | sed 's/.*-/-/'`
|
|
||||||
else os=; fi
|
|
||||||
|
|
||||||
### Let's recognize common machines as not being operating systems so
|
|
||||||
### that things like config.sub decstation-3100 work. We also
|
|
||||||
### recognize some manufacturers as not being operating systems, so we
|
|
||||||
### can provide default operating systems below.
|
|
||||||
case $os in
|
|
||||||
-sun*os*)
|
|
||||||
# Prevent following clause from handling this invalid input.
|
|
||||||
;;
|
|
||||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
|
||||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
|
||||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
|
||||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
|
||||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
|
||||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
|
|
||||||
os=
|
|
||||||
basic_machine=$1
|
|
||||||
;;
|
|
||||||
-hiux*)
|
|
||||||
os=-hiuxwe2
|
|
||||||
;;
|
|
||||||
-sco4)
|
|
||||||
os=-sco3.2v4
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
|
||||||
;;
|
|
||||||
-sco3.2.[4-9]*)
|
|
||||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
|
||||||
;;
|
|
||||||
-sco3.2v[4-9]*)
|
|
||||||
# Don't forget version if it is 3.2v4 or newer.
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
|
||||||
;;
|
|
||||||
-sco*)
|
|
||||||
os=-sco3.2v2
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
|
||||||
;;
|
|
||||||
-isc)
|
|
||||||
os=-isc2.2
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
|
||||||
;;
|
|
||||||
-clix*)
|
|
||||||
basic_machine=clipper-intergraph
|
|
||||||
;;
|
|
||||||
-isc*)
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
|
||||||
;;
|
|
||||||
-lynx*)
|
|
||||||
os=-lynxos
|
|
||||||
;;
|
|
||||||
-ptx*)
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
|
||||||
;;
|
|
||||||
-windowsnt*)
|
|
||||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Decode aliases for certain CPU-COMPANY combinations.
|
|
||||||
case $basic_machine in
|
|
||||||
# Recognize the basic CPU types without company name.
|
|
||||||
# Some are omitted here because they have special meanings below.
|
|
||||||
tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
|
|
||||||
| arme[lb] | pyramid \
|
|
||||||
| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
|
|
||||||
| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
|
|
||||||
| powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
|
|
||||||
| pdp11 | mips64el | mips64orion | mips64orionel \
|
|
||||||
| sparc)
|
|
||||||
basic_machine=$basic_machine-unknown
|
|
||||||
;;
|
|
||||||
# Object if more than one company name word.
|
|
||||||
*-*-*)
|
|
||||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
# Recognize the basic CPU types with company name.
|
|
||||||
vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
|
|
||||||
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
|
|
||||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
|
|
||||||
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
|
|
||||||
| hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
|
|
||||||
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
|
|
||||||
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
|
|
||||||
| mips64el-* | mips64orion-* | mips64orionel-*)
|
|
||||||
;;
|
|
||||||
# Recognize the various machine names and aliases which stand
|
|
||||||
# for a CPU type and a company and sometimes even an OS.
|
|
||||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
|
||||||
basic_machine=m68000-att
|
|
||||||
;;
|
|
||||||
3b*)
|
|
||||||
basic_machine=we32k-att
|
|
||||||
;;
|
|
||||||
alliant | fx80)
|
|
||||||
basic_machine=fx80-alliant
|
|
||||||
;;
|
|
||||||
altos | altos3068)
|
|
||||||
basic_machine=m68k-altos
|
|
||||||
;;
|
|
||||||
am29k)
|
|
||||||
basic_machine=a29k-none
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
amdahl)
|
|
||||||
basic_machine=580-amdahl
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
amiga | amiga-*)
|
|
||||||
basic_machine=m68k-cbm
|
|
||||||
;;
|
|
||||||
amigados)
|
|
||||||
basic_machine=m68k-cbm
|
|
||||||
os=-amigados
|
|
||||||
;;
|
|
||||||
amigaunix | amix)
|
|
||||||
basic_machine=m68k-cbm
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
apollo68)
|
|
||||||
basic_machine=m68k-apollo
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
balance)
|
|
||||||
basic_machine=ns32k-sequent
|
|
||||||
os=-dynix
|
|
||||||
;;
|
|
||||||
convex-c1)
|
|
||||||
basic_machine=c1-convex
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
convex-c2)
|
|
||||||
basic_machine=c2-convex
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
convex-c32)
|
|
||||||
basic_machine=c32-convex
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
convex-c34)
|
|
||||||
basic_machine=c34-convex
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
convex-c38)
|
|
||||||
basic_machine=c38-convex
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
cray | ymp)
|
|
||||||
basic_machine=ymp-cray
|
|
||||||
os=-unicos
|
|
||||||
;;
|
|
||||||
cray2)
|
|
||||||
basic_machine=cray2-cray
|
|
||||||
os=-unicos
|
|
||||||
;;
|
|
||||||
crds | unos)
|
|
||||||
basic_machine=m68k-crds
|
|
||||||
;;
|
|
||||||
da30 | da30-*)
|
|
||||||
basic_machine=m68k-da30
|
|
||||||
;;
|
|
||||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
|
||||||
basic_machine=mips-dec
|
|
||||||
;;
|
|
||||||
delta | 3300 | motorola-3300 | motorola-delta \
|
|
||||||
| 3300-motorola | delta-motorola)
|
|
||||||
basic_machine=m68k-motorola
|
|
||||||
;;
|
|
||||||
delta88)
|
|
||||||
basic_machine=m88k-motorola
|
|
||||||
os=-sysv3
|
|
||||||
;;
|
|
||||||
dpx20 | dpx20-*)
|
|
||||||
basic_machine=rs6000-bull
|
|
||||||
os=-bosx
|
|
||||||
;;
|
|
||||||
dpx2* | dpx2*-bull)
|
|
||||||
basic_machine=m68k-bull
|
|
||||||
os=-sysv3
|
|
||||||
;;
|
|
||||||
ebmon29k)
|
|
||||||
basic_machine=a29k-amd
|
|
||||||
os=-ebmon
|
|
||||||
;;
|
|
||||||
elxsi)
|
|
||||||
basic_machine=elxsi-elxsi
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
encore | umax | mmax)
|
|
||||||
basic_machine=ns32k-encore
|
|
||||||
;;
|
|
||||||
fx2800)
|
|
||||||
basic_machine=i860-alliant
|
|
||||||
;;
|
|
||||||
genix)
|
|
||||||
basic_machine=ns32k-ns
|
|
||||||
;;
|
|
||||||
gmicro)
|
|
||||||
basic_machine=tron-gmicro
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
h3050r* | hiux*)
|
|
||||||
basic_machine=hppa1.1-hitachi
|
|
||||||
os=-hiuxwe2
|
|
||||||
;;
|
|
||||||
h8300hms)
|
|
||||||
basic_machine=h8300-hitachi
|
|
||||||
os=-hms
|
|
||||||
;;
|
|
||||||
harris)
|
|
||||||
basic_machine=m88k-harris
|
|
||||||
os=-sysv3
|
|
||||||
;;
|
|
||||||
hp300-*)
|
|
||||||
basic_machine=m68k-hp
|
|
||||||
;;
|
|
||||||
hp300bsd)
|
|
||||||
basic_machine=m68k-hp
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
hp300hpux)
|
|
||||||
basic_machine=m68k-hp
|
|
||||||
os=-hpux
|
|
||||||
;;
|
|
||||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
|
||||||
basic_machine=m68000-hp
|
|
||||||
;;
|
|
||||||
hp9k3[2-9][0-9])
|
|
||||||
basic_machine=m68k-hp
|
|
||||||
;;
|
|
||||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
|
||||||
basic_machine=hppa1.1-hp
|
|
||||||
;;
|
|
||||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
|
||||||
basic_machine=hppa1.0-hp
|
|
||||||
;;
|
|
||||||
i370-ibm* | ibm*)
|
|
||||||
basic_machine=i370-ibm
|
|
||||||
os=-mvs
|
|
||||||
;;
|
|
||||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
|
||||||
i[345]86v32)
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
|
||||||
os=-sysv32
|
|
||||||
;;
|
|
||||||
i[345]86v4*)
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
i[345]86v)
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
i[345]86sol2)
|
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
|
||||||
os=-solaris2
|
|
||||||
;;
|
|
||||||
iris | iris4d)
|
|
||||||
basic_machine=mips-sgi
|
|
||||||
case $os in
|
|
||||||
-irix*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
os=-irix4
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
isi68 | isi)
|
|
||||||
basic_machine=m68k-isi
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
m88k-omron*)
|
|
||||||
basic_machine=m88k-omron
|
|
||||||
;;
|
|
||||||
magnum | m3230)
|
|
||||||
basic_machine=mips-mips
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
merlin)
|
|
||||||
basic_machine=ns32k-utek
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
miniframe)
|
|
||||||
basic_machine=m68000-convergent
|
|
||||||
;;
|
|
||||||
mips3*-*)
|
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
|
||||||
;;
|
|
||||||
mips3*)
|
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
|
||||||
;;
|
|
||||||
ncr3000)
|
|
||||||
basic_machine=i486-ncr
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
news | news700 | news800 | news900)
|
|
||||||
basic_machine=m68k-sony
|
|
||||||
os=-newsos
|
|
||||||
;;
|
|
||||||
news1000)
|
|
||||||
basic_machine=m68030-sony
|
|
||||||
os=-newsos
|
|
||||||
;;
|
|
||||||
news-3600 | risc-news)
|
|
||||||
basic_machine=mips-sony
|
|
||||||
os=-newsos
|
|
||||||
;;
|
|
||||||
next | m*-next )
|
|
||||||
basic_machine=m68k-next
|
|
||||||
case $os in
|
|
||||||
-nextstep* )
|
|
||||||
;;
|
|
||||||
-ns2*)
|
|
||||||
os=-nextstep2
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
os=-nextstep3
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
nh3000)
|
|
||||||
basic_machine=m68k-harris
|
|
||||||
os=-cxux
|
|
||||||
;;
|
|
||||||
nh[45]000)
|
|
||||||
basic_machine=m88k-harris
|
|
||||||
os=-cxux
|
|
||||||
;;
|
|
||||||
nindy960)
|
|
||||||
basic_machine=i960-intel
|
|
||||||
os=-nindy
|
|
||||||
;;
|
|
||||||
np1)
|
|
||||||
basic_machine=np1-gould
|
|
||||||
;;
|
|
||||||
pa-hitachi)
|
|
||||||
basic_machine=hppa1.1-hitachi
|
|
||||||
os=-hiuxwe2
|
|
||||||
;;
|
|
||||||
paragon)
|
|
||||||
basic_machine=i860-intel
|
|
||||||
os=-osf
|
|
||||||
;;
|
|
||||||
pbd)
|
|
||||||
basic_machine=sparc-tti
|
|
||||||
;;
|
|
||||||
pbb)
|
|
||||||
basic_machine=m68k-tti
|
|
||||||
;;
|
|
||||||
pc532 | pc532-*)
|
|
||||||
basic_machine=ns32k-pc532
|
|
||||||
;;
|
|
||||||
pentium | p5 | p6)
|
|
||||||
# We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
|
|
||||||
basic_machine=i586-intel
|
|
||||||
;;
|
|
||||||
pentium-* | p5-* | p6-*)
|
|
||||||
# We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
|
|
||||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
;;
|
|
||||||
i686)
|
|
||||||
basic_machine=i686-intel
|
|
||||||
;;
|
|
||||||
i686-*)
|
|
||||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
;;
|
|
||||||
k5)
|
|
||||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
|
||||||
basic_machine=i586-amd
|
|
||||||
;;
|
|
||||||
nexen)
|
|
||||||
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
|
||||||
basic_machine=i586-nexgen
|
|
||||||
;;
|
|
||||||
pn)
|
|
||||||
basic_machine=pn-gould
|
|
||||||
;;
|
|
||||||
power) basic_machine=rs6000-ibm
|
|
||||||
;;
|
|
||||||
ppc) basic_machine=powerpc-unknown
|
|
||||||
;;
|
|
||||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
;;
|
|
||||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
|
||||||
basic_machine=powerpcle-unknown
|
|
||||||
;;
|
|
||||||
ppcle-* | powerpclittle-*)
|
|
||||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
;;
|
|
||||||
ps2)
|
|
||||||
basic_machine=i386-ibm
|
|
||||||
;;
|
|
||||||
rm[46]00)
|
|
||||||
basic_machine=mips-siemens
|
|
||||||
;;
|
|
||||||
rtpc | rtpc-*)
|
|
||||||
basic_machine=romp-ibm
|
|
||||||
;;
|
|
||||||
sequent)
|
|
||||||
basic_machine=i386-sequent
|
|
||||||
;;
|
|
||||||
sh)
|
|
||||||
basic_machine=sh-hitachi
|
|
||||||
os=-hms
|
|
||||||
;;
|
|
||||||
sps7)
|
|
||||||
basic_machine=m68k-bull
|
|
||||||
os=-sysv2
|
|
||||||
;;
|
|
||||||
spur)
|
|
||||||
basic_machine=spur-unknown
|
|
||||||
;;
|
|
||||||
sun2)
|
|
||||||
basic_machine=m68000-sun
|
|
||||||
;;
|
|
||||||
sun2os3)
|
|
||||||
basic_machine=m68000-sun
|
|
||||||
os=-sunos3
|
|
||||||
;;
|
|
||||||
sun2os4)
|
|
||||||
basic_machine=m68000-sun
|
|
||||||
os=-sunos4
|
|
||||||
;;
|
|
||||||
sun3os3)
|
|
||||||
basic_machine=m68k-sun
|
|
||||||
os=-sunos3
|
|
||||||
;;
|
|
||||||
sun3os4)
|
|
||||||
basic_machine=m68k-sun
|
|
||||||
os=-sunos4
|
|
||||||
;;
|
|
||||||
sun4os3)
|
|
||||||
basic_machine=sparc-sun
|
|
||||||
os=-sunos3
|
|
||||||
;;
|
|
||||||
sun4os4)
|
|
||||||
basic_machine=sparc-sun
|
|
||||||
os=-sunos4
|
|
||||||
;;
|
|
||||||
sun4sol2)
|
|
||||||
basic_machine=sparc-sun
|
|
||||||
os=-solaris2
|
|
||||||
;;
|
|
||||||
sun3 | sun3-*)
|
|
||||||
basic_machine=m68k-sun
|
|
||||||
;;
|
|
||||||
sun4)
|
|
||||||
basic_machine=sparc-sun
|
|
||||||
;;
|
|
||||||
sun386 | sun386i | roadrunner)
|
|
||||||
basic_machine=i386-sun
|
|
||||||
;;
|
|
||||||
symmetry)
|
|
||||||
basic_machine=i386-sequent
|
|
||||||
os=-dynix
|
|
||||||
;;
|
|
||||||
tower | tower-32)
|
|
||||||
basic_machine=m68k-ncr
|
|
||||||
;;
|
|
||||||
udi29k)
|
|
||||||
basic_machine=a29k-amd
|
|
||||||
os=-udi
|
|
||||||
;;
|
|
||||||
ultra3)
|
|
||||||
basic_machine=a29k-nyu
|
|
||||||
os=-sym1
|
|
||||||
;;
|
|
||||||
vaxv)
|
|
||||||
basic_machine=vax-dec
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
vms)
|
|
||||||
basic_machine=vax-dec
|
|
||||||
os=-vms
|
|
||||||
;;
|
|
||||||
vxworks960)
|
|
||||||
basic_machine=i960-wrs
|
|
||||||
os=-vxworks
|
|
||||||
;;
|
|
||||||
vxworks68)
|
|
||||||
basic_machine=m68k-wrs
|
|
||||||
os=-vxworks
|
|
||||||
;;
|
|
||||||
vxworks29k)
|
|
||||||
basic_machine=a29k-wrs
|
|
||||||
os=-vxworks
|
|
||||||
;;
|
|
||||||
xmp)
|
|
||||||
basic_machine=xmp-cray
|
|
||||||
os=-unicos
|
|
||||||
;;
|
|
||||||
xps | xps100)
|
|
||||||
basic_machine=xps100-honeywell
|
|
||||||
;;
|
|
||||||
none)
|
|
||||||
basic_machine=none-none
|
|
||||||
os=-none
|
|
||||||
;;
|
|
||||||
|
|
||||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
|
||||||
# some cases the only manufacturer, in others, it is the most popular.
|
|
||||||
mips)
|
|
||||||
basic_machine=mips-mips
|
|
||||||
;;
|
|
||||||
romp)
|
|
||||||
basic_machine=romp-ibm
|
|
||||||
;;
|
|
||||||
rs6000)
|
|
||||||
basic_machine=rs6000-ibm
|
|
||||||
;;
|
|
||||||
vax)
|
|
||||||
basic_machine=vax-dec
|
|
||||||
;;
|
|
||||||
pdp11)
|
|
||||||
basic_machine=pdp11-dec
|
|
||||||
;;
|
|
||||||
we32k)
|
|
||||||
basic_machine=we32k-att
|
|
||||||
;;
|
|
||||||
sparc)
|
|
||||||
basic_machine=sparc-sun
|
|
||||||
;;
|
|
||||||
cydra)
|
|
||||||
basic_machine=cydra-cydrome
|
|
||||||
;;
|
|
||||||
orion)
|
|
||||||
basic_machine=orion-highlevel
|
|
||||||
;;
|
|
||||||
orion105)
|
|
||||||
basic_machine=clipper-highlevel
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Here we canonicalize certain aliases for manufacturers.
|
|
||||||
case $basic_machine in
|
|
||||||
*-digital*)
|
|
||||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
|
||||||
;;
|
|
||||||
*-commodore*)
|
|
||||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Decode manufacturer-specific aliases for certain operating systems.
|
|
||||||
|
|
||||||
if [ x"$os" != x"" ]
|
|
||||||
then
|
|
||||||
case $os in
|
|
||||||
# -solaris* is a basic system type, with this one exception.
|
|
||||||
-solaris1 | -solaris1.*)
|
|
||||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
|
||||||
;;
|
|
||||||
-solaris)
|
|
||||||
os=-solaris2
|
|
||||||
;;
|
|
||||||
-unixware* | svr4*)
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
-gnu/linux*)
|
|
||||||
os=`echo $os | sed -e 's|gnu/linux|linux|'`
|
|
||||||
;;
|
|
||||||
# First accept the basic system types.
|
|
||||||
# The portable systems comes first.
|
|
||||||
# Each alternative MUST END IN A *, to match a version number.
|
|
||||||
# -sysv* is not here because it comes later, after sysvr4.
|
|
||||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
|
||||||
| -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
|
|
||||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
|
||||||
| -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
|
|
||||||
| -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
|
|
||||||
| -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
|
|
||||||
| -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
|
|
||||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
|
||||||
| -udi* | -eabi* | -lites* )
|
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
|
||||||
;;
|
|
||||||
-sunos5*)
|
|
||||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
|
||||||
;;
|
|
||||||
-sunos6*)
|
|
||||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
|
||||||
;;
|
|
||||||
-osfrose*)
|
|
||||||
os=-osfrose
|
|
||||||
;;
|
|
||||||
-osf*)
|
|
||||||
os=-osf
|
|
||||||
;;
|
|
||||||
-utek*)
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
-dynix*)
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
-acis*)
|
|
||||||
os=-aos
|
|
||||||
;;
|
|
||||||
-ctix* | -uts*)
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
# Preserve the version number of sinix5.
|
|
||||||
-sinix5.*)
|
|
||||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
|
||||||
;;
|
|
||||||
-sinix*)
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
-triton*)
|
|
||||||
os=-sysv3
|
|
||||||
;;
|
|
||||||
-oss*)
|
|
||||||
os=-sysv3
|
|
||||||
;;
|
|
||||||
-svr4)
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
-svr3)
|
|
||||||
os=-sysv3
|
|
||||||
;;
|
|
||||||
-sysvr4)
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
# This must come after -sysvr4.
|
|
||||||
-sysv*)
|
|
||||||
;;
|
|
||||||
-xenix)
|
|
||||||
os=-xenix
|
|
||||||
;;
|
|
||||||
-none)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Get rid of the `-' at the beginning of $os.
|
|
||||||
os=`echo $os | sed 's/[^-]*-//'`
|
|
||||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
|
|
||||||
# Here we handle the default operating systems that come with various machines.
|
|
||||||
# The value should be what the vendor currently ships out the door with their
|
|
||||||
# machine or put another way, the most popular os provided with the machine.
|
|
||||||
|
|
||||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
|
||||||
# "-sun"), then you have to tell the case statement up towards the top
|
|
||||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
|
||||||
# will signal an error saying that MANUFACTURER isn't an operating
|
|
||||||
# system, and we'll never get to this point.
|
|
||||||
|
|
||||||
case $basic_machine in
|
|
||||||
*-acorn)
|
|
||||||
os=-riscix1.2
|
|
||||||
;;
|
|
||||||
arm*-semi)
|
|
||||||
os=-aout
|
|
||||||
;;
|
|
||||||
pdp11-*)
|
|
||||||
os=-none
|
|
||||||
;;
|
|
||||||
*-dec | vax-*)
|
|
||||||
os=-ultrix4.2
|
|
||||||
;;
|
|
||||||
m68*-apollo)
|
|
||||||
os=-domain
|
|
||||||
;;
|
|
||||||
i386-sun)
|
|
||||||
os=-sunos4.0.2
|
|
||||||
;;
|
|
||||||
m68000-sun)
|
|
||||||
os=-sunos3
|
|
||||||
# This also exists in the configure program, but was not the
|
|
||||||
# default.
|
|
||||||
# os=-sunos4
|
|
||||||
;;
|
|
||||||
*-tti) # must be before sparc entry or we get the wrong os.
|
|
||||||
os=-sysv3
|
|
||||||
;;
|
|
||||||
sparc-* | *-sun)
|
|
||||||
os=-sunos4.1.1
|
|
||||||
;;
|
|
||||||
*-ibm)
|
|
||||||
os=-aix
|
|
||||||
;;
|
|
||||||
*-hp)
|
|
||||||
os=-hpux
|
|
||||||
;;
|
|
||||||
*-hitachi)
|
|
||||||
os=-hiux
|
|
||||||
;;
|
|
||||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
*-cbm)
|
|
||||||
os=-amigados
|
|
||||||
;;
|
|
||||||
*-dg)
|
|
||||||
os=-dgux
|
|
||||||
;;
|
|
||||||
*-dolphin)
|
|
||||||
os=-sysv3
|
|
||||||
;;
|
|
||||||
m68k-ccur)
|
|
||||||
os=-rtu
|
|
||||||
;;
|
|
||||||
m88k-omron*)
|
|
||||||
os=-luna
|
|
||||||
;;
|
|
||||||
*-sequent)
|
|
||||||
os=-ptx
|
|
||||||
;;
|
|
||||||
*-crds)
|
|
||||||
os=-unos
|
|
||||||
;;
|
|
||||||
*-ns)
|
|
||||||
os=-genix
|
|
||||||
;;
|
|
||||||
i370-*)
|
|
||||||
os=-mvs
|
|
||||||
;;
|
|
||||||
*-next)
|
|
||||||
os=-nextstep3
|
|
||||||
;;
|
|
||||||
*-gould)
|
|
||||||
os=-sysv
|
|
||||||
;;
|
|
||||||
*-highlevel)
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
*-encore)
|
|
||||||
os=-bsd
|
|
||||||
;;
|
|
||||||
*-sgi)
|
|
||||||
os=-irix
|
|
||||||
;;
|
|
||||||
*-siemens)
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
*-masscomp)
|
|
||||||
os=-rtu
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
os=-none
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
|
||||||
# manufacturer. We pick the logical manufacturer.
|
|
||||||
vendor=unknown
|
|
||||||
case $basic_machine in
|
|
||||||
*-unknown)
|
|
||||||
case $os in
|
|
||||||
-riscix*)
|
|
||||||
vendor=acorn
|
|
||||||
;;
|
|
||||||
-sunos*)
|
|
||||||
vendor=sun
|
|
||||||
;;
|
|
||||||
-lynxos*)
|
|
||||||
vendor=lynx
|
|
||||||
;;
|
|
||||||
-aix*)
|
|
||||||
vendor=ibm
|
|
||||||
;;
|
|
||||||
-hpux*)
|
|
||||||
vendor=hp
|
|
||||||
;;
|
|
||||||
-hiux*)
|
|
||||||
vendor=hitachi
|
|
||||||
;;
|
|
||||||
-unos*)
|
|
||||||
vendor=crds
|
|
||||||
;;
|
|
||||||
-dgux*)
|
|
||||||
vendor=dg
|
|
||||||
;;
|
|
||||||
-luna*)
|
|
||||||
vendor=omron
|
|
||||||
;;
|
|
||||||
-genix*)
|
|
||||||
vendor=ns
|
|
||||||
;;
|
|
||||||
-mvs*)
|
|
||||||
vendor=ibm
|
|
||||||
;;
|
|
||||||
-ptx*)
|
|
||||||
vendor=sequent
|
|
||||||
;;
|
|
||||||
-vxworks*)
|
|
||||||
vendor=wrs
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo $basic_machine$os
|
|
54
configure.in
54
configure.in
@ -22,6 +22,12 @@
|
|||||||
### commands depend on them):
|
### commands depend on them):
|
||||||
|
|
||||||
AC_INIT(src/guile/gnucash.h.in)
|
AC_INIT(src/guile/gnucash.h.in)
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE(gnucash,1.3.1)
|
||||||
|
|
||||||
|
dnl Set of available languages.
|
||||||
|
ALL_LINGUAS="fr de"
|
||||||
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
|
|
||||||
@ -52,7 +58,9 @@ AC_ARG_ENABLE( color,
|
|||||||
|
|
||||||
AC_ARG_WITH( opt-style-install,
|
AC_ARG_WITH( opt-style-install,
|
||||||
[ --with-opt-style-install install everything in subdirs of --prefix],
|
[ --with-opt-style-install install everything in subdirs of --prefix],
|
||||||
OPT_STYLE_INSTALL=1,
|
OPT_STYLE_INSTALL=1
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$prefix/include"
|
||||||
|
CFLAGS="$CLFAGS -L$prefix/lib",
|
||||||
OPT_STYLE_INSTALL=0)
|
OPT_STYLE_INSTALL=0)
|
||||||
AC_SUBST(OPT_STYLE_INSTALL)
|
AC_SUBST(OPT_STYLE_INSTALL)
|
||||||
|
|
||||||
@ -69,6 +77,26 @@ AC_ARG_ENABLE( warnings,
|
|||||||
LDFLAGS="${LDFLAGS} -g -Wall"
|
LDFLAGS="${LDFLAGS} -g -Wall"
|
||||||
AC_DEFINE(DEBUG_MEMORY,1) AC_DEFINE(USE_DEBUG,1) )
|
AC_DEFINE(DEBUG_MEMORY,1) AC_DEFINE(USE_DEBUG,1) )
|
||||||
|
|
||||||
|
### --------------------------------------------------------------------------
|
||||||
|
## qt-version of gnucash
|
||||||
|
# The qt version of gnucash is far from doing anything usefull, so most people
|
||||||
|
# don't care about it. Those who want to play with it, must specify --enable-qt
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(qt,
|
||||||
|
[ --enable-qt enable building of the Qt version of gnucash],
|
||||||
|
GNC_QT_ENABLED=yes)
|
||||||
|
|
||||||
|
if test x"$GNC_QT_ENABLED" = xyes; then
|
||||||
|
QT_TARGET="qt.real"
|
||||||
|
QT_STATIC_TARGET="qt.static.real"
|
||||||
|
else
|
||||||
|
QT_TARGET="qt.disable"
|
||||||
|
QT_STATIC_TARGET="qt.disable"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(QT_TARGET)
|
||||||
|
AC_SUBST(QT_STATIC_TARGET)
|
||||||
|
|
||||||
### --------------------------------------------------------------------------
|
### --------------------------------------------------------------------------
|
||||||
### Programs
|
### Programs
|
||||||
|
|
||||||
@ -98,7 +126,7 @@ AC_SUBST(PERL)
|
|||||||
# I'm reasonably sure it's correct.
|
# I'm reasonably sure it's correct.
|
||||||
# PERLINCL="/usr/lib/perl5/i386-linux/5.00404"
|
# PERLINCL="/usr/lib/perl5/i386-linux/5.00404"
|
||||||
#
|
#
|
||||||
PERLINCL=`perl -MConfig -e 'print $Config{"archlibexp"}'`
|
PERLINCL=`$PERL -MConfig -e 'print $Config{"archlibexp"}'`
|
||||||
AC_ARG_WITH( perl-includes,
|
AC_ARG_WITH( perl-includes,
|
||||||
[ --with-perl-includes=DIR specify where to look for perl includes],
|
[ --with-perl-includes=DIR specify where to look for perl includes],
|
||||||
PERLINCL="$with_perl_includes" )
|
PERLINCL="$with_perl_includes" )
|
||||||
@ -272,7 +300,7 @@ AC_SUBST(XMHTML_INC)
|
|||||||
## If there's a better way to tackle this please let me know!
|
## If there's a better way to tackle this please let me know!
|
||||||
|
|
||||||
OLDCPPFLAGS="$CPPFLAGS"
|
OLDCPPFLAGS="$CPPFLAGS"
|
||||||
CPPFLAGS="$CPPFLAGS `$GNOME_CONFIG_BIN --cflags glib`"
|
CPPFLAGS="$CPPFLAGS `$GNOME_CONFIG_BIN --cflags gnome`"
|
||||||
|
|
||||||
|
|
||||||
# gnome targets if all goes well
|
# gnome targets if all goes well
|
||||||
@ -309,7 +337,6 @@ LDFLAGS="$OLDLDFLAGS"
|
|||||||
AC_SUBST(GNOME_TARGET)
|
AC_SUBST(GNOME_TARGET)
|
||||||
AC_SUBST(GNOME_STATIC_TARGET)
|
AC_SUBST(GNOME_STATIC_TARGET)
|
||||||
|
|
||||||
|
|
||||||
### --------------------------------------------------------------------------
|
### --------------------------------------------------------------------------
|
||||||
## Nana
|
## Nana
|
||||||
# XXX - There should probably be a --without-nana option (e.g., for
|
# XXX - There should probably be a --without-nana option (e.g., for
|
||||||
@ -495,6 +522,19 @@ AC_SUBST(GNC_RUNTIME_CONFIGDIR)
|
|||||||
ABSOLUTE_TOP_SRCDIR=`pwd`
|
ABSOLUTE_TOP_SRCDIR=`pwd`
|
||||||
AC_SUBST(ABSOLUTE_TOP_SRCDIR)
|
AC_SUBST(ABSOLUTE_TOP_SRCDIR)
|
||||||
|
|
||||||
|
### Begin i18n
|
||||||
|
|
||||||
|
AC_ARG_WITH( locale-dir,
|
||||||
|
[ --with-locale-dir=PATH specify where to look for locale-specific information],
|
||||||
|
LOCALE_DIR="$with_locale_dir",
|
||||||
|
LOCALE_DIR="$prefix/share/locale")
|
||||||
|
AC_SUBST(LOCALE_DIR)
|
||||||
|
|
||||||
|
AC_CHECK_HEADER(locale.h, ac_cv_header_locale_h=yes, ac_cv_header_locale_h=no)
|
||||||
|
AC_CAN_USE_GNU_GETTEXT
|
||||||
|
|
||||||
|
### End i18n
|
||||||
|
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
AC_OUTPUT(Makefile
|
AC_OUTPUT(Makefile
|
||||||
@ -502,6 +542,7 @@ AC_OUTPUT(Makefile
|
|||||||
src/Makefile
|
src/Makefile
|
||||||
src/engine/Makefile
|
src/engine/Makefile
|
||||||
src/guile/Makefile
|
src/guile/Makefile
|
||||||
|
src/guile/i18n.h
|
||||||
src/scm/Makefile
|
src/scm/Makefile
|
||||||
src/g-wrap/Makefile
|
src/g-wrap/Makefile
|
||||||
src/gnome/Makefile
|
src/gnome/Makefile
|
||||||
@ -513,6 +554,9 @@ AC_OUTPUT(Makefile
|
|||||||
src/reports/pathconfig.h
|
src/reports/pathconfig.h
|
||||||
src/swig/Makefile
|
src/swig/Makefile
|
||||||
src/swig/perl5/Makefile
|
src/swig/perl5/Makefile
|
||||||
|
po/Makefile.in
|
||||||
|
po/extract-macros.perl
|
||||||
|
include/messages_i18n.h
|
||||||
lib/Makefile
|
lib/Makefile
|
||||||
lib/Xbae-4.6.2-linas/Makefile
|
lib/Xbae-4.6.2-linas/Makefile
|
||||||
lib/Xbae-4.6.2-linas/src/Makefile
|
lib/Xbae-4.6.2-linas/src/Makefile
|
||||||
@ -522,4 +566,4 @@ chmod +x gnucash
|
|||||||
|
|
||||||
${MAKE-make} -f Makefile.config.finish prefix=${prefix} \
|
${MAKE-make} -f Makefile.config.finish prefix=${prefix} \
|
||||||
GNC_SHAREDIR=${GNC_SHAREDIR} \
|
GNC_SHAREDIR=${GNC_SHAREDIR} \
|
||||||
GNC_CONFIGDIR=${GNC_SHAREDIR}
|
GNC_CONFIGDIR=${GNC_SHAREDIR}
|
||||||
|
@ -75,7 +75,7 @@ motif motif.static: g-wrap-install
|
|||||||
|
|
||||||
gnome gnome.static: g-wrap-install
|
gnome gnome.static: g-wrap-install
|
||||||
|
|
||||||
qt: g-wrap-install
|
qt qt.static: g-wrap-install
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all gnome gnome.static motif motif.static qt dist
|
.PHONY: all gnome gnome.static motif motif.static qt qt.static dist
|
||||||
|
129
make-gnucash-patch
Executable file
129
make-gnucash-patch
Executable file
@ -0,0 +1,129 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# This perl script is used to make a patch for your GnuCash
|
||||||
|
# development work. All patches should be submitted to the
|
||||||
|
# mailing list gnucash-patches@gnucash.org. For more info
|
||||||
|
# consult the README.
|
||||||
|
#
|
||||||
|
# This script requires the programs 'makepatch', 'gzip',
|
||||||
|
# 'diff', and 'uuencode'.
|
||||||
|
#
|
||||||
|
# Author: Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# This section must be configured for your own setup. #
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
# The directory with the original gnucash sources
|
||||||
|
my $old = 'gnucash.pristine';
|
||||||
|
|
||||||
|
# The directory where you do your development
|
||||||
|
my $new = 'gnucash';
|
||||||
|
|
||||||
|
# The directory where the above two directories reside
|
||||||
|
my $gnc_home = '/usr/src/misc/gnc';
|
||||||
|
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# This section should not need to be modified. #
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
# Switch to the home directory
|
||||||
|
chdir $gnc_home or die "Can't cd!\n";
|
||||||
|
|
||||||
|
# Erase the old files
|
||||||
|
unlink('gnc.diff', 'gnucash.diff.gz', 'gnucash.diff.gz.uue');
|
||||||
|
|
||||||
|
# Start out with our basic makepatch arguments
|
||||||
|
my @args = ('-diff', 'diff -u', '-exclude-vc');
|
||||||
|
|
||||||
|
# Add in the exclude patterns from the __DATA__ section
|
||||||
|
foreach my $pat (<DATA>) {
|
||||||
|
chomp($pat);
|
||||||
|
push(@args, '-exclude', $pat) if $pat;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add the from and to directories for makepatch
|
||||||
|
push(@args, $old, $new);
|
||||||
|
|
||||||
|
# Invoke makepatch with standard out redirected to 'gnucash.diff'
|
||||||
|
open(OLDOUT, ">&STDOUT");
|
||||||
|
open(STDOUT, "> gnucash.diff") || die "Can't redirect stdout";
|
||||||
|
system('makepatch', @args);
|
||||||
|
close(STDOUT);
|
||||||
|
open(STDOUT, ">&OLDOUT");
|
||||||
|
|
||||||
|
# Make a copy of the ascii diff in 'gnc.diff'
|
||||||
|
system('cp gnucash.diff gnc.diff');
|
||||||
|
|
||||||
|
# Compress the patch
|
||||||
|
system('gzip -9vf gnucash.diff');
|
||||||
|
|
||||||
|
# UU encode the compressed patch
|
||||||
|
# 'gnucash.diff.gz.uue' is the file you send.
|
||||||
|
system('uuencode gnucash.diff.gz gnucash.diff.gz > gnucash.diff.gz.uue');
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
__DATA__
|
||||||
|
|
||||||
|
obj
|
||||||
|
g-wrap-install
|
||||||
|
Makefile
|
||||||
|
Makefile.init
|
||||||
|
config.cache
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
config.h
|
||||||
|
*.tar.gz
|
||||||
|
*.log
|
||||||
|
*.bin
|
||||||
|
*.patch
|
||||||
|
*.diff
|
||||||
|
*.diffs
|
||||||
|
xacc
|
||||||
|
*.xac.*.xac
|
||||||
|
errs*
|
||||||
|
.#*
|
||||||
|
TAGS
|
||||||
|
#*#
|
||||||
|
libtool
|
||||||
|
conf.h
|
||||||
|
stamp-h
|
||||||
|
configure
|
||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
*.i
|
||||||
|
gnucash.pm
|
||||||
|
gnucash-engine-perl5_wrap.c
|
||||||
|
g-wrap-guile
|
||||||
|
libgwrapguile.la
|
||||||
|
gnc-autogen.h
|
||||||
|
src/g-wrap/gnc.c
|
||||||
|
src/g-wrap/gnc.h
|
||||||
|
src/g-wrap/gnc.html
|
||||||
|
src/guile/gnucash.h
|
||||||
|
src/scm/bootstrap.scm
|
||||||
|
src/swig/perl5/gnucash.engine_wrap.doc
|
||||||
|
g-wrap.info
|
||||||
|
lib/g-wrap/Makefile.in
|
||||||
|
lib/g-wrap/rscheme/g-wrap-rs
|
||||||
|
src/quotes/gnc-prices
|
||||||
|
gtksheet*
|
||||||
|
*.wrap
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
|
src/reports/pathconfig.h
|
||||||
|
*.moc
|
||||||
|
*.gmo
|
||||||
|
*.mo
|
||||||
|
po/Makefile.in
|
||||||
|
POTFILES
|
||||||
|
cat-id-tbl.c
|
||||||
|
gnucash.pot
|
||||||
|
po/pseudo-source.c
|
||||||
|
stamp-cat-id
|
||||||
|
po/extract-macros.perl
|
||||||
|
include/messages_i18n.h
|
||||||
|
lib/g-wrap/aclocal.m4
|
32
mkinstalldirs
Executable file
32
mkinstalldirs
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# mkinstalldirs --- make directory hierarchy
|
||||||
|
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||||
|
# Created: 1993-05-16
|
||||||
|
# Last modified: 1994-03-25
|
||||||
|
# Public domain
|
||||||
|
|
||||||
|
errstatus=0
|
||||||
|
|
||||||
|
for file in ${1+"$@"} ; do
|
||||||
|
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||||
|
shift
|
||||||
|
|
||||||
|
pathcomp=
|
||||||
|
for d in ${1+"$@"} ; do
|
||||||
|
pathcomp="$pathcomp$d"
|
||||||
|
case "$pathcomp" in
|
||||||
|
-* ) pathcomp=./$pathcomp ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
echo "mkdir $pathcomp" 1>&2
|
||||||
|
mkdir "$pathcomp" || errstatus=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="$pathcomp/"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $errstatus
|
||||||
|
|
||||||
|
# mkinstalldirs ends here
|
@ -70,13 +70,13 @@ gnome gnome.static: ${GNOME_OBJS}
|
|||||||
@cd guile; $(MAKE) default
|
@cd guile; $(MAKE) default
|
||||||
@cd gnome; $(MAKE) $@
|
@cd gnome; $(MAKE) $@
|
||||||
|
|
||||||
qt: $(QT_OBJS)
|
qt qt.static: $(QT_OBJS)
|
||||||
@cd engine; $(MAKE) default
|
@cd engine; $(MAKE) default
|
||||||
@cd register; $(MAKE) qt
|
@cd register; $(MAKE) qt
|
||||||
@cd reports; $(MAKE) default
|
@cd reports; $(MAKE) default
|
||||||
@cd g-wrap; $(MAKE) qt
|
@cd g-wrap; $(MAKE) qt
|
||||||
@cd swig; $(MAKE) qt
|
@cd swig; $(MAKE) qt
|
||||||
@cd guile; $(MAKE) default
|
@cd guile; $(MAKE) default
|
||||||
@cd qt; $(MAKE) qt
|
@cd qt; $(MAKE) $@
|
||||||
|
|
||||||
.PHONY: default qt gnome gnome.static motif motif.static all
|
.PHONY: default qt qt.static gnome gnome.static motif motif.static all
|
||||||
|
@ -54,7 +54,7 @@ static short module = MOD_LEDGER;
|
|||||||
* present a rather natural place for the locks to be placed. *
|
* present a rather natural place for the locks to be placed. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
int
|
static int
|
||||||
ledgerListCount (xaccLedgerDisplay **list)
|
ledgerListCount (xaccLedgerDisplay **list)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
@ -65,7 +65,7 @@ ledgerListCount (xaccLedgerDisplay **list)
|
|||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
xaccLedgerDisplay **
|
static xaccLedgerDisplay **
|
||||||
ledgerListAdd (xaccLedgerDisplay **oldlist, xaccLedgerDisplay *addreg)
|
ledgerListAdd (xaccLedgerDisplay **oldlist, xaccLedgerDisplay *addreg)
|
||||||
{
|
{
|
||||||
xaccLedgerDisplay **newlist;
|
xaccLedgerDisplay **newlist;
|
||||||
@ -95,7 +95,7 @@ ledgerListAdd (xaccLedgerDisplay **oldlist, xaccLedgerDisplay *addreg)
|
|||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
void
|
static void
|
||||||
ledgerListRemove (xaccLedgerDisplay **list, xaccLedgerDisplay *delreg)
|
ledgerListRemove (xaccLedgerDisplay **list, xaccLedgerDisplay *delreg)
|
||||||
{
|
{
|
||||||
int n, i;
|
int n, i;
|
||||||
@ -273,6 +273,20 @@ xaccLedgerDisplayAccGroup (Account *acc)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gncUIWidget
|
||||||
|
xaccLedgerDisplayParent(void *user_data)
|
||||||
|
{
|
||||||
|
xaccLedgerDisplay *regData = user_data;
|
||||||
|
|
||||||
|
if (regData == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (regData->get_parent == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return (regData->get_parent)(regData);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* xaccLedgerDisplayLedger *
|
* xaccLedgerDisplayLedger *
|
||||||
* opens up a ledger window for a list of accounts *
|
* opens up a ledger window for a list of accounts *
|
||||||
@ -325,6 +339,7 @@ xaccLedgerDisplayGeneral (Account *lead_acc, Account **acclist, int ledger_type)
|
|||||||
regData->leader = lead_acc;
|
regData->leader = lead_acc;
|
||||||
regData->redraw = NULL;
|
regData->redraw = NULL;
|
||||||
regData->destroy = NULL;
|
regData->destroy = NULL;
|
||||||
|
regData->get_parent = NULL;
|
||||||
regData->gui_hook = NULL;
|
regData->gui_hook = NULL;
|
||||||
regData->dirty = 0;
|
regData->dirty = 0;
|
||||||
regData->balance = 0.0;
|
regData->balance = 0.0;
|
||||||
@ -358,6 +373,8 @@ xaccLedgerDisplayGeneral (Account *lead_acc, Account **acclist, int ledger_type)
|
|||||||
* but will not do the gui init */
|
* but will not do the gui init */
|
||||||
regData->ledger = xaccMallocSplitRegister (ledger_type);
|
regData->ledger = xaccMallocSplitRegister (ledger_type);
|
||||||
|
|
||||||
|
xaccSRSetData(regData->ledger, regData, xaccLedgerDisplayParent);
|
||||||
|
|
||||||
regData->dirty = 1;
|
regData->dirty = 1;
|
||||||
xaccLedgerDisplayRefresh (regData);
|
xaccLedgerDisplayRefresh (regData);
|
||||||
|
|
||||||
@ -384,8 +401,8 @@ xaccLedgerDisplayRefresh (xaccLedgerDisplay *regData)
|
|||||||
* new splits and get them into the system.
|
* new splits and get them into the system.
|
||||||
*/
|
*/
|
||||||
xaccSRLoadRegister (regData->ledger,
|
xaccSRLoadRegister (regData->ledger,
|
||||||
xaccQueryGetSplits (regData->query),
|
xaccQueryGetSplits (regData->query),
|
||||||
regData->leader);
|
regData->leader);
|
||||||
|
|
||||||
|
|
||||||
/* hack alert -- this computation of totals is incorrect
|
/* hack alert -- this computation of totals is incorrect
|
||||||
@ -462,31 +479,6 @@ xaccRegisterRefresh (SplitRegister *splitreg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
|
||||||
* sort of a quick hack involving the layout of the register.
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
xaccRegisterCountHack (SplitRegister *splitreg)
|
|
||||||
{
|
|
||||||
xaccLedgerDisplay *regData;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
if (!fullList) return;
|
|
||||||
|
|
||||||
/* find the ledger which contains this register */
|
|
||||||
n = 0; regData = fullList[n];
|
|
||||||
while (regData) {
|
|
||||||
if (splitreg == regData->ledger) {
|
|
||||||
xaccSRCountRows (splitreg,
|
|
||||||
xaccQueryGetSplits (regData->query),
|
|
||||||
regData->leader);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
n++; regData = fullList[n];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* mark dirty *all* register windows which contain this account *
|
* mark dirty *all* register windows which contain this account *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
@ -71,6 +71,7 @@ struct _xaccLedgerDisplay {
|
|||||||
void *gui_hook; /* GUI-specific state */
|
void *gui_hook; /* GUI-specific state */
|
||||||
void (*redraw) (xaccLedgerDisplay *); /* redraw callback */
|
void (*redraw) (xaccLedgerDisplay *); /* redraw callback */
|
||||||
void (*destroy) (xaccLedgerDisplay *); /* destroy callback */
|
void (*destroy) (xaccLedgerDisplay *); /* destroy callback */
|
||||||
|
gncUIWidget (*get_parent) (xaccLedgerDisplay *); /* get parent widget */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -132,12 +133,9 @@ int ledgerIsMember (xaccLedgerDisplay *reg, Account * acc);
|
|||||||
*/
|
*/
|
||||||
void xaccLedgerDisplayClose (xaccLedgerDisplay *);
|
void xaccLedgerDisplayClose (xaccLedgerDisplay *);
|
||||||
|
|
||||||
/********************************************************************\
|
/*
|
||||||
* sort of a quick hack involving the layout of the register.
|
* close all ledger windows containing this account.
|
||||||
\********************************************************************/
|
*/
|
||||||
|
|
||||||
void xaccRegisterCountHack (SplitRegister *splitreg);
|
|
||||||
|
|
||||||
void xaccDestroyLedgerDisplay (Account *acc);
|
void xaccDestroyLedgerDisplay (Account *acc);
|
||||||
|
|
||||||
#endif /* __MULTI_LEDGER_H__ */
|
#endif /* __MULTI_LEDGER_H__ */
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* =====================================================================
|
* =====================================================================
|
||||||
* Some notes on Commit/Rollback:
|
* Some notes on Commit/Rollback:
|
||||||
*
|
*
|
||||||
* There's an engine compnenent and a gui componenet to the commit/rollback
|
* There's an engine component and a gui component to the commit/rollback
|
||||||
* scheme. On the engine side, one must always call BeginEdit()
|
* scheme. On the engine side, one must always call BeginEdit()
|
||||||
* before starting to edit a transaction. When you think you're done,
|
* before starting to edit a transaction. When you think you're done,
|
||||||
* you can call CommitEdit() to commit the changes, or RollbackEdit() to
|
* you can call CommitEdit() to commit the changes, or RollbackEdit() to
|
||||||
@ -50,14 +50,14 @@
|
|||||||
* Some notes on Reloads & Redraws:
|
* Some notes on Reloads & Redraws:
|
||||||
*
|
*
|
||||||
* Reloads and redraws tend to be heavyweight. We try to use change flags
|
* Reloads and redraws tend to be heavyweight. We try to use change flags
|
||||||
* as much as possible in this code, but imagine the following senario:
|
* as much as possible in this code, but imagine the following scenario:
|
||||||
*
|
*
|
||||||
* Create two bank accounts. Transfer money from one to the other.
|
* Create two bank accounts. Transfer money from one to the other.
|
||||||
* Open two registers, showing each account. Change the amount in one window.
|
* 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.
|
* Note that the other window also redraws, to show the new correct amount.
|
||||||
*
|
*
|
||||||
* Since you changed an amount value, potentially *all* displayed balances change
|
* Since you changed an amount value, potentially *all* displayed balances change
|
||||||
* in *both* register windows (as well as the leger balance in the main window).
|
* 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,
|
* 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
|
* 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
|
* old paycheck)... changing a date might even cause all entries in all three
|
||||||
@ -89,7 +89,6 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
@ -119,6 +118,12 @@ struct _SRInfo
|
|||||||
|
|
||||||
/* The default account where new splits are added */
|
/* The default account where new splits are added */
|
||||||
Account *default_source_account;
|
Account *default_source_account;
|
||||||
|
|
||||||
|
/* User data for users of SplitRegisters */
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
|
/* hook to get parent widget */
|
||||||
|
gncUIWidget (*get_parent) (void * user_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -130,7 +135,7 @@ struct _SRInfo
|
|||||||
* If this flag is set, then any new split will be put into
|
* If this flag is set, then any new split will be put into
|
||||||
* the leader account. What happens visually is that it appears
|
* the leader account. What happens visually is that it appears
|
||||||
* as if there are two transactions, one debiting and one crediting
|
* as if there are two transactions, one debiting and one crediting
|
||||||
* this acount by exactly the same amount. Thus, the user is forced
|
* this account by exactly the same amount. Thus, the user is forced
|
||||||
* to deal with this somewhat nutty situation.
|
* to deal with this somewhat nutty situation.
|
||||||
*
|
*
|
||||||
* If this flag is *not* set, then the split just sort of
|
* If this flag is *not* set, then the split just sort of
|
||||||
@ -147,6 +152,12 @@ static int force_double_entry_awareness = 0;
|
|||||||
/* 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_LEDGER;
|
static short module = MOD_LEDGER;
|
||||||
|
|
||||||
|
|
||||||
|
/* static prototypes */
|
||||||
|
static Transaction * xaccSRGetTrans (SplitRegister *reg,
|
||||||
|
int phys_row, int phys_col);
|
||||||
|
|
||||||
|
|
||||||
/* The routines below create, access, and destroy the SRInfo structure
|
/* The routines below create, access, and destroy the SRInfo structure
|
||||||
* used by SplitLedger routines to store data for a particular register.
|
* used by SplitLedger routines to store data for a particular register.
|
||||||
* This is the only code that should access the user_data member of a
|
* This is the only code that should access the user_data member of a
|
||||||
@ -184,6 +195,31 @@ xaccSRGetInfo(SplitRegister *reg)
|
|||||||
return (SRInfo *) reg->user_data;
|
return (SRInfo *) reg->user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gncUIWidget
|
||||||
|
xaccSRGetParent(SplitRegister *reg)
|
||||||
|
{
|
||||||
|
SRInfo *info = xaccSRGetInfo(reg);
|
||||||
|
|
||||||
|
assert(reg != NULL);
|
||||||
|
|
||||||
|
if (info->get_parent == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return (info->get_parent)(info->user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xaccSRSetData(SplitRegister *reg, void *user_data,
|
||||||
|
SRGetParentCallback get_parent)
|
||||||
|
{
|
||||||
|
SRInfo *info = xaccSRGetInfo(reg);
|
||||||
|
|
||||||
|
assert(reg != NULL);
|
||||||
|
|
||||||
|
info->user_data = user_data;
|
||||||
|
info->get_parent = get_parent;
|
||||||
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
/* this callback gets called when the user clicks on the gui
|
/* this callback gets called when the user clicks on the gui
|
||||||
* in such a way as to leave the current transaction, and to
|
* in such a way as to leave the current transaction, and to
|
||||||
@ -215,19 +251,15 @@ LedgerMoveCursor (Table *table,
|
|||||||
int new_phys_row = *p_new_phys_row;
|
int new_phys_row = *p_new_phys_row;
|
||||||
int new_phys_col = *p_new_phys_col;
|
int new_phys_col = *p_new_phys_col;
|
||||||
SplitRegister *reg = (SplitRegister *) client_data;
|
SplitRegister *reg = (SplitRegister *) client_data;
|
||||||
SRInfo *info = xaccSRGetInfo(reg);
|
|
||||||
Transaction *newtrans = NULL;
|
Transaction *newtrans = NULL;
|
||||||
Locator *locator;
|
Locator *locator;
|
||||||
Split *split;
|
|
||||||
int style;
|
int style;
|
||||||
|
|
||||||
PINFO ("LedgerMoveCursor(): start calback %d %d \n",
|
PINFO ("LedgerMoveCursor(): start callback %d %d \n",
|
||||||
new_phys_row, new_phys_col);
|
new_phys_row, new_phys_col);
|
||||||
|
|
||||||
/* The split where we are moving to */
|
/* The transaction where we are moving to */
|
||||||
split = xaccGetUserData (reg->table, new_phys_row, new_phys_col);
|
newtrans = xaccSRGetTrans(reg, new_phys_row, new_phys_col);
|
||||||
if (split != NULL)
|
|
||||||
newtrans = xaccSplitGetParent(split);
|
|
||||||
|
|
||||||
/* commit the contents of the cursor into the database */
|
/* commit the contents of the cursor into the database */
|
||||||
xaccSRSaveRegEntry (reg, newtrans);
|
xaccSRSaveRegEntry (reg, newtrans);
|
||||||
@ -237,38 +269,35 @@ LedgerMoveCursor (Table *table,
|
|||||||
new_phys_row, new_phys_col);
|
new_phys_row, new_phys_col);
|
||||||
|
|
||||||
reg->cursor_phys_row = new_phys_row;
|
reg->cursor_phys_row = new_phys_row;
|
||||||
|
reg->cursor_phys_col = new_phys_col;
|
||||||
|
|
||||||
locator = table->locators[new_phys_row][new_phys_col];
|
locator = table->locators[new_phys_row][new_phys_col];
|
||||||
reg->cursor_virt_row = locator->virt_row;
|
reg->cursor_virt_row = locator->virt_row;
|
||||||
|
|
||||||
/* if auto-expansion is enabled, we need to redraw the register
|
/* if auto-expansion is enabled, we need to redraw the register
|
||||||
* to expand out the splits at the new location. We do some
|
* to expand out the splits at the new location. We do some
|
||||||
* tomfoolery here to trick the code into expanding the new location.
|
* tomfoolery here to trick the code into expanding the new location.
|
||||||
* This little futz is sleazy, but it does suceed in getting the
|
* This little futz is sleazy, but it does succeed in getting the
|
||||||
* LoadRegister code into expanding the appropriate split.
|
* LoadRegister code into expanding the appropriate split.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
style = ((reg->type) & REG_STYLE_MASK);
|
style = ((reg->type) & REG_STYLE_MASK);
|
||||||
if ((REG_SINGLE_DYNAMIC == style) ||
|
if ((REG_SINGLE_DYNAMIC == style) ||
|
||||||
(REG_DOUBLE_DYNAMIC == style))
|
(REG_DOUBLE_DYNAMIC == style))
|
||||||
{
|
{
|
||||||
Split *split, *oldsplit;
|
Split *split;
|
||||||
oldsplit = xaccSRGetCurrentSplit (reg);
|
|
||||||
split = xaccGetUserData (reg->table, new_phys_row, new_phys_col);
|
split = xaccGetUserData (reg->table, new_phys_row, new_phys_col);
|
||||||
reg->table->current_cursor->user_data = (void *) split;
|
reg->table->current_cursor->user_data = (void *) split;
|
||||||
|
|
||||||
/* if a null split, provide a hint for where the cursor should go */
|
|
||||||
if (NULL == split) {
|
|
||||||
reg->cursor_phys_row = new_phys_row;
|
|
||||||
// reg->cursor_virt_row = reg->table->current_cursor_virt_row;
|
|
||||||
info->cursor_hint_trans = xaccSplitGetParent (oldsplit);
|
|
||||||
}
|
|
||||||
xaccRegisterRefresh (reg);
|
xaccRegisterRefresh (reg);
|
||||||
gnc_refresh_main_window();
|
gnc_refresh_main_window();
|
||||||
|
|
||||||
/* indicate what row we *should* have gone to */
|
/* indicate what row we *should* have gone to */
|
||||||
*p_new_phys_row = table->current_cursor_phys_row;
|
*p_new_phys_row = table->current_cursor_phys_row;
|
||||||
|
*p_new_phys_col = table->current_cursor_phys_col;
|
||||||
|
|
||||||
PINFO ("LedgerMoveCursor(): after dynamic %d %d stored val %d\n",
|
PINFO ("LedgerMoveCursor(): after dynamic %d %d stored val %d\n",
|
||||||
*p_new_phys_row, new_phys_col, reg->cursor_phys_row);
|
*p_new_phys_row, *p_new_phys_col, reg->cursor_phys_row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,61 +314,65 @@ LedgerTraverse (Table *table,
|
|||||||
int *p_new_phys_col,
|
int *p_new_phys_col,
|
||||||
void * client_data)
|
void * client_data)
|
||||||
{
|
{
|
||||||
int new_phys_row = *p_new_phys_row;
|
#ifdef GNOME
|
||||||
int new_phys_col = *p_new_phys_col;
|
static const char *message =
|
||||||
SplitRegister *reg = (SplitRegister *) client_data;
|
"You have made changes to the current transaction.\n"
|
||||||
SRInfo *info = xaccSRGetInfo(reg);
|
"Do you want to record your changes?";
|
||||||
int style;
|
|
||||||
|
|
||||||
/* For now, just do nothing. The auto mode handling is done entirely
|
SplitRegister *reg = client_data;
|
||||||
* by LedgerMoveCursor above. */
|
SRInfo *info = xaccSRGetInfo(reg);
|
||||||
return;
|
Transaction *trans, *new_trans;
|
||||||
|
int phys_row = *p_new_phys_row;
|
||||||
|
int phys_col = *p_new_phys_col;
|
||||||
|
int virt_row, virt_col;
|
||||||
|
unsigned int changed;
|
||||||
|
GNCVerifyResult result;
|
||||||
|
|
||||||
/* if auto-expansion is enabled, we need to redraw the register
|
trans = xaccSRGetCurrentTrans(reg);
|
||||||
* to expand out the splits at the new location. We do some
|
if (trans == NULL)
|
||||||
* tomfoolery here to trick the code into expanding the new location.
|
return;
|
||||||
* This little futz is sleazy, but it does suceed in getting the
|
|
||||||
* LoadRegister code into expanding the appropriate split.
|
|
||||||
*/
|
|
||||||
style = ((reg->type) & REG_STYLE_MASK);
|
|
||||||
if ((REG_SINGLE_DYNAMIC == style) ||
|
|
||||||
(REG_DOUBLE_DYNAMIC == style))
|
|
||||||
{
|
|
||||||
Split *split, *oldsplit;
|
|
||||||
int save_num_phys_rows, save_num_virt_rows;
|
|
||||||
int save_cursor_phys_row, save_cursor_virt_row;
|
|
||||||
|
|
||||||
/* Save the values that xaccSRCountRows will futz up */
|
/* no changes, no worries */
|
||||||
save_num_phys_rows = reg->num_phys_rows;
|
changed = xaccSplitRegisterGetChangeFlag(reg);
|
||||||
save_num_virt_rows = reg->num_virt_rows;
|
if (!changed && (info->pending_trans != trans))
|
||||||
save_cursor_phys_row = reg->cursor_phys_row;
|
return;
|
||||||
save_cursor_virt_row = reg->cursor_virt_row;
|
|
||||||
|
|
||||||
ENTER ("LedgerTraverse with %d %d \n", new_phys_row , new_phys_col);
|
/* Now see if we are changing cursors. If not, no problems */
|
||||||
oldsplit = xaccSRGetCurrentSplit (reg);
|
if ((phys_row >= 0) && (phys_col >= 0) &&
|
||||||
split = xaccGetUserData (reg->table, new_phys_row, new_phys_col);
|
(phys_row < table->num_phys_rows) && (phys_col < table->num_phys_cols))
|
||||||
reg->table->current_cursor->user_data = (void *) split;
|
{
|
||||||
|
virt_row = table->locators[phys_row][phys_col]->virt_row;
|
||||||
|
virt_col = table->locators[phys_row][phys_col]->virt_col;
|
||||||
|
|
||||||
/* if a null split, provide a hint for where the cursor should go */
|
if ((virt_row == table->current_cursor_virt_row) &&
|
||||||
if (NULL == split) {
|
(virt_col == table->current_cursor_virt_col))
|
||||||
reg->cursor_phys_row = new_phys_row;
|
return;
|
||||||
// reg->cursor_virt_row = reg->table->current_cursor_virt_row;
|
}
|
||||||
info->cursor_hint_trans = xaccSplitGetParent (oldsplit);
|
|
||||||
}
|
|
||||||
|
|
||||||
xaccRegisterCountHack (reg);
|
/* Same transaction, no problem */
|
||||||
reg->table->current_cursor->user_data = (void *) oldsplit;
|
new_trans = xaccSRGetTrans(reg, phys_row, phys_col);
|
||||||
|
if (trans == new_trans)
|
||||||
|
return;
|
||||||
|
|
||||||
LEAVE ("LedgerTraverse with %d \n", reg->cursor_phys_row);
|
/* Ok, we are changing transactions and the current transaction has
|
||||||
/* indicate what row we *should* go to */
|
* changed. See what the user wants to do. */
|
||||||
*p_new_phys_row = reg->cursor_phys_row;
|
|
||||||
|
|
||||||
/* Restore the values */
|
result = gnc_verify_cancel_dialog_parented(xaccSRGetParent(reg),
|
||||||
reg->num_phys_rows = save_num_phys_rows;
|
message, GNC_VERIFY_YES);
|
||||||
reg->num_virt_rows = save_num_virt_rows;
|
|
||||||
reg->cursor_phys_row = save_cursor_phys_row;
|
switch (result)
|
||||||
reg->cursor_virt_row = save_cursor_virt_row;
|
{
|
||||||
}
|
case GNC_VERIFY_NO:
|
||||||
|
xaccSRCancelCursorTransChanges(reg);
|
||||||
|
break;
|
||||||
|
case GNC_VERIFY_CANCEL:
|
||||||
|
*p_new_phys_row = table->current_cursor_phys_row;
|
||||||
|
*p_new_phys_col = table->current_cursor_phys_col;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
@ -381,6 +414,42 @@ LedgerDestroy (SplitRegister *reg)
|
|||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
|
|
||||||
|
static Transaction *
|
||||||
|
xaccSRGetTrans (SplitRegister *reg, int phys_row, int phys_col)
|
||||||
|
{
|
||||||
|
Split *split;
|
||||||
|
int vr, vc;
|
||||||
|
|
||||||
|
if ((phys_row < 0) || (phys_col < 0) ||
|
||||||
|
(phys_row >= reg->table->num_phys_rows) ||
|
||||||
|
(phys_col >= reg->table->num_phys_cols))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
split = xaccGetUserData(reg->table, phys_row, phys_col);
|
||||||
|
if (split != NULL)
|
||||||
|
return xaccSplitGetParent(split);
|
||||||
|
|
||||||
|
/* Split is blank. Assume it is the blank split of a multi-line
|
||||||
|
* transaction. Go back one row to find a split in the transaction. */
|
||||||
|
vr = reg->table->locators[phys_row][phys_col]->virt_row;
|
||||||
|
vc = reg->table->locators[phys_row][phys_col]->virt_col;
|
||||||
|
vr --;
|
||||||
|
if ((0 > vr) || (0 > vc)) {
|
||||||
|
PERR ("Internal Error: xaccSRGetTrans(): bad row \n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
split = (Split *) reg->table->user_data[vr][vc];
|
||||||
|
if (split == NULL) {
|
||||||
|
PERR ("Internal Error: xaccSRGetTrans(): no parent \n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return xaccSplitGetParent(split);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ======================================================== */
|
||||||
|
|
||||||
Transaction *
|
Transaction *
|
||||||
xaccSRGetCurrentTrans (SplitRegister *reg)
|
xaccSRGetCurrentTrans (SplitRegister *reg)
|
||||||
{
|
{
|
||||||
@ -400,13 +469,13 @@ xaccSRGetCurrentTrans (SplitRegister *reg)
|
|||||||
vc = reg->table->locators[pr][pc]->virt_col;
|
vc = reg->table->locators[pr][pc]->virt_col;
|
||||||
vr --;
|
vr --;
|
||||||
if ((0 > vr) || (0 > vc)) {
|
if ((0 > vr) || (0 > vc)) {
|
||||||
PERR ("Internal Error: SaveRegEntry(): bad row \n");
|
PERR ("Internal Error: xaccSRGetCurrentTrans(): bad row \n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
split = (Split *) reg->table->user_data[vr][vc];
|
split = (Split *) reg->table->user_data[vr][vc];
|
||||||
if (split == NULL) {
|
if (split == NULL) {
|
||||||
PERR ("Internal Error: SaveRegEntry(): no parent \n");
|
PERR ("Internal Error: xaccSRGetCurrentTrans(): no parent \n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -685,6 +754,8 @@ xaccSRCancelCursorSplitChanges (SplitRegister *reg)
|
|||||||
{
|
{
|
||||||
Split * split;
|
Split * split;
|
||||||
unsigned int changed;
|
unsigned int changed;
|
||||||
|
int row = reg->cursor_phys_row;
|
||||||
|
int col = reg->cursor_phys_col;
|
||||||
|
|
||||||
changed = xaccSplitRegisterGetChangeFlag(reg);
|
changed = xaccSplitRegisterGetChangeFlag(reg);
|
||||||
if (!changed)
|
if (!changed)
|
||||||
@ -694,8 +765,12 @@ xaccSRCancelCursorSplitChanges (SplitRegister *reg)
|
|||||||
/* When cancelling edits, reload the cursor from the transaction */
|
/* When cancelling edits, reload the cursor from the transaction */
|
||||||
split = xaccSRGetCurrentSplit(reg);
|
split = xaccSRGetCurrentSplit(reg);
|
||||||
xaccSRLoadRegEntry(reg, split);
|
xaccSRLoadRegEntry(reg, split);
|
||||||
xaccRefreshTableGUI(reg->table);
|
|
||||||
xaccSplitRegisterClearChangeFlag(reg);
|
xaccSplitRegisterClearChangeFlag(reg);
|
||||||
|
|
||||||
|
if (gnc_table_find_valid_cell_horiz(reg->table, &row, &col, GNC_F))
|
||||||
|
xaccMoveCursorGUI(reg->table, row, col);
|
||||||
|
|
||||||
|
xaccRefreshTableGUI(reg->table);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
@ -760,7 +835,6 @@ xaccSRCancelCursorTransChanges (SplitRegister *reg)
|
|||||||
void
|
void
|
||||||
xaccSRRedrawRegEntry (SplitRegister *reg)
|
xaccSRRedrawRegEntry (SplitRegister *reg)
|
||||||
{
|
{
|
||||||
Split *split;
|
|
||||||
Transaction *trans;
|
Transaction *trans;
|
||||||
unsigned int changed;
|
unsigned int changed;
|
||||||
|
|
||||||
@ -769,8 +843,7 @@ xaccSRRedrawRegEntry (SplitRegister *reg)
|
|||||||
changed = xaccSplitRegisterGetChangeFlag (reg);
|
changed = xaccSplitRegisterGetChangeFlag (reg);
|
||||||
if (!changed) return;
|
if (!changed) return;
|
||||||
|
|
||||||
split = xaccSRGetCurrentSplit (reg);
|
trans = xaccSRGetCurrentTrans (reg);
|
||||||
trans = xaccSplitGetParent (split);
|
|
||||||
|
|
||||||
/* refresh the register windows */
|
/* refresh the register windows */
|
||||||
/* This split belongs to a transaction that might be displayed
|
/* This split belongs to a transaction that might be displayed
|
||||||
@ -1077,17 +1150,17 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
|
|||||||
double amt;
|
double amt;
|
||||||
char * accname=NULL;
|
char * accname=NULL;
|
||||||
Transaction *trans = xaccSplitGetParent (split);
|
Transaction *trans = xaccSplitGetParent (split);
|
||||||
|
|
||||||
secs = xaccTransGetDateL (trans);
|
secs = xaccTransGetDateL (trans);
|
||||||
xaccSetDateCellValueSecsL (reg->dateCell, secs);
|
xaccSetDateCellValueSecsL (reg->dateCell, secs);
|
||||||
|
|
||||||
xaccSetBasicCellValue (reg->numCell, xaccTransGetNum (trans));
|
xaccSetBasicCellValue (reg->numCell, xaccTransGetNum (trans));
|
||||||
xaccSetQuickFillCellValue (reg->descCell, xaccTransGetDescription (trans));
|
xaccSetQuickFillCellValue (reg->descCell, xaccTransGetDescription (trans));
|
||||||
|
|
||||||
buff[0] = xaccSplitGetReconcile (split);
|
buff[0] = xaccSplitGetReconcile (split);
|
||||||
buff[1] = 0x0;
|
buff[1] = 0x0;
|
||||||
xaccSetBasicCellValue (reg->recnCell, buff);
|
xaccSetBasicCellValue (reg->recnCell, buff);
|
||||||
|
|
||||||
/* For income and expense acounts, we have to reverse
|
/* For income and expense acounts, we have to reverse
|
||||||
* the meaning of balance, since, in a dual entry
|
* the meaning of balance, since, in a dual entry
|
||||||
* system, income will show up as a credit to a
|
* system, income will show up as a credit to a
|
||||||
@ -1099,7 +1172,7 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
|
|||||||
baln = -baln;
|
baln = -baln;
|
||||||
}
|
}
|
||||||
xaccSetPriceCellValue (reg->balanceCell, baln);
|
xaccSetPriceCellValue (reg->balanceCell, baln);
|
||||||
|
|
||||||
xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split));
|
xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split));
|
||||||
|
|
||||||
xaccSetComboCellValue (reg->actionCell, xaccSplitGetAction (split));
|
xaccSetComboCellValue (reg->actionCell, xaccSplitGetAction (split));
|
||||||
@ -1162,51 +1235,24 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
|
|||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
|
|
||||||
#define xaccSRLoadSplitEntry xaccSRLoadTransEntry
|
|
||||||
|
|
||||||
#ifdef LATER
|
|
||||||
static void
|
|
||||||
xaccSRLoadSplitEntry (SplitRegister *reg, Split *split, int do_commit)
|
|
||||||
{
|
|
||||||
char buff[2];
|
|
||||||
|
|
||||||
if (!split) {
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
|
|
||||||
reg->table->current_cursor->user_data = (void *) split;
|
|
||||||
|
|
||||||
/* copy cursor contents into the table */
|
|
||||||
if (do_commit) {
|
|
||||||
xaccCommitCursor (reg->table);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ======================================================== */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccSRLoadRegEntry (SplitRegister *reg, Split *split)
|
xaccSRLoadRegEntry (SplitRegister *reg, Split *split)
|
||||||
{
|
{
|
||||||
xaccSRLoadTransEntry (reg, split, 0);
|
xaccSRLoadTransEntry (reg, split, GNC_T);
|
||||||
|
|
||||||
/* copy cursor contents into the table */
|
|
||||||
xaccCommitCursor (reg->table);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
|
|
||||||
void
|
static void
|
||||||
xaccSRCountRows (SplitRegister *reg, Split **slist,
|
xaccSRCountRows (SplitRegister *reg, Split **slist)
|
||||||
Account *default_source_acc)
|
|
||||||
{
|
{
|
||||||
SRInfo *info = xaccSRGetInfo(reg);
|
SRInfo *info = xaccSRGetInfo(reg);
|
||||||
int i;
|
int i;
|
||||||
Split *split = NULL;
|
Split *split = NULL;
|
||||||
Split *save_current_split = NULL;
|
Split *save_current_split = NULL;
|
||||||
Transaction *save_current_trans = NULL;
|
Transaction *save_current_trans = NULL;
|
||||||
int save_cursor_phys_row = -1;
|
int save_cursor_phys_row;
|
||||||
int save_cursor_virt_row = -1;
|
int save_cursor_virt_row;
|
||||||
Table *table;
|
Table *table;
|
||||||
int num_phys_rows;
|
int num_phys_rows;
|
||||||
int num_virt_rows;
|
int num_virt_rows;
|
||||||
@ -1281,7 +1327,7 @@ xaccSRCountRows (SplitRegister *reg, Split **slist,
|
|||||||
do_expand = multi_line;
|
do_expand = multi_line;
|
||||||
do_expand = do_expand ||
|
do_expand = do_expand ||
|
||||||
(dynamic && xaccIsPeerSplit(split,save_current_split));
|
(dynamic && xaccIsPeerSplit(split,save_current_split));
|
||||||
if (NULL == save_current_split) {
|
if (dynamic && (NULL == save_current_split)) {
|
||||||
trans = xaccSplitGetParent (split);
|
trans = xaccSplitGetParent (split);
|
||||||
do_expand = do_expand || (trans == info->cursor_hint_trans);
|
do_expand = do_expand || (trans == info->cursor_hint_trans);
|
||||||
}
|
}
|
||||||
@ -1362,16 +1408,15 @@ xaccSRCountRows (SplitRegister *reg, Split **slist,
|
|||||||
|
|
||||||
/* check to make sure we got a good cursor position */
|
/* check to make sure we got a good cursor position */
|
||||||
if ((num_phys_rows <= save_cursor_phys_row) ||
|
if ((num_phys_rows <= save_cursor_phys_row) ||
|
||||||
(num_virt_rows <= save_cursor_virt_row))
|
(num_virt_rows <= save_cursor_virt_row)) {
|
||||||
{
|
save_cursor_phys_row = num_phys_rows - reg->split_cursor->numRows;
|
||||||
save_cursor_phys_row = num_phys_rows - reg->split_cursor->numRows;
|
save_cursor_virt_row = num_virt_rows;
|
||||||
save_cursor_virt_row = num_virt_rows - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((save_cursor_phys_row < (reg->header->numRows)) ||
|
if ((save_cursor_phys_row < (reg->header->numRows)) ||
|
||||||
(save_cursor_virt_row < 1))
|
(save_cursor_virt_row < 1)) {
|
||||||
{
|
save_cursor_phys_row = reg->header->numRows;
|
||||||
save_cursor_phys_row = reg->header->numRows;
|
save_cursor_virt_row = 1;
|
||||||
save_cursor_virt_row = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finally, record the values */
|
/* finally, record the values */
|
||||||
@ -1389,11 +1434,11 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
{
|
{
|
||||||
SRInfo *info = xaccSRGetInfo(reg);
|
SRInfo *info = xaccSRGetInfo(reg);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Split *split=NULL, *last_split=NULL;
|
Split *split = NULL;
|
||||||
Split *save_current_split=NULL;
|
Split *last_split = NULL;
|
||||||
|
Split *save_current_split = NULL;
|
||||||
Table *table;
|
Table *table;
|
||||||
int phys_row;
|
int phys_row;
|
||||||
int save_phys_col;
|
|
||||||
int vrow;
|
int vrow;
|
||||||
int type, style;
|
int type, style;
|
||||||
int multi_line, dynamic;
|
int multi_line, dynamic;
|
||||||
@ -1414,14 +1459,18 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
lead_cursor = reg->double_cursor;
|
lead_cursor = reg->double_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* count the number of rows */
|
|
||||||
xaccSRCountRows (reg, slist, default_source_acc);
|
|
||||||
|
|
||||||
/* save the current cursor location; we do this by saving a pointer
|
/* save the current cursor location; we do this by saving a pointer
|
||||||
* to the currently edited split and physical column; we restore
|
* to the currently edited split and physical column; we restore
|
||||||
* the cursor to this location when we are done. */
|
* the cursor to this location when we are done. */
|
||||||
save_current_split = xaccSRGetCurrentSplit (reg);
|
save_current_split = xaccSRGetCurrentSplit (reg);
|
||||||
save_phys_col = table->current_cursor_phys_col;
|
|
||||||
|
/* If we are in dynamic mode on a blank split, remember the
|
||||||
|
* current transaction for determining expansion. */
|
||||||
|
if (dynamic && (save_current_split == NULL))
|
||||||
|
info->cursor_hint_trans = xaccSRGetCurrentTrans(reg);
|
||||||
|
|
||||||
|
/* count the number of rows */
|
||||||
|
xaccSRCountRows (reg, slist);
|
||||||
|
|
||||||
/* disable move callback -- we con't want the cascade of
|
/* disable move callback -- we con't want the cascade of
|
||||||
* callbacks while we are fiddling with loading the register */
|
* callbacks while we are fiddling with loading the register */
|
||||||
@ -1467,7 +1516,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
do_expand = multi_line;
|
do_expand = multi_line;
|
||||||
do_expand = do_expand ||
|
do_expand = do_expand ||
|
||||||
(dynamic && xaccIsPeerSplit(split,save_current_split));
|
(dynamic && xaccIsPeerSplit(split,save_current_split));
|
||||||
if (NULL == save_current_split) {
|
if (dynamic && (NULL == save_current_split)) {
|
||||||
trans = xaccSplitGetParent (split);
|
trans = xaccSplitGetParent (split);
|
||||||
do_expand = do_expand || (trans == info->cursor_hint_trans);
|
do_expand = do_expand || (trans == info->cursor_hint_trans);
|
||||||
}
|
}
|
||||||
@ -1479,7 +1528,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
|
|
||||||
xaccSetCursor (table, reg->trans_cursor, phys_row, 0, vrow, 0);
|
xaccSetCursor (table, reg->trans_cursor, phys_row, 0, vrow, 0);
|
||||||
xaccMoveCursor (table, phys_row, 0);
|
xaccMoveCursor (table, phys_row, 0);
|
||||||
xaccSRLoadTransEntry (reg, split, 1);
|
xaccSRLoadRegEntry (reg, split);
|
||||||
vrow ++;
|
vrow ++;
|
||||||
phys_row += reg->trans_cursor->numRows;
|
phys_row += reg->trans_cursor->numRows;
|
||||||
|
|
||||||
@ -1493,7 +1542,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
if (secondary != split) {
|
if (secondary != split) {
|
||||||
xaccSetCursor (table, reg->split_cursor, phys_row, 0, vrow, 0);
|
xaccSetCursor (table, reg->split_cursor, phys_row, 0, vrow, 0);
|
||||||
xaccMoveCursor (table, phys_row, 0);
|
xaccMoveCursor (table, phys_row, 0);
|
||||||
xaccSRLoadSplitEntry (reg, secondary, 1);
|
xaccSRLoadRegEntry (reg, secondary);
|
||||||
PINFO ("xaccSRLoadRegister(): "
|
PINFO ("xaccSRLoadRegister(): "
|
||||||
"load split %d at phys row %d addr=%p \n",
|
"load split %d at phys row %d addr=%p \n",
|
||||||
j, phys_row, secondary);
|
j, phys_row, secondary);
|
||||||
@ -1508,7 +1557,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
/* the simple case ... */
|
/* the simple case ... */
|
||||||
xaccSetCursor (table, lead_cursor, phys_row, 0, vrow, 0);
|
xaccSetCursor (table, lead_cursor, phys_row, 0, vrow, 0);
|
||||||
xaccMoveCursor (table, phys_row, 0);
|
xaccMoveCursor (table, phys_row, 0);
|
||||||
xaccSRLoadTransEntry (reg, split, 1);
|
xaccSRLoadRegEntry (reg, split);
|
||||||
vrow ++;
|
vrow ++;
|
||||||
phys_row += lead_cursor->numRows;
|
phys_row += lead_cursor->numRows;
|
||||||
}
|
}
|
||||||
@ -1516,7 +1565,6 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
PINFO ("xaccSRLoadRegister(): "
|
PINFO ("xaccSRLoadRegister(): "
|
||||||
"skip trans %d (blank split) \n", i);
|
"skip trans %d (blank split) \n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
last_split = split;
|
last_split = split;
|
||||||
i++;
|
i++;
|
||||||
@ -1560,7 +1608,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
/* do the transaction row of the blank split */
|
/* do the transaction row of the blank split */
|
||||||
xaccSetCursor (table, reg->trans_cursor, phys_row, 0, vrow, 0);
|
xaccSetCursor (table, reg->trans_cursor, phys_row, 0, vrow, 0);
|
||||||
xaccMoveCursor (table, phys_row, 0);
|
xaccMoveCursor (table, phys_row, 0);
|
||||||
xaccSRLoadTransEntry (reg, split, 1);
|
xaccSRLoadRegEntry (reg, split);
|
||||||
vrow ++;
|
vrow ++;
|
||||||
phys_row += reg->trans_cursor->numRows;
|
phys_row += reg->trans_cursor->numRows;
|
||||||
|
|
||||||
@ -1568,31 +1616,28 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
|||||||
split = xaccTransGetSplit (trans, 1);
|
split = xaccTransGetSplit (trans, 1);
|
||||||
xaccSetCursor (table, reg->split_cursor, phys_row, 0, vrow, 0);
|
xaccSetCursor (table, reg->split_cursor, phys_row, 0, vrow, 0);
|
||||||
xaccMoveCursor (table, phys_row, 0);
|
xaccMoveCursor (table, phys_row, 0);
|
||||||
xaccSRLoadSplitEntry (reg, split, 1);
|
xaccSRLoadRegEntry (reg, split);
|
||||||
vrow ++;
|
vrow ++;
|
||||||
phys_row += reg->split_cursor->numRows;
|
phys_row += reg->split_cursor->numRows;
|
||||||
} else {
|
} else {
|
||||||
xaccSetCursor (table, lead_cursor, phys_row, 0, vrow, 0);
|
xaccSetCursor (table, lead_cursor, phys_row, 0, vrow, 0);
|
||||||
xaccMoveCursor (table, phys_row, 0);
|
xaccMoveCursor (table, phys_row, 0);
|
||||||
xaccSRLoadTransEntry (reg, split, 1);
|
xaccSRLoadRegEntry (reg, split);
|
||||||
vrow ++;
|
vrow ++;
|
||||||
phys_row += lead_cursor->numRows;
|
phys_row += lead_cursor->numRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore the cursor to its rightful position */
|
/* restore the cursor to its rightful position */
|
||||||
i = 0;
|
{
|
||||||
while ((save_phys_col + i < reg->num_cols) || (save_phys_col > 0)) {
|
int row = reg->cursor_phys_row;
|
||||||
if (gnc_register_cell_valid(table, reg->cursor_phys_row,
|
int col = reg->cursor_phys_col;
|
||||||
save_phys_col + i)) {
|
|
||||||
xaccMoveCursorGUI (table, reg->cursor_phys_row, save_phys_col + i);
|
if (gnc_table_find_valid_cell_horiz(table, &row, &col, GNC_F))
|
||||||
break;
|
{
|
||||||
|
xaccMoveCursorGUI(table, row, col);
|
||||||
|
reg->cursor_phys_row = row;
|
||||||
|
reg->cursor_phys_col = col;
|
||||||
}
|
}
|
||||||
if (gnc_register_cell_valid(table, reg->cursor_phys_row,
|
|
||||||
save_phys_col - i)) {
|
|
||||||
xaccMoveCursorGUI (table, reg->cursor_phys_row, save_phys_col - i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we didn't find the pending transaction, it was removed
|
/* If we didn't find the pending transaction, it was removed
|
||||||
|
@ -20,11 +20,10 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include "top-level.h"
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
#include "gnucash.h"
|
#include "gnucash.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "AccWindow.h"
|
#include "AccWindow.h"
|
||||||
@ -103,9 +102,9 @@ gnc_account_tree_new_with_root(Account * root)
|
|||||||
static void
|
static void
|
||||||
gnc_account_tree_init(GNCAccountTree *tree)
|
gnc_account_tree_init(GNCAccountTree *tree)
|
||||||
{
|
{
|
||||||
tree->root_account = NULL;
|
tree->root_account = NULL;
|
||||||
tree->current_account = NULL;
|
tree->current_accounts = NULL;
|
||||||
tree->ignore_unselect = GNC_F;
|
tree->ignore_unselect = GNC_F;
|
||||||
|
|
||||||
gnc_init_account_view_info(&tree->avi);
|
gnc_init_account_view_info(&tree->avi);
|
||||||
|
|
||||||
@ -269,14 +268,17 @@ gnc_account_tree_refresh(GNCAccountTree * tree)
|
|||||||
{
|
{
|
||||||
GtkCList *clist = GTK_CLIST(tree);
|
GtkCList *clist = GTK_CLIST(tree);
|
||||||
GHashTable *expanded_accounts;
|
GHashTable *expanded_accounts;
|
||||||
|
GList *current_accounts;
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
gfloat save_value = 0.0;
|
gfloat save_value = 0.0;
|
||||||
|
|
||||||
adjustment = gtk_clist_get_vadjustment(GTK_CLIST(tree));
|
adjustment = gtk_clist_get_vadjustment(GTK_CLIST(tree));
|
||||||
if (adjustment != NULL)
|
if (adjustment != NULL)
|
||||||
save_value = adjustment->value;
|
save_value = adjustment->value;
|
||||||
|
|
||||||
expanded_accounts = gnc_account_tree_save_expanded(tree);
|
expanded_accounts = gnc_account_tree_save_expanded(tree);
|
||||||
|
current_accounts = tree->current_accounts;
|
||||||
|
tree->current_accounts = NULL;
|
||||||
|
|
||||||
gtk_clist_freeze(clist);
|
gtk_clist_freeze(clist);
|
||||||
|
|
||||||
@ -291,8 +293,7 @@ gnc_account_tree_refresh(GNCAccountTree * tree)
|
|||||||
|
|
||||||
gnc_account_tree_update_column_visibility(tree);
|
gnc_account_tree_update_column_visibility(tree);
|
||||||
|
|
||||||
if (!gnc_account_tree_select_account(tree, tree->current_account, FALSE))
|
gnc_account_tree_select_accounts(tree, current_accounts, FALSE);
|
||||||
tree->current_account = NULL;
|
|
||||||
|
|
||||||
if (adjustment != NULL)
|
if (adjustment != NULL)
|
||||||
{
|
{
|
||||||
@ -304,6 +305,7 @@ gnc_account_tree_refresh(GNCAccountTree * tree)
|
|||||||
gtk_clist_thaw(clist);
|
gtk_clist_thaw(clist);
|
||||||
|
|
||||||
g_hash_table_destroy(expanded_accounts);
|
g_hash_table_destroy(expanded_accounts);
|
||||||
|
g_list_free(current_accounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -347,12 +349,13 @@ gnc_account_tree_get_view_info(GNCAccountTree *tree, AccountViewInfo *info)
|
|||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_account_tree_select_account *
|
* gnc_account_tree_select_account *
|
||||||
* select an account in the tree and possibly expands and scrolls *
|
* select an account in the tree and expands the tree to make *
|
||||||
* the tree to ensure it is visible *
|
* sure it could be visible. It may also scroll the tree to *
|
||||||
|
* ensure it is visible *
|
||||||
* *
|
* *
|
||||||
* Args: tree - tree to be modified *
|
* Args: tree - tree to be modified *
|
||||||
* account - account to be selected *
|
* account - account to be selected *
|
||||||
* show - if true, expand and show the tree *
|
* show - if true, scroll the tree *
|
||||||
* Returns: true if the account was found *
|
* Returns: true if the account was found *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
gboolean
|
gboolean
|
||||||
@ -373,9 +376,6 @@ gnc_account_tree_select_account(GNCAccountTree *tree,
|
|||||||
/* Select it */
|
/* Select it */
|
||||||
gtk_ctree_select(ctree, node);
|
gtk_ctree_select(ctree, node);
|
||||||
|
|
||||||
if (!show)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* Expand all the parents */
|
/* Expand all the parents */
|
||||||
row = GTK_CTREE_ROW(node);
|
row = GTK_CTREE_ROW(node);
|
||||||
while ((n = row->parent) != NULL)
|
while ((n = row->parent) != NULL)
|
||||||
@ -384,6 +384,9 @@ gnc_account_tree_select_account(GNCAccountTree *tree,
|
|||||||
row = GTK_CTREE_ROW(n);
|
row = GTK_CTREE_ROW(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!show)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
/* Make sure it's visible */
|
/* Make sure it's visible */
|
||||||
if (gtk_ctree_node_is_visible(ctree, node) != GTK_VISIBILITY_FULL)
|
if (gtk_ctree_node_is_visible(ctree, node) != GTK_VISIBILITY_FULL)
|
||||||
gtk_ctree_node_moveto(ctree, node, 0, 0.5, 0.0);
|
gtk_ctree_node_moveto(ctree, node, 0, 0.5, 0.0);
|
||||||
@ -392,6 +395,44 @@ gnc_account_tree_select_account(GNCAccountTree *tree,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_account_tree_select_accounts *
|
||||||
|
* select a list of accounts in the tree, expanding the parents *
|
||||||
|
* of each one. If 'show' is true, the last one is made visible. *
|
||||||
|
* *
|
||||||
|
* Args: tree - tree to be modified *
|
||||||
|
* account_list - list of accounts to be selected *
|
||||||
|
* show - determines if last account is made visible *
|
||||||
|
* Returns: true if the last account was found in the list *
|
||||||
|
\********************************************************************/
|
||||||
|
gboolean
|
||||||
|
gnc_account_tree_select_accounts(GNCAccountTree *tree,
|
||||||
|
GList *account_list,
|
||||||
|
gboolean show_last)
|
||||||
|
{
|
||||||
|
Account *account;
|
||||||
|
gboolean real_show;
|
||||||
|
gboolean result = FALSE;
|
||||||
|
|
||||||
|
gtk_clist_freeze(GTK_CLIST(tree));
|
||||||
|
|
||||||
|
while (account_list != NULL)
|
||||||
|
{
|
||||||
|
account = account_list->data;
|
||||||
|
|
||||||
|
real_show = (account_list->next == NULL) ? show_last : FALSE;
|
||||||
|
|
||||||
|
result = gnc_account_tree_select_account(tree, account, real_show);
|
||||||
|
|
||||||
|
account_list = account_list->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_clist_thaw(GTK_CLIST(tree));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_account_tree_remove_account *
|
* gnc_account_tree_remove_account *
|
||||||
* removes an account from the tree *
|
* removes an account from the tree *
|
||||||
@ -495,7 +536,7 @@ gnc_account_tree_update_column_visibility(GNCAccountTree *tree)
|
|||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_account_tree_get_current_account *
|
* gnc_account_tree_get_current_account *
|
||||||
* returns the current account selected, or NULL if none *
|
* returns the first account selected, or NULL if none *
|
||||||
* *
|
* *
|
||||||
* Args: tree - tree to get current account from *
|
* Args: tree - tree to get current account from *
|
||||||
* Returns: current account *
|
* Returns: current account *
|
||||||
@ -503,7 +544,30 @@ gnc_account_tree_update_column_visibility(GNCAccountTree *tree)
|
|||||||
Account *
|
Account *
|
||||||
gnc_account_tree_get_current_account (GNCAccountTree *tree)
|
gnc_account_tree_get_current_account (GNCAccountTree *tree)
|
||||||
{
|
{
|
||||||
return tree->current_account;
|
if (tree == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (tree->current_accounts == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return tree->current_accounts->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_account_tree_get_current_accounts *
|
||||||
|
* returns a g_malloc'd GList of the selected accounts *
|
||||||
|
* *
|
||||||
|
* Args: tree - tree to get current accounts from *
|
||||||
|
* Returns: GList of selected accounts *
|
||||||
|
\********************************************************************/
|
||||||
|
GList *
|
||||||
|
gnc_account_tree_get_current_accounts (GNCAccountTree *tree)
|
||||||
|
{
|
||||||
|
if (tree == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return g_list_copy(tree->current_accounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -557,13 +621,14 @@ gnc_account_tree_set_view_info_real(GNCAccountTree *tree)
|
|||||||
static gint
|
static gint
|
||||||
gnc_account_tree_key_press(GtkWidget *widget, GdkEventKey *event)
|
gnc_account_tree_key_press(GtkWidget *widget, GdkEventKey *event)
|
||||||
{
|
{
|
||||||
GNCAccountTree *account_tree = GNC_ACCOUNT_TREE(widget);
|
GNCAccountTree *tree = GNC_ACCOUNT_TREE(widget);
|
||||||
|
Account *account = gnc_account_tree_get_current_account(tree);
|
||||||
|
|
||||||
if ((event->keyval == GDK_Return) && (account_tree->current_account != NULL))
|
if ((event->keyval == GDK_Return) && (account != NULL))
|
||||||
{
|
{
|
||||||
gtk_signal_emit(GTK_OBJECT(account_tree),
|
gtk_signal_emit(GTK_OBJECT(tree),
|
||||||
account_tree_signals[ACTIVATE_ACCOUNT],
|
account_tree_signals[ACTIVATE_ACCOUNT],
|
||||||
account_tree->current_account);
|
account);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -601,7 +666,7 @@ gnc_account_tree_button_press(GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_signal_emit(GTK_OBJECT(widget),
|
gtk_signal_emit(GTK_OBJECT(widget),
|
||||||
account_tree_signals[ACTIVATE_ACCOUNT],
|
account_tree_signals[ACTIVATE_ACCOUNT],
|
||||||
account);
|
account);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -619,15 +684,19 @@ gnc_account_tree_select_row(GtkCTree *ctree,
|
|||||||
gint column)
|
gint column)
|
||||||
{
|
{
|
||||||
GNCAccountTree *tree = GNC_ACCOUNT_TREE(ctree);
|
GNCAccountTree *tree = GNC_ACCOUNT_TREE(ctree);
|
||||||
|
Account *account;
|
||||||
|
GList *node;
|
||||||
|
|
||||||
tree->ignore_unselect = GNC_F;
|
tree->ignore_unselect = GNC_F;
|
||||||
|
|
||||||
tree->current_account = gtk_ctree_node_get_row_data(ctree,
|
account = gtk_ctree_node_get_row_data(ctree, GTK_CTREE_NODE(row));
|
||||||
GTK_CTREE_NODE(row));
|
node = g_list_find(tree->current_accounts, account);
|
||||||
|
if (node == NULL)
|
||||||
|
tree->current_accounts = g_list_prepend(tree->current_accounts, account);
|
||||||
|
|
||||||
gtk_signal_emit(GTK_OBJECT(ctree),
|
gtk_signal_emit(GTK_OBJECT(ctree),
|
||||||
account_tree_signals[SELECT_ACCOUNT],
|
account_tree_signals[SELECT_ACCOUNT],
|
||||||
tree->current_account);
|
account);
|
||||||
|
|
||||||
GTK_CTREE_CLASS(parent_class)->tree_select_row(ctree, row, column);
|
GTK_CTREE_CLASS(parent_class)->tree_select_row(ctree, row, column);
|
||||||
}
|
}
|
||||||
@ -639,6 +708,7 @@ gnc_account_tree_unselect_row(GtkCTree *ctree,
|
|||||||
{
|
{
|
||||||
GNCAccountTree *tree = GNC_ACCOUNT_TREE(ctree);
|
GNCAccountTree *tree = GNC_ACCOUNT_TREE(ctree);
|
||||||
Account *account;
|
Account *account;
|
||||||
|
GList *node;
|
||||||
|
|
||||||
if (tree->ignore_unselect)
|
if (tree->ignore_unselect)
|
||||||
{
|
{
|
||||||
@ -648,8 +718,14 @@ gnc_account_tree_unselect_row(GtkCTree *ctree,
|
|||||||
|
|
||||||
account = gtk_ctree_node_get_row_data(ctree, GTK_CTREE_NODE(row));
|
account = gtk_ctree_node_get_row_data(ctree, GTK_CTREE_NODE(row));
|
||||||
|
|
||||||
if (account == tree->current_account)
|
node = g_list_find(tree->current_accounts, account);
|
||||||
tree->current_account = NULL;
|
while (node != NULL)
|
||||||
|
{
|
||||||
|
tree->current_accounts = g_list_remove_link(tree->current_accounts, node);
|
||||||
|
g_list_free_1(node);
|
||||||
|
|
||||||
|
node = g_list_find(tree->current_accounts, account);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_signal_emit(GTK_OBJECT(ctree),
|
gtk_signal_emit(GTK_OBJECT(ctree),
|
||||||
account_tree_signals[UNSELECT_ACCOUNT],
|
account_tree_signals[UNSELECT_ACCOUNT],
|
||||||
@ -752,6 +828,9 @@ gnc_account_tree_destroy(GtkObject *object)
|
|||||||
tree->deficit_style = NULL;
|
tree->deficit_style = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_list_free(tree->current_accounts);
|
||||||
|
tree->current_accounts = NULL;
|
||||||
|
|
||||||
if (GTK_OBJECT_CLASS(parent_class)->destroy)
|
if (GTK_OBJECT_CLASS(parent_class)->destroy)
|
||||||
(* GTK_OBJECT_CLASS(parent_class)->destroy) (object);
|
(* GTK_OBJECT_CLASS(parent_class)->destroy) (object);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,8 @@ struct _GNCAccountTree
|
|||||||
GtkStyle *deficit_style;
|
GtkStyle *deficit_style;
|
||||||
|
|
||||||
Account *root_account;
|
Account *root_account;
|
||||||
Account *current_account;
|
|
||||||
|
GList *current_accounts;
|
||||||
|
|
||||||
gboolean ignore_unselect;
|
gboolean ignore_unselect;
|
||||||
};
|
};
|
||||||
@ -97,6 +98,10 @@ gboolean gnc_account_tree_select_account (GNCAccountTree *tree,
|
|||||||
Account *account,
|
Account *account,
|
||||||
gboolean show_account);
|
gboolean show_account);
|
||||||
|
|
||||||
|
gboolean gnc_account_tree_select_accounts(GNCAccountTree *tree,
|
||||||
|
GList *account_list,
|
||||||
|
gboolean show_last);
|
||||||
|
|
||||||
void gnc_account_tree_insert_account (GNCAccountTree *tree,
|
void gnc_account_tree_insert_account (GNCAccountTree *tree,
|
||||||
Account *account);
|
Account *account);
|
||||||
|
|
||||||
@ -108,6 +113,7 @@ void gnc_account_tree_show_categories (GNCAccountTree *tree);
|
|||||||
void gnc_account_tree_hide_categories (GNCAccountTree *tree);
|
void gnc_account_tree_hide_categories (GNCAccountTree *tree);
|
||||||
|
|
||||||
Account * gnc_account_tree_get_current_account (GNCAccountTree *tree);
|
Account * gnc_account_tree_get_current_account (GNCAccountTree *tree);
|
||||||
|
GList * gnc_account_tree_get_current_accounts (GNCAccountTree *tree);
|
||||||
|
|
||||||
void gnc_account_tree_hide_all_but_name (GNCAccountTree *tree);
|
void gnc_account_tree_hide_all_but_name (GNCAccountTree *tree);
|
||||||
|
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
* Huntington Beach, CA 92648-4632 *
|
* Huntington Beach, CA 92648-4632 *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "ui-callbacks.h"
|
#include "ui-callbacks.h"
|
||||||
|
|
||||||
#include "cursors.h"
|
#include "cursors.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
* -- tooltips for the widgets in the window
|
* -- tooltips for the widgets in the window
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gnome.h>
|
|
||||||
|
|
||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
|
|
||||||
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "AccWindow.h"
|
#include "AccWindow.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "FileDialog.h"
|
#include "FileDialog.h"
|
||||||
@ -88,6 +88,12 @@ gnc_ui_accWindow_list_select_cb(GtkCList * type_list, gint row, gint column,
|
|||||||
if(accData == NULL)
|
if(accData == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!gtk_clist_get_selectable(type_list, row))
|
||||||
|
{
|
||||||
|
gtk_clist_unselect_row(type_list, row, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
accData->type = row;
|
accData->type = row;
|
||||||
|
|
||||||
_accWindow_last_used_account_type = row;
|
_accWindow_last_used_account_type = row;
|
||||||
@ -164,7 +170,7 @@ gnc_ui_accWindow_list_box_create(AccWindow * accData)
|
|||||||
{
|
{
|
||||||
GtkWidget *frame, *hbox;
|
GtkWidget *frame, *hbox;
|
||||||
|
|
||||||
frame = gtk_frame_new("Type of Account");
|
frame = gtk_frame_new(ACC_TYPE_STR);
|
||||||
gtk_widget_show(frame);
|
gtk_widget_show(frame);
|
||||||
|
|
||||||
hbox = gtk_hbox_new(TRUE, 0);
|
hbox = gtk_hbox_new(TRUE, 0);
|
||||||
@ -177,9 +183,10 @@ gnc_ui_accWindow_list_box_create(AccWindow * accData)
|
|||||||
gtk_container_border_width(GTK_CONTAINER(accData->type_list), 3);
|
gtk_container_border_width(GTK_CONTAINER(accData->type_list), 3);
|
||||||
gtk_widget_show(GTK_WIDGET(accData->type_list));
|
gtk_widget_show(GTK_WIDGET(accData->type_list));
|
||||||
|
|
||||||
|
|
||||||
gnc_ui_accWindow_list_fill(accData->type_list);
|
gnc_ui_accWindow_list_fill(accData->type_list);
|
||||||
|
|
||||||
|
gtk_clist_columns_autosize(GTK_CLIST(accData->type_list));
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(accData->type_list), "select-row",
|
gtk_signal_connect(GTK_OBJECT(accData->type_list), "select-row",
|
||||||
GTK_SIGNAL_FUNC(gnc_ui_accWindow_list_select_cb),
|
GTK_SIGNAL_FUNC(gnc_ui_accWindow_list_select_cb),
|
||||||
accData);
|
accData);
|
||||||
@ -263,7 +270,7 @@ gnc_ui_accWindow_tree_select(GNCAccountTree *tree,
|
|||||||
|
|
||||||
parentAccType = xaccAccountGetType(account);
|
parentAccType = xaccAccountGetType(account);
|
||||||
|
|
||||||
/* set the alowable account types for this parent */
|
/* set the allowable account types for this parent */
|
||||||
for (type = 0; type < NUM_ACCOUNT_TYPES; type++)
|
for (type = 0; type < NUM_ACCOUNT_TYPES; type++)
|
||||||
{
|
{
|
||||||
compatible = xaccAccountTypesCompatible(parentAccType, type);
|
compatible = xaccAccountTypesCompatible(parentAccType, type);
|
||||||
@ -300,7 +307,6 @@ gnc_ui_accWindow_account_tree_box_create(AccWindow * accData)
|
|||||||
gtk_clist_column_titles_hide(GTK_CLIST(accountTree));
|
gtk_clist_column_titles_hide(GTK_CLIST(accountTree));
|
||||||
gnc_account_tree_hide_all_but_name(GNC_ACCOUNT_TREE(accountTree));
|
gnc_account_tree_hide_all_but_name(GNC_ACCOUNT_TREE(accountTree));
|
||||||
gnc_account_tree_refresh(GNC_ACCOUNT_TREE(accountTree));
|
gnc_account_tree_refresh(GNC_ACCOUNT_TREE(accountTree));
|
||||||
gtk_widget_show(accountTree);
|
|
||||||
|
|
||||||
accData->tree = GNC_ACCOUNT_TREE(accountTree);
|
accData->tree = GNC_ACCOUNT_TREE(accountTree);
|
||||||
|
|
||||||
@ -315,7 +321,7 @@ gnc_ui_accWindow_account_tree_box_create(AccWindow * accData)
|
|||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollWin),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollWin),
|
||||||
GTK_POLICY_AUTOMATIC,
|
GTK_POLICY_AUTOMATIC,
|
||||||
GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
|
||||||
gtk_container_add(GTK_CONTAINER(frame), scrollWin);
|
gtk_container_add(GTK_CONTAINER(frame), scrollWin);
|
||||||
gtk_container_border_width (GTK_CONTAINER (scrollWin), 5);
|
gtk_container_border_width (GTK_CONTAINER (scrollWin), 5);
|
||||||
gtk_container_add(GTK_CONTAINER(scrollWin), accountTree);
|
gtk_container_add(GTK_CONTAINER(scrollWin), accountTree);
|
||||||
@ -403,6 +409,9 @@ gnc_accWindow_create(AccWindow *accData)
|
|||||||
/* don't close on buttons */
|
/* don't close on buttons */
|
||||||
gnome_dialog_set_close(GNOME_DIALOG(dialog), FALSE);
|
gnome_dialog_set_close(GNOME_DIALOG(dialog), FALSE);
|
||||||
|
|
||||||
|
/* allow grow and shrink, no auto-shrink */
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(dialog), TRUE, TRUE, FALSE);
|
||||||
|
|
||||||
/* Account field edit box */
|
/* Account field edit box */
|
||||||
widget = gnc_ui_account_field_box_create(&accData->edit_info, FALSE);
|
widget = gnc_ui_account_field_box_create(&accData->edit_info, FALSE);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
|
||||||
@ -444,8 +453,6 @@ gnc_accWindow_create(AccWindow *accData)
|
|||||||
widget = gnc_ui_notes_frame_create(&accData->edit_info.notes_entry);
|
widget = gnc_ui_notes_frame_create(&accData->edit_info.notes_entry);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
|
||||||
|
|
||||||
gtk_widget_show_all(dialog);
|
|
||||||
|
|
||||||
gnc_account_tree_select_account(accData->tree, accData->parentAccount, TRUE);
|
gnc_account_tree_select_account(accData->tree, accData->parentAccount, TRUE);
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
@ -462,18 +469,19 @@ gnc_accWindow_create(AccWindow *accData)
|
|||||||
AccWindow *
|
AccWindow *
|
||||||
accWindow (AccountGroup *this_is_not_used)
|
accWindow (AccountGroup *this_is_not_used)
|
||||||
{
|
{
|
||||||
gint result;
|
|
||||||
AccWindow *accData = g_new0(AccWindow, 1);
|
AccWindow *accData = g_new0(AccWindow, 1);
|
||||||
GtkWidget *dialog;
|
|
||||||
AccountFieldStrings strings;
|
AccountFieldStrings strings;
|
||||||
|
GtkWidget *dialog;
|
||||||
|
gint result;
|
||||||
|
|
||||||
accData->parentAccount = gnc_get_current_account();
|
accData->parentAccount = gnc_get_current_account();
|
||||||
accData->newAccount = xaccMallocAccount();
|
accData->newAccount = xaccMallocAccount();
|
||||||
accData->type = _accWindow_last_used_account_type;
|
accData->type = _accWindow_last_used_account_type;
|
||||||
|
|
||||||
xaccAccountSetName(accData->newAccount, "New top level account");
|
xaccAccountSetName(accData->newAccount, NEW_TOP_ACCT_STR);
|
||||||
|
|
||||||
dialog = gnc_accWindow_create(accData);
|
dialog = gnc_accWindow_create(accData);
|
||||||
|
gtk_widget_show_all(dialog);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -490,8 +498,7 @@ accWindow (AccountGroup *this_is_not_used)
|
|||||||
/* check for valid name */
|
/* check for valid name */
|
||||||
if (safe_strcmp(strings.name, "") == 0)
|
if (safe_strcmp(strings.name, "") == 0)
|
||||||
{
|
{
|
||||||
gnc_error_dialog_parented(GTK_WINDOW(dialog),
|
gnc_error_dialog_parented(GTK_WINDOW(dialog), ACC_NO_NAME_MSG);
|
||||||
"You must enter a valid account name.");
|
|
||||||
gnc_ui_free_field_strings(&strings);
|
gnc_ui_free_field_strings(&strings);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -499,8 +506,7 @@ accWindow (AccountGroup *this_is_not_used)
|
|||||||
/* check for valid type */
|
/* check for valid type */
|
||||||
if (accData->type == BAD_TYPE)
|
if (accData->type == BAD_TYPE)
|
||||||
{
|
{
|
||||||
gnc_error_dialog_parented(GTK_WINDOW(dialog),
|
gnc_error_dialog_parented(GTK_WINDOW(dialog), ACC_TYPE_MSG);
|
||||||
"You must select an account type.");
|
|
||||||
gnc_ui_free_field_strings(&strings);
|
gnc_ui_free_field_strings(&strings);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,11 @@
|
|||||||
* Huntington Beach, CA 92648-4632 *
|
* Huntington Beach, CA 92648-4632 *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include "top-level.h"
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
|
|
||||||
#include "AccWindow.h"
|
#include "AccWindow.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Refresh.h"
|
#include "Refresh.h"
|
||||||
@ -93,7 +92,7 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
|||||||
/* check for valid name */
|
/* check for valid name */
|
||||||
if (safe_strcmp(strings.name, "") == 0)
|
if (safe_strcmp(strings.name, "") == 0)
|
||||||
{
|
{
|
||||||
gnc_error_dialog("You must enter a valid account name.");
|
gnc_error_dialog(ACC_NO_NAME_MSG);
|
||||||
gnc_ui_free_field_strings(&strings);
|
gnc_ui_free_field_strings(&strings);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,10 @@
|
|||||||
* Huntington Beach, CA 92648-4632 *
|
* Huntington Beach, CA 92648-4632 *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#include <gnome.h>
|
|
||||||
|
|
||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "FileBox.h"
|
#include "FileBox.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -17,12 +17,18 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include <top-level.h>
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "dialog-options.h"
|
#include "dialog-options.h"
|
||||||
#include "dialog-utils.h"
|
#include "dialog-utils.h"
|
||||||
#include "option-util.h"
|
#include "option-util.h"
|
||||||
#include "query-user.h"
|
#include "query-user.h"
|
||||||
|
#include "gnc-helpers.h"
|
||||||
|
#include "account-tree.h"
|
||||||
|
#include "global-options.h"
|
||||||
|
#include "messages.h"
|
||||||
#include "util.h"
|
#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. */
|
||||||
@ -82,7 +88,7 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default)
|
|||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
index = gnc_option_value_permissible_value_index(option, value);
|
index = gnc_option_permissible_value_index(option, value);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
bad_value = TRUE;
|
bad_value = TRUE;
|
||||||
else
|
else
|
||||||
@ -92,6 +98,30 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default)
|
|||||||
GINT_TO_POINTER(index));
|
GINT_TO_POINTER(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (safe_strcmp(type, "date") == 0)
|
||||||
|
{
|
||||||
|
Timespec ts;
|
||||||
|
|
||||||
|
if (gnc_timepair_p(value))
|
||||||
|
{
|
||||||
|
ts = gnc_timepair2timespec(value);
|
||||||
|
gnome_date_edit_set_time(GNOME_DATE_EDIT(option->widget), ts.tv_sec);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bad_value = TRUE;
|
||||||
|
}
|
||||||
|
else if (safe_strcmp(type, "account-list") == 0)
|
||||||
|
{
|
||||||
|
GList *list;
|
||||||
|
|
||||||
|
list = gnc_scm_to_account_list(value);
|
||||||
|
|
||||||
|
gtk_clist_unselect_all(GTK_CLIST(option->widget));
|
||||||
|
gnc_account_tree_select_accounts(GNC_ACCOUNT_TREE(option->widget),
|
||||||
|
list, TRUE);
|
||||||
|
|
||||||
|
g_list_free(list);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PERR("gnc_option_set_ui_value: Unknown type. Ignoring.\n");
|
PERR("gnc_option_set_ui_value: Unknown type. Ignoring.\n");
|
||||||
@ -148,7 +178,28 @@ gnc_option_get_ui_value(GNCOption *option)
|
|||||||
"gnc_multichoice_index");
|
"gnc_multichoice_index");
|
||||||
index = GPOINTER_TO_INT(_index);
|
index = GPOINTER_TO_INT(_index);
|
||||||
|
|
||||||
result = gnc_option_value_permissible_value(option, index);
|
result = gnc_option_permissible_value(option, index);
|
||||||
|
}
|
||||||
|
else if (safe_strcmp(type, "date") == 0)
|
||||||
|
{
|
||||||
|
Timespec ts;
|
||||||
|
|
||||||
|
ts.tv_sec = gnome_date_edit_get_date(GNOME_DATE_EDIT(option->widget));
|
||||||
|
ts.tv_nsec = 0;
|
||||||
|
|
||||||
|
result = gnc_timespec2timepair(ts);
|
||||||
|
}
|
||||||
|
else if (safe_strcmp(type, "account-list") == 0)
|
||||||
|
{
|
||||||
|
GNCAccountTree *tree;
|
||||||
|
GList *list;
|
||||||
|
|
||||||
|
tree = GNC_ACCOUNT_TREE(option->widget);
|
||||||
|
list = gnc_account_tree_get_current_accounts(tree);
|
||||||
|
|
||||||
|
result = gnc_account_list_to_scm(list);
|
||||||
|
|
||||||
|
g_list_free(list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -178,9 +229,8 @@ default_button_cb(GtkButton *button, gpointer data)
|
|||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
gnc_option_create_default_button(GNCOption *option)
|
gnc_option_create_default_button(GNCOption *option)
|
||||||
{
|
{
|
||||||
GtkWidget *default_button = gtk_button_new_with_label("Set to default");
|
GtkWidget *default_button = gtk_button_new_with_label(SET_TO_DEFAULT_STR);
|
||||||
|
|
||||||
gtk_widget_show(default_button);
|
|
||||||
gtk_container_set_border_width(GTK_CONTAINER(default_button), 2);
|
gtk_container_set_border_width(GTK_CONTAINER(default_button), 2);
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(default_button), "clicked",
|
gtk_signal_connect(GTK_OBJECT(default_button), "clicked",
|
||||||
@ -247,7 +297,7 @@ gnc_option_create_multichoice_widget(GNCOption *option)
|
|||||||
int num_values;
|
int num_values;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
num_values = gnc_option_value_num_permissible_values(option);
|
num_values = gnc_option_num_permissible_values(option);
|
||||||
|
|
||||||
g_return_val_if_fail(num_values >= 0, NULL);
|
g_return_val_if_fail(num_values >= 0, NULL);
|
||||||
|
|
||||||
@ -255,8 +305,8 @@ gnc_option_create_multichoice_widget(GNCOption *option)
|
|||||||
|
|
||||||
for (i = 0; i < num_values; i++)
|
for (i = 0; i < num_values; i++)
|
||||||
{
|
{
|
||||||
info[i].name = gnc_option_value_permissible_value_name(option, i);
|
info[i].name = gnc_option_permissible_value_name(option, i);
|
||||||
info[i].tip = gnc_option_value_permissible_value_description(option, i);
|
info[i].tip = gnc_option_permissible_value_description(option, i);
|
||||||
info[i].callback = gnc_option_multichoice_cb;
|
info[i].callback = gnc_option_multichoice_cb;
|
||||||
info[i].user_data = option;
|
info[i].user_data = option;
|
||||||
}
|
}
|
||||||
@ -273,15 +323,131 @@ gnc_option_create_multichoice_widget(GNCOption *option)
|
|||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_option_account_cb(GNCAccountTree *tree, Account * account, gpointer data)
|
||||||
|
{
|
||||||
|
GNCOption *option = data;
|
||||||
|
GtkWidget *pbox;
|
||||||
|
|
||||||
|
option->changed = TRUE;
|
||||||
|
|
||||||
|
pbox = gtk_widget_get_toplevel(GTK_WIDGET(tree));
|
||||||
|
gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_option_account_select_all_cb(GtkWidget *widget, gpointer data)
|
||||||
|
{
|
||||||
|
GNCOption *option = data;
|
||||||
|
GtkWidget *pbox;
|
||||||
|
|
||||||
|
gtk_clist_select_all(GTK_CLIST(option->widget));
|
||||||
|
|
||||||
|
option->changed = TRUE;
|
||||||
|
|
||||||
|
pbox = gtk_widget_get_toplevel(GTK_WIDGET(widget));
|
||||||
|
gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_option_account_clear_all_cb(GtkWidget *widget, gpointer data)
|
||||||
|
{
|
||||||
|
GNCOption *option = data;
|
||||||
|
GtkWidget *pbox;
|
||||||
|
|
||||||
|
gtk_clist_unselect_all(GTK_CLIST(option->widget));
|
||||||
|
|
||||||
|
option->changed = TRUE;
|
||||||
|
|
||||||
|
pbox = gtk_widget_get_toplevel(GTK_WIDGET(widget));
|
||||||
|
gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
gnc_option_set_ui_widget(GNCOption *option)
|
gnc_option_create_account_widget(GNCOption *option, char *name)
|
||||||
|
{
|
||||||
|
gboolean multiple_selection;
|
||||||
|
GtkWidget *scroll_win;
|
||||||
|
GtkWidget *button;
|
||||||
|
GtkWidget *frame;
|
||||||
|
GtkWidget *tree;
|
||||||
|
GtkWidget *vbox;
|
||||||
|
GtkWidget *bbox;
|
||||||
|
|
||||||
|
multiple_selection = gnc_option_multiple_selection(option);
|
||||||
|
|
||||||
|
frame = gtk_frame_new(name);
|
||||||
|
|
||||||
|
vbox = gtk_vbox_new(FALSE, 0);
|
||||||
|
gtk_container_add(GTK_CONTAINER(frame), vbox);
|
||||||
|
|
||||||
|
tree = gnc_account_tree_new();
|
||||||
|
gtk_clist_column_titles_hide(GTK_CLIST(tree));
|
||||||
|
gnc_account_tree_hide_all_but_name(GNC_ACCOUNT_TREE(tree));
|
||||||
|
gnc_account_tree_refresh(GNC_ACCOUNT_TREE(tree));
|
||||||
|
if (multiple_selection)
|
||||||
|
gtk_clist_set_selection_mode(GTK_CLIST(tree), GTK_SELECTION_MULTIPLE);
|
||||||
|
|
||||||
|
gtk_signal_connect(GTK_OBJECT(tree), "select_account",
|
||||||
|
GTK_SIGNAL_FUNC(gnc_option_account_cb), option);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(tree), "unselect_account",
|
||||||
|
GTK_SIGNAL_FUNC(gnc_option_account_cb), option);
|
||||||
|
|
||||||
|
scroll_win = gtk_scrolled_window_new(NULL, NULL);
|
||||||
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win),
|
||||||
|
GTK_POLICY_AUTOMATIC,
|
||||||
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), scroll_win, FALSE, FALSE, 0);
|
||||||
|
gtk_container_border_width(GTK_CONTAINER(scroll_win), 5);
|
||||||
|
gtk_container_add(GTK_CONTAINER(scroll_win), tree);
|
||||||
|
|
||||||
|
bbox = gtk_hbutton_box_new();
|
||||||
|
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 10);
|
||||||
|
|
||||||
|
if (multiple_selection)
|
||||||
|
{
|
||||||
|
button = gtk_button_new_with_label(SELECT_ALL_STR);
|
||||||
|
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gnc_option_account_select_all_cb),
|
||||||
|
option);
|
||||||
|
|
||||||
|
button = gtk_button_new_with_label(CLEAR_ALL_STR);
|
||||||
|
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gnc_option_account_clear_all_cb),
|
||||||
|
option);
|
||||||
|
}
|
||||||
|
|
||||||
|
button = gtk_button_new_with_label(SELECT_DEFAULT_STR);
|
||||||
|
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(default_button_cb), option);
|
||||||
|
|
||||||
|
option->widget = tree;
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_option_set_ui_widget(GNCOption *option, GtkBox *page_box)
|
||||||
{
|
{
|
||||||
GtkWidget *enclosing = NULL;
|
GtkWidget *enclosing = NULL;
|
||||||
GtkWidget *value = NULL;
|
GtkWidget *value = NULL;
|
||||||
|
gboolean packed = FALSE;
|
||||||
char *name, *documentation;
|
char *name, *documentation;
|
||||||
char *type;
|
char *type;
|
||||||
|
|
||||||
type = gnc_option_type(option);
|
type = gnc_option_type(option);
|
||||||
|
if (type == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
name = gnc_option_name(option);
|
name = gnc_option_name(option);
|
||||||
documentation = gnc_option_documentation(option);
|
documentation = gnc_option_documentation(option);
|
||||||
|
|
||||||
@ -347,29 +513,91 @@ gnc_option_set_ui_widget(GNCOption *option)
|
|||||||
gnc_option_create_default_button(option),
|
gnc_option_create_default_button(option),
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
}
|
}
|
||||||
|
else if (safe_strcmp(type, "date") == 0)
|
||||||
|
{
|
||||||
|
GtkWidget *entry;
|
||||||
|
GtkWidget *label;
|
||||||
|
gchar *colon_name;
|
||||||
|
gboolean show_time;
|
||||||
|
gboolean use24;
|
||||||
|
|
||||||
|
colon_name = g_strconcat(name, ":", NULL);
|
||||||
|
label= gtk_label_new(colon_name);
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5);
|
||||||
|
g_free(colon_name);
|
||||||
|
|
||||||
|
enclosing = gtk_hbox_new(FALSE, 5);
|
||||||
|
|
||||||
|
show_time = gnc_option_show_time(option);
|
||||||
|
use24 = gnc_lookup_boolean_option("International",
|
||||||
|
"Use 24-hour time format", FALSE);
|
||||||
|
|
||||||
|
value = gnome_date_edit_new(time(NULL), show_time, use24);
|
||||||
|
|
||||||
|
option->widget = value;
|
||||||
|
gnc_option_set_ui_value(option, FALSE);
|
||||||
|
|
||||||
|
entry = GNOME_DATE_EDIT(value)->date_entry;
|
||||||
|
gnc_set_tooltip(entry, documentation);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||||
|
GTK_SIGNAL_FUNC(gnc_option_changed_cb), option);
|
||||||
|
|
||||||
|
if (show_time)
|
||||||
|
{
|
||||||
|
entry = GNOME_DATE_EDIT(value)->time_entry;
|
||||||
|
gnc_set_tooltip(entry, documentation);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||||
|
GTK_SIGNAL_FUNC(gnc_option_changed_cb), option);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_box_pack_start(GTK_BOX(enclosing), label, FALSE, FALSE, 0);
|
||||||
|
gtk_box_pack_start(GTK_BOX(enclosing), value, FALSE, FALSE, 0);
|
||||||
|
gtk_box_pack_end(GTK_BOX(enclosing),
|
||||||
|
gnc_option_create_default_button(option),
|
||||||
|
FALSE, FALSE, 0);
|
||||||
|
}
|
||||||
|
else if (safe_strcmp(type, "account-list") == 0)
|
||||||
|
{
|
||||||
|
enclosing = gnc_option_create_account_widget(option, name);
|
||||||
|
value = option->widget;
|
||||||
|
|
||||||
|
gnc_set_tooltip(enclosing, documentation);
|
||||||
|
|
||||||
|
gtk_box_pack_start(page_box, enclosing, FALSE, FALSE, 5);
|
||||||
|
packed = TRUE;
|
||||||
|
|
||||||
|
gtk_widget_realize(value);
|
||||||
|
|
||||||
|
gnc_option_set_ui_value(option, FALSE);
|
||||||
|
|
||||||
|
gtk_clist_set_row_height(GTK_CLIST(value), 0);
|
||||||
|
gtk_widget_set_usize(value, 0, GTK_CLIST(value)->row_height * 10);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PERR("gnc_option_set_ui_widget: Unknown type. Ignoring.\n");
|
PERR("gnc_option_set_ui_widget: Unknown type. Ignoring.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!packed && (enclosing != NULL))
|
||||||
|
gtk_box_pack_start(page_box, enclosing, FALSE, FALSE, 0);
|
||||||
|
|
||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
gnc_set_tooltip(value, documentation);
|
gnc_set_tooltip(value, documentation);
|
||||||
|
|
||||||
if (enclosing != NULL)
|
if (enclosing != NULL)
|
||||||
gtk_widget_show_all(enclosing);
|
gtk_widget_show_all(enclosing);
|
||||||
|
|
||||||
free(documentation);
|
if (documentation != NULL)
|
||||||
free(name);
|
free(documentation);
|
||||||
|
if (name != NULL)
|
||||||
|
free(name);
|
||||||
free(type);
|
free(type);
|
||||||
|
|
||||||
return enclosing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_options_dialog_add_option(GtkWidget *page, GNCOption *option)
|
gnc_options_dialog_add_option(GtkWidget *page, GNCOption *option)
|
||||||
{
|
{
|
||||||
gtk_box_pack_start(GTK_BOX(page), gnc_option_set_ui_widget(option),
|
gnc_option_set_ui_widget(option, GTK_BOX(page));
|
||||||
FALSE, FALSE, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#include <gnome.h>
|
|
||||||
|
|
||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
|
|
||||||
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "dialog-transfer.h"
|
#include "dialog-transfer.h"
|
||||||
|
#include "dialog-utils.h"
|
||||||
#include "MultiLedger.h"
|
#include "MultiLedger.h"
|
||||||
#include "FileDialog.h"
|
#include "FileDialog.h"
|
||||||
#include "Refresh.h"
|
#include "Refresh.h"
|
||||||
@ -110,9 +111,10 @@ gnc_xfer_dialog_create_tree_frame(Account *initial, gchar *title,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button = gtk_check_button_new_with_label("Show Categories");
|
button = gtk_check_button_new_with_label(SHOW_CATEGORIES_STR);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), is_category);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), is_category);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
|
||||||
|
gnc_set_tooltip(button, SHOW_CAT_MSG);
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(button), "toggled",
|
gtk_signal_connect(GTK_OBJECT(button), "toggled",
|
||||||
GTK_SIGNAL_FUNC(gnc_xfer_dialog_toggle_cb),
|
GTK_SIGNAL_FUNC(gnc_xfer_dialog_toggle_cb),
|
||||||
@ -151,7 +153,7 @@ gnc_xfer_dialog_create(GtkWidget * parent, Account * initial,
|
|||||||
{
|
{
|
||||||
GtkWidget *frame, *vbox, *hbox, *label;
|
GtkWidget *frame, *vbox, *hbox, *label;
|
||||||
|
|
||||||
frame = gtk_frame_new(_("Transfer Information"));
|
frame = gtk_frame_new(XFER_INFO);
|
||||||
gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
|
gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
|
||||||
|
|
||||||
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),
|
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),
|
||||||
@ -316,17 +318,14 @@ gnc_xfer_dialog(GtkWidget * parent, Account * initial)
|
|||||||
|
|
||||||
if (!xaccAccountsHaveCommonCurrency(from, to))
|
if (!xaccAccountsHaveCommonCurrency(from, to))
|
||||||
{
|
{
|
||||||
gnc_error_dialog_parented(GTK_WINDOW(dialog),
|
gnc_error_dialog_parented(GTK_WINDOW(dialog), XFER_CURR_MSG);
|
||||||
"You cannot transfer between those accounts." \
|
|
||||||
"\nThey do not have a common currency.");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
string = gtk_entry_get_text(GTK_ENTRY(xferData.amount_entry));
|
string = gtk_entry_get_text(GTK_ENTRY(xferData.amount_entry));
|
||||||
if (sscanf(string, "%lf", &amount) != 1)
|
if (sscanf(string, "%lf", &amount) != 1)
|
||||||
{
|
{
|
||||||
gnc_error_dialog_parented(GTK_WINDOW(dialog),
|
gnc_error_dialog_parented(GTK_WINDOW(dialog), AMOUNT_NUM_MSG);
|
||||||
"The amount must be a number.");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ gnc_ui_notes_frame_create(GtkEditable **notes_entry)
|
|||||||
{
|
{
|
||||||
GtkWidget *frame, *text, *table, *vscr;
|
GtkWidget *frame, *text, *table, *vscr;
|
||||||
|
|
||||||
frame = gtk_frame_new("Notes");
|
frame = gtk_frame_new(NOTES_STR);
|
||||||
gtk_container_border_width(GTK_CONTAINER(frame), 5);
|
gtk_container_border_width(GTK_CONTAINER(frame), 5);
|
||||||
gtk_widget_show(frame);
|
gtk_widget_show(frame);
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ gnc_ui_account_field_box_create(AccountEditInfo * info,
|
|||||||
{
|
{
|
||||||
GtkWidget *frame, *vbox, *hbox, *widget;
|
GtkWidget *frame, *vbox, *hbox, *widget;
|
||||||
|
|
||||||
frame = gtk_frame_new("Account Info");
|
frame = gtk_frame_new(ACC_INFO_STR);
|
||||||
gtk_container_border_width(GTK_CONTAINER(frame), 5);
|
gtk_container_border_width(GTK_CONTAINER(frame), 5);
|
||||||
gtk_widget_show(frame);
|
gtk_widget_show(frame);
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ gnc_get_source_name(gint source)
|
|||||||
switch (source)
|
switch (source)
|
||||||
{
|
{
|
||||||
case SOURCE_NONE :
|
case SOURCE_NONE :
|
||||||
return "None";
|
return NONE_STR;
|
||||||
case SOURCE_YAHOO :
|
case SOURCE_YAHOO :
|
||||||
return "Yahoo";
|
return "Yahoo";
|
||||||
case SOURCE_FIDELITY :
|
case SOURCE_FIDELITY :
|
||||||
@ -296,7 +296,7 @@ gnc_ui_account_source_box_create(AccountEditInfo * info)
|
|||||||
{
|
{
|
||||||
GtkWidget *frame, *hbox, *widget, *omenu;
|
GtkWidget *frame, *hbox, *widget, *omenu;
|
||||||
|
|
||||||
frame = gtk_frame_new("Quote Source");
|
frame = gtk_frame_new(QUOTE_SRC_STR);
|
||||||
gtk_container_border_width(GTK_CONTAINER(frame), 5);
|
gtk_container_border_width(GTK_CONTAINER(frame), 5);
|
||||||
gtk_widget_show(frame);
|
gtk_widget_show(frame);
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ gnc_ui_account_source_box_create(AccountEditInfo * info)
|
|||||||
gtk_container_border_width(GTK_CONTAINER(hbox), 5);
|
gtk_container_border_width(GTK_CONTAINER(hbox), 5);
|
||||||
gtk_widget_show(hbox);
|
gtk_widget_show(hbox);
|
||||||
|
|
||||||
widget = gtk_label_new("Source for stock quotes:");
|
widget = gtk_label_new(QUOTE_SRC_MSG);
|
||||||
gtk_misc_set_alignment (GTK_MISC(widget), 0.95, 0.5);
|
gtk_misc_set_alignment (GTK_MISC(widget), 0.95, 0.5);
|
||||||
gtk_widget_show(widget);
|
gtk_widget_show(widget);
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include "top-level.h"
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "global-options.h"
|
#include "global-options.h"
|
||||||
@ -25,13 +27,15 @@
|
|||||||
#include "option-util.h"
|
#include "option-util.h"
|
||||||
#include "query-user.h"
|
#include "query-user.h"
|
||||||
#include "guile-util.h"
|
#include "guile-util.h"
|
||||||
|
#include "messages.h"
|
||||||
#include "util.h"
|
#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;
|
static short module = MOD_GUI;
|
||||||
|
|
||||||
static GNCOptionDB *global_options = NULL;
|
static GNCOptionDB *global_options = NULL;
|
||||||
static SCM guile_global_options = SCM_UNDEFINED;
|
static SCM guile_global_options = SCM_UNDEFINED;
|
||||||
|
static SCM guile_global_options_id = SCM_UNDEFINED;
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@ -71,8 +75,10 @@ gnc_options_shutdown()
|
|||||||
gnc_option_db_destroy(global_options);
|
gnc_option_db_destroy(global_options);
|
||||||
global_options = NULL;
|
global_options = NULL;
|
||||||
|
|
||||||
gnc_unregister_c_side_scheme_ptr(guile_global_options);
|
if (guile_global_options_id != SCM_UNDEFINED)
|
||||||
|
gnc_unregister_c_side_scheme_ptr_id(guile_global_options_id);
|
||||||
guile_global_options = SCM_UNDEFINED;
|
guile_global_options = SCM_UNDEFINED;
|
||||||
|
guile_global_options_id = SCM_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -209,7 +215,7 @@ void
|
|||||||
_gnc_register_global_options(SCM options)
|
_gnc_register_global_options(SCM options)
|
||||||
{
|
{
|
||||||
guile_global_options = options;
|
guile_global_options = options;
|
||||||
gnc_register_c_side_scheme_ptr(options);
|
guile_global_options_id = gnc_register_c_side_scheme_ptr(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -257,7 +263,7 @@ gnc_show_options_dialog()
|
|||||||
gnc_build_options_dialog_contents(options_dialog, global_options);
|
gnc_build_options_dialog_contents(options_dialog, global_options);
|
||||||
gnc_option_db_clean(global_options);
|
gnc_option_db_clean(global_options);
|
||||||
|
|
||||||
gtk_window_set_title(GTK_WINDOW(options_dialog), "GnuCash Preferences");
|
gtk_window_set_title(GTK_WINDOW(options_dialog), GNC_PREFS);
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(options_dialog), "apply",
|
gtk_signal_connect(GTK_OBJECT(options_dialog), "apply",
|
||||||
GTK_SIGNAL_FUNC(gnc_options_dialog_apply_cb),
|
GTK_SIGNAL_FUNC(gnc_options_dialog_apply_cb),
|
||||||
|
@ -17,11 +17,17 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <g-wrap.h>
|
||||||
|
|
||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
|
|
||||||
#include "guile-util.h"
|
#include "guile-util.h"
|
||||||
#include "option-util.h"
|
#include "option-util.h"
|
||||||
#include "dialog-options.h"
|
#include "dialog-options.h"
|
||||||
|
#include "gnc-helpers.h"
|
||||||
|
#include "gnc.h"
|
||||||
|
#include "window-main.h"
|
||||||
#include "ui-callbacks.h"
|
#include "ui-callbacks.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -63,7 +69,7 @@ struct _Getters
|
|||||||
SCM setter;
|
SCM setter;
|
||||||
SCM default_getter;
|
SCM default_getter;
|
||||||
SCM value_validator;
|
SCM value_validator;
|
||||||
SCM permissible_values;
|
SCM option_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -181,7 +187,7 @@ gnc_option_db_destroy(GNCOptionDB *odb)
|
|||||||
option = option_node->data;
|
option = option_node->data;
|
||||||
|
|
||||||
/* Should we check return value? */
|
/* Should we check return value? */
|
||||||
gnc_unregister_c_side_scheme_ptr(option->guile_option_id);
|
gnc_unregister_c_side_scheme_ptr_id(option->guile_option_id);
|
||||||
|
|
||||||
option_node = option_node->next;
|
option_node = option_node->next;
|
||||||
}
|
}
|
||||||
@ -280,8 +286,7 @@ initialize_getters()
|
|||||||
gh_eval_str("gnc:option-default-getter");
|
gh_eval_str("gnc:option-default-getter");
|
||||||
getters.value_validator =
|
getters.value_validator =
|
||||||
gh_eval_str("gnc:option-value-validator");
|
gh_eval_str("gnc:option-value-validator");
|
||||||
getters.permissible_values =
|
getters.option_data = gh_eval_str("gnc:option-data");
|
||||||
gh_eval_str("gnc:option-permissible-values");
|
|
||||||
|
|
||||||
getters_initialized = TRUE;
|
getters_initialized = TRUE;
|
||||||
}
|
}
|
||||||
@ -447,7 +452,7 @@ gnc_option_value_validator(GNCOption *option)
|
|||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_option_value_num_permissible_values *
|
* gnc_option_num_permissible_values *
|
||||||
* returns the number of permissible values in the option, or *
|
* returns the number of permissible values in the option, or *
|
||||||
* -1 if there are no values available. *
|
* -1 if there are no values available. *
|
||||||
* *
|
* *
|
||||||
@ -455,15 +460,13 @@ gnc_option_value_validator(GNCOption *option)
|
|||||||
* Returns: number of permissible options or -1 *
|
* Returns: number of permissible options or -1 *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
int
|
int
|
||||||
gnc_option_value_num_permissible_values(GNCOption *option)
|
gnc_option_num_permissible_values(GNCOption *option)
|
||||||
{
|
{
|
||||||
SCM values;
|
SCM values;
|
||||||
|
|
||||||
initialize_getters();
|
initialize_getters();
|
||||||
|
|
||||||
values = gnc_guile_call1_to_list(getters.permissible_values,
|
values = gnc_guile_call1_to_list(getters.option_data, option->guile_option);
|
||||||
option->guile_option);
|
|
||||||
|
|
||||||
if (values == SCM_UNDEFINED)
|
if (values == SCM_UNDEFINED)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -472,7 +475,7 @@ gnc_option_value_num_permissible_values(GNCOption *option)
|
|||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_option_value_permissible_value_index *
|
* gnc_option_permissible_value_index *
|
||||||
* returns the index of the permissible value matching the *
|
* returns the index of the permissible value matching the *
|
||||||
* provided value, or -1 if it couldn't be found *
|
* provided value, or -1 if it couldn't be found *
|
||||||
* *
|
* *
|
||||||
@ -481,7 +484,7 @@ gnc_option_value_num_permissible_values(GNCOption *option)
|
|||||||
* Returns: index of permissible value, or -1 *
|
* Returns: index of permissible value, or -1 *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
int
|
int
|
||||||
gnc_option_value_permissible_value_index(GNCOption *option, SCM search_value)
|
gnc_option_permissible_value_index(GNCOption *option, SCM search_value)
|
||||||
{
|
{
|
||||||
SCM values, vector, value;
|
SCM values, vector, value;
|
||||||
int num_values, i;
|
int num_values, i;
|
||||||
@ -491,9 +494,7 @@ gnc_option_value_permissible_value_index(GNCOption *option, SCM search_value)
|
|||||||
|
|
||||||
initialize_getters();
|
initialize_getters();
|
||||||
|
|
||||||
values = gnc_guile_call1_to_list(getters.permissible_values,
|
values = gnc_guile_call1_to_list(getters.option_data, option->guile_option);
|
||||||
option->guile_option);
|
|
||||||
|
|
||||||
if (values == SCM_UNDEFINED)
|
if (values == SCM_UNDEFINED)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -516,7 +517,7 @@ gnc_option_value_permissible_value_index(GNCOption *option, SCM search_value)
|
|||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_option_value_permissible_value *
|
* gnc_option_permissible_value *
|
||||||
* returns the SCM handle to the indexth permissible value in the *
|
* returns the SCM handle to the indexth permissible value in the *
|
||||||
* option, or SCM_UNDEFINED if the index was out of range or *
|
* option, or SCM_UNDEFINED if the index was out of range or *
|
||||||
* there was some other problem. *
|
* there was some other problem. *
|
||||||
@ -526,7 +527,7 @@ gnc_option_value_permissible_value_index(GNCOption *option, SCM search_value)
|
|||||||
* Returns: SCM handle to option value or SCM_UNDEFINED *
|
* Returns: SCM handle to option value or SCM_UNDEFINED *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
SCM
|
SCM
|
||||||
gnc_option_value_permissible_value(GNCOption *option, int index)
|
gnc_option_permissible_value(GNCOption *option, int index)
|
||||||
{
|
{
|
||||||
SCM values, vector, value;
|
SCM values, vector, value;
|
||||||
|
|
||||||
@ -535,9 +536,7 @@ gnc_option_value_permissible_value(GNCOption *option, int index)
|
|||||||
|
|
||||||
initialize_getters();
|
initialize_getters();
|
||||||
|
|
||||||
values = gnc_guile_call1_to_list(getters.permissible_values,
|
values = gnc_guile_call1_to_list(getters.option_data, option->guile_option);
|
||||||
option->guile_option);
|
|
||||||
|
|
||||||
if (values == SCM_UNDEFINED)
|
if (values == SCM_UNDEFINED)
|
||||||
return SCM_UNDEFINED;
|
return SCM_UNDEFINED;
|
||||||
|
|
||||||
@ -557,7 +556,7 @@ gnc_option_value_permissible_value(GNCOption *option, int index)
|
|||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_option_value_permissible_value_name *
|
* gnc_option_permissible_value_name *
|
||||||
* returns the malloc'd name of the indexth permissible value in *
|
* returns the malloc'd name of the indexth permissible value in *
|
||||||
* the option, or NULL if the index was out of range or there are *
|
* the option, or NULL if the index was out of range or there are *
|
||||||
* no values available. *
|
* no values available. *
|
||||||
@ -567,7 +566,7 @@ gnc_option_value_permissible_value(GNCOption *option, int index)
|
|||||||
* Returns: malloc'd name of permissible value or NULL *
|
* Returns: malloc'd name of permissible value or NULL *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
char *
|
char *
|
||||||
gnc_option_value_permissible_value_name(GNCOption *option, int index)
|
gnc_option_permissible_value_name(GNCOption *option, int index)
|
||||||
{
|
{
|
||||||
SCM values, vector, name;
|
SCM values, vector, name;
|
||||||
|
|
||||||
@ -576,9 +575,7 @@ gnc_option_value_permissible_value_name(GNCOption *option, int index)
|
|||||||
|
|
||||||
initialize_getters();
|
initialize_getters();
|
||||||
|
|
||||||
values = gnc_guile_call1_to_list(getters.permissible_values,
|
values = gnc_guile_call1_to_list(getters.option_data, option->guile_option);
|
||||||
option->guile_option);
|
|
||||||
|
|
||||||
if (values == SCM_UNDEFINED)
|
if (values == SCM_UNDEFINED)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -598,7 +595,7 @@ gnc_option_value_permissible_value_name(GNCOption *option, int index)
|
|||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_option_value_permissible_value_description *
|
* gnc_option_permissible_value_description *
|
||||||
* returns the malloc'd description of the indexth permissible *
|
* returns the malloc'd description of the indexth permissible *
|
||||||
* value in the option, or NULL if the index was out of range or *
|
* value in the option, or NULL if the index was out of range or *
|
||||||
* there are no values available. *
|
* there are no values available. *
|
||||||
@ -608,7 +605,7 @@ gnc_option_value_permissible_value_name(GNCOption *option, int index)
|
|||||||
* Returns: malloc'd description of permissible value or NULL *
|
* Returns: malloc'd description of permissible value or NULL *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
char *
|
char *
|
||||||
gnc_option_value_permissible_value_description(GNCOption *option, int index)
|
gnc_option_permissible_value_description(GNCOption *option, int index)
|
||||||
{
|
{
|
||||||
SCM values, vector, help;
|
SCM values, vector, help;
|
||||||
|
|
||||||
@ -617,9 +614,7 @@ gnc_option_value_permissible_value_description(GNCOption *option, int index)
|
|||||||
|
|
||||||
initialize_getters();
|
initialize_getters();
|
||||||
|
|
||||||
values = gnc_guile_call1_to_list(getters.permissible_values,
|
values = gnc_guile_call1_to_list(getters.option_data, option->guile_option);
|
||||||
option->guile_option);
|
|
||||||
|
|
||||||
if (values == SCM_UNDEFINED)
|
if (values == SCM_UNDEFINED)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -638,6 +633,48 @@ gnc_option_value_permissible_value_description(GNCOption *option, int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_option_show_time *
|
||||||
|
* returns true if the gui should display the time as well as *
|
||||||
|
* the date for this option. Only use this for date options. *
|
||||||
|
* *
|
||||||
|
* Args: option - the GNCOption *
|
||||||
|
* Returns: true if time should be shown *
|
||||||
|
\********************************************************************/
|
||||||
|
gboolean
|
||||||
|
gnc_option_show_time(GNCOption *option)
|
||||||
|
{
|
||||||
|
SCM value;
|
||||||
|
|
||||||
|
initialize_getters();
|
||||||
|
|
||||||
|
value = gh_call1(getters.option_data, option->guile_option);
|
||||||
|
|
||||||
|
return !gh_scm2bool(gh_not(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_option_multiple_selection *
|
||||||
|
* returns true if the gui should allow multiple selection of *
|
||||||
|
* accounts. Only use this for account options. *
|
||||||
|
* *
|
||||||
|
* Args: option - the GNCOption *
|
||||||
|
* Returns: true if multiple selection allowed *
|
||||||
|
\********************************************************************/
|
||||||
|
gboolean
|
||||||
|
gnc_option_multiple_selection(GNCOption *option)
|
||||||
|
{
|
||||||
|
SCM value;
|
||||||
|
|
||||||
|
initialize_getters();
|
||||||
|
|
||||||
|
value = gh_call1(getters.option_data, option->guile_option);
|
||||||
|
|
||||||
|
return !gh_scm2bool(gh_not(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
compare_sections(gconstpointer a, gconstpointer b)
|
compare_sections(gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
@ -950,6 +987,9 @@ gnc_commit_option(GNCOption *option)
|
|||||||
|
|
||||||
/* Validate the ui's value */
|
/* Validate the ui's value */
|
||||||
value = gnc_option_get_ui_value(option);
|
value = gnc_option_get_ui_value(option);
|
||||||
|
if (value == SCM_UNDEFINED)
|
||||||
|
return;
|
||||||
|
|
||||||
validator = gnc_option_value_validator(option);
|
validator = gnc_option_value_validator(option);
|
||||||
|
|
||||||
result = gh_call1(validator, value);
|
result = gh_call1(validator, value);
|
||||||
@ -1172,3 +1212,149 @@ gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb, char *section,
|
|||||||
|
|
||||||
return strdup(default_value);
|
return strdup(default_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_option_db_lookup_date_option *
|
||||||
|
* looks up a date option. If present, returns its value in the *
|
||||||
|
* set_value argument provided, otherwise copies the default_value*
|
||||||
|
* argument (if non-NULL) to the set_value argument. If the *
|
||||||
|
* default_value argument is NULL, copies the current date to *
|
||||||
|
* set_value. Whatever value is stored in set_value is return *
|
||||||
|
* as an approximate (no nanoseconds) time_t value. set_value *
|
||||||
|
* may be NULL, in which case only the return value can be used. *
|
||||||
|
* *
|
||||||
|
* Args: odb - option database to search in *
|
||||||
|
* section - section name of option *
|
||||||
|
* name - name of option *
|
||||||
|
* set_value - location to store option value *
|
||||||
|
* default - default value if not found *
|
||||||
|
* Return: time_t approximation of set_value *
|
||||||
|
\********************************************************************/
|
||||||
|
time_t
|
||||||
|
gnc_option_db_lookup_date_option(GNCOptionDB *odb, char *section, char *name,
|
||||||
|
Timespec *set_value, Timespec *default_value)
|
||||||
|
{
|
||||||
|
GNCOption *option;
|
||||||
|
Timespec temp;
|
||||||
|
SCM getter;
|
||||||
|
SCM value;
|
||||||
|
|
||||||
|
if (set_value == NULL)
|
||||||
|
set_value = &temp;
|
||||||
|
|
||||||
|
option = gnc_option_db_get_option_by_name(odb, section, name);
|
||||||
|
|
||||||
|
if (option != NULL)
|
||||||
|
{
|
||||||
|
getter = gnc_option_getter(option);
|
||||||
|
if (getter != SCM_UNDEFINED)
|
||||||
|
{
|
||||||
|
value = gh_call0(getter);
|
||||||
|
if (gnc_timepair_p(value))
|
||||||
|
*set_value = gnc_timepair2timespec(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (default_value == NULL)
|
||||||
|
{
|
||||||
|
set_value->tv_sec = time(NULL);
|
||||||
|
set_value->tv_nsec = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*set_value = *default_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return set_value->tv_sec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_account_list_to_scm *
|
||||||
|
* Turn a list of accounts into an SCM. *
|
||||||
|
* *
|
||||||
|
* Args: account_list - list of accounts to SCMify *
|
||||||
|
* Return: SCM list of accounts *
|
||||||
|
\********************************************************************/
|
||||||
|
SCM
|
||||||
|
gnc_account_list_to_scm(GList *account_list)
|
||||||
|
{
|
||||||
|
SCM list;
|
||||||
|
Account *account;
|
||||||
|
POINTER_TOKEN pt;
|
||||||
|
SCM scm_account;
|
||||||
|
|
||||||
|
list = gh_eval_str("()");
|
||||||
|
while (account_list != NULL)
|
||||||
|
{
|
||||||
|
account = account_list->data;
|
||||||
|
|
||||||
|
pt = make_POINTER_TOKEN("Account*", account);
|
||||||
|
scm_account = POINTER_TOKEN_to_SCM(pt);
|
||||||
|
|
||||||
|
list = gh_cons(scm_account, list);
|
||||||
|
|
||||||
|
account_list = account_list->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_scm_to_account_list *
|
||||||
|
* Turn an SCM into a g_malloc's account list *
|
||||||
|
* *
|
||||||
|
* Args: scm_list - SCM list of accounts *
|
||||||
|
* Return: GList of accounts *
|
||||||
|
\********************************************************************/
|
||||||
|
GList *
|
||||||
|
gnc_scm_to_account_list(SCM scm_list)
|
||||||
|
{
|
||||||
|
POINTER_TOKEN pt;
|
||||||
|
GList *account_list = NULL;
|
||||||
|
Account *account;
|
||||||
|
SCM scm_pt;
|
||||||
|
|
||||||
|
if (!gh_list_p(scm_list))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
while (!gh_null_p(scm_list))
|
||||||
|
{
|
||||||
|
scm_pt = gh_car(scm_list);
|
||||||
|
if (is_a_POINTER_TOKEN(scm_pt) == SCM_BOOL_T)
|
||||||
|
{
|
||||||
|
pt = (POINTER_TOKEN) gh_cdr(scm_pt);
|
||||||
|
account = pt->pdata;
|
||||||
|
account_list = g_list_prepend(account_list, account);
|
||||||
|
}
|
||||||
|
|
||||||
|
scm_list = gh_cdr(scm_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
return account_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_get_current_accounts *
|
||||||
|
* Return an SCMified list of the current accounts *
|
||||||
|
* *
|
||||||
|
* Args: none *
|
||||||
|
* Return: SCM list of current accounts *
|
||||||
|
\********************************************************************/
|
||||||
|
SCM
|
||||||
|
_gnc_get_current_accounts()
|
||||||
|
{
|
||||||
|
GList *list;
|
||||||
|
SCM scm_list;
|
||||||
|
|
||||||
|
list = gnc_get_current_accounts();
|
||||||
|
|
||||||
|
scm_list = gnc_account_list_to_scm(list);
|
||||||
|
|
||||||
|
g_list_free(list);
|
||||||
|
|
||||||
|
return scm_list;
|
||||||
|
}
|
||||||
|
@ -65,12 +65,13 @@ SCM gnc_option_getter(GNCOption *option);
|
|||||||
SCM gnc_option_setter(GNCOption *option);
|
SCM gnc_option_setter(GNCOption *option);
|
||||||
SCM gnc_option_default_getter(GNCOption *option);
|
SCM gnc_option_default_getter(GNCOption *option);
|
||||||
SCM gnc_option_value_validator(GNCOption *option);
|
SCM gnc_option_value_validator(GNCOption *option);
|
||||||
int gnc_option_value_num_permissible_values(GNCOption *option);
|
int gnc_option_num_permissible_values(GNCOption *option);
|
||||||
int gnc_option_value_permissible_value_index(GNCOption *option, SCM value);
|
int gnc_option_permissible_value_index(GNCOption *option, SCM value);
|
||||||
SCM gnc_option_value_permissible_value(GNCOption *option, int index);
|
SCM gnc_option_permissible_value(GNCOption *option, int index);
|
||||||
char * gnc_option_value_permissible_value_name(GNCOption *option, int index);
|
char * gnc_option_permissible_value_name(GNCOption *option, int index);
|
||||||
char * gnc_option_value_permissible_value_description(GNCOption *option,
|
char * gnc_option_permissible_value_description(GNCOption *option, int index);
|
||||||
int index);
|
gboolean gnc_option_show_time(GNCOption *option);
|
||||||
|
gboolean gnc_option_multiple_selection(GNCOption *option);
|
||||||
|
|
||||||
guint gnc_option_db_num_sections(GNCOptionDB *odb);
|
guint gnc_option_db_num_sections(GNCOptionDB *odb);
|
||||||
|
|
||||||
@ -108,5 +109,11 @@ char * gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb,
|
|||||||
void _gnc_option_db_register_option(GNCOptionDBHandle handle,
|
void _gnc_option_db_register_option(GNCOptionDBHandle handle,
|
||||||
SCM guile_option);
|
SCM guile_option);
|
||||||
|
|
||||||
|
/* These should be in src/guile or src/g-wrap, but they use glib */
|
||||||
|
|
||||||
|
SCM gnc_account_list_to_scm(GList *account_list);
|
||||||
|
GList * gnc_scm_to_account_list(SCM scm_list);
|
||||||
|
|
||||||
|
SCM _gnc_get_current_accounts();
|
||||||
|
|
||||||
#endif /* __OPTION_UTIL_H__ */
|
#endif /* __OPTION_UTIL_H__ */
|
||||||
|
@ -17,15 +17,20 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#include <gnome.h>
|
|
||||||
|
|
||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
|
|
||||||
|
#include <gnome.h>
|
||||||
|
|
||||||
|
#include "ui-callbacks.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "query-user.h"
|
#include "query-user.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
|
static short module = MOD_GUI;
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
gnc_foundation_query_dialog
|
gnc_foundation_query_dialog
|
||||||
|
|
||||||
@ -199,6 +204,66 @@ gnc_foundation_query_dialog(const gchar *title,
|
|||||||
return query_dialog;
|
return query_dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_verify_cancel_dialog *
|
||||||
|
* display a message, and asks the user to press "Yes", "No", or *
|
||||||
|
* "Cancel"
|
||||||
|
* *
|
||||||
|
* NOTE: This function does not return until the dialog is closed *
|
||||||
|
* *
|
||||||
|
* Args: message - the message to display *
|
||||||
|
* default - the button that will be the default *
|
||||||
|
* Return: the result the user selected *
|
||||||
|
\********************************************************************/
|
||||||
|
GNCVerifyResult
|
||||||
|
gnc_verify_cancel_dialog_parented(GtkWidget *parent, const char *message,
|
||||||
|
GNCVerifyResult default_result)
|
||||||
|
{
|
||||||
|
GtkWidget *verify_box = NULL;
|
||||||
|
gint default_button;
|
||||||
|
gint result;
|
||||||
|
|
||||||
|
verify_box = gnome_message_box_new(message,
|
||||||
|
GNOME_MESSAGE_BOX_QUESTION,
|
||||||
|
GNOME_STOCK_BUTTON_YES,
|
||||||
|
GNOME_STOCK_BUTTON_NO,
|
||||||
|
GNOME_STOCK_BUTTON_CANCEL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
switch (default_result)
|
||||||
|
{
|
||||||
|
case GNC_VERIFY_YES:
|
||||||
|
default_button = 0;
|
||||||
|
break;
|
||||||
|
case GNC_VERIFY_NO:
|
||||||
|
default_button = 1;
|
||||||
|
break;
|
||||||
|
case GNC_VERIFY_CANCEL:
|
||||||
|
default_button = 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PWARN("gnc_verify_cancel_dialog: bad default button\n");
|
||||||
|
default_button = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gnome_dialog_set_default(GNOME_DIALOG(verify_box), default_button);
|
||||||
|
if (parent != NULL)
|
||||||
|
gnome_dialog_set_parent(GNOME_DIALOG(verify_box), GTK_WINDOW(parent));
|
||||||
|
|
||||||
|
result = gnome_dialog_run_and_close(GNOME_DIALOG(verify_box));
|
||||||
|
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return GNC_VERIFY_YES;
|
||||||
|
case 1:
|
||||||
|
return GNC_VERIFY_NO;
|
||||||
|
case 2:
|
||||||
|
default:
|
||||||
|
return GNC_VERIFY_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_verify_dialog *
|
* gnc_verify_dialog *
|
||||||
@ -209,7 +274,7 @@ gnc_foundation_query_dialog(const gchar *title,
|
|||||||
* Args: message - the message to display *
|
* Args: message - the message to display *
|
||||||
* yes_is_default - If true, "Yes" is default, *
|
* yes_is_default - If true, "Yes" is default, *
|
||||||
* "No" is the default button. *
|
* "No" is the default button. *
|
||||||
* Return: none *
|
* Return: true for "Yes", false for "No" *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
gncBoolean
|
gncBoolean
|
||||||
gnc_verify_dialog(const char *message, gncBoolean yes_is_default)
|
gnc_verify_dialog(const char *message, gncBoolean yes_is_default)
|
||||||
@ -228,7 +293,7 @@ gnc_verify_dialog(const char *message, gncBoolean yes_is_default)
|
|||||||
* message - the message to display *
|
* message - the message to display *
|
||||||
* yes_is_default - If true, "Yes" is default, *
|
* yes_is_default - If true, "Yes" is default, *
|
||||||
* "No" is the default button. *
|
* "No" is the default button. *
|
||||||
* Return: none *
|
* Return: true for "Yes", false for "No" *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
gncBoolean
|
gncBoolean
|
||||||
gnc_verify_dialog_parented(GtkWindow *parent, const char *message,
|
gnc_verify_dialog_parented(GtkWindow *parent, const char *message,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef __QUERY_USER_H__
|
#ifndef __QUERY_USER_H__
|
||||||
#define __QUERY_USER_H__
|
#define __QUERY_USER_H__
|
||||||
|
|
||||||
#include "gnc-common.h"
|
|
||||||
#include <guile/gh.h>
|
#include <guile/gh.h>
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -19,11 +19,10 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include "top-level.h"
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
#include "gnucash.h"
|
#include "gnucash.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "reconcile-listP.h"
|
#include "reconcile-listP.h"
|
||||||
@ -90,7 +89,7 @@ static void
|
|||||||
gnc_reconcile_list_init(GNCReconcileList *list)
|
gnc_reconcile_list_init(GNCReconcileList *list)
|
||||||
{
|
{
|
||||||
GtkCList *clist = GTK_CLIST(list);
|
GtkCList *clist = GTK_CLIST(list);
|
||||||
static gchar * titles[] =
|
gchar * titles[] =
|
||||||
{
|
{
|
||||||
DATE_STR,
|
DATE_STR,
|
||||||
NUM_STR,
|
NUM_STR,
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "scripts_menu.h"
|
#include "scripts_menu.h"
|
||||||
|
|
||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#ifndef __SCRIPTS_MENU_H__
|
#ifndef __SCRIPTS_MENU_H__
|
||||||
#define __SCRIPTS_MENU_H__
|
#define __SCRIPTS_MENU_H__
|
||||||
|
|
||||||
#include <gnome.h>
|
|
||||||
#include <guile/gh.h>
|
#include <guile/gh.h>
|
||||||
|
|
||||||
void gnc_extensions_menu_add_item(char *name, char *hint, SCM script);
|
void gnc_extensions_menu_add_item(char *name, char *hint, SCM script);
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
* *
|
* *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include "top-level.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <guile/gh.h>
|
#include <guile/gh.h>
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
|
|
||||||
#include "window-main.h"
|
#include "window-main.h"
|
||||||
#include "global-options.h"
|
#include "global-options.h"
|
||||||
#include "gnucash-sheet.h"
|
#include "gnucash-sheet.h"
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
// Contains the version of GnuCash
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
gchar *VERSION = "1.1.26";
|
|
@ -23,11 +23,11 @@
|
|||||||
* Huntington Beach, CA 92648-4632 *
|
* Huntington Beach, CA 92648-4632 *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include "top-level.h"
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
|
|
||||||
#include "ui-callbacks.h"
|
#include "ui-callbacks.h"
|
||||||
#include "MultiLedger.h"
|
#include "MultiLedger.h"
|
||||||
#include "AdjBWindow.h"
|
#include "AdjBWindow.h"
|
||||||
@ -95,8 +95,7 @@ gnc_ui_AdjBWindow_ok_cb(GtkWidget * widget, gpointer data)
|
|||||||
|
|
||||||
if(sscanf(string, "%lf", &new_balance) != 1)
|
if(sscanf(string, "%lf", &new_balance) != 1)
|
||||||
{
|
{
|
||||||
gnc_error_dialog_parented(GTK_WINDOW(adjBData->dialog),
|
gnc_error_dialog_parented(GTK_WINDOW(adjBData->dialog), BALANCE_NUM_MSG);
|
||||||
"Balance must be a number.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
* Huntington Beach, CA 92648-4632 *
|
* Huntington Beach, CA 92648-4632 *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <top-level.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "window-help.h"
|
#include "window-help.h"
|
||||||
#include "window-html.h"
|
#include "window-html.h"
|
||||||
@ -44,6 +44,7 @@ typedef struct _HelpData HelpData;
|
|||||||
struct _HelpData
|
struct _HelpData
|
||||||
{
|
{
|
||||||
gchar *htmlfile;
|
gchar *htmlfile;
|
||||||
|
gchar *title;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
};
|
};
|
||||||
@ -52,64 +53,82 @@ struct _HelpData
|
|||||||
static HelpData *
|
static HelpData *
|
||||||
help_data_new()
|
help_data_new()
|
||||||
{
|
{
|
||||||
HelpData *hd;
|
HelpData *help_data;
|
||||||
|
|
||||||
hd = g_new0(HelpData, 1);
|
help_data = g_new0(HelpData, 1);
|
||||||
|
|
||||||
return hd;
|
return help_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
help_data_destroy(HTMLHistoryData history_data)
|
help_data_destroy(HTMLUserData history_data)
|
||||||
{
|
{
|
||||||
HelpData *hd = history_data;
|
HelpData *help_data = history_data;
|
||||||
|
|
||||||
g_free(hd->htmlfile);
|
g_free(help_data->htmlfile);
|
||||||
hd->htmlfile = NULL;
|
help_data->htmlfile = NULL;
|
||||||
|
|
||||||
g_free(hd->label);
|
g_free(help_data->title);
|
||||||
hd->label = NULL;
|
help_data->title = NULL;
|
||||||
|
|
||||||
g_free(hd->text);
|
g_free(help_data->label);
|
||||||
hd->text = NULL;
|
help_data->label = NULL;
|
||||||
|
|
||||||
g_free(hd);
|
g_free(help_data->text);
|
||||||
|
help_data->text = NULL;
|
||||||
|
|
||||||
|
g_free(help_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
help_data_set_file(HelpData *hd, const gchar *htmlfile)
|
help_data_set_file(HelpData *help_data, const gchar *htmlfile)
|
||||||
{
|
{
|
||||||
g_free(hd->htmlfile);
|
g_free(help_data->htmlfile);
|
||||||
hd->htmlfile = g_strdup(htmlfile);
|
help_data->htmlfile = g_strdup(htmlfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
help_data_set_label(HelpData *hd, const gchar *label)
|
help_data_set_title(HelpData *help_data, const gchar *title)
|
||||||
{
|
{
|
||||||
g_free(hd->label);
|
g_free(help_data->title);
|
||||||
hd->label = g_strdup(label);
|
help_data->title = g_strdup(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
help_data_set_text(HelpData *hd, const gchar *text)
|
help_data_set_label(HelpData *help_data, const gchar *label)
|
||||||
{
|
{
|
||||||
g_free(hd->text);
|
g_free(help_data->label);
|
||||||
hd->text = g_strdup(text);
|
help_data->label = g_strdup(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
help_data_set_text(HelpData *help_data, const gchar *text)
|
||||||
|
{
|
||||||
|
g_free(help_data->text);
|
||||||
|
help_data->text = g_strdup(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static HTMLHistoryData
|
static HTMLData *
|
||||||
helpAnchorCB(XmHTMLAnchorCallbackStruct *acbs, HTMLHistoryData history_data)
|
helpAnchorCB(XmHTMLAnchorCallbackStruct *acbs, HTMLUserData user_data)
|
||||||
{
|
{
|
||||||
HelpData *hd;
|
HelpData *user = user_data;
|
||||||
|
HTMLData *html_data;
|
||||||
|
HelpData *help_data;
|
||||||
|
|
||||||
switch(acbs->url_type)
|
switch(acbs->url_type)
|
||||||
{
|
{
|
||||||
/* a local file with a possible jump to label */
|
/* a local file with a possible jump to label */
|
||||||
case ANCHOR_FILE_LOCAL:
|
case ANCHOR_FILE_LOCAL:
|
||||||
hd = help_data_new();
|
help_data = help_data_new();
|
||||||
help_data_set_file(hd, acbs->href);
|
help_data_set_file(help_data, acbs->href);
|
||||||
return hd;
|
help_data_set_title(help_data, user->title);
|
||||||
|
|
||||||
|
html_data = gnc_html_data_new(user->title, help_data,
|
||||||
|
help_data_destroy,
|
||||||
|
NULL, 0);
|
||||||
|
|
||||||
|
return html_data;
|
||||||
|
|
||||||
/* other types are unsupported, but it would be fun if they were ... */
|
/* other types are unsupported, but it would be fun if they were ... */
|
||||||
case ANCHOR_FTP:
|
case ANCHOR_FTP:
|
||||||
@ -131,51 +150,51 @@ helpAnchorCB(XmHTMLAnchorCallbackStruct *acbs, HTMLHistoryData history_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
helpJumpCB(HTMLHistoryData history_data, char **set_text, char **set_label)
|
helpJumpCB(HTMLUserData user_data, char **set_text, char **set_label)
|
||||||
{
|
{
|
||||||
HelpData *hd = (HelpData *) history_data;
|
HelpData *help_data = user_data;
|
||||||
char *text = NULL;
|
char *text = NULL;
|
||||||
char *label = NULL;
|
char *label = NULL;
|
||||||
|
|
||||||
*set_text = NULL;
|
*set_text = NULL;
|
||||||
*set_label = NULL;
|
*set_label = NULL;
|
||||||
|
|
||||||
if (hd->text != NULL)
|
if (help_data->text != NULL)
|
||||||
{
|
{
|
||||||
*set_text = hd->text;
|
*set_text = help_data->text;
|
||||||
*set_label = hd->label;
|
*set_label = help_data->label;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hd->htmlfile == NULL)
|
if (help_data->htmlfile == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* see if this anchor contains a jump */
|
/* see if this anchor contains a jump */
|
||||||
label = strpbrk(hd->htmlfile, "#?");
|
label = strpbrk(help_data->htmlfile, "#?");
|
||||||
if (label != NULL)
|
if (label != NULL)
|
||||||
{
|
{
|
||||||
help_data_set_label(hd, label);
|
help_data_set_label(help_data, label);
|
||||||
|
|
||||||
/* truncate # from name */
|
/* truncate # from name */
|
||||||
hd->htmlfile[label - hd->htmlfile] = 0x0;
|
help_data->htmlfile[label - help_data->htmlfile] = 0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see if the anchor is an "active gnucash page" */
|
/* see if the anchor is an "active gnucash page" */
|
||||||
if (strstr(hd->htmlfile, ".phtml"))
|
if (strstr(help_data->htmlfile, ".phtml"))
|
||||||
text = gncReport(hd->htmlfile);
|
text = gncReport(help_data->htmlfile);
|
||||||
|
|
||||||
/* if text to display wasn't specified, use the truncated name to read */
|
/* if text to display wasn't specified, use the truncated name to read */
|
||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
text = gncReadFile(hd->htmlfile);
|
text = gncReadFile(help_data->htmlfile);
|
||||||
|
|
||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
{
|
{
|
||||||
help_data_set_text(hd, text);
|
help_data_set_text(help_data, text);
|
||||||
free(text);
|
free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
*set_text = hd->text;
|
*set_text = help_data->text;
|
||||||
*set_label = hd->label;
|
*set_label = help_data->label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -191,16 +210,19 @@ helpJumpCB(HTMLHistoryData history_data, char **set_text, char **set_label)
|
|||||||
void
|
void
|
||||||
helpWindow(GtkWidget *parent, const char *title, const char *htmlfile)
|
helpWindow(GtkWidget *parent, const char *title, const char *htmlfile)
|
||||||
{
|
{
|
||||||
HelpData *hd;
|
HTMLData *html_data;
|
||||||
|
HelpData *help_data;
|
||||||
|
|
||||||
if (helpwindow == NULL)
|
if (helpwindow == NULL)
|
||||||
helpwindow = gnc_html_window_new(help_data_destroy, helpAnchorCB,
|
helpwindow = gnc_html_window_new(helpAnchorCB, helpJumpCB);
|
||||||
helpJumpCB);
|
|
||||||
|
|
||||||
hd = help_data_new();
|
|
||||||
help_data_set_file(hd, htmlfile);
|
|
||||||
|
|
||||||
htmlWindow(parent, &helpwindow, title, hd, NULL, 0);
|
help_data = help_data_new();
|
||||||
|
help_data_set_file(help_data, htmlfile);
|
||||||
|
help_data_set_title(help_data, title);
|
||||||
|
|
||||||
|
html_data = gnc_html_data_new(title, help_data, help_data_destroy, NULL, 0);
|
||||||
|
|
||||||
|
htmlWindow(parent, &helpwindow, html_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,10 +25,6 @@
|
|||||||
#ifndef __WINDOW_HELP_H__
|
#ifndef __WINDOW_HELP_H__
|
||||||
#define __WINDOW_HELP_H__
|
#define __WINDOW_HELP_H__
|
||||||
|
|
||||||
#include <gnome.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
/** PROTOTYPES ******************************************************/
|
/** PROTOTYPES ******************************************************/
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
|
|
||||||
#include "window-html.h"
|
#include "window-html.h"
|
||||||
|
#include "messages.h"
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -40,33 +41,118 @@ static short module = MOD_HTML;
|
|||||||
* hack alert -- these are gui-independent, and should be moved *
|
* hack alert -- these are gui-independent, and should be moved *
|
||||||
* to a central location *
|
* to a central location *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
struct _HTMLData
|
||||||
|
{
|
||||||
|
char *title;
|
||||||
|
|
||||||
|
GnomeUIInfo *user_buttons;
|
||||||
|
int num_user_buttons;
|
||||||
|
|
||||||
|
HTMLUserData user_data;
|
||||||
|
HTMLDestroyUserDataFunc destroy;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct _HTMLHistoryNode HTMLHistoryNode;
|
typedef struct _HTMLHistoryNode HTMLHistoryNode;
|
||||||
struct _HTMLHistoryNode
|
struct _HTMLHistoryNode
|
||||||
{
|
{
|
||||||
HTMLHistoryNode *next;
|
HTMLHistoryNode *next;
|
||||||
HTMLHistoryNode *last;
|
HTMLHistoryNode *last;
|
||||||
|
|
||||||
HTMLHistoryData history_data;
|
HTMLData *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _HTMLHistory HTMLHistory;
|
typedef struct _HTMLHistory HTMLHistory;
|
||||||
struct _HTMLHistory
|
struct _HTMLHistory
|
||||||
{
|
{
|
||||||
HTMLHistoryNode *current_node;
|
HTMLHistoryNode *current_node;
|
||||||
HTMLHistoryDestroyDataFunc destroy;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************\
|
||||||
|
* gnc_html_data_new *
|
||||||
|
* construct a new html data structure *
|
||||||
|
* *
|
||||||
|
* Args: title - the title of the html window *
|
||||||
|
* user_data - html user data, whatever you like *
|
||||||
|
* destroy - function to destroy user data, or NULL*
|
||||||
|
* user_buttons - new buttons for the toolbar *
|
||||||
|
* num_user_buttons - number of new buttons *
|
||||||
|
* Return: html data structure *
|
||||||
|
\********************************************************************/
|
||||||
|
HTMLData *
|
||||||
|
gnc_html_data_new(const char *title, HTMLUserData user_data,
|
||||||
|
HTMLDestroyUserDataFunc destroy,
|
||||||
|
GnomeUIInfo *user_buttons,
|
||||||
|
int num_user_buttons)
|
||||||
|
{
|
||||||
|
HTMLData *data;
|
||||||
|
|
||||||
|
data = malloc(sizeof(HTMLData));
|
||||||
|
assert(data != NULL);
|
||||||
|
|
||||||
|
if (title != NULL)
|
||||||
|
{
|
||||||
|
data->title = strdup(title);
|
||||||
|
assert(title != NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
data->title = NULL;
|
||||||
|
|
||||||
|
if (num_user_buttons == 0)
|
||||||
|
data->user_buttons = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
data->user_buttons = calloc(num_user_buttons, sizeof(GnomeUIInfo));
|
||||||
|
assert(data->user_buttons != NULL);
|
||||||
|
|
||||||
|
for (i = 0; i < num_user_buttons; i++)
|
||||||
|
data->user_buttons[i] = user_buttons[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
data->num_user_buttons = num_user_buttons;
|
||||||
|
|
||||||
|
data->user_data = user_data;
|
||||||
|
data->destroy = destroy;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
html_data_destroy(HTMLData *data)
|
||||||
|
{
|
||||||
|
if (data == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (data->title != NULL)
|
||||||
|
free(data->title);
|
||||||
|
data->title = NULL;
|
||||||
|
|
||||||
|
if (data->user_buttons != NULL)
|
||||||
|
free(data->user_buttons);
|
||||||
|
data->user_buttons = NULL;
|
||||||
|
data->num_user_buttons = 0;
|
||||||
|
|
||||||
|
if ((data->destroy != NULL) &&
|
||||||
|
(data->user_data != NULL))
|
||||||
|
(data->destroy)(data->user_data);
|
||||||
|
|
||||||
|
data->destroy = NULL;
|
||||||
|
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
static HTMLHistoryNode *
|
static HTMLHistoryNode *
|
||||||
history_node_new(const HTMLHistoryData history_data)
|
history_node_new(HTMLData *data)
|
||||||
{
|
{
|
||||||
HTMLHistoryNode *new;
|
HTMLHistoryNode *new;
|
||||||
|
|
||||||
new = malloc(sizeof(HTMLHistoryNode));
|
new = malloc(sizeof(HTMLHistoryNode));
|
||||||
assert(new != NULL);
|
assert(new != NULL);
|
||||||
|
|
||||||
new->history_data = history_data;
|
new->data = data;
|
||||||
new->last = NULL;
|
new->last = NULL;
|
||||||
new->next = NULL;
|
new->next = NULL;
|
||||||
|
|
||||||
@ -77,14 +163,14 @@ history_node_new(const HTMLHistoryData history_data)
|
|||||||
* is the first element in the history. If not last element
|
* is the first element in the history. If not last element
|
||||||
* in history, all next pages are deleted */
|
* in history, all next pages are deleted */
|
||||||
static gncBoolean
|
static gncBoolean
|
||||||
historyInsert(HTMLHistory *history, const HTMLHistoryData history_data)
|
historyInsert(HTMLHistory *history, HTMLData *data)
|
||||||
{
|
{
|
||||||
HTMLHistoryNode *new;
|
HTMLHistoryNode *new;
|
||||||
HTMLHistoryNode *temp;
|
HTMLHistoryNode *temp;
|
||||||
|
|
||||||
assert(history != NULL);
|
assert(history != NULL);
|
||||||
|
|
||||||
new = history_node_new(history_data);
|
new = history_node_new(data);
|
||||||
|
|
||||||
if (history->current_node == NULL)
|
if (history->current_node == NULL)
|
||||||
{
|
{
|
||||||
@ -97,8 +183,8 @@ historyInsert(HTMLHistory *history, const HTMLHistoryData history_data)
|
|||||||
while(temp != NULL)
|
while(temp != NULL)
|
||||||
{
|
{
|
||||||
history->current_node->next = temp->next;
|
history->current_node->next = temp->next;
|
||||||
if (temp->history_data != NULL)
|
html_data_destroy(temp->data);
|
||||||
(history->destroy)(temp->history_data);
|
temp->data = NULL;
|
||||||
free(temp);
|
free(temp);
|
||||||
|
|
||||||
temp = history->current_node->next;
|
temp = history->current_node->next;
|
||||||
@ -112,7 +198,7 @@ historyInsert(HTMLHistory *history, const HTMLHistoryData history_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Move forward in history, and return current history data */
|
/* Move forward in history, and return current history data */
|
||||||
static HTMLHistoryData
|
static HTMLData *
|
||||||
historyFwd(HTMLHistory *history)
|
historyFwd(HTMLHistory *history)
|
||||||
{
|
{
|
||||||
if (history == NULL)
|
if (history == NULL)
|
||||||
@ -123,11 +209,11 @@ historyFwd(HTMLHistory *history)
|
|||||||
if (history->current_node->next != NULL)
|
if (history->current_node->next != NULL)
|
||||||
history->current_node = history->current_node->next;
|
history->current_node = history->current_node->next;
|
||||||
|
|
||||||
return history->current_node->history_data;
|
return history->current_node->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move back in history, and return current history data */
|
/* Move back in history, and return current history data */
|
||||||
static HTMLHistoryData
|
static HTMLData *
|
||||||
historyBack(HTMLHistory *history)
|
historyBack(HTMLHistory *history)
|
||||||
{
|
{
|
||||||
if (history == NULL)
|
if (history == NULL)
|
||||||
@ -138,10 +224,10 @@ historyBack(HTMLHistory *history)
|
|||||||
if (history->current_node->last != NULL)
|
if (history->current_node->last != NULL)
|
||||||
history->current_node = history->current_node->last;
|
history->current_node = history->current_node->last;
|
||||||
|
|
||||||
return history->current_node->history_data;
|
return history->current_node->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove all entries from history: */
|
/* Remove all entries from history */
|
||||||
static void
|
static void
|
||||||
historyClear(HTMLHistory *history)
|
historyClear(HTMLHistory *history)
|
||||||
{
|
{
|
||||||
@ -160,19 +246,19 @@ historyClear(HTMLHistory *history)
|
|||||||
HTMLHistoryNode *temp = history->current_node->next;
|
HTMLHistoryNode *temp = history->current_node->next;
|
||||||
|
|
||||||
history->current_node->next = temp->next;
|
history->current_node->next = temp->next;
|
||||||
if (temp->history_data != NULL)
|
html_data_destroy(temp->data);
|
||||||
(history->destroy)(temp->history_data);
|
temp->data = NULL;
|
||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* delete current page: */
|
/* delete current page: */
|
||||||
if (history->current_node->history_data != NULL)
|
html_data_destroy(history->current_node->data);
|
||||||
(history->destroy)(history->current_node->history_data);
|
history->current_node->data = NULL;
|
||||||
free(history->current_node);
|
free(history->current_node);
|
||||||
history->current_node = NULL;
|
history->current_node = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HTMLHistoryData
|
static HTMLData *
|
||||||
historyData(HTMLHistory *history)
|
historyData(HTMLHistory *history)
|
||||||
{
|
{
|
||||||
if (history == NULL)
|
if (history == NULL)
|
||||||
@ -180,11 +266,23 @@ historyData(HTMLHistory *history)
|
|||||||
if (history->current_node == NULL)
|
if (history->current_node == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return history->current_node->history_data;
|
return history->current_node->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HTMLUserData
|
||||||
|
historyUserData(HTMLHistory *history)
|
||||||
|
{
|
||||||
|
HTMLData *data;
|
||||||
|
|
||||||
|
data = historyData(history);
|
||||||
|
if (data == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return data->user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HTMLHistory *
|
static HTMLHistory *
|
||||||
historyNew(HTMLHistoryDestroyDataFunc destroy)
|
historyNew()
|
||||||
{
|
{
|
||||||
HTMLHistory *history;
|
HTMLHistory *history;
|
||||||
|
|
||||||
@ -192,7 +290,6 @@ historyNew(HTMLHistoryDestroyDataFunc destroy)
|
|||||||
assert(history != NULL);
|
assert(history != NULL);
|
||||||
|
|
||||||
history->current_node = NULL;
|
history->current_node = NULL;
|
||||||
history->destroy = destroy;
|
|
||||||
|
|
||||||
return history;
|
return history;
|
||||||
}
|
}
|
||||||
@ -220,6 +317,8 @@ struct _HTMLWindow
|
|||||||
GtkWidget *forward;
|
GtkWidget *forward;
|
||||||
GtkWidget *back;
|
GtkWidget *back;
|
||||||
|
|
||||||
|
GtkWidget *toolbar;
|
||||||
|
|
||||||
HTMLHistory *history;
|
HTMLHistory *history;
|
||||||
|
|
||||||
HTMLAnchorCB anchor_cb;
|
HTMLAnchorCB anchor_cb;
|
||||||
@ -246,19 +345,19 @@ static void htmlSetButtonStates(HTMLWindow *hw);
|
|||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_html_window_history_data *
|
* gnc_html_window_user_data *
|
||||||
* return the current history data for the window *
|
* return the current user data for the window *
|
||||||
* *
|
* *
|
||||||
* Args: none *
|
* Args: none *
|
||||||
* Return: history data for the window *
|
* Return: user data for the window *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
HTMLHistoryData
|
HTMLUserData
|
||||||
gnc_html_window_history_data(HTMLWindow *hw)
|
gnc_html_window_user_data(HTMLWindow *hw)
|
||||||
{
|
{
|
||||||
if (hw == NULL)
|
if (hw == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return historyData(hw->history);
|
return historyUserData(hw->history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,18 +365,18 @@ gnc_html_window_history_data(HTMLWindow *hw)
|
|||||||
* gnc_html_window_new *
|
* gnc_html_window_new *
|
||||||
* g_malloc and initialize HTMLWindow structure *
|
* g_malloc and initialize HTMLWindow structure *
|
||||||
* *
|
* *
|
||||||
* Args: none *
|
* Args: anchor_cb - callback for new html pages *
|
||||||
|
* jump_cb - callback for html text *
|
||||||
* Return: g_malloc'd initialized HTMLWindow structure *
|
* Return: g_malloc'd initialized HTMLWindow structure *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
HTMLWindow *
|
HTMLWindow *
|
||||||
gnc_html_window_new(HTMLHistoryDestroyDataFunc destroy,
|
gnc_html_window_new(HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb)
|
||||||
HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb)
|
|
||||||
{
|
{
|
||||||
HTMLWindow *hw;
|
HTMLWindow *hw;
|
||||||
|
|
||||||
hw = g_new0(HTMLWindow, 1);
|
hw = g_new0(HTMLWindow, 1);
|
||||||
|
|
||||||
hw->history = historyNew(destroy);
|
hw->history = historyNew();
|
||||||
|
|
||||||
hw->anchor_cb = anchor_cb;
|
hw->anchor_cb = anchor_cb;
|
||||||
hw->jump_cb = jump_cb;
|
hw->jump_cb = jump_cb;
|
||||||
@ -309,20 +408,20 @@ gnc_html_window_destroy(HTMLWindow *hw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget *
|
static void
|
||||||
create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons,
|
gnc_html_window_fill_toolbar(HTMLWindow *hw)
|
||||||
gint num_buttons)
|
|
||||||
{
|
{
|
||||||
GnomeUIInfo *toolbar_info;
|
GnomeUIInfo *toolbar_info;
|
||||||
GtkWidget *toolbar;
|
|
||||||
gint num_start, num_end;
|
gint num_start, num_end;
|
||||||
|
GList *children, *node;
|
||||||
|
HTMLData *data;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
GnomeUIInfo toolbar_start[] =
|
GnomeUIInfo toolbar_start[] =
|
||||||
{
|
{
|
||||||
{ GNOME_APP_UI_ITEM,
|
{ GNOME_APP_UI_ITEM,
|
||||||
"Back",
|
BACK_STR,
|
||||||
"Move back one step in the history.",
|
TOOLTIP_HTML_BACK,
|
||||||
htmlBackCB, hw,
|
htmlBackCB, hw,
|
||||||
NULL,
|
NULL,
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
@ -330,8 +429,8 @@ create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons,
|
|||||||
0, 0, NULL
|
0, 0, NULL
|
||||||
},
|
},
|
||||||
{ GNOME_APP_UI_ITEM,
|
{ GNOME_APP_UI_ITEM,
|
||||||
"Forward",
|
FORWARD_STR,
|
||||||
"Move forward one step in the history.",
|
TOOLTIP_HTML_FORW,
|
||||||
htmlFwdCB, hw,
|
htmlFwdCB, hw,
|
||||||
NULL,
|
NULL,
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
@ -343,8 +442,8 @@ create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons,
|
|||||||
GnomeUIInfo toolbar_end[] =
|
GnomeUIInfo toolbar_end[] =
|
||||||
{
|
{
|
||||||
{ GNOME_APP_UI_ITEM,
|
{ GNOME_APP_UI_ITEM,
|
||||||
"Close",
|
CLOSE_STR,
|
||||||
"Close this HTML window.",
|
TOOLTIP_CLOSE_HTML,
|
||||||
closeHtmlWinCB, hw,
|
closeHtmlWinCB, hw,
|
||||||
NULL,
|
NULL,
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
@ -354,30 +453,42 @@ create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons,
|
|||||||
GNOMEUIINFO_END
|
GNOMEUIINFO_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
data = historyData(hw->history);
|
||||||
|
if (data == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (hw->toolbar == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
node = children = gtk_container_children(GTK_CONTAINER(hw->toolbar));
|
||||||
|
while (node != NULL)
|
||||||
|
{
|
||||||
|
gtk_container_remove(GTK_CONTAINER(hw->toolbar), GTK_WIDGET(node->data));
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
g_list_free(children);
|
||||||
|
|
||||||
num_start = sizeof(toolbar_start) / sizeof(GnomeUIInfo);
|
num_start = sizeof(toolbar_start) / sizeof(GnomeUIInfo);
|
||||||
num_end = sizeof(toolbar_end) / sizeof(GnomeUIInfo);
|
num_end = sizeof(toolbar_end) / sizeof(GnomeUIInfo);
|
||||||
|
|
||||||
toolbar_info = g_new0(GnomeUIInfo, num_start + num_buttons + num_end);
|
toolbar_info = g_new0(GnomeUIInfo,
|
||||||
|
num_start + data->num_user_buttons + num_end);
|
||||||
|
|
||||||
for (i = 0; i < num_start; i++)
|
for (i = 0; i < num_start; i++)
|
||||||
toolbar_info[i] = toolbar_start[i];
|
toolbar_info[i] = toolbar_start[i];
|
||||||
|
|
||||||
for (i = 0; i < num_buttons; i++)
|
for (i = 0; i < data->num_user_buttons; i++)
|
||||||
toolbar_info[i + num_start] = user_buttons[i];
|
toolbar_info[i + num_start] = data->user_buttons[i];
|
||||||
|
|
||||||
for (i = 0; i < num_end; i++)
|
for (i = 0; i < num_end; i++)
|
||||||
toolbar_info[i + num_start + num_buttons] = toolbar_end[i];
|
toolbar_info[i + num_start + data->num_user_buttons] = toolbar_end[i];
|
||||||
|
|
||||||
toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
|
gnome_app_fill_toolbar(GTK_TOOLBAR(hw->toolbar), toolbar_info, NULL);
|
||||||
|
|
||||||
gnome_app_fill_toolbar(GTK_TOOLBAR(toolbar), toolbar_info, NULL);
|
|
||||||
|
|
||||||
hw->back = toolbar_info[0].widget;
|
hw->back = toolbar_info[0].widget;
|
||||||
hw->forward = toolbar_info[1].widget;
|
hw->forward = toolbar_info[1].widget;
|
||||||
|
|
||||||
g_free(toolbar_info);
|
g_free(toolbar_info);
|
||||||
|
|
||||||
return toolbar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -387,23 +498,19 @@ create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons,
|
|||||||
* *
|
* *
|
||||||
* Args: parent - the parent widget *
|
* Args: parent - the parent widget *
|
||||||
* hwp - the htmlwindow structure pointer *
|
* hwp - the htmlwindow structure pointer *
|
||||||
* title - the title of the window *
|
* data - the data for the window *
|
||||||
* history_data - the history data *
|
* user_buttons - array of buttons to add to icon bar *
|
||||||
* new_buttons - array of buttons to add to icon bar *
|
|
||||||
* num_buttons - number of buttons in list *
|
* num_buttons - number of buttons in list *
|
||||||
* Return: none *
|
* Return: none *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
void
|
void
|
||||||
htmlWindow(GtkWidget * parent,
|
htmlWindow(GtkWidget *parent,
|
||||||
HTMLWindow ** hwp,
|
HTMLWindow **hwp,
|
||||||
const char * const title,
|
HTMLData *data)
|
||||||
HTMLHistoryData history_data,
|
|
||||||
GnomeUIInfo *user_buttons,
|
|
||||||
gint num_buttons)
|
|
||||||
{
|
{
|
||||||
HTMLWindow *hw = *hwp;
|
HTMLWindow *hw = *hwp;
|
||||||
|
|
||||||
historyInsert(hw->history, history_data);
|
historyInsert(hw->history, data);
|
||||||
|
|
||||||
/* If the help window is already created, just load the new
|
/* If the help window is already created, just load the new
|
||||||
* page into the existing widget and raise the window. */
|
* page into the existing widget and raise the window. */
|
||||||
@ -429,7 +536,6 @@ htmlWindow(GtkWidget * parent,
|
|||||||
|
|
||||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
hw->window = window;
|
hw->window = window;
|
||||||
gtk_window_set_title(GTK_WINDOW (window), title);
|
|
||||||
gtk_window_set_policy(GTK_WINDOW (window), TRUE, TRUE, FALSE);
|
gtk_window_set_policy(GTK_WINDOW (window), TRUE, TRUE, FALSE);
|
||||||
gtk_window_set_default_size(GTK_WINDOW(window), 675, 400);
|
gtk_window_set_default_size(GTK_WINDOW(window), 675, 400);
|
||||||
|
|
||||||
@ -438,9 +544,10 @@ htmlWindow(GtkWidget * parent,
|
|||||||
|
|
||||||
dock_item = gnome_dock_item_new("toolbar", GNOME_DOCK_ITEM_BEH_EXCLUSIVE);
|
dock_item = gnome_dock_item_new("toolbar", GNOME_DOCK_ITEM_BEH_EXCLUSIVE);
|
||||||
|
|
||||||
toolbar = create_html_toolbar(hw, user_buttons, num_buttons);
|
toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
|
||||||
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 2);
|
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 2);
|
||||||
gtk_container_add(GTK_CONTAINER(dock_item), toolbar);
|
gtk_container_add(GTK_CONTAINER(dock_item), toolbar);
|
||||||
|
hw->toolbar = toolbar;
|
||||||
|
|
||||||
gnome_dock_add_item (GNOME_DOCK(dock), GNOME_DOCK_ITEM(dock_item),
|
gnome_dock_add_item (GNOME_DOCK(dock), GNOME_DOCK_ITEM(dock_item),
|
||||||
GNOME_DOCK_TOP, 0, 0, 0, TRUE);
|
GNOME_DOCK_TOP, 0, 0, 0, TRUE);
|
||||||
@ -505,46 +612,56 @@ htmlSetButtonStates(HTMLWindow *hw)
|
|||||||
* Return: none *
|
* Return: none *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
static gboolean
|
static gboolean
|
||||||
htmlKeyCB( GtkWidget *widget, GdkEventKey *event, gpointer data )
|
htmlKeyCB(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||||
{
|
{
|
||||||
HTMLWindow *hw = (HTMLWindow *) data;
|
HTMLWindow *hw = (HTMLWindow *) data;
|
||||||
GtkXmHTML *html = GTK_XMHTML(hw->htmlwidget);
|
GtkXmHTML *html = GTK_XMHTML(hw->htmlwidget);
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *vadj, *hadj;
|
||||||
gfloat value;
|
gfloat v_value, h_value;
|
||||||
|
|
||||||
if (html->vsba == NULL)
|
if (html->vsba == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
adj = GTK_ADJUSTMENT(html->vsba);
|
vadj = GTK_ADJUSTMENT(html->vsba);
|
||||||
|
hadj = GTK_ADJUSTMENT(html->hsba);
|
||||||
|
|
||||||
value = adj->value;
|
v_value = vadj->value;
|
||||||
|
h_value = hadj->value;
|
||||||
|
|
||||||
switch (event->keyval)
|
switch (event->keyval)
|
||||||
{
|
{
|
||||||
|
case GDK_KP_Left:
|
||||||
|
case GDK_Left:
|
||||||
|
h_value -= hadj->step_increment;
|
||||||
|
break;
|
||||||
|
case GDK_KP_Right:
|
||||||
|
case GDK_Right:
|
||||||
|
h_value += hadj->step_increment;
|
||||||
|
break;
|
||||||
case GDK_KP_Up:
|
case GDK_KP_Up:
|
||||||
case GDK_Up:
|
case GDK_Up:
|
||||||
value -= adj->step_increment;
|
v_value -= vadj->step_increment;
|
||||||
break;
|
break;
|
||||||
case GDK_KP_Down:
|
case GDK_KP_Down:
|
||||||
case GDK_Down:
|
case GDK_Down:
|
||||||
value += adj->step_increment;
|
v_value += vadj->step_increment;
|
||||||
break;
|
break;
|
||||||
case GDK_KP_Page_Up:
|
case GDK_KP_Page_Up:
|
||||||
case GDK_Page_Up:
|
case GDK_Page_Up:
|
||||||
value -= adj->page_increment;
|
v_value -= vadj->page_increment;
|
||||||
break;
|
break;
|
||||||
case GDK_KP_Page_Down:
|
case GDK_KP_Page_Down:
|
||||||
case GDK_Page_Down:
|
case GDK_Page_Down:
|
||||||
case GDK_space:
|
case GDK_space:
|
||||||
value += adj->page_increment;
|
v_value += vadj->page_increment;
|
||||||
break;
|
break;
|
||||||
case GDK_KP_Home:
|
case GDK_KP_Home:
|
||||||
case GDK_Home:
|
case GDK_Home:
|
||||||
value = adj->lower;
|
v_value = vadj->lower;
|
||||||
break;
|
break;
|
||||||
case GDK_KP_End:
|
case GDK_KP_End:
|
||||||
case GDK_End:
|
case GDK_End:
|
||||||
value = adj->upper;
|
v_value = vadj->upper;
|
||||||
break;
|
break;
|
||||||
case GDK_Escape:
|
case GDK_Escape:
|
||||||
gtk_widget_destroy(hw->window);
|
gtk_widget_destroy(hw->window);
|
||||||
@ -553,9 +670,11 @@ htmlKeyCB( GtkWidget *widget, GdkEventKey *event, gpointer data )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = CLAMP(value, adj->lower, adj->upper - adj->page_size);
|
v_value = CLAMP(v_value, vadj->lower, vadj->upper - vadj->page_size);
|
||||||
|
h_value = CLAMP(h_value, hadj->lower, hadj->upper - hadj->page_size);
|
||||||
|
|
||||||
gtk_adjustment_set_value(adj, value);
|
gtk_adjustment_set_value(vadj, v_value);
|
||||||
|
gtk_adjustment_set_value(hadj, h_value);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -573,9 +692,8 @@ static void
|
|||||||
htmlBackCB(GtkWidget *widget, gpointer data)
|
htmlBackCB(GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
HTMLWindow *hw = (HTMLWindow *) data;
|
HTMLWindow *hw = (HTMLWindow *) data;
|
||||||
HTMLHistoryData history_data;
|
|
||||||
|
|
||||||
history_data = historyBack(hw->history);
|
historyBack(hw->history);
|
||||||
|
|
||||||
gnc_html_load(hw);
|
gnc_html_load(hw);
|
||||||
|
|
||||||
@ -595,9 +713,8 @@ static void
|
|||||||
htmlFwdCB(GtkWidget *widget, gpointer data)
|
htmlFwdCB(GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
HTMLWindow *hw = (HTMLWindow *) data;
|
HTMLWindow *hw = (HTMLWindow *) data;
|
||||||
HTMLHistoryData history_data;
|
|
||||||
|
|
||||||
history_data = historyFwd(hw->history);
|
historyFwd(hw->history);
|
||||||
|
|
||||||
gnc_html_load(hw);
|
gnc_html_load(hw);
|
||||||
|
|
||||||
@ -660,7 +777,7 @@ htmlAnchorCB(GtkWidget *widget, XmHTMLAnchorCallbackStruct *acbs,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
HTMLWindow *hw = (HTMLWindow *) data;
|
HTMLWindow *hw = (HTMLWindow *) data;
|
||||||
HTMLHistoryData history_data;
|
HTMLData *html_data;
|
||||||
|
|
||||||
if (acbs->reason != XmCR_ACTIVATE) return;
|
if (acbs->reason != XmCR_ACTIVATE) return;
|
||||||
|
|
||||||
@ -675,11 +792,11 @@ htmlAnchorCB(GtkWidget *widget, XmHTMLAnchorCallbackStruct *acbs,
|
|||||||
if (hw->anchor_cb == NULL)
|
if (hw->anchor_cb == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
history_data = (hw->anchor_cb)(acbs, historyData(hw->history));
|
html_data = (hw->anchor_cb)(acbs, historyUserData(hw->history));
|
||||||
if (history_data == NULL)
|
if (html_data == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
historyInsert(hw->history, history_data);
|
historyInsert(hw->history, html_data);
|
||||||
gnc_html_load(hw);
|
gnc_html_load(hw);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -691,13 +808,13 @@ htmlAnchorCB(GtkWidget *widget, XmHTMLAnchorCallbackStruct *acbs,
|
|||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_html_load - load the current location into the html window *
|
* gnc_html_load - load the current location into the html window *
|
||||||
* *
|
* *
|
||||||
* Args: hw - the html window structure *
|
* Args: hw - the html window structure *
|
||||||
* Return: none *
|
* Return: none *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
void
|
void
|
||||||
gnc_html_load(HTMLWindow *hw)
|
gnc_html_load(HTMLWindow *hw)
|
||||||
{
|
{
|
||||||
HTMLHistoryData history_data;
|
HTMLData *data;
|
||||||
char *label = NULL;
|
char *label = NULL;
|
||||||
char *text = NULL;
|
char *text = NULL;
|
||||||
|
|
||||||
@ -706,9 +823,12 @@ gnc_html_load(HTMLWindow *hw)
|
|||||||
if (hw->jump_cb == NULL)
|
if (hw->jump_cb == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
history_data = historyData(hw->history);
|
data = historyData(hw->history);
|
||||||
|
|
||||||
(hw->jump_cb)(history_data, &text, &label);
|
gtk_window_set_title(GTK_WINDOW(hw->window), data->title);
|
||||||
|
gnc_html_window_fill_toolbar(hw);
|
||||||
|
|
||||||
|
(hw->jump_cb)(data->user_data, &text, &label);
|
||||||
|
|
||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -30,31 +30,33 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef struct _HTMLWindow HTMLWindow;
|
typedef struct _HTMLWindow HTMLWindow;
|
||||||
typedef void * HTMLHistoryData;
|
typedef struct _HTMLData HTMLData;
|
||||||
|
typedef void * HTMLUserData;
|
||||||
|
|
||||||
typedef void (*HTMLHistoryDestroyDataFunc)(HTMLHistoryData);
|
typedef void (*HTMLDestroyUserDataFunc)(HTMLUserData);
|
||||||
|
|
||||||
typedef HTMLHistoryData (*HTMLAnchorCB)(XmHTMLAnchorCallbackStruct *acbs,
|
typedef HTMLData* (*HTMLAnchorCB)(XmHTMLAnchorCallbackStruct *acbs,
|
||||||
HTMLHistoryData history_data);
|
HTMLUserData user_data);
|
||||||
|
|
||||||
typedef void (*HTMLJumpCB)(HTMLHistoryData history_data,
|
typedef void (*HTMLJumpCB)(HTMLUserData user_data,
|
||||||
char **text, char **label);
|
char **text, char **label);
|
||||||
|
|
||||||
|
|
||||||
HTMLHistoryData gnc_html_window_history_data(HTMLWindow *hw);
|
HTMLUserData gnc_html_window_user_data(HTMLWindow *hw);
|
||||||
|
|
||||||
HTMLWindow * gnc_html_window_new(HTMLHistoryDestroyDataFunc destroy,
|
HTMLWindow * gnc_html_window_new(HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb);
|
||||||
HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb);
|
|
||||||
|
|
||||||
|
|
||||||
void gnc_html_window_destroy(HTMLWindow *hw);
|
void gnc_html_window_destroy(HTMLWindow *hw);
|
||||||
|
|
||||||
void htmlWindow(GtkWidget * parent,
|
HTMLData * gnc_html_data_new(const char *title, HTMLUserData user_data,
|
||||||
HTMLWindow ** hwp,
|
HTMLDestroyUserDataFunc destroy,
|
||||||
const char * const title,
|
GnomeUIInfo *user_buttons,
|
||||||
HTMLHistoryData history_data,
|
int num_user_buttons);
|
||||||
GnomeUIInfo *user_buttons,
|
|
||||||
gint num_buttons);
|
void htmlWindow(GtkWidget *parent,
|
||||||
|
HTMLWindow **hwp,
|
||||||
|
HTMLData *data);
|
||||||
|
|
||||||
void gnc_html_load(HTMLWindow *hw);
|
void gnc_html_load(HTMLWindow *hw);
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
|
#include "top-level.h"
|
||||||
|
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
#include <guile/gh.h>
|
#include <guile/gh.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
|
|
||||||
#include "AccWindow.h"
|
#include "AccWindow.h"
|
||||||
#include "AdjBWindow.h"
|
#include "AdjBWindow.h"
|
||||||
#include "global-options.h"
|
#include "global-options.h"
|
||||||
@ -33,10 +33,9 @@
|
|||||||
#include "gnucash.h"
|
#include "gnucash.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Destroy.h"
|
#include "Destroy.h"
|
||||||
#include "messages.h"
|
#include "enriched-messages.h"
|
||||||
#include "RegWindow.h"
|
#include "RegWindow.h"
|
||||||
#include "Refresh.h"
|
#include "Refresh.h"
|
||||||
#include "version.h"
|
|
||||||
#include "window-main.h"
|
#include "window-main.h"
|
||||||
#include "window-mainP.h"
|
#include "window-mainP.h"
|
||||||
#include "window-reconcile.h"
|
#include "window-reconcile.h"
|
||||||
@ -53,7 +52,7 @@
|
|||||||
/* 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;
|
static short module = MOD_GUI;
|
||||||
|
|
||||||
|
/* Codes for the file menu */
|
||||||
enum {
|
enum {
|
||||||
FMB_NEW,
|
FMB_NEW,
|
||||||
FMB_OPEN,
|
FMB_OPEN,
|
||||||
@ -63,258 +62,6 @@ enum {
|
|||||||
FMB_QUIT,
|
FMB_QUIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Menus ***********************************************************/
|
|
||||||
static GnomeUIInfo filemenu[] = {
|
|
||||||
GNOMEUIINFO_MENU_NEW_ITEM(N_("New"),
|
|
||||||
N_("Create New File."),
|
|
||||||
gnc_ui_filemenu_cb,
|
|
||||||
GINT_TO_POINTER(FMB_NEW)),
|
|
||||||
GNOMEUIINFO_MENU_OPEN_ITEM(gnc_ui_filemenu_cb,
|
|
||||||
GINT_TO_POINTER(FMB_OPEN)),
|
|
||||||
GNOMEUIINFO_MENU_SAVE_ITEM(gnc_ui_filemenu_cb,
|
|
||||||
GINT_TO_POINTER(FMB_SAVE)),
|
|
||||||
GNOMEUIINFO_MENU_SAVE_AS_ITEM(gnc_ui_filemenu_cb,
|
|
||||||
GINT_TO_POINTER(FMB_SAVEAS)),
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("Import..."), N_("Import QIF File."),
|
|
||||||
gnc_ui_filemenu_cb, GINT_TO_POINTER(FMB_IMPORT), NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CONVERT,
|
|
||||||
'i', GDK_CONTROL_MASK, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
GNOMEUIINFO_MENU_EXIT_ITEM(gnc_ui_filemenu_cb,
|
|
||||||
GINT_TO_POINTER(FMB_QUIT)),
|
|
||||||
GNOMEUIINFO_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static GnomeUIInfo optionsmenu[] = {
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("Preferences"), N_("Preferences"),
|
|
||||||
gnc_ui_options_cb, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PREF,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("Gnucash News"), N_("News"),
|
|
||||||
gnc_ui_news_callback, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PREF,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
GNOMEUIINFO_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static GnomeUIInfo scrubmenu[] = {
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("_Scrub Account"), N_("Scrub the account clean"),
|
|
||||||
gnc_ui_mainWindow_scrub, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_NONE, NULL,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("Scrub S_ubaccounts"), N_("Scrub the account and all its "
|
|
||||||
"subaccounts clean"),
|
|
||||||
gnc_ui_mainWindow_scrub_sub, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_NONE, NULL,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("Scrub _All"), N_("Scrub all the accounts clean"),
|
|
||||||
gnc_ui_mainWindow_scrub_all, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_NONE, NULL,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static GnomeUIInfo accountsmenu[] = {
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("_View..."), N_("View account"),
|
|
||||||
gnc_ui_mainWindow_toolbar_open, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN,
|
|
||||||
'v', GDK_CONTROL_MASK, NULL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("View S_ubaccounts..."), N_("View account and subaccounts"),
|
|
||||||
gnc_ui_mainWindow_toolbar_open_subs, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("_Edit..."), N_("Edit account information"),
|
|
||||||
gnc_ui_mainWindow_toolbar_edit, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP,
|
|
||||||
'e', GDK_CONTROL_MASK, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("Re_concile..."), N_("Reconcile the account"),
|
|
||||||
gnc_ui_mainWindow_reconcile, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_NONE, NULL,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("_Transfer..."), N_("Transfer funds from one account to another"),
|
|
||||||
gnc_ui_mainWindow_transfer, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_NONE, NULL,
|
|
||||||
't', GDK_CONTROL_MASK, NULL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("Adjust _Balance..."), N_("Adjust the balance of the account"),
|
|
||||||
gnc_ui_mainWindow_adjust_balance, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_NONE, NULL,
|
|
||||||
'b', GDK_CONTROL_MASK, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("_Add..."), N_("Add Account"),
|
|
||||||
gnc_ui_add_account, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_ADD,
|
|
||||||
'a', GDK_CONTROL_MASK, NULL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("_Remove"), N_("Remove Account"),
|
|
||||||
gnc_ui_delete_account_cb, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_REMOVE,
|
|
||||||
'r', GDK_CONTROL_MASK, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
GNOMEUIINFO_SUBTREE(N_("_Scrub"), scrubmenu),
|
|
||||||
GNOMEUIINFO_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static GnomeUIInfo helpmenu[] = {
|
|
||||||
GNOMEUIINFO_MENU_ABOUT_ITEM(gnc_ui_about_cb, NULL),
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
{
|
|
||||||
GNOME_APP_UI_ITEM,
|
|
||||||
N_("_Help..."), N_("Gnucash Help."),
|
|
||||||
gnc_ui_help_cb, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_NONE, NULL,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_END
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static GnomeUIInfo scriptsmenu[] = {
|
|
||||||
GNOMEUIINFO_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static GnomeUIInfo mainmenu[] = {
|
|
||||||
GNOMEUIINFO_MENU_FILE_TREE(filemenu),
|
|
||||||
GNOMEUIINFO_SUBTREE(N_("_Accounts"), accountsmenu),
|
|
||||||
GNOMEUIINFO_SUBTREE(N_("_Options"), optionsmenu),
|
|
||||||
GNOMEUIINFO_SUBTREE(N_("_Extensions"), scriptsmenu),
|
|
||||||
GNOMEUIINFO_MENU_HELP_TREE(helpmenu),
|
|
||||||
GNOMEUIINFO_END
|
|
||||||
};
|
|
||||||
|
|
||||||
/** TOOLBAR ************************************************************/
|
|
||||||
static GnomeUIInfo toolbar[] =
|
|
||||||
{
|
|
||||||
{ GNOME_APP_UI_ITEM,
|
|
||||||
N_("Open"),
|
|
||||||
N_("Open File."),
|
|
||||||
gnc_ui_filemenu_cb,
|
|
||||||
GINT_TO_POINTER(FMB_OPEN),
|
|
||||||
NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
|
||||||
GNOME_STOCK_PIXMAP_OPEN,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
{ GNOME_APP_UI_ITEM,
|
|
||||||
N_("Save"),
|
|
||||||
N_("Save File."),
|
|
||||||
gnc_ui_filemenu_cb,
|
|
||||||
GINT_TO_POINTER(FMB_SAVE),
|
|
||||||
NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
|
||||||
GNOME_STOCK_PIXMAP_SAVE,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
{ GNOME_APP_UI_ITEM,
|
|
||||||
N_("Import"),
|
|
||||||
N_("Import QIF File."),
|
|
||||||
gnc_ui_filemenu_cb,
|
|
||||||
GINT_TO_POINTER(FMB_IMPORT),
|
|
||||||
NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
|
||||||
GNOME_STOCK_PIXMAP_CONVERT,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
{ GNOME_APP_UI_ITEM,
|
|
||||||
N_("View"),
|
|
||||||
N_("View selected account."),
|
|
||||||
gnc_ui_mainWindow_toolbar_open,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
|
||||||
GNOME_STOCK_PIXMAP_JUMP_TO,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
{ GNOME_APP_UI_ITEM,
|
|
||||||
N_("Edit"),
|
|
||||||
N_("Edit account information."),
|
|
||||||
gnc_ui_mainWindow_toolbar_edit,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
|
||||||
GNOME_STOCK_PIXMAP_PROPERTIES,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
{ GNOME_APP_UI_ITEM,
|
|
||||||
N_("Add"),
|
|
||||||
N_("Add a new account."),
|
|
||||||
gnc_ui_add_account,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
|
||||||
GNOME_STOCK_PIXMAP_ADD,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
{ GNOME_APP_UI_ITEM,
|
|
||||||
N_("Remove"),
|
|
||||||
N_("Remove selected account."),
|
|
||||||
gnc_ui_delete_account_cb,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
|
||||||
GNOME_STOCK_PIXMAP_REMOVE,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_SEPARATOR,
|
|
||||||
{ GNOME_APP_UI_ITEM,
|
|
||||||
N_("Exit"),
|
|
||||||
N_("Exit GnuCash."),
|
|
||||||
gnc_ui_exit_cb,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
|
||||||
GNOME_STOCK_PIXMAP_QUIT,
|
|
||||||
0, 0, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_END
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_ui_refresh_statusbar()
|
gnc_ui_refresh_statusbar()
|
||||||
@ -369,8 +116,9 @@ gnc_ui_refresh_statusbar()
|
|||||||
asset_string = g_strdup(xaccPrintAmount(assets, PRTSYM | PRTSEP));
|
asset_string = g_strdup(xaccPrintAmount(assets, PRTSYM | PRTSEP));
|
||||||
profit_string = g_strdup(xaccPrintAmount(profits, PRTSYM | PRTSEP));
|
profit_string = g_strdup(xaccPrintAmount(profits, PRTSYM | PRTSEP));
|
||||||
|
|
||||||
label_string = g_strconcat("Assets: ", asset_string,
|
label_string = g_strconcat(ASSETS_STR, ": ", asset_string, " ",
|
||||||
" Profits: ", profit_string, " ", NULL);
|
PROFITS_STR, ": ", profit_string, " ",
|
||||||
|
NULL);
|
||||||
|
|
||||||
label = gtk_object_get_data(GTK_OBJECT(gnc_get_ui_data()),
|
label = gtk_object_get_data(GTK_OBJECT(gnc_get_ui_data()),
|
||||||
"balance_label");
|
"balance_label");
|
||||||
@ -401,15 +149,14 @@ static void
|
|||||||
gnc_ui_about_cb (GtkWidget *widget, gpointer data)
|
gnc_ui_about_cb (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *about;
|
GtkWidget *about;
|
||||||
|
const gchar *copyright = "(C) 1998-1999 Linas Vepstas";
|
||||||
const gchar *authors[] = {
|
const gchar *authors[] = {
|
||||||
"Linas Vepstas <linas@linas.org>",
|
"Linas Vepstas <linas@linas.org>",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
about = gnome_about_new("GnuCash", "1.3 (development version)",
|
about = gnome_about_new("GnuCash", VERSION, copyright,
|
||||||
"(C) 1998-1999 Linas Vepstas",
|
authors, ABOUT_MSG, NULL);
|
||||||
authors,
|
|
||||||
"The GnuCash personal finance manager.\nThe GNU way to manage your money!", NULL);
|
|
||||||
|
|
||||||
gnome_dialog_run_and_close(GNOME_DIALOG(about));
|
gnome_dialog_run_and_close(GNOME_DIALOG(about));
|
||||||
}
|
}
|
||||||
@ -448,12 +195,19 @@ static void
|
|||||||
gnc_ui_delete_account_cb ( GtkWidget *widget, gpointer data )
|
gnc_ui_delete_account_cb ( GtkWidget *widget, gpointer data )
|
||||||
{
|
{
|
||||||
Account *account = gnc_get_current_account();
|
Account *account = gnc_get_current_account();
|
||||||
|
|
||||||
if (account)
|
if (account)
|
||||||
{
|
{
|
||||||
if (gnc_verify_dialog("Are you sure you want to delete this account?",
|
gchar *name;
|
||||||
GNC_F))
|
gchar *message;
|
||||||
|
|
||||||
|
name = xaccAccountGetName(account);
|
||||||
|
message = g_strdup_printf(ACC_DEL_SURE_MSG, name);
|
||||||
|
|
||||||
|
if (gnc_verify_dialog(message, GNC_F))
|
||||||
gnc_ui_delete_account(account);
|
gnc_ui_delete_account(account);
|
||||||
|
|
||||||
|
g_free(message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gnc_error_dialog(ACC_DEL_MSG);
|
gnc_error_dialog(ACC_DEL_MSG);
|
||||||
@ -467,7 +221,7 @@ gnc_ui_mainWindow_toolbar_open ( GtkWidget *widget, gpointer data )
|
|||||||
|
|
||||||
if (account == NULL)
|
if (account == NULL)
|
||||||
{
|
{
|
||||||
gnc_error_dialog("You must select an account to open first.");
|
gnc_error_dialog(ACC_OPEN_MSG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,7 +239,7 @@ gnc_ui_mainWindow_toolbar_open_subs(GtkWidget *widget, gpointer data)
|
|||||||
|
|
||||||
if (account == NULL)
|
if (account == NULL)
|
||||||
{
|
{
|
||||||
gnc_error_dialog("You must select an account to open first.");
|
gnc_error_dialog(ACC_OPEN_MSG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,7 +276,7 @@ gnc_ui_mainWindow_reconcile(GtkWidget *widget, gpointer data)
|
|||||||
gnc_ui_reconcile_window_raise(recnData);
|
gnc_ui_reconcile_window_raise(recnData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gnc_error_dialog("You must select an account");
|
gnc_error_dialog(ACC_RECONCILE_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -539,7 +293,7 @@ gnc_ui_mainWindow_adjust_balance(GtkWidget *widget, gpointer data)
|
|||||||
if (account != NULL)
|
if (account != NULL)
|
||||||
adjBWindow(account);
|
adjBWindow(account);
|
||||||
else
|
else
|
||||||
gnc_error_dialog("You must select an account to adjust first.");
|
gnc_error_dialog(ACC_ADJUST_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -549,7 +303,7 @@ gnc_ui_mainWindow_scrub(GtkWidget *widget, gpointer data)
|
|||||||
|
|
||||||
if (account == NULL)
|
if (account == NULL)
|
||||||
{
|
{
|
||||||
gnc_error_dialog("You must select an account to scrub first.");
|
gnc_error_dialog(ACC_SCRUB_MSG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +321,7 @@ gnc_ui_mainWindow_scrub_sub(GtkWidget *widget, gpointer data)
|
|||||||
|
|
||||||
if (account == NULL)
|
if (account == NULL)
|
||||||
{
|
{
|
||||||
gnc_error_dialog("You must select an account to scrub first.");
|
gnc_error_dialog(ACC_SCRUB_MSG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,7 +406,13 @@ gnc_ui_mainWindow_destroy_cb(GtkWidget *widget,
|
|||||||
GNCAccountTree *
|
GNCAccountTree *
|
||||||
gnc_get_current_account_tree()
|
gnc_get_current_account_tree()
|
||||||
{
|
{
|
||||||
return gtk_object_get_data(GTK_OBJECT(gnc_get_ui_data()), "account_tree");
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
widget = gnc_get_ui_data();
|
||||||
|
if (widget == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return gtk_object_get_data(GTK_OBJECT(widget), "account_tree");
|
||||||
}
|
}
|
||||||
|
|
||||||
Account *
|
Account *
|
||||||
@ -662,6 +422,13 @@ gnc_get_current_account()
|
|||||||
return gnc_account_tree_get_current_account(tree);
|
return gnc_account_tree_get_current_account(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GList *
|
||||||
|
gnc_get_current_accounts()
|
||||||
|
{
|
||||||
|
GNCAccountTree * tree = gnc_get_current_account_tree();
|
||||||
|
return gnc_account_tree_get_current_accounts(tree);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_account_tree_activate_cb(GNCAccountTree *tree,
|
gnc_account_tree_activate_cb(GNCAccountTree *tree,
|
||||||
Account *account,
|
Account *account,
|
||||||
@ -789,30 +556,280 @@ gnc_configure_account_tree(gpointer data)
|
|||||||
gnc_account_tree_set_view_info(tree, &new_avi);
|
gnc_account_tree_set_view_info(tree, &new_avi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_main_create_toolbar(GnomeApp *app)
|
||||||
|
{
|
||||||
|
GnomeUIInfo toolbar[] =
|
||||||
|
{
|
||||||
|
{ GNOME_APP_UI_ITEM,
|
||||||
|
OPEN_STR,
|
||||||
|
TOOLTIP_OPEN_FILE,
|
||||||
|
gnc_ui_filemenu_cb,
|
||||||
|
GINT_TO_POINTER(FMB_OPEN),
|
||||||
|
NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
|
GNOME_STOCK_PIXMAP_OPEN,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
{ GNOME_APP_UI_ITEM,
|
||||||
|
SAVE_STR,
|
||||||
|
TOOLTIP_SAVE_FILE,
|
||||||
|
gnc_ui_filemenu_cb,
|
||||||
|
GINT_TO_POINTER(FMB_SAVE),
|
||||||
|
NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
|
GNOME_STOCK_PIXMAP_SAVE,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
{ GNOME_APP_UI_ITEM,
|
||||||
|
IMPORT_STR,
|
||||||
|
TOOLTIP_IMPORT_QIF,
|
||||||
|
gnc_ui_filemenu_cb,
|
||||||
|
GINT_TO_POINTER(FMB_IMPORT),
|
||||||
|
NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
|
GNOME_STOCK_PIXMAP_CONVERT,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
{ GNOME_APP_UI_ITEM,
|
||||||
|
OPEN_STR,
|
||||||
|
TOOLTIP_OPEN,
|
||||||
|
gnc_ui_mainWindow_toolbar_open,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
|
GNOME_STOCK_PIXMAP_JUMP_TO,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
{ GNOME_APP_UI_ITEM,
|
||||||
|
EDIT_STR,
|
||||||
|
TOOLTIP_EDIT,
|
||||||
|
gnc_ui_mainWindow_toolbar_edit,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
|
GNOME_STOCK_PIXMAP_PROPERTIES,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
{ GNOME_APP_UI_ITEM,
|
||||||
|
NEW_STR,
|
||||||
|
TOOLTIP_NEW,
|
||||||
|
gnc_ui_add_account,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
|
GNOME_STOCK_PIXMAP_ADD,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
{ GNOME_APP_UI_ITEM,
|
||||||
|
DELETE_STR,
|
||||||
|
TOOLTIP_DELETE,
|
||||||
|
gnc_ui_delete_account_cb,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
|
GNOME_STOCK_PIXMAP_REMOVE,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
{ GNOME_APP_UI_ITEM,
|
||||||
|
EXIT_STR,
|
||||||
|
TOOLTIP_EXIT,
|
||||||
|
gnc_ui_exit_cb,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
|
GNOME_STOCK_PIXMAP_QUIT,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
|
gnome_app_create_toolbar(app, toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree)
|
||||||
|
{
|
||||||
|
GtkWidget *popup;
|
||||||
|
|
||||||
|
GnomeUIInfo filemenu[] = {
|
||||||
|
GNOMEUIINFO_MENU_NEW_ITEM(NEW_FILE_STR,
|
||||||
|
TOOLTIP_NEW_FILE,
|
||||||
|
gnc_ui_filemenu_cb,
|
||||||
|
GINT_TO_POINTER(FMB_NEW)),
|
||||||
|
GNOMEUIINFO_MENU_OPEN_ITEM(gnc_ui_filemenu_cb,
|
||||||
|
GINT_TO_POINTER(FMB_OPEN)),
|
||||||
|
GNOMEUIINFO_MENU_SAVE_ITEM(gnc_ui_filemenu_cb,
|
||||||
|
GINT_TO_POINTER(FMB_SAVE)),
|
||||||
|
GNOMEUIINFO_MENU_SAVE_AS_ITEM(gnc_ui_filemenu_cb,
|
||||||
|
GINT_TO_POINTER(FMB_SAVEAS)),
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
IMPORT_QIF_E_STR, TOOLTIP_IMPORT_QIF,
|
||||||
|
gnc_ui_filemenu_cb, GINT_TO_POINTER(FMB_IMPORT), NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CONVERT,
|
||||||
|
'i', GDK_CONTROL_MASK, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
GNOMEUIINFO_MENU_EXIT_ITEM(gnc_ui_filemenu_cb,
|
||||||
|
GINT_TO_POINTER(FMB_QUIT)),
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
|
GnomeUIInfo optionsmenu[] = {
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
PREFERENCES_STR, TOOLTIP_PREFERENCES,
|
||||||
|
gnc_ui_options_cb, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PREF,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
|
GnomeUIInfo scrubmenu[] = {
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
SCRUB_ACCT_STR, TOOLTIP_SCRUB_ACCT,
|
||||||
|
gnc_ui_mainWindow_scrub, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_NONE, NULL,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
SCRUB_SUBACCTS_STR, TOOLTIP_SCRUB_SUB,
|
||||||
|
gnc_ui_mainWindow_scrub_sub, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_NONE, NULL,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
SCRUB_ALL_STR, TOOLTIP_SCRUB_ALL,
|
||||||
|
gnc_ui_mainWindow_scrub_all, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_NONE, NULL,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
|
GnomeUIInfo accountsmenu[] = {
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
OPEN_ACC_E_STR, TOOLTIP_OPEN,
|
||||||
|
gnc_ui_mainWindow_toolbar_open, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN,
|
||||||
|
'v', GDK_CONTROL_MASK, NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
OPEN_SUB_E_STR, TOOLTIP_OPEN_SUB,
|
||||||
|
gnc_ui_mainWindow_toolbar_open_subs, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
EDIT_ACCT_E_STR, TOOLTIP_EDIT,
|
||||||
|
gnc_ui_mainWindow_toolbar_edit, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP,
|
||||||
|
'e', GDK_CONTROL_MASK, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
RECONCILE_E_STR, TOOLTIP_RECONCILE,
|
||||||
|
gnc_ui_mainWindow_reconcile, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_NONE, NULL,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
TRANSFER_E_STR, TOOLTIP_TRANSFER,
|
||||||
|
gnc_ui_mainWindow_transfer, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_NONE, NULL,
|
||||||
|
't', GDK_CONTROL_MASK, NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
ADJ_BALN_E_STR, TOOLTIP_ADJUST,
|
||||||
|
gnc_ui_mainWindow_adjust_balance, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_NONE, NULL,
|
||||||
|
'b', GDK_CONTROL_MASK, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
NEW_ACC_E_STR, TOOLTIP_NEW,
|
||||||
|
gnc_ui_add_account, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_ADD,
|
||||||
|
'a', GDK_CONTROL_MASK, NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
DEL_ACC_E_STR, TOOLTIP_DELETE,
|
||||||
|
gnc_ui_delete_account_cb, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_REMOVE,
|
||||||
|
'r', GDK_CONTROL_MASK, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
GNOMEUIINFO_SUBTREE(SCRUB_STR, scrubmenu),
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
|
GnomeUIInfo helpmenu[] = {
|
||||||
|
GNOMEUIINFO_MENU_ABOUT_ITEM(gnc_ui_about_cb, NULL),
|
||||||
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
HELP_E_STR, TOOLTIP_HELP,
|
||||||
|
gnc_ui_help_cb, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_NONE, NULL,
|
||||||
|
0, 0, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
|
GnomeUIInfo scriptsmenu[] = {
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
|
GnomeUIInfo mainmenu[] = {
|
||||||
|
GNOMEUIINFO_MENU_FILE_TREE(filemenu),
|
||||||
|
GNOMEUIINFO_SUBTREE(ACCOUNTS_STR, accountsmenu),
|
||||||
|
GNOMEUIINFO_MENU_SETTINGS_TREE(optionsmenu),
|
||||||
|
GNOMEUIINFO_SUBTREE(EXTENSIONS_STR, scriptsmenu),
|
||||||
|
GNOMEUIINFO_MENU_HELP_TREE(helpmenu),
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
|
gnome_app_create_menus(app, mainmenu);
|
||||||
|
gnome_app_install_menu_hints(app, mainmenu);
|
||||||
|
|
||||||
|
popup = gnome_popup_menu_new(accountsmenu);
|
||||||
|
gnome_popup_menu_attach(popup, account_tree, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mainWindow()
|
mainWindow()
|
||||||
{
|
{
|
||||||
GtkWidget *app = gnc_get_ui_data();
|
GtkWidget *app = gnc_get_ui_data();
|
||||||
GtkWidget *popup;
|
|
||||||
GtkWidget *scrolled_win;
|
GtkWidget *scrolled_win;
|
||||||
GtkWidget *statusbar;
|
GtkWidget *statusbar;
|
||||||
GtkWidget *account_tree;
|
GtkWidget *account_tree;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
|
||||||
account_tree = gnc_account_tree_new();
|
account_tree = gnc_account_tree_new();
|
||||||
gtk_object_set_data (GTK_OBJECT (app), "account_tree", account_tree);
|
gtk_object_set_data(GTK_OBJECT (app), "account_tree", account_tree);
|
||||||
gnc_configure_account_tree(NULL);
|
gnc_configure_account_tree(NULL);
|
||||||
gnc_register_option_change_callback(gnc_configure_account_tree, NULL);
|
gnc_register_option_change_callback(gnc_configure_account_tree, NULL);
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT (account_tree), "activate_account",
|
gtk_signal_connect(GTK_OBJECT (account_tree), "activate_account",
|
||||||
GTK_SIGNAL_FUNC (gnc_account_tree_activate_cb), NULL);
|
GTK_SIGNAL_FUNC (gnc_account_tree_activate_cb), NULL);
|
||||||
|
|
||||||
popup = gnome_popup_menu_new(accountsmenu);
|
|
||||||
gnome_popup_menu_attach(GTK_WIDGET(popup), GTK_WIDGET(account_tree), NULL);
|
|
||||||
|
|
||||||
gnome_app_create_toolbar(GNOME_APP(app), toolbar);
|
|
||||||
gnome_app_create_menus(GNOME_APP(app), mainmenu);
|
|
||||||
|
|
||||||
/* create statusbar and add it to the application. */
|
/* create statusbar and add it to the application. */
|
||||||
statusbar = gnome_appbar_new(GNC_F, /* no progress bar, maybe later? */
|
statusbar = gnome_appbar_new(GNC_F, /* no progress bar, maybe later? */
|
||||||
GNC_T, /* has status area */
|
GNC_T, /* has status area */
|
||||||
@ -820,6 +837,9 @@ mainWindow()
|
|||||||
|
|
||||||
gnome_app_set_statusbar(GNOME_APP(app), GTK_WIDGET(statusbar));
|
gnome_app_set_statusbar(GNOME_APP(app), GTK_WIDGET(statusbar));
|
||||||
|
|
||||||
|
gnc_main_create_menus(GNOME_APP(app), account_tree);
|
||||||
|
gnc_main_create_toolbar(GNOME_APP(app));
|
||||||
|
|
||||||
/* create the label containing the account balances */
|
/* create the label containing the account balances */
|
||||||
label = gtk_label_new("");
|
label = gtk_label_new("");
|
||||||
gtk_object_set_data (GTK_OBJECT (app), "balance_label", label);
|
gtk_object_set_data (GTK_OBJECT (app), "balance_label", label);
|
||||||
@ -844,8 +864,6 @@ mainWindow()
|
|||||||
gh_call2(run_danglers, hook, window);
|
gh_call2(run_danglers, hook, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnome_app_install_menu_hints(GNOME_APP(app), mainmenu);
|
|
||||||
|
|
||||||
/* Attach delete and destroy signals to the main window */
|
/* Attach delete and destroy signals to the main window */
|
||||||
gtk_signal_connect (GTK_OBJECT (app), "delete_event",
|
gtk_signal_connect (GTK_OBJECT (app), "delete_event",
|
||||||
GTK_SIGNAL_FUNC (gnc_ui_mainWindow_delete_cb),
|
GTK_SIGNAL_FUNC (gnc_ui_mainWindow_delete_cb),
|
||||||
|
@ -26,7 +26,10 @@
|
|||||||
/** PROTOTYPES ******************************************************/
|
/** PROTOTYPES ******************************************************/
|
||||||
|
|
||||||
void mainWindow(void);
|
void mainWindow(void);
|
||||||
|
|
||||||
GNCAccountTree * gnc_get_current_account_tree();
|
GNCAccountTree * gnc_get_current_account_tree();
|
||||||
|
|
||||||
Account * gnc_get_current_account();
|
Account * gnc_get_current_account();
|
||||||
|
GList * gnc_get_current_accounts();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,10 +25,6 @@
|
|||||||
#ifndef __WINDOW_MAINP_H__
|
#ifndef __WINDOW_MAINP_H__
|
||||||
#define __WINDOW_MAINP_H__
|
#define __WINDOW_MAINP_H__
|
||||||
|
|
||||||
#include <gnome.h>
|
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
|
|
||||||
|
|
||||||
/** PROTOTYPES ******************************************************/
|
/** PROTOTYPES ******************************************************/
|
||||||
static void gnc_ui_refresh_statusbar(void);
|
static void gnc_ui_refresh_statusbar(void);
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <stdio.h>
|
|
||||||
#include <gnome.h>
|
|
||||||
|
|
||||||
#include "top-level.h"
|
#include "top-level.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "date.h"
|
#include "date.h"
|
||||||
#include "MultiLedger.h"
|
#include "MultiLedger.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
@ -39,7 +40,7 @@
|
|||||||
#include "Refresh.h"
|
#include "Refresh.h"
|
||||||
#include "query-user.h"
|
#include "query-user.h"
|
||||||
#include "window-help.h"
|
#include "window-help.h"
|
||||||
#include "messages.h"
|
#include "enriched-messages.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +174,7 @@ recnRecalculateBalance(RecnWindow *recnData)
|
|||||||
* diff - returns the amount from ending balance field *
|
* diff - returns the amount from ending balance field *
|
||||||
* Return: True, if the user presses "Ok", else False *
|
* Return: True, if the user presses "Ok", else False *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
gboolean
|
static gboolean
|
||||||
startRecnWindow(GtkWidget *parent, Account *account, double *diff)
|
startRecnWindow(GtkWidget *parent, Account *account, double *diff)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog, *end_value;
|
GtkWidget *dialog, *end_value;
|
||||||
@ -266,8 +267,7 @@ startRecnWindow(GtkWidget *parent, Account *account, double *diff)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gnc_error_dialog_parented(GTK_WINDOW(parent),
|
gnc_error_dialog_parented(GTK_WINDOW(parent), BALANCE_NUM_MSG);
|
||||||
"Ending balance must be a number.");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -443,11 +443,10 @@ gnc_ui_reconcile_window_delete_cb(GtkButton *button, gpointer data)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
{
|
{
|
||||||
gchar * buf = "Are you sure you want to delete the current transaction?";
|
|
||||||
gboolean result;
|
gboolean result;
|
||||||
|
|
||||||
result = gnc_verify_dialog_parented(GTK_WINDOW(recnData->dialog),
|
result = gnc_verify_dialog_parented(GTK_WINDOW(recnData->dialog),
|
||||||
buf, GNC_F);
|
TRANS_DEL2_MSG, GNC_F);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
return;
|
return;
|
||||||
@ -599,35 +598,41 @@ recnWindow(GtkWidget *parent, Account *account)
|
|||||||
bbox = gtk_hbutton_box_new();
|
bbox = gtk_hbutton_box_new();
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), bbox, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(hbox), bbox, FALSE, FALSE, 0);
|
||||||
|
|
||||||
button = gtk_button_new_with_label("New");
|
button = gtk_button_new_with_label(NEW_STR);
|
||||||
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
||||||
gnc_set_tooltip(button, "Add a new transaction to the account");
|
gnc_set_tooltip(button, TOOLTIP_NEW_TRANS);
|
||||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_new_cb),
|
GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_new_cb),
|
||||||
recnData);
|
recnData);
|
||||||
|
|
||||||
button = gtk_button_new_with_label("Edit");
|
button = gtk_button_new_with_label(EDIT_STR);
|
||||||
recnData->edit_button = button;
|
recnData->edit_button = button;
|
||||||
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
||||||
gnc_set_tooltip(button, "Edit the current transaction");
|
gnc_set_tooltip(button, TOOLTIP_EDIT_TRANS);
|
||||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_edit_cb),
|
GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_edit_cb),
|
||||||
recnData);
|
recnData);
|
||||||
|
|
||||||
button = gtk_button_new_with_label("Delete");
|
button = gtk_button_new_with_label(DELETE_STR);
|
||||||
recnData->delete_button = button;
|
recnData->delete_button = button;
|
||||||
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
||||||
gnc_set_tooltip(button, "Delete the current transaction");
|
gnc_set_tooltip(button, TOOLTIP_DEL_TRANS);
|
||||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_delete_cb),
|
GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_delete_cb),
|
||||||
recnData);
|
recnData);
|
||||||
|
|
||||||
button = gtk_button_new_with_label("Edit Info...");
|
{
|
||||||
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
gchar *s = g_strconcat(END_BALN_STR, "...", NULL);
|
||||||
gnc_set_tooltip(button, "Adjust the ending balance");
|
|
||||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
button = gtk_button_new_with_label(s);
|
||||||
GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_change_cb),
|
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
||||||
recnData);
|
gnc_set_tooltip(button, TOOLTIP_ADJUST_END);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_change_cb),
|
||||||
|
recnData);
|
||||||
|
|
||||||
|
g_free(s);
|
||||||
|
}
|
||||||
|
|
||||||
/* frame to hold totals */
|
/* frame to hold totals */
|
||||||
frame = gtk_frame_new(NULL);
|
frame = gtk_frame_new(NULL);
|
||||||
@ -785,9 +790,7 @@ recnOkCB(GtkWidget *w, gpointer data)
|
|||||||
|
|
||||||
if (!DEQ(recnRecalculateBalance(recnData), 0.0))
|
if (!DEQ(recnRecalculateBalance(recnData), 0.0))
|
||||||
if (!gnc_verify_dialog_parented(GTK_WINDOW(recnData->dialog),
|
if (!gnc_verify_dialog_parented(GTK_WINDOW(recnData->dialog),
|
||||||
"The account is not balanced.\n" \
|
RECN_BALN_WARN, GNC_F))
|
||||||
"Are you sure you want to finish?",
|
|
||||||
GNC_F))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gnc_reconcile_list_commit(GNC_RECONCILE_LIST(recnData->credit));
|
gnc_reconcile_list_commit(GNC_RECONCILE_LIST(recnData->credit));
|
||||||
|
@ -25,12 +25,6 @@
|
|||||||
#ifndef __WINDOW_RECONCILE_H__
|
#ifndef __WINDOW_RECONCILE_H__
|
||||||
#define __WINDOW_RECONCILE_H__
|
#define __WINDOW_RECONCILE_H__
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
|
|
||||||
|
|
||||||
/** GLOBALS *********************************************************/
|
/** GLOBALS *********************************************************/
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -20,8 +20,6 @@
|
|||||||
#ifndef __WINDOW_REGISTER_H__
|
#ifndef __WINDOW_REGISTER_H__
|
||||||
#define __WINDOW_REGISTER_H__
|
#define __WINDOW_REGISTER_H__
|
||||||
|
|
||||||
#include "top-level.h"
|
|
||||||
|
|
||||||
void gnc_register_raise(RegWindow *regData);
|
void gnc_register_raise(RegWindow *regData);
|
||||||
void gnc_register_jump_to_blank(RegWindow *regData);
|
void gnc_register_jump_to_blank(RegWindow *regData);
|
||||||
void gnc_register_jump_to_split(RegWindow *regData, Split *split);
|
void gnc_register_jump_to_split(RegWindow *regData, Split *split);
|
||||||
|
@ -24,15 +24,16 @@
|
|||||||
* Huntington Beach, CA 92648-4632 *
|
* Huntington Beach, CA 92648-4632 *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#include <gnome.h>
|
#include "top-level.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include <gnome.h>
|
||||||
|
|
||||||
#include "window-report.h"
|
#include "window-report.h"
|
||||||
#include "window-html.h"
|
#include "window-html.h"
|
||||||
#include "option-util.h"
|
#include "option-util.h"
|
||||||
#include "guile-util.h"
|
#include "guile-util.h"
|
||||||
#include "dialog-options.h"
|
#include "dialog-options.h"
|
||||||
|
#include "messages.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static short module = MOD_HTML;
|
static short module = MOD_HTML;
|
||||||
@ -50,73 +51,83 @@ struct _ReportData
|
|||||||
GtkWidget *option_dialog;
|
GtkWidget *option_dialog;
|
||||||
|
|
||||||
SCM rendering_thunk;
|
SCM rendering_thunk;
|
||||||
|
SCM rendering_thunk_id;
|
||||||
|
|
||||||
SCM guile_options;
|
SCM guile_options;
|
||||||
|
SCM guile_options_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static ReportData *
|
static ReportData *
|
||||||
report_data_new()
|
report_data_new()
|
||||||
{
|
{
|
||||||
ReportData *rd;
|
ReportData *report_data;
|
||||||
|
|
||||||
rd = g_new0(ReportData, 1);
|
report_data = g_new0(ReportData, 1);
|
||||||
|
|
||||||
rd->guile_options = SCM_UNDEFINED;
|
report_data->guile_options = SCM_UNDEFINED;
|
||||||
rd->rendering_thunk = SCM_UNDEFINED;
|
report_data->guile_options_id = SCM_UNDEFINED;
|
||||||
|
|
||||||
return rd;
|
report_data->rendering_thunk = SCM_UNDEFINED;
|
||||||
|
report_data->rendering_thunk_id = SCM_UNDEFINED;
|
||||||
|
|
||||||
|
return report_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
report_data_destroy(HTMLHistoryData history_data)
|
report_data_destroy(HTMLUserData user_data)
|
||||||
{
|
{
|
||||||
ReportData *rd = history_data;
|
ReportData *report_data = user_data;
|
||||||
|
|
||||||
g_free(rd->text);
|
g_free(report_data->text);
|
||||||
rd->text = NULL;
|
report_data->text = NULL;
|
||||||
|
|
||||||
gnc_option_db_destroy(rd->odb);
|
gnc_option_db_destroy(report_data->odb);
|
||||||
rd->odb = NULL;
|
report_data->odb = NULL;
|
||||||
|
|
||||||
if (rd->option_dialog != NULL)
|
if (report_data->option_dialog != NULL)
|
||||||
gtk_widget_destroy(rd->option_dialog);
|
gtk_widget_destroy(report_data->option_dialog);
|
||||||
rd->option_dialog = NULL;
|
report_data->option_dialog = NULL;
|
||||||
|
|
||||||
if (rd->guile_options != SCM_UNDEFINED)
|
if (report_data->guile_options_id != SCM_UNDEFINED)
|
||||||
gnc_unregister_c_side_scheme_ptr(rd->guile_options);
|
gnc_unregister_c_side_scheme_ptr_id(report_data->guile_options_id);
|
||||||
rd->guile_options = SCM_UNDEFINED;
|
report_data->guile_options = SCM_UNDEFINED;
|
||||||
|
report_data->guile_options_id = SCM_UNDEFINED;
|
||||||
|
|
||||||
if (rd->rendering_thunk != SCM_UNDEFINED)
|
if (report_data->rendering_thunk_id != SCM_UNDEFINED)
|
||||||
gnc_unregister_c_side_scheme_ptr(rd->rendering_thunk);
|
gnc_unregister_c_side_scheme_ptr_id(report_data->rendering_thunk_id);
|
||||||
rd->rendering_thunk = SCM_UNDEFINED;
|
report_data->rendering_thunk = SCM_UNDEFINED;
|
||||||
|
report_data->rendering_thunk_id = SCM_UNDEFINED;
|
||||||
|
|
||||||
g_free(rd);
|
g_free(report_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
report_data_set_text(ReportData *rd, const gchar *text)
|
report_data_set_text(ReportData *report_data, const gchar *text)
|
||||||
{
|
{
|
||||||
g_free(rd->text);
|
g_free(report_data->text);
|
||||||
rd->text = g_strdup(text);
|
report_data->text = g_strdup(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
report_data_set_rendering_thunk(ReportData *rd, const SCM rendering_thunk)
|
report_data_set_rendering_thunk(ReportData *report_data,
|
||||||
|
const SCM rendering_thunk)
|
||||||
{
|
{
|
||||||
if (rd->rendering_thunk != SCM_UNDEFINED)
|
if (report_data->rendering_thunk_id != SCM_UNDEFINED)
|
||||||
gnc_unregister_c_side_scheme_ptr(rd->rendering_thunk);
|
gnc_unregister_c_side_scheme_ptr_id(report_data->rendering_thunk_id);
|
||||||
|
|
||||||
rd->rendering_thunk = rendering_thunk;
|
report_data->rendering_thunk = rendering_thunk;
|
||||||
|
report_data->rendering_thunk_id = gnc_register_c_side_scheme_ptr(rendering_thunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_options_dialog_apply_cb(GnomePropertyBox *propertybox,
|
gnc_options_dialog_apply_cb(GnomePropertyBox *propertybox,
|
||||||
gint arg1, gpointer user_data)
|
gint arg1, gpointer user_data)
|
||||||
{
|
{
|
||||||
ReportData *rd = user_data;
|
ReportData *report_data = user_data;
|
||||||
|
|
||||||
if (arg1 == -1)
|
if (arg1 == -1)
|
||||||
gnc_option_db_commit(rd->odb);
|
gnc_option_db_commit(report_data->odb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -128,52 +139,55 @@ gnc_options_dialog_help_cb(GnomePropertyBox *propertybox,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
report_data_set_guile_options(ReportData *rd, const SCM guile_options)
|
report_data_set_guile_options(ReportData *report_data, const SCM guile_options)
|
||||||
{
|
{
|
||||||
GnomePropertyBox *prop_box;
|
GnomePropertyBox *prop_box;
|
||||||
|
|
||||||
if (rd->guile_options != SCM_UNDEFINED)
|
if (report_data->guile_options_id != SCM_UNDEFINED)
|
||||||
{
|
{
|
||||||
gnc_unregister_c_side_scheme_ptr(rd->guile_options);
|
gnc_unregister_c_side_scheme_ptr_id(report_data->guile_options_id);
|
||||||
gnc_option_db_destroy(rd->odb);
|
gnc_option_db_destroy(report_data->odb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rd->option_dialog != NULL)
|
if (report_data->option_dialog != NULL)
|
||||||
gtk_widget_destroy(rd->option_dialog);
|
gtk_widget_destroy(report_data->option_dialog);
|
||||||
|
|
||||||
if (gh_scm2bool(gh_not(guile_options)))
|
if (gh_scm2bool(gh_not(guile_options)))
|
||||||
{
|
{
|
||||||
rd->guile_options = SCM_UNDEFINED;
|
report_data->guile_options = SCM_UNDEFINED;
|
||||||
rd->option_dialog = NULL;
|
report_data->option_dialog = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rd->guile_options = guile_options;
|
report_data->guile_options = guile_options;
|
||||||
gnc_register_c_side_scheme_ptr(guile_options);
|
report_data->guile_options_id =
|
||||||
|
gnc_register_c_side_scheme_ptr(guile_options);
|
||||||
|
|
||||||
rd->odb = gnc_option_db_new();
|
report_data->odb = gnc_option_db_new();
|
||||||
|
|
||||||
gnc_option_db_init(rd->odb, guile_options);
|
gnc_option_db_init(report_data->odb, guile_options);
|
||||||
|
|
||||||
rd->option_dialog = gnome_property_box_new();
|
report_data->option_dialog = gnome_property_box_new();
|
||||||
gnome_dialog_close_hides(GNOME_DIALOG(rd->option_dialog), TRUE);
|
gnome_dialog_close_hides(GNOME_DIALOG(report_data->option_dialog), TRUE);
|
||||||
|
|
||||||
prop_box = GNOME_PROPERTY_BOX(rd->option_dialog);
|
prop_box = GNOME_PROPERTY_BOX(report_data->option_dialog);
|
||||||
gnc_build_options_dialog_contents(prop_box, rd->odb);
|
gnc_build_options_dialog_contents(prop_box, report_data->odb);
|
||||||
|
|
||||||
gnc_option_db_clean(rd->odb);
|
gnc_option_db_clean(report_data->odb);
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(rd->option_dialog), "apply",
|
gtk_signal_connect(GTK_OBJECT(report_data->option_dialog), "apply",
|
||||||
GTK_SIGNAL_FUNC(gnc_options_dialog_apply_cb), rd);
|
GTK_SIGNAL_FUNC(gnc_options_dialog_apply_cb),
|
||||||
|
report_data);
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(rd->option_dialog), "help",
|
gtk_signal_connect(GTK_OBJECT(report_data->option_dialog), "help",
|
||||||
GTK_SIGNAL_FUNC(gnc_options_dialog_help_cb), rd);
|
GTK_SIGNAL_FUNC(gnc_options_dialog_help_cb),
|
||||||
|
report_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static HTMLHistoryData
|
static HTMLData *
|
||||||
reportAnchorCB(XmHTMLAnchorCallbackStruct *acbs,
|
reportAnchorCB(XmHTMLAnchorCallbackStruct *acbs,
|
||||||
HTMLHistoryData history_data)
|
HTMLUserData user_data)
|
||||||
{
|
{
|
||||||
switch(acbs->url_type)
|
switch(acbs->url_type)
|
||||||
{
|
{
|
||||||
@ -201,25 +215,25 @@ reportAnchorCB(XmHTMLAnchorCallbackStruct *acbs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reportJumpCB(HTMLHistoryData history_data, char **set_text, char **set_label)
|
reportJumpCB(HTMLUserData user_data, char **set_text, char **set_label)
|
||||||
{
|
{
|
||||||
ReportData *rd = (ReportData *) history_data;
|
ReportData *report_data = user_data;
|
||||||
char *text;
|
char *text;
|
||||||
SCM text_scm;
|
SCM text_scm;
|
||||||
|
|
||||||
*set_text = NULL;
|
*set_text = NULL;
|
||||||
*set_label = NULL;
|
*set_label = NULL;
|
||||||
|
|
||||||
if (rd->text != NULL)
|
if (report_data->text != NULL)
|
||||||
{
|
{
|
||||||
*set_text = rd->text;
|
*set_text = report_data->text;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gh_procedure_p(rd->rendering_thunk))
|
if (!gh_procedure_p(report_data->rendering_thunk))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
text_scm = gh_call0(rd->rendering_thunk);
|
text_scm = gh_call0(report_data->rendering_thunk);
|
||||||
|
|
||||||
if (!gh_string_p(text_scm))
|
if (!gh_string_p(text_scm))
|
||||||
return;
|
return;
|
||||||
@ -228,41 +242,42 @@ reportJumpCB(HTMLHistoryData history_data, char **set_text, char **set_label)
|
|||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
report_data_set_text(rd, text);
|
report_data_set_text(report_data, text);
|
||||||
free(text);
|
free(text);
|
||||||
|
|
||||||
*set_text = rd->text;
|
*set_text = report_data->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_report_options_changed_cb(gpointer data)
|
gnc_report_options_changed_cb(gpointer data)
|
||||||
{
|
{
|
||||||
HTMLWindow *hw = data;
|
ReportData *report_data = data;
|
||||||
HTMLHistoryData hd;
|
ReportData *real_data;
|
||||||
ReportData *rd;
|
|
||||||
|
|
||||||
hd = gnc_html_window_history_data(hw);
|
if (report_data == NULL)
|
||||||
if (hd == NULL)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rd = (ReportData *) hd;
|
report_data_set_text(report_data, NULL);
|
||||||
report_data_set_text(rd, NULL);
|
|
||||||
|
|
||||||
gnc_html_load(hw);
|
real_data = gnc_html_window_user_data(reportwindow);
|
||||||
|
if (report_data != real_data)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gnc_html_load(reportwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_report_properties_cb(GtkWidget *widget, gpointer data)
|
gnc_report_properties_cb(GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
ReportData *rd = data;
|
ReportData *report_data = data;
|
||||||
|
|
||||||
if (rd->option_dialog == NULL)
|
if (report_data->option_dialog == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_widget_show_all(rd->option_dialog);
|
gtk_widget_show_all(report_data->option_dialog);
|
||||||
gdk_window_raise(GTK_WIDGET(rd->option_dialog)->window);
|
gdk_window_raise(GTK_WIDGET(report_data->option_dialog)->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -277,37 +292,38 @@ gnc_report_properties_cb(GtkWidget *widget, gpointer data)
|
|||||||
void
|
void
|
||||||
reportWindow(const char *title, SCM rendering_thunk, SCM guile_options)
|
reportWindow(const char *title, SCM rendering_thunk, SCM guile_options)
|
||||||
{
|
{
|
||||||
ReportData *rd;
|
ReportData *report_data;
|
||||||
|
HTMLData *html_data;
|
||||||
|
|
||||||
if (reportwindow == NULL)
|
if (reportwindow == NULL)
|
||||||
reportwindow = gnc_html_window_new(report_data_destroy, reportAnchorCB,
|
reportwindow = gnc_html_window_new(reportAnchorCB, reportJumpCB);
|
||||||
reportJumpCB);
|
|
||||||
|
|
||||||
rd = report_data_new();
|
report_data = report_data_new();
|
||||||
report_data_set_rendering_thunk(rd, rendering_thunk);
|
report_data_set_rendering_thunk(report_data, rendering_thunk);
|
||||||
report_data_set_guile_options(rd, guile_options);
|
report_data_set_guile_options(report_data, guile_options);
|
||||||
|
|
||||||
if (rd->odb != NULL)
|
if (report_data->odb != NULL)
|
||||||
gnc_option_db_register_change_callback(rd->odb,
|
gnc_option_db_register_change_callback(report_data->odb,
|
||||||
gnc_report_options_changed_cb,
|
gnc_report_options_changed_cb,
|
||||||
reportwindow);
|
report_data);
|
||||||
|
|
||||||
if (rd->option_dialog != NULL)
|
if (report_data->option_dialog != NULL)
|
||||||
{
|
{
|
||||||
gchar *prop_title;
|
gchar *prop_title;
|
||||||
|
|
||||||
prop_title = g_strconcat(title, " (Parameters)", NULL);
|
prop_title = g_strconcat(title, " (", PARAMETERS_STR, ")", NULL);
|
||||||
gtk_window_set_title(GTK_WINDOW(rd->option_dialog), prop_title);
|
gtk_window_set_title(GTK_WINDOW(report_data->option_dialog), prop_title);
|
||||||
g_free(prop_title);
|
g_free(prop_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (report_data->option_dialog != NULL)
|
||||||
{
|
{
|
||||||
GnomeUIInfo user_buttons[] =
|
GnomeUIInfo user_buttons[] =
|
||||||
{
|
{
|
||||||
{ GNOME_APP_UI_ITEM,
|
{ GNOME_APP_UI_ITEM,
|
||||||
"Properties",
|
PARAMETERS_STR,
|
||||||
"Set the properties for this report.",
|
TOOLTIP_REPORT_PARM,
|
||||||
gnc_report_properties_cb, rd,
|
gnc_report_properties_cb, report_data,
|
||||||
NULL,
|
NULL,
|
||||||
GNOME_APP_PIXMAP_STOCK,
|
GNOME_APP_PIXMAP_STOCK,
|
||||||
GNOME_STOCK_PIXMAP_PROPERTIES,
|
GNOME_STOCK_PIXMAP_PROPERTIES,
|
||||||
@ -317,8 +333,15 @@ reportWindow(const char *title, SCM rendering_thunk, SCM guile_options)
|
|||||||
|
|
||||||
gint num_buttons = sizeof(user_buttons) / sizeof(GnomeUIInfo);
|
gint num_buttons = sizeof(user_buttons) / sizeof(GnomeUIInfo);
|
||||||
|
|
||||||
htmlWindow(NULL, &reportwindow, title, rd, user_buttons, num_buttons);
|
html_data = gnc_html_data_new(title, report_data,
|
||||||
|
report_data_destroy,
|
||||||
|
user_buttons, num_buttons);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
html_data = gnc_html_data_new(title, report_data,
|
||||||
|
report_data_destroy, NULL, 0);
|
||||||
|
|
||||||
|
htmlWindow(NULL, &reportwindow, html_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,20 @@
|
|||||||
|
|
||||||
;; (use-modules (gnc))
|
;; (use-modules (gnc))
|
||||||
|
|
||||||
|
;; Test for slib.
|
||||||
|
(let* ((try-slib (lambda () (use-modules (ice-9 slib))))
|
||||||
|
(handler (lambda args #f))
|
||||||
|
(result (catch #t try-slib handler)))
|
||||||
|
(if (not result)
|
||||||
|
(begin
|
||||||
|
(newline)
|
||||||
|
(display "It appears you do not have the 'slib' scheme\n")
|
||||||
|
(display "library installed. You need slib2c6 or later\n")
|
||||||
|
(display "to run GnuCash.\n")
|
||||||
|
(newline)
|
||||||
|
(exit))))
|
||||||
|
|
||||||
|
|
||||||
(define (build-path firstelement . restofpath)
|
(define (build-path firstelement . restofpath)
|
||||||
(define separator "/")
|
(define separator "/")
|
||||||
(define (bp first rest)
|
(define (bp first rest)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
(define gnc:register-c-side-scheme-ptr #f)
|
(define gnc:register-c-side-scheme-ptr #f)
|
||||||
(define gnc:unregister-c-side-scheme-ptr #f)
|
(define gnc:unregister-c-side-scheme-ptr-id #f)
|
||||||
|
|
||||||
(let ((next-registration-id 0)
|
(let ((next-registration-id 0)
|
||||||
;; Not sure this has to be prime, and not sure how large it needs
|
;; Not sure this has to be prime, and not sure how large it needs
|
||||||
@ -12,8 +12,10 @@
|
|||||||
(hashv-set! pointer-storage id ptr)
|
(hashv-set! pointer-storage id ptr)
|
||||||
id))
|
id))
|
||||||
|
|
||||||
(define (unregister-c-side-scheme-ptr id)
|
(define (unregister-c-side-scheme-ptr-id id)
|
||||||
(hashv-remove! pointer-storage id))
|
(if (hashv-ref pointer-storage id)
|
||||||
|
(hashv-remove! pointer-storage id)
|
||||||
|
(gnc:error "unregister-c-side-scheme-ptr-id: no such id\n")))
|
||||||
|
|
||||||
(set! gnc:register-c-side-scheme-ptr register-c-side-scheme-ptr)
|
(set! gnc:register-c-side-scheme-ptr register-c-side-scheme-ptr)
|
||||||
(set! gnc:unregister-c-side-scheme-ptr unregister-c-side-scheme-ptr))
|
(set! gnc:unregister-c-side-scheme-ptr-id unregister-c-side-scheme-ptr-id))
|
||||||
|
@ -64,12 +64,7 @@
|
|||||||
;; on success, and (#f "failure-message") on failure. If #t,
|
;; on success, and (#f "failure-message") on failure. If #t,
|
||||||
;; the supplied value will be used by the gui to set the option.
|
;; the supplied value will be used by the gui to set the option.
|
||||||
value-validator
|
value-validator
|
||||||
;; permissible-values (multichoice options only)
|
option-data)
|
||||||
;; a list of vectors giving the value, a name,
|
|
||||||
;; and description of the permissible values.
|
|
||||||
;; Values are unevaluated Scheme symbols, names and
|
|
||||||
;; descriptions are strings which are used by the GUI.
|
|
||||||
permissible-values)
|
|
||||||
(vector section
|
(vector section
|
||||||
name
|
name
|
||||||
sort-tag
|
sort-tag
|
||||||
@ -80,7 +75,7 @@
|
|||||||
default-getter
|
default-getter
|
||||||
generate-restore-form
|
generate-restore-form
|
||||||
value-validator
|
value-validator
|
||||||
permissible-values))
|
option-data))
|
||||||
|
|
||||||
(define (gnc:make-string-option
|
(define (gnc:make-string-option
|
||||||
section
|
section
|
||||||
@ -94,8 +89,9 @@
|
|||||||
(lambda (x) (set! option x))
|
(lambda (x) (set! option x))
|
||||||
(lambda () default-value)
|
(lambda () default-value)
|
||||||
#f
|
#f
|
||||||
(lambda (x) (cond ((string? x)(list #t x))
|
(lambda (x)
|
||||||
(else (list #f #f))))
|
(cond ((string? x)(list #t x))
|
||||||
|
(else (list #f "string-option: not a string"))))
|
||||||
#f )))
|
#f )))
|
||||||
|
|
||||||
(define (gnc:make-simple-boolean-option
|
(define (gnc:make-simple-boolean-option
|
||||||
@ -110,36 +106,105 @@
|
|||||||
(lambda (x) (set! option x))
|
(lambda (x) (set! option x))
|
||||||
(lambda () default-value)
|
(lambda () default-value)
|
||||||
#f
|
#f
|
||||||
(lambda (x) (list #t x))
|
(lambda (x)
|
||||||
|
(if (boolean? x)
|
||||||
|
(list #t x)
|
||||||
|
(list #f "boolean-option: not a boolean")))
|
||||||
#f )))
|
#f )))
|
||||||
|
|
||||||
(define (gnc:make-multichoice-option
|
|
||||||
section
|
|
||||||
name
|
|
||||||
sort-tag
|
|
||||||
documentation-string
|
|
||||||
default-value
|
|
||||||
ok-values)
|
|
||||||
(let ((option default-value))
|
|
||||||
(define (multichoice-legal val p-vals)
|
|
||||||
(cond ((null? p-vals) #f)
|
|
||||||
((eq? val (vector-ref (car p-vals) 0)) #t)
|
|
||||||
(else multichoice-legal (cdr p-vals))))
|
|
||||||
|
|
||||||
(gnc:make-option
|
;; date options use the option-data as a boolean value. If true,
|
||||||
section name sort-tag 'multichoice documentation-string
|
;; the gui should allow the time to be entered as well.
|
||||||
(lambda () option)
|
(define (gnc:make-date-option
|
||||||
(lambda (x)
|
section
|
||||||
(if (multichoice-legal x ok-values)
|
name
|
||||||
(set! option x)
|
sort-tag
|
||||||
(gnc:error "Illegal Multichoice option set")))
|
documentation-string
|
||||||
(lambda () default-value)
|
default-getter
|
||||||
#f
|
show-time)
|
||||||
(lambda (x)
|
(let ((option (default-getter)))
|
||||||
(if (multichoice-legal x ok-values)
|
|
||||||
(list #t x)
|
(define (date-legal date)
|
||||||
(list #f #f)))
|
(and (pair? date) (exact? (car date)) (exact? (cdr date))))
|
||||||
ok-values)))
|
|
||||||
|
(gnc:make-option section name sort-tag 'date documentation-string
|
||||||
|
(lambda () option)
|
||||||
|
(lambda (date)
|
||||||
|
(if (date-legal date)
|
||||||
|
(set! option date)
|
||||||
|
(gnc:error "Illegal date value set")))
|
||||||
|
default-getter
|
||||||
|
#f
|
||||||
|
(lambda (date)
|
||||||
|
(if (date-legal date)
|
||||||
|
(list #t date)
|
||||||
|
(list #f "date-option: illegal date")))
|
||||||
|
show-time )))
|
||||||
|
|
||||||
|
;; account-list options use the option-data as a boolean value. If
|
||||||
|
;; true, the gui should allow the user to select multiple accounts.
|
||||||
|
;; values are always a list of accounts.
|
||||||
|
(define (gnc:make-account-list-option
|
||||||
|
section
|
||||||
|
name
|
||||||
|
sort-tag
|
||||||
|
documentation-string
|
||||||
|
default-getter
|
||||||
|
value-validator
|
||||||
|
multiple-selection)
|
||||||
|
(let ((option (default-getter))
|
||||||
|
(option-set #f)
|
||||||
|
(validator
|
||||||
|
(if (not value-validator)
|
||||||
|
(lambda (account-list) (list #t account-list))
|
||||||
|
value-validator)))
|
||||||
|
(gnc:make-option
|
||||||
|
section name sort-tag 'account-list documentation-string
|
||||||
|
(lambda () (if option-set option (default-getter)))
|
||||||
|
(lambda (account-list)
|
||||||
|
(let* ((result (validator account-list))
|
||||||
|
(valid (car result))
|
||||||
|
(value (cadr result)))
|
||||||
|
(if valid
|
||||||
|
(begin
|
||||||
|
(set! option value)
|
||||||
|
(set! option-set #t))
|
||||||
|
(gnc:error "Illegal account list value set"))))
|
||||||
|
default-getter
|
||||||
|
#f
|
||||||
|
validator
|
||||||
|
multiple-selection )))
|
||||||
|
|
||||||
|
;; multichoice options use the option-data as a list of vectors.
|
||||||
|
;; Each vector contains a permissible value (scheme symbol) and
|
||||||
|
;; a description string.
|
||||||
|
(define (gnc:make-multichoice-option
|
||||||
|
section
|
||||||
|
name
|
||||||
|
sort-tag
|
||||||
|
documentation-string
|
||||||
|
default-value
|
||||||
|
ok-values)
|
||||||
|
(let ((option default-value))
|
||||||
|
(define (multichoice-legal val p-vals)
|
||||||
|
(cond ((null? p-vals) #f)
|
||||||
|
((eq? val (vector-ref (car p-vals) 0)) #t)
|
||||||
|
(else multichoice-legal (cdr p-vals))))
|
||||||
|
|
||||||
|
(gnc:make-option
|
||||||
|
section name sort-tag 'multichoice documentation-string
|
||||||
|
(lambda () option)
|
||||||
|
(lambda (x)
|
||||||
|
(if (multichoice-legal x ok-values)
|
||||||
|
(set! option x)
|
||||||
|
(gnc:error "Illegal Multichoice option set")))
|
||||||
|
(lambda () default-value)
|
||||||
|
#f
|
||||||
|
(lambda (x)
|
||||||
|
(if (multichoice-legal x ok-values)
|
||||||
|
(list #t x)
|
||||||
|
(list #f "multichoice-option: illegal choice")))
|
||||||
|
ok-values)))
|
||||||
|
|
||||||
(define (gnc:option-section option)
|
(define (gnc:option-section option)
|
||||||
(vector-ref option 0))
|
(vector-ref option 0))
|
||||||
@ -161,7 +226,7 @@
|
|||||||
(vector-ref option 8))
|
(vector-ref option 8))
|
||||||
(define (gnc:option-value-validator option)
|
(define (gnc:option-value-validator option)
|
||||||
(vector-ref option 9))
|
(vector-ref option 9))
|
||||||
(define (gnc:option-permissible-values option)
|
(define (gnc:option-data option)
|
||||||
(vector-ref option 10))
|
(vector-ref option 10))
|
||||||
|
|
||||||
(define (gnc:register-option options new-option)
|
(define (gnc:register-option options new-option)
|
||||||
@ -308,6 +373,11 @@
|
|||||||
"International" "Default Currency"
|
"International" "Default Currency"
|
||||||
"b" "Default Currency For New Accounts" "USD"))
|
"b" "Default Currency For New Accounts" "USD"))
|
||||||
|
|
||||||
|
(gnc:register-configuration-option
|
||||||
|
(gnc:make-simple-boolean-option
|
||||||
|
"International" "Use 24-hour time format"
|
||||||
|
"c" "Use a 24 hour (instead of a 12 hour) time format." #f))
|
||||||
|
|
||||||
(gnc:register-configuration-option
|
(gnc:register-configuration-option
|
||||||
(gnc:make-multichoice-option
|
(gnc:make-multichoice-option
|
||||||
"Register" "Default Register Mode"
|
"Register" "Default Register Mode"
|
||||||
|
@ -32,10 +32,41 @@
|
|||||||
"Page Two" "String Option"
|
"Page Two" "String Option"
|
||||||
"b" "This is a string option" "Hello, World.")))
|
"b" "This is a string option" "Hello, World.")))
|
||||||
|
|
||||||
|
(define dateop
|
||||||
|
(gnc:register-dummy-option
|
||||||
|
(gnc:make-date-option
|
||||||
|
"Time and Date" "Just a Date Option"
|
||||||
|
"a" "This is a date option"
|
||||||
|
(lambda () (cons (current-time) 0))
|
||||||
|
#f)))
|
||||||
|
|
||||||
|
(define dateop2
|
||||||
|
(gnc:register-dummy-option
|
||||||
|
(gnc:make-date-option
|
||||||
|
"Time and Date" "Time and Date Option"
|
||||||
|
"a" "This is a date option with time"
|
||||||
|
(lambda () (cons (current-time) 0))
|
||||||
|
#t)))
|
||||||
|
|
||||||
|
(define account-list-op
|
||||||
|
(gnc:register-dummy-option
|
||||||
|
(gnc:make-account-list-option
|
||||||
|
"Page One" "An account list option"
|
||||||
|
"b" "This is an account list option"
|
||||||
|
(lambda () (gnc:get-current-accounts))
|
||||||
|
#f #t)))
|
||||||
|
|
||||||
(define (op-value op)
|
(define (op-value op)
|
||||||
(let ((getter (gnc:option-getter op)))
|
(let ((getter (gnc:option-getter op)))
|
||||||
(getter)))
|
(getter)))
|
||||||
|
|
||||||
|
(define (account-list)
|
||||||
|
(let* ((accounts (op-value account-list-op))
|
||||||
|
(names (map gnc:account-get-name accounts)))
|
||||||
|
(list "<ul>"
|
||||||
|
(map (lambda (name) (list "<li>" name "</li>")) names)
|
||||||
|
"</ul>")))
|
||||||
|
|
||||||
(gnc:define-report
|
(gnc:define-report
|
||||||
;; version
|
;; version
|
||||||
1
|
1
|
||||||
@ -45,16 +76,26 @@
|
|||||||
gnc:*dummy-options*
|
gnc:*dummy-options*
|
||||||
;; Rendering thunk. See report.scm for details.
|
;; Rendering thunk. See report.scm for details.
|
||||||
(lambda (options)
|
(lambda (options)
|
||||||
(list
|
(let ((time-string (strftime "%c" (localtime (current-time))))
|
||||||
"<html>"
|
(date-string (strftime "%x" (localtime (car (op-value dateop)))))
|
||||||
"<body bgcolor=#99ccff>"
|
(date-string2 (strftime "%c" (localtime (car (op-value dateop2))))))
|
||||||
"The current time is " (strftime "%c" (localtime (current-time))) "."
|
(list
|
||||||
"<br>"
|
"<html>"
|
||||||
"The boolean op is " (if (op-value boolop) "true." "false.")
|
"<body bgcolor=#99ccff>"
|
||||||
"<br>"
|
"The current time is " time-string "."
|
||||||
"The multi op is " (symbol->string (op-value multop))
|
"<br>"
|
||||||
"<br>"
|
"The boolean op is " (if (op-value boolop) "true." "false.")
|
||||||
"The string op is " (op-value strop)
|
"<br>"
|
||||||
"</body>"
|
"The multi op is " (symbol->string (op-value multop))
|
||||||
"</html>")))
|
"<br>"
|
||||||
|
"The string op is " (op-value strop)
|
||||||
|
"<br>"
|
||||||
|
"The date op is " date-string
|
||||||
|
"<br>"
|
||||||
|
"The date and time op is " date-string2
|
||||||
|
"<br>"
|
||||||
|
"The accounts are:"
|
||||||
|
(account-list)
|
||||||
|
"</body>"
|
||||||
|
"</html>"))))
|
||||||
)
|
)
|
||||||
|
@ -1,22 +1,116 @@
|
|||||||
;; -*-scheme-*-
|
;; -*-scheme-*-
|
||||||
|
;; transaction-report.scm
|
||||||
|
;; Report on all transactions in an account
|
||||||
|
;; Robert Merkel (rgmerk@mira.net)
|
||||||
|
|
||||||
;; something like
|
(use-modules (ice-9 slib))
|
||||||
;; for(i = first; i < last; i+= step) { thunk(i);}
|
(require 'printf)
|
||||||
|
|
||||||
|
(gnc:depend "text-export.scm")
|
||||||
|
|
||||||
|
(define gnc:*transaction-report-options* '())
|
||||||
|
|
||||||
|
;;returns a list contains elements of the-list for which predictate is
|
||||||
|
;; true
|
||||||
|
(define (gnc:filter-list the-list predicate)
|
||||||
|
(cond ((not (list? the-list))
|
||||||
|
(gnc:error("Attempted to filter a non-list object")))
|
||||||
|
((null? the-list) '())
|
||||||
|
((predicate (car the-list))
|
||||||
|
(cons (car the-list)
|
||||||
|
(gnc:filter-list (cdr the-list) predicate)))
|
||||||
|
(else (gnc:filter-list (cdr the-list) predicate))))
|
||||||
|
|
||||||
|
(define (gnc:register-trep-option new-option)
|
||||||
|
(set! gnc:*transaction-report-options*
|
||||||
|
(gnc:register-option gnc:*transaction-report-options* new-option))
|
||||||
|
new-option)
|
||||||
|
|
||||||
|
;; from date
|
||||||
|
;; hack alert - could somebody set this to an appropriate date?
|
||||||
|
(define begindate
|
||||||
|
(gnc:register-trep-option
|
||||||
|
(gnc:make-date-option
|
||||||
|
"Report Options" "From"
|
||||||
|
"a" "Report Items from this date"
|
||||||
|
(lambda ()
|
||||||
|
(let ((bdtime (localtime (current-time))))
|
||||||
|
(set-tm:sec bdtime 0)
|
||||||
|
(set-tm:min bdtime 0)
|
||||||
|
(set-tm:hour bdtime 0)
|
||||||
|
(set-tm:mday bdtime 1)
|
||||||
|
(set-tm:mon bdtime 0)
|
||||||
|
(let ((time (car (mktime bdtime))))
|
||||||
|
(cons time 0))))
|
||||||
|
#f)))
|
||||||
|
|
||||||
|
;; to-date
|
||||||
|
(define enddate
|
||||||
|
(gnc:register-trep-option
|
||||||
|
(gnc:make-date-option
|
||||||
|
"Report Options" "To"
|
||||||
|
"b" "Report items up to and including this date"
|
||||||
|
(lambda () (cons (current-time) 0))
|
||||||
|
#f)))
|
||||||
|
|
||||||
|
;; account to do report on
|
||||||
|
;; hack alert - default setting doesn't work!
|
||||||
|
|
||||||
|
(define tr-report-account-op
|
||||||
|
(gnc:register-trep-option
|
||||||
|
(gnc:make-account-list-option
|
||||||
|
"Report Options" "Account"
|
||||||
|
"c" "Do transaction report on this account"
|
||||||
|
(lambda () (list (gnc:group-get-account (gnc:get-current-group) 0)))
|
||||||
|
#f #f)))
|
||||||
|
|
||||||
|
;; extract fields out of the scheme split representation
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-memo split-scm)
|
||||||
|
(vector-ref split-scm 0))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-action split-scm)
|
||||||
|
(vector-ref split-scm 1))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-description split-scm)
|
||||||
|
(vector-ref split-scm 2))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-date split-scm)
|
||||||
|
(vector-ref split-scm 3))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-reconcile-state split-scm)
|
||||||
|
(vector-ref split-scm 4))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-reconcile-date split-scm)
|
||||||
|
(vector-ref split-scm 5))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-share-amount split-scm)
|
||||||
|
(vector-ref split-scm 6))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-share-price split-scm)
|
||||||
|
(vector-ref split-scm 7))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-value split-scm)
|
||||||
|
(vector-ref split-scm 8))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-docref split-scm)
|
||||||
|
(vector-ref split-scm 9))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-other-splits split-scm)
|
||||||
|
(vector-ref split-scm 10))
|
||||||
|
|
||||||
|
;;; something like
|
||||||
|
;;; for(i = first; i < last; i+= step) { thunk(i);}
|
||||||
|
|
||||||
(define (gnc:for-loop thunk first last step)
|
(define (gnc:for-loop thunk first last step)
|
||||||
(cond ((< first last) (thunk first)
|
(cond ((< first last) (thunk first)
|
||||||
(gnc:for-loop thunk (+ first step) last step))
|
(gnc:for-loop thunk (+ first step) last step))
|
||||||
(else #f)))
|
(else #f)))
|
||||||
|
|
||||||
;; applies thunk to each split in account account
|
;;; applies thunk to each split in account account
|
||||||
(define (gnc:for-each-split-in-account account thunk)
|
(define (gnc:for-each-split-in-account account thunk)
|
||||||
(gnc:for-loop (lambda (x) (thunk (gnc:account-get-split account x)))
|
(gnc:for-loop (lambda (x) (thunk (gnc:account-get-split account x)))
|
||||||
0 (gnc:account-get-split-count account) 1))
|
0 (gnc:account-get-split-count account) 1))
|
||||||
|
|
||||||
|
|
||||||
(define (gnc:split-get-corresponding-account-name-and-values split)
|
|
||||||
(list (cons "Not implemented yet." 0)))
|
|
||||||
|
|
||||||
(define (gnc:split-get-transaction-date split)
|
(define (gnc:split-get-transaction-date split)
|
||||||
(gnc:transaction-get-date-posted (gnc:split-get-parent split)))
|
(gnc:transaction-get-date-posted (gnc:split-get-parent split)))
|
||||||
@ -24,6 +118,37 @@
|
|||||||
(define (gnc:split-get-description-from-parent split)
|
(define (gnc:split-get-description-from-parent split)
|
||||||
(gnc:transaction-get-description (gnc:split-get-parent split)))
|
(gnc:transaction-get-description (gnc:split-get-parent split)))
|
||||||
|
|
||||||
|
|
||||||
|
(define (gnc:split-get-account-name split)
|
||||||
|
(gnc:account-get-name (gnc:split-get-account split)))
|
||||||
|
|
||||||
|
;; builds a list of the account name and values for the other
|
||||||
|
;; splits in a transaction
|
||||||
|
;; hack alert - lots of debugging cruft in here
|
||||||
|
|
||||||
|
(define (gnc:split-get-corresponding-account-name-and-values split)
|
||||||
|
(let* ((my-sign (positive? (gnc:split-get-value split)))
|
||||||
|
(diff-list '())
|
||||||
|
(parent-transaction (gnc:split-get-parent split))
|
||||||
|
(num-splits (gnc:transaction-get-split-count parent-transaction)))
|
||||||
|
(gnc:for-loop
|
||||||
|
(lambda (n)
|
||||||
|
(let ((split-in-trans
|
||||||
|
(gnc:transaction-get-split parent-transaction n)))
|
||||||
|
(if (not (eq? my-sign
|
||||||
|
(positive? (gnc:split-get-value split-in-trans))))
|
||||||
|
(set! diff-list
|
||||||
|
(cons
|
||||||
|
(list
|
||||||
|
(gnc:split-get-account-name split-in-trans)
|
||||||
|
(gnc:split-get-value split-in-trans))
|
||||||
|
diff-list)))))
|
||||||
|
0 num-splits 1)
|
||||||
|
(reverse diff-list)))
|
||||||
|
|
||||||
|
;; takes a C split, extracts relevant data and converts to a scheme
|
||||||
|
;; representation
|
||||||
|
|
||||||
(define (gnc:make-split-scheme-data split)
|
(define (gnc:make-split-scheme-data split)
|
||||||
(vector (gnc:split-get-memo split)
|
(vector (gnc:split-get-memo split)
|
||||||
(gnc:split-get-action split)
|
(gnc:split-get-action split)
|
||||||
@ -32,38 +157,106 @@
|
|||||||
(gnc:split-get-reconcile-state split)
|
(gnc:split-get-reconcile-state split)
|
||||||
(gnc:split-get-reconciled-date split)
|
(gnc:split-get-reconciled-date split)
|
||||||
(gnc:split-get-share-amount split)
|
(gnc:split-get-share-amount split)
|
||||||
(gnc:split-get-share-amount split)
|
|
||||||
(gnc:split-get-share-price split)
|
(gnc:split-get-share-price split)
|
||||||
(gnc:split-get-value split)
|
(gnc:split-get-value split)
|
||||||
(gnc:split-get-docref split)
|
(gnc:split-get-docref split)
|
||||||
(gnc:split-get-corresponding-account-name-and-values split)))
|
(gnc:split-get-corresponding-account-name-and-values split)))
|
||||||
|
|
||||||
(define (gnc:split-represent-scheme-data-textually split)
|
(define (gnc:timepair-to-datestring tp)
|
||||||
(call-with-output-string (lambda (x) (write (gnc:make-split-scheme-data split) x))))
|
(let ((bdtime (localtime (car tp))))
|
||||||
|
(strftime "%x" bdtime)))
|
||||||
|
|
||||||
|
(define (gnc:timepair-earlier-or-eq t1 t2)
|
||||||
|
(let ((time1 (car t1))
|
||||||
|
(time2 (car t2)))
|
||||||
|
(<= time1 time2)))
|
||||||
|
|
||||||
|
(define (gnc:timepair-later-or-eq t1 t2)
|
||||||
|
(gnc:timepair-earlier-or-eq t2 t1))
|
||||||
|
|
||||||
|
(define (gnc:tr-report-make-filter-predicate early-date late-date)
|
||||||
|
(lambda (split-scm)
|
||||||
|
(let ((split-date (gnc:tr-report-get-date split-scm)))
|
||||||
|
(and (gnc:timepair-later-or-eq split-date early-date)
|
||||||
|
(gnc:timepair-earlier-or-eq split-date late-date)))))
|
||||||
|
|
||||||
|
;; converts a scheme split representation to a line of HTML,
|
||||||
|
;; updates the values of total-inflow and total-outflow based
|
||||||
|
;; on the split value
|
||||||
|
|
||||||
|
(define (gnc:tr-report-split-to-html split-scm total-inflow total-outflow
|
||||||
|
starting-balance)
|
||||||
|
(let ((other-splits (gnc:tr-report-get-other-splits split-scm)))
|
||||||
|
(string-append
|
||||||
|
"<TR><TD>"
|
||||||
|
(gnc:timepair-to-datestring
|
||||||
|
(gnc:tr-report-get-date split-scm))
|
||||||
|
"</TD><TD>"
|
||||||
|
(gnc:tr-report-get-docref split-scm)
|
||||||
|
"</TD><TD>"
|
||||||
|
(gnc:tr-report-get-description split-scm)
|
||||||
|
"</TD><TD>"
|
||||||
|
(gnc:tr-report-get-memo split-scm)
|
||||||
|
"</TD><TD>"
|
||||||
|
(cond ((null? other-splits) "")
|
||||||
|
((= (length other-splits) 1) (caar other-splits))
|
||||||
|
(else "Multi-split (not implemented yet)"))
|
||||||
|
"</TD><TD>"
|
||||||
|
(cond ((> (gnc:tr-report-get-value split-scm) 0)
|
||||||
|
(set! total-inflow (+ total-inflow
|
||||||
|
(gnc:tr-report-get-value split-scm)))
|
||||||
|
(sprintf #f "%.2f" (gnc:tr-report-get-value split-scm)))
|
||||||
|
(else
|
||||||
|
(set! total-outflow (+ total-outflow
|
||||||
|
(- (gnc:tr-report-get-value split-scm))))
|
||||||
|
(string-append
|
||||||
|
(sprintf #f "%.2f"
|
||||||
|
(- (gnc:tr-report-get-value split-scm))))))
|
||||||
|
"</TD></TR>")))
|
||||||
|
|
||||||
|
;; hack alert - stub for testing
|
||||||
|
|
||||||
|
(define (gnc:tr-report-get-starting-balance scm-split-list beginning-date)
|
||||||
|
0)
|
||||||
|
|
||||||
(gnc:define-report
|
(gnc:define-report
|
||||||
;; version
|
;; version
|
||||||
1
|
1
|
||||||
;; Name
|
;; Name
|
||||||
"Account Transactions"
|
"Account Transactions"
|
||||||
;; Options
|
;; Options
|
||||||
#f
|
gnc:*transaction-report-options*
|
||||||
;; renderer
|
;; renderer
|
||||||
(lambda (options)
|
(lambda (options)
|
||||||
(let ( (test-account (gnc:group-get-account (gnc:get-current-group) 0))
|
(let* ((prefix (list "<HTML>" "<BODY bgcolor=#99ccff>" "<TABLE>"))
|
||||||
(prefix (list "<HTML>" "<BODY bgcolor=#99ccff>" "<PRE>"))
|
(suffix (list "</TABLE>" "</BODY>" "</HTML>"))
|
||||||
(suffix (list "</PRE>" "</BODY>" "</HTML>"))
|
(report-lines '())
|
||||||
(report-lines (list)))
|
(date-filter-pred (gnc:tr-report-make-filter-predicate
|
||||||
|
(op-value begindate)
|
||||||
(gnc:for-each-split-in-account
|
(op-value enddate)))
|
||||||
test-account
|
(total-inflow 0)
|
||||||
(lambda (split)
|
(total-outflow 0)
|
||||||
; (newline)
|
(starting-balance 0)
|
||||||
; (write report-lines)
|
(accounts (op-value tr-report-account-op))
|
||||||
(set! report-lines (append! report-lines (list (gnc:split-represent-scheme-data-textually split))))))
|
(html-mapper (lambda (split-scm) (gnc:tr-report-split-to-html
|
||||||
; (write prefix)
|
split-scm
|
||||||
; (newline)
|
total-inflow
|
||||||
; (write suffix)
|
total-outflow
|
||||||
; (newline)
|
starting-balance))))
|
||||||
; (write report-lines)
|
|
||||||
|
(if (null? accounts)
|
||||||
|
(set! report-lines
|
||||||
|
(list "<TR><TD>You have not selected an account.</TD></TR>"))
|
||||||
|
(begin
|
||||||
|
(gnc:for-each-split-in-account
|
||||||
|
(car accounts)
|
||||||
|
(lambda (split)
|
||||||
|
(set! report-lines
|
||||||
|
(append! report-lines
|
||||||
|
(list (gnc:make-split-scheme-data split))))))
|
||||||
|
(set! starting-balance
|
||||||
|
(gnc:tr-report-get-starting-balance
|
||||||
|
report-lines (op-value begindate)))
|
||||||
|
(set! report-lines (gnc:filter-list report-lines date-filter-pred))
|
||||||
|
(set! report-lines (map html-mapper report-lines))))
|
||||||
(append prefix report-lines suffix))))
|
(append prefix report-lines suffix))))
|
||||||
|
69
src/scm/report/transaction-report.scm.bif
Normal file
69
src/scm/report/transaction-report.scm.bif
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
;; -*-scheme-*-
|
||||||
|
|
||||||
|
|
||||||
|
;; something like
|
||||||
|
;; for(i = first; i < last; i+= step) { thunk(i);}
|
||||||
|
|
||||||
|
(define (gnc:for-loop thunk first last step)
|
||||||
|
(cond ((< first last) (thunk first)
|
||||||
|
(gnc:for-loop thunk (+ first step) last step))
|
||||||
|
(else #f)))
|
||||||
|
|
||||||
|
;; applies thunk to each split in account account
|
||||||
|
(define (gnc:for-each-split-in-account account thunk)
|
||||||
|
(gnc:for-loop (lambda (x) (thunk (gnc:account-get-split account x)))
|
||||||
|
0 (gnc:account-get-split-count account) 1))
|
||||||
|
|
||||||
|
|
||||||
|
(define (gnc:split-get-corresponding-account-name-and-values split)
|
||||||
|
(list (cons "Not implemented yet." 0)))
|
||||||
|
|
||||||
|
(define (gnc:split-get-transaction-date split)
|
||||||
|
(gnc:transaction-get-date-posted (gnc:split-get-parent split)))
|
||||||
|
|
||||||
|
(define (gnc:split-get-description-from-parent split)
|
||||||
|
(gnc:transaction-get-description (gnc:split-get-parent split)))
|
||||||
|
|
||||||
|
(define (gnc:make-split-scheme-data split)
|
||||||
|
(vector (gnc:split-get-memo split)
|
||||||
|
(gnc:split-get-action split)
|
||||||
|
(gnc:split-get-description-from-parent split)
|
||||||
|
(gnc:split-get-transaction-date split)
|
||||||
|
(gnc:split-get-reconcile-state split)
|
||||||
|
(gnc:split-get-reconciled-date split)
|
||||||
|
(gnc:split-get-share-amount split)
|
||||||
|
(gnc:split-get-share-amount split)
|
||||||
|
(gnc:split-get-share-price split)
|
||||||
|
(gnc:split-get-value split)
|
||||||
|
(gnc:split-get-docref split)
|
||||||
|
(gnc:split-get-corresponding-account-name-and-values split)))
|
||||||
|
|
||||||
|
(define (gnc:split-represent-scheme-data-textually split)
|
||||||
|
(call-with-output-string (lambda (x) (write (gnc:make-split-scheme-data split) x))))
|
||||||
|
|
||||||
|
(gnc:define-report
|
||||||
|
;; version
|
||||||
|
1
|
||||||
|
;; Name
|
||||||
|
"Account Transactions"
|
||||||
|
;; Options
|
||||||
|
#f
|
||||||
|
;; renderer
|
||||||
|
(lambda (options)
|
||||||
|
(let ( (test-account (gnc:group-get-account (gnc:get-current-group) 0))
|
||||||
|
(prefix (list "<HTML>" "<BODY bgcolor=#99ccff>" "<PRE>"))
|
||||||
|
(suffix (list "</PRE>" "</BODY>" "</HTML>"))
|
||||||
|
(report-lines (list)))
|
||||||
|
|
||||||
|
(gnc:for-each-split-in-account
|
||||||
|
test-account
|
||||||
|
(lambda (split)
|
||||||
|
; (newline)
|
||||||
|
; (write report-lines)
|
||||||
|
(set! report-lines (append! report-lines (list (gnc:split-represent-scheme-data-textually split))))))
|
||||||
|
; (write prefix)
|
||||||
|
; (newline)
|
||||||
|
; (write suffix)
|
||||||
|
; (newline)
|
||||||
|
; (write report-lines)
|
||||||
|
(append prefix report-lines suffix))))
|
@ -28,8 +28,21 @@
|
|||||||
|
|
||||||
#include <gnc-common.h>
|
#include <gnc-common.h>
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GNC_VERIFY_NO,
|
||||||
|
GNC_VERIFY_YES,
|
||||||
|
GNC_VERIFY_CANCEL
|
||||||
|
} GNCVerifyResult;
|
||||||
|
|
||||||
|
|
||||||
void gnc_refresh_main_window( void );
|
void gnc_refresh_main_window( void );
|
||||||
|
|
||||||
|
GNCVerifyResult
|
||||||
|
gnc_verify_cancel_dialog_parented(gncUIWidget parent,
|
||||||
|
const char *message,
|
||||||
|
GNCVerifyResult default_result);
|
||||||
|
|
||||||
gncBoolean gnc_verify_dialog( const char *message,
|
gncBoolean gnc_verify_dialog( const char *message,
|
||||||
gncBoolean yes_is_default );
|
gncBoolean yes_is_default );
|
||||||
void gnc_error_dialog( const char *message );
|
void gnc_error_dialog( const char *message );
|
||||||
|
Loading…
Reference in New Issue
Block a user