From fcf7f501cd74ccc7cfc76ce3a59d8852a9f52a9d Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Mon, 23 Oct 2000 22:39:27 +0000 Subject: [PATCH] PO: Move translatable strings from src/message_i18n.h into source files. Register: Use visibility flags to implement auto-modes instead of rebuilding the table. Make 'multi-line' an auto-mode where only the current transactions has a blank split line. Engine: Remove MoveFarEnd* cruft. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3073 57a11ea4-9604-0410-9ed3-97b8803252fd --- po/.cvsignore | 1 - po/Makefile.in.in | 18 +- po/POTFILES.in | 19 +- po/extract-macros.perl.in | 70 --- src/FileDialog.c | 16 +- src/Makefile.am | 1 - src/SplitLedger.c | 788 +++++++++---------------- src/engine/Account.c | 107 +--- src/engine/Scrub.c | 12 +- src/engine/io-gncbin-r.c | 2 +- src/gnc-exp-parser.c | 12 +- src/gnome/dialog-account.c | 18 +- src/gnome/dialog-budget.c | 2 +- src/gnome/dialog-filebox.c | 2 +- src/gnome/dialog-find-transactions.c | 4 +- src/gnome/dialog-options.c | 21 +- src/gnome/dialog-print-check.c | 4 +- src/gnome/dialog-totd.c | 18 +- src/gnome/dialog-transfer.c | 23 +- src/gnome/dialog-utils.c | 32 +- src/gnome/druid-qif-import.c | 7 +- src/gnome/file-history.c | 2 +- src/gnome/gnc-currency-edit.c | 6 +- src/gnome/gnc-datedelta.c | 12 +- src/gnome/print-session.c | 2 +- src/gnome/reconcile-list.c | 10 +- src/gnome/top-level.c | 68 +-- src/gnome/window-help.c | 5 +- src/gnome/window-html.c | 16 +- src/gnome/window-main.c | 123 ++-- src/gnome/window-reconcile.c | 117 ++-- src/gnome/window-register.c | 217 ++++--- src/gnome/window-report.c | 39 +- src/messages.h | 32 +- src/messages_i18n.h | 659 --------------------- src/register/basiccell.c | 2 - src/register/basiccell.h | 2 - src/register/cellblock.c | 4 +- src/register/cellblock.h | 4 +- src/register/gnome/gnucash-grid.c | 3 + src/register/gnome/gnucash-header.c | 8 +- src/register/gnome/gnucash-item-edit.c | 13 +- src/register/gnome/gnucash-sheet.c | 456 +++++--------- src/register/gnome/gnucash-sheet.h | 38 +- src/register/gnome/gnucash-style.c | 76 +-- src/register/gnome/gnucash-style.h | 4 +- src/register/pricecell.c | 2 + src/register/splitreg.c | 406 +++++++------ src/register/splitreg.h | 41 +- src/register/table-allgui.c | 88 +-- src/register/table-allgui.h | 14 +- src/register/table-gnome.c | 13 +- src/scm/prefs.scm | 82 +-- 53 files changed, 1351 insertions(+), 2390 deletions(-) delete mode 100644 po/extract-macros.perl.in delete mode 100644 src/messages_i18n.h diff --git a/po/.cvsignore b/po/.cvsignore index 86c6e4689c..4e0366b0e6 100644 --- a/po/.cvsignore +++ b/po/.cvsignore @@ -7,5 +7,4 @@ POTFILES cat-id-tbl.c pseudo-source.c stamp-cat-id -extract-macros.perl gnucash.pot diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 1a51872609..d75d0402c2 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -84,7 +84,7 @@ all: all-@USE_NLS@ all-yes: $(srcdir)/cat-id-tbl.c $(CATALOGS) all-no: -$(srcdir)/$(PACKAGE).pot: pseudo-source.c $(POTFILES) +$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ --add-comments --keyword=_ --keyword=N_ \ --files-from=$(srcdir)/POTFILES.in \ @@ -92,22 +92,6 @@ $(srcdir)/$(PACKAGE).pot: pseudo-source.c $(POTFILES) || ( rm -f $(srcdir)/$(PACKAGE).pot \ && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) -## We borrow guile's convention and use @-...-@ as the substitution -## brackets here, instead of the usual @...@. This prevents autoconf -## from substituting the values directly into the left-hand sides of -## the sed substitutions. *sigh* -extract-macros.perl: extract-macros.perl.in - rm -f $@.tmp - sed < $@.in > $@.tmp \ - -e 's:@-PACKAGE-@:${PACKAGE}:g' \ - -e 's:@-PERL-@:${PERL}:g' \ - -e 's:@-CPP-@:${CPP}:g' - chmod +x $@.tmp - mv $@.tmp $@ - -pseudo-source.c: $(top_srcdir)/src/messages_i18n.h extract-macros.perl - perl -s extract-macros.perl $< > $@ - $(srcdir)/cat-id-tbl.c: $(srcdir)/stamp-cat-id; @: $(srcdir)/stamp-cat-id: $(srcdir)/$(PACKAGE).pot rm -f cat-id-tbl.tmp diff --git a/po/POTFILES.in b/po/POTFILES.in index 0d9e2f0b58..1d94b51cab 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,18 +1,35 @@ # List of files which containing translatable strings. # Copyright (C) 1995, 1998 Free Software Foundation, Inc. -po/pseudo-source.c po/guile_strings.txt +src/engine/Account.c +src/engine/io-gncbin-r.c +src/engine/Scrub.c +src/gnc-exp-parser.c src/gnome/dialog-account.c src/gnome/dialog-account-picker.c +src/gnome/dialog-budget.c +src/gnome/dialog-commodity.c +src/gnome/dialog-filebox.c src/gnome/dialog-fincalc.c +src/gnome/dialog-options.c src/gnome/dialog-progress.c src/gnome/dialog-totd.c +src/gnome/dialog-transfer.c +src/gnome/dialog-utils.c +src/gnome/druid-commodity.c +src/gnome/druid-qif-import.c +src/gnome/file-history.c src/gnome/glade-gnc-dialogs.c +src/gnome/gnc-datedelta.c src/gnome/print-session.c +src/gnome/reconcile-list.c +src/gnome/window-html.c src/gnome/window-main.c src/gnome/window-reconcile.c src/gnome/window-register.c +src/gnome/window-report.c src/register/recncell.c +src/register/splitreg.c src/FileDialog.c src/SplitLedger.c diff --git a/po/extract-macros.perl.in b/po/extract-macros.perl.in deleted file mode 100644 index d3fbde8ff8..0000000000 --- a/po/extract-macros.perl.in +++ /dev/null @@ -1,70 +0,0 @@ -#!@-PERL-@ -w -s -# -# extract-macros.perl.in - Generate C file for input to xgettext -# Copyright (C) 1999 Laurent Pélecq -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Author: Laurent Pélecq -# Address: 71 rue de Bagnolet -# F-75020 Paris (France) - -# Begin variables set by configure - -$package_name="@-PACKAGE-@"; -$cpp="@-CPP-@"; - -# End variables set by configure - -sub usage { - my ($status)=@_; - print "usage:\t$0 ...\n"; - exit $status; -} - -usage 1 if $#ARGV==-1; - -$prefile="messages-i18n.c"; - -open(TMP, ">$prefile") || die "$prefile: can't open file\n"; - -select TMP; -printf "/* automatically generated by %s\n", $0; -printf " source files:\n"; -foreach $file (@ARGV) - { - printf " - %s\n", $file; - } -printf "*/\n\n"; -foreach $file (@ARGV) - { - printf "#include \"%s\"\n", $file; - } -printf "\n/* Strings for package %s */\n", $package_name; -printf "const char *all_strings[]={\n"; - -while(<>) - { - printf ("\t%s,\n", $1) if (/^#define\s+([A-Z0-9_]+)\s+_\(\"/); - printf ("\t_ %s,\n", $1) if (/^#define\s+([A-Z0-9_]+)\s+N_\(\"/); - } - -printf "\tNULL\n"; -printf "};\n"; -select STDOUT; -close (TMP); - -system ("$cpp -DHAVE_GETTEXT $prefile"); -unlink ($prefile); diff --git a/src/FileDialog.c b/src/FileDialog.c index 1325e6a3cd..0fe60ef047 100644 --- a/src/FileDialog.c +++ b/src/FileDialog.c @@ -131,7 +131,9 @@ show_session_error(Session *session, char *newfile) } else if (norr) { - buf = (FMB_INVALID_MSG, newfile); + const char *format = _("The filepath \n %s\n" + "is not a valid location in the filesystem."); + buf = g_strdup_printf (format, newfile); gnc_error_dialog (buf); uh_oh = TRUE; } @@ -377,7 +379,7 @@ gncFileOpen (void) if (!gncFileQuerySave ()) return; - newfile = fileBox( OPEN_STR, "*.gnc"); + newfile = fileBox(_("Open"), "*.gnc"); gncPostFileOpen (newfile); /* This dialogue can show up early in the startup process. @@ -435,13 +437,15 @@ gncFileSave (void) norr = xaccSessionGetError (current_session); if (norr) { + const char *format = _("There was an error writing the file\n %s" + "\n\n%s"); char *message; newfile = xaccSessionGetFilePath(current_session); if (newfile == NULL) newfile = ""; - message = g_strdup_printf(FILE_EWRITE_MSG, newfile, g_strerror(norr)); + message = g_strdup_printf(format, newfile, g_strerror(norr)); gnc_error_dialog(message); g_free(message); @@ -486,7 +490,7 @@ gncFileSaveAs (void) char * oldfile; gboolean uh_oh = FALSE; - filename = fileBox(SAVE_STR, "*.gnc"); + filename = fileBox(_("Save"), "*.gnc"); if (!filename) return; /* check to see if the user did something silly, @@ -554,10 +558,12 @@ gncFileSaveAs (void) /* oops ... file already exists ... ask user what to do... */ if(xaccSessionSaveMayClobberData(newsess)) { + const char *format = _("The file \n %s\n already exists.\n" + "Are you sure you want to overwrite it?"); char *tmpmsg; gboolean result; - tmpmsg = g_strdup_printf (FMB_EEXIST_MSG, newfile); + tmpmsg = g_strdup_printf (format, newfile); result = gnc_verify_dialog (tmpmsg, FALSE); g_free (tmpmsg); diff --git a/src/Makefile.am b/src/Makefile.am index 3d82066d1e..58a164ec61 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -61,7 +61,6 @@ noinst_HEADERS = \ gnc-exp-parser.h \ gnc-ui-common.h \ messages.h \ - messages_i18n.h \ top-level.h \ ui-callbacks.h diff --git a/src/SplitLedger.c b/src/SplitLedger.c index 31a4fd8433..2fbc94a128 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -208,7 +208,7 @@ static char account_separator = ':'; static SRReverseBalanceCallback reverse_balance = NULL; /* The copied split or transaction, if any */ -static CursorClass copied_class = CURSOR_NONE; +static CursorClass copied_class = CURSOR_CLASS_NONE; static SCM copied_item = SCM_UNDEFINED; static GUID copied_leader_guid; @@ -216,20 +216,26 @@ static GUID copied_leader_guid; /** static prototypes *****************************************************/ static Split * xaccSRGetTransSplit (SplitRegister *reg, - VirtualCellLocation vcell_loc); + VirtualCellLocation vcell_loc, + VirtualCellLocation *trans_split_loc); static gboolean xaccSRSaveRegEntryToSCM (SplitRegister *reg, SCM trans_scm, SCM split_scm, gboolean use_cut_semantics); static Transaction * xaccSRGetTrans (SplitRegister *reg, VirtualCellLocation vcell_loc); -static Split * xaccSRGetCurrentTransSplit (SplitRegister *reg); +static Split * xaccSRGetCurrentTransSplit (SplitRegister *reg, + VirtualCellLocation *vcell_loc); static GList * xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split); -static gboolean xaccSRGetTransSplitVirtLoc (SplitRegister *reg, - Transaction *trans, - Split *trans_split, Split *split, - VirtualCellLocation *vcell_loc); +static gboolean xaccSRFindTransSplit (SplitRegister *reg, + Transaction *trans, + Split *trans_split, Split *split, + VirtualCellLocation *vcell_loc); static Split * sr_get_split (SplitRegister *reg, VirtualCellLocation vcell_loc); +static void xaccSRSetTransVisible (SplitRegister *reg, + VirtualCellLocation vcell_loc, + gboolean visible, + gboolean only_blank_split); /** implementations *******************************************************/ @@ -460,21 +466,25 @@ gnc_find_split_in_trans_by_memo(Transaction *trans, const char *memo, * is a transaction used for currency checking. */ static Split * gnc_find_split_in_account_by_memo(Account *account, const char *memo, - Transaction *dest_trans, gboolean unit_price) { + Transaction *dest_trans, gboolean unit_price) +{ GList *slp; if (account == NULL) return NULL; for(slp = g_list_last(xaccAccountGetSplitList(account)); slp; - slp = slp->prev) { - Split *split = (Split *) slp->data; + slp = slp->prev) + { + Split *split = slp->data; Transaction *trans = xaccSplitGetParent(split); - split = gnc_find_split_in_trans_by_memo(trans, memo, dest_trans, unit_price); + split = gnc_find_split_in_trans_by_memo(trans, memo, dest_trans, + unit_price); if (split != NULL) return split; } + return NULL; } @@ -483,20 +493,23 @@ gnc_find_split_in_account_by_memo(Account *account, const char *memo, * in registers with a default leading account. The dest_trans is a * transaction used for currency checking. */ static Transaction * -gnc_find_trans_in_account_by_desc(Account *account, const char *description) { +gnc_find_trans_in_account_by_desc(Account *account, const char *description) +{ GList *slp; if (account == NULL) return NULL; for(slp = g_list_last(xaccAccountGetSplitList(account)); slp; - slp = slp->prev) { - Split *split = (Split *) slp->data; + slp = slp->prev) + { + Split *split = slp->data; Transaction *trans = xaccSplitGetParent(split); - if(safe_strcmp(description, xaccTransGetDescription(trans)) == 0) + if (safe_strcmp(description, xaccTransGetDescription(trans)) == 0) return trans; } + return NULL; } @@ -622,6 +635,7 @@ static void LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc) { VirtualLocation new_virt_loc = *p_new_virt_loc; + VirtualCellLocation old_trans_split_loc; SplitRegister *reg = table->user_data; SRInfo *info = xaccSRGetInfo(reg); Transaction *pending_trans = xaccTransLookup(&info->pending_trans_guid); @@ -638,7 +652,7 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc) /* The transaction we are coming from */ old_trans = xaccSRGetCurrentTrans (reg); - old_trans_split = xaccSRGetCurrentTransSplit (reg); + old_trans_split = xaccSRGetCurrentTransSplit (reg, &old_trans_split_loc); if (!info->hint_set_by_traverse) { @@ -649,7 +663,7 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc) new_split = sr_get_split(reg, new_virt_loc.vcell_loc); /* The split at the transaction line we are moving to */ - new_trans_split = xaccSRGetTransSplit(reg, new_virt_loc.vcell_loc); + new_trans_split = xaccSRGetTransSplit(reg, new_virt_loc.vcell_loc, NULL); } else { @@ -672,15 +686,21 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc) } /* redrawing the register can muck everything up */ - if (saved) { + if (saved) + { VirtualCellLocation vcell_loc; + info->cursor_hint_trans = new_trans; + info->cursor_hint_split = new_split; + info->cursor_hint_trans_split = new_trans_split; + info->cursor_hint_phys_col = -1; + xaccSRRedrawRegEntry (reg); /* if the split we were going to is still in the register, * then it may have moved. Find out where it is now. */ - if (xaccSRGetTransSplitVirtLoc (reg, new_trans, new_trans_split, - new_split, &vcell_loc)) + if (xaccSRFindTransSplit (reg, new_trans, new_trans_split, + new_split, &vcell_loc)) { VirtualCell *vcell; @@ -688,60 +708,44 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc) new_virt_loc.vcell_loc = vcell_loc; } + else + new_virt_loc.vcell_loc = reg->table->current_cursor_loc.vcell_loc; } gnc_table_find_close_valid_cell (table, &new_virt_loc, info->exact_traversal); *p_new_virt_loc = new_virt_loc; - PINFO ("after redraw %d %d \n", + PINFO ("after move %d %d \n", new_virt_loc.vcell_loc.virt_row, new_virt_loc.vcell_loc.virt_col); - reg->cursor_virt_row = new_virt_loc.vcell_loc.virt_row; + /* if the register was reloaded, then everything should be fine :) + * otherwise, we may need to change some visibility settings. */ + if (saved) + return; - /* if auto-expansion is enabled, we need to redraw the register - * to expand out the splits at the new location. We use the - * cursor_hint data members to tell the refresh routine where - * to go. */ + /* in the mult-line and dynamic modes, we need to hide the old + * and show the new. */ if (((REG_SINGLE_DYNAMIC == reg->style) || - (REG_DOUBLE_DYNAMIC == reg->style)) && + (REG_DOUBLE_DYNAMIC == reg->style) || + (REG_MULTI_LINE == reg->style)) && (old_trans_split != new_trans_split)) { - new_trans = xaccSRGetTrans(reg, new_virt_loc.vcell_loc); - info->cursor_hint_trans = new_trans; + xaccSRSetTransVisible (reg, old_trans_split_loc, FALSE, + REG_MULTI_LINE == reg->style); - new_trans_split = xaccSRGetTransSplit(reg, new_virt_loc.vcell_loc); - info->cursor_hint_trans_split = new_trans_split; + xaccSRSetTransVisible (reg, new_virt_loc.vcell_loc, TRUE, + REG_MULTI_LINE == reg->style); - new_split = sr_get_split (reg, new_virt_loc.vcell_loc); - info->cursor_hint_split = new_split; - - info->cursor_hint_phys_col = new_virt_loc.phys_col_offset; - - xaccRegisterRefresh (reg); - - /* indicate what row we should go to */ - *p_new_virt_loc = table->current_cursor_loc; - - info->cursor_hint_trans = xaccSRGetCurrentTrans (reg); - info->cursor_hint_split = xaccSRGetCurrentSplit (reg); - info->cursor_hint_trans_split = xaccSRGetCurrentTransSplit (reg); - info->cursor_hint_phys_col = -1; - - PINFO ("after dynamic %d %d stored val %d\n", - p_new_virt_loc->vcell_loc.virt_row, - p_new_virt_loc->vcell_loc.virt_col, - reg->cursor_virt_row); - } - else - { - info->cursor_hint_trans = new_trans; - info->cursor_hint_split = new_split; - info->cursor_hint_trans_split = new_trans_split; - info->cursor_hint_phys_col = -1; + gnc_table_refresh_gui (reg->table); } + info->cursor_hint_trans = new_trans; + info->cursor_hint_split = new_split; + info->cursor_hint_trans_split = new_trans_split; + info->cursor_hint_phys_col = -1; + info->hint_set_by_traverse = FALSE; } @@ -777,7 +781,7 @@ LedgerAutoCompletion(SplitRegister *reg, gncTableTraversalDir dir, switch (cursor_class) { - case CURSOR_TRANS: { + case CURSOR_CLASS_TRANS: { Transaction *auto_trans; GList *refresh_accounts; char *desc; @@ -881,7 +885,7 @@ LedgerAutoCompletion(SplitRegister *reg, gncTableTraversalDir dir, break; - case CURSOR_SPLIT: { + case CURSOR_CLASS_SPLIT: { char *memo, *fullname; gboolean unit_price; Split *auto_split; @@ -1024,7 +1028,7 @@ LedgerTraverse (Table *table, * transaction. */ info->cursor_hint_trans = trans; info->cursor_hint_split = split; - info->cursor_hint_trans_split = xaccSRGetCurrentTransSplit (reg); + info->cursor_hint_trans_split = xaccSRGetCurrentTransSplit (reg, NULL); info->cursor_hint_phys_col = -1; info->hint_set_by_traverse = TRUE; @@ -1045,10 +1049,12 @@ LedgerTraverse (Table *table, /* Ok, we are changing transactions and the current transaction has * changed. See what the user wants to do. */ - - result = gnc_verify_cancel_dialog_parented(xaccSRGetParent(reg), - TRANS_CHANGED_MSG, - GNC_VERIFY_YES); + { + const char *message = _("The current transaction has been changed.\n" + "Would you like to record it?"); + result = gnc_verify_cancel_dialog_parented(xaccSRGetParent(reg), + message, GNC_VERIFY_YES); + } switch (result) { @@ -1063,12 +1069,12 @@ LedgerTraverse (Table *table, break; new_split = sr_get_split(reg, virt_loc.vcell_loc); - trans_split = xaccSRGetTransSplit(reg, virt_loc.vcell_loc); + trans_split = xaccSRGetTransSplit(reg, virt_loc.vcell_loc, NULL); xaccSRCancelCursorTransChanges(reg); - if (xaccSRGetTransSplitVirtLoc (reg, new_trans, trans_split, - new_split, &vcell_loc)) + if (xaccSRFindTransSplit (reg, new_trans, trans_split, + new_split, &vcell_loc)) virt_loc.vcell_loc = vcell_loc; gnc_table_find_close_valid_cell (table, &virt_loc, @@ -1162,11 +1168,6 @@ xaccSRGetTrans (SplitRegister *reg, VirtualCellLocation vcell_loc) * transaction. Go back one row to find a split in the transaction. */ vcell_loc.virt_row--; - if ((0 > vcell_loc.virt_row) || (0 > vcell_loc.virt_col)) { - PERR ("bad row \n"); - return NULL; - } - split = sr_get_split (reg, vcell_loc); if (split == NULL) { PERR ("no parent \n"); @@ -1179,7 +1180,9 @@ xaccSRGetTrans (SplitRegister *reg, VirtualCellLocation vcell_loc) /* ======================================================== */ static Split * -xaccSRGetTransSplit (SplitRegister *reg, VirtualCellLocation vcell_loc) +xaccSRGetTransSplit (SplitRegister *reg, + VirtualCellLocation vcell_loc, + VirtualCellLocation *trans_split_loc) { CursorClass cursor_class; @@ -1190,8 +1193,13 @@ xaccSRGetTransSplit (SplitRegister *reg, VirtualCellLocation vcell_loc) { cursor_class = xaccSplitRegisterGetCursorClass (reg, vcell_loc); - if (cursor_class == CURSOR_TRANS) + if (cursor_class == CURSOR_CLASS_TRANS) + { + if (trans_split_loc) + *trans_split_loc = vcell_loc; + return sr_get_split (reg, vcell_loc); + } vcell_loc.virt_row--; @@ -1204,30 +1212,45 @@ xaccSRGetTransSplit (SplitRegister *reg, VirtualCellLocation vcell_loc) /* ======================================================== */ -static Split * -xaccSRGetCurrentTransSplit (SplitRegister *reg) +static void +xaccSRSetTransVisible (SplitRegister *reg, + VirtualCellLocation vcell_loc, + gboolean visible, + gboolean only_blank_split) +{ + CursorClass cursor_class; + + while (TRUE) + { + vcell_loc.virt_row++; + + cursor_class = xaccSplitRegisterGetCursorClass (reg, vcell_loc); + if (cursor_class != CURSOR_CLASS_SPLIT) + return; + + if (only_blank_split && sr_get_split (reg, vcell_loc)) + continue; + + gnc_table_set_virt_cell_visible (reg->table, vcell_loc, visible); + } +} + +/* ======================================================== */ + +static Split * +xaccSRGetCurrentTransSplit (SplitRegister *reg, + VirtualCellLocation *trans_split_loc) { - Split *split; CursorClass cursor_class; VirtualCellLocation vcell_loc; if (reg == NULL) return NULL; - split = xaccSRGetCurrentSplit (reg); - cursor_class = xaccSplitRegisterGetCurrentCursorClass (reg); - if (cursor_class == CURSOR_TRANS) - return split; - - /* Split is not associated with a transaction cursor. Assume it is a - * split of a multi-line transaction. Go back until we find one that - * is on a transaction cursor. */ vcell_loc = reg->table->current_cursor_loc.vcell_loc; while (TRUE) { - vcell_loc.virt_row--; - if ((0 > vcell_loc.virt_row) || (0 > vcell_loc.virt_col)) { PERR ("bad row \n"); return NULL; @@ -1235,8 +1258,14 @@ xaccSRGetCurrentTransSplit (SplitRegister *reg) cursor_class = xaccSplitRegisterGetCursorClass (reg, vcell_loc); - if (cursor_class == CURSOR_TRANS) + if (cursor_class == CURSOR_CLASS_TRANS) + { + if (trans_split_loc) + *trans_split_loc = vcell_loc; return sr_get_split (reg, vcell_loc); + } + + vcell_loc.virt_row--; } } @@ -1260,10 +1289,6 @@ xaccSRGetCurrentTrans (SplitRegister *reg) vcell_loc = reg->table->current_cursor_loc.vcell_loc; vcell_loc.virt_row --; - if ((0 > vcell_loc.virt_row) || (0 > vcell_loc.virt_col)) { - PERR ("bad row \n"); - return NULL; - } split = sr_get_split (reg, vcell_loc); @@ -1348,12 +1373,10 @@ xaccSRGetSplitAmountVirtLoc (SplitRegister *reg, Split *split, switch (cursor_class) { - case CURSOR_TRANS: + case CURSOR_CLASS_SPLIT: + case CURSOR_CLASS_TRANS: cell_type = (value >= 0.0) ? DEBT_CELL : CRED_CELL; break; - case CURSOR_SPLIT: - cell_type = (value >= 0.0) ? CRED_CELL : DEBT_CELL; - break; default: return FALSE; } @@ -1372,9 +1395,9 @@ xaccSRGetSplitAmountVirtLoc (SplitRegister *reg, Split *split, /* ======================================================== */ static gboolean -xaccSRGetTransSplitVirtLoc (SplitRegister *reg, Transaction *trans, - Split *trans_split, Split *split, - VirtualCellLocation *vcell_loc) +xaccSRFindTransSplit (SplitRegister *reg, Transaction *trans, + Split *trans_split, Split *split, + VirtualCellLocation *vcell_loc) { Table *table = reg->table; gboolean found_trans = FALSE; @@ -1398,7 +1421,7 @@ xaccSRGetTransSplitVirtLoc (SplitRegister *reg, Transaction *trans, if (t == trans) found_trans = TRUE; - if ((cursor_class == CURSOR_TRANS) && (s == trans_split)) + if ((cursor_class == CURSOR_CLASS_TRANS) && (s == trans_split)) found_trans_split = TRUE; if (found_trans && (s == split)) @@ -1437,7 +1460,7 @@ xaccSRDuplicateCurrent (SplitRegister *reg) split = xaccSRGetCurrentSplit(reg); trans = xaccSRGetCurrentTrans(reg); - trans_split = xaccSRGetCurrentTransSplit(reg); + trans_split = xaccSRGetCurrentTransSplit(reg, NULL); /* This shouldn't happen, but be paranoid. */ if (trans == NULL) @@ -1446,11 +1469,11 @@ xaccSRDuplicateCurrent (SplitRegister *reg) cursor_class = xaccSplitRegisterGetCurrentCursorClass (reg); /* Can't do anything with this. */ - if (cursor_class == CURSOR_NONE) + if (cursor_class == CURSOR_CLASS_NONE) return NULL; /* This shouldn't happen, but be paranoid. */ - if ((split == NULL) && (cursor_class == CURSOR_TRANS)) + if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS)) return NULL; changed = xaccSplitRegisterGetChangeFlag(reg); @@ -1464,11 +1487,12 @@ xaccSRDuplicateCurrent (SplitRegister *reg) * it before we can duplicate. Make sure the user wants to do that. */ if (changed) { + const char *message = _("The current transaction has been changed.\n" + "Would you like to record it?"); GNCVerifyResult result; result = gnc_ok_cancel_dialog_parented(xaccSRGetParent(reg), - TRANS_CHANGED_MSG, - GNC_VERIFY_OK); + message, GNC_VERIFY_OK); if (result == GNC_VERIFY_CANCEL) return NULL; @@ -1485,7 +1509,7 @@ xaccSRDuplicateCurrent (SplitRegister *reg) /* Ok, we are now ready to make the copy. */ - if (cursor_class == CURSOR_SPLIT) + if (cursor_class == CURSOR_CLASS_SPLIT) { Split *new_split; @@ -1569,11 +1593,11 @@ xaccSRCopyCurrentInternal (SplitRegister *reg, gboolean use_cut_semantics) cursor_class = xaccSplitRegisterGetCurrentCursorClass (reg); /* Can't do anything with this. */ - if (cursor_class == CURSOR_NONE) + if (cursor_class == CURSOR_CLASS_NONE) return; /* This shouldn't happen, but be paranoid. */ - if ((split == NULL) && (cursor_class == CURSOR_TRANS)) + if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS)) return; changed = xaccSplitRegisterGetChangeFlag(reg); @@ -1584,7 +1608,7 @@ xaccSRCopyCurrentInternal (SplitRegister *reg, gboolean use_cut_semantics) /* Ok, we are now ready to make the copy. */ - if (cursor_class == CURSOR_SPLIT) + if (cursor_class == CURSOR_CLASS_SPLIT) { /* We are on a split in an expanded transaction. Just copy the split. */ new_item = gnc_copy_split(split, use_cut_semantics); @@ -1666,11 +1690,11 @@ xaccSRCutCurrent (SplitRegister *reg) cursor_class = xaccSplitRegisterGetCurrentCursorClass (reg); /* Can't do anything with this. */ - if (cursor_class == CURSOR_NONE) + if (cursor_class == CURSOR_CLASS_NONE) return; /* This shouldn't happen, but be paranoid. */ - if ((split == NULL) && (cursor_class == CURSOR_TRANS)) + if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS)) return; changed = xaccSplitRegisterGetChangeFlag(reg); @@ -1681,7 +1705,7 @@ xaccSRCutCurrent (SplitRegister *reg) xaccSRCopyCurrentInternal(reg, TRUE); - if (cursor_class == CURSOR_SPLIT) + if (cursor_class == CURSOR_CLASS_SPLIT) xaccSRDeleteCurrentSplit(reg); else xaccSRDeleteCurrentTrans(reg); @@ -1700,13 +1724,13 @@ xaccSRPasteCurrent (SplitRegister *reg) Split *trans_split; Split *split; - if (copied_class == CURSOR_NONE) + if (copied_class == CURSOR_CLASS_NONE) return; split = xaccSRGetCurrentSplit(reg); trans = xaccSRGetCurrentTrans(reg); - trans_split = xaccSRGetCurrentTransSplit(reg); + trans_split = xaccSRGetCurrentTransSplit(reg, NULL); /* This shouldn't happen, but be paranoid. */ if (trans == NULL) @@ -1715,19 +1739,19 @@ xaccSRPasteCurrent (SplitRegister *reg) cursor_class = xaccSplitRegisterGetCurrentCursorClass (reg); /* Can't do anything with this. */ - if (cursor_class == CURSOR_NONE) + if (cursor_class == CURSOR_CLASS_NONE) return; /* This shouldn't happen, but be paranoid. */ - if ((split == NULL) && (cursor_class == CURSOR_TRANS)) + if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS)) return; - if (cursor_class == CURSOR_SPLIT) { + if (cursor_class == CURSOR_CLASS_SPLIT) { const char *message = _("You are about to overwrite an existing split.\n" "Are you sure you want to do that?"); gboolean result; - if (copied_class == CURSOR_TRANS) + if (copied_class == CURSOR_CLASS_TRANS) return; if (split != NULL) @@ -1763,7 +1787,7 @@ xaccSRPasteCurrent (SplitRegister *reg) int split_index; int num_splits; - if (copied_class == CURSOR_SPLIT) + if (copied_class == CURSOR_CLASS_SPLIT) return; if (split != blank_split) @@ -2080,7 +2104,7 @@ xaccSRCancelCursorTransChanges (SplitRegister *reg) /* ======================================================== */ -void +void xaccSRRedrawRegEntry (SplitRegister *reg) { Transaction *trans; @@ -2339,7 +2363,7 @@ xaccSRSaveRegEntry (SplitRegister *reg, gboolean do_commit) reg->table->current_cursor_loc.vcell_loc, xaccSplitGetGUID (split)); - trans_split = xaccSRGetCurrentTransSplit (reg); + trans_split = xaccSRGetCurrentTransSplit (reg, NULL); if ((info->cursor_hint_trans == trans) && (info->cursor_hint_trans_split == trans_split) && (info->cursor_hint_split == NULL)) @@ -2500,9 +2524,15 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split) refresh_accounts = g_list_prepend(refresh_accounts, new_acc); } else { + const char *format = _("You cannot transfer funds from the %s " + "account.\nIt does not have a matching " + "currency.\nTo transfer funds between " + "accounts with different currencies\n" + "you need an intermediate currency account.\n" + "Please see the GnuCash online manual."); char *message; - message = g_strdup_printf(REG_CURR_MSG, xaccAccountGetName(new_acc)); + message = g_strdup_printf(format, xaccAccountGetName(new_acc)); gnc_warning_dialog_parented(xaccSRGetParent(reg), message); g_free(message); @@ -2573,9 +2603,15 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split) refresh_accounts = g_list_prepend(refresh_accounts, new_acc); } else { + const char *format = _("You cannot transfer funds from the %s " + "account.\nIt does not have a matching " + "currency.\nTo transfer funds between " + "accounts with different currencies\n" + "you need an intermediate currency account.\n" + "Please see the GnuCash online manual."); char *message; - message = g_strdup_printf(REG_CURR_MSG, xaccAccountGetName(new_acc)); + message = g_strdup_printf(format, xaccAccountGetName(new_acc)); gnc_warning_dialog_parented(xaccSRGetParent(reg), message); g_free(message); @@ -2622,19 +2658,19 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split) "like to have recalculated?"); if (MOD_SHRS & changed) - radio_list[0] = g_strdup_printf("%s (%s)", SHARES_STR, CHANGED_STR); + radio_list[0] = g_strdup_printf("%s (%s)", _("Shares"), _("Changed")); else - radio_list[0] = g_strdup(SHARES_STR); + radio_list[0] = g_strdup(_("Shares")); if (MOD_PRIC & changed) - radio_list[1] = g_strdup_printf("%s (%s)", PRICE_STR, CHANGED_STR); + radio_list[1] = g_strdup_printf("%s (%s)", _("Price"), _("Changed")); else - radio_list[1] = g_strdup(PRICE_STR); + radio_list[1] = g_strdup(_("Price")); if (MOD_AMNT & changed) - radio_list[2] = g_strdup_printf("%s (%s)", VALUE_STR, CHANGED_STR); + radio_list[2] = g_strdup_printf("%s (%s)", _("Value"), _("Changed")); else - radio_list[2] = g_strdup(VALUE_STR); + radio_list[2] = g_strdup(_("Value")); if (!(MOD_PRIC & changed)) default_value = 1; @@ -2916,9 +2952,9 @@ xaccSRGetEntryHandler (gpointer vcell_data, short _cell_type, * or more splits, or whether there is only one ... */ s = xaccTransGetSplit (xaccSplitGetParent(split), 1); if (s) - name = g_strdup (SPLIT_STR); /* three or more */ + name = g_strdup (_("Split")); /* three or more */ else - name = g_strdup (""); /* none */ + name = g_strdup (""); /* none */ } return name; @@ -3001,265 +3037,59 @@ xaccSRGetFGColorHandler (gpointer vcell_data, short _cell_type, /* ======================================================== */ -static void -xaccSRCountRows (SplitRegister *reg, - Split **slist, - Transaction *find_trans, - Split *find_split, - Split *find_trans_split, - gboolean *ext_found_trans, - gboolean *ext_found_split, - gboolean *ext_found_trans_split, - gboolean *ext_on_blank_split) +G_INLINE_FUNC void +sr_add_transaction (SplitRegister *reg, + Transaction *trans, + Split *split, + CellBlock *lead_cursor, + gboolean visible_splits, + gboolean start_primary_color, + Split *find_split, + int *new_split_row, + VirtualCellLocation * vcell_loc); + +G_INLINE_FUNC void +sr_add_transaction (SplitRegister *reg, + Transaction *trans, + Split *split, + CellBlock *lead_cursor, + gboolean visible_splits, + gboolean start_primary_color, + Split *find_split, + int *new_split_row, + VirtualCellLocation * vcell_loc) { - SRInfo *info = xaccSRGetInfo(reg); - Split *blank_split = xaccSplitLookup(&info->blank_split_guid); - CellBlock *lead_cursor; - Transaction *trans; - Split *split; - Table *table; + Split *secondary; + int i = 0; - gboolean found_split = FALSE; - gboolean found_trans = FALSE; - gboolean found_trans_split = FALSE; - gboolean on_blank_split = FALSE; - gboolean did_expand = FALSE; - gboolean on_trans_split; - gboolean multi_line; - gboolean dynamic; + if (split == find_split) + *new_split_row = vcell_loc->virt_row; - SplitRegisterStyle style; - int save_cursor_virt_row; - int save_cell_row = -1; - int num_virt_rows; - int i; + gnc_table_set_vcell (reg->table, lead_cursor, xaccSplitGetGUID (split), + TRUE, start_primary_color, *vcell_loc); + vcell_loc->virt_row++; - table = reg->table; - style = reg->style; - multi_line = (REG_MULTI_LINE == style); - dynamic = ((REG_SINGLE_DYNAMIC == style) || (REG_DOUBLE_DYNAMIC == style)); - if ((REG_SINGLE_LINE == style) || (REG_SINGLE_DYNAMIC == style)) - lead_cursor = reg->single_cursor; - else - lead_cursor = reg->double_cursor; + do + { + secondary = xaccTransGetSplit (trans, i++); + if (secondary == NULL) + break; - /* save the current cursor location; if we can't find the - * requested transaction/split pair, we restore the - * cursor to this location when we are done. */ - save_cursor_virt_row = reg->cursor_virt_row; + if (secondary != split) + { + if (secondary == find_split) + *new_split_row = vcell_loc->virt_row; - /* save the current cell row offset */ - save_cell_row = table->current_cursor_loc.phys_row_offset; + gnc_table_set_vcell (reg->table, reg->split_cursor, + xaccSplitGetGUID (secondary), + visible_splits, TRUE, *vcell_loc); + vcell_loc->virt_row++; + } + } while (TRUE); - /* num_virt_rows is the number of cursors (including the header). */ - num_virt_rows = 1; - - /* Look for the transaction split */ - i=0; - if (slist) - split = slist[0]; - else - split = NULL; - - while (split) { - if (split == find_trans_split) - { - found_trans_split = TRUE; - break; - } - i++; - split = slist[i]; - } - - split = blank_split; - if ((split != NULL) && (split == find_trans_split)) - found_trans_split = TRUE; - - /* now count the rows */ - i=0; - if (slist) - split = slist[0]; - else - split = NULL; - - while (split) { - /* do not count the blank split */ - if (split != blank_split) { - gboolean do_expand; - - trans = xaccSplitGetParent(split); - - /* lets determine where to locate the cursor ... */ - on_trans_split = (find_trans_split == split); - - if (!found_split) { - /* Check to see if we find a perfect match */ - if (split == find_split) { - save_cursor_virt_row = num_virt_rows; - if (on_trans_split || !found_trans_split) - found_split = TRUE; - found_trans = TRUE; - } - /* Otherwise, check for a close match. This could happen - * if, e.g., we are collapsing from multi-line to single. */ - else if (on_trans_split) { - save_cursor_virt_row = num_virt_rows; - if (trans == find_trans) - found_trans = TRUE; - } - else if (!found_trans && (trans == find_trans)) { - save_cursor_virt_row = num_virt_rows; - found_trans = TRUE; - } - } - - /* if multi-line, then show all splits. If dynamic then - * show all splits only if this is the hot split. */ - do_expand = multi_line; - do_expand = do_expand || (dynamic && (split == find_trans_split)); - if (dynamic && !found_trans_split) - do_expand = do_expand || (trans == find_trans); - do_expand = do_expand && !did_expand; - - /* make sure we only expand once on dynamic */ - if (dynamic && do_expand) - did_expand = TRUE; - - if (do_expand) - { - Split * secondary; - int j = 0; - - /* add one row for a transaction */ - num_virt_rows++; - - /* Add a row for each split, minus one, plus one. - * Essentially, do the following: - * j = xaccTransCountSplits (trans); - * num_virt_rows += j; - * except that we also have to skip the transaction split. - * Thus, we need a real loop over the splits. - * The do..while will automaticaly put a blank (null) - * split at the end - */ - trans = xaccSplitGetParent (split); - j = 0; - do { - secondary = xaccTransGetSplit (trans, j); - if (secondary != split) { - - /* lets determine where to locate the cursor ... */ - if (!found_split) { - /* Check if we find a perfect match. We have to check - * the transaction in case the split is NULL (blank). */ - if ((secondary == find_split) && - (trans == find_trans)) { - save_cursor_virt_row = num_virt_rows; - if (on_trans_split || !found_trans_split) - found_split = TRUE; - found_trans = TRUE; - } - } - - num_virt_rows++; - } - j++; - } while (secondary); - } - else { - /* the simple case ... add one row for a transaction */ - num_virt_rows++; - } - } - i++; - split = slist[i]; - } - - /* ---------------------------------------------------------- */ - /* the "blank split", if it exists, is at the end */ - split = blank_split; - trans = xaccSplitGetParent(split); - - on_trans_split = (find_trans_split == split); - if (on_trans_split) - found_trans_split = TRUE; - - if (split != NULL) { - /* lets determine where to locate the cursor ... */ - if (!found_split && (split == find_split)) { - save_cursor_virt_row = num_virt_rows; - if (on_trans_split || !found_trans_split) - found_split = TRUE; - found_trans = TRUE; - on_blank_split = TRUE; - } - else if (!found_split && (trans == find_trans)) { - save_cursor_virt_row = num_virt_rows; - found_trans = TRUE; - on_blank_split = TRUE; - } - } - - if (multi_line || (dynamic && info->blank_split_edited)) { - if (multi_line || (dynamic && on_blank_split)) { - Split *secondary; - int j; - - /* The code below is copied from the main loop above */ - - /* add one row for a transaction */ - num_virt_rows++; - - /* add in the splits */ - trans = xaccSplitGetParent (split); - j = 0; - do { - secondary = xaccTransGetSplit (trans, j); - if (secondary != split) { - /* lets determine where to locate the cursor ... */ - if (!found_split) { - /* Check if we find a perfect match. We have to check - * the transaction in case the split is NULL (blank). */ - if ((secondary == find_split) && - (trans == find_trans)) { - save_cursor_virt_row = num_virt_rows; - if (on_trans_split || !found_trans_split) - found_split = TRUE; - found_trans = TRUE; - } - } - - num_virt_rows++; - } - j++; - } while (secondary); - } - else { - num_virt_rows += 1; - } - } - else { - num_virt_rows += 1; - } - - /* make sure we got a good cursor position */ - if (save_cursor_virt_row >= num_virt_rows) - save_cursor_virt_row = num_virt_rows - 1; - - if (save_cursor_virt_row < 1) - save_cursor_virt_row = 1; - - /* finally, record the values */ - reg->cursor_virt_row = save_cursor_virt_row; - - if (ext_found_trans != NULL) - *ext_found_trans = found_trans; - if (ext_found_split != NULL) - *ext_found_split = found_split; - if (ext_found_trans_split != NULL) - *ext_found_trans_split = found_trans_split; - if (ext_on_blank_split != NULL) - *ext_on_blank_split = on_blank_split; + gnc_table_set_vcell (reg->table, reg->split_cursor, + xaccSplitGetGUID (NULL), FALSE, TRUE, *vcell_loc); + vcell_loc->virt_row++; } /* ======================================================== */ @@ -3274,28 +3104,25 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, SplitRegisterBuffer *reg_buffer; CellBlock *lead_cursor; Transaction *find_trans; + Transaction *trans; Split *find_trans_split; Split *find_split; Split *split; Table *table; + gboolean start_primary_color = TRUE; gboolean found_pending = FALSE; - gboolean found_split = FALSE; - gboolean found_trans = FALSE; - gboolean found_trans_split = FALSE; gboolean found_divider = FALSE; - gboolean did_expand = FALSE; - gboolean on_blank_split; gboolean multi_line; gboolean dynamic; VirtualCellLocation vcell_loc; + VirtualLocation save_loc; - SplitRegisterType type; - SplitRegisterStyle style; guint32 changed; - int save_cell_col; - int save_cell_row; + int new_trans_split_row = -1; + int new_trans_row = -1; + int new_split_row = -1; time_t present; int i; @@ -3309,7 +3136,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, trans = xaccMallocTransaction (); xaccTransBeginEdit (trans, TRUE); - xaccTransSetDateSecs(trans, info->last_date_entered); + xaccTransSetDateSecs (trans, info->last_date_entered); xaccTransCommitEdit (trans); blank_split = xaccTransGetSplit (trans, 0); @@ -3321,12 +3148,14 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, info->default_source_account = default_source_acc; table = reg->table; - type = reg->type; - style = reg->style; - multi_line = (REG_MULTI_LINE == style); - dynamic = ((REG_SINGLE_DYNAMIC == style) || (REG_DOUBLE_DYNAMIC == style)); - if ((REG_SINGLE_LINE == style) || - (REG_SINGLE_DYNAMIC == style)) + + multi_line = (REG_MULTI_LINE == reg->style); + dynamic = ((REG_SINGLE_DYNAMIC == reg->style) || + (REG_DOUBLE_DYNAMIC == reg->style)); + + if ((REG_SINGLE_LINE == reg->style) || + (REG_SINGLE_DYNAMIC == reg->style) || + (REG_MULTI_LINE == reg->style)) lead_cursor = reg->single_cursor; else lead_cursor = reg->double_cursor; @@ -3336,20 +3165,12 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, find_split = info->cursor_hint_split; find_trans_split = info->cursor_hint_trans_split; - save_cell_row = table->current_cursor_loc.phys_row_offset; - save_cell_col = table->current_cursor_loc.phys_col_offset; + save_loc = table->current_cursor_loc; - /* count the number of rows, looking for the place we want to go. */ - xaccSRCountRows (reg, slist, - find_trans, find_split, find_trans_split, - &found_trans, &found_split, &found_trans_split, - &on_blank_split); - - /* If the current cursor has changed, and the 'current split' - * is still among the living, we save the values for later - * restoration. */ + /* If the current cursor has changed we save the values for later + * possible restoration. */ changed = xaccSplitRegisterGetChangeFlag(reg); - if (found_split && changed && (find_split == xaccSRGetCurrentSplit(reg))) + if (changed && find_split && (find_split == xaccSRGetCurrentSplit(reg))) { reg_buffer = xaccMallocSplitRegisterBuffer(); xaccSplitRegisterSaveCursor(reg, reg_buffer); @@ -3375,7 +3196,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, /* make sure that the header is loaded */ vcell_loc.virt_row = 0; vcell_loc.virt_col = 0; - gnc_table_set_vcell (table, reg->header, NULL, vcell_loc); + gnc_table_set_vcell (table, reg->header, NULL, TRUE, TRUE, vcell_loc); vcell_loc.virt_row++; /* get the current time and reset the dividing row */ @@ -3402,18 +3223,15 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, for (i = 0; split; i++, split = slist[i]) { - Transaction *trans; - gboolean do_expand; + trans = xaccSplitGetParent (split); - if (pending_trans == xaccSplitGetParent (split)) + if (pending_trans == trans) found_pending = TRUE; /* do not load the blank split */ if (split == blank_split) continue; - trans = xaccSplitGetParent (split); - if (info->show_present_divider && !found_divider && (present < xaccTransGetDate (trans))) @@ -3440,100 +3258,34 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, } } - /* if multi-line, then show all splits. If dynamic then - * show all splits only if this is the hot split. */ - do_expand = multi_line; - do_expand = do_expand || (dynamic && (split == find_trans_split)); - if (dynamic && !found_trans_split) - do_expand = do_expand || (trans == find_trans); + if (trans == find_trans) + new_trans_row = vcell_loc.virt_row; - if (dynamic && !found_trans && !found_trans_split && - (vcell_loc.virt_row == reg->cursor_virt_row)) - do_expand = TRUE; + if (split == find_trans_split) + new_trans_split_row = vcell_loc.virt_row; - /* make sure we only expand once on dynamic */ - do_expand = do_expand && !did_expand; + sr_add_transaction (reg, trans, split, lead_cursor, + multi_line, start_primary_color, + find_split, &new_split_row, &vcell_loc); - if (dynamic && do_expand) - did_expand = TRUE; - - if (do_expand) - { - Split * secondary; - int j = 0; - - gnc_table_set_vcell (table, reg->trans_cursor, - xaccSplitGetGUID (split), vcell_loc); - vcell_loc.virt_row++; - - /* loop over all of the splits in the transaction. The - * do..while will automatically put a blank (null) split - * at the end. */ - j = 0; - do - { - secondary = xaccTransGetSplit (trans, j); - - if (secondary != split) - { - gnc_table_set_vcell (table, reg->split_cursor, - xaccSplitGetGUID (secondary), - vcell_loc); - vcell_loc.virt_row++; - } - - j++; - } while (secondary); - } - else - { - /* the simple case ... */ - gnc_table_set_vcell (table, lead_cursor, - xaccSplitGetGUID (split), vcell_loc); - vcell_loc.virt_row++; - } + start_primary_color = !start_primary_color; } /* add the blank split at the end. */ split = blank_split; - if (pending_trans == xaccSplitGetParent(split)) + trans = xaccSplitGetParent (split); + if (pending_trans == trans) found_pending = TRUE; - if (multi_line || (dynamic && info->blank_split_edited)) - { - /* do the transaction row of the blank split */ - gnc_table_set_vcell (table, reg->trans_cursor, - xaccSplitGetGUID (split), vcell_loc); - vcell_loc.virt_row ++; + if (trans == find_trans) + new_trans_row = vcell_loc.virt_row; - if (multi_line || (dynamic && on_blank_split)) - { - Transaction *trans; - Split *secondary; - int j; + if (split == find_trans_split) + new_trans_split_row = vcell_loc.virt_row; - trans = xaccSplitGetParent (split); - j = 0; - do { - secondary = xaccTransGetSplit (trans, j); - - if (secondary != split) - { - gnc_table_set_vcell (table, reg->split_cursor, - xaccSplitGetGUID (secondary), vcell_loc); - vcell_loc.virt_row ++; - } - - j++; - } while (secondary); - } - } - else - { - gnc_table_set_vcell (table, lead_cursor, - xaccSplitGetGUID (split), vcell_loc); - vcell_loc.virt_row ++; - } + sr_add_transaction (reg, trans, split, lead_cursor, + multi_line, start_primary_color, + find_split, &new_split_row, &vcell_loc); /* resize the table to the sizes we just counted above */ /* num_virt_cols is always one. */ @@ -3541,27 +3293,37 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, /* restore the cursor to its rightful position */ { - VirtualLocation v_loc; + VirtualLocation trans_split_loc; + Split *trans_split; - v_loc.vcell_loc.virt_row = reg->cursor_virt_row; - v_loc.vcell_loc.virt_col = 0; - v_loc.phys_row_offset = save_cell_row; - v_loc.phys_col_offset = save_cell_col; + if (new_split_row > 0) + save_loc.vcell_loc.virt_row = new_split_row; + else if (new_trans_split_row > 0) + save_loc.vcell_loc.virt_row = new_trans_split_row; + else if (new_trans_row > 0) + save_loc.vcell_loc.virt_row = new_trans_row; - if (gnc_table_find_close_valid_cell (table, &v_loc, FALSE)) + trans_split_loc = save_loc; + + trans_split = xaccSRGetTransSplit (reg, save_loc.vcell_loc, + &trans_split_loc.vcell_loc); + if (dynamic || multi_line) + xaccSRSetTransVisible (reg, trans_split_loc.vcell_loc, TRUE, multi_line); + else + save_loc = trans_split_loc; + + if (gnc_table_find_close_valid_cell (table, &save_loc, FALSE)) { - gnc_table_move_cursor_gui(table, v_loc); - reg->cursor_virt_row = v_loc.vcell_loc.virt_row; + gnc_table_move_cursor_gui(table, save_loc); + new_split_row = save_loc.vcell_loc.virt_row; - if (reg_buffer != NULL) + if (changed && find_split && (find_split == xaccSRGetCurrentSplit(reg))) xaccSplitRegisterRestoreCursorChanged(reg, reg_buffer); } if (reg_buffer != NULL) - { xaccDestroySplitRegisterBuffer(reg_buffer); - reg_buffer = NULL; - } + reg_buffer = NULL; } /* If we didn't find the pending transaction, it was removed @@ -3578,7 +3340,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, /* Set up the hint transaction, split, transaction split, and column. */ info->cursor_hint_trans = xaccSRGetCurrentTrans (reg); info->cursor_hint_split = xaccSRGetCurrentSplit (reg); - info->cursor_hint_trans_split = xaccSRGetCurrentTransSplit (reg); + info->cursor_hint_trans_split = xaccSRGetCurrentTransSplit (reg, NULL); info->cursor_hint_phys_col = -1; info->hint_set_by_traverse = FALSE; info->exact_traversal = FALSE; diff --git a/src/engine/Account.c b/src/engine/Account.c index bce8afd982..a1dbb4c276 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -22,14 +22,10 @@ * * \********************************************************************/ -#include -#include - #include "config.h" -#define DISABLE_GETTEXT_UNDERSCORE /* required to include messages.h */ -#include "messages.h" -#undef DISABLE_GETTEXT_UNDERSCORE /* do we want this? */ +#include +#include #include "Account.h" #include "AccountP.h" @@ -829,73 +825,6 @@ xaccAccountRecomputeBalances( Account **list ) /********************************************************************\ \********************************************************************/ -void -xaccMoveFarEnd (Split *split, Account *new_acc) -{ - Split *partner_split = 0x0; - Transaction *trans; - Account * acc; - int numsplits = 0; - - if (!split) return; - - /* if the transaction has two splits, then the "far end" - * is the other one. Otherwise, far end is undefined. - * If the new destination does not match the current dest, - * then move the far end of the split to the new location. - */ - trans = (Transaction *) (split->parent); - assert (trans); - assert (trans->splits); - - numsplits = xaccCountSplits (trans->splits); - if (2 < numsplits) return; - - if (split == trans->splits[0]) { - partner_split = trans->splits [1]; - } else - - if (split == trans->splits[1]) { - partner_split = trans->splits [0]; - } else - - if (new_acc) { - /* Gosh, the far end doesn't exist! create it! */ - partner_split = xaccMallocSplit (); - xaccTransAppendSplit (trans, partner_split); - xaccAccountInsertSplit (new_acc, partner_split); - return; - } else { - /* no partner split, AND no far-end accouont. return */ - return; - } - - /* move the partner split from the old account to the new */ - acc = (Account *) (partner_split->acc); - if (acc != new_acc) { - xaccAccountInsertSplit (new_acc, partner_split); - } -} - -/********************************************************************\ -\********************************************************************/ - -void -xaccMoveFarEndByName (Split *split, const char *new_acc_name) -{ - Account *acc; - - if (!split) return; - if (0 == strcmp (SPLIT_STR, new_acc_name)) return; - - acc = (Account *) split->acc; - acc = xaccGetPeerAccountFromName (acc, new_acc_name); - xaccMoveFarEnd (split, acc); -} - -/********************************************************************\ -\********************************************************************/ - void xaccAccountSetType (Account *acc, int tip) { @@ -1424,22 +1353,22 @@ xaccAccountStringToType(const char* str, int *type) { static char * account_type_name[NUM_ACCOUNT_TYPES] = { - BANK_STR, - CASH_STR, - ASSET_STR, - CREDIT_CARD_STR, - LIABILITY_STR, - STOCK_STR, - MUTUAL_FUND_STR, - CURRENCY_STR, - INCOME_STR, - EXPENSE_STR, - EQUITY_STR + N_("Bank"), + N_("Cash"), + N_("Asset"), + N_("Credit Card"), + N_("Liability"), + N_("Stock"), + N_("Mutual Fund"), + N_("Currency"), + N_("Income"), + N_("Expense"), + N_("Equity") /* - CHECKING_STR, - SAVINGS_STR, - MONEYMRKT_STR, - CREDITLINE_STR + N_("Checking"), + N_("Savings"), + N_("Money Market"), + N_("Credit Line") */ }; @@ -1447,7 +1376,7 @@ char * xaccAccountGetTypeStr(int type) { if (0 > type) return ""; if (NUM_ACCOUNT_TYPES <= type) return ""; - return gettext (account_type_name [type]); + return _(account_type_name [type]); } /********************************************************************\ diff --git a/src/engine/Scrub.c b/src/engine/Scrub.c index 5c1a615eac..1b6139c985 100644 --- a/src/engine/Scrub.c +++ b/src/engine/Scrub.c @@ -68,10 +68,6 @@ xaccAccountTreeScrubOrphans (Account *acc) xaccAccountScrubOrphans (acc); } -#ifndef ORPHAN_STR -# define ORPHAN_STR "Orphan" -#endif - void xaccAccountScrubOrphans (Account *acc) { GList *slp; @@ -93,7 +89,7 @@ xaccAccountScrubOrphans (Account *acc) { Account *orph; DEBUG ("Found an orphan \n"); /* OK, we found an orphan. Put it in an orphan account. */ - orph = GetOrMakeAccount (acc, trans, ORPHAN_STR); + orph = GetOrMakeAccount (acc, trans, _("Orphan")); xaccAccountBeginEdit (orph); xaccAccountInsertSplit (orph, tsplit); xaccAccountCommitEdit (orph); @@ -125,10 +121,6 @@ xaccAccountTreeScrubImbalance (Account *acc) xaccAccountScrubImbalance (acc); } -#ifndef IMBALANCE_STR -# define IMBALANCE_STR "Imbalance" -#endif - void xaccAccountScrubImbalance (Account *acc) { GList *slp; @@ -146,7 +138,7 @@ xaccAccountScrubImbalance (Account *acc) { Account *orph; DEBUG ("Found imbalance of %g\n", imbalance); /* OK, we found an imbalanced trans. Put it in the imbal account. */ - orph = GetOrMakeAccount (acc, trans, IMBALANCE_STR); + orph = GetOrMakeAccount (acc, trans, _("Imbalance")); /* put split into account before setting split value */ splat = xaccMallocSplit(); diff --git a/src/engine/io-gncbin-r.c b/src/engine/io-gncbin-r.c index 813eca6b5b..f54ac21d90 100644 --- a/src/engine/io-gncbin-r.c +++ b/src/engine/io-gncbin-r.c @@ -419,7 +419,7 @@ xaccReadAccountGroup(int fd) /* create a lost account, put the missing accounts there */ acc = xaccMallocAccount(); xaccAccountBeginEdit (acc); - xaccAccountSetName (acc, LOST_ACC_STR); + xaccAccountSetName (acc, _("Lost Accounts")); acc -> children = holder; xaccAccountCommitEdit (acc); xaccGroupInsertAccount (grp, acc); diff --git a/src/gnc-exp-parser.c b/src/gnc-exp-parser.c index 0aa42932b7..d074d25ab1 100644 --- a/src/gnc-exp-parser.c +++ b/src/gnc-exp-parser.c @@ -424,16 +424,16 @@ gnc_exp_parser_error_string (void) case PARSER_NO_ERROR: return NULL; case UNBALANCED_PARENS: - return PARSER_UNBALANCED_PARENS; + return _("Unbalanced parenthesis"); case STACK_OVERFLOW: - return PARSER_STACK_OVERFLOW; + return _("Stack overflow"); case STACK_UNDERFLOW: - return PARSER_STACK_OVERFLOW; + return _("Stack underflow"); case UNDEFINED_CHARACTER: - return PARSER_UNDEFINED_CHARACTER; + return _("Undefined character"); case NOT_A_VARIABLE: - return PARSER_NOT_A_VARIABLE; + return _("Not a variable"); case PARSER_OUT_OF_MEMORY: - return PARSER_OUT_OF_MEMORY_STR; + return _("Out of memory"); } } diff --git a/src/gnome/dialog-account.c b/src/gnome/dialog-account.c index cd08412b6f..cc6bda2d13 100644 --- a/src/gnome/dialog-account.c +++ b/src/gnome/dialog-account.c @@ -593,10 +593,10 @@ extra_change_verify(AccountWindow *aw, account = aw->account; - titles[0] = ACCOUNT_STR; - titles[1] = FIELD_STR; - titles[2] = OLD_VALUE_STR; - titles[3] = NEW_VALUE_STR; + titles[0] = _("Account"); + titles[1] = _("Field"); + titles[2] = _("Old Value"); + titles[3] = _("New Value"); titles[4] = NULL; list = GTK_CLIST(gtk_clist_new_with_titles(4, titles)); @@ -624,7 +624,7 @@ extra_change_verify(AccountWindow *aw, GtkWidget *frame; GtkWidget *vbox; - dialog = gnome_dialog_new(VERIFY_CHANGES_STR, + dialog = gnome_dialog_new(_("Verify Changes"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); @@ -638,7 +638,7 @@ extra_change_verify(AccountWindow *aw, vbox = GNOME_DIALOG(dialog)->vbox; - label = gtk_label_new(VERIFY_CHANGE_MSG); + label = gtk_label_new(_("The following changes must be made. Continue?")); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); frame = gtk_frame_new(NULL); @@ -979,7 +979,7 @@ gnc_account_window_help_cb(GtkWidget *widget, gpointer data) return; } - helpWindow(NULL, HELP_STR, help_file); + helpWindow(NULL, NULL, help_file); } @@ -1229,7 +1229,7 @@ gnc_account_window_create(AccountWindow *aw) box = gtk_object_get_data(awo, "parent_scroll"); aw->top_level_account = xaccMallocAccount(); - xaccAccountSetName(aw->top_level_account, NEW_TOP_ACCT_STR); + xaccAccountSetName(aw->top_level_account, _("New top level account")); aw->parent_tree = gnc_account_tree_new_with_root(aw->top_level_account); gtk_clist_column_titles_hide(GTK_CLIST(aw->parent_tree)); @@ -1303,7 +1303,7 @@ gnc_edit_window_set_name(AccountWindow *aw) char *title; fullname = xaccAccountGetFullName(aw->account, gnc_get_account_separator()); - title = g_strconcat(fullname, " - ", EDIT_ACCT_STR, NULL); + title = g_strconcat(fullname, " - ", _("Edit Account"), NULL); free(fullname); diff --git a/src/gnome/dialog-budget.c b/src/gnome/dialog-budget.c index 246c759160..360b964f07 100644 --- a/src/gnome/dialog-budget.c +++ b/src/gnome/dialog-budget.c @@ -238,7 +238,7 @@ string_to_description(char *string, gboolean no_blank) if ((string == NULL) || (*string == '\0')) { if (no_blank) - return g_strconcat("<", NO_DESC_STR, ">", NULL); + return g_strconcat("<", _("No description"), ">", NULL); else return g_strdup(""); } diff --git a/src/gnome/dialog-filebox.c b/src/gnome/dialog-filebox.c index 150c5bd9df..b762c4e72f 100644 --- a/src/gnome/dialog-filebox.c +++ b/src/gnome/dialog-filebox.c @@ -73,7 +73,7 @@ fileBox(const char * title, const char * filter) /* Set a default title if nothing was passed in */ if (title == NULL) - title = OPEN_STR; + title = _("Open"); if (fb_info.file_name != NULL) g_free(fb_info.file_name); diff --git a/src/gnome/dialog-find-transactions.c b/src/gnome/dialog-find-transactions.c index 078c9f2ec5..8a98c6910e 100644 --- a/src/gnome/dialog-find-transactions.c +++ b/src/gnome/dialog-find-transactions.c @@ -31,7 +31,7 @@ #include #include "top-level.h" -#include "messages_i18n.h" +#include "messages.h" #include "ui-callbacks.h" #include "RegWindow.h" #include "window-register.h" @@ -268,7 +268,7 @@ gnc_ui_find_transactions_dialog_cancel_cb(GtkButton * button, void gnc_ui_find_transactions_dialog_help_cb(GtkButton * button, gpointer user_data) { - helpWindow(NULL, HELP_STR, HH_FIND_TRANSACTIONS); + helpWindow(NULL, NULL, HH_FIND_TRANSACTIONS); } diff --git a/src/gnome/dialog-options.c b/src/gnome/dialog-options.c index c89165f56d..818586bdc8 100644 --- a/src/gnome/dialog-options.c +++ b/src/gnome/dialog-options.c @@ -629,14 +629,15 @@ default_button_cb(GtkButton *button, gpointer data) static GtkWidget * gnc_option_create_default_button(GNCOption *option, GtkTooltips *tooltips) { - GtkWidget *default_button = gtk_button_new_with_label(SET_TO_DEFAULT_STR); + GtkWidget *default_button = gtk_button_new_with_label(_("Set to default")); gtk_container_set_border_width(GTK_CONTAINER(default_button), 2); gtk_signal_connect(GTK_OBJECT(default_button), "clicked", GTK_SIGNAL_FUNC(default_button_cb), option); - gtk_tooltips_set_tip(tooltips, default_button, TOOLTIP_SET_DEFAULT, NULL); + gtk_tooltips_set_tip(tooltips, default_button, + _("Set the option to its default value"), NULL); return default_button; } @@ -972,14 +973,14 @@ gnc_option_create_account_widget(GNCOption *option, char *name) if (multiple_selection) { - button = gtk_button_new_with_label(SELECT_ALL_STR); + button = gtk_button_new_with_label(_("Select All")); 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); + button = gtk_button_new_with_label(_("Clear All")); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", @@ -987,7 +988,7 @@ gnc_option_create_account_widget(GNCOption *option, char *name) option); } - button = gtk_button_new_with_label(SELECT_DEFAULT_STR); + button = gtk_button_new_with_label(_("Select Default")); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", @@ -1126,21 +1127,21 @@ gnc_option_create_list_widget(GNCOption *option, char *name) gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start(GTK_BOX(hbox), bbox, FALSE, FALSE, 10); - button = gtk_button_new_with_label(SELECT_ALL_STR); + button = gtk_button_new_with_label(_("Select All")); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gnc_option_list_select_all_cb), option); - button = gtk_button_new_with_label(CLEAR_ALL_STR); + button = gtk_button_new_with_label(_("Clear All")); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gnc_option_list_clear_all_cb), option); - button = gtk_button_new_with_label(SELECT_DEFAULT_STR); + button = gtk_button_new_with_label(_("Select Default")); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", @@ -1653,7 +1654,7 @@ static void gnc_options_dialog_help_cb(GnomePropertyBox *propertybox, gint arg1, gpointer user_data) { - helpWindow(NULL, HELP_STR, HH_GLOBPREFS); + helpWindow(NULL, NULL, HH_GLOBPREFS); } /* Options dialog... this should house all of the config options */ @@ -1688,7 +1689,7 @@ gnc_show_options_dialog(void) gnc_build_options_dialog_contents(options_dialog, global_options); gnc_option_db_clean(global_options); - gtk_window_set_title(GTK_WINDOW(options_dialog), GNC_PREFS); + gtk_window_set_title(GTK_WINDOW(options_dialog), _("GnuCash Preferences")); gtk_signal_connect(GTK_OBJECT(options_dialog), "apply", GTK_SIGNAL_FUNC(gnc_options_dialog_apply_cb), diff --git a/src/gnome/dialog-print-check.c b/src/gnome/dialog-print-check.c index 870820c57d..56985da537 100644 --- a/src/gnome/dialog-print-check.c +++ b/src/gnome/dialog-print-check.c @@ -29,7 +29,7 @@ #include #include "top-level.h" -#include "messages_i18n.h" +#include "messages.h" #include "dialog-print-check.h" #include "dialog-utils.h" #include "window-help.h" @@ -250,6 +250,6 @@ gnc_ui_print_check_dialog_cancel_cb(GtkButton * button, void gnc_ui_print_check_dialog_help_cb(GtkButton * button, gpointer user_data) { - helpWindow(NULL, HELP_STR, HH_PRINTCHECK); + helpWindow(NULL, NULL, HH_PRINTCHECK); } diff --git a/src/gnome/dialog-totd.c b/src/gnome/dialog-totd.c index 795c211db5..4b90f13a61 100644 --- a/src/gnome/dialog-totd.c +++ b/src/gnome/dialog-totd.c @@ -85,7 +85,7 @@ static GtkWidget * gnc_ui_totd_dialog_create(void) { char *new_hint; - win = gnome_dialog_new(TOTD_STR, + win = gnome_dialog_new(_("Tip of the Day:"), GNOME_STOCK_BUTTON_PREV, GNOME_STOCK_BUTTON_NEXT, GNOME_STOCK_BUTTON_CLOSE, @@ -100,7 +100,8 @@ gnc_ui_totd_dialog_create(void) gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), GTK_POLICY_NEVER, GTK_POLICY_NEVER); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(win)->vbox), scrollwin, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(win)->vbox), + scrollwin, TRUE, TRUE, 0); canvas = gnome_canvas_new(); gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0.0,0.0,width,height); @@ -115,11 +116,14 @@ gnc_ui_totd_dialog_create(void) old_enabled = gnc_lookup_boolean_option("General", "Display \"Tip of the Day\"", TRUE); - disable_cb = gtk_check_button_new_with_label(DISPLAY_NEXT_TIME_STR); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (disable_cb), - old_enabled); + { + const char *message = _("Display this dialog next time"); + disable_cb = gtk_check_button_new_with_label(message); + } + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (disable_cb), old_enabled); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(win)->vbox), disable_cb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(win)->vbox), + disable_cb, TRUE, TRUE, 0); gtk_widget_show(disable_cb); gnome_dialog_button_connect(GNOME_DIALOG(win), 0, @@ -302,7 +306,7 @@ draw_on_canvas(GtkWidget *canvas, char *hint) "y",(double)25.0, "fill_color","white", "font",_("-*-helvetica-bold-r-normal-*-*-180-*-*-p-*-*-*"), - "text",TOTD_STR, + "text",_("Tip of the Day:"), NULL); grow_text_if_necessary(); diff --git a/src/gnome/dialog-transfer.c b/src/gnome/dialog-transfer.c index 09799df3f3..5057dd9109 100644 --- a/src/gnome/dialog-transfer.c +++ b/src/gnome/dialog-transfer.c @@ -89,6 +89,7 @@ gnc_xfer_dialog_fill_tree_frame(XferDialog *xferData, XferDirection direction, GtkTooltips *tooltips) { + const char *show_inc_exp_message = _("Show the income and expense accounts"); GNCAccountTree *atree; GtkWidget *scroll_win; GtkWidget *button; @@ -140,7 +141,7 @@ gnc_xfer_dialog_fill_tree_frame(XferDialog *xferData, xferData->from_show_button = button; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); - gtk_tooltips_set_tip(tooltips, button, SHOW_INC_EXP_MSG, NULL); + gtk_tooltips_set_tip(tooltips, button, show_inc_exp_message, NULL); gtk_signal_connect(GTK_OBJECT(button), "toggled", GTK_SIGNAL_FUNC(gnc_xfer_dialog_toggle_cb), tree); @@ -157,7 +158,8 @@ gnc_parse_error_dialog (XferDialog *xferData) if (error_string == NULL) error_string = ""; - error_phrase = g_strdup_printf(ERROR_IN_AMOUNT, error_string); + error_phrase = g_strdup_printf(_("You must enter a valid amount.\n\n" + "Error: %s."), error_string); gnc_error_dialog_parented(GTK_WINDOW(xferData->dialog), error_phrase); @@ -321,19 +323,30 @@ gnc_xfer_dialog_ok_cb(GtkWidget * widget, gpointer data) if ((from == NULL) || (to == NULL)) { - gnc_error_dialog_parented(GTK_WINDOW(xferData->dialog), XFER_NO_ACC_MSG); + const char *message = _("You must specify an account to transfer from,\n" + "or to, or both, for this transaction.\n" + "Otherwise, it will not be recorded."); + gnc_error_dialog_parented(GTK_WINDOW(xferData->dialog), message); return; } if (from == to) { - gnc_error_dialog_parented(GTK_WINDOW(xferData->dialog), XFER_SAME_MSG); + const char *message = _("You can't transfer from and to the same " + "account!"); + gnc_error_dialog_parented(GTK_WINDOW(xferData->dialog), message); return; } if (!xaccAccountsHaveCommonCurrency(from, to)) { - gnc_error_dialog_parented(GTK_WINDOW(xferData->dialog), XFER_CURR_MSG); + const char *message = _("You cannot transfer between those accounts.\n" + "They do not have a common currency.\n" + "To transfer funds between " + "accounts with different currencies you\n" + "need an intermediate currency account.\n" + "Please see the GnuCash online manual"); + gnc_error_dialog_parented(GTK_WINDOW(xferData->dialog), message); return; } diff --git a/src/gnome/dialog-utils.c b/src/gnome/dialog-utils.c index 5d3c1543c3..a4d1986ec0 100644 --- a/src/gnome/dialog-utils.c +++ b/src/gnome/dialog-utils.c @@ -45,7 +45,7 @@ gnc_get_source_name(gint source) switch (source) { case SOURCE_NONE : - return NONE_STR; + return _("(none)"); case SOURCE_YAHOO : return "Yahoo"; case SOURCE_YAHOO_EUROPE : @@ -174,37 +174,37 @@ gnc_ui_get_account_field_name(int field) switch (field) { case ACCOUNT_TYPE : - return TYPE_STR; + return _("Type"); break; case ACCOUNT_NAME : - return ACC_NAME_STR; + return _("Account Name"); break; case ACCOUNT_CODE : - return ACC_CODE_STR; + return _("Account Code"); break; case ACCOUNT_DESCRIPTION : - return DESC_STR; + return _("Description"); break; case ACCOUNT_NOTES : - return NOTES_STR; + return _("Notes"); break; case ACCOUNT_CURRENCY : - return CURRENCY_STR; + return _("Currency"); break; case ACCOUNT_SECURITY : - return SECURITY_STR; + return _("Security"); break; case ACCOUNT_BALANCE : - return BALN_STR; + return _("Balance"); break; case ACCOUNT_BALANCE_EURO : - return BALN_EURO_STR; + return _("Balance"); break; case ACCOUNT_TOTAL : - return TOTAL_STR; + return _("Total"); break; case ACCOUNT_TOTAL_EURO : - return TOTAL_EURO_STR; + return _("Total"); break; } @@ -725,10 +725,10 @@ gnc_get_reconcile_str(char reconciled_flag) { switch (reconciled_flag) { - case NREC: return NOT_CLEARED_ABBREV; - case CREC: return CLEARED_ABBREV; - case YREC: return RECONCILED_ABBREV; - case FREC: return FROZEN_ABBREV; + case NREC: return _("not cleared:n"+12); + case CREC: return _("cleared:c"+8); + case YREC: return _("reconciled:y"+11); + case FREC: return _("frozen:f"+7); default: PERR("Bad reconciled flag\n"); return NULL; diff --git a/src/gnome/druid-qif-import.c b/src/gnome/druid-qif-import.c index 2d6c30d9be..75c9316e9a 100644 --- a/src/gnome/druid-qif-import.c +++ b/src/gnome/druid-qif-import.c @@ -37,7 +37,6 @@ #include "dialog-commodity.h" #include "window-help.h" #include "messages.h" -#include "messages_i18n.h" #include "gnome-top-level.h" #include "ui-callbacks.h" @@ -329,7 +328,7 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page, * (#t error-message) for a warning */ if(gh_list_p(load_return) && (gh_car(load_return) == SCM_BOOL_T)) { - error_string = g_strdup_printf(QIF_LOAD_WARNING_FORMAT_MSG, + error_string = g_strdup_printf(_("QIF file load warning:\n%s"), gh_scm2newstr(gh_cadr(load_return), NULL)); gnc_warning_dialog_parented(GTK_WIDGET(wind->window), error_string); @@ -340,7 +339,7 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page, if((load_return != SCM_BOOL_T) && (!gh_list_p(load_return) || (gh_car(load_return) != SCM_BOOL_T))) { - error_string = g_strdup_printf(QIF_LOAD_FAILED_FORMAT_MSG, + error_string = g_strdup_printf(_("QIF file load failed:\n%s"), gh_scm2newstr(gh_cadr(load_return), NULL)); gnc_error_dialog_parented(GTK_WINDOW(wind->window), error_string); @@ -387,7 +386,7 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page, if((parse_return != SCM_BOOL_T) && (!gh_list_p(parse_return) || (gh_car(parse_return) != SCM_BOOL_T))) { - error_string = g_strdup_printf(QIF_PARSE_FAILED_FORMAT_MSG, + error_string = g_strdup_printf(_("QIF file parse failed:\n%s"), gh_scm2newstr(gh_cadr(parse_return), NULL)); gnc_error_dialog_parented(GTK_WINDOW(wind->window), error_string); diff --git a/src/gnome/file-history.c b/src/gnome/file-history.c index 457bd58f53..5e3af228c2 100644 --- a/src/gnome/file-history.c +++ b/src/gnome/file-history.c @@ -224,7 +224,7 @@ gnc_history_update_menu(void) } (menu+i)->type = GNOME_APP_UI_ENDOFINFO; - path = g_strdup_printf("%s%s", GNOME_MENU_FILE_PATH, IMPORT_QIF_E_STR_N); + path = g_strdup_printf("%s%s", GNOME_MENU_FILE_PATH, "Import QIF..."); gnome_app_insert_menus(GNOME_APP(app), path, menu); num_menu_entries = n; g_free(path); diff --git a/src/gnome/gnc-currency-edit.c b/src/gnome/gnc-currency-edit.c index 5500dfda87..f9a8a70e69 100644 --- a/src/gnome/gnc-currency-edit.c +++ b/src/gnome/gnc-currency-edit.c @@ -124,9 +124,9 @@ gnc_currency_edit_init (GNCCurrencyEdit *gce) #endif tooltips = gtk_tooltips_new(); - gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), - GTK_COMBO(gce)->entry, - TOOLTIP_CURRENCY, NULL); + gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), GTK_COMBO(gce)->entry, + _("Enter a 3-letter ISO currency code such " + "as USD (US Dollars)"), NULL); } static void diff --git a/src/gnome/gnc-datedelta.c b/src/gnome/gnc-datedelta.c index d1e4ff7fa8..5620c38483 100644 --- a/src/gnome/gnc-datedelta.c +++ b/src/gnome/gnc-datedelta.c @@ -203,10 +203,10 @@ fill_units_menu(GNCDateDelta *gdd) GtkWidget *menu; GtkWidget *item; char *strings[] = { - DAYS_STR, - WEEKS_STR, - MONTHS_STR, - YEARS_STR, + _("Days"), + _("Weeks"), + _("Months"), + _("Years"), NULL }; gint i; @@ -249,8 +249,8 @@ fill_polarity_menu(GNCDateDelta *gdd) GtkWidget *menu; GtkWidget *item; char *strings[] = { - AGO_STR, - FROM_NOW_STR, + _("Ago"), + _("From Now"), NULL }; gint i; diff --git a/src/gnome/print-session.c b/src/gnome/print-session.c index 739a5e0666..86063e4ae0 100644 --- a/src/gnome/print-session.c +++ b/src/gnome/print-session.c @@ -263,7 +263,7 @@ gnc_ui_print_dialog_cancel_cb(GtkButton * button, gpointer user_data) { void gnc_ui_print_dialog_help_cb(GtkButton * button, gpointer user_data) { - helpWindow(NULL, HELP_STR, HH_PRINT); + helpWindow(NULL, NULL, HH_PRINT); } diff --git a/src/gnome/reconcile-list.c b/src/gnome/reconcile-list.c index d2c07242d7..00efc95782 100644 --- a/src/gnome/reconcile-list.c +++ b/src/gnome/reconcile-list.c @@ -131,11 +131,11 @@ gnc_reconcile_list_init(GNCReconcileList *list) GtkCList *clist = GTK_CLIST(list); gchar * titles[] = { - DATE_STR, - NUM_STR, - DESC_STR, - AMT_STR, - RECONCILE_ABBREV, + _("Date"), + _("Num"), + _("Description"), + _("Amount"), + _("Reconciled:R"+11), NULL }; diff --git a/src/gnome/top-level.c b/src/gnome/top-level.c index d4e7feefd0..f02fea07a9 100644 --- a/src/gnome/top-level.c +++ b/src/gnome/top-level.c @@ -575,29 +575,39 @@ gnc_configure_register_colors(void) { SplitRegisterColors reg_colors; - reg_colors.single_cursor_passive_bg_color = + reg_colors.header_bg_color = gnc_lookup_color_option_argb("Register Colors", - "Single mode default even row background", - 0xccccff); + "Header color", + 0xffffff); - reg_colors.single_cursor_passive_bg_color2 = + reg_colors.primary_bg_color = gnc_lookup_color_option_argb("Register Colors", - "Single mode default odd row background", - 0xccccff); + "Primary color", + 0xffffff); - reg_colors.single_cursor_active_bg_color = + reg_colors.secondary_bg_color = gnc_lookup_color_option_argb("Register Colors", - "Single mode active background", - 0xffdddd); + "Secondary color", + 0xffffff); - reg_colors.double_cursor_passive_bg_color = + reg_colors.primary_active_bg_color = gnc_lookup_color_option_argb("Register Colors", - "Double mode default even row background", - 0xccccff); + "Primary active color", + 0xffffff); - reg_colors.double_cursor_passive_bg_color2 = + reg_colors.secondary_active_bg_color = gnc_lookup_color_option_argb("Register Colors", - "Double mode default odd row background", + "Secondary active color", + 0xffffff); + + reg_colors.split_bg_color = + gnc_lookup_color_option_argb("Register Colors", + "Split color", + 0xffffff); + + reg_colors.split_active_bg_color = + gnc_lookup_color_option_argb("Register Colors", + "Split active color", 0xffffff); reg_colors.double_alternate_virt = @@ -605,36 +615,6 @@ gnc_configure_register_colors(void) "Double mode colors alternate with transactions", FALSE); - reg_colors.double_cursor_active_bg_color = - gnc_lookup_color_option_argb("Register Colors", - "Double mode active background", - 0xffdddd); - - reg_colors.trans_cursor_passive_bg_color = - gnc_lookup_color_option_argb("Register Colors", - "Multi mode default transaction background", - 0xccccff); - - reg_colors.trans_cursor_active_bg_color = - gnc_lookup_color_option_argb("Register Colors", - "Multi mode active transaction background", - 0xffdddd); - - reg_colors.split_cursor_passive_bg_color = - gnc_lookup_color_option_argb("Register Colors", - "Multi mode default split background", - 0xffffff); - - reg_colors.split_cursor_active_bg_color = - gnc_lookup_color_option_argb("Register Colors", - "Multi mode active split background", - 0xffffdd); - - reg_colors.header_bg_color = - gnc_lookup_color_option_argb("Register Colors", - "Header background", - 0xffffff); - xaccSetSplitRegisterColors(reg_colors); } diff --git a/src/gnome/window-help.c b/src/gnome/window-help.c index 401aebfb52..b4c5ffb9c9 100644 --- a/src/gnome/window-help.c +++ b/src/gnome/window-help.c @@ -192,7 +192,7 @@ helpJumpCB(HTMLUserData user_data, char **set_text, char **set_label) * opens up a help window, and displays html * * * * Args: parent - the parent widget * - * title - the title of the window * + * title - the title of the window, defaults to "Help" * * htmlfile - the file name of the help file to display * * Return: none * \********************************************************************/ @@ -202,6 +202,9 @@ helpWindow(GtkWidget *parent, const char *title, const char *htmlfile) HTMLData *html_data; HelpData *help_data; + if (title == NULL) + title = _("Help"); + if (helpwindow == NULL) helpwindow = gnc_html_window_new(helpAnchorCB, helpJumpCB); diff --git a/src/gnome/window-html.c b/src/gnome/window-html.c index 3fd65da78e..cb9b4be2ea 100644 --- a/src/gnome/window-html.c +++ b/src/gnome/window-html.c @@ -449,8 +449,8 @@ html_window_fill_toolbar(HTMLWindow *hw) GnomeUIInfo toolbar_start[] = { { GNOME_APP_UI_ITEM, - BACK_STR, - TOOLTIP_HTML_BACK, + _("Back"), + _("Move back one step in the history"), htmlBackCB, hw, NULL, GNOME_APP_PIXMAP_STOCK, @@ -458,8 +458,8 @@ html_window_fill_toolbar(HTMLWindow *hw) 0, 0, NULL }, { GNOME_APP_UI_ITEM, - FORWARD_STR, - TOOLTIP_HTML_FORW, + _("Forward"), + _("Move forward one step in the history"), htmlFwdCB, hw, NULL, GNOME_APP_PIXMAP_STOCK, @@ -472,8 +472,8 @@ html_window_fill_toolbar(HTMLWindow *hw) { GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - PRINT_STR, - "Print HTML Window", + _("Print"), + _("Print HTML Window"), htmlPrintCB, hw, NULL, GNOME_APP_PIXMAP_STOCK, @@ -482,8 +482,8 @@ html_window_fill_toolbar(HTMLWindow *hw) }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - CLOSE_STR, - TOOLTIP_CLOSE_HTML, + _("Close"), + _("Close this HTML window"), closeHtmlWinCB, hw, NULL, GNOME_APP_PIXMAP_STOCK, diff --git a/src/gnome/window-main.c b/src/gnome/window-main.c index 7d8a30a2bb..cfcab809c3 100644 --- a/src/gnome/window-main.c +++ b/src/gnome/window-main.c @@ -37,7 +37,7 @@ #include "MainWindow.h" #include "Destroy.h" #include "ui-callbacks.h" -#include "enriched-messages.h" +#include "messages.h" #include "RegWindow.h" #include "Refresh.h" #include "window-main.h" @@ -159,7 +159,7 @@ gnc_ui_build_currency_item(const gnc_commodity * currency) gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(topbox), hbox, FALSE, FALSE, 5); - label = gtk_label_new(ASSETS_C_STR); + label = gtk_label_new(_("Net Assets:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -174,7 +174,7 @@ gnc_ui_build_currency_item(const gnc_commodity * currency) gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(topbox), hbox, FALSE, FALSE, 5); - label = gtk_label_new(PROFITS_C_STR); + label = gtk_label_new(_("Profits:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -279,7 +279,7 @@ gnc_ui_accounts_recurse (AccountGroup *group, GList **currency_list, euro_accum = gnc_ui_get_currency_accumulator(currency_list, euro_commodity); } - + num_accounts = xaccGroupGetNumAccounts(group); for (i = 0; i < num_accounts; i++) { @@ -459,12 +459,12 @@ gnc_refresh_main_window_title() session = gncGetCurrentSession(); if (session == NULL) - filename = UNTITLED_STR; + filename = _("Untitled"); else filename = xaccSessionGetFilePath(session); if ((filename == NULL) || (*filename == '\0')) - filename = UNTITLED_STR; + filename = _("Untitled"); title = g_strconcat("GnuCash - ", filename, NULL); @@ -524,7 +524,7 @@ gnc_ui_totd_cb (GtkWidget *widget, gpointer data) static void gnc_ui_help_cb ( GtkWidget *widget, gpointer data ) { - helpWindow(NULL, HELP_STR, HH_MAIN); + helpWindow(NULL, NULL, HH_MAIN); } static void @@ -994,8 +994,8 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info) static GnomeUIInfo toolbar[] = { { GNOME_APP_UI_ITEM, - SAVE_STR_N, - TOOLTIP_SAVE_FILE_N, + N_("Save"), + N_("Save the file to disk"), gnc_ui_filemenu_cb, GINT_TO_POINTER(FMB_SAVE), NULL, @@ -1004,8 +1004,8 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info) 0, 0, NULL }, { GNOME_APP_UI_ITEM, - IMPORT_STR_N, - TOOLTIP_IMPORT_QIF_N, + N_("Import"), + N_("Import a Quicken QIF file"), gnc_ui_filemenu_cb, GINT_TO_POINTER(FMB_IMPORT), NULL, @@ -1015,8 +1015,8 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info) }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - OPEN_STR_N, - TOOLTIP_OPEN_N, + N_("Open"), + N_("Open the selected account"), gnc_ui_mainWindow_toolbar_open, NULL, NULL, @@ -1025,8 +1025,8 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info) 0, 0, NULL }, { GNOME_APP_UI_ITEM, - EDIT_STR_N, - TOOLTIP_EDIT_N, + N_("Edit"), + N_("Edit the selected account"), gnc_ui_mainWindow_toolbar_edit, NULL, NULL, @@ -1036,8 +1036,8 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info) }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - NEW_STR_N, - TOOLTIP_NEW_N, + N_("New"), + N_("Create a new account"), gnc_ui_add_account, NULL, NULL, @@ -1046,8 +1046,8 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info) 0, 0, NULL }, { GNOME_APP_UI_ITEM, - DELETE_STR_N, - TOOLTIP_DELETE_N, + N_("Delete"), + N_("Delete selected account"), gnc_ui_delete_account_cb, NULL, NULL, @@ -1057,8 +1057,8 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info) }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - FIND_STR_N, - TOOLTIP_FIND_N, + N_("Find"), + N_("Find transactions with a search"), gnc_ui_find_transactions_cb, NULL, NULL, @@ -1068,8 +1068,8 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info) }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - EXIT_STR_N, - TOOLTIP_EXIT_N, + N_("Exit"), + N_("Exit GnuCash"), gnc_ui_exit_cb, NULL, NULL, @@ -1098,9 +1098,10 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GtkWidget *popup; GSList *list; - static GnomeUIInfo filemenu[] = { - GNOMEUIINFO_MENU_NEW_ITEM(NEW_FILE_STR_N, - TOOLTIP_NEW_FILE_N, + static GnomeUIInfo filemenu[] = + { + GNOMEUIINFO_MENU_NEW_ITEM(N_("New File"), + N_("Create a new file"), gnc_ui_filemenu_cb, GINT_TO_POINTER(FMB_NEW)), GNOMEUIINFO_MENU_OPEN_ITEM(gnc_ui_filemenu_cb, @@ -1112,7 +1113,8 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - IMPORT_QIF_E_STR_N, TOOLTIP_IMPORT_QIF_N, + N_("Import QIF..."), + N_("Import a Quicken 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 @@ -1123,10 +1125,12 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GNOMEUIINFO_END }; - static GnomeUIInfo optionsmenu[] = { + static GnomeUIInfo optionsmenu[] = + { { GNOME_APP_UI_ITEM, - PREFERENCES_MENU_E_STR_N, TOOLTIP_PREFERENCES_N, + N_("_Preferences..."), + N_("Open the global preferences dialog"), gnc_ui_options_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PREF, 0, 0, NULL @@ -1134,24 +1138,29 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GNOMEUIINFO_END }; - static GnomeUIInfo scrubmenu[] = { + static GnomeUIInfo scrubmenu[] = + { { GNOME_APP_UI_ITEM, - SCRUB_ACC_MENU_STR_N, TOOLTIP_SCRUB_ACCT_N, + N_("Scrub A_ccount"), + N_("Identify and fix problems in the account"), gnc_ui_mainWindow_scrub, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - SCRUB_SUB_MENU_STR_N, TOOLTIP_SCRUB_SUB_N, + N_("Scrub Su_baccounts"), + N_("Identify and fix problems in the account " + "and its subaccounts"), gnc_ui_mainWindow_scrub_sub, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - SCRUB_ALL_MENU_STR_N, TOOLTIP_SCRUB_ALL_N, + N_("Scrub A_ll"), + N_("Identify and fix problems in all the accounts"), gnc_ui_mainWindow_scrub_all, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1159,24 +1168,28 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GNOMEUIINFO_END }; - static GnomeUIInfo accountsmenu[] = { + static GnomeUIInfo accountsmenu[] = + { { GNOME_APP_UI_ITEM, - OPEN_ACC_MENU_STR_N, TOOLTIP_OPEN_N, + N_("_Open Account"), + N_("Open the selected account"), gnc_ui_mainWindow_toolbar_open, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN, 'o', GDK_CONTROL_MASK, NULL }, { GNOME_APP_UI_ITEM, - OPEN_SUB_MENU_STR_N, TOOLTIP_OPEN_SUB_N, + N_("Open S_ubaccounts"), + N_("Open the selected account and all its subaccounts"), gnc_ui_mainWindow_toolbar_open_subs, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - EDIT_ACC_MENU_STR_N, TOOLTIP_EDIT_N, + N_("_Edit Account"), + N_("Edit the selected account"), gnc_ui_mainWindow_toolbar_edit, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP, 'e', GDK_CONTROL_MASK, NULL @@ -1184,14 +1197,16 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - RECONCILE_MENU_E_STR_N, TOOLTIP_RECONCILE_N, + N_("_Reconcile..."), + N_("Reconcile the selected account"), gnc_ui_mainWindow_reconcile, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 'r', GDK_CONTROL_MASK, NULL }, { GNOME_APP_UI_ITEM, - TRANSFER_MENU_E_STR_N, TOOLTIP_TRANSFER_N, + 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 @@ -1199,27 +1214,31 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - NEW_ACC_MENU_E_STR_N, TOOLTIP_NEW_N, + N_("_New Account..."), + N_("Create a new account"), gnc_ui_add_account, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_ADD, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - DEL_ACC_MENU_STR_N, TOOLTIP_DELETE_N, + N_("_Delete Account"), + N_("Delete selected account"), gnc_ui_delete_account_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_REMOVE, 0, 0, NULL }, GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE(SCRUB_MENU_STR_N, scrubmenu), + GNOMEUIINFO_SUBTREE(N_("_Scrub"), scrubmenu), GNOMEUIINFO_END }; - static GnomeUIInfo toolsmenu[] = { + static GnomeUIInfo toolsmenu[] = + { { GNOME_APP_UI_ITEM, - FIN_CALC_STR_N, TOOLTIP_FIN_CALC_N, + N_("_Financial Calculator"), + N_("Use the financial calculator"), gnc_ui_mainWindow_fincalc_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1227,17 +1246,20 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GNOMEUIINFO_END }; - static GnomeUIInfo helpmenu[] = { + static GnomeUIInfo helpmenu[] = + { { GNOME_APP_UI_ITEM, - MAN_MENU_STR_N, TOOLTIP_MAN_N, + N_("_Manual"), + N_("Open the GnuCash Manual"), gnc_ui_help_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - TOTD_MENU_STR_N, TOOLTIP_TOTD_N, + N_("_Tips Of The Day"), + N_("View the Tips of the Day"), gnc_ui_totd_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1248,10 +1270,11 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree, GNOMEUIINFO_END }; - static GnomeUIInfo mainmenu[] = { + static GnomeUIInfo mainmenu[] = + { GNOMEUIINFO_MENU_FILE_TREE(filemenu), - GNOMEUIINFO_SUBTREE(ACCOUNTS_MENU_STR_N, accountsmenu), - GNOMEUIINFO_SUBTREE(TOOLS_MENU_STR_N, toolsmenu), + GNOMEUIINFO_SUBTREE(N_("_Accounts"), accountsmenu), + GNOMEUIINFO_SUBTREE(N_("_Tools"), toolsmenu), GNOMEUIINFO_MENU_SETTINGS_TREE(optionsmenu), GNOMEUIINFO_MENU_HELP_TREE(helpmenu), GNOMEUIINFO_END diff --git a/src/gnome/window-reconcile.c b/src/gnome/window-reconcile.c index f64b863ac5..735e69b48c 100644 --- a/src/gnome/window-reconcile.c +++ b/src/gnome/window-reconcile.c @@ -48,7 +48,7 @@ #include "Refresh.h" #include "query-user.h" #include "window-help.h" -#include "enriched-messages.h" +#include "messages.h" #include "guile-util.h" #include "AccWindow.h" #include "Scrub.h" @@ -363,13 +363,13 @@ startRecnWindow(GtkWidget *parent, Account *account, gnome_dialog_set_parent(GNOME_DIALOG(dialog), GTK_WINDOW(parent)); { - GtkWidget *frame = gtk_frame_new(RECONCILE_INFO_STR); + GtkWidget *frame = gtk_frame_new(_("Reconcile Information")); GtkWidget *main_area = gtk_hbox_new(FALSE, 5); GtkWidget *left_column = gtk_vbox_new(TRUE, 0); GtkWidget *right_column = gtk_vbox_new(TRUE, 0); - GtkWidget *date_title = gtk_label_new(STATEMENT_DATE_C_STR); - GtkWidget *start_title = gtk_label_new(START_BALN_C_STR); - GtkWidget *end_title = gtk_label_new(END_BALN_C_STR); + GtkWidget *date_title = gtk_label_new(_("Statement Date:")); + GtkWidget *start_title = gtk_label_new(_("Starting Balance:")); + GtkWidget *end_title = gtk_label_new(_("Ending Balance:")); GtkWidget *start_value = gtk_label_new(amount); GtkWidget *vbox = GNOME_DIALOG(dialog)->vbox; @@ -525,7 +525,7 @@ gnc_reconcile_window_set_titles(RecnWindow *recnData) "Use accounting labels", FALSE); if (formal) - title = DEBITS_STR; + title = _("Debits"); else title = gnc_get_debit_string(NO_TYPE); @@ -535,7 +535,7 @@ gnc_reconcile_window_set_titles(RecnWindow *recnData) g_free(title); if (formal) - title = CREDITS_STR; + title = _("Credits"); else title = gnc_get_credit_string(NO_TYPE); @@ -610,7 +610,7 @@ gnc_reconcile_window_create_list_box(Account *account, hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new(TOTAL_C_STR); + label = gtk_label_new(_("Total:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); @@ -655,7 +655,7 @@ gnc_reconcile_window_get_current_split(RecnWindow *recnData) static void gnc_ui_reconcile_window_help_cb(GtkWidget *widget, gpointer data) { - helpWindow(NULL, HELP_STR, HH_RECNWIN); + helpWindow(NULL, NULL, HH_RECNWIN); } static void @@ -703,10 +703,11 @@ gnc_ui_reconcile_window_delete_cb(GtkButton *button, gpointer data) return; { + const char *message = _("Are you sure you want to delete the current " + "transaction?"); gboolean result; - result = gnc_verify_dialog_parented(recnData->window, - TRANS_DEL2_MSG, FALSE); + result = gnc_verify_dialog_parented(recnData->window, message, FALSE); if (!result) return; @@ -768,7 +769,7 @@ gnc_recn_make_window_name(Account *account) char *title; fullname = xaccAccountGetFullName(account, gnc_get_account_separator()); - title = g_strconcat(fullname, " - ", RECONCILE_STR, NULL); + title = g_strconcat(fullname, " - ", _("Reconcile"), NULL); free(fullname); @@ -956,7 +957,9 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) { { GNOME_APP_UI_ITEM, - RECN_INFO_MENU_E_STR_N, TOOLTIP_RECN_INFO_N, + N_("_Reconcile Information..."), + N_("Change the reconcile information " + "including statement date and ending balance."), gnc_ui_reconcile_window_change_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -964,14 +967,16 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - FINISH_MENU_STR_N, TOOLTIP_RECN_FINISH_N, + N_("_Finish"), + N_("Finish the reconciliation of this account"), recnFinishCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 'f', GDK_CONTROL_MASK, NULL }, { GNOME_APP_UI_ITEM, - CANCEL_MENU_STR_N, TOOLTIP_RECN_CANCEL_N, + N_("_Cancel"), + N_("Cancel the reconciliation of this account"), recnCancelCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -981,13 +986,17 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) static GnomeUIInfo sort_debit_list[] = { - GNOMEUIINFO_RADIOITEM_DATA(STANDARD_ORDER_STR_N, TOOLTIP_STANDARD_ORD_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Standard order"), + N_("Keep normal account order"), sort_debit_standard_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_NUM_STR_N, TOOLTIP_SORT_BY_NUM_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Num"), + N_("Sort by Num"), sort_debit_num_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_DESC_STR_N, TOOLTIP_SORT_BY_DESC_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Description"), + N_("Sort by Description"), sort_debit_desc_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_AMNT_STR_N, TOOLTIP_SORT_BY_AMNT_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Amount"), + N_("Sort by Amount"), sort_debit_amount_cb, NULL, NULL), GNOMEUIINFO_END }; @@ -1000,13 +1009,17 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) static GnomeUIInfo sort_credit_list[] = { - GNOMEUIINFO_RADIOITEM_DATA(STANDARD_ORDER_STR_N, TOOLTIP_STANDARD_ORD_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Standard order"), + N_("Keep normal account order"), sort_credit_standard_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_NUM_STR_N, TOOLTIP_SORT_BY_NUM_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Num"), + N_("Sort by Num"), sort_credit_num_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_DESC_STR_N, TOOLTIP_SORT_BY_DESC_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Description"), + N_("Sort by Description"), sort_credit_desc_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_AMNT_STR_N, TOOLTIP_SORT_BY_AMNT_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Amount"), + N_("Sort by Amount"), sort_credit_amount_cb, NULL, NULL), GNOMEUIINFO_END }; @@ -1019,8 +1032,8 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) static GnomeUIInfo sort_menu[] = { - GNOMEUIINFO_SUBTREE(DEBITS_STR_N, sort_debit_menu), - GNOMEUIINFO_SUBTREE(CREDITS_STR_N, sort_credit_menu), + GNOMEUIINFO_SUBTREE(N_("Debits"), sort_debit_menu), + GNOMEUIINFO_SUBTREE(N_("Credits"), sort_credit_menu), GNOMEUIINFO_SUBTREE(NULL, sort_debit_menu), GNOMEUIINFO_SUBTREE(NULL, sort_credit_menu), GNOMEUIINFO_END @@ -1030,14 +1043,14 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) { { GNOME_APP_UI_ITEM, - OPEN_ACC_MENU_STR_N, TOOLTIP_OPEN_ACC_N, + N_("_Open Account"), N_("Open the account"), gnc_recn_open_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - EDIT_ACC_MENU_STR_N, TOOLTIP_EDIT_REG_N, + N_("_Edit Account"), N_("Edit the main account for this register"), gnc_recn_edit_account_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1045,7 +1058,7 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - TRANSFER_MENU_E_STR_N, TOOLTIP_TRANSFER_N, + N_("_Transfer..."), N_("Transfer funds from one account to another"), gnc_recn_xfer_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1053,7 +1066,7 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - SCRUB_MENU_STR_N, TOOLTIP_SCRUB_ACCT_N, + N_("_Scrub"), N_("Identify and fix problems in the account"), gnc_recn_scrub_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1065,21 +1078,21 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) { { GNOME_APP_UI_ITEM, - NEW_MENU_STR_N, TOOLTIP_NEW_TRANS_N, + N_("_New"), N_("Add a new transaction to the account"), gnc_ui_reconcile_window_new_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 'n', GDK_CONTROL_MASK, NULL }, { GNOME_APP_UI_ITEM, - EDIT_MENU_STR_N, TOOLTIP_EDIT_TRANS_N, + N_("_Edit"), N_("Edit the current transaction"), gnc_ui_reconcile_window_edit_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 'e', GDK_CONTROL_MASK, NULL }, { GNOME_APP_UI_ITEM, - DELETE_MENU_STR_N, TOOLTIP_DEL_TRANS_N, + N_("_Delete"), N_("Delete the current transaction"), gnc_ui_reconcile_window_delete_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 'd', GDK_CONTROL_MASK, NULL @@ -1091,7 +1104,7 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) { { GNOME_APP_UI_ITEM, - HELP_MENU_STR_N, TOOLTIP_HELP_N, + N_("_Help"), N_("Open the GnuCash help window"), gnc_ui_reconcile_window_help_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1101,10 +1114,10 @@ gnc_recn_create_menu_bar(RecnWindow *recnData, GtkWidget *statusbar) static GnomeUIInfo reconcile_window_menu[] = { - GNOMEUIINFO_SUBTREE(RECONCILE_MENU_STR_N, reconcile_menu), - GNOMEUIINFO_SUBTREE(SORT_ORDER_MENU_STR_N, sort_menu), - GNOMEUIINFO_SUBTREE(ACCOUNT_MENU_STR_N, account_menu), - GNOMEUIINFO_SUBTREE(TRANSACTION_MENU_STR_N, transaction_menu), + GNOMEUIINFO_SUBTREE(N_("_Reconcile"), reconcile_menu), + GNOMEUIINFO_SUBTREE(N_("Sort _Order"), sort_menu), + GNOMEUIINFO_SUBTREE(N_("_Account"), account_menu), + GNOMEUIINFO_SUBTREE(N_("_Transaction"), transaction_menu), GNOMEUIINFO_MENU_HELP_TREE(help_menu), GNOMEUIINFO_END }; @@ -1149,21 +1162,21 @@ gnc_recn_create_popup_menu(RecnWindow *recnData) { { GNOME_APP_UI_ITEM, - NEW_MENU_STR, TOOLTIP_NEW_TRANS, + N_("_New"), N_("Add a new transaction to the account"), gnc_ui_reconcile_window_new_cb, recnData, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_NEW, 'n', GDK_CONTROL_MASK, NULL }, { GNOME_APP_UI_ITEM, - EDIT_MENU_STR, TOOLTIP_EDIT_TRANS, + N_("_Edit"), N_("Edit the current transaction"), gnc_ui_reconcile_window_edit_cb, recnData, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_PROPERTIES, 'e', GDK_CONTROL_MASK, NULL }, { GNOME_APP_UI_ITEM, - DELETE_MENU_STR, TOOLTIP_DEL_TRANS, + N_("_Delete"), N_("Delete the current transaction"), gnc_ui_reconcile_window_delete_cb, recnData, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_TRASH, 'd', GDK_CONTROL_MASK, NULL @@ -1209,21 +1222,21 @@ gnc_recn_create_tool_bar(RecnWindow *recnData) { { GNOME_APP_UI_ITEM, - NEW_STR, TOOLTIP_NEW_TRANS, + N_("New"), N_("Add a new transaction to the account"), gnc_ui_reconcile_window_new_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_NEW, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - EDIT_STR, TOOLTIP_EDIT_TRANS, + N_("Edit"), N_("Edit the current transaction"), gnc_ui_reconcile_window_edit_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_PROPERTIES, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - DELETE_STR, TOOLTIP_DEL_TRANS, + N_("Delete"), N_("Delete the current transaction"), gnc_ui_reconcile_window_delete_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_TRASH, 0, 0, NULL @@ -1231,7 +1244,7 @@ gnc_recn_create_tool_bar(RecnWindow *recnData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - OPEN_STR, TOOLTIP_OPEN_ACC, + N_("Open"), N_("Open the account"), gnc_recn_open_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_JUMP_TO, 0, 0, NULL @@ -1239,7 +1252,7 @@ gnc_recn_create_tool_bar(RecnWindow *recnData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - FINISH_STR, TOOLTIP_RECN_FINISH_N, + N_("Finish"), N_("Finish the reconciliation of this account"), recnFinishCB, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_DOWN, 0, 0, NULL @@ -1434,7 +1447,7 @@ recnWindow(GtkWidget *parent, Account *account) gtk_box_pack_start(GTK_BOX(totals_hbox), value_vbox, TRUE, TRUE, 0); /* starting balance title/value */ - title = gtk_label_new(START_BALN_C_STR); + title = gtk_label_new(_("Starting Balance:")); gtk_misc_set_alignment(GTK_MISC(title), 1.0, 0.5); gtk_box_pack_start(GTK_BOX(title_vbox), title, FALSE, FALSE, 3); @@ -1444,7 +1457,7 @@ recnWindow(GtkWidget *parent, Account *account) gtk_box_pack_start(GTK_BOX(value_vbox), value, FALSE, FALSE, 3); /* ending balance title/value */ - title = gtk_label_new(END_BALN_C_STR); + title = gtk_label_new(_("Ending Balance:")); gtk_misc_set_alignment(GTK_MISC(title), 1.0, 0.5); gtk_box_pack_start(GTK_BOX(title_vbox), title, FALSE, FALSE, 0); @@ -1454,7 +1467,7 @@ recnWindow(GtkWidget *parent, Account *account) gtk_box_pack_start(GTK_BOX(value_vbox), value, FALSE, FALSE, 0); /* reconciled balance title/value */ - title = gtk_label_new(RECONCILE_BALN_C_STR); + title = gtk_label_new(_("Reconciled Balance:")); gtk_misc_set_alignment(GTK_MISC(title), 1.0, 0.5); gtk_box_pack_start(GTK_BOX(title_vbox), title, FALSE, FALSE, 0); @@ -1464,7 +1477,7 @@ recnWindow(GtkWidget *parent, Account *account) gtk_box_pack_start(GTK_BOX(value_vbox), value, FALSE, FALSE, 0); /* difference title/value */ - title = gtk_label_new(DIFF_C_STR); + title = gtk_label_new(_("Difference:")); gtk_misc_set_alignment(GTK_MISC(title), 1.0, 0.5); gtk_box_pack_start(GTK_BOX(title_vbox), title, FALSE, FALSE, 0); @@ -1724,8 +1737,12 @@ recnCancelCB(GtkWidget *w, gpointer data) changed = TRUE; if (changed) - if (!gnc_verify_dialog_parented(recnData->window, RECN_CANCEL_WARN, FALSE)) + { + const char *message = _("You have made changes to this reconcile " + "window.\nAre you sure you want to cancel?"); + if (!gnc_verify_dialog_parented(recnData->window, message, FALSE)) return; + } gtk_widget_destroy(recnData->window); } diff --git a/src/gnome/window-register.c b/src/gnome/window-register.c index 0ec7010fa4..b7b64bf04e 100644 --- a/src/gnome/window-register.c +++ b/src/gnome/window-register.c @@ -45,7 +45,7 @@ #include "dialog-transfer.h" #include "dialog-utils.h" #include "query-user.h" -#include "enriched-messages.h" +#include "messages.h" #include "table-allgui.h" #include "gnucash-sheet.h" #include "global-options.h" @@ -664,7 +664,7 @@ gnc_register_date_window(RegWindow *regData) regDateData = g_new0(RegDateWindow, 1); regData->date_window = regDateData; - dialog = gnome_dialog_new(REG_DATE_RANGES_STR, + dialog = gnome_dialog_new(_("Register date ranges"), GNOME_STOCK_BUTTON_CLOSE, NULL); @@ -706,7 +706,7 @@ gnc_register_date_window(RegWindow *regData) vbox2 = gtk_vbox_new(TRUE, 2); gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); - radio = gtk_radio_button_new_with_label(NULL, SHOW_EARLIEST_STR); + radio = gtk_radio_button_new_with_label(NULL, _("Show Earliest")); gtk_box_pack_start(GTK_BOX(vbox2), radio, FALSE, FALSE, 0); regDateData->show_earliest = radio; @@ -717,7 +717,7 @@ gnc_register_date_window(RegWindow *regData) gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio)); - radio = gtk_radio_button_new_with_label(group, START_DATE_C_STR); + radio = gtk_radio_button_new_with_label(group, _("Start date:")); gtk_box_pack_start(GTK_BOX(hbox), radio, FALSE, FALSE, 0); if (!show_all) @@ -755,7 +755,7 @@ gnc_register_date_window(RegWindow *regData) vbox2 = gtk_vbox_new(TRUE, 2); gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); - radio = gtk_radio_button_new_with_label(NULL, SHOW_LATEST_STR); + radio = gtk_radio_button_new_with_label(NULL, _("Show Latest")); gtk_box_pack_start(GTK_BOX(vbox2), radio, FALSE, FALSE, 0); regDateData->show_latest = radio; @@ -766,7 +766,7 @@ gnc_register_date_window(RegWindow *regData) gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio)); - radio = gtk_radio_button_new_with_label(group, END_DATE_C_STR); + radio = gtk_radio_button_new_with_label(group, _("End date:")); gtk_box_pack_start(GTK_BOX(hbox), radio, FALSE, FALSE, 0); if (!show_all) @@ -792,13 +792,13 @@ gnc_register_date_window(RegWindow *regData) gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(gnc_register_date_changed_cb), regData); - button = gtk_button_new_with_label(TODAY_STR); + button = gtk_button_new_with_label(_("Today")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gnc_register_today_cb), regData); regDateData->today_button = button; - button = gtk_button_new_with_label(SET_DATE_RANGE_STR); + button = gtk_button_new_with_label(_("Set Date Range")); gtk_box_pack_start(GTK_BOX(dvbox), button, FALSE, FALSE, 5); gtk_widget_set_sensitive(button, FALSE); regDateData->set_button = button; @@ -819,21 +819,24 @@ gnc_register_create_tool_bar(RegWindow *regData) { { GNOME_APP_UI_ITEM, - RECORD_STR_N, TOOLTIP_RECORD_N, + N_("Record"), + N_("Record the current transaction"), recordCB, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_ADD, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - CANCEL_STR_N, TOOLTIP_CANCEL_TRANS_N, + N_("Cancel"), + N_("Cancel the current transaction"), cancelCB, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_UNDELETE, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - DELETE_STR_N, TOOLTIP_DEL_TRANS_N, + N_("Delete"), + N_("Delete the current transaction"), deleteCB, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_TRASH, 0, 0, NULL @@ -841,7 +844,8 @@ gnc_register_create_tool_bar(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - DUPLICATE_STR_N, TOOLTIP_DUP_TRANS_N, + N_("Duplicate"), + N_("Make a copy of the current transaction"), duplicateCB, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_COPY, 0, 0, NULL @@ -849,14 +853,18 @@ gnc_register_create_tool_bar(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - BLANK_STR_N, TOOLTIP_BLANK_TRANS_N, + N_("Blank"), + N_("Move to the blank transaction at the "\ + "bottom of the register"), new_trans_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_NEW, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - JUMP_STR_N, TOOLTIP_JUMP_TRANS_N, + N_("Jump"), + N_("Jump to the corresponding transaction in " + "the other account"), jump_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_JUMP_TO, 0, 0, NULL @@ -864,7 +872,8 @@ gnc_register_create_tool_bar(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - TRANSFER_STR_N, TOOLTIP_TRANSFER_N, + N_("Transfer"), + N_("Transfer funds from one account to another"), xferCB, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_CONVERT, 0, 0, NULL @@ -872,7 +881,8 @@ gnc_register_create_tool_bar(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - FIND_STR_N, TOOLTIP_FIND_N, + N_("Find"), + N_("Find transactions with a search"), gnc_ui_find_transactions_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_SEARCH, @@ -881,7 +891,8 @@ gnc_register_create_tool_bar(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - CLOSE_STR_N, TOOLTIP_CLOSE_REG_N, + N_("Close"), + N_("Close this register window"), closeCB, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_CLOSE, 0, 0, NULL @@ -941,7 +952,7 @@ gnc_register_create_status_bar(RegWindow *regData) hbox = gtk_hbox_new(FALSE, 2); gtk_box_pack_end(GTK_BOX(statusbar), hbox, FALSE, FALSE, 5); - label = gtk_label_new(CLEARED_C_STR); + label = gtk_label_new(_("Cleared:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -953,7 +964,7 @@ gnc_register_create_status_bar(RegWindow *regData) hbox = gtk_hbox_new(FALSE, 2); gtk_box_pack_end(GTK_BOX(statusbar), hbox, FALSE, FALSE, 5); - label = gtk_label_new(BALN_C_STR); + label = gtk_label_new(_("Balance:")); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -1089,16 +1100,23 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) static GnomeUIInfo style_list[] = { - GNOMEUIINFO_RADIOITEM_DATA(SINGLE_LINE_STR_N, TOOLTIP_SINGLE_LINE_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Single Line"), + N_("Show transactions on single lines"), gnc_register_style_single_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(DOUBLE_LINE_STR_N, TOOLTIP_DOUBLE_LINE_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Double Line"), + N_("Show transactions on two lines with " + "more information"), gnc_register_style_double_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(MULTI_LINE_STR_N, TOOLTIP_MULTI_LINE_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Multi Line"), + N_("Show transactions on multiple lines with " + "one line for each split"), gnc_register_style_multi_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(AUTO_SINGLE_STR_N, TOOLTIP_AUTO_SINGLE_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Auto Single"), + N_("Single line mode with a multi-line cursor"), gnc_register_style_auto_single_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(AUTO_DOUBLE_STR_N, TOOLTIP_AUTO_DOUBLE_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Auto Double"), + N_("Double line mode with a multi-line cursor"), gnc_register_style_auto_double_cb, NULL, NULL), GNOMEUIINFO_END @@ -1112,25 +1130,32 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) static GnomeUIInfo sort_list[] = { - GNOMEUIINFO_RADIOITEM_DATA(STANDARD_ORDER_STR_N, TOOLTIP_STANDARD_ORD_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Standard order"), + N_("Keep normal account order"), gnc_register_sort_standard_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_DATE_STR_N, TOOLTIP_SORT_BY_DATE_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Date"), + N_("Sort by Date"), gnc_register_sort_date_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_ENTERED_STR_N, - TOOLTIP_SORT_BY_ENTERED_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by date of entry"), + N_("Sort by the date of entry"), gnc_register_sort_date_entered_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_STMT_STR_N, - TOOLTIP_SORT_BY_STMT_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by statement date"), + N_("Sort by the statement date " + "(unreconciled items last)"), gnc_register_sort_date_reconciled_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_NUM_STR_N, TOOLTIP_SORT_BY_NUM_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Num"), + N_("Sort by Num"), gnc_register_sort_num_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_AMNT_STR_N, TOOLTIP_SORT_BY_AMNT_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Amount"), + N_("Sort by Amount"), gnc_register_sort_amount_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_MEMO_STR_N, TOOLTIP_SORT_BY_MEMO_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Memo"), + N_("Sort by Memo"), gnc_register_sort_memo_cb, NULL, NULL), - GNOMEUIINFO_RADIOITEM_DATA(SORT_BY_DESC_STR_N, TOOLTIP_SORT_BY_DESC_N, + GNOMEUIINFO_RADIOITEM_DATA(N_("Sort by Description"), + N_("Sort by Description"), gnc_register_sort_desc_cb, NULL, NULL), GNOMEUIINFO_END }; @@ -1145,14 +1170,16 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) { { GNOME_APP_UI_ITEM, - SHOW_ALL_MENU_STR_N, TOOLTIP_SHOW_ALL_N, + N_("Show _All"), + N_("Show all of the transactions in the account"), show_all_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - SET_RANGE_MENU_E_STR_N, TOOLTIP_DATE_RANGE_N, + N_("Set _Range..."), + N_("Set the date range of this register"), dateCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1162,13 +1189,14 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) static GnomeUIInfo register_menu[] = { - GNOMEUIINFO_SUBTREE(STYLE_MENU_STR_N, style_menu), - GNOMEUIINFO_SUBTREE(SORT_ORDER_MENU_STR_N, sort_menu), - GNOMEUIINFO_SUBTREE(DATE_RANGE_MENU_STR_N, date_menu), + GNOMEUIINFO_SUBTREE(N_("_Style"), style_menu), + GNOMEUIINFO_SUBTREE(N_("Sort _Order"), sort_menu), + GNOMEUIINFO_SUBTREE(N_("_Date Range"), date_menu), GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - CLOSE_STR_N, TOOLTIP_CLOSE_REG_N, + N_("Close"), + N_("Close this register window"), closeCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1184,21 +1212,24 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - CUT_TRANS_STR_N, TOOLTIP_CUT_TRANS_N, + N_("Cut Transaction"), + N_("Cut the selected transaction"), cutTransCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - COPY_TRANS_STR_N, TOOLTIP_COPY_TRANS_N, + N_("Copy Transaction"), + N_("Copy the selected transaction"), copyTransCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - PASTE_TRANS_STR_N, TOOLTIP_PASTE_TRANS_N, + N_("Paste Transaction"), + N_("Paste the transaction clipboard"), pasteTransCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1210,7 +1241,8 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) { { GNOME_APP_UI_ITEM, - EDIT_ACC_MENU_STR_N, TOOLTIP_EDIT_REG_N, + N_("_Edit Account"), + N_("Edit the main account for this register"), editCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1218,14 +1250,16 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - RECONCILE_MENU_E_STR_N, TOOLTIP_RECN_REG_N, + N_("_Reconcile..."), + N_("Reconcile the main account for this register"), startRecnCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - TRANSFER_MENU_E_STR_N, TOOLTIP_TRANSFER_N, + N_("_Transfer..."), + N_("Transfer funds from one account to another"), xferCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1233,7 +1267,8 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - NEW_ACC_MENU_E_STR_N, TOOLTIP_NEW_N, + N_("_New Account..."), + N_("Create a new account"), newAccountCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1241,7 +1276,9 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - SCRUB_MENU_STR_N, TOOLTIP_SCRUB_REG_N, + N_("_Scrub"), + N_("Identify and fix problems in the " + "accounts of this register"), gnc_register_scrub_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1253,21 +1290,24 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) { { GNOME_APP_UI_ITEM, - RECORD_MENU_STR_N, TOOLTIP_RECORD_N, + N_("_Record"), + N_("Record the current transaction"), recordCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - CANCEL_MENU_STR_N, TOOLTIP_CANCEL_TRANS_N, + N_("_Cancel"), + N_("Cancel the current transaction"), cancelCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - DELETE_MENU_STR_N, TOOLTIP_DEL_TRANS_N, + N_("_Delete"), + N_("Delete the current transaction"), deleteCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1275,7 +1315,8 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - DUPLICATE_MENU_STR_N, TOOLTIP_DUP_TRANS_N, + N_("D_uplicate"), + N_("Make a copy of the current transaction"), duplicateCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1283,14 +1324,18 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - BLANK_MENU_STR_N, TOOLTIP_BLANK_TRANS_N, + N_("_Blank"), + N_("Move to the blank transaction at the " + "bottom of the register"), new_trans_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - JUMP_MENU_STR_N, TOOLTIP_JUMP_TRANS_N, + N_("_Jump"), + N_("Jump to the corresponding transaction in " + "the other account"), jump_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1298,7 +1343,8 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - PRINT_CHECK_MENU_E_STR_N, TOOLTIP_PRINT_CHECK_N, + N_("_Print Check... (unfinished!)"), + N_("Print a check using a standard format"), print_check_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1310,7 +1356,8 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) { { GNOME_APP_UI_ITEM, - HELP_MENU_STR_N, TOOLTIP_HELP_N, + N_("_Help"), + N_("Open the GnuCash help window"), helpCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1320,10 +1367,10 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) static GnomeUIInfo register_window_menu[] = { - GNOMEUIINFO_SUBTREE(REGISTER_MENU_STR_N, register_menu), + GNOMEUIINFO_SUBTREE(N_("_Register"), register_menu), GNOMEUIINFO_MENU_EDIT_TREE(edit_menu), - GNOMEUIINFO_SUBTREE(ACCOUNT_MENU_STR_N, account_menu), - GNOMEUIINFO_SUBTREE(TRANSACTION_MENU_STR_N, transaction_menu), + GNOMEUIINFO_SUBTREE(N_("_Account"), account_menu), + GNOMEUIINFO_SUBTREE(N_("_Transaction"), transaction_menu), GNOMEUIINFO_MENU_HELP_TREE(help_menu), GNOMEUIINFO_END }; @@ -1388,21 +1435,24 @@ gnc_register_create_popup_menu(RegWindow *regData) { { GNOME_APP_UI_ITEM, - RECORD_MENU_STR_N, TOOLTIP_RECORD_N, + N_("_Record"), + N_("Record the current transaction"), recordCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - CANCEL_MENU_STR_N, TOOLTIP_CANCEL_TRANS_N, + N_("_Cancel"), + N_("Cancel the current transaction"), cancelCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - DELETE_MENU_STR_N, TOOLTIP_DEL_TRANS_N, + N_("_Delete"), + N_("Delete the current transaction"), deleteCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1410,7 +1460,8 @@ gnc_register_create_popup_menu(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - DUPLICATE_MENU_STR_N, TOOLTIP_DUP_TRANS_N, + N_("D_uplicate"), + N_("Make a copy of the current transaction"), duplicateCB, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1418,14 +1469,18 @@ gnc_register_create_popup_menu(RegWindow *regData) GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - BLANK_MENU_STR_N, TOOLTIP_BLANK_TRANS_N, + N_("_Blank"), + N_("Move to the blank transaction at the " + "bottom of the register"), new_trans_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, { GNOME_APP_UI_ITEM, - JUMP_MENU_STR_N, TOOLTIP_JUMP_TRANS_N, + N_("_Jump"), + N_("Jump to the corresponding transaction in " + "the other account"), jump_cb, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL @@ -1526,19 +1581,19 @@ gnc_reg_set_window_name(RegWindow *regData) { case GENERAL_LEDGER: case INCOME_LEDGER: - reg_name = GENERAL_LEDGER_STR; + reg_name = _("General Ledger"); single_account = FALSE; break; case PORTFOLIO_LEDGER: - reg_name = PORTFOLIO_STR; + reg_name = _("Portfolio"); single_account = FALSE; break; case SEARCH_LEDGER: - reg_name = SEARCH_RESULTS_STR; + reg_name = _("Search Results"); single_account = FALSE; break; default: - reg_name = REGISTER_STR; + reg_name = _("Register"); single_account = TRUE; break; } @@ -2215,7 +2270,7 @@ gnc_transaction_delete_query(GtkWindow *parent) DeleteType return_value; - dialog = gnome_dialog_new(DEL_TRANS_STR, + dialog = gnome_dialog_new(_("Delete Transaction"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); @@ -2324,14 +2379,16 @@ deleteCB(GtkWidget *widget, gpointer data) } } - if (cursor_class == CURSOR_NONE) + if (cursor_class == CURSOR_CLASS_NONE) return; /* On a split cursor, just delete the one split. */ - if (cursor_class == CURSOR_SPLIT) + if (cursor_class == CURSOR_CLASS_SPLIT) { + const char *format = _("Are you sure you want to delete\n %s\n" + "from the transaction\n %s ?"); /* ask for user confirmation before performing permanent damage */ - buf = g_strdup_printf(TRANS_DEL_MSG, xaccSplitGetMemo(split), + buf = g_strdup_printf(format, xaccSplitGetMemo(split), xaccTransGetDescription(trans)); result = gnc_verify_dialog_parented(regData->window, buf, FALSE); @@ -2345,15 +2402,17 @@ deleteCB(GtkWidget *widget, gpointer data) return; } - assert(cursor_class == CURSOR_TRANS); + assert(cursor_class == CURSOR_CLASS_TRANS); /* On a transaction cursor with 2 or fewer splits in single or double * mode, we just delete the whole transaction, kerblooie */ if ((xaccTransCountSplits(trans) <= 2) && ((style == REG_SINGLE_LINE) || (style == REG_DOUBLE_LINE))) { - result = gnc_verify_dialog_parented(regData->window, - TRANS_DEL2_MSG, FALSE); + const char *message = _("Are you sure you want to delete the current " + "transaction?"); + + result = gnc_verify_dialog_parented(regData->window, message, FALSE); if (!result) return; @@ -2434,7 +2493,9 @@ gnc_register_check_close(RegWindow *regData) pending_changes = xaccSRHasPendingChanges(regData->ledger->ledger); if (pending_changes) { - if (gnc_verify_dialog_parented(regData->window, TRANS_CHANGED_MSG, TRUE)) + const char *message = _("The current transaction has been changed.\n" + "Would you like to record it?"); + if (gnc_verify_dialog_parented(regData->window, message, TRUE)) recordCB(regData->window, regData); else xaccSRCancelCursorTransChanges(regData->ledger->ledger); @@ -2485,7 +2546,7 @@ dateCB(GtkWidget *widget, gpointer data) static void helpCB(GtkWidget *widget, gpointer data) { - helpWindow(NULL, HELP_STR, HH_REGWIN); + helpWindow(NULL, NULL, HH_REGWIN); } /************************** END OF FILE **************************/ diff --git a/src/gnome/window-report.c b/src/gnome/window-report.c index a2a60b6863..e4002453f3 100644 --- a/src/gnome/window-report.c +++ b/src/gnome/window-report.c @@ -193,15 +193,16 @@ reportAnchorCB(URLType url_type, char * location, char * label, static void gnc_report_error_dialog(const char *message) { + const char *err_msg = _("Error executing scheme report."); GtkWindow *parent; gchar *text; parent = GTK_WINDOW(gnc_html_window_get_window(reportwindow)); if (message == NULL) - text = REPORT_ERR_MSG; + text = err_msg; else - text = g_strconcat(REPORT_ERR_MSG, "\n\n", message, NULL); + text = g_strconcat(err_msg, "\n\n", message, NULL); PERR("gnc_report_error_dialog: error running report.\n%s\n", message); @@ -288,7 +289,8 @@ gnc_report_properties_cb(GtkWidget *widget, gpointer data) if (report_data->option_dialog == NULL) { GtkWidget *window = gnc_html_window_get_window(reportwindow); - gnc_info_dialog_parented(GTK_WINDOW(window), REPORT_NOPARM_MSG); + gnc_info_dialog_parented(GTK_WINDOW(window), + _("This report has no parameters.")); return; } @@ -313,7 +315,7 @@ gnc_report_export(ReportData *report_data) text = report_data->text; /* Get the filename */ - export_filename = fileBox(EXPORT_TO_STR, NULL); + export_filename = fileBox(_("Export To"), NULL); if (export_filename == NULL) return; @@ -322,9 +324,11 @@ gnc_report_export(ReportData *report_data) /* See if the file exists */ if ((stat(export_filename, &file_status) == 0)) { + const char *format = _("The file \n %s\n already exists.\n" + "Are you sure you want to overwrite it?"); gboolean result; - message = g_strdup_printf(FMB_EEXIST_MSG, export_filename); + message = g_strdup_printf(format, export_filename); result = gnc_verify_dialog_parented(GTK_WIDGET(parent), message, FALSE); g_free(message); @@ -336,8 +340,9 @@ gnc_report_export(ReportData *report_data) export_dest = fopen(export_filename, "w"); if (export_dest == NULL) { - message = g_strdup_printf(FILE_EOPEN_MSG, export_filename, - g_strerror(errno)); + const char *format = _("There was an error opening the file\n" + " %s\n\n%s"); + message = g_strdup_printf(format, export_filename, g_strerror(errno)); gnc_error_dialog_parented(parent, message); g_free(message); @@ -347,8 +352,9 @@ gnc_report_export(ReportData *report_data) /* Write the data */ if (fputs(text, export_dest) == EOF) { - message = g_strdup_printf(FILE_EWRITE_MSG, export_filename, - g_strerror(errno)); + const char *format = _("There was an error writing the file\n" + " %s\n\n%s"); + message = g_strdup_printf(format, export_filename, g_strerror(errno)); gnc_error_dialog_parented(parent, message); g_free(message); @@ -358,8 +364,9 @@ gnc_report_export(ReportData *report_data) /* Close the file */ if (fclose(export_dest) == EOF) { - message = g_strdup_printf(FILE_ECLOSE_MSG, export_filename, - g_strerror(errno)); + const char *format = _("There was an error closing the file\n" + " %s\n\n%s"); + message = g_strdup_printf(format, export_filename, g_strerror(errno)); gnc_error_dialog_parented(parent, message); g_free(message); @@ -407,7 +414,7 @@ reportWindow(const char *title, SCM rendering_thunk, SCM guile_options) { gchar *prop_title; - prop_title = g_strconcat(title, " (", PARAMETERS_STR, ")", NULL); + prop_title = g_strconcat(title, " (", _("Parameters"), ")", NULL); gtk_window_set_title(GTK_WINDOW(report_data->option_dialog), prop_title); g_free(prop_title); } @@ -416,8 +423,8 @@ reportWindow(const char *title, SCM rendering_thunk, SCM guile_options) GnomeUIInfo user_buttons[] = { { GNOME_APP_UI_ITEM, - PARAMETERS_STR, - TOOLTIP_REPORT_PARM, + _("Parameters"), + _("Set the parameters for this report"), gnc_report_properties_cb, report_data, NULL, GNOME_APP_PIXMAP_STOCK, @@ -425,8 +432,8 @@ reportWindow(const char *title, SCM rendering_thunk, SCM guile_options) 0, 0, NULL }, { GNOME_APP_UI_ITEM, - EXPORT_STR, - TOOLTIP_EXPORT_REPORT, + _("Export"), + _("Export HTML-formatted report to file"), gnc_report_export_cb, report_data, NULL, GNOME_APP_PIXMAP_STOCK, diff --git a/src/messages.h b/src/messages.h index 7ba9a49427..5769e2f3b8 100644 --- a/src/messages.h +++ b/src/messages.h @@ -1,7 +1,8 @@ /********************************************************************\ - * messages.h -- national-language messages for GnuCash (eX-Accountant) * + * messages.h -- national-language messages for GnuCash * * Copyright (C) 1997 Robin D. Clark * * Copyright (C) 1997, 1998 Linas Vepstas * + * Copyright (C) 2000 Dave Peticolas * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -16,11 +17,6 @@ * You should have received a copy of the GNU General Public License* * along with this program; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * * - * Author: Rob Clark * - * Internet: rclark@cs.hmc.edu * - * Address: 609 8th Street * - * Huntington Beach, CA 92648-4632 * \********************************************************************/ #ifndef __XACC_MESSAGES_H__ @@ -28,7 +24,27 @@ #include "config.h" -/* messages_i18n.h contains messages for internationalization */ -#include "messages_i18n.h" +#if defined(HAVE_GETTEXT) /* HAVE_GETTEXT */ + +#include +#include + +#undef _ + +#ifdef DISABLE_GETTEXT_UNDERSCORE +#define _(String) (String) +#else /* ENABLE_GETTEXT_UNDERSCORE */ +#define _(String) gettext(String) +#endif /* End ENABLE_GETTEXT_UNDERSCORE */ + +#else /* Not HAVE_GETTEXT */ + +#define _(String) (String) +#define gettext(String) (String) + +#endif /* End Not HAVE_GETTEXT */ + +#undef N_ +#define N_(String) (String) #endif /* __XACC_MESSAGES_H__ */ diff --git a/src/messages_i18n.h b/src/messages_i18n.h deleted file mode 100644 index daebeedc0c..0000000000 --- a/src/messages_i18n.h +++ /dev/null @@ -1,659 +0,0 @@ -/********************************************************************\ - * messages_i18n.h -- internationalized messages for GnuCash * - * Copyright (C) 1997 Robin D. Clark * - * Copyright (C) 1997, 1998, 1999,2000 Linas Vepstas * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * 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, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * - * Boston, MA 02111-1307, USA gnu@gnu.org * - * * - * Author: Rob Clark * - * Internet: rclark@cs.hmc.edu * - * Address: 609 8th Street * - * Huntington Beach, CA 92648-4632 * -\********************************************************************/ - -#ifndef __XACC_MESSAGES_I18N_H__ -#define __XACC_MESSAGES_I18N_H__ - -#if defined(HAVE_GETTEXT) /* HAVE_GETTEXT */ - -#include -#include - -#undef _ - -#ifdef DISABLE_GETTEXT_UNDERSCORE -#define _(String) (String) -#else /* ENABLE_GETTEXT_UNDERSCORE */ -#define _(String) gettext(String) -#endif /* End ENABLE_GETTEXT_UNDERSCORE */ - -#else /* Not HAVE_GETTEXT */ - -#define _(String) (String) -#define gettext(String) (String) - -#endif /* End Not HAVE_GETTEXT */ - -#undef N_ -#define N_(String) (String) - - -/** MISC INTERNATIONALIZATION PIECES-PARTS: ******************************/ - -/** DIALOG BOX MESSAGES: ********************************************/ -#define FILE_EWRITE_MSG _("There was an error writing the file\n %s" \ - "\n\n%s") -#define FILE_EOPEN_MSG _("There was an error opening the file\n %s" \ - "\n\n%s") -#define FILE_ECLOSE_MSG _("There was an error closing the file\n %s" \ - "\n\n%s") -#define FMB_EEXIST_MSG _("The file \n %s\n already exists.\n" \ - "Are you sure you want to overwrite it?") -#define FMB_INVALID_MSG _("The filepath \n %s\n" \ - "is not a valid location in the filesystem.") -#define FMB_LOCKED_MSG _("The file \n %s\n" \ - "appears to be in use by another user.\n" \ - "If this is not right, remove the .LCK file " \ - "and try again.") -#define QIF_LOAD_FAILED_FORMAT_MSG _("QIF file load failed:\n%s") -#define QIF_LOAD_WARNING_FORMAT_MSG _("QIF file load warning:\n%s") -#define QIF_PARSE_FAILED_FORMAT_MSG _("QIF file parse failed:\n%s") -#define QIF_PARSE_WARNING_FORMAT_MSG _("QIF file parse warning:\n%s") - -#define RECN_CANCEL_WARN _("You have made changes to this reconcile " \ - "window.\nAre you sure you want to cancel?") -#define RECN_TRANS_WARN _("Warning! This is a reconciled transaction. " \ - "Do you want do continue?") - -#define REG_CURR_MSG _("You cannot transfer funds from the %s " \ - "account.\nIt does not have a matching " \ - "currency.\nTo transfer funds between " \ - "accounts with different currencies\n" \ - "you need an intermediate currency account.\n" \ - "Please see the GnuCash online manual") -#define REPORT_ERR_MSG _("Error executing scheme report.") -#define REPORT_NOPARM_MSG _("This report has no parameters.") -#define SHOW_INC_EXP_MSG _("Show the income and expense accounts.") -#define TRANS_CHANGED_MSG _("The current transaction has been changed.\n"\ - "Would you like to record it?") -#define TRANS_DEL_MSG _("Are you sure you want to delete\n %s\n"\ - "from the transaction\n %s ?") -#define TRANS_DEL2_MSG _("Are you sure you want to delete the current "\ - "transaction?") -#define VERIFY_CHANGE_MSG _("The following changes must be made. Continue?") -#define XFER_NSF_MSG _("There must be at least two accounts\n"\ - "created before you can transfer funds.") -#define XFER_CURR_MSG _("You cannot transfer between those accounts.\n" \ - "They do not have a common currency.\n" \ - "To transfer funds between " \ - "accounts with different currencies you\n" \ - "need an intermediate currency account.\n" \ - "Please see the GnuCash online manual") -#define XFER_DIFF_MSG _("The \"From\" and \"To\" accounts\n must be " \ - "different!") -#define XFER_SAME_MSG _("You can't transfer from and to the same " \ - "account!") -#define XFER_NO_ACC_MSG _("You must specify an account to transfer from,\n"\ - "or to, or both, for this transaction.\n" \ - "Otherwise, it will not be recorded.") - - -/* Tooltip phrases */ -#define TOOLTIP_ADJUST_N N_("Adjust the balance of the selected " \ - "account") -#define TOOLTIP_ADJUST _(TOOLTIP_ADJUST_N) -#define TOOLTIP_ADJUST_AMOUNT _("Enter the new balance") -#define TOOLTIP_ADJUST_DATE _("Enter the date you want the balance "\ - "adjusted") -#define TOOLTIP_ADJUST_END_N N_("Adjust the ending balance") -#define TOOLTIP_ADJUST_END _(TOOLTIP_ADJUST_END_N) -#define TOOLTIP_ADJUST_REG_N N_("Adjust the balance of the main account "\ - "for this register") -#define TOOLTIP_ADJUST_REG _(TOOLTIP_ADJUST_REG_N) -#define TOOLTIP_AUTO_DOUBLE_N N_("Double line mode with a multi-line cursor") -#define TOOLTIP_AUTO_DOUBLE _(TOOLTIP_AUTO_DOUBLE_N) -#define TOOLTIP_AUTO_SINGLE_N N_("Single line mode with a multi-line cursor") -#define TOOLTIP_AUTO_SINGLE _(TOOLTIP_AUTO_SINGLE_N) -#define TOOLTIP_BLANK_TRANS_N N_("Move to the blank transaction at the "\ - "bottom of the register") -#define TOOLTIP_BLANK_TRANS _(TOOLTIP_BLANK_TRANS_N) -#define TOOLTIP_CANCEL_TRANS_N N_("Cancel the current transaction") -#define TOOLTIP_CANCEL_TRANS _(TOOLTIP_CANCEL_TRANS_N) -#define TOOLTIP_CLOSE_HTML _("Close this HTML window") -#define TOOLTIP_CLOSE_REG_N N_("Close this register window") -#define TOOLTIP_CLOSE_REG _(TOOLTIP_CLOSE_REG_N) -#define TOOLTIP_COPY_TRANS_N N_("Copy the selected transaction") -#define TOOLTIP_COPY_TRANS _(TOOLTIP_COPY_TRANS_N) -#define TOOLTIP_CURRENCY _("Enter a 3-letter ISO currency code such " \ - "as USD (US Dollars)") -#define TOOLTIP_CUT_TRANS_N N_("Cut the selected transaction") -#define TOOLTIP_CUT_TRANS _(TOOLTIP_CUT_TRANS_N) -#define TOOLTIP_DATE_RANGE_N N_("Set the date range of this register") -#define TOOLTIP_DATE_RANGE _(TOOLTIP_DATE_RANGE_N) -#define TOOLTIP_DELETE_N N_("Delete selected account") -#define TOOLTIP_DELETE _(TOOLTIP_DELETE_N) -#define TOOLTIP_DEL_TRANS_N N_("Delete the current transaction") -#define TOOLTIP_DEL_TRANS _(TOOLTIP_DEL_TRANS_N) -#define TOOLTIP_DOUBLE_LINE_N N_("Show transactions on two lines with "\ - "more information") -#define TOOLTIP_DOUBLE_LINE _(TOOLTIP_DOUBLE_LINE_N) -#define TOOLTIP_DUP_TRANS_N N_("Make a copy of the current transaction") -#define TOOLTIP_DUP_TRANS _(TOOLTIP_DUP_TRANS_N) -#define TOOLTIP_EDIT_N N_("Edit the selected account") -#define TOOLTIP_EDIT _(TOOLTIP_EDIT_N) -#define TOOLTIP_EDIT_REG_N N_("Edit the main account for this register") -#define TOOLTIP_EDIT_REG _(TOOLTIP_EDIT_REG_N) -#define TOOLTIP_EDIT_TRANS_N N_("Edit the current transaction") -#define TOOLTIP_EDIT_TRANS _(TOOLTIP_EDIT_TRANS_N) -#define TOOLTIP_EXIT_N N_("Exit GnuCash") -#define TOOLTIP_EXIT _(TOOLTIP_EXIT_N) -#define TOOLTIP_EXPORT_REPORT _("Export HTML-formatted report to file") -#define TOOLTIP_FIN_CALC_N N_("Use the financial calculator") -#define TOOLTIP_FIND_N N_("Find transactions with a search") -#define TOOLTIP_FIND _(TOOLTIP_FIND_N) -#define TOOLTIP_HELP_N N_("Open the GnuCash help window") -#define TOOLTIP_HELP _(TOOLTIP_HELP_N) -#define TOOLTIP_HTML_BACK _("Move back one step in the history") -#define TOOLTIP_HTML_FORW _("Move forward one step in the history") -#define TOOLTIP_IMPORT_QIF_N N_("Import a Quicken QIF file") -#define TOOLTIP_IMPORT_QIF _(TOOLTIP_IMPORT_QIF_N) -#define TOOLTIP_JUMP_TRANS_N N_("Jump to the corresponding transaction in "\ - "the other account") -#define TOOLTIP_JUMP_TRANS _(TOOLTIP_JUMP_TRANS_N) -#define TOOLTIP_MAN_N N_("Open the GnuCash Manual") -#define TOOLTIP_MAN _(TOOLTIP_MAN_N) -#define TOOLTIP_MULTI_LINE_N N_("Show transactions on multiple lines with "\ - "one line for each split") -#define TOOLTIP_MULTI_LINE _(TOOLTIP_MULTI_LINE_N) -#define TOOLTIP_MULTI_SPLIT _("This transaction has multiple splits; "\ - "switch to multi-line mode to see them all") -#define TOOLTIP_NEW_N N_("Create a new account") -#define TOOLTIP_NEW _(TOOLTIP_NEW_N) -#define TOOLTIP_NEW_FILE_N N_("Create a new file") -#define TOOLTIP_NEW_FILE _(TOOLTIP_NEW_FILE_N) -#define TOOLTIP_NEW_TRANS_N N_("Add a new transaction to the account") -#define TOOLTIP_NEW_TRANS _(TOOLTIP_NEW_TRANS_N) -#define TOOLTIP_OPEN_N N_("Open the selected account") -#define TOOLTIP_OPEN _(TOOLTIP_OPEN_N) -#define TOOLTIP_OPEN_ACC_N N_("Open the account") -#define TOOLTIP_OPEN_ACC _(TOOLTIP_OPEN_ACC_N) -#define TOOLTIP_OPEN_SUB_N N_("Open the selected account and all its "\ - "subaccounts") -#define TOOLTIP_OPEN_SUB _(TOOLTIP_OPEN_SUB_N) -#define TOOLTIP_OPEN_FILE_N N_("Open a file") -#define TOOLTIP_OPEN_FILE _(TOOLTIP_OPEN_FILE_N) -#define TOOLTIP_PASTE_TRANS_N N_("Paste the transaction clipboard") -#define TOOLTIP_PASTE_TRANS _(TOOLTIP_PASTE_TRANS_N) -#define TOOLTIP_PREFERENCES_N N_("Open the global preferences dialog") -#define TOOLTIP_PREFERENCES _(TOOLTIP_PREFERENCES_N) -#define TOOLTIP_PRINT_CHECK_N N_("Print a check using a standard format") -#define TOOLTIP_PRINT_CHECK _(TOOLTIP_PRINT_CHECK_N) -#define TOOLTIP_RECONCILE_N N_("Reconcile the selected account") -#define TOOLTIP_RECONCILE _(TOOLTIP_RECONCILE_N) -#define TOOLTIP_RECN_CANCEL_N N_("Cancel the reconciliation of this account") -#define TOOLTIP_RECN_CANCEL _(TOOLTIP_RECN_CANCEL_N) -#define TOOLTIP_RECN_FINISH_N N_("Finish the reconciliation of this account") -#define TOOLTIP_RECN_FINISH _(TOOLTIP_RECN_FINISH_N) -#define TOOLTIP_RECN_INFO_N N_("Change the reconcile information "\ - "including statement date and ending "\ - "balance.") -#define TOOLTIP_RECN_REG_N N_("Reconcile the main account for this "\ - "register") -#define TOOLTIP_RECN_REG _(TOOLTIP_RECN_REG_N) -#define TOOLTIP_RECORD_N N_("Record the current transaction") -#define TOOLTIP_RECORD _(TOOLTIP_RECORD_N) -#define TOOLTIP_REPORT_PARM _("Set the parameters for this report") -#define TOOLTIP_SAVE_FILE_N N_("Save the file to disk") -#define TOOLTIP_SAVE_FILE _(TOOLTIP_SAVE_FILE_N) -#define TOOLTIP_SCRUB_ACCT_N N_("Identify and fix problems in the account") -#define TOOLTIP_SCRUB_ACCT _(TOOLTIP_SCRUB_ACCT_N) -#define TOOLTIP_SCRUB_ALL_N N_("Identify and fix problems in all the "\ - "accounts") -#define TOOLTIP_SCRUB_ALL _(TOOLTIP_SCRUB_ALL_N) -#define TOOLTIP_SCRUB_SUB_N N_("Identify and fix problems in the account "\ - "and its subaccounts") -#define TOOLTIP_SCRUB_SUB _(TOOLTIP_SCRUB_SUB_N) -#define TOOLTIP_SCRUB_REG_N N_("Identify and fix problems in the "\ - "accounts of this register") -#define TOOLTIP_SCRUB_REG _(TOOLTIP_SCRUB_REG_N) -#define TOOLTIP_SET_DEFAULT _("Set the option to its default value") -#define TOOLTIP_SHOW_ALL_N N_("Show all of the transactions in the "\ - "account") -#define TOOLTIP_SHOW_ALL _(TOOLTIP_SHOW_ALL_N) -#define TOOLTIP_SINGLE_LINE_N N_("Show transactions on single lines") -#define TOOLTIP_SINGLE_LINE _(TOOLTIP_SINGLE_LINE_N) -#define TOOLTIP_SORT_BY_AMNT_N N_("Sort by Amount") -#define TOOLTIP_SORT_BY_AMNT _(TOOLTIP_SORT_BY_AMNT_N) -#define TOOLTIP_SORT_BY_DATE_N N_("Sort by Date") -#define TOOLTIP_SORT_BY_DATE _(TOOLTIP_SORT_BY_DATE_N) -#define TOOLTIP_SORT_BY_DESC_N N_("Sort by Description") -#define TOOLTIP_SORT_BY_DESC _(TOOLTIP_SORT_BY_DESC_N) -#define TOOLTIP_SORT_BY_ENTERED_N N_("Sort by the date of entry") -#define TOOLTIP_SORT_BY_ENTERED _(TOOLTIP_SORT_BY_ENTERED_N) -#define TOOLTIP_SORT_BY_MEMO_N N_("Sort by Memo") -#define TOOLTIP_SORT_BY_MEMO _(TOOLTIP_SORT_BY_MEMO_N) -#define TOOLTIP_SORT_BY_NUM_N N_("Sort by Num") -#define TOOLTIP_SORT_BY_NUM _(TOOLTIP_SORT_BY_NUM_N) -#define TOOLTIP_SORT_BY_STMT_N N_("Sort by the statement date "\ - "(unreconciled items last") -#define TOOLTIP_SORT_BY_STMT _(TOOLTIP_SORT_BY_STMT_N) -#define TOOLTIP_STANDARD_ORD_N N_("Keep normal account order") -#define TOOLTIP_STANDARD_ORD _(TOOLTIP_STANDARD_ORD_N) -#define TOOLTIP_TOTD_N N_("Tips of the Day") -#define TOOLTIP_TOTD _(TOOLTIP_TOTD_N) -#define TOOLTIP_TRANSFER_N N_("Transfer funds from one account to "\ - "another") -#define TOOLTIP_TRANSFER _(TOOLTIP_TRANSFER_N) - - -/* Register cell help phrases */ -#define ACTION_CELL_HELP _("Enter the type of transaction, or choose "\ - "one from the list") -#define DESC_CELL_HELP _("Enter a description of the transaction") -#define MEMO_CELL_HELP _("Enter a description of the split") -#define NUM_CELL_HELP _("Enter the transaction number, such as the "\ - "check number") -#define PRICE_CELL_HELP _("Enter the share price") -#define SHARES_CELL_HELP _("Enter the number of shares bought or sold") -#define VALUE_CELL_HELP _("Enter the total value of the shares") -#define XFER_CELL_HELP _("Enter the account to transfer from, or choose "\ - "one from the list") -#define XFER_TO_CELL_HELP _("Enter the account to transfer to, or choose "\ - "one from the list") - - -/* Menu strings with underscore accelerators */ -#define ACCOUNT_MENU_STR_N N_("_Account") -#define ACCOUNT_MENU_STR _(ACCOUNT_MENU_STR_N) -#define ACCOUNTS_MENU_STR_N N_("_Accounts") -#define ACCOUNTS_MENU_STR _(ACCOUNTS_MENU_STR_N) -#define ADJ_BALN_MENU_STR _("_Adjust Balance") -#define ADJ_BALN_MENU_E_STR_N N_("_Adjust Balance...") -#define BLANK_MENU_STR_N N_("_Blank") -#define BLANK_MENU_STR _(BLANK_MENU_STR_N) -#define CANCEL_MENU_STR_N N_("_Cancel") -#define CANCEL_MENU_STR _(CANCEL_MENU_STR_N) -#define COPY_TRANS_STR_N N_("Copy Transaction") -#define COPY_TRANS_STR _(COPY_TRANS_STR_N) -#define CUT_TRANS_STR_N N_("Cut Transaction") -#define CUT_TRANS_STR _(CUT_TRANS_STR_N) -#define DATE_RANGE_MENU_STR_N N_("_Date Range") -#define DATE_RANGE_MENU_STR _(DATE_RANGE_MENU_STR_N) -#define DEL_ACC_MENU_STR_N N_("_Delete Account") -#define DEL_ACC_MENU_STR _(DEL_ACC_MENU_STR_N) -#define DELETE_MENU_STR_N N_("_Delete") -#define DELETE_MENU_STR _(DELETE_MENU_STR_N) -#define DUPLICATE_MENU_STR_N N_("D_uplicate") -#define DUPLICATE_MENU_STR _(DUPLICATE_MENU_STR_N) -#define EDIT_MENU_STR_N N_("_Edit") -#define EDIT_MENU_STR _(EDIT_MENU_STR_N) -#define EDIT_ACC_MENU_STR_N N_("_Edit Account") -#define EDIT_ACC_MENU_STR _(EDIT_ACC_MENU_STR_N) -#define END_BALN_MENU_STR _("_Ending Balance") -#define END_BALN_MENU_E_STR_N N_("_Ending Balance...") -#define FINISH_MENU_STR_N N_("_Finish") -#define FINISH_MENU_STR _(FINISH_MENU_STR_N) -#define HELP_MENU_STR_N N_("_Help") -#define HELP_MENU_STR _(HELP_MENU_STR_N) -#define JUMP_MENU_STR_N N_("_Jump") -#define JUMP_MENU_STR _(JUMP_MENU_STR_N) -#define MAN_MENU_STR_N N_("_Manual") -#define MAN_MENU_STR _(MAN_MENU_STR_N) -#define NEW_MENU_STR_N N_("_New") -#define NEW_MENU_STR _(NEW_MENU_STR_N) -#define NEW_ACC_MENU_STR _("_New Account") -#define NEW_ACC_MENU_E_STR_N N_("_New Account...") -#define OPEN_ACC_MENU_STR_N N_("_Open Account") -#define OPEN_ACC_MENU_STR _(OPEN_ACC_MENU_STR_N) -#define OPEN_SUB_MENU_STR_N N_("Open S_ubaccounts") -#define OPEN_SUB_MENU_STR _(OPEN_SUB_MENU_STR_N) -#define PASTE_TRANS_STR_N N_("Paste Transaction") -#define PASTE_TRANS_STR _(PASTE_TRANS_STR_N) -#define PREFERENCES_MENU_STR _("_Preferences") -#define PREFERENCES_MENU_E_STR_N N_("_Preferences...") -#define PRINT_CHECK_MENU_E_STR_N N_("_Print Check... (unfinished!)") -#define RECN_INFO_MENU_E_STR_N N_("_Reconcile Information...") -#define RECONCILE_MENU_E_STR_N N_("_Reconcile...") -#define RECONCILE_MENU_STR_N N_("_Reconcile") -#define RECONCILE_MENU_STR _(RECONCILE_MENU_STR_N) -#define RECORD_MENU_STR_N N_("_Record") -#define RECORD_MENU_STR _(RECORD_MENU_STR_N) -#define REGISTER_MENU_STR_N N_("_Register") -#define REGISTER_MENU_STR _(REGISTER_MENU_STR_N) -#define SCRUB_MENU_STR_N N_("_Scrub") -#define SCRUB_MENU_STR _(SCRUB_MENU_STR_N) -#define SCRUB_ACC_MENU_STR_N N_("Scrub A_ccount") -#define SCRUB_ACC_MENU_STR _(SCRUB_ACC_MENU_STR_N) -#define SCRUB_ALL_MENU_STR_N N_("Scrub A_ll") -#define SCRUB_ALL_MENU_STR _(SCRUB_ALL_MENU_STR_N) -#define SCRUB_SUB_MENU_STR_N N_("Scrub Su_baccounts") -#define SCRUB_SUB_MENU_STR _(SCRUB_SUB_MENU_STR_N) -#define SET_RANGE_MENU_E_STR_N N_("Set _Range...") -#define SET_RANGE_MENU_STR _("Set _Range") -#define SHOW_ALL_MENU_STR_N N_("Show _All") -#define SHOW_ALL_MENU_STR _(SHOW_ALL_MENU_STR_N) -#define SORT_ORDER_MENU_STR_N N_("Sort _Order") -#define SORT_ORDER_MENU_STR _(SORT_ORDER_MENU_STR_N) -#define STYLE_MENU_STR_N N_("_Style") -#define STYLE_MENU_STR _(STYLE_MENU_STR_N) -#define TOOLS_MENU_STR_N N_("_Tools") -#define TOOLS_MENU_STR _(TOOLS_MENU_STR_N) -#define TOTD_MENU_STR_N N_("_Tips Of The Day") -#define TOTD_MENU_STR _(TOTD_MENU_STR_N) -#define TRANSACTION_MENU_STR_N N_("_Transaction") -#define TRANSACTION_MENU_STR _(TRANSACTION_MENU_STR_N) -#define TRANSFER_MENU_STR _("_Transfer") -#define TRANSFER_MENU_E_STR_N N_("_Transfer...") - - -/* Error messages */ -#define ERROR_IN_AMOUNT _("You must enter a valid amount.\n\n" \ - "Error: %s.") -#define PARSER_UNBALANCED_PARENS _("Unbalanced parenthesis") -#define PARSER_STACK_OVERFLOW _("Stack overflow") -#define PARSER_STACK_UNDERFLOW _("Stack underflow") -#define PARSER_UNDEFINED_CHARACTER _("Undefined character") -#define PARSER_NOT_A_VARIABLE _("Not a variable") -#define PARSER_OUT_OF_MEMORY_STR _("Out of memory") - - -/** MISC INTERNATIONALIZATION STRINGS: ******************************/ - -/* phrases */ -#define ACC_CODE_STR _("Account Code") -#define ACC_NAME_STR _("Account Name") -#define ACC_TYPE_STR _("Account Type") -#define ADJ_BALN_STR _("Adjust Balance") -#define AUTO_DOUBLE_STR_N N_("Auto Double") -#define AUTO_DOUBLE_STR _(AUTO_DOUBLE_STR_N) -#define AUTO_SINGLE_STR_N N_("Auto Single") -#define AUTO_SINGLE_STR _(AUTO_SINGLE_STR_N) -#define CLEAR_ALL_STR _("Clear All") -#define CLOSE_WIN_STR _("Close Window") -#define CREDIT_CARD_STR _("Credit Card") -#define CREDITLINE_STR _("Credit Line") /* Line of Credit */ -#define DATE_RANGE_STR _("Date Range") -#define DEL_ACC_STR _("Delete Account") -#define DEL_TRANS_STR _("Delete Transaction") -#define DISPLAY_NEXT_TIME_STR _("Display this dialog next time") -#define DOUBLE_LINE_STR_N N_("Double Line") -#define DOUBLE_LINE_STR _(DOUBLE_LINE_STR_N) -#define EDIT_ACCT_STR _("Edit Account") -#define END_BALN_STR _("Ending Balance") -#define END_DATE_STR _("End date") -#define EXPORT_TO_STR _("Export To") -#define FIN_CALC_STR_N N_("Financial Calculator") -#define FIN_CALC_STR _("FIN_CALC_STR_N") -#define FINISH_STR _("Finish") -#define FROM_NOW_STR _("From Now") -#define GENERAL_LEDGER_STR _("General Ledger") -#define HIDE_INC_EXP_STR _("Hide Inc/Exp") -#define IMPORT_QIF_E_STR_N N_("Import QIF...") -#define IMPORT_QIF_STR _("Import QIF") -#define LOST_ACC_STR _("Lost Accounts") -#define MONEYMRKT_STR _("Money Market") -#define MULTI_LINE_STR_N N_("Multi Line") -#define MULTI_LINE_STR _(MULTI_LINE_STR_N) -#define MUTUAL_FUND_STR _("Mutual Fund") -#define NEW_ACC_STR _("New Account") -#define NEW_BALN_STR _("New Balance") -#define NEW_FILE_STR_N N_("New File") -#define NEW_FILE_STR _(NEW_FILE_STR_N) -#define NEW_TOP_ACCT_STR _("New top level account") -#define NEW_VALUE_STR _("New Value") -#define NO_DESC_STR _("No description") -#define OLD_VALUE_STR _("Old Value") -#define OPEN_ACC_STR _("Open Account") -#define OPEN_BALN_STR _("Opening Balance") -#define OPEN_FILE_STR _("Open File") -#define OPEN_SUB_STR _("Open Subaccounts") -#define PICK_ONE_STR _("Pick One") -#define PARENT_ACC_STR _("Parent Account") -#define PREV_BALN_STR _("Previous Balance") -#define PURCH_PRIC_STR _("Purch Price") -#define QUOTE_SRC_STR _("Price Quote Source") -#define RECONCILE_BALN_STR _("Reconciled Balance") -#define RECONCILE_INFO_STR _("Reconcile Information") -#define REG_DATE_RANGES_STR _("Register date ranges") -#define SALE_PRIC_STR _("Sale Price") -#define SAVE_AS_STR _("Save As") -#define SCRUB_ACCT_STR _("Scrub Account") -#define SCRUB_ALL_STR _("Scrub All") -#define SCRUB_SUBACCTS_STR _("Scrub Subaccounts") -#define SELECT_ALL_STR _("Select All") -#define SELECT_DEFAULT_STR _("Select Default") -#define SET_DATE_RANGE_STR _("Set Date Range") -#define SET_RANGE_STR _("Set Range") -#define SET_TO_DEFAULT_STR _("Set to default") -#define SETUP_ACCT_STR _("Set Up Account") -#define SHOW_ALL_STR _("Show All") -#define SHOW_INC_EXP_STR _("Show Income/Expense") -#define SHOW_EARLIEST_STR _("Show Earliest") -#define SHOW_LATEST_STR _("Show Latest") -#define SINGLE_LINE_STR_N N_("Single Line") -#define SINGLE_LINE_STR _(SINGLE_LINE_STR_N) -#define SORT_BY_AMNT_STR_N N_("Sort by Amount") -#define SORT_BY_AMNT_STR _(SORT_BY_AMNT_STR_N) -#define SORT_BY_DATE_STR_N N_("Sort by Date") -#define SORT_BY_DATE_STR _(SORT_BY_DATE_STR_N) -#define SORT_BY_DESC_STR_N N_("Sort by Description") -#define SORT_BY_DESC_STR _(SORT_BY_DESC_STR_N) -#define SORT_BY_ENTERED_STR_N N_("Sort by date of entry") -#define SORT_BY_ENTERED_STR _(SORT_BY_ENTERED_STR_N) -#define SORT_BY_MEMO_STR_N N_("Sort by Memo") -#define SORT_BY_MEMO_STR _(SORT_BY_MEMO_STR_N) -#define SORT_BY_NUM_STR_N N_("Sort by Num") -#define SORT_BY_NUM_STR _(SORT_BY_NUM_STR_N) -#define SORT_BY_STMT_STR_N N_("Sort by statement date") -#define SORT_BY_STMT_STR _(SORT_BY_STMT_STR_N) -#define SORT_ORDER_STR _("Sort Order") -#define START_DATE_STR _("Start date") -#define START_BALN_STR _("Starting Balance") -#define STANDARD_ORDER_STR_N N_("Standard order") -#define STANDARD_ORDER_STR _(STANDARD_ORDER_STR_N) -#define STATEMENT_DATE_C_STR _("Statement Date:") -#define TOTD_STR _("Tip of the Day:") -#define TOP_ACCT_STR _("Top level account") -#define TOTAL_SHARES_STR _("Total Shares") -#define VERIFY_CHANGES_STR _("Verify Changes") -#define XFER_INFO _("Transfer Information") -#define XFER_MONEY_STR _("Transfer Money") -#define XFRM_STR _("Transfer From") -#define XFTO_STR _("Transfer To") - -/* single words */ -#define ABOUT_STR _("About") -#define ACCOUNT_STR _("Account") -#define ACCOUNTS_STR _("Accounts") -#define ACC_INFO_STR _("Account Information") -#define ACH_STR _("AutoDep") /* Automatic Check Handling auto deposit */ -#define ACTION_STR _("Action") -#define ACTIVITIES_STR _("Activities") -#define AGO_STR _("Ago") -#define AMT_STR _("Amount") -#define APPR_STR _("Appreciation") -#define ARU_STR _("Phone") /* Automated Response Unit telephone xfer */ -#define ASSET_STR _("Asset") -#define ASSETS_STR _("Assets") -#define ATM_STR _("ATM") /* automatic teller machine */ -#define BACK_STR _("Back") -#define BALN_STR _("Balance") -#define BALN_EURO_STR _("Balance") -#define BANK_STR _("Bank") -#define BLANK_STR_N N_("Blank") -#define BLANK_STR _(BLANK_STR_N) -#define BOUGHT_STR _("Bought") -#define BUY_STR _("Buy") -#define CANCEL_STR_N N_("Cancel") -#define CANCEL_STR _(CANCEL_STR_N) -#define CASH_STR _("Cash") -#define CHANGED_STR _("Changed") -#define CHARGE_STR _("Charge") -#define CHECK_STR _("Check") -#define CHECKING_STR _("Checking") -#define CLEARED_STR _("Cleared") -#define CLOSE_STR_N N_("Close") -#define CLOSE_STR _(CLOSE_STR_N) -#define COMMIT_STR _("Commit") -#define CREATE_STR _("Create") -#define CREDIT_STR _("Credit") -#define CREDITS_STR_N N_("Credits") -#define CREDITS_STR _(CREDITS_STR_N) -#define CURRENCY_STR _("Currency") -#define DATE_STR _("Date") -#define DAYS_STR _("Days") -#define DEBIT_STR _("Debit") -#define DEBITS_STR_N N_("Debits") -#define DEBITS_STR _(DEBITS_STR_N) -#define DECREASE_STR _("Decrease") -#define DEFICIT_STR _("Deficit") -#define DELETE_STR_N N_("Delete") -#define DELETE_STR _(DELETE_STR_N) -#define DEPOSIT_STR _("Deposit") -#define DEPR_STR _("Depreciation") -#define DESC_STR _("Description") -#define DIFF_STR _("Difference") -#define DIRECTDEBIT_STR _("Direct Debit") -#define DIST_STR _("Dist") /* Distribution */ -#define DIV_STR _("Div") /* Dividend */ -#define DUPLICATE_STR_N N_("Duplicate") -#define DUPLICATE_STR _(DUPLICATE_STR_N) -#define EDIT_STR_N N_("Edit") -#define EDIT_STR _(EDIT_STR_N) -#define EQUITY_STR _("Equity") -#define EURO_TOTAL_STR _("EUR (total)") -#define EXIT_STR_N N_("Exit") -#define EXIT_STR _(EXIT_STR_N) -#define EXPENSE_STR _("Expense") -#define EXPORT_STR _("Export") -#define EXTENSIONS_STR _("Extensions") -#define FEE_STR _("Fee") -#define FIELD_STR _("Field") -#define FILE_STR _("File") -#define FIND_STR_N N_("Find") -#define FIND_STR _(FIND_STR_N) -#define FORWARD_STR _("Forward") -#define FROM_STR _("From") -#define GNC_PREFS _("GnuCash Preferences") -#define HELP_STR _("Help") -#define IMBALANCE_STR _("Imbalance") -#define IMPORT_STR_N N_("Import") -#define IMPORT_STR _(IMPORT_STR_N) -#define INCOME_STR _("Income") -#define INCREASE_STR _("Increase") -#define INT_STR _("Int") /* Interest */ -#define JUMP_STR_N N_("Jump") -#define JUMP_STR _(JUMP_STR_N) -#define LIABILITY_STR _("Liability") -#define LICENSE_STR _("License") -#define LOAN_STR _("Loan") -#define LTCG_STR _("LTCG") /* Long Term Capital Gains */ -#define MEMO_STR _("Memo") -#define MONTHS_STR _("Months") -#define NEW_STR_N N_("New") -#define NEW_STR _(NEW_STR_N) -#define NO_STR _("No") -#define NONE_STR _("(none)") -#define NOTES_STR _("Notes") -#define NUM_STR _("Num") -#define OK_STR _("Ok") -#define ONLINE_STR _("Online") -#define OPEN_STR_N N_("Open") -#define OPEN_STR _(OPEN_STR_N) -#define ORPHAN_STR _("Orphan") -#define PARAMETERS_STR _("Parameters") -#define PAYMENT_STR _("Payment") -#define PORTFOLIO_STR _("Portfolio") -#define POS_STR _("POS") /* Point of Sale credit card machine */ -#define PREFERENCES_STR _("Preferences") -#define PRICE_STR _("Price") -#define PRINT_STR _("Print") -#define PROFITS_STR _("Profits") -#define QUIT_STR _("Quit") -#define REBATE_STR _("Rebate") -#define RECEIVE_STR _("Receive") -#define RECONCILE_STR _("Reconcile") -#define RECORD_STR_N N_("Record") -#define RECORD_STR _(RECORD_STR_N) -#define REGISTER_STR _("Register") -#define REPORT_STR _("Report") -#define REPORTS_STR _("Reports") -#define SAVE_STR_N N_("Save") -#define SAVE_STR _(SAVE_STR_N) -#define SAVINGS_STR _("Savings") -#define SCRUB_STR _("Scrub") -#define SEARCH_RESULTS_STR _("Search Results") -#define SECURITY_STR _("Security") -#define SELL_STR _("Sell") -#define SETTINGS_STR _("Settings") -#define SHARES_STR _("Shares") -#define SIMPLE_STR _("Simple") -#define SOLD_STR _("Sold") -#define SPEND_STR _("Spend") -#define SPLIT_STR _("Split") -#define STCG_STR _("STCG") /* Short Term Captial Gains */ -#define STOCK_STR _("Stock") -#define STYLE_STR _("Style") -#define SURPLUS_STR _("Surplus") -#define TELLER_STR _("Teller") -#define TO_STR _("To") -#define TODAY_STR _("Today") -#define TOTAL_STR _("Total") -#define TOTAL_EURO_STR _("Total") -#define TYPE_STR _("Type") -#define TRANSACTION_STR _("Transaction") -#define TRANSFER_STR_N N_("Transfer") -#define TRANSFER_STR _(TRANSFER_STR_N) -#define UNTITLED_STR _("Untitled") -#define VALUE_STR _("Value") -#define WARN_STR _("WARNING") -#define WEEKS_STR _("Weeks") -#define WIRE_STR _("Wire") /* Electronic Wire transfer */ -#define WITHDRAW_STR _("Withdraw") -#define WITHDRAWAL_STR _("Withdrawal") -#define YEARS_STR _("Years") -#define YES_STR _("Yes") - -/* single letters */ -#define CLEARED_ABBREV _("cleared:c"+8) -#define FROZEN_ABBREV _("frozen:f"+7) -#define NOT_CLEARED_ABBREV _("not cleared:n"+12) -#define RECONCILE_ABBREV _("Reconciled:R"+11) -#define RECONCILED_ABBREV _("reconciled:y"+11) - -/* register sample strings */ -#define DATE_CELL_SAMPLE _("sample:12/12/2000"+7) -#define NUM_CELL_SAMPLE _("sample:99999"+7) -#define ACTN_CELL_SAMPLE TRANSFER_STR -#define XFRM_CELL_SAMPLE _("sample:Expenses:Automobile:Gasoline"+7) -#define MXFRM_CELL_SAMPLE XFRM_CELL_SAMPLE -#define XTO_CELL_SAMPLE XFRM_CELL_SAMPLE -#define DESC_CELL_SAMPLE _("sample:Description of a transaction"+7) -#define MEMO_CELL_SAMPLE _("sample:Memo field sample text string"+7) -#define RECN_CELL_SAMPLE RECONCILE_ABBREV -#define DEBT_CELL_SAMPLE _("sample:999,999.000"+7) -#define CRED_CELL_SAMPLE DEBT_CELL_SAMPLE -#define NDEBT_CELL_SAMPLE DEBT_CELL_SAMPLE -#define NCRED_CELL_SAMPLE DEBT_CELL_SAMPLE -#define PRIC_CELL_SAMPLE DEBT_CELL_SAMPLE -#define VALU_CELL_SAMPLE DEBT_CELL_SAMPLE -#define SHRS_CELL_SAMPLE DEBT_CELL_SAMPLE -#define BALN_CELL_SAMPLE DEBT_CELL_SAMPLE -#define SHRBALN_CELL_SAMPLE DEBT_CELL_SAMPLE - -#endif /* __XACC_MESSAGES_I18N_H__ */ diff --git a/src/register/basiccell.c b/src/register/basiccell.c index 080c405d69..66b0d253c2 100644 --- a/src/register/basiccell.c +++ b/src/register/basiccell.c @@ -71,9 +71,7 @@ void xaccInitBasicCell (BasicCell *cell) cell->input_output = XACC_CELL_ALLOW_ALL; cell->changed = 0; - cell->bg_color = 0xffffff; /* white */ cell->fg_color = 0x0; /* black */ - cell->use_bg_color = 0; /* ignore the color */ cell->use_fg_color = 0; /* ignore the color */ cell->value = g_strdup(""); diff --git a/src/register/basiccell.h b/src/register/basiccell.h index 4eb8ba1e1d..66d62c740a 100644 --- a/src/register/basiccell.h +++ b/src/register/basiccell.h @@ -218,11 +218,9 @@ typedef char * (*CellGetHelpFunc) (BasicCell *cell); struct _BasicCell { /* cell attributes */ - guint32 bg_color; /* background color, ARGB format */ guint32 fg_color; /* forground (text) color ARGB format */ gboolean use_fg_color; /* if 0, above is ignored */ - gboolean use_bg_color; /* if 0, above is ignored */ char * value; /* current value */ char * blank_help; /* help when value is blank */ diff --git a/src/register/cellblock.c b/src/register/cellblock.c index ffb8383157..131bded926 100644 --- a/src/register/cellblock.c +++ b/src/register/cellblock.c @@ -39,7 +39,7 @@ static void gnc_cellblock_init (CellBlock *cellblock, int rows, int cols); /* =================================================== */ CellBlock * -gnc_cellblock_new (int rows, int cols) +gnc_cellblock_new (int rows, int cols, int cursor_type) { CellBlock *cellblock; @@ -47,6 +47,8 @@ gnc_cellblock_new (int rows, int cols) gnc_cellblock_init (cellblock, rows, cols); + cellblock->cursor_type = cursor_type; + return cellblock; } diff --git a/src/register/cellblock.h b/src/register/cellblock.h index a9257b3869..1c27dd0939 100644 --- a/src/register/cellblock.h +++ b/src/register/cellblock.h @@ -91,6 +91,8 @@ typedef struct short num_rows; short num_cols; + short cursor_type; + GTable *cb_cells; /* Holds the CellBlockCell data */ /* The active_bg_color is the default color (in argb) for the cell @@ -110,7 +112,7 @@ typedef struct } CellBlock; -CellBlock * gnc_cellblock_new (int rows, int cols); +CellBlock * gnc_cellblock_new (int rows, int cols, int cursor_type); void gnc_cellblock_destroy (CellBlock *cellblock); diff --git a/src/register/gnome/gnucash-grid.c b/src/register/gnome/gnucash-grid.c index 1368b6bdff..36e3ccdb28 100644 --- a/src/register/gnome/gnucash-grid.c +++ b/src/register/gnome/gnucash-grid.c @@ -413,6 +413,9 @@ draw_block (GnucashGrid *grid, h = cd->pixel_height; w = cd->pixel_width; + if (w == 0) + continue; + if (x_paint + w < x) continue; diff --git a/src/register/gnome/gnucash-header.c b/src/register/gnome/gnucash-header.c index b2df353b76..aef8bf563a 100644 --- a/src/register/gnome/gnucash-header.c +++ b/src/register/gnome/gnucash-header.c @@ -77,7 +77,7 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable, GdkColor *bg_color; guint32 argb; - header_style = header->sheet->cursor_styles[GNUCASH_CURSOR_HEADER]; + header_style = header->sheet->cursor_styles[CURSOR_TYPE_HEADER]; virt_loc.vcell_loc.virt_row = 0; virt_loc.vcell_loc.virt_col = 0; @@ -103,7 +103,7 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gdk_gc_set_line_attributes (header->gc, 1, GDK_LINE_SOLID, -1, -1); gdk_gc_set_background (header->gc, &gn_white); gdk_gc_set_foreground (header->gc, &gn_black); - font = style->header_font; + font = gnucash_register_font; ypaint = -y; @@ -546,7 +546,7 @@ gnucash_header_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) case ARG_CURSOR_TYPE: { gint old_type = header->type; - + header->type = GTK_VALUE_INT (*arg); needs_update = (old_type != header->type); break; @@ -654,7 +654,7 @@ gnucash_header_new (GnucashSheet *sheet) gnucash_header_get_type (), "GnucashHeader::sheet", sheet, "GnucashHeader::cursor_type", - GNUCASH_CURSOR_HEADER, + CURSOR_TYPE_HEADER, NULL); sheet->header_item = item; diff --git a/src/register/gnome/gnucash-item-edit.c b/src/register/gnome/gnucash-item-edit.c index 00a67bd210..e88282253e 100644 --- a/src/register/gnome/gnucash-item-edit.c +++ b/src/register/gnome/gnucash-item-edit.c @@ -99,10 +99,15 @@ item_edit_get_pixel_coords (ItemEdit *item_edit, int *w, int *h) { GnucashSheet *sheet = item_edit->sheet; + SheetBlock *block; int xd, yd; - gnucash_sheet_block_pixel_origin (sheet, item_edit->virt_loc.vcell_loc, - &xd, &yd); + block = gnucash_sheet_get_block (sheet, item_edit->virt_loc.vcell_loc); + if (block == NULL) + return; + + xd = block->origin_x; + yd = block->origin_y; gnucash_sheet_style_get_cell_pixel_rel_coords (item_edit->style, @@ -118,6 +123,7 @@ item_edit_get_pixel_coords (ItemEdit *item_edit, static void item_edit_draw_info(ItemEdit *item_edit, int x, int y, TextDrawInfo *info) { + SheetBlock *block; SheetBlockStyle *style; GtkEditable *editable; Table *table; @@ -136,6 +142,9 @@ item_edit_draw_info(ItemEdit *item_edit, int x, int y, TextDrawInfo *info) info->font = GNUCASH_GRID(item_edit->sheet->grid)->normal_font; + block = gnucash_sheet_get_block (item_edit->sheet, + item_edit->virt_loc.vcell_loc); + argb = gnc_table_get_bg_color (table, item_edit->virt_loc); info->bg_color = gnucash_color_argb_to_gdk (argb); diff --git a/src/register/gnome/gnucash-sheet.c b/src/register/gnome/gnucash-sheet.c index 457004ca3e..4a9f2e4c27 100644 --- a/src/register/gnome/gnucash-sheet.c +++ b/src/register/gnome/gnucash-sheet.c @@ -53,8 +53,6 @@ static void gnucash_sheet_deactivate_cursor_cell (GnucashSheet *sheet); static void gnucash_sheet_activate_cursor_cell (GnucashSheet *sheet, gboolean changed_cells); static void gnucash_sheet_stop_editing (GnucashSheet *sheet); -static gint gnucash_sheet_row_get_distance (GnucashSheet *sheet, - int v_row_a, int v_row_b); /* Register signals */ @@ -71,12 +69,12 @@ static guint register_signals[LAST_SIGNAL]; void gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor, - GNCCursorType cursor_type) + CursorType cursor_type) { g_return_if_fail (sheet != NULL); g_return_if_fail (GNUCASH_IS_SHEET (sheet)); g_return_if_fail (cursor_type >= 0); - g_return_if_fail (cursor_type < GNUCASH_NUM_CURSORS); + g_return_if_fail (cursor_type < NUM_CURSOR_TYPES); sheet->cursors[cursor_type] = cursor; } @@ -223,7 +221,7 @@ gnucash_sheet_activate_cursor_cell (GnucashSheet *sheet, gnucash_cursor_get_virt (GNUCASH_CURSOR(sheet->cursor), &virt_loc); style = gnucash_sheet_get_style (sheet, virt_loc.vcell_loc); - if (style->cursor_type == GNUCASH_CURSOR_HEADER || + if (style->cursor_type == CURSOR_TYPE_HEADER || !gnc_table_virtual_loc_valid (table, virt_loc, TRUE)) return; @@ -295,207 +293,6 @@ gnucash_sheet_cursor_move (GnucashSheet *sheet, VirtualLocation virt_loc) } -/* assumes a valid top block */ -void -gnucash_sheet_compute_visible_range (GnucashSheet *sheet) -{ - Table *table; - VirtualCellLocation vcell_loc; - gint height; - gint cy; - - g_return_if_fail (sheet != NULL); - g_return_if_fail (GNUCASH_IS_SHEET (sheet)); - - table = sheet->table; - height = GTK_WIDGET(sheet)->allocation.height; - - gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), NULL, &cy); - - vcell_loc.virt_row = sheet->top_block; - vcell_loc.virt_col = 0; - - for ( ; - vcell_loc.virt_row < sheet->num_virt_rows - 1; - vcell_loc.virt_row++ ) - { - SheetBlock *block; - - block = gnucash_sheet_get_block (sheet, vcell_loc); - - if (block->origin_y - cy + block->style->dimensions->height - >= height) - break; - } - - sheet->bottom_block = vcell_loc.virt_row; - - /* FIXME */ - sheet->left_block = 0; - sheet->right_block = 0; -} - - -void -gnucash_sheet_block_pixel_origin (GnucashSheet *sheet, - VirtualCellLocation vcell_loc, - gint *x, gint *y) -{ - SheetBlock *block; - - g_return_if_fail (sheet != NULL); - g_return_if_fail (GNUCASH_IS_SHEET(sheet)); - - if (gnucash_sheet_virt_cell_out_of_bounds (sheet, vcell_loc)) - return; - - block = gnucash_sheet_get_block (sheet, vcell_loc); - - if (x) - *x = block->origin_x; - if (y) - *y = block->origin_y; -} - - -static void -gnucash_sheet_set_top_row (GnucashSheet *sheet, gint new_top_row, gint align) -{ - VirtualCellLocation new_row_loc = { new_top_row, 0 }; - gint x, y; - gint cx, cy; - gint diff = 0; - gint height; - gint distance; - gint last_visible; - - g_return_if_fail (sheet != NULL); - g_return_if_fail (GNUCASH_IS_SHEET(sheet)); - - new_row_loc.virt_row = MAX (new_row_loc.virt_row, 1); - new_row_loc.virt_row = MIN (new_row_loc.virt_row, - sheet->num_virt_rows - 1); - - last_visible = new_row_loc.virt_row; - - if (align != GNUCASH_ALIGN_SAME) - sheet->alignment = align; - - gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), &cx, &cy); - - x = cx; - - height = GTK_WIDGET(sheet)->allocation.height; - distance = gnucash_sheet_row_get_distance(sheet, new_row_loc.virt_row, - sheet->num_virt_rows); - - while ((new_row_loc.virt_row > 1) && height > distance) - { - SheetBlock *block; - - new_row_loc.virt_row--; - - block = gnucash_sheet_get_block (sheet, new_row_loc); - if (!block->visible) - continue; - - last_visible = new_row_loc.virt_row; - - distance += block->style->dimensions->height; - } - - new_row_loc.virt_row = last_visible; - - gnucash_sheet_block_pixel_origin (sheet, new_row_loc, NULL, &y); - - if (sheet->alignment == GNUCASH_ALIGN_BOTTOM) { - VirtualCellLocation vcell_loc = { sheet->bottom_block, 0 }; - SheetBlock *block; - - distance = gnucash_sheet_row_get_distance - (sheet, sheet->top_block, sheet->bottom_block); - - block = gnucash_sheet_get_block (sheet, vcell_loc); - if (block) - distance += block->style->dimensions->height; - - if (distance > height) - diff = distance - height; - } - - y += diff; - - sheet->top_block_offset = -diff; - - sheet->top_block = last_visible; - - if (x != cx || y != cy) { - gnucash_sheet_compute_visible_range(sheet); - gnome_canvas_update_now (GNOME_CANVAS(sheet)); - - if (y != cy) - gtk_adjustment_set_value(sheet->vadj, y); - if (x != cx) - gtk_adjustment_set_value(sheet->hadj, x); - } - - gnucash_sheet_update_adjustments (sheet); -} - - -void -gnucash_sheet_make_cell_visible (GnucashSheet *sheet, VirtualLocation virt_loc) -{ - g_return_if_fail (sheet != NULL); - g_return_if_fail (GNUCASH_IS_SHEET (sheet)); - - if (!gnucash_sheet_cell_valid (sheet, virt_loc)) - return; - - if (virt_loc.vcell_loc.virt_row <= sheet->top_block) - gnucash_sheet_set_top_row (sheet, virt_loc.vcell_loc.virt_row, - GNUCASH_ALIGN_TOP); - else if (virt_loc.vcell_loc.virt_row >= sheet->bottom_block) - /* FIXME -- invisible rows */ - gnucash_sheet_set_top_row (sheet, - sheet->top_block + - (virt_loc.vcell_loc.virt_row - - sheet->bottom_block), - GNUCASH_ALIGN_BOTTOM); - - if (!sheet->smooth_scroll) - sheet->vadj->value = sheet->top_block; - - gnucash_sheet_update_adjustments (sheet); -} - - -void -gnucash_sheet_update_adjustments (GnucashSheet *sheet) -{ - GtkAdjustment *vadj; - - g_return_if_fail (sheet != NULL); - g_return_if_fail (GNUCASH_IS_SHEET (sheet)); - g_return_if_fail (sheet->vadj != NULL); - - vadj = sheet->vadj; - - if (!sheet->smooth_scroll) { - vadj->lower = 1; - vadj->upper = MAX(sheet->bottom_block, sheet->num_virt_rows); - vadj->page_size = sheet->bottom_block - sheet->top_block + 1; - vadj->page_increment = vadj->page_size - 1; - vadj->step_increment = 1; - } - else - vadj->step_increment = vadj->page_size / - (sheet->bottom_block - sheet->top_block + 1); - - gtk_adjustment_changed(vadj); -} - - static gint gnucash_sheet_y_pixel_to_block (GnucashSheet *sheet, int y) { @@ -519,39 +316,143 @@ gnucash_sheet_y_pixel_to_block (GnucashSheet *sheet, int y) } +void +gnucash_sheet_compute_visible_range (GnucashSheet *sheet) +{ + Table *table; + VirtualCellLocation vcell_loc; + gint height; + gint cy; + + g_return_if_fail (sheet != NULL); + g_return_if_fail (GNUCASH_IS_SHEET (sheet)); + + table = sheet->table; + height = GTK_WIDGET(sheet)->allocation.height; + + gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), NULL, &cy); + + sheet->top_block = gnucash_sheet_y_pixel_to_block (sheet, cy); + + sheet->num_visible_blocks = 0; + sheet->num_visible_phys_rows = 0; + + for ( vcell_loc.virt_row = sheet->top_block, vcell_loc.virt_col = 0; + vcell_loc.virt_row < sheet->num_virt_rows - 1; + vcell_loc.virt_row++ ) + { + SheetBlock *block; + + block = gnucash_sheet_get_block (sheet, vcell_loc); + if (!block->visible) + continue; + + sheet->num_visible_blocks++; + sheet->num_visible_phys_rows += block->style->nrows; + + if (block->origin_y - cy + block->style->dimensions->height + >= height) + break; + } + + sheet->bottom_block = vcell_loc.virt_row; + + /* FIXME */ + sheet->left_block = 0; + sheet->right_block = 0; +} + + +static void +gnucash_sheet_show_row (GnucashSheet *sheet, gint virt_row) +{ + VirtualCellLocation vcell_loc = { virt_row, 0 }; + SheetBlock *block; + gint block_height; + gint height; + gint cx, cy; + gint x, y; + + g_return_if_fail (sheet != NULL); + g_return_if_fail (GNUCASH_IS_SHEET(sheet)); + + vcell_loc.virt_row = MAX (vcell_loc.virt_row, 1); + vcell_loc.virt_row = MIN (vcell_loc.virt_row, sheet->num_virt_rows - 1); + + gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), &cx, &cy); + x = cx; + + height = GTK_WIDGET(sheet)->allocation.height; + + block = gnucash_sheet_get_block (sheet, vcell_loc); + + y = block->origin_y; + block_height = block->style->dimensions->height; + + if ((cy <= y) && (cy + height >= y + block_height)) + return; + + if (y > cy) + y -= height - block_height; + + if ((sheet->height - y) < height) + y = sheet->height - height; + + if (y < 0) + y = 0; + + if (y != cy) + gtk_adjustment_set_value(sheet->vadj, y); + if (x != cx) + gtk_adjustment_set_value(sheet->hadj, x); + + gnucash_sheet_compute_visible_range(sheet); + gnucash_sheet_update_adjustments (sheet); +} + + +void +gnucash_sheet_make_cell_visible (GnucashSheet *sheet, VirtualLocation virt_loc) +{ + + g_return_if_fail (sheet != NULL); + g_return_if_fail (GNUCASH_IS_SHEET (sheet)); + + if (!gnucash_sheet_cell_valid (sheet, virt_loc)) + return; + + gnucash_sheet_show_row (sheet, virt_loc.vcell_loc.virt_row); + + gnucash_sheet_update_adjustments (sheet); +} + + +void +gnucash_sheet_update_adjustments (GnucashSheet *sheet) +{ + GtkAdjustment *vadj; + + g_return_if_fail (sheet != NULL); + g_return_if_fail (GNUCASH_IS_SHEET (sheet)); + g_return_if_fail (sheet->vadj != NULL); + + vadj = sheet->vadj; + + if (sheet->num_visible_blocks > 0) + vadj->step_increment = + vadj->page_size / sheet->num_visible_blocks; + else + vadj->step_increment = 0; + + gtk_adjustment_changed(vadj); +} + + static void gnucash_sheet_vadjustment_value_changed (GtkAdjustment *adj, GnucashSheet *sheet) { - gint new_top_row; - gint oy; - - if (sheet->smooth_scroll) { - VirtualCellLocation vcell_loc; - - new_top_row = - gnucash_sheet_y_pixel_to_block (sheet, - (gint) adj->value); - - sheet->top_block = new_top_row; - - vcell_loc.virt_row = new_top_row; - vcell_loc.virt_col = 0; - - gnucash_sheet_block_pixel_origin (sheet, vcell_loc, NULL, &oy); - sheet->top_block_offset = oy - (gint)adj->value; - - gnucash_sheet_compute_visible_range(sheet); - } - else { - new_top_row = (gint) adj->value; - - if (new_top_row == sheet->top_block) - return; - - gnucash_sheet_set_top_row (sheet, new_top_row, - GNUCASH_ALIGN_SAME); - } + gnucash_sheet_compute_visible_range(sheet); } @@ -598,7 +499,7 @@ gnucash_sheet_row_get_distance (GnucashSheet *sheet, int v_row_a, int v_row_b) return sign * distance; } -#if 0 + static gint gnucash_sheet_col_get_distance (GnucashSheet *sheet, int vrow, int v_col_a, int v_col_b) @@ -643,7 +544,7 @@ gnucash_sheet_col_get_distance (GnucashSheet *sheet, int vrow, return sign * distance; } -#endif + void gnucash_sheet_redraw_all (GnucashSheet *sheet) @@ -694,7 +595,7 @@ gnucash_sheet_destroy (GtkObject *object) g_table_destroy (sheet->blocks); sheet->blocks = NULL; - for (i = GNUCASH_CURSOR_HEADER; i < GNUCASH_NUM_CURSORS; i++) + for (i = 0; i < NUM_CURSOR_TYPES; i++) gnucash_sheet_style_destroy(sheet, sheet->cursor_styles[i]); g_hash_table_destroy (sheet->dimensions_hash_table); @@ -734,12 +635,7 @@ gnucash_sheet_create (Table *table) sheet->table = table; sheet->entry = NULL; - if (sheet->smooth_scroll) - sheet->vadj = gtk_layout_get_vadjustment (GTK_LAYOUT(canvas)); - else - sheet->vadj = GTK_ADJUSTMENT(gtk_adjustment_new (0.0, 0.0, 0.0, - 1.0, 1.0, 1.0)); - + sheet->vadj = gtk_layout_get_vadjustment (GTK_LAYOUT(canvas)); sheet->hadj = gtk_layout_get_hadjustment (GTK_LAYOUT(canvas)); gtk_signal_connect(GTK_OBJECT(sheet->vadj), "value_changed", @@ -754,13 +650,13 @@ compute_optimal_width (GnucashSheet *sheet) SheetBlockStyle *style; if ((sheet == NULL) || - (sheet->cursor_styles[GNUCASH_CURSOR_HEADER] == NULL)) + (sheet->cursor_styles[CURSOR_TYPE_HEADER] == NULL)) return DEFAULT_REGISTER_WIDTH; if (sheet->window_width >= 0) return sheet->window_width; - style = sheet->cursor_styles[GNUCASH_CURSOR_HEADER]; + style = sheet->cursor_styles[CURSOR_TYPE_HEADER]; if ((style == NULL) || (style->dimensions == NULL)) return DEFAULT_REGISTER_WIDTH; @@ -781,10 +677,10 @@ compute_optimal_height (GnucashSheet *sheet) return sheet->window_height; if ((sheet == NULL) || - (sheet->cursor_styles[GNUCASH_CURSOR_HEADER] == NULL)) + (sheet->cursor_styles[CURSOR_TYPE_HEADER] == NULL)) return DEFAULT_REGISTER_HEIGHT; - style = sheet->cursor_styles[GNUCASH_CURSOR_HEADER]; + style = sheet->cursor_styles[CURSOR_TYPE_HEADER]; cd = gnucash_style_get_cell_dimensions (style, 0, 0); if (cd == NULL) @@ -1170,7 +1066,7 @@ gnucash_sheet_scroll_event(GnucashSheet *sheet, GdkEventButton *event) vadj = sheet->vadj; v_value = vadj->value; if (event->state & GDK_SHIFT_MASK) - multiplier = 5.0; + multiplier = sheet->num_visible_blocks / 2; switch (event->button) { @@ -1556,7 +1452,7 @@ gnucash_sheet_key_press_event (GtkWidget *widget, GdkEventKey *event) case GDK_Page_Up: direction = GNC_TABLE_TRAVERSE_UP; new_virt_loc.phys_col_offset = 0; - distance = sheet->bottom_block - sheet->top_block; + distance = sheet->num_visible_phys_rows - 1; gnc_table_move_vertical_position (table, &new_virt_loc, -distance); break; @@ -1564,7 +1460,7 @@ gnucash_sheet_key_press_event (GtkWidget *widget, GdkEventKey *event) case GDK_Page_Down: direction = GNC_TABLE_TRAVERSE_DOWN; new_virt_loc.phys_col_offset = 0; - distance = sheet->bottom_block - sheet->top_block; + distance = sheet->num_visible_phys_rows - 1; gnc_table_move_vertical_position (table, &new_virt_loc, distance); break; @@ -1806,27 +1702,17 @@ gnucash_sheet_block_set_from_table (GnucashSheet *sheet, table = sheet->table; vcell = gnc_table_get_virtual_cell (table, vcell_loc); - if (vcell) - block->visible = vcell->visible; if (block->style && (block->style != style)) { - - /* the zero'th virtual row isn't drawn */ - if (vcell_loc.virt_row > 0) - sheet->height -= block->style->dimensions->height; gnucash_style_unref (block->style); block->style = NULL; } + block->visible = (vcell) ? vcell->visible : TRUE; + if (block->style == NULL) { block->style = style; - - /* the zero'th virtual row isn't drawn */ - if (vcell_loc.virt_row > 0) - sheet->height += block->style->dimensions->height; - gnucash_style_ref(block->style); - return TRUE; } @@ -1871,7 +1757,7 @@ gnucash_sheet_col_max_width (GnucashSheet *sheet, gint virt_col, gint cell_col) if (virt_row == 0) { text = gnc_table_get_label (sheet->table, virt_loc); - font = style->header_font; + font = gnucash_register_font; } else { text = gnc_table_get_entry @@ -1942,38 +1828,17 @@ gnucash_sheet_block_construct (gpointer _block, gpointer user_data) static void gnucash_sheet_resize (GnucashSheet *sheet) { - gint i; - gint diff_rows; - gint num_virt_rows; - VirtualCellLocation vcell_loc = { 0, 0 }; - g_return_if_fail (sheet != NULL); g_return_if_fail (GNUCASH_IS_SHEET(sheet)); if (sheet->table->num_virt_cols > 1) g_warning ("num_virt_cols > 1"); - num_virt_rows = sheet->num_virt_rows; - - diff_rows = sheet->table->num_virt_rows - num_virt_rows; sheet->num_virt_cols = 1; - if (diff_rows < 0) { - for (i = 0; i < -diff_rows; i++) { - SheetBlock *block; - - vcell_loc.virt_row = (num_virt_rows - i) - 1; - - block = gnucash_sheet_get_block (sheet, vcell_loc); - - sheet->height -= block->style->dimensions->height; - } - } - g_table_resize (sheet->blocks, sheet->table->num_virt_rows, 1); sheet->num_virt_rows = sheet->table->num_virt_rows; - gnucash_sheet_set_scroll_region (sheet); } void @@ -1981,7 +1846,6 @@ gnucash_sheet_recompute_block_offsets (GnucashSheet *sheet) { Table *table; SheetBlock *block; - gint num_virt_rows; gint i, j; gint height; gint width; @@ -1991,7 +1855,6 @@ gnucash_sheet_recompute_block_offsets (GnucashSheet *sheet) g_return_if_fail (sheet->table != NULL); table = sheet->table; - num_virt_rows = table->num_virt_rows; height = 0; block = NULL; @@ -2006,12 +1869,15 @@ gnucash_sheet_recompute_block_offsets (GnucashSheet *sheet) block->origin_x = width; block->origin_y = height; - width += block->style->dimensions->width; + if (block->visible) + width += block->style->dimensions->width; } - if (i > 0) + if (i > 0 && block->visible) height += block->style->dimensions->height; } + + sheet->height = height; } void @@ -2047,10 +1913,8 @@ gnucash_sheet_table_load (GnucashSheet *sheet) gnucash_sheet_set_scroll_region (sheet); - gnucash_sheet_set_top_row (sheet, sheet->top_block, - GNUCASH_ALIGN_BOTTOM); - - gnucash_sheet_compute_visible_range(sheet); + gnucash_sheet_show_row (sheet, + table->current_cursor_loc.vcell_loc.virt_row); gnucash_sheet_cursor_set_from_table (sheet, TRUE); gnucash_sheet_activate_cursor_cell (sheet, TRUE); @@ -2146,9 +2010,8 @@ gnucash_sheet_init (GnucashSheet *sheet) sheet->top_block = 1; sheet->bottom_block = 1; - sheet->alignment = GNUCASH_ALIGN_TOP; - - sheet->top_block_offset = 0; + sheet->num_visible_blocks = 1; + sheet->num_visible_phys_rows = 1; sheet->num_virt_rows = 0; sheet->num_virt_cols = 0; @@ -2161,7 +2024,6 @@ gnucash_sheet_init (GnucashSheet *sheet) sheet->window_height = -1; sheet->width = 0; sheet->height = 0; - sheet->smooth_scroll = TRUE; sheet->blocks = g_table_new(sizeof (SheetBlock), gnucash_sheet_block_construct, diff --git a/src/register/gnome/gnucash-sheet.h b/src/register/gnome/gnucash-sheet.h index 79dbd94247..dde966f7e8 100644 --- a/src/register/gnome/gnucash-sheet.h +++ b/src/register/gnome/gnucash-sheet.h @@ -42,24 +42,6 @@ #define GNUCASH_IS_SHEET(o) (GTK_CHECK_TYPE((o), GNUCASH_TYPE_SHEET)) -typedef enum -{ - GNUCASH_CURSOR_HEADER = 0, - GNUCASH_CURSOR_SINGLE, - GNUCASH_CURSOR_DOUBLE, - GNUCASH_CURSOR_TRANS, - GNUCASH_CURSOR_SPLIT, - GNUCASH_NUM_CURSORS -} GNCCursorType; - - -typedef enum { - GNUCASH_ALIGN_TOP, - GNUCASH_ALIGN_BOTTOM, - GNUCASH_ALIGN_SAME, /* keep the alignment the same */ -} GnucashSheetAlignment; - - typedef struct _SheetBlockStyle SheetBlockStyle; typedef struct @@ -90,8 +72,8 @@ typedef struct { GnomeCanvasItem *cursor; GnomeCanvasItem *grid; - CellBlock *cursors[GNUCASH_NUM_CURSORS]; - SheetBlockStyle *cursor_styles[GNUCASH_NUM_CURSORS]; + CellBlock *cursors[NUM_CURSOR_TYPES]; + SheetBlockStyle *cursor_styles[NUM_CURSOR_TYPES]; /* some style information associated to a sheet */ GHashTable *dimensions_hash_table; @@ -103,10 +85,11 @@ typedef struct { gint top_block; /* maybe not fully visible */ gint bottom_block; - gint left_block, right_block; + gint left_block; + gint right_block; - gint top_block_offset; - gint left_block_offset; + gint num_visible_blocks; + gint num_visible_phys_rows; gint width; /* the width in pixels of the sheet */ gint height; @@ -114,8 +97,6 @@ typedef struct { gint window_height; gint window_width; - gint alignment; - gint cell_borders; gint editing; @@ -127,7 +108,6 @@ typedef struct { guint delete_signal; guint changed_signal; - gint smooth_scroll; GtkAdjustment *hadj, *vadj; } GnucashSheet; @@ -185,15 +165,11 @@ void gnucash_sheet_cursor_set_from_table (GnucashSheet *sheet, void gnucash_sheet_compute_visible_range (GnucashSheet *sheet); -void gnucash_sheet_block_pixel_origin (GnucashSheet *sheet, - VirtualCellLocation vcell_loc, - gint *x, gint *y); - void gnucash_sheet_make_cell_visible (GnucashSheet *sheet, VirtualLocation virt_loc); void gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor, - GNCCursorType cursor_type); + CursorType cursor_type); void gnucash_sheet_update_adjustments (GnucashSheet *sheet); diff --git a/src/register/gnome/gnucash-style.c b/src/register/gnome/gnucash-style.c index 3dc358e425..8858765fc6 100644 --- a/src/register/gnome/gnucash-style.c +++ b/src/register/gnome/gnucash-style.c @@ -49,16 +49,19 @@ static char * style_get_key (SheetBlockStyle *style) { switch (style->cursor_type) { - case GNUCASH_CURSOR_HEADER: - case GNUCASH_CURSOR_SINGLE: - case GNUCASH_CURSOR_TRANS: - case GNUCASH_CURSOR_SPLIT: + case CURSOR_TYPE_HEADER: + case CURSOR_TYPE_SINGLE: + case CURSOR_TYPE_TRANS: + case CURSOR_TYPE_SPLIT: return "singles"; break; - case GNUCASH_CURSOR_DOUBLE: + case CURSOR_TYPE_DOUBLE: return "doubles"; break; + + default: + break; } g_warning("style_get_key: bad cursor type\n"); @@ -228,9 +231,9 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width) int row, col; int i; - dimensions = sheet->cursor_styles[GNUCASH_CURSOR_HEADER]->dimensions; + dimensions = sheet->cursor_styles[CURSOR_TYPE_HEADER]->dimensions; cd_table = dimensions->cell_dimensions; - cursor = sheet->cursors[GNUCASH_CURSOR_HEADER]; + cursor = sheet->cursors[CURSOR_TYPE_HEADER]; width = 0; num_cols = cursor->num_cols; @@ -265,7 +268,7 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width) } /* adjust widths to be consistent */ - for (i = 0; i < GNUCASH_NUM_CURSORS; i++) + for (i = 0; i < NUM_CURSOR_TYPES; i++) { style = sheet->cursor_styles[i]; dimensions = style->dimensions; @@ -282,7 +285,7 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width) } /* now expand spanning cells */ - for (i = 0; i < GNUCASH_NUM_CURSORS; i++) + for (i = 0; i < NUM_CURSOR_TYPES; i++) { CellDimensions *cd_span; @@ -387,7 +390,7 @@ set_dimensions_pass_three (GnucashSheet *sheet) { int i; - for (i = 0; i < GNUCASH_NUM_CURSORS; i++) + for (i = 0; i < NUM_CURSOR_TYPES; i++) { BlockDimensions *dimensions; @@ -409,7 +412,7 @@ styles_recompute_layout_dimensions (GnucashSheet *sheet, int default_width) BlockDimensions *dimensions; int i; - for (i = 0; i < GNUCASH_NUM_CURSORS; i++) + for (i = 0; i < NUM_CURSOR_TYPES; i++) { cursor = sheet->cursors[i]; dimensions = sheet->cursor_styles[i]->dimensions; @@ -457,7 +460,7 @@ gnucash_sheet_set_col_width (GnucashSheet *sheet, int col, int width) if (width < 0) return; - style = sheet->cursor_styles[GNUCASH_CURSOR_HEADER]; + style = sheet->cursor_styles[CURSOR_TYPE_HEADER]; g_return_if_fail (col < style->ncols); @@ -474,33 +477,9 @@ gnucash_sheet_set_col_width (GnucashSheet *sheet, int col, int width) } -/* Recompiles the style information from the cellblock, without - * recomputing the layout info or the dimensions. WARNING: this - * function assumes that the space for the style info has been - * allocated already. */ -static void -gnucash_sheet_style_recompile(SheetBlockStyle *style, gint cursor_type) -{ - CellBlock *cursor; - - g_assert (style != NULL); - g_assert (style->cursor != NULL); - - cursor = style->cursor; - - style->header_font = gnucash_register_font; -} - void gnucash_sheet_styles_recompile(GnucashSheet *sheet) { - int i; - - g_return_if_fail (sheet != NULL); - g_return_if_fail (GNUCASH_IS_SHEET (sheet)); - - for (i = 0; i < GNUCASH_NUM_CURSORS; i++) - gnucash_sheet_style_recompile (sheet->cursor_styles[i], i); } @@ -525,7 +504,7 @@ gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc) if (virt_loc.phys_col_offset == 0) return borders |= STYLE_BORDER_LEFT; - style = sheet->cursor_styles[GNUCASH_CURSOR_HEADER]; + style = sheet->cursor_styles[CURSOR_TYPE_HEADER]; if (style == NULL) return borders; @@ -537,8 +516,7 @@ gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc) static SheetBlockStyle * -gnucash_sheet_style_new (GnucashSheet *sheet, CellBlock *cursor, - GNCCursorType cursor_type) +gnucash_sheet_style_new (GnucashSheet *sheet, CellBlock *cursor) { SheetBlockStyle *style; @@ -549,13 +527,11 @@ gnucash_sheet_style_new (GnucashSheet *sheet, CellBlock *cursor, style = g_new0(SheetBlockStyle, 1); style->cursor = cursor; - style->cursor_type = cursor_type; + style->cursor_type = cursor->cursor_type; style->nrows = cursor->num_rows; style->ncols = cursor->num_cols; - gnucash_sheet_style_recompile(style, cursor_type); - gnucash_style_dimensions_init (sheet, style); return style; @@ -569,9 +545,9 @@ gnucash_sheet_create_styles (GnucashSheet *sheet) g_return_if_fail (sheet != NULL); g_return_if_fail (GNUCASH_IS_SHEET (sheet)); - for (i = 0; i < GNUCASH_NUM_CURSORS; i++) + for (i = 0; i < NUM_CURSOR_TYPES; i++) sheet->cursor_styles[i] = - gnucash_sheet_style_new (sheet, sheet->cursors[i], i); + gnucash_sheet_style_new (sheet, sheet->cursors[i]); } void @@ -659,11 +635,11 @@ gnucash_sheet_get_style_from_table (GnucashSheet *sheet, cursor = vcell->cellblock; - for (i = 0; i < GNUCASH_NUM_CURSORS; i++) + for (i = 0; i < NUM_CURSOR_TYPES; i++) if (cursor == sheet->cursors[i]) return sheet->cursor_styles[i]; - return sheet->cursor_styles[GNUCASH_CURSOR_HEADER]; + return sheet->cursor_styles[CURSOR_TYPE_HEADER]; } @@ -757,8 +733,8 @@ gnucash_sheet_get_header_widths (GnucashSheet *sheet, int *header_widths) g_return_if_fail(sheet != NULL); g_return_if_fail(GNUCASH_IS_SHEET(sheet)); - style = sheet->cursor_styles[GNUCASH_CURSOR_HEADER]; - header = sheet->cursors[GNUCASH_CURSOR_HEADER]; + style = sheet->cursor_styles[CURSOR_TYPE_HEADER]; + header = sheet->cursors[CURSOR_TYPE_HEADER]; g_return_if_fail(style != NULL); g_return_if_fail(header != NULL); @@ -795,8 +771,8 @@ gnucash_sheet_set_header_widths (GnucashSheet *sheet, int *header_widths) g_return_if_fail(sheet != NULL); g_return_if_fail(GNUCASH_IS_SHEET(sheet)); - style = sheet->cursor_styles[GNUCASH_CURSOR_HEADER]; - header = sheet->cursors[GNUCASH_CURSOR_HEADER]; + style = sheet->cursor_styles[CURSOR_TYPE_HEADER]; + header = sheet->cursors[CURSOR_TYPE_HEADER]; g_return_if_fail(style != NULL); g_return_if_fail(header != NULL); diff --git a/src/register/gnome/gnucash-style.h b/src/register/gnome/gnucash-style.h index 1fb7e19adb..add6e3f4b7 100644 --- a/src/register/gnome/gnucash-style.h +++ b/src/register/gnome/gnucash-style.h @@ -66,12 +66,10 @@ struct _SheetBlockStyle gint nrows; gint ncols; - gint cursor_type; + CursorType cursor_type; BlockDimensions *dimensions; - GdkFont *header_font; - gint refcount; }; diff --git a/src/register/pricecell.c b/src/register/pricecell.c index 9cabbc1ed0..8907fc990e 100644 --- a/src/register/pricecell.c +++ b/src/register/pricecell.c @@ -152,6 +152,8 @@ PriceParse (PriceCell *cell) else cell->amount = 0.0; + COLORIZE (cell, cell->amount); + newval = xaccPriceCellPrintValue(cell); /* If they are identical do nothing */ diff --git a/src/register/splitreg.c b/src/register/splitreg.c index 6ca4f4ee69..c36085f9e9 100644 --- a/src/register/splitreg.c +++ b/src/register/splitreg.c @@ -81,24 +81,37 @@ struct _SplitRegisterBuffer CellBuffer sharesCell; }; -static SplitRegisterColors reg_colors = { - 0xffdddd, /* pale red, single cursor active */ - 0xccccff, /* pale blue, single cursor passive */ - 0xccccff, /* pale blue, single cursor passive 2 */ +static SplitRegisterColors reg_colors = +{ + 0xffffff, /* white */ + 0xffffff, + 0xffffff, - 0xffdddd, /* pale red, double cursor active */ - 0xccccff, /* pale blue, double cursor passive */ - 0xffffff, /* white, double cursor passive 2 */ + 0xffffff, + 0xffffff, + 0xffffff, + 0xffffff, - FALSE, /* double mode alternate by physical row */ + FALSE /* double mode alternate by physical row */ +}; - 0xffdddd, /* pale red, trans cursor active */ - 0xccccff, /* pale blue, trans cursor passive */ - - 0xffffdd, /* pale yellow, split cursor active */ - 0xffffff, /* white, split cursor passive */ - - 0xffffff /* white, header color */ +static char *cell_sample_strings[] = +{ + N_("sample:12/12/2000"+7), /* date cell */ + N_("sample:99999"+7), /* num cell */ + N_("sample:Description of a transaction"+7), /* desc cell */ + N_("Reconciled:R"+11), /* recn cell */ + N_("sample:999,999.000"+7), /* share balance cell */ + N_("sample:999,999.000"+7), /* balance cell */ + N_("Transfer"), /* action cell */ + N_("sample:Expenses:Automobile:Gasoline"+7), /* xfrm cell */ + N_("sample:Expenses:Automobile:Gasoline"+7), /* xto cell */ + N_("sample:Memo field sample text string"+7), /* memo cell */ + N_("sample:999,999.000"+7), /* credit cell */ + N_("sample:999,999.000"+7), /* debit cell */ + N_("sample:999,999.000"+7), /* price cell */ + N_("sample:999,999.000"+7), /* shares cell */ + N_("sample:Expenses:Automobile:Gasoline"+7), /* mxfrm cell */ }; #define DATE_CELL_ALIGN CELL_ALIGN_RIGHT @@ -164,21 +177,21 @@ configLabels (SplitRegister *reg) type = reg->type; - LABEL (DATE, DATE_STR); - LABEL (NUM, NUM_STR); - LABEL (DESC, DESC_STR); - LABEL (RECN, RECONCILE_ABBREV); - LABEL (SHRBALN, TOTAL_SHARES_STR); - LABEL (BALN, BALN_STR); - LABEL (ACTN, ACTION_STR); - LABEL (XFRM, ACCOUNT_STR); - LABEL (MXFRM, TRANSFER_STR); - LABEL (XTO, ACCOUNT_STR); - LABEL (MEMO, MEMO_STR); - LABEL (CRED, CREDIT_STR); - LABEL (DEBT, DEBIT_STR); - LABEL (PRIC, PRICE_STR); - LABEL (SHRS, SHARES_STR); + LABEL (DATE, _("Date")); + LABEL (NUM, _("Num")); + LABEL (DESC, _("Description")); + LABEL (RECN, _("Reconciled:R"+11)); + LABEL (SHRBALN, _("Total Shares")); + LABEL (BALN, _("Balance")); + LABEL (ACTN, _("Action")); + LABEL (XFRM, _("Account")); + LABEL (MXFRM, _("Transfer")); + LABEL (XTO, _("Account")); + LABEL (MEMO, _("Memo")); + LABEL (CRED, _("Credit")); + LABEL (DEBT, _("Debit")); + LABEL (PRIC, _("Price")); + LABEL (SHRS, _("Shares")); if (debit_getter != NULL) { @@ -213,82 +226,84 @@ configAction (SplitRegister *reg) { case BANK_REGISTER: case SEARCH_LEDGER: /* broken ! FIXME bg */ - xaccAddComboCellMenuItem ( reg->actionCell, DEPOSIT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, WITHDRAW_STR); - xaccAddComboCellMenuItem ( reg->actionCell, CHECK_STR); - xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, ATM_STR); - xaccAddComboCellMenuItem ( reg->actionCell, TELLER_STR); - xaccAddComboCellMenuItem ( reg->actionCell, POS_STR); - xaccAddComboCellMenuItem ( reg->actionCell, ARU_STR); - xaccAddComboCellMenuItem ( reg->actionCell, ONLINE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, ACH_STR); - xaccAddComboCellMenuItem ( reg->actionCell, WIRE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, CREDIT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, DIRECTDEBIT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, TRANSFER_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Deposit")); + xaccAddComboCellMenuItem (reg->actionCell, _("Withdraw")); + xaccAddComboCellMenuItem (reg->actionCell, _("Check")); + xaccAddComboCellMenuItem (reg->actionCell, _("Int")); + xaccAddComboCellMenuItem (reg->actionCell, _("ATM")); + xaccAddComboCellMenuItem (reg->actionCell, _("Teller")); + xaccAddComboCellMenuItem (reg->actionCell, _("POS")); + xaccAddComboCellMenuItem (reg->actionCell, _("Phone")); + xaccAddComboCellMenuItem (reg->actionCell, _("Online")); + xaccAddComboCellMenuItem (reg->actionCell, _("AutoDep")); + xaccAddComboCellMenuItem (reg->actionCell, _("Wire")); + xaccAddComboCellMenuItem (reg->actionCell, _("Credit")); + xaccAddComboCellMenuItem (reg->actionCell, _("Direct Debit")); + xaccAddComboCellMenuItem (reg->actionCell, _("Transfer")); break; case CASH_REGISTER: - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); break; case ASSET_REGISTER: - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); - xaccAddComboCellMenuItem ( reg->actionCell, FEE_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); + xaccAddComboCellMenuItem (reg->actionCell, _("Fee")); break; case CREDIT_REGISTER: - xaccAddComboCellMenuItem ( reg->actionCell, ATM_STR); - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, CREDIT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, FEE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, ONLINE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("ATM")); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Credit")); + xaccAddComboCellMenuItem (reg->actionCell, _("Fee")); + xaccAddComboCellMenuItem (reg->actionCell, _("Int")); + xaccAddComboCellMenuItem (reg->actionCell, _("Online")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); break; case LIABILITY_REGISTER: - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); - xaccAddComboCellMenuItem ( reg->actionCell, LOAN_STR); - xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, PAYMENT_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); + xaccAddComboCellMenuItem (reg->actionCell, _("Loan")); + xaccAddComboCellMenuItem (reg->actionCell, _("Int")); + xaccAddComboCellMenuItem (reg->actionCell, _("Payment")); break; case INCOME_LEDGER: case INCOME_REGISTER: - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); - xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, PAYMENT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, REBATE_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); + xaccAddComboCellMenuItem (reg->actionCell, _("Int")); + xaccAddComboCellMenuItem (reg->actionCell, _("Payment")); + xaccAddComboCellMenuItem (reg->actionCell, _("Rebate")); break; case EXPENSE_REGISTER: - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); break; case GENERAL_LEDGER: case EQUITY_REGISTER: - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); - xaccAddComboCellMenuItem ( reg->actionCell, EQUITY_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); + xaccAddComboCellMenuItem (reg->actionCell, _("Equity")); break; case STOCK_REGISTER: case PORTFOLIO_LEDGER: case CURRENCY_REGISTER: - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); - xaccAddComboCellMenuItem ( reg->actionCell, PRICE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, FEE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, DIV_STR); - xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, LTCG_STR); - xaccAddComboCellMenuItem ( reg->actionCell, STCG_STR); - xaccAddComboCellMenuItem ( reg->actionCell, INCOME_STR); - xaccAddComboCellMenuItem ( reg->actionCell, DIST_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SPLIT_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); + xaccAddComboCellMenuItem (reg->actionCell, _("Price")); + xaccAddComboCellMenuItem (reg->actionCell, _("Fee")); + xaccAddComboCellMenuItem (reg->actionCell, _("Div")); /* Dividend */ + xaccAddComboCellMenuItem (reg->actionCell, _("Int")); + /* Long Term Capital Gains */ + xaccAddComboCellMenuItem (reg->actionCell, _("LTCG")); + /* Short Term Captial Gains */ + xaccAddComboCellMenuItem (reg->actionCell, _("STCG")); + xaccAddComboCellMenuItem (reg->actionCell, _("Income")); + xaccAddComboCellMenuItem (reg->actionCell, _("Dist")); /* Distribution */ + xaccAddComboCellMenuItem (reg->actionCell, _("Split")); break; default: - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + xaccAddComboCellMenuItem (reg->actionCell, _("Buy")); + xaccAddComboCellMenuItem (reg->actionCell, _("Sell")); break; } } @@ -308,20 +323,26 @@ configAction (SplitRegister *reg) cb_cell->cell = (handler); \ cb_cell->cell_type = NAME##_CELL; \ cb_cell->label = g_strdup (hcell->value); \ - cb_cell->sample_text = g_strdup (NAME##_CELL_SAMPLE); \ + cb_cell->sample_text = \ + g_strdup (_(cell_sample_strings[NAME##_CELL])); \ cb_cell->alignment = NAME##_CELL_ALIGN; \ - cb_cell->expandable = ((handler) == (BasicCell *) reg->descCell); \ - cb_cell->span = ((handler) == (BasicCell *) reg->memoCell); \ + cb_cell->expandable = \ + ((handler) == (BasicCell *) reg->descCell); \ + cb_cell->span = \ + ((handler) == (BasicCell *) reg->memoCell); \ \ cb_cell = gnc_cellblock_get_cell (header, row, col); \ if (cb_cell && (curs == reg->single_cursor)) { \ cb_cell->cell = hcell; \ cb_cell->cell_type = NAME##_CELL; \ cb_cell->label = g_strdup (hcell->value); \ - cb_cell->sample_text = g_strdup (NAME##_CELL_SAMPLE); \ + cb_cell->sample_text = \ + g_strdup (_(cell_sample_strings[NAME##_CELL])); \ cb_cell->alignment = NAME##_CELL_ALIGN; \ - cb_cell->expandable = ((handler) == (BasicCell *) reg->descCell); \ - cb_cell->span = ((handler) == (BasicCell *) reg->memoCell); \ + cb_cell->expandable = \ + ((handler) == (BasicCell *) reg->descCell); \ + cb_cell->span = \ + ((handler) == (BasicCell *) reg->memoCell); \ } \ } \ } @@ -405,8 +426,8 @@ configLayout (SplitRegister *reg) SET_CELL (ACTN, action, 1, 0); SET_CELL (MEMO, memo, 2, 0); SET_CELL (XFRM, xfrm, 3, 0); - SET_CELL (CRED, credit, 5, 0); - SET_CELL (DEBT, debit, 6, 0); + SET_CELL (DEBT, debit, 5, 0); + SET_CELL (CRED, credit, 6, 0); curs = reg->single_cursor; SET_CELL (DATE, date, 0, 0); @@ -453,8 +474,8 @@ configLayout (SplitRegister *reg) SET_CELL (ACTN, action, 1, 0); SET_CELL (MEMO, memo, 2, 0); SET_CELL (XFRM, xfrm, 4, 0); - SET_CELL (CRED, credit, 6, 0); - SET_CELL (DEBT, debit, 7, 0); + SET_CELL (DEBT, debit, 6, 0); + SET_CELL (CRED, credit, 7, 0); curs = reg->single_cursor; SET_CELL (DATE, date, 0, 0); @@ -506,8 +527,8 @@ configLayout (SplitRegister *reg) SET_CELL (ACTN, action, 1, 0); SET_CELL (MEMO, memo, 2, 0); SET_CELL (XFRM, xfrm, 3, 0); - SET_CELL (CRED, credit, 7, 0); - SET_CELL (DEBT, debit, 8, 0); + SET_CELL (DEBT, debit, 7, 0); + SET_CELL (CRED, credit, 8, 0); curs = reg->single_cursor; SET_CELL (DATE, date, 0, 0); @@ -561,8 +582,8 @@ configLayout (SplitRegister *reg) SET_CELL (ACTN, action, 1, 0); SET_CELL (MEMO, memo, 2, 0); SET_CELL (XFRM, xfrm, 4, 0); - SET_CELL (CRED, credit, 8, 0); - SET_CELL (DEBT, debit, 9, 0); + SET_CELL (DEBT, debit, 8, 0); + SET_CELL (CRED, credit, 9, 0); curs = reg->single_cursor; SET_CELL (DATE, date, 0, 0); @@ -645,33 +666,21 @@ configTable(SplitRegister *reg) void xaccSplitRegisterConfigColors (SplitRegister *reg) { - reg->single_cursor->active_bg_color = - reg_colors.single_cursor_active_bg_color; - reg->single_cursor->passive_bg_color = - reg_colors.single_cursor_passive_bg_color; - reg->single_cursor->passive_bg_color2 = - reg_colors.single_cursor_passive_bg_color2; + reg->single_cursor->active_bg_color = reg_colors.primary_active_bg_color; + reg->single_cursor->passive_bg_color = reg_colors.primary_bg_color; + reg->single_cursor->passive_bg_color2 = reg_colors.secondary_bg_color; - reg->double_cursor->active_bg_color = - reg_colors.double_cursor_active_bg_color; - reg->double_cursor->passive_bg_color = - reg_colors.double_cursor_passive_bg_color; - reg->double_cursor->passive_bg_color2 = - reg_colors.double_cursor_passive_bg_color2; + reg->double_cursor->active_bg_color = reg_colors.primary_active_bg_color; + reg->double_cursor->passive_bg_color = reg_colors.primary_bg_color; + reg->double_cursor->passive_bg_color2 = reg_colors.secondary_bg_color; - reg->trans_cursor->active_bg_color = - reg_colors.trans_cursor_active_bg_color; - reg->trans_cursor->passive_bg_color = - reg_colors.trans_cursor_passive_bg_color; - reg->trans_cursor->passive_bg_color2 = - reg_colors.trans_cursor_passive_bg_color; + reg->trans_cursor->active_bg_color = reg_colors.primary_active_bg_color; + reg->trans_cursor->passive_bg_color = reg_colors.primary_bg_color; + reg->trans_cursor->passive_bg_color2 = reg_colors.secondary_bg_color; - reg->split_cursor->active_bg_color = - reg_colors.split_cursor_active_bg_color; - reg->split_cursor->passive_bg_color = - reg_colors.split_cursor_passive_bg_color; - reg->split_cursor->passive_bg_color2 = - reg_colors.split_cursor_passive_bg_color; + reg->split_cursor->active_bg_color = reg_colors.split_active_bg_color; + reg->split_cursor->passive_bg_color = reg_colors.split_bg_color; + reg->split_cursor->passive_bg_color2 = reg_colors.split_bg_color; reg->header->active_bg_color = reg_colors.header_bg_color; reg->header->passive_bg_color = reg_colors.header_bg_color; @@ -728,15 +737,15 @@ mallocCursors (SplitRegister *reg) return; } - reg->header = gnc_cellblock_new (1, num_cols); + reg->header = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_HEADER); /* cursors used in the single & double line displays */ - reg->single_cursor = gnc_cellblock_new (1, num_cols); - reg->double_cursor = gnc_cellblock_new (2, num_cols); + reg->single_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SINGLE); + reg->double_cursor = gnc_cellblock_new (2, num_cols, CURSOR_TYPE_DOUBLE); /* the two cursors used for multi-line and dynamic displays */ - reg->trans_cursor = gnc_cellblock_new (1, num_cols); - reg->split_cursor = gnc_cellblock_new (1, num_cols); + reg->trans_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_TRANS); + reg->split_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SPLIT); } /* ============================================== */ @@ -762,7 +771,6 @@ xaccInitSplitRegister (SplitRegister *reg, VirtCellDataCopy copy) { Table * table; - CellBlock *header; reg->table = NULL; reg->user_data = NULL; @@ -776,8 +784,6 @@ xaccInitSplitRegister (SplitRegister *reg, /* --------------------------- */ /* malloc the header (label) cells */ - header = reg->header; - HDR (DATE); HDR (NUM); HDR (ACTN); @@ -841,24 +847,40 @@ xaccInitSplitRegister (SplitRegister *reg, xaccSetBasicCellValue (reg->nullCell, ""); /* The num cell is the transaction number */ - xaccSetBasicCellBlankHelp (®->numCell->cell, NUM_CELL_HELP); + xaccSetBasicCellBlankHelp (®->numCell->cell, + _("Enter the transaction number, such as the " + "check number")); /* the xfer cells */ - xaccSetBasicCellBlankHelp (®->mxfrmCell->cell, XFER_CELL_HELP); - xaccSetBasicCellBlankHelp (®->xfrmCell->cell, XFER_CELL_HELP); - xaccSetBasicCellBlankHelp (®->xtoCell->cell, XFER_TO_CELL_HELP); + { + const char *help = _("Enter the account to transfer from, or choose " + "one from the list"); + xaccSetBasicCellBlankHelp (®->mxfrmCell->cell, help); + xaccSetBasicCellBlankHelp (®->xfrmCell->cell, help); + } - xaccComboCellSetIgnoreString (reg->mxfrmCell, SPLIT_STR); - xaccComboCellSetIgnoreString (reg->xtoCell, SPLIT_STR); + xaccSetBasicCellBlankHelp (®->xtoCell->cell, + _("Enter the account to transfer to, or choose " + "one from the list")); - xaccComboCellSetIgnoreHelp (reg->mxfrmCell, TOOLTIP_MULTI_SPLIT); - xaccComboCellSetIgnoreHelp (reg->xtoCell, TOOLTIP_MULTI_SPLIT); + xaccComboCellSetIgnoreString (reg->mxfrmCell, _("Split")); + xaccComboCellSetIgnoreString (reg->xtoCell, _("Split")); + + + { + const char *help = _("This transaction has multiple splits; " + "switch to multi-line mode to see them all"); + xaccComboCellSetIgnoreHelp (reg->mxfrmCell, help); + xaccComboCellSetIgnoreHelp (reg->xtoCell, help); + } /* the memo cell */ - xaccSetBasicCellBlankHelp (®->memoCell->cell, MEMO_CELL_HELP); + xaccSetBasicCellBlankHelp (®->memoCell->cell, + _("Enter a description of the split")); /* the desc cell */ - xaccSetBasicCellBlankHelp (®->descCell->cell, DESC_CELL_HELP); + xaccSetBasicCellBlankHelp (®->descCell->cell, + _("Enter a description of the transaction")); /* The balance cells are just placeholders */ reg->balanceCell->cell.input_output = XACC_CELL_ALLOW_NONE; @@ -882,20 +904,25 @@ xaccInitSplitRegister (SplitRegister *reg, /* The action cell should accept strings not in the list */ xaccComboCellSetStrict (reg->actionCell, FALSE); - xaccSetBasicCellBlankHelp (®->actionCell->cell, ACTION_CELL_HELP); + xaccSetBasicCellBlankHelp (®->actionCell->cell, + _("Enter the type of transaction, or choose " + "one from the list")); /* number format for share quantities in stock ledgers */ switch (type) { case CURRENCY_REGISTER: xaccSetPriceCellIsCurrency (reg->priceCell, TRUE); - + /* fall through */ case STOCK_REGISTER: case PORTFOLIO_LEDGER: xaccSetPriceCellIsCurrency (reg->priceCell, TRUE); - xaccSetBasicCellBlankHelp (®->priceCell->cell, PRICE_CELL_HELP); - xaccSetBasicCellBlankHelp (®->sharesCell->cell, SHARES_CELL_HELP); + xaccSetBasicCellBlankHelp (®->priceCell->cell, + _("Enter the share price")); + xaccSetBasicCellBlankHelp (®->sharesCell->cell, + _("Enter the number of shares bought or " + "sold")); break; default: break; @@ -911,7 +938,7 @@ xaccInitSplitRegister (SplitRegister *reg, { VirtualCellLocation vcell_loc = { 0, 0 }; - gnc_table_set_vcell (table, header, NULL, vcell_loc); + gnc_table_set_vcell (table, reg->header, NULL, TRUE, TRUE, vcell_loc); } /* Set up first and only initial row */ @@ -923,9 +950,9 @@ xaccInitSplitRegister (SplitRegister *reg, vloc.phys_row_offset = 0; vloc.phys_col_offset = 0; - gnc_table_set_vcell (table, reg->single_cursor, NULL, vloc.vcell_loc); + gnc_table_set_vcell (table, reg->single_cursor, NULL, TRUE, TRUE, + vloc.vcell_loc); gnc_table_move_cursor (table, vloc); - reg->cursor_virt_row = 1; } reg->table = table; @@ -1085,17 +1112,17 @@ static CursorClass sr_cellblock_cursor_class(SplitRegister *reg, CellBlock *cursor) { if (cursor == NULL) - return CURSOR_NONE; + return CURSOR_CLASS_NONE; if ((cursor == reg->single_cursor) || (cursor == reg->double_cursor) || (cursor == reg->trans_cursor)) - return CURSOR_TRANS; + return CURSOR_CLASS_TRANS; if (cursor == reg->split_cursor) - return CURSOR_SPLIT; + return CURSOR_CLASS_SPLIT; - return CURSOR_NONE; + return CURSOR_CLASS_NONE; } /* ============================================== */ @@ -1106,11 +1133,11 @@ xaccSplitRegisterGetCurrentCursorClass (SplitRegister *reg) Table *table; if (reg == NULL) - return CURSOR_NONE; + return CURSOR_CLASS_NONE; table = reg->table; if (table == NULL) - return CURSOR_NONE; + return CURSOR_CLASS_NONE; return sr_cellblock_cursor_class(reg, table->current_cursor); } @@ -1125,15 +1152,15 @@ xaccSplitRegisterGetCursorClass (SplitRegister *reg, Table *table; if (reg == NULL) - return CURSOR_NONE; + return CURSOR_CLASS_NONE; table = reg->table; if (table == NULL) - return CURSOR_NONE; + return CURSOR_CLASS_NONE; vcell = gnc_table_get_virtual_cell (table, vcell_loc); if (vcell == NULL) - return CURSOR_NONE; + return CURSOR_CLASS_NONE; return sr_cellblock_cursor_class(reg, vcell->cellblock); } @@ -1414,40 +1441,63 @@ xaccSplitRegisterSaveCursor(SplitRegister *sr, SplitRegisterBuffer *srb) /* ============================================== */ static void -restoreCellChanged(BasicCell *bcell, CellBuffer *cb) +restoreCellChanged(BasicCell *bcell, CellBuffer *cb, CellBlock *cursor) { + int r, c; + if ((bcell == NULL) || (cb == NULL)) return; - if (cb->changed) - { - xaccSetBasicCellValue(bcell, cb->value); - bcell->changed = cb->changed; - } + if (!cb->changed) + return; + + /* only restore if it's in the current cursor */ + for (r = 0; r < cursor->num_rows; r++) + for (c = 0; c < cursor->num_cols; c++) + { + CellBlockCell *cb_cell; + + cb_cell = gnc_cellblock_get_cell (cursor, r, c); + if (cb_cell == NULL) + continue; + + if (cb_cell->cell == bcell) + { + xaccSetBasicCellValue(bcell, cb->value); + bcell->changed = cb->changed; + return; + } + } } void xaccSplitRegisterRestoreCursorChanged(SplitRegister *sr, SplitRegisterBuffer *srb) { - if ((sr == NULL) || (srb == NULL)) + CellBlock *cursor; + + if ((sr == NULL) || (sr->table == NULL) || (srb == NULL)) return; - restoreCellChanged(&sr->dateCell->cell, &srb->dateCell); - restoreCellChanged(&sr->numCell->cell, &srb->numCell); - restoreCellChanged(&sr->descCell->cell, &srb->descCell); - restoreCellChanged(&sr->recnCell->cell, &srb->recnCell); - restoreCellChanged(&sr->shrbalnCell->cell, &srb->shrbalnCell); - restoreCellChanged(&sr->balanceCell->cell, &srb->balanceCell); - restoreCellChanged(&sr->actionCell->cell, &srb->actionCell); - restoreCellChanged(&sr->xfrmCell->cell, &srb->xfrmCell); - restoreCellChanged(&sr->mxfrmCell->cell, &srb->mxfrmCell); - restoreCellChanged(&sr->xtoCell->cell, &srb->xtoCell); - restoreCellChanged(&sr->memoCell->cell, &srb->memoCell); - restoreCellChanged(&sr->creditCell->cell, &srb->creditCell); - restoreCellChanged(&sr->debitCell->cell, &srb->debitCell); - restoreCellChanged(&sr->priceCell->cell, &srb->priceCell); - restoreCellChanged(&sr->sharesCell->cell, &srb->sharesCell); + cursor = sr->table->current_cursor; + if (cursor == NULL) + return; + + restoreCellChanged(&sr->dateCell->cell, &srb->dateCell, cursor); + restoreCellChanged(&sr->numCell->cell, &srb->numCell, cursor); + restoreCellChanged(&sr->descCell->cell, &srb->descCell, cursor); + restoreCellChanged(&sr->recnCell->cell, &srb->recnCell, cursor); + restoreCellChanged(&sr->shrbalnCell->cell, &srb->shrbalnCell, cursor); + restoreCellChanged(&sr->balanceCell->cell, &srb->balanceCell, cursor); + restoreCellChanged(&sr->actionCell->cell, &srb->actionCell, cursor); + restoreCellChanged(&sr->xfrmCell->cell, &srb->xfrmCell, cursor); + restoreCellChanged(&sr->mxfrmCell->cell, &srb->mxfrmCell, cursor); + restoreCellChanged(&sr->xtoCell->cell, &srb->xtoCell, cursor); + restoreCellChanged(&sr->memoCell->cell, &srb->memoCell, cursor); + restoreCellChanged(&sr->creditCell->cell, &srb->creditCell, cursor); + restoreCellChanged(&sr->debitCell->cell, &srb->debitCell, cursor); + restoreCellChanged(&sr->priceCell->cell, &srb->priceCell, cursor); + restoreCellChanged(&sr->sharesCell->cell, &srb->sharesCell, cursor); } /* keep in sync with CellType enum */ diff --git a/src/register/splitreg.h b/src/register/splitreg.h index 2ef1d56615..628326b2af 100644 --- a/src/register/splitreg.h +++ b/src/register/splitreg.h @@ -140,11 +140,22 @@ typedef enum /* Types of cursors */ typedef enum { - CURSOR_SPLIT, - CURSOR_TRANS, - CURSOR_NONE + CURSOR_CLASS_NONE = -1, + CURSOR_CLASS_SPLIT, + CURSOR_CLASS_TRANS, + NUM_CURSOR_CLASSES } CursorClass; +typedef enum +{ + CURSOR_TYPE_NONE = -1, + CURSOR_TYPE_HEADER, + CURSOR_TYPE_SINGLE, + CURSOR_TYPE_DOUBLE, + CURSOR_TYPE_TRANS, + CURSOR_TYPE_SPLIT, + NUM_CURSOR_TYPES +} CursorType; typedef struct _SplitRegisterBuffer SplitRegisterBuffer; typedef struct _SplitRegister SplitRegister; @@ -185,7 +196,6 @@ struct _SplitRegister SplitRegisterStyle style; /* some private data; outsiders should not access this */ - int cursor_virt_row; BasicCell *header_cells[CELL_TYPE_COUNT]; @@ -203,23 +213,18 @@ typedef struct _SplitRegisterColors SplitRegisterColors; struct _SplitRegisterColors { - guint32 single_cursor_active_bg_color; - guint32 single_cursor_passive_bg_color; - guint32 single_cursor_passive_bg_color2; + guint32 header_bg_color; - guint32 double_cursor_active_bg_color; - guint32 double_cursor_passive_bg_color; - guint32 double_cursor_passive_bg_color2; + guint32 primary_bg_color; + guint32 secondary_bg_color; + + guint32 primary_active_bg_color; + guint32 secondary_active_bg_color; + + guint32 split_bg_color; + guint32 split_active_bg_color; gboolean double_alternate_virt; - - guint32 trans_cursor_active_bg_color; - guint32 trans_cursor_passive_bg_color; - - guint32 split_cursor_active_bg_color; - guint32 split_cursor_passive_bg_color; - - guint32 header_bg_color; }; typedef char* (*SRStringGetter) (SplitRegisterType); diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index 90b7704890..bf3c58d75b 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -278,8 +278,6 @@ guint32 gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc) { VirtualCell *vcell; - CellBlockCell *cb_cell; - BasicCell *cell; guint32 bg_color; bg_color = 0xffffff; /* white */ @@ -297,7 +295,7 @@ gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc) bg_color = vcell->cellblock->passive_bg_color; else if (table->alternate_bg_colors) { - if ((virt_loc.vcell_loc.virt_row % 2) == 1) + if (vcell->start_primary_color) bg_color = vcell->cellblock->passive_bg_color; else bg_color = vcell->cellblock->passive_bg_color2; @@ -306,23 +304,8 @@ gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc) bg_color = vcell->cellblock->passive_bg_color; else bg_color = vcell->cellblock->passive_bg_color2; - - return bg_color; } - cb_cell = gnc_cellblock_get_cell (vcell->cellblock, - virt_loc.phys_row_offset, - virt_loc.phys_col_offset); - if (cb_cell == NULL) - return bg_color; - - cell = cb_cell->cell; - if (cell == NULL) - return bg_color; - - if (cell->use_bg_color) - bg_color = cell->bg_color; - return bg_color; } @@ -406,7 +389,7 @@ gnc_virtual_cell_construct (gpointer _vcell, gpointer user_data) else vcell->vcell_data = NULL; - vcell->visible = TRUE; + vcell->visible = 1; } /* ==================================================== */ @@ -442,6 +425,8 @@ void gnc_table_set_vcell (Table *table, CellBlock *cursor, gconstpointer vcell_data, + gboolean visible, + gboolean start_primary_color, VirtualCellLocation vcell_loc) { VirtualCell *vcell; @@ -467,6 +452,9 @@ gnc_table_set_vcell (Table *table, table->vcell_data_copy (vcell->vcell_data, vcell_data); else vcell->vcell_data = (gpointer) vcell_data; + + vcell->visible = visible ? 1 : 0; + vcell->start_primary_color = start_primary_color ? 1 : 0; } /* ==================================================== */ @@ -493,6 +481,25 @@ gnc_table_set_virt_cell_data (Table *table, /* ==================================================== */ +void +gnc_table_set_virt_cell_visible (Table *table, + VirtualCellLocation vcell_loc, + gboolean visible) +{ + VirtualCell *vcell; + + if (table == NULL) + return; + + vcell = gnc_table_get_virtual_cell (table, vcell_loc); + if (vcell == NULL) + return; + + vcell->visible = visible ? 1 : 0; +} + +/* ==================================================== */ + static void gnc_table_move_cursor_internal (Table *table, VirtualLocation new_virt_loc, @@ -1296,16 +1303,21 @@ gnc_table_move_vertical_position (Table *table, int phys_row_offset) { VirtualLocation vloc; + VirtualCell *vcell; + gint last_visible_row; if ((table == NULL) || (virt_loc == NULL)) return FALSE; vloc = *virt_loc; + last_visible_row = vloc.vcell_loc.virt_row; + + vcell = gnc_table_get_virtual_cell (table, vloc.vcell_loc); + if ((vcell == NULL) || (vcell->cellblock == NULL)) + return FALSE; while (phys_row_offset != 0) { - VirtualCell *vcell; - /* going up */ if (phys_row_offset < 0) { @@ -1327,27 +1339,17 @@ gnc_table_move_vertical_position (Table *table, vloc.vcell_loc.virt_row--; vcell = gnc_table_get_virtual_cell (table, vloc.vcell_loc); - if ((vcell == NULL) || (vcell->cellblock == NULL)) - return FALSE; - } while (!vcell->visible); + } while (vcell && vcell->cellblock && !vcell->visible); + if (!vcell || !vcell->cellblock) + break; + + last_visible_row = vloc.vcell_loc.virt_row; vloc.phys_row_offset = vcell->cellblock->num_rows - 1; } /* going down */ else { - do - { - vcell = gnc_table_get_virtual_cell (table, vloc.vcell_loc); - if ((vcell == NULL) || (vcell->cellblock == NULL)) - return FALSE; - - if (vcell->visible) - break; - - vloc.vcell_loc.virt_row++; - } while (TRUE); - phys_row_offset--; /* room left in the current cursor */ @@ -1361,11 +1363,23 @@ gnc_table_move_vertical_position (Table *table, if (vloc.vcell_loc.virt_row == (table->num_virt_rows - 1)) break; - vloc.vcell_loc.virt_row++; + do + { + vloc.vcell_loc.virt_row++; + + vcell = gnc_table_get_virtual_cell (table, vloc.vcell_loc); + } while (vcell && vcell->cellblock && !vcell->visible); + + if (!vcell || !vcell->cellblock) + break; + + last_visible_row = vloc.vcell_loc.virt_row; vloc.phys_row_offset = 0; } } + vloc.vcell_loc.virt_row = last_visible_row; + { gboolean changed = !virt_loc_equal (vloc, *virt_loc); diff --git a/src/register/table-allgui.h b/src/register/table-allgui.h index 51350685d8..fc125f0624 100644 --- a/src/register/table-allgui.h +++ b/src/register/table-allgui.h @@ -111,7 +111,10 @@ struct _VirtualCell { CellBlock *cellblock; /* Array of physical cells */ gpointer vcell_data; /* Used by higher-level code */ - gboolean visible; /* visible in the GUI */ + + /* flags */ + unsigned int visible : 1; /* visible in the GUI */ + unsigned int start_primary_color : 1; /* color usage flag */ }; @@ -137,6 +140,8 @@ typedef guint32 (*TableGetFGColorHandler) (gpointer vcell_data, short cell_type, gpointer user_data); +typedef guint32 (*TableGetBGColorHandler) (VirtualCell *vcell); + typedef gpointer (*VirtCellDataAllocator) (void); typedef void (*VirtCellDataDeallocator) (gpointer user_data); typedef void (*VirtCellDataCopy) (gpointer to, gconstpointer from); @@ -254,6 +259,8 @@ void gnc_table_create_cursor (Table *table, CellBlock *cursor); /* Indicate what handler should be used for a given virtual block */ void gnc_table_set_vcell (Table *table, CellBlock *cursor, gconstpointer vcell_data, + gboolean visible, + gboolean start_primary_color, VirtualCellLocation vcell_loc); /* Set the virtual cell data for a particular location. */ @@ -261,6 +268,11 @@ void gnc_table_set_virt_cell_data (Table *table, VirtualCellLocation vcell_loc, gconstpointer vcell_data); +/* Set the visibility flag for a particular location. */ +void gnc_table_set_virt_cell_visible (Table *table, + VirtualCellLocation vcell_loc, + gboolean visible); + /* The gnc_table_move_cursor() method will move the cursor (but not * the cursor GUI) to the indicated location. This function is * useful when loading the table from the cursor: data can be loaded diff --git a/src/register/table-gnome.c b/src/register/table-gnome.c index 6410fddfc5..8ff5954891 100644 --- a/src/register/table-gnome.c +++ b/src/register/table-gnome.c @@ -128,15 +128,15 @@ gnc_table_init_gui (gncUIWidget widget, void *data) /* config the cell-block styles */ - gnucash_sheet_set_cursor (sheet, sr->header, GNUCASH_CURSOR_HEADER); + gnucash_sheet_set_cursor (sheet, sr->header, CURSOR_TYPE_HEADER); gnucash_sheet_set_cursor (sheet, sr->single_cursor, - GNUCASH_CURSOR_SINGLE); + CURSOR_TYPE_SINGLE); gnucash_sheet_set_cursor (sheet, sr->double_cursor, - GNUCASH_CURSOR_DOUBLE); + CURSOR_TYPE_DOUBLE); gnucash_sheet_set_cursor (sheet, sr->trans_cursor, - GNUCASH_CURSOR_TRANS); + CURSOR_TYPE_TRANS); gnucash_sheet_set_cursor (sheet, sr->split_cursor, - GNUCASH_CURSOR_SPLIT); + CURSOR_TYPE_SPLIT); for (i = 0; i < CELL_TYPE_COUNT; i++) header_widths[i] = -1; @@ -219,7 +219,10 @@ gnc_table_refresh_cursor_gui (Table * table, gnucash_sheet_cursor_set_from_table (sheet, do_scroll); if (gnucash_sheet_block_set_from_table (sheet, vcell_loc)) { + g_warning ("woops"); gnucash_sheet_recompute_block_offsets (sheet); + gnucash_sheet_set_scroll_region (sheet); + gnucash_sheet_compute_visible_range(sheet); gnucash_sheet_redraw_all (sheet); } else diff --git a/src/scm/prefs.scm b/src/scm/prefs.scm index 5fe1c5d9da..73afc9d350 100644 --- a/src/scm/prefs.scm +++ b/src/scm/prefs.scm @@ -274,7 +274,7 @@ transaction." #t)) (gnc:register-configuration-option (gnc:make-color-option - "Register Colors" "Header background" + "Register Colors" "Header color" "a" "The header background color" (list #x96 #xb2 #x84 0) 255 @@ -282,90 +282,58 @@ transaction." #t)) (gnc:register-configuration-option (gnc:make-color-option - "Register Colors" "Single mode default even row background" - "b" "The default background color for even rows in single mode" + "Register Colors" "Primary color" + "b" "The default background color for register rows" + (list #xbf #xde #xba 0) + 255 + #f)) + +(gnc:register-configuration-option + (gnc:make-color-option + "Register Colors" "Secondary color" + "c" "The default secondary background color for register rows" (list #xf6 #xff #xdb 0) 255 #f)) (gnc:register-configuration-option (gnc:make-color-option - "Register Colors" "Single mode default odd row background" - "bb" "The default background color for odd rows in single mode" - (list #xbf #xde #xba 0) - 255 - #f)) - -(gnc:register-configuration-option - (gnc:make-color-option - "Register Colors" "Single mode active background" - "c" "The background color for the active transaction in single mode" + "Register Colors" "Primary active color" + "d" "The background color for the current register row" (list #xff #xf7 #xba 0) 255 #f)) (gnc:register-configuration-option (gnc:make-color-option - "Register Colors" "Double mode default even row background" - "d" "The default background color for even rows in double mode" - (list #xf6 #xff #xdb 0) - 255 - #f)) - -(gnc:register-configuration-option - (gnc:make-color-option - "Register Colors" "Double mode default odd row background" - "e" "The default background color for odd rows in double mode" - (list #xbf #xde #xba 0) - 255 - #f)) - -(gnc:register-configuration-option - (gnc:make-simple-boolean-option - "Register Colors" "Double mode colors alternate with transactions" - "ee" "Alternate the even and odd colors with each transaction, not each row" - #f)) - -(gnc:register-configuration-option - (gnc:make-color-option - "Register Colors" "Double mode active background" - "f" "The background color for the active transaction in double mode" - (list #xff #xf7 #xba 0) - 255 - #f)) - -(gnc:register-configuration-option - (gnc:make-color-option - "Register Colors" "Multi mode default transaction background" - "g" "The default background color for transactions in multi-line mode and the auto modes" - (list #xbf #xde #xba 0) - 255 - #f)) - -(gnc:register-configuration-option - (gnc:make-color-option - "Register Colors" "Multi mode active transaction background" - "h" "The background color for an active transaction in multi-line mode and the auto modes" + "Register Colors" "Secondary active color" + "e" "The secondary background color for the current register row" (list #xff #xf0 #x99 0) 255 #f)) (gnc:register-configuration-option (gnc:make-color-option - "Register Colors" "Multi mode default split background" - "i" "The default background color for splits in multi-line mode and the auto modes" + "Register Colors" "Split color" + "f" "The default background color for split rows in the register" (list #xff #xfa #xd9 0) 255 #f)) (gnc:register-configuration-option (gnc:make-color-option - "Register Colors" "Multi mode active split background" - "j" "The background color for an active split in multi-line mode and the auto modes" + "Register Colors" "Split active color" + "g" "The background color for the current split row in the register" (list #xff #xf2 #xab 0) 255 #f)) +(gnc:register-configuration-option + (gnc:make-simple-boolean-option + "Register Colors" "Double mode colors alternate with transactions" + "h" "Alternate the primary and secondary colors with each transaction, not each row" + #f)) + ;;; Reconcile Options