*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2051 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-03-03 21:21:49 +00:00
parent 9e26a7882d
commit a45524211b
23 changed files with 3198 additions and 1149 deletions

View File

@ -1,5 +1,34 @@
2000-03-03 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/scm/c-interface.scm: new functionality for registering
translatable strings and saving them to a file in a suitable
format for po creation. This touched a bunch of other .scm
files as well.
2000-03-02 Dave Peticolas <peticola@cs.ucdavis.edu> 2000-03-02 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/gnome/dialog-options.c: use gettext to translate the strings
used to make the gui components.
* src/gnome/window-reconcile.c
(gnc_reconcile_window_create_list_frame): always show vertical
scrollbars, the columns widths work out better that way.
* src/gnome/reconcile-list.c
(gnc_reconcile_list_get_needed_height): better estimate of needed
height than just multiplying row height times rows.
* src/register/gnome/gnucash-item-list.c (gnc_item_list_autosize):
new function to autosize the list. For some reason, have the list
autosize for each new insertion wasn't working for very large
registers.
* src/register/gnome/gnucash-sheet.c (gnucash_sheet_new): bump up
the scroll region for very large registers.
* src/gnome/window-main.c (gnc_main_create_toolbar): removed the
C-a and C-d shortcuts for adding and deleting accounts.
* src/gnome/reconcile-list.c (gnc_reconcile_list_init): print * src/gnome/reconcile-list.c (gnc_reconcile_list_init): print
selected 'y' reconcile flags in yellow for better contrast. selected 'y' reconcile flags in yellow for better contrast.
(gnc_reconcile_list_unselect_row): don't unselect the row if we (gnc_reconcile_list_unselect_row): don't unselect the row if we

View File

@ -1,3 +1,10 @@
2000-03-03 Dave Peticolas <peticola@cs.ucdavis.edu>
* POTFILES.in: added guile_strings.txt, a collection of strings
used in the guile code.
* Added Yannick LE NY's fr.po translations.
2000-02-18 Dave Peticolas <peticola@cs.ucdavis.edu> 2000-02-18 Dave Peticolas <peticola@cs.ucdavis.edu>
* Start of ChangeLog for po directory. * Start of ChangeLog for po directory.

View File

@ -1,3 +1,5 @@
# List of files which containing translatable strings. # List of files which containing translatable strings.
# Copyright (C) 1995, 1998 Free Software Foundation, Inc. # Copyright (C) 1995, 1998 Free Software Foundation, Inc.
include/messages_i18n.h include/messages_i18n.h
po/guile_strings.txt

1789
po/de.po

File diff suppressed because it is too large Load Diff

2006
po/fr.po

File diff suppressed because it is too large Load Diff

232
po/guile_strings.txt Normal file
View File

@ -0,0 +1,232 @@
_("String Option")
_("Second Option")
_("Mutual Fund")
_("Account Name")
_("Date")
_("Equity")
_("Account Separator")
_("The default background color for splits in multi-line mode and the auto modes")
_("Auto-Raise Lists")
_("Balance")
_("Secondary Sort Order")
_("The types of accounts for which balances are sign-reversed")
_("The Good")
_("Double Line")
_("Use a 24 hour (instead of a 12 hour) time format.")
_("Income:Salary:Taxable")
_("reg_win_width")
_("Time")
_("Memo")
_("International")
_("The background color for an active split in multi-line mode and the auto modes")
_("Double mode active background")
_("This is a string option")
_("Main Window")
_("_Account Transactions")
_("UK")
_("Sort by date")
_("Account types to display")
_("Gain And Loss")
_("Double click expands parent accounts")
_("main_win_height")
_("Boolean Option")
_("Income-Salary-Taxable")
_("Testing")
_("US-style: mm/dd/yyyy")
_("By default, show every transaction in an account.")
_("Amount")
_("Multi Line")
_("The default background color for odd rows in double mode")
_("UK-style dd/mm/yyyy")
_("Account")
_("Header background")
_("Sorting")
_("Show icons only")
_("The default background color for odd rows in single mode")
_("Auto Single")
_("Display the Hello, World report.")
_("Hello Again")
_("This page shows your profits and losses.")
_("Show Vertical Borders")
_("This is a boolean option.")
_("_Profit and Loss")
_("Background Color")
_("Income/Salary/Taxable")
_("Continental Europe: dd.mm.yyyy")
_("account_edit_win_height")
_("Import QIF File - Scripted in Guile.")
_("Show Horizontal Borders")
_("Sort by check/transaction number")
_("The background color for the active transaction in double mode")
_("Register Colors")
_("Multi mode default transaction background")
_("Double clicking on an account with children expands the account instead of opening a register.")
_("The background color for the active transaction in single mode")
_("Credit Accounts")
_("Sort by description")
_("largest to smallest, latest to earliest")
_("Secondary Key")
_("Save window sizes and positions.")
_("Bank")
_("Reverse Income and Expense Accounts")
_("Europe")
_("Add in sub-accounts of each selected")
_("Day")
_("This is for testing. Your reports probably shouldn't have an option like this.")
_("Average")
_("A_ccount Balance Tracker")
_("From")
_("Sort by EXACT entry time")
_("account_add_win_width")
_("Multi mode default split background")
_("Currency")
_("Week")
_("Get number at each one of these")
_("Crash the report")
_("Cash")
_("Step Size")
_("Hello, World!")
_("ISO")
_("Date Format Display")
_("Reversed-balance account types")
_("Show transactions on two lines with more information")
_("Account fields to display")
_("Report Options")
_("Show transactions on single lines")
_("Description")
_("Alternate the even and odd colors with each transaction, not each row")
_("Gain/Loss")
_("Transfer from/to")
_("Text only")
_("Toolbar Buttons")
_("Report Items from this date")
_("The default background color for transactions in multi-line mode and the auto modes")
_("Fourth Options")
_("Sort by this criterion first")
_("Ugly option")
_("Save Translatable Strings")
_("Save strings that need to be translated")
_("Number of Rows")
_("/ (Slash)")
_("Asset")
_("Use 24-hour time format")
_("Date Format")
_("A list option")
_("ISO Standard: yyyy-mm-dd")
_("Default Currency")
_("Do transaction report on this account")
_("Single mode default even row background")
_("Double mode default even row background")
_("Double mode colors alternate with transactions")
_("General")
_("Security")
_("Single Line")
_("Sub-Accounts")
_("Liability")
_("Don't reverse any accounts")
_("Good option")
_("US")
_("account_edit_win_width")
_("_Balance sheet")
_("Help for first option")
_("Number")
_("Show both icons and text")
_("Notes")
_("_Reports")
_("Single mode active background")
_("Register")
_("Year")
_("Profit and Loss")
_("Month")
_("Multi mode active transaction background")
_(". (Period)")
_("Primary Sort Order")
_("Descending")
_("This is a date option")
_("Two Week")
_("Save Window Geometry")
_("Income\\Salary\\Taxable")
_("Code")
_("Export data as text.")
_("- (Dash)")
_("Order of primary sorting")
_("Default Currency For New Accounts")
_("Sort by this criterion second")
_("Income.Salary.Taxable")
_("Income")
_("The Ugly")
_("By default, show horizontal borders on the cells.")
_(": (Colon)")
_("By default, show vertical borders on the cells.")
_("Credit")
_("Ascending")
_("The Bad")
_("Just a Date Option")
_("The default background color for even rows in single mode")
_("The default background color for even rows in double mode")
_("_Hello, World")
_("First Option")
_("Double line mode with multi-line cursor")
_("Single line mode with multi-line cursor")
_("Show transactions on multiple lines with one line for each split in the transaction")
_("account_add_win_height")
_("Plot Type")
_("Choose whether to display icons, text, or both for toolbar buttons")
_("Show text only")
_("Icons and Text")
_("Automatically raise the list of accounts or actions during input.")
_("Sort by account transferred from/to's name")
_("Net Gain")
_("The fourth option rules!")
_("This is a date option with time")
_("The header background color")
_("Sort by memo")
_("Third Option")
_("Choose the default mode for register windows")
_("Default number of register rows to display.")
_("None")
_("Export data as text (Danger: Unfinished)")
_("Primary Key")
_("Time and Date Option")
_("Single mode default odd row background")
_("Double mode default odd row background")
_("The character used to separate fully-qualified account names")
_("__gui")
_("To")
_("smallest to largest, earliest to latest")
_("Type")
_("\\ (Backslash)")
_("Icons only")
_("Help for third option")
_("Default Register Mode")
_("Auto Double")
_("main_win_width")
_("Sort by amount")
_("This is an account list option")
_("Average Balance")
_("Show All Transactions")
_("Display the Profit and Loss report.")
_("Display the Account Balance Tracker report.")
_("2Week")
_("Nothing")
_("Expense")
_("An account list option")
_("Multi Choice Option")
_("This is a color option")
_("QIF File Import (Danger: Unfinished)")
_("Make No Plot")
_("Bad option")
_("Display the Balance sheet report.")
_("Display the Account Transactions report.")
_("This is a list option")
_("Order of Secondary sorting")
_("Help for second option")
_("reg_stock_win_width")
_("Report items up to and including this date")
_("The background color for an active transaction in multi-line mode and the auto modes")
_("This is a multi choice option.")
_("Income & Expense")
_("Reverse Credit Card, Liability, Equity, and Income Accounts")
_("Stock")
_("Extensions")
_("Multi mode active split background")

View File

@ -1691,7 +1691,8 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
secondary = xaccTransGetSplit (trans, j); secondary = xaccTransGetSplit (trans, j);
if (secondary != split) { if (secondary != split) {
xaccSetCursor (table, reg->split_cursor, phys_row, 0, vrow, 0); xaccSetCursor (table, reg->split_cursor,
phys_row, 0, vrow, 0);
xaccMoveCursor (table, phys_row, 0); xaccMoveCursor (table, phys_row, 0);
xaccSRLoadRegEntry (reg, secondary); xaccSRLoadRegEntry (reg, secondary);
PINFO ("xaccSRLoadRegister(): " PINFO ("xaccSRLoadRegister(): "

View File

@ -1,6 +1,6 @@
/********************************************************************\ /********************************************************************\
* dialog-options.c -- GNOME option handling * * dialog-options.c -- GNOME option handling *
* Copyright (C) 1998,1999 Linas Vepstas * * Copyright (C) 1998-2000 Linas Vepstas *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *
@ -410,6 +410,8 @@ gnc_option_create_multichoice_widget(GNCOption *option)
GtkWidget *widget; GtkWidget *widget;
GNCOptionInfo *info; GNCOptionInfo *info;
int num_values; int num_values;
char **raw_strings;
char **raw;
int i; int i;
num_values = gnc_option_num_permissible_values(option); num_values = gnc_option_num_permissible_values(option);
@ -417,22 +419,36 @@ gnc_option_create_multichoice_widget(GNCOption *option)
g_return_val_if_fail(num_values >= 0, NULL); g_return_val_if_fail(num_values >= 0, NULL);
info = g_new0(GNCOptionInfo, num_values); info = g_new0(GNCOptionInfo, num_values);
raw_strings = g_new0(char *, num_values * 2);
raw = raw_strings;
for (i = 0; i < num_values; i++) for (i = 0; i < num_values; i++)
{ {
info[i].name = gnc_option_permissible_value_name(option, i); *raw = gnc_option_permissible_value_name(option, i);
info[i].tip = gnc_option_permissible_value_description(option, i); if (*raw != NULL)
info[i].name = _(*raw);
else
info[i].name = "";
raw++;
*raw = gnc_option_permissible_value_description(option, i);
if (*raw != NULL)
info[i].tip = _(*raw);
else
info[i].tip = "";
info[i].callback = gnc_option_multichoice_cb; info[i].callback = gnc_option_multichoice_cb;
info[i].user_data = option; info[i].user_data = option;
} }
widget = gnc_build_option_menu(info, num_values); widget = gnc_build_option_menu(info, num_values);
for (i = 0; i < num_values; i++) for (i = 0; i < num_values * 2; i++)
{ if (raw_strings[i] != NULL)
free(info[i].name); free(raw_strings[i]);
free(info[i].tip);
} g_free(raw_strings);
g_free(info); g_free(info);
return widget; return widget;
@ -713,6 +729,7 @@ gnc_option_set_ui_widget(GNCOption *option,
GtkWidget *enclosing = NULL; GtkWidget *enclosing = NULL;
GtkWidget *value = NULL; GtkWidget *value = NULL;
gboolean packed = FALSE; gboolean packed = FALSE;
char *raw_name, *raw_documentation;
char *name, *documentation; char *name, *documentation;
char *type; char *type;
@ -720,8 +737,17 @@ gnc_option_set_ui_widget(GNCOption *option,
if (type == NULL) if (type == NULL)
return; return;
name = gnc_option_name(option); raw_name = gnc_option_name(option);
documentation = gnc_option_documentation(option); if (raw_name != NULL)
name = _(raw_name);
else
name = NULL;
raw_documentation = gnc_option_documentation(option);
if (raw_documentation != NULL)
documentation = _(raw_documentation);
else
documentation = NULL;
if (safe_strcmp(type, "boolean") == 0) if (safe_strcmp(type, "boolean") == 0)
{ {
@ -960,10 +986,10 @@ gnc_option_set_ui_widget(GNCOption *option,
if (enclosing != NULL) if (enclosing != NULL)
gtk_widget_show_all(enclosing); gtk_widget_show_all(enclosing);
if (documentation != NULL) if (raw_name != NULL)
free(documentation); free(raw_name);
if (name != NULL) if (raw_documentation != NULL)
free(name); free(raw_documentation);
free(type); free(type);
} }
@ -991,7 +1017,7 @@ gnc_options_dialog_append_page(GnomePropertyBox *propertybox,
if (strncmp(name, "__", 2) == 0) if (strncmp(name, "__", 2) == 0)
return; return;
page_label = gtk_label_new(name); page_label = gtk_label_new(_(name));
gtk_widget_show(page_label); gtk_widget_show(page_label);
page_content_box = gtk_vbox_new(FALSE, 5); page_content_box = gtk_vbox_new(FALSE, 5);

View File

@ -1,6 +1,6 @@
/********************************************************************\ /********************************************************************\
* dialog-options.h -- GNOME option handling * * dialog-options.h -- GNOME option handling *
* Copyright (C) 1998,1999 Linas Vepstas * * Copyright (C) 1998-2000 Linas Vepstas *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *

View File

@ -302,17 +302,27 @@ gnc_reconcile_list_destroy(GtkObject *object)
} }
gint gint
gnc_reconcile_list_get_row_height(GNCReconcileList *list) gnc_reconcile_list_get_needed_height(GNCReconcileList *list, gint num_rows)
{ {
GtkCList *clist;
gint list_height;
gint title_height;
g_return_val_if_fail(list != NULL, 0); g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail(IS_GNC_RECONCILE_LIST(list), 0); g_return_val_if_fail(IS_GNC_RECONCILE_LIST(list), 0);
if (!GTK_WIDGET_REALIZED(list)) if (!GTK_WIDGET_REALIZED(list))
return 0; return 0;
gtk_clist_set_row_height(GTK_CLIST(list), 0); clist = GTK_CLIST(list);
return GTK_CLIST(list)->row_height; /* sync with gtkclist.c */
title_height = (clist->column_title_area.height +
(GTK_WIDGET(list)->style->klass->ythickness +
GTK_CONTAINER(list)->border_width) * 2);
list_height = (clist->row_height * num_rows) + (num_rows + 1);
return title_height + list_height;
} }
gint gint

View File

@ -80,7 +80,8 @@ GtkType gnc_reconcile_list_get_type (void);
GtkWidget * gnc_reconcile_list_new (Account * account, GtkWidget * gnc_reconcile_list_new (Account * account,
GNCReconcileListType type); GNCReconcileListType type);
gint gnc_reconcile_list_get_row_height(GNCReconcileList *list); gint gnc_reconcile_list_get_needed_height(GNCReconcileList *list,
gint num_rows);
gint gnc_reconcile_list_get_num_splits(GNCReconcileList *list); gint gnc_reconcile_list_get_num_splits(GNCReconcileList *list);

View File

@ -816,14 +816,14 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree,
NEW_ACC_MENU_E_STR, TOOLTIP_NEW, NEW_ACC_MENU_E_STR, TOOLTIP_NEW,
gnc_ui_add_account, NULL, NULL, gnc_ui_add_account, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_ADD, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_ADD,
'a', GDK_CONTROL_MASK, NULL 0, 0, NULL
}, },
{ {
GNOME_APP_UI_ITEM, GNOME_APP_UI_ITEM,
DEL_ACC_MENU_STR, TOOLTIP_DELETE, DEL_ACC_MENU_STR, TOOLTIP_DELETE,
gnc_ui_delete_account_cb, NULL, NULL, gnc_ui_delete_account_cb, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_REMOVE, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_REMOVE,
'd', GDK_CONTROL_MASK, NULL 0, 0, NULL
}, },
GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_SUBTREE(SCRUB_MENU_STR, scrubmenu), GNOMEUIINFO_SUBTREE(SCRUB_MENU_STR, scrubmenu),

View File

@ -427,9 +427,9 @@ gnc_reconcile_window_create_list_frame(Account *account,
scrollWin = gtk_scrolled_window_new (NULL, NULL); scrollWin = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrollWin), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrollWin),
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC); GTK_POLICY_ALWAYS);
gtk_container_set_border_width(GTK_CONTAINER(scrollWin), 5); gtk_container_set_border_width(GTK_CONTAINER(scrollWin), 5);
gtk_container_add(GTK_CONTAINER(frame), scrollWin); gtk_container_add(GTK_CONTAINER(frame), scrollWin);
gtk_container_add(GTK_CONTAINER(scrollWin), list); gtk_container_add(GTK_CONTAINER(scrollWin), list);
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
@ -1102,11 +1102,8 @@ recnWindow(GtkWidget *parent, Account *account)
/* Clamp down on the size */ /* Clamp down on the size */
{ {
gint row_height, num_debits, num_credits, num_show; GNCReconcileList *rlist;
gint height, num_debits, num_credits, num_show;
gtk_widget_realize(recnData->credit);
row_height = gnc_reconcile_list_get_row_height
(GNC_RECONCILE_LIST(recnData->credit));
num_credits = gnc_reconcile_list_get_num_splits num_credits = gnc_reconcile_list_get_num_splits
(GNC_RECONCILE_LIST(recnData->credit)); (GNC_RECONCILE_LIST(recnData->credit));
@ -1114,10 +1111,15 @@ recnWindow(GtkWidget *parent, Account *account)
(GNC_RECONCILE_LIST(recnData->debit)); (GNC_RECONCILE_LIST(recnData->debit));
num_show = MAX(num_debits, num_credits); num_show = MAX(num_debits, num_credits);
num_show = MIN(num_show, 15) + 2; num_show = MIN(num_show, 15);
num_show = MAX(num_show, 8);
gtk_widget_set_usize(recnData->credit, 0, row_height * num_show); gtk_widget_realize(recnData->credit);
gtk_widget_set_usize(recnData->debit, 0, row_height * num_show); rlist = GNC_RECONCILE_LIST(recnData->credit);
height = gnc_reconcile_list_get_needed_height(rlist, num_show);
gtk_widget_set_usize(recnData->credit, 0, height);
gtk_widget_set_usize(recnData->debit, 0, height);
} }
} }

View File

@ -1056,6 +1056,8 @@ item_edit_show_list (ItemEdit *item_edit)
else else
list_anchor = GTK_ANCHOR_NW; list_anchor = GTK_ANCHOR_NW;
gnc_item_list_autosize(item_edit->item_list);
gnome_canvas_item_set(GNOME_CANVAS_ITEM(item_edit->item_list), gnome_canvas_item_set(GNOME_CANVAS_ITEM(item_edit->item_list),
"x", (gdouble) list_x, "x", (gdouble) list_x,
"y", (gdouble) list_y, "y", (gdouble) list_y,

View File

@ -114,6 +114,16 @@ gnc_item_list_sort(GNCItemList *item_list)
} }
void
gnc_item_list_autosize(GNCItemList *item_list)
{
g_return_if_fail(item_list != NULL);
g_return_if_fail(IS_GNC_ITEM_LIST(item_list));
gtk_clist_columns_autosize(item_list->clist);
}
static void static void
item_edit_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) item_edit_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{ {
@ -334,7 +344,6 @@ gnc_item_list_new(GnomeCanvasGroup *parent)
clist = gtk_clist_new(1); clist = gtk_clist_new(1);
gtk_box_pack_start(GTK_BOX(hbox), clist, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), clist, TRUE, TRUE, 0);
gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 0, TRUE);
gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_BROWSE); gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_BROWSE);
scrollbar = gtk_vscrollbar_new(NULL); scrollbar = gtk_vscrollbar_new(NULL);
@ -347,6 +356,7 @@ gnc_item_list_new(GnomeCanvasGroup *parent)
"widget", hbox, "widget", hbox,
"size_pixels", TRUE, "size_pixels", TRUE,
"x", -10000.0, "x", -10000.0,
"y", -10000.0,
NULL); NULL);
item_list = GNC_ITEM_LIST(item); item_list = GNC_ITEM_LIST(item);

View File

@ -49,6 +49,8 @@ void gnc_item_list_select(GNCItemList *item_list, const char *string);
void gnc_item_list_sort(GNCItemList *item_list); void gnc_item_list_sort(GNCItemList *item_list);
void gnc_item_list_autosize(GNCItemList *item_list);
typedef struct typedef struct
{ {

View File

@ -376,6 +376,7 @@ gnucash_sheet_compute_visible_range (GnucashSheet *sheet)
if (y + style->dimensions->height >= height) if (y + style->dimensions->height >= height)
break; break;
y += style->dimensions->height; y += style->dimensions->height;
block++; block++;
} while (block < sheet->num_virt_rows - 1); } while (block < sheet->num_virt_rows - 1);
@ -446,8 +447,10 @@ gnucash_sheet_set_top_row (GnucashSheet *sheet, gint new_top_row, gint align)
x = cx; x = cx;
height = GTK_WIDGET(sheet)->allocation.height; height = GTK_WIDGET(sheet)->allocation.height;
distance = gnucash_sheet_row_get_distance(sheet, new_top_row, distance = gnucash_sheet_row_get_distance(sheet, new_top_row,
sheet->num_virt_rows); sheet->num_virt_rows);
while ((new_top_row > 1) && height > distance) while ((new_top_row > 1) && height > distance)
{ {
SheetBlockStyle *style; SheetBlockStyle *style;
@ -469,7 +472,6 @@ gnucash_sheet_set_top_row (GnucashSheet *sheet, gint new_top_row, gint align)
y += diff; y += diff;
sheet->top_block_offset = -diff; sheet->top_block_offset = -diff;
sheet->top_block = new_top_row; sheet->top_block = new_top_row;
if (x != cx || y != cy) { if (x != cx || y != cy) {
@ -477,7 +479,7 @@ gnucash_sheet_set_top_row (GnucashSheet *sheet, gint new_top_row, gint align)
gnome_canvas_scroll_to (GNOME_CANVAS(sheet), x, y); gnome_canvas_scroll_to (GNOME_CANVAS(sheet), x, y);
} }
gnucash_sheet_update_adjustments (sheet); gnucash_sheet_update_adjustments (sheet);
} }
@ -550,8 +552,6 @@ gnucash_sheet_update_adjustments (GnucashSheet *sheet)
hadj->step_increment = hadj->page_size / 50.0; hadj->step_increment = hadj->page_size / 50.0;
gtk_adjustment_changed (hadj); gtk_adjustment_changed (hadj);
} }
} }
@ -583,8 +583,8 @@ gnucash_sheet_vadjustment_value_changed (GtkAdjustment *adj,
gint oy; gint oy;
if (sheet->smooth_scroll) { if (sheet->smooth_scroll) {
new_top_row = gnucash_sheet_y_pixel_to_block (sheet, (gint) adj->value); oy = (gint) adj->value;
new_top_row = gnucash_sheet_y_pixel_to_block (sheet, oy);
if (new_top_row < 0) { if (new_top_row < 0) {
sheet->top_block = 0; sheet->top_block = 0;
sheet->top_block_offset = 0; sheet->top_block_offset = 0;
@ -2427,7 +2427,7 @@ gnucash_sheet_new (Table *table)
/* FIXME: */ /* FIXME: */
gnome_canvas_set_scroll_region(GNOME_CANVAS (sheet), gnome_canvas_set_scroll_region(GNOME_CANVAS (sheet),
0, 0, 100000, 100000); 0, 0, 1000000, 1000000);
/* handy shortcuts */ /* handy shortcuts */
sheet_canvas = GNOME_CANVAS (sheet); sheet_canvas = GNOME_CANVAS (sheet);
@ -2441,8 +2441,11 @@ gnucash_sheet_new (Table *table)
sheet->grid = item; sheet->grid = item;
/* some register data */ /* some register data */
sheet->layout_info_hash_table = g_hash_table_new (g_str_hash, g_str_equal); sheet->layout_info_hash_table = g_hash_table_new (g_str_hash,
sheet->dimensions_hash_table = g_hash_table_new (g_str_hash, g_str_equal); g_str_equal);
sheet->dimensions_hash_table = g_hash_table_new (g_str_hash,
g_str_equal);
/* The cursor */ /* The cursor */
sheet->cursor = gnucash_cursor_new (sheet_group); sheet->cursor = gnucash_cursor_new (sheet_group);

View File

@ -41,3 +41,41 @@
(false-if-exception (false-if-exception
(call-with-output-string write-error))) (call-with-output-string write-error)))
(define gnc:register-translatable-strings #f)
(define gnc:save-translatable-strings #f)
(let ((string-hash (make-hash-table 313)))
(define (register . strings)
(if (gnc:debugging?)
(for-each
(lambda (string)
(if (and (string? string) (> (string-length string) 0))
(hash-set! string-hash string #t)))
strings)))
(define (save file)
(let ((port (open file (logior O_WRONLY O_CREAT O_TRUNC))))
(if port
(begin
(hash-for-each
(lambda (string not-used)
(display "_(" port)
(write string port)
(display ")\n" port))
string-hash)
(close port)))))
(set! gnc:register-translatable-strings register)
(set! gnc:save-translatable-strings save))
(if (gnc:debugging?)
(begin
(define (gnc:gettext string)
(gnc:register-translatable-strings string)
(gnc:gettext-helper string)))
(define gnc:gettext gnc:gettext-helper))
(define gnc:_ gnc:gettext)

View File

@ -15,6 +15,8 @@
path path
;; The script to call when the menu item is selected ;; The script to call when the menu item is selected
script) script)
(if (gnc:debugging?)
(gnc:register-translatable-strings name documentation-string))
(vector type (vector type
name name
documentation-string documentation-string
@ -61,7 +63,21 @@
(gnc:add-extension menu) (gnc:add-extension menu)
(gnc:add-extension export-item) (gnc:add-extension export-item)
(gnc:add-extension qif-item)) (gnc:add-extension qif-item)
(if (gnc:debugging?)
(begin
(define strings-item
(gnc:make-menu-item
"Save Translatable Strings"
"Save strings that need to be translated"
(list "Extensions" "")
(lambda ()
(let ((file-name (gnc:file-selection-dialog
"Select file to save strings in" "")))
(if file-name (gnc:save-translatable-strings file-name))))))
(gnc:add-extension strings-item))))
(if (gnc:debugging?) (if (gnc:debugging?)
(gnc:hook-add-dangler gnc:*main-window-opened-hook* (gnc:hook-add-dangler gnc:*main-window-opened-hook*
@ -91,6 +107,8 @@
(substring name k length)))) (substring name k length))))
(hash-set! letter-hash char #t) (hash-set! letter-hash char #t)
(hash-set! name-hash name new-name) (hash-set! name-hash name new-name)
(if (gnc:debugging?)
(gnc:register-translatable-strings new-name))
new-name) new-name)
(try-at-k (+ k 1)))))) (try-at-k (+ k 1))))))

View File

@ -22,7 +22,12 @@
;; on success, and (#f "failure-message") on failure. If #t, ;; on success, and (#f "failure-message") on failure. If #t,
;; the supplied value will be used by the gui to set the option. ;; the supplied value will be used by the gui to set the option.
value-validator value-validator
option-data) option-data
;; This function should return a list of all the strings in the
;; option other than the section, name, and documentation-string
;; that might be displayed to the user (and thus should be
;; translated).
strings-getter)
(let ((changed-callback #f)) (let ((changed-callback #f))
(vector section (vector section
name name
@ -37,7 +42,8 @@
generate-restore-form generate-restore-form
value-validator value-validator
option-data option-data
(lambda (callback) (set! changed-callback callback))))) (lambda (callback) (set! changed-callback callback))
strings-getter)))
(define (gnc:option-section option) (define (gnc:option-section option)
(vector-ref option 0)) (vector-ref option 0))
@ -64,6 +70,8 @@
(define (gnc:option-set-changed-callback option callback) (define (gnc:option-set-changed-callback option callback)
(let ((cb-setter (vector-ref option 11))) (let ((cb-setter (vector-ref option 11)))
(cb-setter callback))) (cb-setter callback)))
(define (gnc:option-strings-getter option)
(vector-ref option 12))
(define (gnc:option-value option) (define (gnc:option-value option)
(let ((getter (gnc:option-getter option))) (let ((getter (gnc:option-getter option)))
@ -73,6 +81,7 @@
(let ((getter (gnc:option-default-getter option))) (let ((getter (gnc:option-default-getter option)))
(getter))) (getter)))
(define (gnc:restore-form-generator value->string) (define (gnc:restore-form-generator value->string)
(lambda () (string-append (lambda () (string-append
"(lambda (option) " "(lambda (option) "
@ -101,7 +110,7 @@
(lambda (x) (lambda (x)
(cond ((string? x)(list #t x)) (cond ((string? x)(list #t x))
(else (list #f "string-option: not a string")))) (else (list #f "string-option: not a string"))))
#f ))) #f #f )))
(define (gnc:make-simple-boolean-option (define (gnc:make-simple-boolean-option
section section
@ -121,7 +130,7 @@
(if (boolean? x) (if (boolean? x)
(list #t x) (list #t x)
(list #f "boolean-option: not a boolean"))) (list #f "boolean-option: not a boolean")))
#f ))) #f #f )))
;; date options use the option-data as a boolean value. If true, ;; date options use the option-data as a boolean value. If true,
;; the gui should allow the time to be entered as well. ;; the gui should allow the time to be entered as well.
@ -152,7 +161,7 @@
(if (date-legal date) (if (date-legal date)
(list #t date) (list #t date)
(list #f "date-option: illegal date"))) (list #f "date-option: illegal date")))
show-time ))) show-time #f)))
;; account-list options use the option-data as a boolean value. If ;; account-list options use the option-data as a boolean value. If
;; true, the gui should allow the user to select multiple accounts. ;; true, the gui should allow the user to select multiple accounts.
@ -186,11 +195,11 @@
default-getter default-getter
#f #f
validator validator
multiple-selection ))) multiple-selection #f)))
;; multichoice options use the option-data as a list of vectors. ;; multichoice options use the option-data as a list of vectors.
;; Each vector contains a permissible value (scheme symbol) and ;; Each vector contains a permissible value (scheme symbol), a
;; a description string. ;; name, and a description string.
(define (gnc:make-multichoice-option (define (gnc:make-multichoice-option
section section
name name
@ -204,6 +213,13 @@
((eq? val (vector-ref (car p-vals) 0)) #t) ((eq? val (vector-ref (car p-vals) 0)) #t)
(else (multichoice-legal val (cdr p-vals))))) (else (multichoice-legal val (cdr p-vals)))))
(define (multichoice-strings p-vals)
(if (null? p-vals)
()
(cons (vector-ref (car p-vals) 1)
(cons (vector-ref (car p-vals) 2)
(multichoice-strings (cdr p-vals))))))
(let* ((value default-value) (let* ((value default-value)
(value->string (lambda () (value->string (lambda ()
(string-append "'" (gnc:value->string value))))) (string-append "'" (gnc:value->string value)))))
@ -220,7 +236,8 @@
(if (multichoice-legal x ok-values) (if (multichoice-legal x ok-values)
(list #t x) (list #t x)
(list #f "multichoice-option: illegal choice"))) (list #f "multichoice-option: illegal choice")))
ok-values))) ok-values
(lambda () (multichoice-strings ok-values)))))
;; list options use the option-data in the same way as multichoice ;; list options use the option-data in the same way as multichoice
;; options. List options allow the user to select more than one option. ;; options. List options allow the user to select more than one option.
@ -244,6 +261,13 @@
(legal-value? (car values) ok-values) (legal-value? (car values) ok-values)
(list-legal (cdr values)))))) (list-legal (cdr values))))))
(define (list-strings p-vals)
(if (null? p-vals)
()
(cons (vector-ref (car p-vals) 1)
(cons (vector-ref (car p-vals) 2)
(list-strings (cdr p-vals))))))
(let* ((value default-value) (let* ((value default-value)
(value->string (lambda () (value->string (lambda ()
(string-append "'" (gnc:value->string value))))) (string-append "'" (gnc:value->string value)))))
@ -260,7 +284,8 @@
(if (list-legal x) (if (list-legal x)
(list #t x) (list #t x)
(list #f "list-option: illegal value"))) (list #f "list-option: illegal value")))
ok-values))) ok-values
(lambda () (list-strings ok-values)))))
;; number range options use the option-data as a list whose ;; number range options use the option-data as a list whose
;; elements are: (lower-bound upper-bound num-decimals step-size) ;; elements are: (lower-bound upper-bound num-decimals step-size)
@ -288,7 +313,8 @@
(<= value upper-bound)) (<= value upper-bound))
(list #t x)) (list #t x))
(else (list #f "number-range-option: out of range")))) (else (list #f "number-range-option: out of range"))))
(list lower-bound upper-bound num-decimals step-size)))) (list lower-bound upper-bound num-decimals step-size)
#f)))
;; Color options store rgba values in a list. ;; Color options store rgba values in a list.
;; The option-data is a list, whose first element ;; The option-data is a list, whose first element
@ -333,7 +359,8 @@
(lambda () (canonicalize default-value)) (lambda () (canonicalize default-value))
(gnc:restore-form-generator value->string) (gnc:restore-form-generator value->string)
validate-color validate-color
(list range use-alpha)))) (list range use-alpha)
#f)))
(define (gnc:color->html color range) (define (gnc:color->html color range)
@ -545,3 +572,15 @@
(display header port) (display header port)
(display code port) (display code port)
(close port))))) (close port)))))
(define (gnc:options-register-translatable-strings options)
(gnc:options-for-each-general
(lambda (section hash)
(gnc:register-translatable-strings section))
(lambda (option)
(gnc:register-translatable-strings (gnc:option-name option))
(gnc:register-translatable-strings (gnc:option-documentation option))
(let ((getter (gnc:option-strings-getter option)))
(if getter
(apply gnc:register-translatable-strings (getter)))))
options))

View File

@ -477,3 +477,8 @@ the current value of the path."
0.0 ;; number of decimals 0.0 ;; number of decimals
1.0 ;; step size 1.0 ;; step size
)) ))
;; This needs to be after all the global options definitions
(if (gnc:debugging?)
(gnc:options-register-translatable-strings gnc:*options-entries*))

View File

@ -53,6 +53,10 @@
(hash-for-each (hash-for-each
(lambda (name report) (lambda (name report)
(if (gnc:debugging?)
(let ((options (false-if-exception (gnc:report-new-options report))))
(if options
(gnc:options-register-translatable-strings options))))
(define item (define item
(gnc:make-menu-item (gnc:make-menu-item
((menu-namer 'add-name) name) ((menu-namer 'add-name) name)

View File

@ -121,16 +121,17 @@
(list (list
"<html>" "<html>"
"<head>" "<head>"
"<title>" report-name "</title>" "<title>" (gnc:_ report-name) "</title>"
"</head>" "</head>"
"<body bgcolor=#ccccff>" "<body bgcolor=#ccccff>"
report-description (gnc:_ report-description)
"<p>" "<p>"
"<table cellpadding=1>" "<table cellpadding=1>"
"<caption><b>" report-name "</b></caption>" "<caption><b>" (gnc:_ report-name) "</b></caption>"
"<tr><th>Account Name<th align=center>Type<th> <th align=center>Balance" "<tr><th>"(gnc:_ "Account Name")"<th align=center>"(gnc:_ "Type")
"<th> <th align=center>"(gnc:_ "Balance")
output output