From c8c4ffa54e532ef2adeaf85c2e51355901b09970 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Mon, 10 Jan 2000 03:33:23 +0000 Subject: [PATCH] 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 --- ChangeLog | 143 ++ Makefile.common | 4 - Makefile.in | 31 +- README | 98 +- README.SuSE-6.3 | 95 ++ aclocal.m4 | 438 ++++++ config.h.in | 23 + config.sub | 873 ------------ configure | 1587 +++++++++++++++++++-- configure.in | 54 +- lib/Makefile.in | 4 +- make-gnucash-patch | 129 ++ mkinstalldirs | 32 + src/Makefile.in | 6 +- src/MultiLedger.c | 52 +- src/MultiLedger.h | 10 +- src/SplitLedger.c | 343 +++-- src/gnome/account-tree.c | 133 +- src/gnome/account-tree.h | 8 +- src/gnome/cursors.c | 3 +- src/gnome/dialog-add.c | 38 +- src/gnome/dialog-edit.c | 5 +- src/gnome/dialog-filebox.c | 5 +- src/gnome/dialog-options.c | 256 +++- src/gnome/dialog-transfer.c | 17 +- src/gnome/dialog-utils.c | 10 +- src/gnome/global-options.c | 14 +- src/gnome/option-util.c | 244 +++- src/gnome/option-util.h | 19 +- src/gnome/query-user.c | 73 +- src/gnome/query-user.h | 1 - src/gnome/reconcile-list.c | 7 +- src/gnome/scripts_menu.c | 2 + src/gnome/scripts_menu.h | 1 - src/gnome/top-level.c | 4 +- src/gnome/version.h | 5 - src/gnome/window-adjust.c | 7 +- src/gnome/window-help.c | 124 +- src/gnome/window-help.h | 4 - src/gnome/window-html.c | 296 ++-- src/gnome/window-html.h | 30 +- src/gnome/window-main.c | 584 ++++---- src/gnome/window-main.h | 3 + src/gnome/window-mainP.h | 4 - src/gnome/window-reconcile.c | 49 +- src/gnome/window-reconcile.h | 6 - src/gnome/window-register.c | 838 ++++++----- src/gnome/window-register.h | 2 - src/gnome/window-report.c | 205 +-- src/scm/bootstrap.scm.in | 14 + src/scm/c-interface.scm | 10 +- src/scm/prefs.scm | 144 +- src/scm/report/dummy.scm | 65 +- src/scm/report/transaction-report.scm | 253 +++- src/scm/report/transaction-report.scm.bif | 69 + src/ui-callbacks.h | 13 + 56 files changed, 5143 insertions(+), 2344 deletions(-) create mode 100644 README.SuSE-6.3 delete mode 100755 config.sub create mode 100755 make-gnucash-patch create mode 100755 mkinstalldirs delete mode 100644 src/gnome/version.h create mode 100644 src/scm/report/transaction-report.scm.bif diff --git a/ChangeLog b/ChangeLog index a1f5b4734a..71fa58e265 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,146 @@ +2000-01-09 Dave Peticolas + + * 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 + + * 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 + + * src/scm/bootstrap.scm.in: Added a check for slib. + +2000-01-07 Dave Peticolas + + * 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 + + * 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 + + * 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 + + * 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 + + * src/gnome/dialog-add.c (gnc_ui_accWindow_list_select_cb): + prevent user from selecting illegal account types. + +2000-01-02 Peter Pointner + + * 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 + + * 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 + + * 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 + + * 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 + + * src/SplitLedger.c (xaccSRGetCurrentTrans): Fix error messages. + +1999-12-29 Peter Pointner + + * 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 * src/gnome/window-report.c (reportWindow): Add a properties diff --git a/Makefile.common b/Makefile.common index 5422e9c86f..0834df1d14 100644 --- a/Makefile.common +++ b/Makefile.common @@ -103,7 +103,3 @@ dist: # Get dependencies (if existent). -include $(shell if [ -e obj ]; then find obj -name "*.d"; fi) "" - -# Local Variables: -# tab-width: 2 -# End: diff --git a/Makefile.in b/Makefile.in index 883c4ba47b..afdf5ba7fd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -41,6 +41,7 @@ default: @echo "gnome gnome/gtk version" @echo "gnome-static gnome/gtk statically linked version" @echo "qt kde/qt version" + @echo "qt-static kde/qt statically linked version" @echo " " # This inclusion must come after the first target, and after the @@ -50,6 +51,7 @@ include @top_srcdir@/Makefile.common # Aliases motif-static: motif.static gnome-static: gnome.static +qt-static: qt.static build-flavor: config.status @cd lib; $(MAKE) ${FLAVOR} @@ -82,8 +84,23 @@ gnome.disable: false qt: + ${MAKE} @QT_TARGET@ + +qt.static: + ${MAKE} @QT_STATIC_TARGET@ + +qt.real: ${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: @echo make depend is now superfluous. @@ -98,12 +115,13 @@ config.status: configure exit 1; \ fi -CLEAN_SUBDIRS += lib src +CLEAN_SUBDIRS += lib src po TRASH += TAGS *~ *.o *.bak DIST_TRASH += Makefile *~ *.o *.bak share/scm gnucash.bin 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 tagsfiles := $(shell find . -name "*.[ch]" -print) @@ -120,6 +138,8 @@ install: # Put these in the opposite order of precedence. Final bin/gnucash link will # 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.gnome.static ] && \ ${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.gnome -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} @@ -202,6 +223,8 @@ install: $(INSTALL_DATA) etc/conf* ${GNC_SHAREDIR} + $(MAKE) -C po install + # # Config directory # @mkdir -p ${GNC_CONFIGDIR} # @@ -218,5 +241,5 @@ install: # done .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 diff --git a/README b/README index dbd4fc2823..6ac0c9d67e 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ The version 1.3.x series of GnuCash are experimental development 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 ############################################## @@ -90,6 +90,7 @@ ftp://ftp.ultra.net/pub/eugene/RPMS/i386/ Development versions: http://linas.org/linux/gnucash/ + Running: -------- 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.87.0: broken (missing symbols for XmeDrawShadows, etc.) 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. 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 package and compile it yourself. +slib -- scheme libraries for guile. Need version slib2c6 or later. + libpng -- portable network graphics library. Any version. libjpeg -- JPEG image handling library. Any version. libz -- compression library. Any version. @@ -166,7 +169,6 @@ perl-HTML/HTML-Parser-2.20 http://www.cpan.org/CPAN.html - Invocation: ----------- 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 here). + Building & Installing: ---------------------- 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 +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: ---------------- Robin Clark wrote the original X-Accountant in Motif @@ -414,6 +497,7 @@ Per Bojsen several core dump fixes Christopher B. Browne for perl, scheme scripts Graham Chapman for the xacc-rpts addon package George Chen for MS-Money QIF's & fixes +Albert Chin-A-Young configure.in patch Jeremey Collins for GnoMoney & GTK port Patrick Condron for webserver and T1 connection. Ciaran Deignan for AIX binary version @@ -433,22 +517,26 @@ Sven Kuenzler for SuSE README file Graham Leggett for fixing a hang Ted Lemon for NetBSD port Yannick Le Ny pour la traduction en francais -Heath Martin for extensive gtk fixes +Grant Likely gnome and engine patches +Heath Martin gnome and register patches +Robert Graham Merkel reporting, gnome, and config patches. Tim Mooney port to alpha-dec-osf4.0f G. Allen Morris III for QIF core dump Peter Norton for a valiant attempt at a GTK port OmNiBuS web site graphics & content Myroslav Opyr for misc patches Dave Peticolas extensive intelligent patches +Laurent P{'e}lecq i18n patches with gettext Alain Peyrat for configure.in patches Peter Pointner QIF import fixes, Qt patches Gavin Porter for euro style dates Ron Record for SCO Unixware & OpenServer binaries +Jan Schrage documentation patches Christopher Seawood for XbaeMatrix core dump Mike Simons misc configure.in patches Richard Skelton for Solaris cleanup Henning Spruth for German text & euro date rework +Rob Walker guile and register patches Ken Yamaguchi QIF import fixes; MYM import ... and I am sure that I have missed many others ... - diff --git a/README.SuSE-6.3 b/README.SuSE-6.3 new file mode 100644 index 0000000000..022a4ae379 --- /dev/null +++ b/README.SuSE-6.3 @@ -0,0 +1,95 @@ +How to install gnucash-1.2.5 on SuSE-6.3 +======================================== +(written 2000-01-07 by Peter Pointner ) + +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" diff --git a/aclocal.m4 b/aclocal.m4 index e9662caa69..08619e3a0f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -48,3 +48,441 @@ ifelse([$4], , , [$4 ])dnl fi ]) +# Search path for a program which passes the given test. +# Ulrich Drepper , 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 , 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 ], [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 in the installed 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 " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . 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 . +# Ulrich Drepper , 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 ], [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)]) diff --git a/config.h.in b/config.h.in index 91c4f4dae8..b71c54dc37 100644 --- a/config.h.in +++ b/config.h.in @@ -26,6 +26,10 @@ #ifndef __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 */ #undef WORDS_BIGENDIAN @@ -65,4 +69,23 @@ /* Configure found the function 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 diff --git a/config.sub b/config.sub deleted file mode 100755 index 39d7a6c87f..0000000000 --- a/config.sub +++ /dev/null @@ -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 diff --git a/configure b/configure index 7e1d573919..cdfed56c95 100755 --- a/configure +++ b/configure @@ -19,6 +19,8 @@ ac_help="$ac_help --enable-debug compile with debugging flags set" ac_help="$ac_help --enable-warnings compile with lots of warnings generated" +ac_help="$ac_help + --enable-qt enable building of the Qt version of gnucash" ac_help="$ac_help --with-perl=FILE which perl executable to use " ac_help="$ac_help @@ -53,6 +55,14 @@ ac_help="$ac_help --with-guile-config=executable which guile-config to use to find guile " ac_help="$ac_help --with-guile=PATH specify where to look for guile includes and libs" +ac_help="$ac_help + --with-locale-dir=PATH specify where to look for locale-specific information" +ac_help="$ac_help + --disable-nls do not use Native Language Support" +ac_help="$ac_help + --with-included-gettext use the GNU gettext library included here" +ac_help="$ac_help + --with-catgets use catgets functions if available" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -563,6 +573,7 @@ else fi + ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -594,7 +605,246 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:598: checking for a BSD compatible install" >&5 +echo "configure:609: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:665: checking whether build environment is sane" >&5 +# 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". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:722: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=gnucash + +VERSION=1.3.1 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:768: checking for working aclocal" >&5 +# 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 (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:781: checking for working autoconf" >&5 +# 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 (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:794: checking for working automake" >&5 +# 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 (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:807: checking for working autoheader" >&5 +# 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 (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:820: checking for working makeinfo" >&5 +# 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 (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +ALL_LINGUAS="fr de" + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:848: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -649,7 +899,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:653: checking for $ac_word" >&5 +echo "configure:903: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -681,7 +931,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:685: checking for $ac_word" >&5 +echo "configure:935: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -711,7 +961,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:715: checking for $ac_word" >&5 +echo "configure:965: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -762,7 +1012,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:766: checking for $ac_word" >&5 +echo "configure:1016: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -794,7 +1044,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:798: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1048: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -805,12 +1055,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 809 "configure" +#line 1059 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -836,12 +1086,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:840: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1090: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:845: checking whether we are using GNU C" >&5 +echo "configure:1095: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -850,7 +1100,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -869,7 +1119,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:873: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1123: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -902,7 +1152,7 @@ fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:906: checking for POSIXized ISC" >&5 +echo "configure:1156: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -923,14 +1173,14 @@ else fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:927: checking whether byte ordering is bigendian" >&5 +echo "configure:1177: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -941,11 +1191,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -956,7 +1206,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:960: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1210: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -976,7 +1226,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1013,7 +1263,7 @@ EOF fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1017: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1267: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1043,12 +1293,12 @@ fi for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1047: checking for $ac_func" >&5 +echo "configure:1297: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1129,6 +1379,8 @@ fi if test "${with_opt_style_install+set}" = set; then withval="$with_opt_style_install" OPT_STYLE_INSTALL=1 + CPPFLAGS="$CPPFLAGS -I$prefix/include" + CFLAGS="$CLFAGS -L$prefix/lib" else OPT_STYLE_INSTALL=0 fi @@ -1173,6 +1425,29 @@ EOF fi +### -------------------------------------------------------------------------- +## 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 + +# Check whether --enable-qt or --disable-qt was given. +if test "${enable_qt+set}" = set; then + enableval="$enable_qt" + GNC_QT_ENABLED=yes +fi + + +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 + + + + ### -------------------------------------------------------------------------- ### Programs @@ -1181,7 +1456,7 @@ fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1185: checking for $ac_word" >&5 +echo "configure:1460: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1239,7 +1514,7 @@ fi # I'm reasonably sure it's correct. # PERLINCL="/usr/lib/perl5/i386-linux/5.00404" # -PERLINCL=`perl -MConfig -e 'print $Config{"archlibexp"}'` +PERLINCL=`$PERL -MConfig -e 'print $Config{"archlibexp"}'` # Check whether --with-perl-includes or --without-perl-includes was given. if test "${with_perl_includes+set}" = set; then withval="$with_perl_includes" @@ -1260,7 +1535,7 @@ fi # Extract the first word of "eperl", so it can be a program name with args. set dummy eperl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1264: checking for $ac_word" >&5 +echo "configure:1539: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_EPERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1319,7 +1594,7 @@ EPERL_NAME=`basename $EPERL` # Extract the first word of "swig", so it can be a program name with args. set dummy swig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1323: checking for $ac_word" >&5 +echo "configure:1598: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SWIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1378,7 +1653,7 @@ then # Extract the first word of "gnome-config", so it can be a program name with args. set dummy gnome-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1382: checking for $ac_word" >&5 +echo "configure:1657: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG_BIN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1424,7 +1699,7 @@ LIBS="$LIBS -lm" # important. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1428: checking how to run the C preprocessor" >&5 +echo "configure:1703: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1439,13 +1714,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1456,13 +1731,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1466: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1473,13 +1748,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1483: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1508,7 +1783,7 @@ echo "$ac_t""$CPP" 1>&6 # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1512: checking for X" >&5 +echo "configure:1787: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1570,12 +1845,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1579: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1644,14 +1919,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -1757,17 +2032,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:1761: checking whether -R must be followed by a space" >&5 +echo "configure:2036: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -1783,14 +2058,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -1822,7 +2097,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:1826: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:2101: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1830,7 +2105,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1863,7 +2138,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:1867: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2142: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1871,7 +2146,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1911,12 +2186,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1915: checking for gethostbyname" >&5 +echo "configure:2190: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1960,7 +2235,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1964: checking for gethostbyname in -lnsl" >&5 +echo "configure:2239: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1968,7 +2243,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2009,12 +2284,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2013: checking for connect" >&5 +echo "configure:2288: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2058,7 +2333,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2062: checking for connect in -lsocket" >&5 +echo "configure:2337: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2066,7 +2341,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2101,12 +2376,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:2105: checking for remove" >&5 +echo "configure:2380: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -2150,7 +2425,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:2154: checking for remove in -lposix" >&5 +echo "configure:2429: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2158,7 +2433,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2193,12 +2468,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:2197: checking for shmat" >&5 +echo "configure:2472: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2242,7 +2517,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2246: checking for shmat in -lipc" >&5 +echo "configure:2521: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2250,7 +2525,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2294,7 +2569,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2298: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:2573: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2302,7 +2577,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2435,7 +2710,7 @@ fi # the XmHTML widget needs libz, libjpeg, libpng and libm # it also uses #ifdef's not #if's so DONT #def to zero. echo $ac_n "checking for deflateEnd in -lz""... $ac_c" 1>&6 -echo "configure:2439: checking for deflateEnd in -lz" >&5 +echo "configure:2714: checking for deflateEnd in -lz" >&5 ac_lib_var=`echo z'_'deflateEnd | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2443,7 +2718,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2478,7 +2753,7 @@ else fi echo $ac_n "checking for jpeg_read_scanlines in -ljpeg""... $ac_c" 1>&6 -echo "configure:2482: checking for jpeg_read_scanlines in -ljpeg" >&5 +echo "configure:2757: checking for jpeg_read_scanlines in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_read_scanlines | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2486,7 +2761,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ljpeg $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2521,7 +2796,7 @@ else fi echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6 -echo "configure:2525: checking for png_read_image in -lpng" >&5 +echo "configure:2800: checking for png_read_image in -lpng" >&5 ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2529,7 +2804,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpng $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2570,7 +2845,7 @@ fi # LIBS="-lXmu -lXt -lXext $X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS $LIBS" echo $ac_n "checking for XpmReadFileToXpmImage in -lXpm""... $ac_c" 1>&6 -echo "configure:2574: checking for XpmReadFileToXpmImage in -lXpm" >&5 +echo "configure:2849: checking for XpmReadFileToXpmImage in -lXpm" >&5 ac_lib_var=`echo Xpm'_'XpmReadFileToXpmImage | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2578,7 +2853,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXpm $X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2620,7 +2895,7 @@ fi # Don't build the xmhtml source if user already has it installed... # this is ugly, there must be a nicer way of setting this up ... echo $ac_n "checking for XmHTMLTextScrollToLine in -lXmHTML""... $ac_c" 1>&6 -echo "configure:2624: checking for XmHTMLTextScrollToLine in -lXmHTML" >&5 +echo "configure:2899: checking for XmHTMLTextScrollToLine in -lXmHTML" >&5 ac_lib_var=`echo XmHTML'_'XmHTMLTextScrollToLine | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2628,7 +2903,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXmHTML $X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS $X_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2673,7 +2948,7 @@ fi ## If there's a better way to tackle this please let me know! OLDCPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS `$GNOME_CONFIG_BIN --cflags glib`" +CPPFLAGS="$CPPFLAGS `$GNOME_CONFIG_BIN --cflags gnome`" # gnome targets if all goes well @@ -2686,14 +2961,14 @@ GNOME_STATIC_TARGET="gnome.static.real" #AC_CHECK_HEADER might work, but I'm not sure it uses CPPFLAGS # this guarantees it - it works. Promise!! echo $ac_n "checking gtk-xmhtml/gtk-xmhtml.h""... $ac_c" 1>&6 -echo "configure:2690: checking gtk-xmhtml/gtk-xmhtml.h" >&5 +echo "configure:2965: checking gtk-xmhtml/gtk-xmhtml.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2972: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2717,7 +2992,7 @@ LDFLAGS="$LDFLAGS `$GNOME_CONFIG_BIN --libs gtkxmhtml`" #check for gtkxmhtml, export library link to variable GTK_XMHTML echo $ac_n "checking for gtk_xmhtml_new in -lgtkxmhtml""... $ac_c" 1>&6 -echo "configure:2721: checking for gtk_xmhtml_new in -lgtkxmhtml" >&5 +echo "configure:2996: checking for gtk_xmhtml_new in -lgtkxmhtml" >&5 ac_lib_var=`echo gtkxmhtml'_'gtk_xmhtml_new | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2725,7 +3000,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgtkxmhtml $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2766,7 +3041,6 @@ LDFLAGS="$OLDLDFLAGS" - ### -------------------------------------------------------------------------- ## Nana # XXX - There should probably be a --without-nana option (e.g., for @@ -2776,17 +3050,17 @@ LDFLAGS="$OLDLDFLAGS" # See if the header file can be found. ac_safe=`echo "nana.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for nana.h""... $ac_c" 1>&6 -echo "configure:2780: checking for nana.h" >&5 +echo "configure:3054: checking for nana.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2790: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2809,7 +3083,7 @@ else fi echo $ac_n "checking for L_buffer_create in -lnana""... $ac_c" 1>&6 -echo "configure:2813: checking for L_buffer_create in -lnana" >&5 +echo "configure:3087: checking for L_buffer_create in -lnana" >&5 ac_lib_var=`echo nana'_'L_buffer_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2817,7 +3091,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnana $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2861,7 +3135,7 @@ fi ### -------------------------------------------------------------------------- # If readline exists, just assume that guile needs it. It probably does. echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6 -echo "configure:2865: checking for readline in -lreadline" >&5 +echo "configure:3139: checking for readline in -lreadline" >&5 ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2869,7 +3143,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lreadline $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2926,7 +3200,7 @@ fi if test "${with_guile_config+set}" = set; then withval="$with_guile_config" echo $ac_n "checking for guile-config""... $ac_c" 1>&6 -echo "configure:2930: checking for guile-config" >&5 +echo "configure:3204: checking for guile-config" >&5 echo "$ac_t""${with_guile_config}" 1>&6 GUILE_CONFIG="$with_guile_config" LIBS="`${GUILE_CONFIG} link` ${LIBS}" @@ -2939,7 +3213,7 @@ if test x"$GUILE_CONFIG" = x; then # Extract the first word of "guile-config", so it can be a program name with args. set dummy guile-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2943: checking for $ac_word" >&5 +echo "configure:3217: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GUILE_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2995,7 +3269,7 @@ if test x"$GUILE_CONFIG" = x; then GNC_LIBS_SAFE=${LIBS} echo $ac_n "checking for guile""... $ac_c" 1>&6 -echo "configure:2999: checking for guile" >&5 +echo "configure:3273: checking for guile" >&5 if eval "test \"`echo '$''{'ac_cv_lib_guile'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3008,14 +3282,14 @@ else else LIBS="${GNC_TEST_LIBS} ${GNC_LIBS_SAFE}" cat > conftest.$ac_ext < int main() { gh_eval_file; ; return 0; } EOF -if { (eval echo configure:3019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* GUILELIBS="${GNC_TEST_LIBS}" else @@ -3042,7 +3316,7 @@ if test x"$GUILE_CONFIG" != x; then # Extract the first word of "guile", so it can be a program name with args. set dummy guile; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3046: checking for $ac_word" >&5 +echo "configure:3320: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GUILE_BIN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3081,7 +3355,7 @@ if test x"$GUILE_BIN" = x && test x"$with_guile" != x; then # Extract the first word of "guile", so it can be a program name with args. set dummy guile; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3085: checking for $ac_word" >&5 +echo "configure:3359: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GUILE_BIN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3120,7 +3394,7 @@ if test x"${GUILE_BIN}" = x; then # Extract the first word of "guile", so it can be a program name with args. set dummy guile; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3124: checking for $ac_word" >&5 +echo "configure:3398: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GUILE_BIN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3240,6 +3514,990 @@ GNC_RUNTIME_CONFIGDIR=`eval echo ${GNC_CONFIGDIR}` ABSOLUTE_TOP_SRCDIR=`pwd` +### Begin i18n + +# Check whether --with-locale-dir or --without-locale-dir was given. +if test "${with_locale_dir+set}" = set; then + withval="$with_locale_dir" + LOCALE_DIR="$with_locale_dir" +else + LOCALE_DIR="$prefix/share/locale" +fi + + + +ac_safe=`echo "locale.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for locale.h""... $ac_c" 1>&6 +echo "configure:3532: checking for locale.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3542: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_cv_header_locale_h=yes +else + echo "$ac_t""no" 1>&6 +ac_cv_header_locale_h=no +fi + +if test "$ac_cv_header_locale_h" = yes; then + echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 +echo "configure:3566: checking for LC_MESSAGES" >&5 +if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return LC_MESSAGES +; return 0; } +EOF +if { (eval echo configure:3578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_val_LC_MESSAGES=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_val_LC_MESSAGES=no +fi +rm -f conftest* +fi + +echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 + if test "$am_cv_val_LC_MESSAGES" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LC_MESSAGES 1 +EOF + + fi + fi + echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 +echo "configure:3599: checking whether NLS is requested" >&5 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi + + echo "$ac_t""$USE_NLS" 1>&6 + + + USE_INCLUDED_LIBINTL=no + + if test "$USE_NLS" = "yes"; then + cat >> confdefs.h <<\EOF +#define ENABLE_NLS 1 +EOF + + echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 +echo "configure:3619: checking whether included gettext is requested" >&5 + # Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval +else + nls_cv_force_use_gnu_gettext=no +fi + + echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 +echo "configure:3638: checking for libintl.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 +echo "configure:3665: checking for gettext in libc" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return (int) gettext ("") +; return 0; } +EOF +if { (eval echo configure:3677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + gt_cv_func_gettext_libc=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gettext_libc=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 + + if test "$gt_cv_func_gettext_libc" != "yes"; then + echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 +echo "configure:3693: checking for bindtextdomain in -lintl" >&5 +ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lintl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 +echo "configure:3728: checking for gettext in libintl" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6 +echo "configure:3733: checking for gettext in -lintl" >&5 +ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lintl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + gt_cv_func_gettext_libintl=yes +else + echo "$ac_t""no" 1>&6 +gt_cv_func_gettext_libintl=no +fi + +fi + +echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3791: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$MSGFMT" != "no"; then + for ac_func in dcgettext +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3825: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3880: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3916: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGMERGE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGMERGE" in + /*) + ac_cv_path_GMSGMERGE="$GMSGMERGE" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGMERGE="$GMSGMERGE" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGMERGE="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGMERGE" && ac_cv_path_GMSGMERGE=":" + ;; +esac +fi +GMSGMERGE="$ac_cv_path_GMSGMERGE" +if test -n "$GMSGMERGE"; then + echo "$ac_t""$GMSGMERGE" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3952: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + CATOBJEXT=.gmo + DATADIRNAME=share +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CATOBJEXT=.mo + DATADIRNAME=lib +fi +rm -f conftest* + INSTOBJEXT=.mo + fi + fi + +else + echo "$ac_t""no" 1>&6 +fi + + + if test "$CATOBJEXT" = "NONE"; then + echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6 +echo "configure:4015: checking whether catgets can be used" >&5 + # Check whether --with-catgets or --without-catgets was given. +if test "${with_catgets+set}" = set; then + withval="$with_catgets" + nls_cv_use_catgets=$withval +else + nls_cv_use_catgets=no +fi + + echo "$ac_t""$nls_cv_use_catgets" 1>&6 + + if test "$nls_cv_use_catgets" = "yes"; then + echo $ac_n "checking for main in -li""... $ac_c" 1>&6 +echo "configure:4028: checking for main in -li" >&5 +ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-li $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo i | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + echo $ac_n "checking for catgets""... $ac_c" 1>&6 +echo "configure:4071: checking for catgets" >&5 +if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char catgets(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_catgets) || defined (__stub___catgets) +choke me +#else +catgets(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_catgets=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_catgets=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'catgets`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_CATGETS 1 +EOF + + INTLOBJS="\$(CATOBJS)" + # Extract the first word of "gencat", so it can be a program name with args. +set dummy gencat; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4121: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GENCAT" in + /*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GENCAT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no" + ;; +esac +fi +GENCAT="$ac_cv_path_GENCAT" +if test -n "$GENCAT"; then + echo "$ac_t""$GENCAT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$GENCAT" != "no"; then + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4157: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$GMSGFMT" = "no"; then + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4194: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4229: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + 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 +else + echo "$ac_t""no" 1>&6 +fi + + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + INTLOBJS="\$(GETTOBJS)" + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4287: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4321: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4357: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + 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 + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6 + 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 + + + + + # 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 + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + POXFILES="$POXFILES $lang.pox" + done + + + + + + + + + + + + + + + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 +echo "configure:4452: checking for catalogs to be installed" >&5 + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + echo "$ac_t""$LINGUAS" 1>&6 + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + if test "$ac_cv_header_locale_h" = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + 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 + + +### End i18n + trap '' 1 2 15 @@ -3348,6 +4606,7 @@ trap 'rm -fr `echo "Makefile src/Makefile src/engine/Makefile src/guile/Makefile + src/guile/i18n.h src/scm/Makefile src/g-wrap/Makefile src/gnome/Makefile @@ -3359,6 +4618,9 @@ trap 'rm -fr `echo "Makefile src/reports/pathconfig.h src/swig/Makefile src/swig/perl5/Makefile + po/Makefile.in + po/extract-macros.perl + include/messages_i18n.h lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile @@ -3397,10 +4659,19 @@ s%@mandir@%$mandir%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g s%@RANLIB@%$RANLIB%g s%@CC@%$CC%g -s%@SET_MAKE@%$SET_MAKE%g s%@OPT_STYLE_INSTALL@%$OPT_STYLE_INSTALL%g +s%@QT_TARGET@%$QT_TARGET%g +s%@QT_STATIC_TARGET@%$QT_STATIC_TARGET%g s%@PERL@%$PERL%g s%@PERLINCL@%$PERLINCL%g s%@EPERL@%$EPERL%g @@ -3432,6 +4703,27 @@ s%@GNC_RUNTIME_PERLLIBPATH@%$GNC_RUNTIME_PERLLIBPATH%g s%@GNC_RUNTIME_SHAREDIR@%$GNC_RUNTIME_SHAREDIR%g s%@GNC_RUNTIME_CONFIGDIR@%$GNC_RUNTIME_CONFIGDIR%g s%@ABSOLUTE_TOP_SRCDIR@%$ABSOLUTE_TOP_SRCDIR%g +s%@LOCALE_DIR@%$LOCALE_DIR%g +s%@USE_NLS@%$USE_NLS%g +s%@MSGFMT@%$MSGFMT%g +s%@GMSGFMT@%$GMSGFMT%g +s%@GMSGMERGE@%$GMSGMERGE%g +s%@XGETTEXT@%$XGETTEXT%g +s%@GENCAT@%$GENCAT%g +s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g +s%@CATALOGS@%$CATALOGS%g +s%@CATOBJEXT@%$CATOBJEXT%g +s%@DATADIRNAME@%$DATADIRNAME%g +s%@GMOFILES@%$GMOFILES%g +s%@INSTOBJEXT@%$INSTOBJEXT%g +s%@INTLDEPS@%$INTLDEPS%g +s%@INTLLIBS@%$INTLLIBS%g +s%@INTLOBJS@%$INTLOBJS%g +s%@POFILES@%$POFILES%g +s%@POXFILES@%$POXFILES%g +s%@POSUB@%$POSUB%g +s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g +s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g CEOF EOF @@ -3478,6 +4770,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile src/engine/Makefile src/guile/Makefile + src/guile/i18n.h src/scm/Makefile src/g-wrap/Makefile src/gnome/Makefile @@ -3489,6 +4782,9 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile src/reports/pathconfig.h src/swig/Makefile src/swig/perl5/Makefile + po/Makefile.in + po/extract-macros.perl + include/messages_i18n.h lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile @@ -3659,10 +4955,59 @@ cat >> $CONFIG_STATUS <<\EOF fi; done EOF + cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$1; shift; ac_dests=$* + set $ac_sources; ac_source=$1; shift; ac_sources=$* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } + fi +done +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac exit 0 EOF @@ -3675,4 +5020,4 @@ chmod +x gnucash ${MAKE-make} -f Makefile.config.finish prefix=${prefix} \ GNC_SHAREDIR=${GNC_SHAREDIR} \ - GNC_CONFIGDIR=${GNC_SHAREDIR} + GNC_CONFIGDIR=${GNC_SHAREDIR} diff --git a/configure.in b/configure.in index ff5036db06..8b07c1cc01 100644 --- a/configure.in +++ b/configure.in @@ -22,6 +22,12 @@ ### commands depend on them): 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_RANLIB @@ -52,7 +58,9 @@ AC_ARG_ENABLE( color, AC_ARG_WITH( opt-style-install, [ --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) AC_SUBST(OPT_STYLE_INSTALL) @@ -69,6 +77,26 @@ AC_ARG_ENABLE( warnings, LDFLAGS="${LDFLAGS} -g -Wall" 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 @@ -98,7 +126,7 @@ AC_SUBST(PERL) # I'm reasonably sure it's correct. # 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, [ --with-perl-includes=DIR specify where to look for 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! OLDCPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS `$GNOME_CONFIG_BIN --cflags glib`" +CPPFLAGS="$CPPFLAGS `$GNOME_CONFIG_BIN --cflags gnome`" # gnome targets if all goes well @@ -309,7 +337,6 @@ LDFLAGS="$OLDLDFLAGS" AC_SUBST(GNOME_TARGET) AC_SUBST(GNOME_STATIC_TARGET) - ### -------------------------------------------------------------------------- ## Nana # 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` 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_OUTPUT(Makefile @@ -502,6 +542,7 @@ AC_OUTPUT(Makefile src/Makefile src/engine/Makefile src/guile/Makefile + src/guile/i18n.h src/scm/Makefile src/g-wrap/Makefile src/gnome/Makefile @@ -513,6 +554,9 @@ AC_OUTPUT(Makefile src/reports/pathconfig.h src/swig/Makefile src/swig/perl5/Makefile + po/Makefile.in + po/extract-macros.perl + include/messages_i18n.h lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile @@ -522,4 +566,4 @@ chmod +x gnucash ${MAKE-make} -f Makefile.config.finish prefix=${prefix} \ GNC_SHAREDIR=${GNC_SHAREDIR} \ - GNC_CONFIGDIR=${GNC_SHAREDIR} + GNC_CONFIGDIR=${GNC_SHAREDIR} diff --git a/lib/Makefile.in b/lib/Makefile.in index 8e4ab0053f..f24c0cae7c 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -75,7 +75,7 @@ motif motif.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 diff --git a/make-gnucash-patch b/make-gnucash-patch new file mode 100755 index 0000000000..61d8287aa6 --- /dev/null +++ b/make-gnucash-patch @@ -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 + + +########################################################### +# 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 () { + 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 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000000..91f6d04e17 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,32 @@ +#!/bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# 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 diff --git a/src/Makefile.in b/src/Makefile.in index af782d02a8..f0de722b59 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -70,13 +70,13 @@ gnome gnome.static: ${GNOME_OBJS} @cd guile; $(MAKE) default @cd gnome; $(MAKE) $@ -qt: $(QT_OBJS) +qt qt.static: $(QT_OBJS) @cd engine; $(MAKE) default @cd register; $(MAKE) qt @cd reports; $(MAKE) default @cd g-wrap; $(MAKE) qt @cd swig; $(MAKE) qt @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 diff --git a/src/MultiLedger.c b/src/MultiLedger.c index 9feed13339..442b9bece7 100644 --- a/src/MultiLedger.c +++ b/src/MultiLedger.c @@ -54,7 +54,7 @@ static short module = MOD_LEDGER; * present a rather natural place for the locks to be placed. * \********************************************************************/ -int +static int ledgerListCount (xaccLedgerDisplay **list) { int n = 0; @@ -65,7 +65,7 @@ ledgerListCount (xaccLedgerDisplay **list) /* ------------------------------------------------------ */ -xaccLedgerDisplay ** +static xaccLedgerDisplay ** ledgerListAdd (xaccLedgerDisplay **oldlist, xaccLedgerDisplay *addreg) { xaccLedgerDisplay **newlist; @@ -95,7 +95,7 @@ ledgerListAdd (xaccLedgerDisplay **oldlist, xaccLedgerDisplay *addreg) /* ------------------------------------------------------ */ -void +static void ledgerListRemove (xaccLedgerDisplay **list, xaccLedgerDisplay *delreg) { int n, i; @@ -273,6 +273,20 @@ xaccLedgerDisplayAccGroup (Account *acc) 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 * * 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->redraw = NULL; regData->destroy = NULL; + regData->get_parent = NULL; regData->gui_hook = NULL; regData->dirty = 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 */ regData->ledger = xaccMallocSplitRegister (ledger_type); + xaccSRSetData(regData->ledger, regData, xaccLedgerDisplayParent); + regData->dirty = 1; xaccLedgerDisplayRefresh (regData); @@ -384,8 +401,8 @@ xaccLedgerDisplayRefresh (xaccLedgerDisplay *regData) * new splits and get them into the system. */ xaccSRLoadRegister (regData->ledger, - xaccQueryGetSplits (regData->query), - regData->leader); + xaccQueryGetSplits (regData->query), + regData->leader); /* 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 * \********************************************************************/ diff --git a/src/MultiLedger.h b/src/MultiLedger.h index 71ae2e2f65..2542b2b2fe 100644 --- a/src/MultiLedger.h +++ b/src/MultiLedger.h @@ -71,6 +71,7 @@ struct _xaccLedgerDisplay { void *gui_hook; /* GUI-specific state */ void (*redraw) (xaccLedgerDisplay *); /* redraw 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 *); -/********************************************************************\ - * sort of a quick hack involving the layout of the register. -\********************************************************************/ - -void xaccRegisterCountHack (SplitRegister *splitreg); - +/* + * close all ledger windows containing this account. + */ void xaccDestroyLedgerDisplay (Account *acc); #endif /* __MULTI_LEDGER_H__ */ diff --git a/src/SplitLedger.c b/src/SplitLedger.c index 5bcb4a3ebd..e30c939a97 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -25,7 +25,7 @@ * ===================================================================== * 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() * before starting to edit a transaction. When you think you're done, * you can call CommitEdit() to commit the changes, or RollbackEdit() to @@ -50,14 +50,14 @@ * Some notes on Reloads & Redraws: * * 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. * Open two registers, showing each account. Change the amount in one window. * Note that the other window also redraws, to show the new correct amount. * * Since you changed an amount value, potentially *all* displayed balances change - * in *both* register windows (as well as the 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, * 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 @@ -89,7 +89,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ -#include #include #include "top-level.h" @@ -119,6 +118,12 @@ struct _SRInfo /* The default account where new splits are added */ 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 * the leader account. What happens visually is that it appears * 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. * * 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. */ 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 * 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 @@ -184,6 +195,31 @@ xaccSRGetInfo(SplitRegister *reg) 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 * 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_col = *p_new_phys_col; SplitRegister *reg = (SplitRegister *) client_data; - SRInfo *info = xaccSRGetInfo(reg); Transaction *newtrans = NULL; Locator *locator; - Split *split; int style; - PINFO ("LedgerMoveCursor(): start calback %d %d \n", + PINFO ("LedgerMoveCursor(): start callback %d %d \n", new_phys_row, new_phys_col); - /* The split where we are moving to */ - split = xaccGetUserData (reg->table, new_phys_row, new_phys_col); - if (split != NULL) - newtrans = xaccSplitGetParent(split); + /* The transaction where we are moving to */ + newtrans = xaccSRGetTrans(reg, new_phys_row, new_phys_col); /* commit the contents of the cursor into the database */ xaccSRSaveRegEntry (reg, newtrans); @@ -237,38 +269,35 @@ LedgerMoveCursor (Table *table, new_phys_row, new_phys_col); reg->cursor_phys_row = new_phys_row; + reg->cursor_phys_col = new_phys_col; + locator = table->locators[new_phys_row][new_phys_col]; reg->cursor_virt_row = locator->virt_row; /* if auto-expansion is enabled, we need to redraw the register * to expand out the splits at the new location. We do some * 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. - * */ style = ((reg->type) & REG_STYLE_MASK); if ((REG_SINGLE_DYNAMIC == style) || (REG_DOUBLE_DYNAMIC == style)) { - Split *split, *oldsplit; - oldsplit = xaccSRGetCurrentSplit (reg); + Split *split; + split = xaccGetUserData (reg->table, new_phys_row, new_phys_col); 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); gnc_refresh_main_window(); /* indicate what row we *should* have gone to */ *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", - *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, void * client_data) { - int new_phys_row = *p_new_phys_row; - int new_phys_col = *p_new_phys_col; - SplitRegister *reg = (SplitRegister *) client_data; - SRInfo *info = xaccSRGetInfo(reg); - int style; +#ifdef GNOME + static const char *message = + "You have made changes to the current transaction.\n" + "Do you want to record your changes?"; - /* For now, just do nothing. The auto mode handling is done entirely - * by LedgerMoveCursor above. */ - return; + SplitRegister *reg = client_data; + SRInfo *info = xaccSRGetInfo(reg); + 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 - * to expand out the splits at the new location. We do some - * tomfoolery here to trick the code into expanding the new location. - * 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; + trans = xaccSRGetCurrentTrans(reg); + if (trans == NULL) + return; - /* Save the values that xaccSRCountRows will futz up */ - save_num_phys_rows = reg->num_phys_rows; - save_num_virt_rows = reg->num_virt_rows; - save_cursor_phys_row = reg->cursor_phys_row; - save_cursor_virt_row = reg->cursor_virt_row; + /* no changes, no worries */ + changed = xaccSplitRegisterGetChangeFlag(reg); + if (!changed && (info->pending_trans != trans)) + return; - ENTER ("LedgerTraverse with %d %d \n", new_phys_row , new_phys_col); - oldsplit = xaccSRGetCurrentSplit (reg); - split = xaccGetUserData (reg->table, new_phys_row, new_phys_col); - reg->table->current_cursor->user_data = (void *) split; + /* Now see if we are changing cursors. If not, no problems */ + if ((phys_row >= 0) && (phys_col >= 0) && + (phys_row < table->num_phys_rows) && (phys_col < table->num_phys_cols)) + { + 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 (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); - } + if ((virt_row == table->current_cursor_virt_row) && + (virt_col == table->current_cursor_virt_col)) + return; + } - xaccRegisterCountHack (reg); - reg->table->current_cursor->user_data = (void *) oldsplit; + /* Same transaction, no problem */ + new_trans = xaccSRGetTrans(reg, phys_row, phys_col); + if (trans == new_trans) + return; - LEAVE ("LedgerTraverse with %d \n", reg->cursor_phys_row); - /* indicate what row we *should* go to */ - *p_new_phys_row = reg->cursor_phys_row; + /* Ok, we are changing transactions and the current transaction has + * changed. See what the user wants to do. */ - /* Restore the values */ - reg->num_phys_rows = save_num_phys_rows; - reg->num_virt_rows = save_num_virt_rows; - reg->cursor_phys_row = save_cursor_phys_row; - reg->cursor_virt_row = save_cursor_virt_row; - } + result = gnc_verify_cancel_dialog_parented(xaccSRGetParent(reg), + message, GNC_VERIFY_YES); + + switch (result) + { + 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 * xaccSRGetCurrentTrans (SplitRegister *reg) { @@ -400,13 +469,13 @@ xaccSRGetCurrentTrans (SplitRegister *reg) vc = reg->table->locators[pr][pc]->virt_col; vr --; if ((0 > vr) || (0 > vc)) { - PERR ("Internal Error: SaveRegEntry(): bad row \n"); + PERR ("Internal Error: xaccSRGetCurrentTrans(): bad row \n"); return NULL; } split = (Split *) reg->table->user_data[vr][vc]; if (split == NULL) { - PERR ("Internal Error: SaveRegEntry(): no parent \n"); + PERR ("Internal Error: xaccSRGetCurrentTrans(): no parent \n"); return NULL; } @@ -685,6 +754,8 @@ xaccSRCancelCursorSplitChanges (SplitRegister *reg) { Split * split; unsigned int changed; + int row = reg->cursor_phys_row; + int col = reg->cursor_phys_col; changed = xaccSplitRegisterGetChangeFlag(reg); if (!changed) @@ -694,8 +765,12 @@ xaccSRCancelCursorSplitChanges (SplitRegister *reg) /* When cancelling edits, reload the cursor from the transaction */ split = xaccSRGetCurrentSplit(reg); xaccSRLoadRegEntry(reg, split); - xaccRefreshTableGUI(reg->table); 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 xaccSRRedrawRegEntry (SplitRegister *reg) { - Split *split; Transaction *trans; unsigned int changed; @@ -769,8 +843,7 @@ xaccSRRedrawRegEntry (SplitRegister *reg) changed = xaccSplitRegisterGetChangeFlag (reg); if (!changed) return; - split = xaccSRGetCurrentSplit (reg); - trans = xaccSplitGetParent (split); + trans = xaccSRGetCurrentTrans (reg); /* refresh the register windows */ /* This split belongs to a transaction that might be displayed @@ -1077,17 +1150,17 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit) double amt; char * accname=NULL; Transaction *trans = xaccSplitGetParent (split); - + secs = xaccTransGetDateL (trans); xaccSetDateCellValueSecsL (reg->dateCell, secs); - + xaccSetBasicCellValue (reg->numCell, xaccTransGetNum (trans)); xaccSetQuickFillCellValue (reg->descCell, xaccTransGetDescription (trans)); - + buff[0] = xaccSplitGetReconcile (split); buff[1] = 0x0; xaccSetBasicCellValue (reg->recnCell, buff); - + /* For income and expense acounts, we have to reverse * the meaning of balance, since, in a dual entry * system, income will show up as a credit to a @@ -1099,7 +1172,7 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit) baln = -baln; } xaccSetPriceCellValue (reg->balanceCell, baln); - + xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (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 xaccSRLoadRegEntry (SplitRegister *reg, Split *split) { - xaccSRLoadTransEntry (reg, split, 0); - - /* copy cursor contents into the table */ - xaccCommitCursor (reg->table); + xaccSRLoadTransEntry (reg, split, GNC_T); } /* ======================================================== */ -void -xaccSRCountRows (SplitRegister *reg, Split **slist, - Account *default_source_acc) +static void +xaccSRCountRows (SplitRegister *reg, Split **slist) { SRInfo *info = xaccSRGetInfo(reg); int i; Split *split = NULL; Split *save_current_split = NULL; Transaction *save_current_trans = NULL; - int save_cursor_phys_row = -1; - int save_cursor_virt_row = -1; + int save_cursor_phys_row; + int save_cursor_virt_row; Table *table; int num_phys_rows; int num_virt_rows; @@ -1281,7 +1327,7 @@ xaccSRCountRows (SplitRegister *reg, Split **slist, do_expand = multi_line; do_expand = do_expand || (dynamic && xaccIsPeerSplit(split,save_current_split)); - if (NULL == save_current_split) { + if (dynamic && (NULL == save_current_split)) { trans = xaccSplitGetParent (split); 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 */ if ((num_phys_rows <= save_cursor_phys_row) || - (num_virt_rows <= save_cursor_virt_row)) - { - save_cursor_phys_row = num_phys_rows - reg->split_cursor->numRows; - save_cursor_virt_row = num_virt_rows - 1; + (num_virt_rows <= save_cursor_virt_row)) { + save_cursor_phys_row = num_phys_rows - reg->split_cursor->numRows; + save_cursor_virt_row = num_virt_rows; } + if ((save_cursor_phys_row < (reg->header->numRows)) || - (save_cursor_virt_row < 1)) - { - 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_virt_row = 1; } /* finally, record the values */ @@ -1389,11 +1434,11 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, { SRInfo *info = xaccSRGetInfo(reg); int i = 0; - Split *split=NULL, *last_split=NULL; - Split *save_current_split=NULL; + Split *split = NULL; + Split *last_split = NULL; + Split *save_current_split = NULL; Table *table; int phys_row; - int save_phys_col; int vrow; int type, style; int multi_line, dynamic; @@ -1414,14 +1459,18 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, 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 * to the currently edited split and physical column; we restore * the cursor to this location when we are done. */ 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 * callbacks while we are fiddling with loading the register */ @@ -1467,7 +1516,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, do_expand = multi_line; do_expand = do_expand || (dynamic && xaccIsPeerSplit(split,save_current_split)); - if (NULL == save_current_split) { + if (dynamic && (NULL == save_current_split)) { trans = xaccSplitGetParent (split); 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); xaccMoveCursor (table, phys_row, 0); - xaccSRLoadTransEntry (reg, split, 1); + xaccSRLoadRegEntry (reg, split); vrow ++; phys_row += reg->trans_cursor->numRows; @@ -1493,7 +1542,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, if (secondary != split) { xaccSetCursor (table, reg->split_cursor, phys_row, 0, vrow, 0); xaccMoveCursor (table, phys_row, 0); - xaccSRLoadSplitEntry (reg, secondary, 1); + xaccSRLoadRegEntry (reg, secondary); PINFO ("xaccSRLoadRegister(): " "load split %d at phys row %d addr=%p \n", j, phys_row, secondary); @@ -1508,7 +1557,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, /* the simple case ... */ xaccSetCursor (table, lead_cursor, phys_row, 0, vrow, 0); xaccMoveCursor (table, phys_row, 0); - xaccSRLoadTransEntry (reg, split, 1); + xaccSRLoadRegEntry (reg, split); vrow ++; phys_row += lead_cursor->numRows; } @@ -1516,7 +1565,6 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, PINFO ("xaccSRLoadRegister(): " "skip trans %d (blank split) \n", i); } - last_split = split; i++; @@ -1560,7 +1608,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, /* do the transaction row of the blank split */ xaccSetCursor (table, reg->trans_cursor, phys_row, 0, vrow, 0); xaccMoveCursor (table, phys_row, 0); - xaccSRLoadTransEntry (reg, split, 1); + xaccSRLoadRegEntry (reg, split); vrow ++; phys_row += reg->trans_cursor->numRows; @@ -1568,31 +1616,28 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, split = xaccTransGetSplit (trans, 1); xaccSetCursor (table, reg->split_cursor, phys_row, 0, vrow, 0); xaccMoveCursor (table, phys_row, 0); - xaccSRLoadSplitEntry (reg, split, 1); + xaccSRLoadRegEntry (reg, split); vrow ++; phys_row += reg->split_cursor->numRows; } else { xaccSetCursor (table, lead_cursor, phys_row, 0, vrow, 0); xaccMoveCursor (table, phys_row, 0); - xaccSRLoadTransEntry (reg, split, 1); + xaccSRLoadRegEntry (reg, split); vrow ++; phys_row += lead_cursor->numRows; } /* restore the cursor to its rightful position */ - i = 0; - while ((save_phys_col + i < reg->num_cols) || (save_phys_col > 0)) { - 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; + { + int row = reg->cursor_phys_row; + int col = reg->cursor_phys_col; + + if (gnc_table_find_valid_cell_horiz(table, &row, &col, GNC_F)) + { + 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 diff --git a/src/gnome/account-tree.c b/src/gnome/account-tree.c index 9a42fbe07a..f4bb0472a4 100644 --- a/src/gnome/account-tree.c +++ b/src/gnome/account-tree.c @@ -20,11 +20,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ +#include "top-level.h" + #include -#include "config.h" - -#include "top-level.h" #include "gnucash.h" #include "messages.h" #include "AccWindow.h" @@ -103,9 +102,9 @@ gnc_account_tree_new_with_root(Account * root) static void gnc_account_tree_init(GNCAccountTree *tree) { - tree->root_account = NULL; - tree->current_account = NULL; - tree->ignore_unselect = GNC_F; + tree->root_account = NULL; + tree->current_accounts = NULL; + tree->ignore_unselect = GNC_F; gnc_init_account_view_info(&tree->avi); @@ -269,14 +268,17 @@ gnc_account_tree_refresh(GNCAccountTree * tree) { GtkCList *clist = GTK_CLIST(tree); GHashTable *expanded_accounts; + GList *current_accounts; GtkAdjustment *adjustment; - gfloat save_value = 0.0; + gfloat save_value = 0.0; adjustment = gtk_clist_get_vadjustment(GTK_CLIST(tree)); if (adjustment != NULL) save_value = adjustment->value; expanded_accounts = gnc_account_tree_save_expanded(tree); + current_accounts = tree->current_accounts; + tree->current_accounts = NULL; gtk_clist_freeze(clist); @@ -291,8 +293,7 @@ gnc_account_tree_refresh(GNCAccountTree * tree) gnc_account_tree_update_column_visibility(tree); - if (!gnc_account_tree_select_account(tree, tree->current_account, FALSE)) - tree->current_account = NULL; + gnc_account_tree_select_accounts(tree, current_accounts, FALSE); if (adjustment != NULL) { @@ -304,6 +305,7 @@ gnc_account_tree_refresh(GNCAccountTree * tree) gtk_clist_thaw(clist); 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 * - * select an account in the tree and possibly expands and scrolls * - * the tree to ensure it is visible * + * select an account in the tree and expands the tree to make * + * sure it could be visible. It may also scroll the tree to * + * ensure it is visible * * * * Args: tree - tree to be modified * * 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 * \********************************************************************/ gboolean @@ -373,9 +376,6 @@ gnc_account_tree_select_account(GNCAccountTree *tree, /* Select it */ gtk_ctree_select(ctree, node); - if (!show) - return TRUE; - /* Expand all the parents */ row = GTK_CTREE_ROW(node); while ((n = row->parent) != NULL) @@ -384,6 +384,9 @@ gnc_account_tree_select_account(GNCAccountTree *tree, row = GTK_CTREE_ROW(n); } + if (!show) + return TRUE; + /* Make sure it's visible */ if (gtk_ctree_node_is_visible(ctree, node) != GTK_VISIBILITY_FULL) 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 * * removes an account from the tree * @@ -495,7 +536,7 @@ gnc_account_tree_update_column_visibility(GNCAccountTree *tree) /********************************************************************\ * 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 * * Returns: current account * @@ -503,7 +544,30 @@ gnc_account_tree_update_column_visibility(GNCAccountTree *tree) Account * 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 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->current_account); + account); return TRUE; } @@ -601,7 +666,7 @@ gnc_account_tree_button_press(GtkWidget *widget, gtk_signal_emit(GTK_OBJECT(widget), account_tree_signals[ACTIVATE_ACCOUNT], - account); + account); return TRUE; } @@ -619,15 +684,19 @@ gnc_account_tree_select_row(GtkCTree *ctree, gint column) { GNCAccountTree *tree = GNC_ACCOUNT_TREE(ctree); + Account *account; + GList *node; tree->ignore_unselect = GNC_F; - tree->current_account = gtk_ctree_node_get_row_data(ctree, - GTK_CTREE_NODE(row)); + account = gtk_ctree_node_get_row_data(ctree, 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), account_tree_signals[SELECT_ACCOUNT], - tree->current_account); + account); 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); Account *account; + GList *node; 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)); - if (account == tree->current_account) - tree->current_account = NULL; + node = g_list_find(tree->current_accounts, account); + 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), account_tree_signals[UNSELECT_ACCOUNT], @@ -752,6 +828,9 @@ gnc_account_tree_destroy(GtkObject *object) tree->deficit_style = NULL; } + g_list_free(tree->current_accounts); + tree->current_accounts = NULL; + if (GTK_OBJECT_CLASS(parent_class)->destroy) (* GTK_OBJECT_CLASS(parent_class)->destroy) (object); } diff --git a/src/gnome/account-tree.h b/src/gnome/account-tree.h index 4cc772d1e4..3f1e3f8837 100644 --- a/src/gnome/account-tree.h +++ b/src/gnome/account-tree.h @@ -59,7 +59,8 @@ struct _GNCAccountTree GtkStyle *deficit_style; Account *root_account; - Account *current_account; + + GList *current_accounts; gboolean ignore_unselect; }; @@ -97,6 +98,10 @@ gboolean gnc_account_tree_select_account (GNCAccountTree *tree, Account *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, Account *account); @@ -108,6 +113,7 @@ void gnc_account_tree_show_categories (GNCAccountTree *tree); void gnc_account_tree_hide_categories (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); diff --git a/src/gnome/cursors.c b/src/gnome/cursors.c index 256260eb2e..e5fd357df3 100644 --- a/src/gnome/cursors.c +++ b/src/gnome/cursors.c @@ -23,10 +23,11 @@ * Huntington Beach, CA 92648-4632 * \********************************************************************/ +#include "config.h" + #include #include "ui-callbacks.h" - #include "cursors.h" diff --git a/src/gnome/dialog-add.c b/src/gnome/dialog-add.c index c32ecd4feb..8793d8bc31 100644 --- a/src/gnome/dialog-add.c +++ b/src/gnome/dialog-add.c @@ -28,10 +28,10 @@ * -- tooltips for the widgets in the window */ -#include - #include "top-level.h" +#include + #include "AccWindow.h" #include "MainWindow.h" #include "FileDialog.h" @@ -88,6 +88,12 @@ gnc_ui_accWindow_list_select_cb(GtkCList * type_list, gint row, gint column, if(accData == NULL) return; + if (!gtk_clist_get_selectable(type_list, row)) + { + gtk_clist_unselect_row(type_list, row, 0); + return; + } + accData->type = row; _accWindow_last_used_account_type = row; @@ -164,7 +170,7 @@ gnc_ui_accWindow_list_box_create(AccWindow * accData) { GtkWidget *frame, *hbox; - frame = gtk_frame_new("Type of Account"); + frame = gtk_frame_new(ACC_TYPE_STR); gtk_widget_show(frame); 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_widget_show(GTK_WIDGET(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_FUNC(gnc_ui_accWindow_list_select_cb), accData); @@ -263,7 +270,7 @@ gnc_ui_accWindow_tree_select(GNCAccountTree *tree, 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++) { 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)); gnc_account_tree_hide_all_but_name(GNC_ACCOUNT_TREE(accountTree)); gnc_account_tree_refresh(GNC_ACCOUNT_TREE(accountTree)); - gtk_widget_show(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_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - + gtk_container_add(GTK_CONTAINER(frame), scrollWin); gtk_container_border_width (GTK_CONTAINER (scrollWin), 5); gtk_container_add(GTK_CONTAINER(scrollWin), accountTree); @@ -403,6 +409,9 @@ gnc_accWindow_create(AccWindow *accData) /* don't close on buttons */ 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 */ widget = gnc_ui_account_field_box_create(&accData->edit_info, FALSE); 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); 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); return dialog; @@ -462,18 +469,19 @@ gnc_accWindow_create(AccWindow *accData) AccWindow * accWindow (AccountGroup *this_is_not_used) { - gint result; AccWindow *accData = g_new0(AccWindow, 1); - GtkWidget *dialog; AccountFieldStrings strings; + GtkWidget *dialog; + gint result; accData->parentAccount = gnc_get_current_account(); accData->newAccount = xaccMallocAccount(); 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); + gtk_widget_show_all(dialog); while (1) { @@ -490,8 +498,7 @@ accWindow (AccountGroup *this_is_not_used) /* check for valid name */ if (safe_strcmp(strings.name, "") == 0) { - gnc_error_dialog_parented(GTK_WINDOW(dialog), - "You must enter a valid account name."); + gnc_error_dialog_parented(GTK_WINDOW(dialog), ACC_NO_NAME_MSG); gnc_ui_free_field_strings(&strings); continue; } @@ -499,8 +506,7 @@ accWindow (AccountGroup *this_is_not_used) /* check for valid type */ if (accData->type == BAD_TYPE) { - gnc_error_dialog_parented(GTK_WINDOW(dialog), - "You must select an account type."); + gnc_error_dialog_parented(GTK_WINDOW(dialog), ACC_TYPE_MSG); gnc_ui_free_field_strings(&strings); continue; } diff --git a/src/gnome/dialog-edit.c b/src/gnome/dialog-edit.c index 0511b02180..1260fff8e3 100644 --- a/src/gnome/dialog-edit.c +++ b/src/gnome/dialog-edit.c @@ -24,12 +24,11 @@ * Huntington Beach, CA 92648-4632 * \********************************************************************/ +#include "top-level.h" #include #include -#include "top-level.h" - #include "AccWindow.h" #include "MainWindow.h" #include "Refresh.h" @@ -93,7 +92,7 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget, /* check for valid name */ 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); return; } diff --git a/src/gnome/dialog-filebox.c b/src/gnome/dialog-filebox.c index d0db4f98d1..fffc6a0cc1 100644 --- a/src/gnome/dialog-filebox.c +++ b/src/gnome/dialog-filebox.c @@ -23,11 +23,10 @@ * Huntington Beach, CA 92648-4632 * \********************************************************************/ -#include - #include "top-level.h" -#include "config.h" +#include + #include "FileBox.h" #include "messages.h" #include "util.h" diff --git a/src/gnome/dialog-options.c b/src/gnome/dialog-options.c index 0541f60072..d1cbbbc654 100644 --- a/src/gnome/dialog-options.c +++ b/src/gnome/dialog-options.c @@ -17,12 +17,18 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ +#include + #include #include "dialog-options.h" #include "dialog-utils.h" #include "option-util.h" #include "query-user.h" +#include "gnc-helpers.h" +#include "account-tree.h" +#include "global-options.h" +#include "messages.h" #include "util.h" /* 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; - index = gnc_option_value_permissible_value_index(option, value); + index = gnc_option_permissible_value_index(option, value); if (index < 0) bad_value = TRUE; else @@ -92,6 +98,30 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default) 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 { PERR("gnc_option_set_ui_value: Unknown type. Ignoring.\n"); @@ -148,7 +178,28 @@ gnc_option_get_ui_value(GNCOption *option) "gnc_multichoice_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 { @@ -178,9 +229,8 @@ default_button_cb(GtkButton *button, gpointer data) static GtkWidget * 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_signal_connect(GTK_OBJECT(default_button), "clicked", @@ -247,7 +297,7 @@ gnc_option_create_multichoice_widget(GNCOption *option) int num_values; 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); @@ -255,8 +305,8 @@ gnc_option_create_multichoice_widget(GNCOption *option) for (i = 0; i < num_values; i++) { - info[i].name = gnc_option_value_permissible_value_name(option, i); - info[i].tip = gnc_option_value_permissible_value_description(option, i); + info[i].name = gnc_option_permissible_value_name(option, i); + info[i].tip = gnc_option_permissible_value_description(option, i); info[i].callback = gnc_option_multichoice_cb; info[i].user_data = option; } @@ -273,15 +323,131 @@ gnc_option_create_multichoice_widget(GNCOption *option) 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 * -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 *value = NULL; + gboolean packed = FALSE; char *name, *documentation; char *type; type = gnc_option_type(option); + if (type == NULL) + return; + name = gnc_option_name(option); documentation = gnc_option_documentation(option); @@ -347,29 +513,91 @@ gnc_option_set_ui_widget(GNCOption *option) gnc_option_create_default_button(option), 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 { 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) gnc_set_tooltip(value, documentation); if (enclosing != NULL) gtk_widget_show_all(enclosing); - free(documentation); - free(name); + if (documentation != NULL) + free(documentation); + if (name != NULL) + free(name); free(type); - - return enclosing; } static void gnc_options_dialog_add_option(GtkWidget *page, GNCOption *option) { - gtk_box_pack_start(GTK_BOX(page), gnc_option_set_ui_widget(option), - FALSE, FALSE, 0); + gnc_option_set_ui_widget(option, GTK_BOX(page)); } static void diff --git a/src/gnome/dialog-transfer.c b/src/gnome/dialog-transfer.c index 1ddb65b966..7b14468890 100644 --- a/src/gnome/dialog-transfer.c +++ b/src/gnome/dialog-transfer.c @@ -17,11 +17,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ -#include - #include "top-level.h" +#include + #include "dialog-transfer.h" +#include "dialog-utils.h" #include "MultiLedger.h" #include "FileDialog.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_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_FUNC(gnc_xfer_dialog_toggle_cb), @@ -151,7 +153,7 @@ gnc_xfer_dialog_create(GtkWidget * parent, Account * initial, { 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_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), @@ -316,17 +318,14 @@ gnc_xfer_dialog(GtkWidget * parent, Account * initial) if (!xaccAccountsHaveCommonCurrency(from, to)) { - gnc_error_dialog_parented(GTK_WINDOW(dialog), - "You cannot transfer between those accounts." \ - "\nThey do not have a common currency."); + gnc_error_dialog_parented(GTK_WINDOW(dialog), XFER_CURR_MSG); continue; } string = gtk_entry_get_text(GTK_ENTRY(xferData.amount_entry)); if (sscanf(string, "%lf", &amount) != 1) { - gnc_error_dialog_parented(GTK_WINDOW(dialog), - "The amount must be a number."); + gnc_error_dialog_parented(GTK_WINDOW(dialog), AMOUNT_NUM_MSG); continue; } diff --git a/src/gnome/dialog-utils.c b/src/gnome/dialog-utils.c index 312402b26a..3355ecf983 100644 --- a/src/gnome/dialog-utils.c +++ b/src/gnome/dialog-utils.c @@ -42,7 +42,7 @@ gnc_ui_notes_frame_create(GtkEditable **notes_entry) { 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_widget_show(frame); @@ -109,7 +109,7 @@ gnc_ui_account_field_box_create(AccountEditInfo * info, { 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_widget_show(frame); @@ -188,7 +188,7 @@ gnc_get_source_name(gint source) switch (source) { case SOURCE_NONE : - return "None"; + return NONE_STR; case SOURCE_YAHOO : return "Yahoo"; case SOURCE_FIDELITY : @@ -296,7 +296,7 @@ gnc_ui_account_source_box_create(AccountEditInfo * info) { 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_widget_show(frame); @@ -304,7 +304,7 @@ gnc_ui_account_source_box_create(AccountEditInfo * info) gtk_container_border_width(GTK_CONTAINER(hbox), 5); 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_widget_show(widget); diff --git a/src/gnome/global-options.c b/src/gnome/global-options.c index ac5fe9050c..eb400564eb 100644 --- a/src/gnome/global-options.c +++ b/src/gnome/global-options.c @@ -17,6 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ +#include "top-level.h" + #include #include "global-options.h" @@ -25,13 +27,15 @@ #include "option-util.h" #include "query-user.h" #include "guile-util.h" +#include "messages.h" #include "util.h" /* This static indicates the debugging module that this .o belongs to. */ static short module = MOD_GUI; 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); 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_id = SCM_UNDEFINED; } @@ -209,7 +215,7 @@ void _gnc_register_global_options(SCM 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_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_FUNC(gnc_options_dialog_apply_cb), diff --git a/src/gnome/option-util.c b/src/gnome/option-util.c index 0711f23d4e..86ac173935 100644 --- a/src/gnome/option-util.c +++ b/src/gnome/option-util.c @@ -17,11 +17,17 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ +#include +#include + #include "top-level.h" #include "guile-util.h" #include "option-util.h" #include "dialog-options.h" +#include "gnc-helpers.h" +#include "gnc.h" +#include "window-main.h" #include "ui-callbacks.h" #include "util.h" @@ -63,7 +69,7 @@ struct _Getters SCM setter; SCM default_getter; SCM value_validator; - SCM permissible_values; + SCM option_data; }; @@ -181,7 +187,7 @@ gnc_option_db_destroy(GNCOptionDB *odb) option = option_node->data; /* 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; } @@ -280,8 +286,7 @@ initialize_getters() gh_eval_str("gnc:option-default-getter"); getters.value_validator = gh_eval_str("gnc:option-value-validator"); - getters.permissible_values = - gh_eval_str("gnc:option-permissible-values"); + getters.option_data = gh_eval_str("gnc:option-data"); 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 * * -1 if there are no values available. * * * @@ -455,15 +460,13 @@ gnc_option_value_validator(GNCOption *option) * Returns: number of permissible options or -1 * \********************************************************************/ int -gnc_option_value_num_permissible_values(GNCOption *option) +gnc_option_num_permissible_values(GNCOption *option) { SCM values; initialize_getters(); - values = gnc_guile_call1_to_list(getters.permissible_values, - option->guile_option); - + values = gnc_guile_call1_to_list(getters.option_data, option->guile_option); if (values == SCM_UNDEFINED) 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 * * 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 * \********************************************************************/ 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; int num_values, i; @@ -491,9 +494,7 @@ gnc_option_value_permissible_value_index(GNCOption *option, SCM search_value) initialize_getters(); - values = gnc_guile_call1_to_list(getters.permissible_values, - option->guile_option); - + values = gnc_guile_call1_to_list(getters.option_data, option->guile_option); if (values == SCM_UNDEFINED) 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 * * option, or SCM_UNDEFINED if the index was out of range or * * 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 * \********************************************************************/ SCM -gnc_option_value_permissible_value(GNCOption *option, int index) +gnc_option_permissible_value(GNCOption *option, int index) { SCM values, vector, value; @@ -535,9 +536,7 @@ gnc_option_value_permissible_value(GNCOption *option, int index) initialize_getters(); - values = gnc_guile_call1_to_list(getters.permissible_values, - option->guile_option); - + values = gnc_guile_call1_to_list(getters.option_data, option->guile_option); if (values == 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 * * the option, or NULL if the index was out of range or there are * * 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 * \********************************************************************/ char * -gnc_option_value_permissible_value_name(GNCOption *option, int index) +gnc_option_permissible_value_name(GNCOption *option, int index) { SCM values, vector, name; @@ -576,9 +575,7 @@ gnc_option_value_permissible_value_name(GNCOption *option, int index) initialize_getters(); - values = gnc_guile_call1_to_list(getters.permissible_values, - option->guile_option); - + values = gnc_guile_call1_to_list(getters.option_data, option->guile_option); if (values == SCM_UNDEFINED) 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 * * value in the option, or NULL if the index was out of range or * * 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 * \********************************************************************/ char * -gnc_option_value_permissible_value_description(GNCOption *option, int index) +gnc_option_permissible_value_description(GNCOption *option, int index) { SCM values, vector, help; @@ -617,9 +614,7 @@ gnc_option_value_permissible_value_description(GNCOption *option, int index) initialize_getters(); - values = gnc_guile_call1_to_list(getters.permissible_values, - option->guile_option); - + values = gnc_guile_call1_to_list(getters.option_data, option->guile_option); if (values == SCM_UNDEFINED) 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 compare_sections(gconstpointer a, gconstpointer b) { @@ -950,6 +987,9 @@ gnc_commit_option(GNCOption *option) /* Validate the ui's value */ value = gnc_option_get_ui_value(option); + if (value == SCM_UNDEFINED) + return; + validator = gnc_option_value_validator(option); result = gh_call1(validator, value); @@ -1172,3 +1212,149 @@ gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb, char *section, 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; +} diff --git a/src/gnome/option-util.h b/src/gnome/option-util.h index 2be0eb0b19..f2093f4a97 100644 --- a/src/gnome/option-util.h +++ b/src/gnome/option-util.h @@ -65,12 +65,13 @@ SCM gnc_option_getter(GNCOption *option); SCM gnc_option_setter(GNCOption *option); SCM gnc_option_default_getter(GNCOption *option); SCM gnc_option_value_validator(GNCOption *option); -int gnc_option_value_num_permissible_values(GNCOption *option); -int gnc_option_value_permissible_value_index(GNCOption *option, SCM value); -SCM gnc_option_value_permissible_value(GNCOption *option, int index); -char * gnc_option_value_permissible_value_name(GNCOption *option, int index); -char * gnc_option_value_permissible_value_description(GNCOption *option, - int index); +int gnc_option_num_permissible_values(GNCOption *option); +int gnc_option_permissible_value_index(GNCOption *option, SCM value); +SCM gnc_option_permissible_value(GNCOption *option, int index); +char * gnc_option_permissible_value_name(GNCOption *option, int index); +char * gnc_option_permissible_value_description(GNCOption *option, int index); +gboolean gnc_option_show_time(GNCOption *option); +gboolean gnc_option_multiple_selection(GNCOption *option); 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, 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__ */ diff --git a/src/gnome/query-user.c b/src/gnome/query-user.c index e28405c920..4c832c62f0 100644 --- a/src/gnome/query-user.c +++ b/src/gnome/query-user.c @@ -17,15 +17,20 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ -#include - #include "top-level.h" +#include + +#include "ui-callbacks.h" #include "messages.h" #include "query-user.h" #include "util.h" +/* This static indicates the debugging module that this .o belongs to. */ +static short module = MOD_GUI; + + /******************************************************************** gnc_foundation_query_dialog @@ -199,6 +204,66 @@ gnc_foundation_query_dialog(const gchar *title, 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 * @@ -209,7 +274,7 @@ gnc_foundation_query_dialog(const gchar *title, * Args: message - the message to display * * yes_is_default - If true, "Yes" is default, * * "No" is the default button. * - * Return: none * + * Return: true for "Yes", false for "No" * \********************************************************************/ gncBoolean 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 * * yes_is_default - If true, "Yes" is default, * * "No" is the default button. * - * Return: none * + * Return: true for "Yes", false for "No" * \********************************************************************/ gncBoolean gnc_verify_dialog_parented(GtkWindow *parent, const char *message, diff --git a/src/gnome/query-user.h b/src/gnome/query-user.h index c75337ae55..bce52c9a8e 100644 --- a/src/gnome/query-user.h +++ b/src/gnome/query-user.h @@ -1,7 +1,6 @@ #ifndef __QUERY_USER_H__ #define __QUERY_USER_H__ -#include "gnc-common.h" #include enum diff --git a/src/gnome/reconcile-list.c b/src/gnome/reconcile-list.c index d671d24171..13e0bf4245 100644 --- a/src/gnome/reconcile-list.c +++ b/src/gnome/reconcile-list.c @@ -19,11 +19,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ +#include "top-level.h" + #include -#include "config.h" - -#include "top-level.h" #include "gnucash.h" #include "messages.h" #include "reconcile-listP.h" @@ -90,7 +89,7 @@ static void gnc_reconcile_list_init(GNCReconcileList *list) { GtkCList *clist = GTK_CLIST(list); - static gchar * titles[] = + gchar * titles[] = { DATE_STR, NUM_STR, diff --git a/src/gnome/scripts_menu.c b/src/gnome/scripts_menu.c index e5f6e1dbbe..6ab90f9fcf 100644 --- a/src/gnome/scripts_menu.c +++ b/src/gnome/scripts_menu.c @@ -17,6 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ +#include + #include "scripts_menu.h" #include "top-level.h" diff --git a/src/gnome/scripts_menu.h b/src/gnome/scripts_menu.h index 59aba8443c..5a87aba706 100644 --- a/src/gnome/scripts_menu.h +++ b/src/gnome/scripts_menu.h @@ -20,7 +20,6 @@ #ifndef __SCRIPTS_MENU_H__ #define __SCRIPTS_MENU_H__ -#include #include void gnc_extensions_menu_add_item(char *name, char *hint, SCM script); diff --git a/src/gnome/top-level.c b/src/gnome/top-level.c index f652558736..fd798fb634 100644 --- a/src/gnome/top-level.c +++ b/src/gnome/top-level.c @@ -19,12 +19,12 @@ * * \********************************************************************/ +#include "top-level.h" + #include #include #include -#include "top-level.h" - #include "window-main.h" #include "global-options.h" #include "gnucash-sheet.h" diff --git a/src/gnome/version.h b/src/gnome/version.h deleted file mode 100644 index e64ae8e447..0000000000 --- a/src/gnome/version.h +++ /dev/null @@ -1,5 +0,0 @@ -// Contains the version of GnuCash - -#include - -gchar *VERSION = "1.1.26"; diff --git a/src/gnome/window-adjust.c b/src/gnome/window-adjust.c index 46bc9d488e..6f11ad1046 100644 --- a/src/gnome/window-adjust.c +++ b/src/gnome/window-adjust.c @@ -23,11 +23,11 @@ * Huntington Beach, CA 92648-4632 * \********************************************************************/ +#include "top-level.h" + #include #include -#include "top-level.h" - #include "ui-callbacks.h" #include "MultiLedger.h" #include "AdjBWindow.h" @@ -95,8 +95,7 @@ gnc_ui_AdjBWindow_ok_cb(GtkWidget * widget, gpointer data) if(sscanf(string, "%lf", &new_balance) != 1) { - gnc_error_dialog_parented(GTK_WINDOW(adjBData->dialog), - "Balance must be a number."); + gnc_error_dialog_parented(GTK_WINDOW(adjBData->dialog), BALANCE_NUM_MSG); return; } diff --git a/src/gnome/window-help.c b/src/gnome/window-help.c index 4a71161c3b..ed8a21be19 100644 --- a/src/gnome/window-help.c +++ b/src/gnome/window-help.c @@ -24,9 +24,9 @@ * Huntington Beach, CA 92648-4632 * \********************************************************************/ -#include +#include -#include "config.h" +#include #include "window-help.h" #include "window-html.h" @@ -44,6 +44,7 @@ typedef struct _HelpData HelpData; struct _HelpData { gchar *htmlfile; + gchar *title; gchar *label; gchar *text; }; @@ -52,64 +53,82 @@ struct _HelpData static HelpData * 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 -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); - hd->htmlfile = NULL; + g_free(help_data->htmlfile); + help_data->htmlfile = NULL; - g_free(hd->label); - hd->label = NULL; + g_free(help_data->title); + help_data->title = NULL; - g_free(hd->text); - hd->text = NULL; + g_free(help_data->label); + help_data->label = NULL; - g_free(hd); + g_free(help_data->text); + help_data->text = NULL; + + g_free(help_data); } 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); - hd->htmlfile = g_strdup(htmlfile); + g_free(help_data->htmlfile); + help_data->htmlfile = g_strdup(htmlfile); } 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); - hd->label = g_strdup(label); + g_free(help_data->title); + help_data->title = g_strdup(title); } 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); - hd->text = g_strdup(text); + g_free(help_data->label); + 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 -helpAnchorCB(XmHTMLAnchorCallbackStruct *acbs, HTMLHistoryData history_data) +static HTMLData * +helpAnchorCB(XmHTMLAnchorCallbackStruct *acbs, HTMLUserData user_data) { - HelpData *hd; + HelpData *user = user_data; + HTMLData *html_data; + HelpData *help_data; switch(acbs->url_type) { /* a local file with a possible jump to label */ case ANCHOR_FILE_LOCAL: - hd = help_data_new(); - help_data_set_file(hd, acbs->href); - return hd; + help_data = help_data_new(); + help_data_set_file(help_data, acbs->href); + 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 ... */ case ANCHOR_FTP: @@ -131,51 +150,51 @@ helpAnchorCB(XmHTMLAnchorCallbackStruct *acbs, HTMLHistoryData history_data) } 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 *label = NULL; *set_text = NULL; *set_label = NULL; - if (hd->text != NULL) + if (help_data->text != NULL) { - *set_text = hd->text; - *set_label = hd->label; + *set_text = help_data->text; + *set_label = help_data->label; return; } - if (hd->htmlfile == NULL) + if (help_data->htmlfile == NULL) return; /* see if this anchor contains a jump */ - label = strpbrk(hd->htmlfile, "#?"); + label = strpbrk(help_data->htmlfile, "#?"); if (label != NULL) { - help_data_set_label(hd, label); + help_data_set_label(help_data, label); /* 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" */ - if (strstr(hd->htmlfile, ".phtml")) - text = gncReport(hd->htmlfile); + if (strstr(help_data->htmlfile, ".phtml")) + text = gncReport(help_data->htmlfile); /* if text to display wasn't specified, use the truncated name to read */ if (text == NULL) - text = gncReadFile(hd->htmlfile); + text = gncReadFile(help_data->htmlfile); if (text != NULL) { - help_data_set_text(hd, text); + help_data_set_text(help_data, text); free(text); } - *set_text = hd->text; - *set_label = hd->label; + *set_text = help_data->text; + *set_label = help_data->label; } @@ -191,16 +210,19 @@ helpJumpCB(HTMLHistoryData history_data, char **set_text, char **set_label) void helpWindow(GtkWidget *parent, const char *title, const char *htmlfile) { - HelpData *hd; + HTMLData *html_data; + HelpData *help_data; if (helpwindow == NULL) - helpwindow = gnc_html_window_new(help_data_destroy, helpAnchorCB, - helpJumpCB); - - hd = help_data_new(); - help_data_set_file(hd, htmlfile); + helpwindow = gnc_html_window_new(helpAnchorCB, helpJumpCB); - 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); } diff --git a/src/gnome/window-help.h b/src/gnome/window-help.h index 8fc7dde4c8..cfe8e58986 100644 --- a/src/gnome/window-help.h +++ b/src/gnome/window-help.h @@ -25,10 +25,6 @@ #ifndef __WINDOW_HELP_H__ #define __WINDOW_HELP_H__ -#include - -#include "config.h" - /** PROTOTYPES ******************************************************/ diff --git a/src/gnome/window-html.c b/src/gnome/window-html.c index c00e1e4476..13a002c98f 100644 --- a/src/gnome/window-html.c +++ b/src/gnome/window-html.c @@ -29,6 +29,7 @@ #include "top-level.h" #include "window-html.h" +#include "messages.h" #include "File.h" #include "util.h" @@ -40,33 +41,118 @@ static short module = MOD_HTML; * hack alert -- these are gui-independent, and should be moved * * to a central location * \********************************************************************/ + +struct _HTMLData +{ + char *title; + + GnomeUIInfo *user_buttons; + int num_user_buttons; + + HTMLUserData user_data; + HTMLDestroyUserDataFunc destroy; +}; + typedef struct _HTMLHistoryNode HTMLHistoryNode; struct _HTMLHistoryNode { HTMLHistoryNode *next; HTMLHistoryNode *last; - HTMLHistoryData history_data; + HTMLData *data; }; typedef struct _HTMLHistory HTMLHistory; struct _HTMLHistory { 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 * -history_node_new(const HTMLHistoryData history_data) +history_node_new(HTMLData *data) { HTMLHistoryNode *new; new = malloc(sizeof(HTMLHistoryNode)); assert(new != NULL); - new->history_data = history_data; + new->data = data; new->last = 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 * in history, all next pages are deleted */ static gncBoolean -historyInsert(HTMLHistory *history, const HTMLHistoryData history_data) +historyInsert(HTMLHistory *history, HTMLData *data) { HTMLHistoryNode *new; HTMLHistoryNode *temp; assert(history != NULL); - new = history_node_new(history_data); + new = history_node_new(data); if (history->current_node == NULL) { @@ -97,8 +183,8 @@ historyInsert(HTMLHistory *history, const HTMLHistoryData history_data) while(temp != NULL) { history->current_node->next = temp->next; - if (temp->history_data != NULL) - (history->destroy)(temp->history_data); + html_data_destroy(temp->data); + temp->data = NULL; free(temp); 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 */ -static HTMLHistoryData +static HTMLData * historyFwd(HTMLHistory *history) { if (history == NULL) @@ -123,11 +209,11 @@ historyFwd(HTMLHistory *history) if (history->current_node->next != NULL) 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 */ -static HTMLHistoryData +static HTMLData * historyBack(HTMLHistory *history) { if (history == NULL) @@ -138,10 +224,10 @@ historyBack(HTMLHistory *history) if (history->current_node->last != NULL) 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 historyClear(HTMLHistory *history) { @@ -160,19 +246,19 @@ historyClear(HTMLHistory *history) HTMLHistoryNode *temp = history->current_node->next; history->current_node->next = temp->next; - if (temp->history_data != NULL) - (history->destroy)(temp->history_data); + html_data_destroy(temp->data); + temp->data = NULL; free(temp); } - + /* delete current page: */ - if (history->current_node->history_data != NULL) - (history->destroy)(history->current_node->history_data); + html_data_destroy(history->current_node->data); + history->current_node->data = NULL; free(history->current_node); history->current_node = NULL; } -static HTMLHistoryData +static HTMLData * historyData(HTMLHistory *history) { if (history == NULL) @@ -180,11 +266,23 @@ historyData(HTMLHistory *history) if (history->current_node == 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 * -historyNew(HTMLHistoryDestroyDataFunc destroy) +historyNew() { HTMLHistory *history; @@ -192,7 +290,6 @@ historyNew(HTMLHistoryDestroyDataFunc destroy) assert(history != NULL); history->current_node = NULL; - history->destroy = destroy; return history; } @@ -220,6 +317,8 @@ struct _HTMLWindow GtkWidget *forward; GtkWidget *back; + GtkWidget *toolbar; + HTMLHistory *history; HTMLAnchorCB anchor_cb; @@ -246,19 +345,19 @@ static void htmlSetButtonStates(HTMLWindow *hw); /********************************************************************\ - * gnc_html_window_history_data * - * return the current history data for the window * + * gnc_html_window_user_data * + * return the current user data for the window * * * * Args: none * - * Return: history data for the window * + * Return: user data for the window * \********************************************************************/ -HTMLHistoryData -gnc_html_window_history_data(HTMLWindow *hw) +HTMLUserData +gnc_html_window_user_data(HTMLWindow *hw) { if (hw == 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 * * 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 * \********************************************************************/ HTMLWindow * -gnc_html_window_new(HTMLHistoryDestroyDataFunc destroy, - HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb) +gnc_html_window_new(HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb) { HTMLWindow *hw; hw = g_new0(HTMLWindow, 1); - hw->history = historyNew(destroy); + hw->history = historyNew(); hw->anchor_cb = anchor_cb; hw->jump_cb = jump_cb; @@ -309,20 +408,20 @@ gnc_html_window_destroy(HTMLWindow *hw) } -static GtkWidget * -create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons, - gint num_buttons) +static void +gnc_html_window_fill_toolbar(HTMLWindow *hw) { GnomeUIInfo *toolbar_info; - GtkWidget *toolbar; gint num_start, num_end; + GList *children, *node; + HTMLData *data; gint i; GnomeUIInfo toolbar_start[] = { { GNOME_APP_UI_ITEM, - "Back", - "Move back one step in the history.", + BACK_STR, + TOOLTIP_HTML_BACK, htmlBackCB, hw, NULL, GNOME_APP_PIXMAP_STOCK, @@ -330,8 +429,8 @@ create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "Forward", - "Move forward one step in the history.", + FORWARD_STR, + TOOLTIP_HTML_FORW, htmlFwdCB, hw, NULL, GNOME_APP_PIXMAP_STOCK, @@ -343,8 +442,8 @@ create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons, GnomeUIInfo toolbar_end[] = { { GNOME_APP_UI_ITEM, - "Close", - "Close this HTML window.", + CLOSE_STR, + TOOLTIP_CLOSE_HTML, closeHtmlWinCB, hw, NULL, GNOME_APP_PIXMAP_STOCK, @@ -354,30 +453,42 @@ create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons, 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_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++) toolbar_info[i] = toolbar_start[i]; - for (i = 0; i < num_buttons; i++) - toolbar_info[i + num_start] = user_buttons[i]; + for (i = 0; i < data->num_user_buttons; i++) + toolbar_info[i + num_start] = data->user_buttons[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(toolbar), toolbar_info, NULL); + gnome_app_fill_toolbar(GTK_TOOLBAR(hw->toolbar), toolbar_info, NULL); hw->back = toolbar_info[0].widget; hw->forward = toolbar_info[1].widget; g_free(toolbar_info); - - return toolbar; } @@ -387,23 +498,19 @@ create_html_toolbar(HTMLWindow *hw, GnomeUIInfo *user_buttons, * * * Args: parent - the parent widget * * hwp - the htmlwindow structure pointer * - * title - the title of the window * - * history_data - the history data * - * new_buttons - array of buttons to add to icon bar * + * data - the data for the window * + * user_buttons - array of buttons to add to icon bar * * num_buttons - number of buttons in list * * Return: none * \********************************************************************/ void -htmlWindow(GtkWidget * parent, - HTMLWindow ** hwp, - const char * const title, - HTMLHistoryData history_data, - GnomeUIInfo *user_buttons, - gint num_buttons) +htmlWindow(GtkWidget *parent, + HTMLWindow **hwp, + HTMLData *data) { HTMLWindow *hw = *hwp; - historyInsert(hw->history, history_data); + historyInsert(hw->history, data); /* If the help window is already created, just load the new * page into the existing widget and raise the window. */ @@ -429,7 +536,6 @@ htmlWindow(GtkWidget * parent, window = gtk_window_new(GTK_WINDOW_TOPLEVEL); hw->window = window; - gtk_window_set_title(GTK_WINDOW (window), title); gtk_window_set_policy(GTK_WINDOW (window), TRUE, TRUE, FALSE); 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); - 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_add(GTK_CONTAINER(dock_item), toolbar); + hw->toolbar = toolbar; gnome_dock_add_item (GNOME_DOCK(dock), GNOME_DOCK_ITEM(dock_item), GNOME_DOCK_TOP, 0, 0, 0, TRUE); @@ -505,46 +612,56 @@ htmlSetButtonStates(HTMLWindow *hw) * Return: none * \********************************************************************/ static gboolean -htmlKeyCB( GtkWidget *widget, GdkEventKey *event, gpointer data ) +htmlKeyCB(GtkWidget *widget, GdkEventKey *event, gpointer data) { HTMLWindow *hw = (HTMLWindow *) data; GtkXmHTML *html = GTK_XMHTML(hw->htmlwidget); - GtkAdjustment *adj; - gfloat value; + GtkAdjustment *vadj, *hadj; + gfloat v_value, h_value; if (html->vsba == NULL) 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) { + 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_Up: - value -= adj->step_increment; + v_value -= vadj->step_increment; break; case GDK_KP_Down: case GDK_Down: - value += adj->step_increment; + v_value += vadj->step_increment; break; case GDK_KP_Page_Up: case GDK_Page_Up: - value -= adj->page_increment; + v_value -= vadj->page_increment; break; case GDK_KP_Page_Down: case GDK_Page_Down: case GDK_space: - value += adj->page_increment; + v_value += vadj->page_increment; break; case GDK_KP_Home: case GDK_Home: - value = adj->lower; + v_value = vadj->lower; break; case GDK_KP_End: case GDK_End: - value = adj->upper; + v_value = vadj->upper; break; case GDK_Escape: gtk_widget_destroy(hw->window); @@ -553,9 +670,11 @@ htmlKeyCB( GtkWidget *widget, GdkEventKey *event, gpointer data ) 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; } @@ -573,9 +692,8 @@ static void htmlBackCB(GtkWidget *widget, gpointer data) { HTMLWindow *hw = (HTMLWindow *) data; - HTMLHistoryData history_data; - history_data = historyBack(hw->history); + historyBack(hw->history); gnc_html_load(hw); @@ -595,9 +713,8 @@ static void htmlFwdCB(GtkWidget *widget, gpointer data) { HTMLWindow *hw = (HTMLWindow *) data; - HTMLHistoryData history_data; - history_data = historyFwd(hw->history); + historyFwd(hw->history); gnc_html_load(hw); @@ -660,7 +777,7 @@ htmlAnchorCB(GtkWidget *widget, XmHTMLAnchorCallbackStruct *acbs, gpointer data) { HTMLWindow *hw = (HTMLWindow *) data; - HTMLHistoryData history_data; + HTMLData *html_data; if (acbs->reason != XmCR_ACTIVATE) return; @@ -675,11 +792,11 @@ htmlAnchorCB(GtkWidget *widget, XmHTMLAnchorCallbackStruct *acbs, if (hw->anchor_cb == NULL) return; - history_data = (hw->anchor_cb)(acbs, historyData(hw->history)); - if (history_data == NULL) + html_data = (hw->anchor_cb)(acbs, historyUserData(hw->history)); + if (html_data == NULL) return; - historyInsert(hw->history, history_data); + historyInsert(hw->history, html_data); gnc_html_load(hw); break; } @@ -691,13 +808,13 @@ htmlAnchorCB(GtkWidget *widget, XmHTMLAnchorCallbackStruct *acbs, /********************************************************************\ * 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 * \********************************************************************/ void gnc_html_load(HTMLWindow *hw) { - HTMLHistoryData history_data; + HTMLData *data; char *label = NULL; char *text = NULL; @@ -706,9 +823,12 @@ gnc_html_load(HTMLWindow *hw) if (hw->jump_cb == NULL) 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) return; diff --git a/src/gnome/window-html.h b/src/gnome/window-html.h index c1e27a8dc2..bc9b91d841 100644 --- a/src/gnome/window-html.h +++ b/src/gnome/window-html.h @@ -30,31 +30,33 @@ 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, - HTMLHistoryData history_data); +typedef HTMLData* (*HTMLAnchorCB)(XmHTMLAnchorCallbackStruct *acbs, + HTMLUserData user_data); -typedef void (*HTMLJumpCB)(HTMLHistoryData history_data, +typedef void (*HTMLJumpCB)(HTMLUserData user_data, 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, - HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb); +HTMLWindow * gnc_html_window_new(HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb); void gnc_html_window_destroy(HTMLWindow *hw); -void htmlWindow(GtkWidget * parent, - HTMLWindow ** hwp, - const char * const title, - HTMLHistoryData history_data, - GnomeUIInfo *user_buttons, - gint num_buttons); +HTMLData * gnc_html_data_new(const char *title, HTMLUserData user_data, + HTMLDestroyUserDataFunc destroy, + GnomeUIInfo *user_buttons, + int num_user_buttons); + +void htmlWindow(GtkWidget *parent, + HTMLWindow **hwp, + HTMLData *data); void gnc_html_load(HTMLWindow *hw); diff --git a/src/gnome/window-main.c b/src/gnome/window-main.c index 3b764b7c02..28953d6c74 100644 --- a/src/gnome/window-main.c +++ b/src/gnome/window-main.c @@ -19,12 +19,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * \********************************************************************/ +#include "top-level.h" + #include #include #include -#include "top-level.h" - #include "AccWindow.h" #include "AdjBWindow.h" #include "global-options.h" @@ -33,10 +33,9 @@ #include "gnucash.h" #include "MainWindow.h" #include "Destroy.h" -#include "messages.h" +#include "enriched-messages.h" #include "RegWindow.h" #include "Refresh.h" -#include "version.h" #include "window-main.h" #include "window-mainP.h" #include "window-reconcile.h" @@ -53,7 +52,7 @@ /* This static indicates the debugging module that this .o belongs to. */ static short module = MOD_GUI; - +/* Codes for the file menu */ enum { FMB_NEW, FMB_OPEN, @@ -63,258 +62,6 @@ enum { 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 gnc_ui_refresh_statusbar() @@ -369,8 +116,9 @@ gnc_ui_refresh_statusbar() asset_string = g_strdup(xaccPrintAmount(assets, PRTSYM | PRTSEP)); profit_string = g_strdup(xaccPrintAmount(profits, PRTSYM | PRTSEP)); - label_string = g_strconcat("Assets: ", asset_string, - " Profits: ", profit_string, " ", NULL); + label_string = g_strconcat(ASSETS_STR, ": ", asset_string, " ", + PROFITS_STR, ": ", profit_string, " ", + NULL); label = gtk_object_get_data(GTK_OBJECT(gnc_get_ui_data()), "balance_label"); @@ -401,15 +149,14 @@ static void gnc_ui_about_cb (GtkWidget *widget, gpointer data) { GtkWidget *about; + const gchar *copyright = "(C) 1998-1999 Linas Vepstas"; const gchar *authors[] = { "Linas Vepstas ", NULL }; - about = gnome_about_new("GnuCash", "1.3 (development version)", - "(C) 1998-1999 Linas Vepstas", - authors, - "The GnuCash personal finance manager.\nThe GNU way to manage your money!", NULL); + about = gnome_about_new("GnuCash", VERSION, copyright, + authors, ABOUT_MSG, NULL); gnome_dialog_run_and_close(GNOME_DIALOG(about)); } @@ -448,12 +195,19 @@ static void gnc_ui_delete_account_cb ( GtkWidget *widget, gpointer data ) { Account *account = gnc_get_current_account(); - + if (account) { - if (gnc_verify_dialog("Are you sure you want to delete this account?", - GNC_F)) + gchar *name; + 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); + + g_free(message); } else gnc_error_dialog(ACC_DEL_MSG); @@ -467,7 +221,7 @@ gnc_ui_mainWindow_toolbar_open ( GtkWidget *widget, gpointer data ) if (account == NULL) { - gnc_error_dialog("You must select an account to open first."); + gnc_error_dialog(ACC_OPEN_MSG); return; } @@ -485,7 +239,7 @@ gnc_ui_mainWindow_toolbar_open_subs(GtkWidget *widget, gpointer data) if (account == NULL) { - gnc_error_dialog("You must select an account to open first."); + gnc_error_dialog(ACC_OPEN_MSG); return; } @@ -522,7 +276,7 @@ gnc_ui_mainWindow_reconcile(GtkWidget *widget, gpointer data) gnc_ui_reconcile_window_raise(recnData); } else - gnc_error_dialog("You must select an account"); + gnc_error_dialog(ACC_RECONCILE_MSG); } static void @@ -539,7 +293,7 @@ gnc_ui_mainWindow_adjust_balance(GtkWidget *widget, gpointer data) if (account != NULL) adjBWindow(account); else - gnc_error_dialog("You must select an account to adjust first."); + gnc_error_dialog(ACC_ADJUST_MSG); } static void @@ -549,7 +303,7 @@ gnc_ui_mainWindow_scrub(GtkWidget *widget, gpointer data) if (account == NULL) { - gnc_error_dialog("You must select an account to scrub first."); + gnc_error_dialog(ACC_SCRUB_MSG); return; } @@ -567,7 +321,7 @@ gnc_ui_mainWindow_scrub_sub(GtkWidget *widget, gpointer data) if (account == NULL) { - gnc_error_dialog("You must select an account to scrub first."); + gnc_error_dialog(ACC_SCRUB_MSG); return; } @@ -652,7 +406,13 @@ gnc_ui_mainWindow_destroy_cb(GtkWidget *widget, GNCAccountTree * 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 * @@ -662,6 +422,13 @@ gnc_get_current_account() 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 gnc_account_tree_activate_cb(GNCAccountTree *tree, Account *account, @@ -789,30 +556,280 @@ gnc_configure_account_tree(gpointer data) 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 mainWindow() { GtkWidget *app = gnc_get_ui_data(); - GtkWidget *popup; GtkWidget *scrolled_win; GtkWidget *statusbar; GtkWidget *account_tree; GtkWidget *label; 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_register_option_change_callback(gnc_configure_account_tree, NULL); gtk_signal_connect(GTK_OBJECT (account_tree), "activate_account", 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. */ statusbar = gnome_appbar_new(GNC_F, /* no progress bar, maybe later? */ GNC_T, /* has status area */ @@ -820,6 +837,9 @@ mainWindow() 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 */ label = gtk_label_new(""); gtk_object_set_data (GTK_OBJECT (app), "balance_label", label); @@ -844,8 +864,6 @@ mainWindow() gh_call2(run_danglers, hook, window); } - gnome_app_install_menu_hints(GNOME_APP(app), mainmenu); - /* Attach delete and destroy signals to the main window */ gtk_signal_connect (GTK_OBJECT (app), "delete_event", GTK_SIGNAL_FUNC (gnc_ui_mainWindow_delete_cb), diff --git a/src/gnome/window-main.h b/src/gnome/window-main.h index a693b6fae9..caa39bb004 100644 --- a/src/gnome/window-main.h +++ b/src/gnome/window-main.h @@ -26,7 +26,10 @@ /** PROTOTYPES ******************************************************/ void mainWindow(void); + GNCAccountTree * gnc_get_current_account_tree(); + Account * gnc_get_current_account(); +GList * gnc_get_current_accounts(); #endif diff --git a/src/gnome/window-mainP.h b/src/gnome/window-mainP.h index 7ccdde44c6..efd0683d0e 100644 --- a/src/gnome/window-mainP.h +++ b/src/gnome/window-mainP.h @@ -25,10 +25,6 @@ #ifndef __WINDOW_MAINP_H__ #define __WINDOW_MAINP_H__ -#include - -#include "top-level.h" - /** PROTOTYPES ******************************************************/ static void gnc_ui_refresh_statusbar(void); diff --git a/src/gnome/window-reconcile.c b/src/gnome/window-reconcile.c index 58f3446c7e..4058e9f7e2 100644 --- a/src/gnome/window-reconcile.c +++ b/src/gnome/window-reconcile.c @@ -23,11 +23,12 @@ \********************************************************************/ #define _GNU_SOURCE -#include -#include #include "top-level.h" +#include +#include + #include "date.h" #include "MultiLedger.h" #include "MainWindow.h" @@ -39,7 +40,7 @@ #include "Refresh.h" #include "query-user.h" #include "window-help.h" -#include "messages.h" +#include "enriched-messages.h" #include "util.h" @@ -173,7 +174,7 @@ recnRecalculateBalance(RecnWindow *recnData) * diff - returns the amount from ending balance field * * Return: True, if the user presses "Ok", else False * \********************************************************************/ -gboolean +static gboolean startRecnWindow(GtkWidget *parent, Account *account, double *diff) { GtkWidget *dialog, *end_value; @@ -266,8 +267,7 @@ startRecnWindow(GtkWidget *parent, Account *account, double *diff) } else { - gnc_error_dialog_parented(GTK_WINDOW(parent), - "Ending balance must be a number."); + gnc_error_dialog_parented(GTK_WINDOW(parent), BALANCE_NUM_MSG); continue; } } @@ -443,11 +443,10 @@ gnc_ui_reconcile_window_delete_cb(GtkButton *button, gpointer data) return; { - gchar * buf = "Are you sure you want to delete the current transaction?"; gboolean result; result = gnc_verify_dialog_parented(GTK_WINDOW(recnData->dialog), - buf, GNC_F); + TRANS_DEL2_MSG, GNC_F); if (!result) return; @@ -599,35 +598,41 @@ recnWindow(GtkWidget *parent, Account *account) bbox = gtk_hbutton_box_new(); 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); - 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_FUNC(gnc_ui_reconcile_window_new_cb), recnData); - button = gtk_button_new_with_label("Edit"); + button = gtk_button_new_with_label(EDIT_STR); recnData->edit_button = button; 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_FUNC(gnc_ui_reconcile_window_edit_cb), recnData); - button = gtk_button_new_with_label("Delete"); + button = gtk_button_new_with_label(DELETE_STR); recnData->delete_button = button; 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_FUNC(gnc_ui_reconcile_window_delete_cb), recnData); - button = gtk_button_new_with_label("Edit Info..."); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); - gnc_set_tooltip(button, "Adjust the ending balance"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(gnc_ui_reconcile_window_change_cb), - recnData); + { + gchar *s = g_strconcat(END_BALN_STR, "...", NULL); + + button = gtk_button_new_with_label(s); + gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); + 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 = gtk_frame_new(NULL); @@ -785,9 +790,7 @@ recnOkCB(GtkWidget *w, gpointer data) if (!DEQ(recnRecalculateBalance(recnData), 0.0)) if (!gnc_verify_dialog_parented(GTK_WINDOW(recnData->dialog), - "The account is not balanced.\n" \ - "Are you sure you want to finish?", - GNC_F)) + RECN_BALN_WARN, GNC_F)) return; gnc_reconcile_list_commit(GNC_RECONCILE_LIST(recnData->credit)); diff --git a/src/gnome/window-reconcile.h b/src/gnome/window-reconcile.h index f75c5222fc..49237592d0 100644 --- a/src/gnome/window-reconcile.h +++ b/src/gnome/window-reconcile.h @@ -25,12 +25,6 @@ #ifndef __WINDOW_RECONCILE_H__ #define __WINDOW_RECONCILE_H__ -#include - -#include "config.h" - -#include "top-level.h" - /** GLOBALS *********************************************************/ diff --git a/src/gnome/window-register.c b/src/gnome/window-register.c index f3e4cb4c5d..c94b8b9846 100644 --- a/src/gnome/window-register.c +++ b/src/gnome/window-register.c @@ -30,10 +30,10 @@ #define _GNU_SOURCE -#include - #include "top-level.h" +#include + #include "MultiLedger.h" #include "LedgerUtils.h" #include "MainWindow.h" @@ -47,7 +47,7 @@ #include "dialog-transfer.h" #include "dialog-utils.h" #include "query-user.h" -#include "messages.h" +#include "enriched-messages.h" #include "table-gnome.h" #include "table-html.h" #include "gnucash-sheet.h" @@ -55,20 +55,13 @@ #include "util.h" -/** STRUCTS *********************************************************/ - -typedef struct _StyleData StyleData; -struct _StyleData +typedef struct _RegDateWindow RegDateWindow; +struct _RegDateWindow { - RegWindow *regData; - int style_code; -}; + GtkWidget * window; -typedef struct _SortData SortData; -struct _SortData -{ - RegWindow *regData; - int sort_code; + GtkWidget * start_date; + GtkWidget * end_date; }; /* The RegWindow struct contains info needed by an instance of an open @@ -85,14 +78,10 @@ struct _RegWindow GtkWidget * balance_label; GtkWidget * cleared_label; - GtkWidget * start_date; - GtkWidget * end_date; - - StyleData * style_cb_data; - SortData * sort_cb_data; - GnucashRegister *reg; + RegDateWindow *date_window; + /* Do we close the ledger when the window closes? */ gncBoolean close_ledger; }; @@ -119,6 +108,9 @@ static void deleteCB(GtkWidget *w, gpointer data); static void recordCB(GtkWidget *w, gpointer data); static void cancelCB(GtkWidget *w, gpointer data); static void closeCB(GtkWidget *w, gpointer data); +static void dateCB(GtkWidget *w, gpointer data); +static void new_trans_cb(GtkWidget *widget, gpointer data); +static void jump_cb(GtkWidget *widget, gpointer data); static gboolean gnc_register_include_date(RegWindow *regData, time_t date); @@ -246,89 +238,67 @@ gnc_register_get_default_type(SplitRegister *reg) static void -ledger_change_style_cb(GtkWidget *w, gint index, gpointer data) +gnc_register_change_style(RegWindow *regData, int style_code) { - StyleData *style_data = (StyleData *) data; - xaccLedgerDisplay *ld = style_data->regData->ledger; - SplitRegister *reg = ld->ledger; + SplitRegister *reg = regData->ledger->ledger; int type = reg->type; type &= ~REG_STYLE_MASK; - type |= style_data->style_code; - + type |= style_code; + xaccConfigSplitRegister(reg, type); - ld->dirty = 1; - xaccLedgerDisplayRefresh(ld); + regData->ledger->dirty = 1; + xaccLedgerDisplayRefresh(regData->ledger); } -static GtkWidget * -gnc_build_ledger_style_menu(RegWindow *regData) +static void +gnc_register_style_single_cb(GtkWidget *w, gpointer data) { - GtkWidget *omenu; - gint num_items; - int style; - gint i; + RegWindow *regData = data; - static StyleData style_data[] = - { - { NULL, REG_SINGLE_LINE }, - { NULL, REG_DOUBLE_LINE }, - { NULL, REG_MULTI_LINE }, - { NULL, REG_SINGLE_DYNAMIC }, - { NULL, REG_DOUBLE_DYNAMIC } - }; + gnc_register_change_style(regData, REG_SINGLE_LINE); +} - static GNCOptionInfo style_items[] = - { - { "Single Line", "Show transactions on single lines", - ledger_change_style_cb, NULL }, - { "Double Line", "Show transactions on two lines with more information", - ledger_change_style_cb, NULL }, - { "Multi Line", "Show transactions on multiple lines with one line " - "for each split in the transaction", - ledger_change_style_cb, NULL }, - { "Auto Single", "Single line mode with multi-line cursor", - ledger_change_style_cb, NULL }, - { "Auto Double", "Double line mode with multi-line cursor", - ledger_change_style_cb, NULL } - }; +static void +gnc_register_style_double_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; - num_items = sizeof(style_items) / sizeof(GNCOptionInfo); + gnc_register_change_style(regData, REG_DOUBLE_LINE); +} - regData->style_cb_data = g_new0(StyleData, num_items); +static void +gnc_register_style_multi_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; - for (i = 0; i < num_items; i++) - { - regData->style_cb_data[i].regData = regData; - regData->style_cb_data[i].style_code = style_data[i].style_code; + gnc_register_change_style(regData, REG_MULTI_LINE); +} - style_items[i].user_data = ®Data->style_cb_data[i]; - } +static void +gnc_register_style_auto_single_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; - omenu = gnc_build_option_menu(style_items, num_items); + gnc_register_change_style(regData, REG_SINGLE_DYNAMIC); +} - style = gnc_register_get_default_type(regData->ledger->ledger); - style &= REG_STYLE_MASK; +static void +gnc_register_style_auto_double_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; - for (i = 0; i < num_items; i++) - if (style == regData->style_cb_data[i].style_code) - { - gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), i); - break; - } - - return omenu; + gnc_register_change_style(regData, REG_DOUBLE_DYNAMIC); } static void -gnc_ledger_sort_cb(GtkWidget *w, gint index, gpointer data) +gnc_register_sort(RegWindow *regData, int sort_code) { - SortData *sortData = (SortData *) data; - Query *query = sortData->regData->ledger->query; + Query *query = regData->ledger->query; - switch(sortData->sort_code) + switch(sort_code) { case BY_STANDARD: xaccQuerySetSortOrder(query, BY_STANDARD, BY_NONE, BY_NONE); @@ -352,55 +322,56 @@ gnc_ledger_sort_cb(GtkWidget *w, gint index, gpointer data) assert(0); /* we should never be here */ } - sortData->regData->ledger->dirty = 1; - xaccLedgerDisplayRefresh(sortData->regData->ledger); + regData->ledger->dirty = 1; + xaccLedgerDisplayRefresh(regData->ledger); } -static GtkWidget * -gnc_build_ledger_sort_order_menu(RegWindow *regData) +static void +gnc_register_sort_standard_cb(GtkWidget *w, gpointer data) { - gint num_items; - gint i; + RegWindow *regData = data; - static SortData sort_data[] = - { - { NULL, BY_STANDARD }, - { NULL, BY_DATE }, - { NULL, BY_NUM }, - { NULL, BY_AMOUNT }, - { NULL, BY_MEMO }, - { NULL, BY_DESC } - }; + gnc_register_sort(regData, BY_STANDARD); +} - static GNCOptionInfo sort_items[] = - { - { "Standard order", "Keep normal account order", - gnc_ledger_sort_cb, NULL }, - { "Sort by date", "Sort by date, then num, then amount", - gnc_ledger_sort_cb, NULL }, - { "Sort by num", "Sort by num, then date, then amount", - gnc_ledger_sort_cb, NULL }, - { "Sort by amount", "Sort by amount, then date, then num", - gnc_ledger_sort_cb, NULL }, - { "Sort by memo", "Sort by memo, then date, then num", - gnc_ledger_sort_cb, NULL }, - { "Sort by description", "Sort by description, then date, then num", - gnc_ledger_sort_cb, NULL } - }; +static void +gnc_register_sort_date_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; - num_items = sizeof(sort_items) / sizeof(GNCOptionInfo); + gnc_register_sort(regData, BY_DATE); +} - regData->sort_cb_data = g_new0(SortData, num_items); +static void +gnc_register_sort_num_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; - for (i = 0; i < num_items; i++) - { - regData->sort_cb_data[i].regData = regData; - regData->sort_cb_data[i].sort_code = sort_data[i].sort_code; + gnc_register_sort(regData, BY_NUM); +} - sort_items[i].user_data = ®Data->sort_cb_data[i]; - } +static void +gnc_register_sort_amount_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; - return gnc_build_option_menu(sort_items, num_items); + gnc_register_sort(regData, BY_AMOUNT); +} + +static void +gnc_register_sort_memo_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; + + gnc_register_sort(regData, BY_MEMO); +} + +static void +gnc_register_sort_desc_cb(GtkWidget *w, gpointer data) +{ + RegWindow *regData = data; + + gnc_register_sort(regData, BY_DESC); } static time_t @@ -438,11 +409,20 @@ gnc_register_max_day_time(time_t time_val) static void gnc_register_set_date_range(RegWindow *regData) { + RegDateWindow *regDateData; time_t start; time_t end; - start = gnome_date_edit_get_date(GNOME_DATE_EDIT(regData->start_date)); - end = gnome_date_edit_get_date(GNOME_DATE_EDIT(regData->end_date)); + assert(regData != NULL); + assert(regData->ledger != NULL); + assert(regData->ledger->query != NULL); + + regDateData = regData->date_window; + if (regDateData == NULL) + return; + + start = gnome_date_edit_get_date(GNOME_DATE_EDIT(regDateData->start_date)); + end = gnome_date_edit_get_date(GNOME_DATE_EDIT(regDateData->end_date)); start = gnc_register_min_day_time(start); end = gnc_register_max_day_time(end); @@ -455,10 +435,6 @@ gnc_register_date_cb(GtkWidget *widget, gpointer data) { RegWindow *regData = (RegWindow *) data; - assert(regData != NULL); - assert(regData->ledger != NULL); - assert(regData->ledger->query != NULL); - gnc_register_set_date_range(regData); regData->ledger->dirty = 1; @@ -469,172 +445,236 @@ static void gnc_register_today_cb(GtkWidget *widget, gpointer data) { RegWindow *regData = (RegWindow *) data; + RegDateWindow *regDateData; assert(regData != NULL); - gnome_date_edit_set_time(GNOME_DATE_EDIT(regData->end_date), time(NULL)); + regDateData = regData->date_window; + gnome_date_edit_set_time(GNOME_DATE_EDIT(regDateData->end_date), time(NULL)); gnc_register_date_cb(widget, regData); } +static void +gnc_register_show_date_window(RegWindow *regData) +{ + RegDateWindow *regDateData; + + if (regData == NULL) + return; + + regDateData = regData->date_window; + if (regDateData == NULL) + return; + + if (regDateData->window == NULL) + return; + + gtk_widget_show_all(regDateData->window); + gdk_window_raise(GTK_WIDGET(regDateData->window)->window); +} + +static RegDateWindow * +gnc_register_date_window(RegWindow *regData) +{ + RegDateWindow *regDateData; + GtkWidget *dialog; + GtkWidget *frame; + GtkWidget *dvbox; + + regDateData = g_new0(RegDateWindow, 1); + regData->date_window = regDateData; + + dialog = gnome_dialog_new(REG_DATE_RANGES_STR, + GNOME_STOCK_BUTTON_CLOSE, + NULL); + + regDateData->window = dialog; + dvbox = GNOME_DIALOG(dialog)->vbox; + + gnome_dialog_set_default(GNOME_DIALOG(dialog), 0); + gnome_dialog_set_close(GNOME_DIALOG(dialog), TRUE); + gnome_dialog_close_hides(GNOME_DIALOG(dialog), TRUE); + gnome_dialog_set_parent(GNOME_DIALOG(dialog), GTK_WINDOW(regData->window)); + + frame = gtk_frame_new(NULL); + gtk_container_set_border_width(GTK_CONTAINER(frame), 5); + gtk_box_pack_start(GTK_BOX(dvbox), frame, FALSE, FALSE, 0); + + { + GtkWidget *calendar; + GtkWidget *button; + GtkWidget *entry; + GtkWidget *date; + GtkWidget *label; + GtkWidget *hbox; + GtkWidget *vbox; + time_t time_val; + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); + gtk_container_add(GTK_CONTAINER(frame), hbox); + + vbox = gtk_vbox_new(TRUE, 2); + gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); + + label = gtk_label_new(START_DATE_C_STR); + gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + label = gtk_label_new(END_DATE_C_STR); + gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + + + vbox = gtk_vbox_new(TRUE, 2); + gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); + + date = gnome_date_edit_new(time(NULL), FALSE, FALSE); + gtk_box_pack_start(GTK_BOX(vbox), date, FALSE, FALSE, 0); + calendar = GNOME_DATE_EDIT(date)->calendar; + gtk_signal_connect(GTK_OBJECT(calendar), "day_selected_double_click", + GTK_SIGNAL_FUNC(gnc_register_date_cb), regData); + entry = GNOME_DATE_EDIT(date)->date_entry; + gtk_signal_connect(GTK_OBJECT(entry), "activate", + GTK_SIGNAL_FUNC(gnc_register_date_cb), regData); + regDateData->start_date = date; + + time_val = xaccQueryGetEarliestDateFound(regData->ledger->query); + if (time_val < time(NULL)) + gnome_date_edit_set_time(GNOME_DATE_EDIT(date), time_val); + + date = gnome_date_edit_new(time(NULL), FALSE, FALSE); + gtk_box_pack_start(GTK_BOX(vbox), date, FALSE, FALSE, 0); + calendar = GNOME_DATE_EDIT(date)->calendar; + gtk_signal_connect(GTK_OBJECT(calendar), "day_selected_double_click", + GTK_SIGNAL_FUNC(gnc_register_date_cb), regData); + entry = GNOME_DATE_EDIT(date)->date_entry; + gtk_signal_connect(GTK_OBJECT(entry), "activate", + GTK_SIGNAL_FUNC(gnc_register_date_cb), regData); + regDateData->end_date = date; + + + vbox = gtk_vbox_new(TRUE, 2); + gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); + + label = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + button = gtk_button_new_with_label(TODAY_STR); + gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); + gtk_signal_connect(GTK_OBJECT(button), "clicked", + GTK_SIGNAL_FUNC(gnc_register_today_cb), regData); + } + + return regDateData; +} + static GtkWidget * gnc_register_create_tool_bar(RegWindow *regData) { - GtkWidget *hbox; - - hbox = gtk_hbox_new(FALSE, 5); - - /* Transaction Buttons */ + GtkWidget *toolbar; + GnomeUIInfo toolbar_info[] = { - GtkWidget *toolbar; - GnomeUIInfo toolbar_info[] = { - { - GNOME_APP_UI_ITEM, - "Record", "Record the current transaction", - recordCB, regData, NULL, - GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_ADD, - 0, 0, NULL - }, - { - GNOME_APP_UI_ITEM, - "Cancel", "Cancel the current transaction", - cancelCB, regData, NULL, - GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_UNDO, - 0, 0, NULL - }, - { - GNOME_APP_UI_ITEM, - "Delete", "Delete the current transaction", - deleteCB, regData, NULL, - GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_TRASH, - 0, 0, NULL - }, - GNOMEUIINFO_END - }; + GNOME_APP_UI_ITEM, + RECORD_STR, TOOLTIP_RECORD, + recordCB, regData, NULL, + GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_ADD, + 0, 0, NULL + }, + { + GNOME_APP_UI_ITEM, + CANCEL_STR, TOOLTIP_CANCEL_TRANS, + cancelCB, regData, NULL, + GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_UNDELETE, + 0, 0, NULL + }, + { + GNOME_APP_UI_ITEM, + DELETE_STR, TOOLTIP_DEL_TRANS, + deleteCB, regData, NULL, + GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_TRASH, + 0, 0, NULL + }, + GNOMEUIINFO_SEPARATOR, + { + GNOME_APP_UI_ITEM, + NEW_STR, TOOLTIP_NEW_TRANS, + new_trans_cb, regData, NULL, + GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_NEW, + 0, 0, NULL + }, + { + GNOME_APP_UI_ITEM, + JUMP_STR, TOOLTIP_JUMP_TRANS, + jump_cb, regData, NULL, + GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_JUMP_TO, + 0, 0, NULL + }, + GNOMEUIINFO_SEPARATOR, + { + GNOME_APP_UI_ITEM, + TRANSFER_STR, TOOLTIP_TRANSFER, + xferCB, regData, NULL, + GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_CONVERT, + 0, 0, NULL + }, + GNOMEUIINFO_SEPARATOR, + { + GNOME_APP_UI_ITEM, + CLOSE_STR, TOOLTIP_CLOSE_REG, + closeCB, regData, NULL, + GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_CLOSE, + 0, 0, NULL + }, + GNOMEUIINFO_END + }; - toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); + toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); - gnome_app_fill_toolbar(GTK_TOOLBAR(toolbar), toolbar_info, NULL); + gnome_app_fill_toolbar(GTK_TOOLBAR(toolbar), toolbar_info, NULL); - gtk_box_pack_start(GTK_BOX(hbox), toolbar, FALSE, FALSE, 0); + regData->toolbar = toolbar; - regData->toolbar = toolbar; - } + return toolbar; +} - { - GtkWidget *frame; - GtkWidget *balance_hbox; - GtkWidget *vbox; - GtkWidget *label; - frame = gtk_frame_new(NULL); - gtk_box_pack_end(GTK_BOX(hbox), frame, FALSE, FALSE, 0); +static GtkWidget * +gnc_register_create_status_bar(RegWindow *regData) +{ + GtkWidget *statusbar; + GtkWidget *hbox; + GtkWidget *label; - balance_hbox = gtk_hbox_new(FALSE, 2); - gtk_container_set_border_width(GTK_CONTAINER(balance_hbox), 4); - gtk_container_add(GTK_CONTAINER(frame), balance_hbox); + statusbar = gnome_appbar_new(GNC_F, /* no progress bar */ + GNC_T, /* has status area */ + GNOME_PREFERENCES_USER); - vbox = gtk_vbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(balance_hbox), vbox, FALSE, FALSE, 0); - label = gtk_label_new(BALN_C_STR); - gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - label = gtk_label_new(CLEARED_C_STR); - gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + hbox = gtk_hbox_new(FALSE, 2); + gtk_box_pack_end(GTK_BOX(statusbar), hbox, FALSE, FALSE, 5); - vbox = gtk_vbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(balance_hbox), vbox, FALSE, FALSE, 0); - label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); - regData->balance_label = label; - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); - regData->cleared_label = label; - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - } + label = gtk_label_new(CLEARED_C_STR); + gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - { - GtkWidget *vbox; + label = gtk_label_new(""); + gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); + regData->cleared_label = label; + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - vbox = gtk_vbox_new(TRUE, 0); - gtk_box_pack_end(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); + hbox = gtk_hbox_new(FALSE, 2); + gtk_box_pack_end(GTK_BOX(statusbar), hbox, FALSE, FALSE, 5); - /* Style popup */ - gtk_box_pack_start(GTK_BOX(vbox), - gnc_build_ledger_style_menu(regData), - FALSE, FALSE, 0); + label = gtk_label_new(BALN_C_STR); + gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - /* Sort popup */ - gtk_box_pack_start(GTK_BOX(vbox), - gnc_build_ledger_sort_order_menu(regData), - FALSE, FALSE, 0); - } + label = gtk_label_new(""); + gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); + regData->balance_label = label; + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - { - GtkWidget *calendar; - GtkWidget *entry; - GtkWidget *date; - GtkWidget *label; - GtkWidget *hbox_date; - GtkWidget *vbox; - GtkWidget *button; - time_t time_val; - - hbox_date = gtk_hbox_new(FALSE, 2); - gtk_box_pack_end(GTK_BOX(hbox), hbox_date, FALSE, FALSE, 0); - - vbox = gtk_vbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(hbox_date), vbox, FALSE, FALSE, 0); - label = gtk_label_new("Start date:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - label = gtk_label_new("End date:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.95, 0.5); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - - vbox = gtk_vbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(hbox_date), vbox, FALSE, FALSE, 0); - - date = gnome_date_edit_new(time(NULL), FALSE, FALSE); - gtk_box_pack_start(GTK_BOX(vbox), date, FALSE, FALSE, 0); - calendar = GNOME_DATE_EDIT(date)->calendar; - gtk_signal_connect(GTK_OBJECT(calendar), "day_selected_double_click", - GTK_SIGNAL_FUNC(gnc_register_date_cb), regData); - entry = GNOME_DATE_EDIT(date)->date_entry; - gtk_signal_connect(GTK_OBJECT(entry), "activate", - GTK_SIGNAL_FUNC(gnc_register_date_cb), regData); - regData->start_date = date; - - date = gnome_date_edit_new(time(NULL), FALSE, FALSE); - gtk_box_pack_start(GTK_BOX(vbox), date, FALSE, FALSE, 0); - calendar = GNOME_DATE_EDIT(date)->calendar; - gtk_signal_connect(GTK_OBJECT(calendar), "day_selected_double_click", - GTK_SIGNAL_FUNC(gnc_register_date_cb), regData); - entry = GNOME_DATE_EDIT(date)->date_entry; - gtk_signal_connect(GTK_OBJECT(entry), "activate", - GTK_SIGNAL_FUNC(gnc_register_date_cb), regData); - regData->end_date = date; - - vbox = gtk_vbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(hbox_date), vbox, FALSE, FALSE, 0); - label = gtk_label_new(""); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - button = gtk_button_new_with_label("Today"); - gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(gnc_register_today_cb), regData); - - time_val = xaccQueryGetEarliestDateFound(regData->ledger->query); - if (time_val < time(NULL)) - gnome_date_edit_set_time(GNOME_DATE_EDIT(regData->start_date), time_val); - - gnc_register_set_date_range(regData); - } - - return hbox; + return statusbar; } @@ -715,37 +755,105 @@ gnc_register_scrub_cb(GtkWidget *widget, gpointer data) } static GtkWidget * -gnc_register_create_menu_bar(RegWindow *regData) +gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) { GtkWidget *menubar; GtkAccelGroup *accel_group; + GnomeUIInfo style_list[] = + { + GNOMEUIINFO_RADIOITEM_DATA(SINGLE_LINE_STR, TOOLTIP_SINGLE_LINE, + gnc_register_style_single_cb, regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(DOUBLE_LINE_STR, TOOLTIP_DOUBLE_LINE, + gnc_register_style_double_cb, regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(MULTI_LINE_STR, TOOLTIP_MULTI_LINE, + gnc_register_style_multi_cb, regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(AUTO_SINGLE_STR, TOOLTIP_AUTO_SINGLE, + gnc_register_style_auto_single_cb, + regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(AUTO_DOUBLE_STR, TOOLTIP_AUTO_DOUBLE, + gnc_register_style_auto_double_cb, + regData, NULL), + GNOMEUIINFO_END + }; + + GnomeUIInfo style_menu[] = + { + GNOMEUIINFO_RADIOLIST(style_list), + GNOMEUIINFO_END + }; + + GnomeUIInfo sort_list[] = + { + GNOMEUIINFO_RADIOITEM_DATA(STANDARD_ORDER_STR, TOOLTIP_STANDARD_ORD, + gnc_register_sort_standard_cb, regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_DATE_STR, TOOLTIP_SORT_BY_DATE, + gnc_register_sort_date_cb, regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_NUM_STR, TOOLTIP_SORT_BY_NUM, + gnc_register_sort_num_cb, regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_AMNT_STR, TOOLTIP_SORT_BY_AMNT, + gnc_register_sort_amount_cb, regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_MEMO_STR, TOOLTIP_SORT_BY_MEMO, + gnc_register_sort_memo_cb, regData, NULL), + GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_DESC_STR, TOOLTIP_SORT_BY_DESC, + gnc_register_sort_desc_cb, regData, NULL), + GNOMEUIINFO_END + }; + + GnomeUIInfo sort_menu[] = + { + GNOMEUIINFO_RADIOLIST(sort_list), + GNOMEUIINFO_END + }; + + GnomeUIInfo register_menu[] = + { + GNOMEUIINFO_SUBTREE(STYLE_STR, style_menu), + GNOMEUIINFO_SUBTREE(SORT_ORDER_STR, sort_menu), + { + GNOME_APP_UI_ITEM, + DATE_RANGE_E_STR, TOOLTIP_DATE_RANGE, + dateCB, regData, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, 0, NULL + }, + GNOMEUIINFO_SEPARATOR, + { + GNOME_APP_UI_ITEM, + CLOSE_STR, TOOLTIP_CLOSE_REG, + closeCB, regData, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, 0, NULL + }, + GNOMEUIINFO_END + }; + GnomeUIInfo account_menu[] = { { GNOME_APP_UI_ITEM, - "_Edit Info...", "Edit account information", + EDIT_ACCT_E_STR, TOOLTIP_EDIT_REG, editCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "Re_concile...", "Reconcile this account", + RECONCILE_E_STR, TOOLTIP_RECN_REG, startRecnCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "_Transfer...", "Transfer funds from one account to another", + TRANSFER_E_STR, TOOLTIP_TRANSFER, xferCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "Adjust _Balance...", "Adjust the balance of the account", + ADJ_BALN_STR, TOOLTIP_ADJUST_REG, startAdjBCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -753,19 +861,11 @@ gnc_register_create_menu_bar(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - N_("_Scrub"), N_("Scrub the account and its subaccounts clean"), + SCRUB_STR, TOOLTIP_SCRUB_REG, gnc_register_scrub_cb, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, - GNOMEUIINFO_SEPARATOR, - { - GNOME_APP_UI_ITEM, - "_Close", "Close this register window", - closeCB, regData, NULL, - GNOME_APP_PIXMAP_NONE, NULL, - 0, 0, NULL - }, GNOMEUIINFO_END }; @@ -773,21 +873,21 @@ gnc_register_create_menu_bar(RegWindow *regData) { { GNOME_APP_UI_ITEM, - "_Record", "Record the current transaction", + RECORD_STR, TOOLTIP_RECORD, recordCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "_Cancel", "Cancel the current edit", + CANCEL_STR, TOOLTIP_CANCEL_TRANS, cancelCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "_Delete", "Delete the current transaction", + DELETE_STR, TOOLTIP_DEL_TRANS, deleteCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -795,15 +895,14 @@ gnc_register_create_menu_bar(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - "_New", "Edit the new new transaction", + NEW_STR, TOOLTIP_NEW_TRANS, new_trans_cb, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "_Jump", "Jump to the corresponding transaction in " - "the other account", + JUMP_STR, TOOLTIP_JUMP_TRANS, jump_cb, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -815,7 +914,7 @@ gnc_register_create_menu_bar(RegWindow *regData) { { GNOME_APP_UI_ITEM, - N_("_Help..."), N_("Gnucash Help."), + HELP_E_STR, TOOLTIP_HELP, helpCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -825,8 +924,9 @@ gnc_register_create_menu_bar(RegWindow *regData) GnomeUIInfo register_window_menu[] = { - GNOMEUIINFO_SUBTREE("_Account", account_menu), - GNOMEUIINFO_SUBTREE("_Transaction", transaction_menu), + GNOMEUIINFO_SUBTREE(REGISTER_STR, register_menu), + GNOMEUIINFO_SUBTREE(ACCOUNT_STR, account_menu), + GNOMEUIINFO_SUBTREE(TRANSACTION_STR, transaction_menu), GNOMEUIINFO_MENU_HELP_TREE(help_menu), GNOMEUIINFO_END }; @@ -839,6 +939,9 @@ gnc_register_create_menu_bar(RegWindow *regData) gnome_app_fill_menu(GTK_MENU_SHELL(menubar), register_window_menu, accel_group, TRUE, 0); + gnome_app_install_appbar_menu_hints(GNOME_APPBAR(statusbar), + register_window_menu); + return menubar; } @@ -852,21 +955,21 @@ gnc_register_create_popup_menu(RegWindow *regData) { { GNOME_APP_UI_ITEM, - "_Record", "Record the current transaction", + RECORD_STR, TOOLTIP_RECORD, recordCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "_Cancel", "Cancel the current edit", + CANCEL_STR, TOOLTIP_CANCEL_TRANS, cancelCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "_Delete", "Delete the current transaction", + DELETE_STR, TOOLTIP_DEL_TRANS, deleteCB, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -874,15 +977,14 @@ gnc_register_create_popup_menu(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - "_New", "Edit the new new transaction", + NEW_STR, TOOLTIP_NEW_TRANS, new_trans_cb, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - "_Jump", "Jump to the corresponding transaction in " - "the other account", + JUMP_STR, TOOLTIP_JUMP_TRANS, jump_cb, regData, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -914,6 +1016,21 @@ gnc_register_destroy_cb(GtkWidget *widget, gpointer data) closeRegWindow(widget, regData); } +static gncUIWidget +gnc_register_get_parent(xaccLedgerDisplay *ledger) +{ + RegWindow *regData; + + if (ledger == NULL) + return NULL; + + regData = ledger->gui_hook; + if (regData == NULL) + return NULL; + + return regData->window; +} + /********************************************************************\ * regWindowLedger * * opens up a ledger window for the account list * @@ -925,9 +1042,11 @@ RegWindow * regWindowLedger(xaccLedgerDisplay *ledger) { RegWindow *regData = NULL; + GtkWidget *vbox; GtkWidget *register_window; GtkWidget *register_dock; GtkWidget *table_frame; + GtkWidget *statusbar; xaccQuerySetMaxSplits(ledger->query, INT_MAX); xaccQuerySetSortOrder(ledger->query, BY_STANDARD, BY_NONE, BY_NONE); @@ -941,48 +1060,52 @@ regWindowLedger(xaccLedgerDisplay *ledger) ledger->gui_hook = (void *) regData; ledger->redraw = regRefresh; ledger->destroy = regDestroy; + ledger->get_parent = gnc_register_get_parent; register_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(register_window), vbox); + register_dock = gnome_dock_new(); - gtk_container_add(GTK_CONTAINER(register_window), register_dock); + gtk_box_pack_start(GTK_BOX(vbox), register_dock, TRUE, TRUE, 0); regData->ledger = ledger; regData->close_ledger = GNC_T; regData->window = register_window; - regData->sort_cb_data = NULL; - regData->style_cb_data = NULL; { /* pick a window name */ - char *windowname; + gchar *windowname; if (ledger->leader) { - char * acc_name = gnc_ui_get_account_full_name(ledger->leader, ":"); + gchar * acc_name = gnc_ui_get_account_full_name(ledger->leader, ":"); + gchar * reg_name; switch (ledger->type) { case GENERAL_LEDGER: case INCOME_LEDGER: - asprintf(&windowname, "%s General Ledger", acc_name); + reg_name = GENERAL_LEDGER_STR; break; case PORTFOLIO: - asprintf(&windowname, "%s Portfolio", acc_name); + reg_name = PORTFOLIO_STR; break; default: - asprintf(&windowname, "%s Register", acc_name); + reg_name = REGISTER_STR; break; } + windowname = g_strconcat(acc_name, " ", reg_name, NULL); + g_free(acc_name); } else - asprintf(&windowname, "%s", "General Ledger"); - - assert(windowname != NULL); + windowname = g_strdup(GENERAL_LEDGER_STR); gtk_window_set_title(GTK_WINDOW(register_window), windowname); - free(windowname); + g_free(windowname); } /* Invoked when window is being destroyed. */ @@ -990,6 +1113,12 @@ regWindowLedger(xaccLedgerDisplay *ledger) GTK_SIGNAL_FUNC (gnc_register_destroy_cb), (gpointer) regData); + regData->date_window = gnc_register_date_window(regData); + gnc_register_set_date_range(regData); + + statusbar = gnc_register_create_status_bar(regData); + gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0); + /* The menu bar */ { GtkWidget *dock_item; @@ -997,7 +1126,7 @@ regWindowLedger(xaccLedgerDisplay *ledger) dock_item = gnome_dock_item_new("menu", GNOME_DOCK_ITEM_BEH_EXCLUSIVE); - menubar = gnc_register_create_menu_bar(regData); + menubar = gnc_register_create_menu_bar(regData, statusbar); gtk_container_set_border_width(GTK_CONTAINER(menubar), 2); gtk_container_add(GTK_CONTAINER(dock_item), menubar); @@ -1005,6 +1134,21 @@ regWindowLedger(xaccLedgerDisplay *ledger) GNOME_DOCK_TOP, 0, 0, 0, TRUE); } + /* The tool bar */ + { + GtkWidget *dock_item; + GtkWidget *toolbar; + + dock_item = gnome_dock_item_new("toolbar", GNOME_DOCK_ITEM_BEH_EXCLUSIVE); + + toolbar = gnc_register_create_tool_bar(regData); + gtk_container_set_border_width(GTK_CONTAINER(toolbar), 2); + gtk_container_add(GTK_CONTAINER(dock_item), toolbar); + + gnome_dock_add_item (GNOME_DOCK(register_dock), GNOME_DOCK_ITEM(dock_item), + GNOME_DOCK_TOP, 1, 0, 0, TRUE); + } + /* The CreateTable will do the actual gui init, returning a widget */ { GtkWidget *register_widget; @@ -1028,21 +1172,6 @@ regWindowLedger(xaccLedgerDisplay *ledger) popup, regData); } - /* The tool bar */ - { - GtkWidget *dock_item; - GtkWidget *toolbar; - - dock_item = gnome_dock_item_new("menu", GNOME_DOCK_ITEM_BEH_EXCLUSIVE); - - toolbar = gnc_register_create_tool_bar(regData); - gtk_container_set_border_width(GTK_CONTAINER(toolbar), 2); - gtk_container_add(GTK_CONTAINER(dock_item), toolbar); - - gnome_dock_add_item (GNOME_DOCK(register_dock), GNOME_DOCK_ITEM(dock_item), - GNOME_DOCK_BOTTOM, 1, 0, 0, TRUE); - } - /* be sure to initialize the gui elements associated with the cursor */ xaccConfigSplitRegister(ledger->ledger, gnc_register_get_default_type(ledger->ledger)); @@ -1140,16 +1269,13 @@ closeRegWindow(GtkWidget * widget, RegWindow *regData) if (regData->close_ledger) xaccLedgerDisplayClose(regData->ledger); - if (regData->style_cb_data != NULL) + if (regData->date_window != NULL) { - g_free(regData->style_cb_data); - regData->style_cb_data = NULL; - } + if (regData->date_window->window != NULL) + gtk_widget_destroy(regData->date_window->window); - if (regData->sort_cb_data != NULL) - { - g_free(regData->sort_cb_data); - regData->sort_cb_data = NULL; + g_free(regData->date_window); + regData->date_window = NULL; } free(regData); @@ -1250,21 +1376,24 @@ startRecnCB(GtkWidget * w, gpointer data) static gboolean gnc_register_include_date(RegWindow *regData, time_t date) { + RegDateWindow *regDateData; time_t start, end; gboolean changed = FALSE; - start = gnome_date_edit_get_date(GNOME_DATE_EDIT(regData->start_date)); - end = gnome_date_edit_get_date(GNOME_DATE_EDIT(regData->end_date)); + regDateData = regData->date_window; + + start = gnome_date_edit_get_date(GNOME_DATE_EDIT(regDateData->start_date)); + end = gnome_date_edit_get_date(GNOME_DATE_EDIT(regDateData->end_date)); if (date < start) { - gnome_date_edit_set_time(GNOME_DATE_EDIT(regData->start_date), date); + gnome_date_edit_set_time(GNOME_DATE_EDIT(regDateData->start_date), date); changed = TRUE; } if (date > end) { - gnome_date_edit_set_time(GNOME_DATE_EDIT(regData->end_date), date); + gnome_date_edit_set_time(GNOME_DATE_EDIT(regDateData->end_date), date); changed = TRUE; } @@ -1348,19 +1477,10 @@ gnc_transaction_delete_query(GtkWindow *parent) gint pos = 0; gint result; - gchar *whole = "Delete the whole transaction"; - gchar *splits = "Delete all the splits"; - gchar *usual = - "This selection will delete the whole transaction. " - "This is what you usually want."; + gchar *usual = DEL_USUAL_MSG; + gchar *warn = DEL_WARN_MSG; - gchar *warn = - "Warning: Just deleting all the splits will make your " - "account unbalanced. You probably shouldn't do this unless " - "you're going to immediately add another split to bring things " - "back into balance."; - - dialog = gnome_dialog_new("Delete Transaction", + dialog = gnome_dialog_new(DEL_TRANS_STR, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); @@ -1380,7 +1500,7 @@ gnc_transaction_delete_query(GtkWindow *parent) text = gtk_text_new(NULL, NULL); - trans_button = gtk_radio_button_new_with_label(NULL, whole); + trans_button = gtk_radio_button_new_with_label(NULL, DEL_TRANS_MSG); gtk_object_set_user_data(GTK_OBJECT(trans_button), text); gtk_box_pack_start(GTK_BOX(vbox), trans_button, TRUE, TRUE, 0); @@ -1388,7 +1508,7 @@ gnc_transaction_delete_query(GtkWindow *parent) GTK_SIGNAL_FUNC(gnc_transaction_delete_toggle_cb), usual); group = gtk_radio_button_group(GTK_RADIO_BUTTON(trans_button)); - splits_button = gtk_radio_button_new_with_label(group, splits); + splits_button = gtk_radio_button_new_with_label(group, DEL_SPLITS_MSG); gtk_object_set_user_data(GTK_OBJECT(splits_button), text); gtk_box_pack_start(GTK_BOX(vbox), splits_button, TRUE, TRUE, 0); @@ -1493,10 +1613,8 @@ deleteCB(GtkWidget *widget, gpointer data) if ((xaccTransCountSplits(trans) <= 2) && ((style == REG_SINGLE_LINE) || (style == REG_DOUBLE_LINE))) { - buf = "Are you sure you want to delete the current transaction?"; - result = gnc_verify_dialog_parented(GTK_WINDOW(regData->window), - buf, GNC_F); + TRANS_DEL2_MSG, GNC_F); if (!result) return; @@ -1562,9 +1680,7 @@ gnc_register_check_close(RegWindow *regData) if (changed) { if (gnc_verify_dialog_parented - (GTK_WINDOW(regData->window), - "The current transaction has been changed.\n" - "Would you like to record it?", GNC_T)) + (GTK_WINDOW(regData->window), TRANS_CHANGED_MSG, GNC_T)) recordCB(regData->window, regData); else xaccSRCancelCursorSplitChanges(regData->ledger->ledger); @@ -1588,6 +1704,20 @@ closeCB(GtkWidget *widget, gpointer data) gtk_widget_destroy(regData->window); } +/********************************************************************\ + * dateCB * + * * + * Args: widget - the widget that called us * + * data - regData - the data struct for this register * + * Return: none * +\********************************************************************/ +static void +dateCB(GtkWidget *widget, gpointer data) +{ + RegWindow *regData = (RegWindow *) data; + + gnc_register_show_date_window(regData); +} /********************************************************************\ * helpCB * diff --git a/src/gnome/window-register.h b/src/gnome/window-register.h index 95a921a31e..fd3b7fc496 100644 --- a/src/gnome/window-register.h +++ b/src/gnome/window-register.h @@ -20,8 +20,6 @@ #ifndef __WINDOW_REGISTER_H__ #define __WINDOW_REGISTER_H__ -#include "top-level.h" - void gnc_register_raise(RegWindow *regData); void gnc_register_jump_to_blank(RegWindow *regData); void gnc_register_jump_to_split(RegWindow *regData, Split *split); diff --git a/src/gnome/window-report.c b/src/gnome/window-report.c index 4e5b950352..cbf3748156 100644 --- a/src/gnome/window-report.c +++ b/src/gnome/window-report.c @@ -24,15 +24,16 @@ * Huntington Beach, CA 92648-4632 * \********************************************************************/ -#include +#include "top-level.h" -#include "config.h" +#include #include "window-report.h" #include "window-html.h" #include "option-util.h" #include "guile-util.h" #include "dialog-options.h" +#include "messages.h" #include "util.h" static short module = MOD_HTML; @@ -50,73 +51,83 @@ struct _ReportData GtkWidget *option_dialog; SCM rendering_thunk; + SCM rendering_thunk_id; + SCM guile_options; + SCM guile_options_id; }; static ReportData * report_data_new() { - ReportData *rd; + ReportData *report_data; - rd = g_new0(ReportData, 1); + report_data = g_new0(ReportData, 1); - rd->guile_options = SCM_UNDEFINED; - rd->rendering_thunk = SCM_UNDEFINED; + report_data->guile_options = 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 -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); - rd->text = NULL; + g_free(report_data->text); + report_data->text = NULL; - gnc_option_db_destroy(rd->odb); - rd->odb = NULL; + gnc_option_db_destroy(report_data->odb); + report_data->odb = NULL; - if (rd->option_dialog != NULL) - gtk_widget_destroy(rd->option_dialog); - rd->option_dialog = NULL; + if (report_data->option_dialog != NULL) + gtk_widget_destroy(report_data->option_dialog); + report_data->option_dialog = NULL; - if (rd->guile_options != SCM_UNDEFINED) - gnc_unregister_c_side_scheme_ptr(rd->guile_options); - rd->guile_options = SCM_UNDEFINED; + if (report_data->guile_options_id != SCM_UNDEFINED) + gnc_unregister_c_side_scheme_ptr_id(report_data->guile_options_id); + report_data->guile_options = SCM_UNDEFINED; + report_data->guile_options_id = SCM_UNDEFINED; - if (rd->rendering_thunk != SCM_UNDEFINED) - gnc_unregister_c_side_scheme_ptr(rd->rendering_thunk); - rd->rendering_thunk = SCM_UNDEFINED; + if (report_data->rendering_thunk_id != SCM_UNDEFINED) + gnc_unregister_c_side_scheme_ptr_id(report_data->rendering_thunk_id); + report_data->rendering_thunk = SCM_UNDEFINED; + report_data->rendering_thunk_id = SCM_UNDEFINED; - g_free(rd); + g_free(report_data); } 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); - rd->text = g_strdup(text); + g_free(report_data->text); + report_data->text = g_strdup(text); } 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) - gnc_unregister_c_side_scheme_ptr(rd->rendering_thunk); + if (report_data->rendering_thunk_id != SCM_UNDEFINED) + 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 gnc_options_dialog_apply_cb(GnomePropertyBox *propertybox, gint arg1, gpointer user_data) { - ReportData *rd = user_data; + ReportData *report_data = user_data; if (arg1 == -1) - gnc_option_db_commit(rd->odb); + gnc_option_db_commit(report_data->odb); } static void @@ -128,52 +139,55 @@ gnc_options_dialog_help_cb(GnomePropertyBox *propertybox, 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; - if (rd->guile_options != SCM_UNDEFINED) + if (report_data->guile_options_id != SCM_UNDEFINED) { - gnc_unregister_c_side_scheme_ptr(rd->guile_options); - gnc_option_db_destroy(rd->odb); + gnc_unregister_c_side_scheme_ptr_id(report_data->guile_options_id); + gnc_option_db_destroy(report_data->odb); } - if (rd->option_dialog != NULL) - gtk_widget_destroy(rd->option_dialog); + if (report_data->option_dialog != NULL) + gtk_widget_destroy(report_data->option_dialog); if (gh_scm2bool(gh_not(guile_options))) { - rd->guile_options = SCM_UNDEFINED; - rd->option_dialog = NULL; + report_data->guile_options = SCM_UNDEFINED; + report_data->option_dialog = NULL; return; } - rd->guile_options = guile_options; - gnc_register_c_side_scheme_ptr(guile_options); + report_data->guile_options = 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(); - gnome_dialog_close_hides(GNOME_DIALOG(rd->option_dialog), TRUE); + report_data->option_dialog = gnome_property_box_new(); + gnome_dialog_close_hides(GNOME_DIALOG(report_data->option_dialog), TRUE); - prop_box = GNOME_PROPERTY_BOX(rd->option_dialog); - gnc_build_options_dialog_contents(prop_box, rd->odb); + prop_box = GNOME_PROPERTY_BOX(report_data->option_dialog); + 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_FUNC(gnc_options_dialog_apply_cb), rd); + gtk_signal_connect(GTK_OBJECT(report_data->option_dialog), "apply", + GTK_SIGNAL_FUNC(gnc_options_dialog_apply_cb), + report_data); - gtk_signal_connect(GTK_OBJECT(rd->option_dialog), "help", - GTK_SIGNAL_FUNC(gnc_options_dialog_help_cb), rd); + gtk_signal_connect(GTK_OBJECT(report_data->option_dialog), "help", + GTK_SIGNAL_FUNC(gnc_options_dialog_help_cb), + report_data); } -static HTMLHistoryData +static HTMLData * reportAnchorCB(XmHTMLAnchorCallbackStruct *acbs, - HTMLHistoryData history_data) + HTMLUserData user_data) { switch(acbs->url_type) { @@ -201,25 +215,25 @@ reportAnchorCB(XmHTMLAnchorCallbackStruct *acbs, } 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; SCM text_scm; *set_text = NULL; *set_label = NULL; - if (rd->text != NULL) + if (report_data->text != NULL) { - *set_text = rd->text; + *set_text = report_data->text; return; } - if (!gh_procedure_p(rd->rendering_thunk)) + if (!gh_procedure_p(report_data->rendering_thunk)) return; - text_scm = gh_call0(rd->rendering_thunk); + text_scm = gh_call0(report_data->rendering_thunk); if (!gh_string_p(text_scm)) return; @@ -228,41 +242,42 @@ reportJumpCB(HTMLHistoryData history_data, char **set_text, char **set_label) if (text == NULL) return; - report_data_set_text(rd, text); + report_data_set_text(report_data, text); free(text); - *set_text = rd->text; + *set_text = report_data->text; } static void gnc_report_options_changed_cb(gpointer data) { - HTMLWindow *hw = data; - HTMLHistoryData hd; - ReportData *rd; + ReportData *report_data = data; + ReportData *real_data; - hd = gnc_html_window_history_data(hw); - if (hd == NULL) + if (report_data == NULL) return; - rd = (ReportData *) hd; - report_data_set_text(rd, NULL); + report_data_set_text(report_data, 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 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; - gtk_widget_show_all(rd->option_dialog); - gdk_window_raise(GTK_WIDGET(rd->option_dialog)->window); + gtk_widget_show_all(report_data->option_dialog); + gdk_window_raise(GTK_WIDGET(report_data->option_dialog)->window); } @@ -277,37 +292,38 @@ gnc_report_properties_cb(GtkWidget *widget, gpointer data) void reportWindow(const char *title, SCM rendering_thunk, SCM guile_options) { - ReportData *rd; + ReportData *report_data; + HTMLData *html_data; if (reportwindow == NULL) - reportwindow = gnc_html_window_new(report_data_destroy, reportAnchorCB, - reportJumpCB); + reportwindow = gnc_html_window_new(reportAnchorCB, reportJumpCB); - rd = report_data_new(); - report_data_set_rendering_thunk(rd, rendering_thunk); - report_data_set_guile_options(rd, guile_options); + report_data = report_data_new(); + report_data_set_rendering_thunk(report_data, rendering_thunk); + report_data_set_guile_options(report_data, guile_options); - if (rd->odb != NULL) - gnc_option_db_register_change_callback(rd->odb, + if (report_data->odb != NULL) + gnc_option_db_register_change_callback(report_data->odb, gnc_report_options_changed_cb, - reportwindow); + report_data); - if (rd->option_dialog != NULL) + if (report_data->option_dialog != NULL) { gchar *prop_title; - prop_title = g_strconcat(title, " (Parameters)", NULL); - gtk_window_set_title(GTK_WINDOW(rd->option_dialog), prop_title); + prop_title = g_strconcat(title, " (", PARAMETERS_STR, ")", NULL); + gtk_window_set_title(GTK_WINDOW(report_data->option_dialog), prop_title); g_free(prop_title); } + if (report_data->option_dialog != NULL) { GnomeUIInfo user_buttons[] = { { GNOME_APP_UI_ITEM, - "Properties", - "Set the properties for this report.", - gnc_report_properties_cb, rd, + PARAMETERS_STR, + TOOLTIP_REPORT_PARM, + gnc_report_properties_cb, report_data, NULL, GNOME_APP_PIXMAP_STOCK, 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); - 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); } diff --git a/src/scm/bootstrap.scm.in b/src/scm/bootstrap.scm.in index 46328007a7..59ea0558a9 100644 --- a/src/scm/bootstrap.scm.in +++ b/src/scm/bootstrap.scm.in @@ -7,6 +7,20 @@ ;; (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 separator "/") (define (bp first rest) diff --git a/src/scm/c-interface.scm b/src/scm/c-interface.scm index 1e4ef6f74d..d6324b4027 100644 --- a/src/scm/c-interface.scm +++ b/src/scm/c-interface.scm @@ -1,5 +1,5 @@ (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) ;; Not sure this has to be prime, and not sure how large it needs @@ -12,8 +12,10 @@ (hashv-set! pointer-storage id ptr) id)) - (define (unregister-c-side-scheme-ptr id) - (hashv-remove! pointer-storage id)) + (define (unregister-c-side-scheme-ptr-id 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:unregister-c-side-scheme-ptr unregister-c-side-scheme-ptr)) + (set! gnc:unregister-c-side-scheme-ptr-id unregister-c-side-scheme-ptr-id)) diff --git a/src/scm/prefs.scm b/src/scm/prefs.scm index eb2627b042..9d647fbc7f 100644 --- a/src/scm/prefs.scm +++ b/src/scm/prefs.scm @@ -64,12 +64,7 @@ ;; on success, and (#f "failure-message") on failure. If #t, ;; the supplied value will be used by the gui to set the option. value-validator - ;; permissible-values (multichoice options only) - ;; 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) + option-data) (vector section name sort-tag @@ -80,7 +75,7 @@ default-getter generate-restore-form value-validator - permissible-values)) + option-data)) (define (gnc:make-string-option section @@ -94,8 +89,9 @@ (lambda (x) (set! option x)) (lambda () default-value) #f - (lambda (x) (cond ((string? x)(list #t x)) - (else (list #f #f)))) + (lambda (x) + (cond ((string? x)(list #t x)) + (else (list #f "string-option: not a string")))) #f ))) (define (gnc:make-simple-boolean-option @@ -110,36 +106,105 @@ (lambda (x) (set! option x)) (lambda () default-value) #f - (lambda (x) (list #t x)) + (lambda (x) + (if (boolean? x) + (list #t x) + (list #f "boolean-option: not a boolean"))) #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 - 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 #f))) - ok-values))) +;; date options use the option-data as a boolean value. If true, +;; the gui should allow the time to be entered as well. +(define (gnc:make-date-option + section + name + sort-tag + documentation-string + default-getter + show-time) + (let ((option (default-getter))) + + (define (date-legal date) + (and (pair? date) (exact? (car date)) (exact? (cdr date)))) + + (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) (vector-ref option 0)) @@ -161,7 +226,7 @@ (vector-ref option 8)) (define (gnc:option-value-validator option) (vector-ref option 9)) -(define (gnc:option-permissible-values option) +(define (gnc:option-data option) (vector-ref option 10)) (define (gnc:register-option options new-option) @@ -308,6 +373,11 @@ "International" "Default Currency" "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:make-multichoice-option "Register" "Default Register Mode" diff --git a/src/scm/report/dummy.scm b/src/scm/report/dummy.scm index 2a434d30fb..23f9ef0e59 100644 --- a/src/scm/report/dummy.scm +++ b/src/scm/report/dummy.scm @@ -32,10 +32,41 @@ "Page Two" "String Option" "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) (let ((getter (gnc:option-getter op))) (getter))) + (define (account-list) + (let* ((accounts (op-value account-list-op)) + (names (map gnc:account-get-name accounts))) + (list "
    " + (map (lambda (name) (list "
  • " name "
  • ")) names) + "
"))) + (gnc:define-report ;; version 1 @@ -45,16 +76,26 @@ gnc:*dummy-options* ;; Rendering thunk. See report.scm for details. (lambda (options) - (list - "" - "" - "The current time is " (strftime "%c" (localtime (current-time))) "." - "
" - "The boolean op is " (if (op-value boolop) "true." "false.") - "
" - "The multi op is " (symbol->string (op-value multop)) - "
" - "The string op is " (op-value strop) - "" - ""))) + (let ((time-string (strftime "%c" (localtime (current-time)))) + (date-string (strftime "%x" (localtime (car (op-value dateop))))) + (date-string2 (strftime "%c" (localtime (car (op-value dateop2)))))) + (list + "" + "" + "The current time is " time-string "." + "
" + "The boolean op is " (if (op-value boolop) "true." "false.") + "
" + "The multi op is " (symbol->string (op-value multop)) + "
" + "The string op is " (op-value strop) + "
" + "The date op is " date-string + "
" + "The date and time op is " date-string2 + "
" + "The accounts are:" + (account-list) + "" + "")))) ) diff --git a/src/scm/report/transaction-report.scm b/src/scm/report/transaction-report.scm index e32b65a3bb..c305127912 100644 --- a/src/scm/report/transaction-report.scm +++ b/src/scm/report/transaction-report.scm @@ -1,22 +1,116 @@ ;; -*-scheme-*- - +;; transaction-report.scm +;; Report on all transactions in an account +;; Robert Merkel (rgmerk@mira.net) -;; something like -;; for(i = first; i < last; i+= step) { thunk(i);} +(use-modules (ice-9 slib)) +(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) (cond ((< first last) (thunk first) (gnc:for-loop thunk (+ first step) last step)) (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) (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))) + 0 (gnc:account-get-split-count account) 1)) (define (gnc:split-get-transaction-date split) (gnc:transaction-get-date-posted (gnc:split-get-parent split))) @@ -24,6 +118,37 @@ (define (gnc:split-get-description-from-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) (vector (gnc:split-get-memo split) (gnc:split-get-action split) @@ -32,38 +157,106 @@ (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)))) +(define (gnc:timepair-to-datestring tp) + (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 + "" + (gnc:timepair-to-datestring + (gnc:tr-report-get-date split-scm)) + "" + (gnc:tr-report-get-docref split-scm) + "" + (gnc:tr-report-get-description split-scm) + "" + (gnc:tr-report-get-memo split-scm) + "" + (cond ((null? other-splits) "") + ((= (length other-splits) 1) (caar other-splits)) + (else "Multi-split (not implemented yet)")) + "" + (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)))))) + ""))) + +;; hack alert - stub for testing + +(define (gnc:tr-report-get-starting-balance scm-split-list beginning-date) + 0) (gnc:define-report -;; version + ;; version 1 ;; Name "Account Transactions" ;; Options - #f + gnc:*transaction-report-options* ;; renderer (lambda (options) - (let ( (test-account (gnc:group-get-account (gnc:get-current-group) 0)) - (prefix (list "" "" "
"))
-	  (suffix  (list "
" "" "")) - (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) + (let* ((prefix (list "" "" "")) + (suffix (list "
" "" "")) + (report-lines '()) + (date-filter-pred (gnc:tr-report-make-filter-predicate + (op-value begindate) + (op-value enddate))) + (total-inflow 0) + (total-outflow 0) + (starting-balance 0) + (accounts (op-value tr-report-account-op)) + (html-mapper (lambda (split-scm) (gnc:tr-report-split-to-html + split-scm + total-inflow + total-outflow + starting-balance)))) + + (if (null? accounts) + (set! report-lines + (list "You have not selected an account.")) + (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)))) diff --git a/src/scm/report/transaction-report.scm.bif b/src/scm/report/transaction-report.scm.bif new file mode 100644 index 0000000000..e32b65a3bb --- /dev/null +++ b/src/scm/report/transaction-report.scm.bif @@ -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 "" "" "
"))
+	  (suffix  (list "
" "" "")) + (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)))) diff --git a/src/ui-callbacks.h b/src/ui-callbacks.h index a1f636bc55..18767d3161 100644 --- a/src/ui-callbacks.h +++ b/src/ui-callbacks.h @@ -28,8 +28,21 @@ #include +typedef enum +{ + GNC_VERIFY_NO, + GNC_VERIFY_YES, + GNC_VERIFY_CANCEL +} GNCVerifyResult; + + 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 yes_is_default ); void gnc_error_dialog( const char *message );