GnuCash Daily Diff
Dave Peticolas
peticolas@linas.org
Sat, 12 May 2001 08:02:53 -0500 (CDT)
Index: gnucash/ChangeLog
diff -c gnucash/ChangeLog:1.447 gnucash/ChangeLog:1.456
*** gnucash/ChangeLog:1.447 Fri May 11 05:48:00 2001
--- gnucash/ChangeLog Sat May 12 07:47:29 2001
***************
*** 1,3 ****
--- 1,104 ----
+ 2001-05-12 Bill Gribble <grib@billgribble.com>
+
+ * src/gnome/dialog-options.c: fix destructor bug
+
+ * src/gnome/window-report.c: add options dialog to edited list
+ even if opened by a URL click.
+
+ * src/gnome/window-main.c: handle close of last window safely.
+ Still don't save MDI info correctly with WM close, though.
+
+ 2001-05-12 Dave Peticolas <dave@krondo.com>
+
+ * src/FileDialog.c (gncFileSaveAs): don't use a default filename
+
+ * src/scm/report/hello-world.scm: put under utility menu
+
+ * src/scm/report/welcome-to-gnucash.scm: don't show in menu
+
+ * src/scm/report/iframe-url.scm: put under utility menu
+
+ * src/scm/report.scm: add 'utility reports' menu
+
+ * src/gnome/new-user-funs.c: add support for opening balances
+
+ * src/gnome/gnc-amount-edit.c (gnc_amount_edit_evaluate): allow
+ empty string as zero
+
+ * src/gnome/new-user-callbacks.c: add support for opening balances
+
+ * src/gnome/dialog-account.c (gnc_account_list_fill): fix warning
+ (gnc_account_window_destroy_cb): destroy callback has no return
+ (gnc_ui_to_account): reverse opening balance appropriately
+
+ * src/engine/Account.c: change return type to const
+
+ 2001-05-12 Christian Stimming <stimming@tuhh.de>
+
+ * src/scm/report/pnl.scm, account-piecharts.scm,
+ account-summary.scm: Added price-source option. Use new function
+ gnc:case-exchange-fn.
+
+ * src/scm/date-utilities.scm (gnc:get-end-cur-fin-year): added
+ function.
+
+ * src/scm/options-utilities.scm (gnc:options-add-date-interval!):
+ changed the order of relative dates - which order is best?
+
+ * src/scm/report/balance-sheet.scm: use new function
+ gnc:case-exchange-fn.
+
+ * src/scm/commodity-utilities.scm (gnc:case-exchange-fn): add
+ function.
+
+ * src/scm/report/price-scatter.scm: adapted helper function name
+ to other reports.
+
+ * src/scm/report/price-scatter.scm: Extended option to use the
+ pricedb as a price source.
+
+ * src/scm/commodity-utilities.scm: Added functions for getting
+ sorted commodity splits, for total-average-prices of a
+ commodity-list, for instantaneous prices, for instantaneous prices
+ of a commodity-list, and for cooking your morning coffee :)
+
+ * src/scm/report-utilites.scm, html-utilities.scm: create new
+ function (gnc:accounts-get-commodities), use it in
+ html-utilities.scm.
+
+ * src/scm/html-scatter.scm: add workaround for rgba color.
+
+ 2001-05-12 Robert Graham Merkel <rgmerk@mira.net>
+
+ * src/scm/main-window.scm: create .gnucash if it doesn't exist
+ when saving a book config file.
+
+ 2001-05-11 Dave Peticolas <dave@krondo.com>
+
+ * src/engine/Account.c (xaccCloneAccountSimple): use
+ xaccAccountSetCurrency -- it does more than just set the pointer!
+
+ * src/gnome/new-user-funs.c (clone_account): don't use engine
+ private functions.
+
+ * src/engine/io-example-account.c (add_account_local): fix up
+ currency & security for new example accounts
+
+ * src/engine/io-utils.c: add emacs mode comment to cancel
+ XML comment
+
+ * src/gnome/new-user-callbacks.c: fix compiler warning
+
+ * src/engine/gnc-book.c (gnc_book_set_group): fix bug
+
+ * src/engine/sql/Makefile.am: add files for make dist
+
+ 2001-05-11 Bill Gribble <grib@billgribble.com>
+
+ * src/scm/main-window.scm: force-output when saving param files.
+ otherwise they don't get written until program exit, which can
+ cause problems. Add newlines to acct tree output.
+
2001-05-11 Dave Peticolas <dave@krondo.com>
* src/doc/design/engine.texinfo: update docs
Index: gnucash/src/FileDialog.c
diff -c gnucash/src/FileDialog.c:1.63 gnucash/src/FileDialog.c:1.64
*** gnucash/src/FileDialog.c:1.63 Thu May 10 17:55:00 2001
--- gnucash/src/FileDialog.c Sat May 12 06:50:27 2001
***************
*** 551,557 ****
GNCBackendError io_err = ERR_BACKEND_NO_ERR;
ENTER(" ");
! filename = fileBox(_("Save"), "*.gnc", gnc_history_get_last());
if (!filename) return;
/* Check to see if the user specified the same file as the current
--- 551,557 ----
GNCBackendError io_err = ERR_BACKEND_NO_ERR;
ENTER(" ");
! filename = fileBox(_("Save"), "*.gnc", NULL);
if (!filename) return;
/* Check to see if the user specified the same file as the current
Index: gnucash/src/engine/Account.c
diff -c gnucash/src/engine/Account.c:1.143 gnucash/src/engine/Account.c:1.145
*** gnucash/src/engine/Account.c:1.143 Thu May 10 11:12:02 2001
--- gnucash/src/engine/Account.c Sat May 12 06:50:29 2001
***************
*** 151,157 ****
ret->kvp_data = kvp_frame_copy(from->kvp_data);
! ret->currency = from->currency;
return ret;
}
--- 151,157 ----
ret->kvp_data = kvp_frame_copy(from->kvp_data);
! xaccAccountSetCurrency (ret, from->currency);
return ret;
}
***************
*** 1871,1878 ****
*/
};
! char *
! xaccAccountGetTypeStr(int type) {
if (0 > type) return "";
if (NUM_ACCOUNT_TYPES <= type) return "";
return _(account_type_name [type]);
--- 1871,1878 ----
*/
};
! const char *
! xaccAccountGetTypeStr(GNCAccountType type) {
if (0 > type) return "";
if (NUM_ACCOUNT_TYPES <= type) return "";
return _(account_type_name [type]);
Index: gnucash/src/engine/Account.h
diff -c gnucash/src/engine/Account.h:1.68 gnucash/src/engine/Account.h:1.69
*** gnucash/src/engine/Account.h:1.68 Thu May 10 11:12:02 2001
--- gnucash/src/engine/Account.h Sat May 12 06:50:30 2001
***************
*** 105,111 ****
CREDITLINE = 14, /* line of credit */
} GNCAccountType;
! char * xaccAccountGetTypeStr (int type); /* GUI names */
/* Conversion routines for the account types to/from strings.
Critical for the text communication mechanisms. i.e. INCOME ->
--- 105,111 ----
CREDITLINE = 14, /* line of credit */
} GNCAccountType;
! const char * xaccAccountGetTypeStr (GNCAccountType type); /* GUI names */
/* Conversion routines for the account types to/from strings.
Critical for the text communication mechanisms. i.e. INCOME ->
Index: gnucash/src/engine/gnc-book.c
diff -c gnucash/src/engine/gnc-book.c:1.34 gnucash/src/engine/gnc-book.c:1.35
*** gnucash/src/engine/gnc-book.c:1.34 Thu May 10 11:12:52 2001
--- gnucash/src/engine/gnc-book.c Fri May 11 16:24:18 2001
***************
*** 198,204 ****
gnc_book_set_group (GNCBook *book, AccountGroup *grp)
{
if(!book) return;
! if(book->topgroup) xaccFreeAccountGroup(book->topgroup);
book->topgroup = grp;
}
--- 198,207 ----
gnc_book_set_group (GNCBook *book, AccountGroup *grp)
{
if(!book) return;
!
! /* Do not free the old topgroup here unless you also fix
! * all the other uses of gnc_book_set_group! */
!
book->topgroup = grp;
}
Index: gnucash/src/engine/io-example-account.c
diff -c gnucash/src/engine/io-example-account.c:1.2 gnucash/src/engine/io-example-account.c:1.3
*** gnucash/src/engine/io-example-account.c:1.2 Wed May 9 18:03:36 2001
--- gnucash/src/engine/io-example-account.c Fri May 11 17:26:42 2001
***************
*** 22,45 ****
* *
\********************************************************************/
! #include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
- #include <string.h>
- #include <ctype.h>
#include <glib.h>
#include "sixtp.h"
#include "gnc-engine-util.h"
#include "io-example-account.h"
#include "io-utils.h"
#include "sixtp-dom-generators.h"
#include "sixtp-dom-parsers.h"
#include "sixtp-parsers.h"
- #include "io-gncxml-gen.h"
- #include "gnc-xml.h"
#include "Group.h"
#include "TransLog.h"
--- 22,48 ----
* *
\********************************************************************/
! #include "config.h"
!
! #include <ctype.h>
#include <dirent.h>
+ #include <string.h>
#include <sys/stat.h>
+ #include <sys/types.h>
#include <unistd.h>
#include <glib.h>
#include "sixtp.h"
+ #include "gnc-engine.h"
#include "gnc-engine-util.h"
+ #include "gnc-xml.h"
#include "io-example-account.h"
+ #include "io-gncxml-gen.h"
#include "io-utils.h"
#include "sixtp-dom-generators.h"
#include "sixtp-dom-parsers.h"
#include "sixtp-parsers.h"
#include "Group.h"
#include "TransLog.h"
***************
*** 104,111 ****
--- 107,148 ----
}
static void
+ clear_up_account_commodity(
+ gnc_commodity_table *tbl, Account *act,
+ gnc_commodity * (*getter) (Account *account),
+ void (*setter) (Account *account, gnc_commodity *comm))
+ {
+ gnc_commodity *gcom;
+ gnc_commodity *com = getter(act);
+
+ if(!com)
+ {
+ return;
+ }
+
+ gcom = gnc_commodity_table_lookup(tbl, gnc_commodity_get_namespace(com),
+ gnc_commodity_get_mnemonic(com));
+ if(!gcom)
+ {
+ g_warning("unable to find global commodity for %s adding new",
+ gnc_commodity_get_unique_name(com));
+ gnc_commodity_table_insert(tbl, com);
+ }
+ else
+ {
+ gnc_commodity_destroy(com);
+ setter(act, gcom);
+ }
+ }
+
+ static void
add_account_local(GncExampleAccount *gea, Account *act)
{
+ clear_up_account_commodity(gnc_engine_commodities(), act,
+ xaccAccountGetCurrency, xaccAccountSetCurrency);
+ clear_up_account_commodity(gnc_engine_commodities(), act,
+ xaccAccountGetSecurity, xaccAccountSetSecurity);
+
if(!xaccAccountGetParent(act))
{
xaccGroupInsertAccount(gea->group, act);
Index: gnucash/src/engine/io-utils.c
diff -c gnucash/src/engine/io-utils.c:1.2 gnucash/src/engine/io-utils.c:1.3
*** gnucash/src/engine/io-utils.c:1.2 Wed May 9 18:03:36 2001
--- gnucash/src/engine/io-utils.c Fri May 11 17:26:43 2001
***************
*** 32,37 ****
--- 32,43 ----
#include "gnc-xml-helper.h"
#include "io-utils.h"
+ /*
+ <!-- Local variables: -->
+ <!-- mode: C -->
+ <!-- End: -->
+ */
+
static const gchar *emacs_trailer =
"<!-- Local variables: -->\n"
"<!-- mode: xml -->\n"
Index: gnucash/src/engine/sql/Makefile.am
diff -c gnucash/src/engine/sql/Makefile.am:1.10 gnucash/src/engine/sql/Makefile.am:1.11
*** gnucash/src/engine/sql/Makefile.am:1.10 Tue Mar 13 20:44:22 2001
--- gnucash/src/engine/sql/Makefile.am Fri May 11 14:57:13 2001
***************
*** 6,23 ****
libgnc_postgres_la_SOURCES = \
builder.c \
checkpoint.c \
gncquery.c \
! kvp-sql.c \
! PostgresBackend.c
EXTRA_DIST = \
- builder.h \
- design.txt \
- PostgresBackend.h \
README \
table.m4 \
table-create.sql \
table-drop.sql \
--- 6,30 ----
libgnc_postgres_la_SOURCES = \
+ PostgresBackend.c \
builder.c \
checkpoint.c \
gncquery.c \
! kvp-sql.c
+ noinst_HEADERS = \
+ PostgresBackend.h \
+ builder.h \
+ gncquery.h \
+ kvp-sql.h \
+ putil.h
EXTRA_DIST = \
README \
+ base-objects.m4 \
+ check-objects.m4 \
+ design.txt \
+ kvp-objects.m4 \
table.m4 \
table-create.sql \
table-drop.sql \
Index: gnucash/src/gnome/dialog-account.c
diff -c gnucash/src/gnome/dialog-account.c:1.35 gnucash/src/gnome/dialog-account.c:1.36
*** gnucash/src/gnome/dialog-account.c:1.35 Tue May 8 04:36:34 2001
--- gnucash/src/gnome/dialog-account.c Sat May 12 06:50:31 2001
***************
*** 391,396 ****
--- 391,399 ----
if (gnc_numeric_zero_p (balance))
return;
+ if (gnc_reverse_balance (account))
+ balance = gnc_numeric_neg (balance);
+
date = gnc_date_edit_get_date
(GNC_DATE_EDIT (aw->opening_balance_date_edit));
***************
*** 1257,1263 ****
}
! static int
gnc_account_window_destroy_cb (GtkObject *object, gpointer data)
{
AccountWindow *aw = data;
--- 1260,1266 ----
}
! static void
gnc_account_window_destroy_cb (GtkObject *object, gpointer data)
{
AccountWindow *aw = data;
***************
*** 1286,1292 ****
default:
PERR ("unexpected dialog type\n");
gnc_resume_gui_refresh ();
! return FALSE;
}
gnc_unregister_gui_component (aw->component_id);
--- 1289,1295 ----
default:
PERR ("unexpected dialog type\n");
gnc_resume_gui_refresh ();
! return;
}
gnc_unregister_gui_component (aw->component_id);
***************
*** 1307,1314 ****
}
g_free (aw);
-
- return FALSE;
}
--- 1310,1315 ----
***************
*** 1389,1395 ****
for (row = 0; row < NUM_ACCOUNT_TYPES; row++)
{
! text[0] = xaccAccountGetTypeStr(row);
gtk_clist_append(type_list, text);
}
}
--- 1390,1396 ----
for (row = 0; row < NUM_ACCOUNT_TYPES; row++)
{
! text[0] = (gchar *) xaccAccountGetTypeStr(row);
gtk_clist_append(type_list, text);
}
}
Index: gnucash/src/gnome/dialog-options.c
diff -c gnucash/src/gnome/dialog-options.c:1.48 gnucash/src/gnome/dialog-options.c:1.49
*** gnucash/src/gnome/dialog-options.c:1.48 Tue Apr 24 04:12:34 2001
--- gnucash/src/gnome/dialog-options.c Sat May 12 07:47:30 2001
***************
*** 1919,1925 ****
gtk_widget_hide(container);
/* at this point, window may point to freed data */
-
if (!GTK_OBJECT_DESTROYED (container))
gtk_signal_handler_unblock_by_func(GTK_OBJECT(container),
GTK_SIGNAL_FUNC
--- 1919,1924 ----
***************
*** 2047,2061 ****
gnc_options_dialog_destroy(GNCOptionWin * win) {
if (!win) return;
-
- gtk_widget_destroy(win->container);
if(!win->toplevel) {
gtk_widget_unref(win->container);
}
!
! gtk_object_unref (GTK_OBJECT(win->tips));
win->container = NULL;
win->notebook = NULL;
win->apply_cb = NULL;
--- 2046,2067 ----
gnc_options_dialog_destroy(GNCOptionWin * win) {
if (!win) return;
+ gtk_signal_disconnect_by_func(GTK_OBJECT(win->container),
+ GTK_SIGNAL_FUNC
+ (gnc_options_dialog_destroy_stub_cb),
+ win);
if(!win->toplevel) {
gtk_widget_unref(win->container);
}
! else {
! gtk_widget_destroy(win->container);
! }
+ if(win->tips) {
+ gtk_object_unref (GTK_OBJECT(win->tips));
+ }
+
win->container = NULL;
win->notebook = NULL;
win->apply_cb = NULL;
Index: gnucash/src/gnome/gnc-amount-edit.c
diff -c gnucash/src/gnome/gnc-amount-edit.c:1.8 gnucash/src/gnome/gnc-amount-edit.c:1.9
*** gnucash/src/gnome/gnc-amount-edit.c:1.8 Wed Dec 13 15:33:57 2000
--- gnucash/src/gnome/gnc-amount-edit.c Sat May 12 06:50:32 2001
***************
*** 257,262 ****
--- 257,273 ----
return TRUE;
string = gtk_entry_get_text(GTK_ENTRY(gae->amount_entry));
+ if (!string || *string == '\0')
+ {
+ gnc_numeric old_amount = gae->amount;
+
+ gnc_amount_edit_set_amount (gae, gnc_numeric_zero ());
+
+ if (!gnc_numeric_equal (gnc_numeric_zero (), old_amount))
+ gtk_signal_emit (GTK_OBJECT (gae), amount_edit_signals [AMOUNT_CHANGED]);
+
+ return TRUE;
+ }
error_loc = NULL;
Index: gnucash/src/gnome/new-user-callbacks.c
diff -c gnucash/src/gnome/new-user-callbacks.c:1.6 gnucash/src/gnome/new-user-callbacks.c:1.8
*** gnucash/src/gnome/new-user-callbacks.c:1.6 Thu May 10 11:15:07 2001
--- gnucash/src/gnome/new-user-callbacks.c Sat May 12 06:50:32 2001
***************
*** 20,44 ****
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
! #ifdef HAVE_CONFIG_H
! # include <config.h>
! #endif
#include <glib.h>
-
#include <gnome.h>
#include "gnc-book.h"
- #include "new-user-callbacks.h"
- #include "new-user-interface.h"
#include "gnc-commodity-edit.h"
- #include "glade-support.h"
- #include "new-user-funs.h"
- #include "gnc-ui-util.h"
#include "gnc-dir.h"
#include "io-example-account.h"
! #include "FileDialog.h"
! #include <guile/gh.h>
static int commodEditAdded = 0;
--- 20,44 ----
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
! #include "config.h"
#include <glib.h>
#include <gnome.h>
+ #include <guile/gh.h>
+ #include <time.h>
+ #include "FileDialog.h"
+ #include "dialog-utils.h"
+ #include "glade-support.h"
#include "gnc-book.h"
#include "gnc-commodity-edit.h"
#include "gnc-dir.h"
+ #include "gnc-ui-util.h"
#include "io-example-account.h"
! #include "new-user-callbacks.h"
! #include "new-user-funs.h"
! #include "new-user-interface.h"
! #include "query-user.h"
static int commodEditAdded = 0;
***************
*** 73,79 ****
gpointer arg1,
gpointer user_data)
{
-
return FALSE;
}
--- 73,78 ----
***************
*** 88,104 ****
}
void
on_newUserDruidFinishPage_finish (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data)
{
gnc_ui_delete_new_user_window();
gnc_ui_delete_nu_account_list();
!
gh_eval_str("(gnc:default-ui-start)");
!
/* now we need to load all the accounts into the program */
gh_eval_str("(gnc:show-main-window)");
--- 87,118 ----
}
+ static gpointer
+ starting_balance_helper (Account *account, gpointer data)
+ {
+ gnc_numeric balance;
+
+ balance = gnc_new_user_get_balance (account);
+ if (!gnc_numeric_zero_p (balance))
+ gnc_account_create_opening_balance (account, balance, time (NULL));
+
+ return NULL;
+ }
void
on_newUserDruidFinishPage_finish (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data)
{
+ if (our_final_group)
+ xaccGroupForEachAccount (our_final_group, starting_balance_helper,
+ NULL, TRUE);
+
gnc_ui_delete_new_user_window();
gnc_ui_delete_nu_account_list();
!
gh_eval_str("(gnc:default-ui-start)");
!
/* now we need to load all the accounts into the program */
gh_eval_str("(gnc:show-main-window)");
***************
*** 108,115 ****
if(our_final_group)
{
! xaccGroupConcatGroup(gnc_book_get_group(gncGetCurrentBook()),
! our_final_group);
}
}
--- 122,131 ----
if(our_final_group)
{
! AccountGroup *group;
!
! group = gnc_book_get_group(gncGetCurrentBook());
! xaccGroupConcatGroup(group, our_final_group);
}
}
***************
*** 210,215 ****
--- 226,233 ----
gtk_clist_sort(clist);
gtk_clist_thaw(clist);
+
+ g_slist_free (list);
}
***************
*** 277,293 ****
gtk_text_forward_delete(datext, gtk_text_get_length(datext));
if(gea->long_description != NULL)
{
- gtk_text_set_editable(datext, TRUE);
gtk_text_insert(datext, NULL, NULL, NULL, gea->long_description, -1);
- gtk_text_set_editable(datext, FALSE);
}
gtk_text_thaw(datext);
! gtk_tree_clear_items(datree, 0, 1000);
add_to_tree(datree, gea->group);
! printf("%s", "");
!
}
--- 295,327 ----
gtk_text_forward_delete(datext, gtk_text_get_length(datext));
if(gea->long_description != NULL)
{
gtk_text_insert(datext, NULL, NULL, NULL, gea->long_description, -1);
}
gtk_text_thaw(datext);
! gtk_tree_clear_items(datree, 0, g_list_length (datree->children) - 1);
add_to_tree(datree, gea->group);
+ }
!
! void
! on_newAccountTypesList_unselect_row (GtkCList *clist,
! gint row,
! gint column,
! GdkEvent *event,
! gpointer user_data)
! {
! GtkText *datext =
! GTK_TEXT(gnc_new_user_get_widget("newAccountTypesDescription"));
! GtkTree *datree =
! GTK_TREE(gnc_new_user_get_widget("newAccountListTree"));
!
! gtk_text_freeze(datext);
! gtk_text_set_point(datext, 0);
! gtk_text_forward_delete(datext, gtk_text_get_length(datext));
! gtk_text_thaw(datext);
!
! gtk_tree_clear_items(datree, 0, g_list_length (datree->children) - 1);
}
***************
*** 313,319 ****
on_newAccountOKButton_clicked (GtkButton *button,
gpointer user_data)
{
-
}
--- 347,352 ----
***************
*** 322,328 ****
gpointer arg1,
gpointer user_data)
{
-
return FALSE;
}
--- 355,360 ----
***************
*** 359,367 ****
ret = g_new(gchar *, 3);
ret[0] = (gchar*)xaccAccountGetName(act);
! ret[1] = xaccAccountTypeEnumAsString(xaccAccountGetType(act));
! ret[2] = "";
return ret;
}
--- 391,417 ----
ret = g_new(gchar *, 3);
ret[0] = (gchar*)xaccAccountGetName(act);
! ret[1] = (gchar*)xaccAccountGetTypeStr(xaccAccountGetType(act));
+ {
+ gnc_numeric balance;
+ const char *string;
+
+ balance = gnc_new_user_get_balance (act);
+
+ if (gnc_numeric_zero_p (balance))
+ string = "";
+ else
+ {
+ GNCPrintAmountInfo print_info;
+
+ print_info = gnc_account_value_print_info (act, FALSE);
+ string = xaccPrintAmount (balance, print_info);
+ }
+
+ ret[2] = (gchar*)string;
+ }
+
return ret;
}
***************
*** 379,393 ****
gchar **titles;
titles = generate_account_titles (toadd);
!
node = gtk_ctree_insert_node(topdata->tree, topdata->node,
topdata->sibling,
titles, 0,
NULL, NULL, NULL, NULL,
FALSE, TRUE);
- /* don't know if this is safe, so commented out at the moment. FIXME! */
- /* free_account_titles(titles); */
if(xaccGroupGetNumAccounts(xaccAccountGetChildren(toadd)) > 0)
{
FinalInsertData nextdata;
--- 429,445 ----
gchar **titles;
titles = generate_account_titles (toadd);
!
node = gtk_ctree_insert_node(topdata->tree, topdata->node,
topdata->sibling,
titles, 0,
NULL, NULL, NULL, NULL,
FALSE, TRUE);
+ free_account_titles(titles);
+
+ gtk_ctree_node_set_row_data (topdata->tree, node, toadd);
+
if(xaccGroupGetNumAccounts(xaccAccountGetChildren(toadd)) > 0)
{
FinalInsertData nextdata;
***************
*** 404,410 ****
return NULL;
}
! void
gnc_new_user_insert_final_accounts(GtkCTree *tree, AccountGroup *group)
{
FinalInsertData data;
--- 456,462 ----
return NULL;
}
! static void
gnc_new_user_insert_final_accounts(GtkCTree *tree, AccountGroup *group)
{
FinalInsertData data;
***************
*** 423,430 ****
GList *dalist;
GSList *actlist = NULL;
GtkCList *clist = gnc_new_user_get_clist();
! gtk_clist_clear(GTK_CLIST(gnc_new_user_get_widget("finalAccountCTree")));
for(dalist = clist->selection; dalist; dalist = dalist->next)
{
--- 475,485 ----
GList *dalist;
GSList *actlist = NULL;
GtkCList *clist = gnc_new_user_get_clist();
+ GtkWidget *ctree;
! ctree = gnc_new_user_get_widget("finalAccountCTree");
!
! gtk_clist_clear(GTK_CLIST(ctree));
for(dalist = clist->selection; dalist; dalist = dalist->next)
{
***************
*** 434,454 ****
delete_our_final_group();
our_final_group = gnc_new_user_merge_groups(actlist);
! gnc_new_user_insert_final_accounts(
! GTK_CTREE(gnc_new_user_get_widget("finalAccountCTree")),
! our_final_group);
}
void
! on_finalAccountCTree_select_row (GtkCList *clist,
! gint row,
gint column,
- GdkEvent *event,
gpointer user_data)
{
}
--- 489,672 ----
delete_our_final_group();
our_final_group = gnc_new_user_merge_groups(actlist);
+
+ gnc_new_user_insert_final_accounts(GTK_CTREE(ctree), our_final_group);
! gnc_clist_columns_autosize (GTK_CLIST(ctree));
!
! {
! GNCAmountEdit *balance_edit;
! GtkWidget *entry;
!
! gnc_new_user_block_amount_changed ();
!
! balance_edit = gnc_new_user_get_balance_editor ();
! gnc_amount_edit_set_amount (balance_edit, gnc_numeric_zero ());
!
! entry = gnc_amount_edit_gtk_entry (balance_edit);
! gtk_entry_set_text (GTK_ENTRY (entry), "");
!
! gnc_new_user_unblock_amount_changed ();
!
! gtk_widget_set_sensitive (GTK_WIDGET (balance_edit), FALSE);
! }
! }
!
!
! void
! on_finalAccountCTree_tree_select_row (GtkCTree *ctree,
! GList *node,
! gint column,
! gpointer user_data)
! {
! Account *account;
! GNCAmountEdit *balance_edit;
! GNCPrintAmountInfo print_info;
! gnc_numeric balance;
!
! balance_edit = gnc_new_user_get_balance_editor ();
!
! account = gtk_ctree_node_get_row_data (ctree, GTK_CTREE_NODE (node));
! if (!account || xaccAccountGetType (account) == EQUITY)
! {
! GtkWidget *entry;
!
! entry = gnc_amount_edit_gtk_entry (balance_edit);
! gtk_entry_set_text (GTK_ENTRY (entry), "");
!
! gtk_widget_set_sensitive (GTK_WIDGET (balance_edit), FALSE);
!
! return;
! }
!
! gtk_widget_set_sensitive (GTK_WIDGET (balance_edit), TRUE);
!
! balance = gnc_new_user_get_balance (account);
!
! if (gnc_reverse_balance (account))
! balance = gnc_numeric_neg (balance);
!
! print_info = gnc_account_value_print_info (account, FALSE);
! gnc_amount_edit_set_print_info (balance_edit, print_info);
! gnc_amount_edit_set_fraction (balance_edit,
! xaccAccountGetCurrencySCU (account));
!
! gnc_new_user_block_amount_changed ();
!
! gnc_amount_edit_set_amount (balance_edit, balance);
! if (gnc_numeric_zero_p (balance))
! {
! GtkWidget *entry;
!
! entry = gnc_amount_edit_gtk_entry (balance_edit);
! gtk_entry_set_text (GTK_ENTRY (entry), "");
! }
!
! gnc_new_user_unblock_amount_changed ();
}
+ static void
+ update_account_balance (GtkCTree *ctree, GtkCTreeNode *node)
+ {
+ Account *account;
+ GNCAmountEdit *balance_edit;
+ gboolean result;
+
+ balance_edit = gnc_new_user_get_balance_editor ();
+
+ account = gtk_ctree_node_get_row_data (ctree, node);
+ if (!account)
+ return;
+
+ gnc_new_user_block_amount_changed ();
+ result = gnc_amount_edit_evaluate (balance_edit);
+ gnc_new_user_unblock_amount_changed ();
+
+ if (result)
+ {
+ gnc_numeric balance;
+ GNCPrintAmountInfo print_info;
+ const char *string;
+ balance = gnc_amount_edit_get_amount (balance_edit);
+
+ print_info = gnc_account_value_print_info (account, FALSE);
+ string = xaccPrintAmount (balance, print_info);
+
+ if (gnc_numeric_zero_p (balance))
+ string = "";
+
+ gtk_ctree_node_set_text (ctree, GTK_CTREE_NODE (node), 2, string);
+
+ if (gnc_reverse_balance (account))
+ balance = gnc_numeric_neg (balance);
+
+ gnc_new_user_set_balance (account, balance);
+ }
+ }
+
void
! on_finalAccountCTree_tree_unselect_row (GtkCTree *ctree,
! GList *node,
gint column,
gpointer user_data)
{
+ update_account_balance (ctree, GTK_CTREE_NODE (node));
+
+ {
+ GNCAmountEdit *balance_edit;
+ GtkWidget *entry;
+
+ balance_edit = gnc_new_user_get_balance_editor ();
+
+ entry = gnc_amount_edit_gtk_entry (balance_edit);
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
+
+ gtk_widget_set_sensitive (GTK_WIDGET (balance_edit), FALSE);
+ }
+ }
+
+ void
+ on_finalAccountBalanceEdit_changed (GNCAmountEdit *gae)
+ {
+ GtkCTree *ctree;
+ GtkCTreeNode *node;
+
+ if (!GTK_WIDGET_SENSITIVE (GTK_WIDGET (gae)))
+ return;
+
+ ctree = gnc_new_user_get_final_account_tree ();
+ if (!ctree)
+ return;
+
+ node = gtk_ctree_node_nth (ctree, GTK_CLIST(ctree)->focus_row);
+ if (!node)
+ return;
+
+ update_account_balance (ctree, node);
+ }
+
+ gboolean
+ on_finalAccountDruidPage_next (GnomeDruidPage *gnomedruidpage,
+ gpointer arg1,
+ gpointer user_data)
+ {
+ GNCAmountEdit *balance_edit;
+
+ balance_edit = gnc_new_user_get_balance_editor ();
+ if (!gnc_amount_edit_evaluate (balance_edit))
+ {
+ GtkWidget *top;
+ const char *message = _("You must enter a valid balance.");
+
+ top = gtk_widget_get_toplevel (GTK_WIDGET (gnomedruidpage));
+ gnc_error_dialog_parented(GTK_WINDOW(top), message);
+
+ return TRUE;
+ }
+
+ return FALSE;
}
Index: gnucash/src/gnome/new-user-callbacks.h
diff -c gnucash/src/gnome/new-user-callbacks.h:1.6 gnucash/src/gnome/new-user-callbacks.h:1.7
*** gnucash/src/gnome/new-user-callbacks.h:1.6 Thu May 10 11:15:07 2001
--- gnucash/src/gnome/new-user-callbacks.h Sat May 12 06:50:32 2001
***************
*** 124,126 ****
--- 124,150 ----
#endif /* _NEW_USER_CALLBACKS_H_ */
+
+ void
+ on_newAccountTypesList_unselect_row (GtkCList *clist,
+ gint row,
+ gint column,
+ GdkEvent *event,
+ gpointer user_data);
+
+ void
+ on_finalAccountCTree_tree_select_row (GtkCTree *ctree,
+ GList *node,
+ gint column,
+ gpointer user_data);
+
+ void
+ on_finalAccountCTree_tree_unselect_row (GtkCTree *ctree,
+ GList *node,
+ gint column,
+ gpointer user_data);
+
+ gboolean
+ on_finalAccountDruidPage_next (GnomeDruidPage *gnomedruidpage,
+ gpointer arg1,
+ gpointer user_data);
Index: gnucash/src/gnome/new-user-funs.c
diff -c gnucash/src/gnome/new-user-funs.c:1.5 gnucash/src/gnome/new-user-funs.c:1.7
*** gnucash/src/gnome/new-user-funs.c:1.5 Thu May 10 11:15:07 2001
--- gnucash/src/gnome/new-user-funs.c Sat May 12 06:50:32 2001
***************
*** 20,45 ****
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
! #ifdef HAVE_CONFIG_H
! # include <config.h>
! #endif
#include <gnome.h>
#include <stdio.h>
#include "new-user-callbacks.h"
#include "new-user-interface.h"
#include "new-user-funs.h"
#include "glade-support.h"
#include "gnc-currency-edit.h"
#include "gnc-ui-util.h"
#include "Group.h"
#include "io-example-account.h"
#include "Account.h"
- #include "AccountP.h"
- #include <guile/gh.h>
static GtkWidget *newUserDialog = NULL;
static GtkWidget *cancelDialog = NULL;
--- 20,43 ----
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
! #include "config.h"
#include <gnome.h>
+ #include <guile/gh.h>
#include <stdio.h>
#include "new-user-callbacks.h"
#include "new-user-interface.h"
#include "new-user-funs.h"
#include "glade-support.h"
+ #include "gnc-amount-edit.h"
#include "gnc-currency-edit.h"
#include "gnc-ui-util.h"
#include "Group.h"
#include "io-example-account.h"
#include "Account.h"
static GtkWidget *newUserDialog = NULL;
static GtkWidget *cancelDialog = NULL;
***************
*** 51,58 ****
Account *ret;
ret = xaccCloneAccountSimple(from);
- ret->currency = com;
return ret;
}
--- 49,57 ----
Account *ret;
ret = xaccCloneAccountSimple(from);
+ xaccAccountSetCurrency (ret, com);
+
return ret;
}
***************
*** 72,77 ****
--- 71,84 ----
return cur_editor;
}
+ GNCAmountEdit *
+ gnc_new_user_get_balance_editor(void)
+ {
+ if (!newUserDialog) return NULL;
+
+ return gtk_object_get_data (GTK_OBJECT (newUserDialog), "balance_editor");
+ }
+
struct add_group_data_struct
{
AccountGroup *to;
***************
*** 152,158 ****
--- 159,249 ----
return GTK_CLIST(gnc_new_user_get_widget("newAccountTypesList"));
}
+ GtkCTree *
+ gnc_new_user_get_final_account_tree (void)
+ {
+ return GTK_CTREE(gnc_new_user_get_widget("finalAccountCTree"));
+ }
+
+ void
+ gnc_new_user_set_balance (Account *account, gnc_numeric in_balance)
+ {
+ GHashTable *hash;
+ gnc_numeric *balance;
+ char *fullname;
+
+ if (!account || !newUserDialog) return;
+
+ hash = gtk_object_get_data (GTK_OBJECT (newUserDialog), "balance_hash");
+ if (!hash) return;
+
+ fullname = xaccAccountGetFullName (account, ':');
+
+ balance = g_hash_table_lookup (hash, fullname);
+ if (balance)
+ {
+ *balance = in_balance;
+ g_free (fullname);
+ }
+ else
+ {
+ balance = g_new (gnc_numeric, 1);
+ *balance = in_balance;
+
+ g_hash_table_insert (hash, fullname, balance);
+ }
+ }
+
+ gnc_numeric
+ gnc_new_user_get_balance (Account *account)
+ {
+ GHashTable *hash;
+ gnc_numeric *balance;
+ char *fullname;
+
+ if (!account || !newUserDialog) return gnc_numeric_zero ();
+
+ hash = gtk_object_get_data (GTK_OBJECT (newUserDialog), "balance_hash");
+ if (!hash) return gnc_numeric_zero ();
+
+ fullname = xaccAccountGetFullName (account, ':');
+
+ balance = g_hash_table_lookup (hash, fullname);
+
+ g_free (fullname);
+
+ if (balance)
+ return *balance;
+
+ return gnc_numeric_zero ();
+ }
+
+ void
+ gnc_new_user_block_amount_changed (void)
+ {
+ GNCAmountEdit *balance_edit;
+
+ balance_edit = gnc_new_user_get_balance_editor ();
+ if (!balance_edit) return;
+
+ gtk_signal_handler_block_by_func
+ (GTK_OBJECT (balance_edit),
+ GTK_SIGNAL_FUNC(on_finalAccountBalanceEdit_changed), NULL);
+ }
+ void
+ gnc_new_user_unblock_amount_changed (void)
+ {
+ GNCAmountEdit *balance_edit;
+
+ balance_edit = gnc_new_user_get_balance_editor ();
+ if (!balance_edit) return;
+
+ gtk_signal_handler_unblock_by_func
+ (GTK_OBJECT (balance_edit),
+ GTK_SIGNAL_FUNC(on_finalAccountBalanceEdit_changed), NULL);
+ }
+
/***********************************************************************/
static int
createit(GtkWidget*(*creator)(), GtkWidget** placetoput)
***************
*** 179,188 ****
return 1;
}
int
gnc_ui_show_new_user_window(void)
{
! return createit(create_newUserDialog, &newUserDialog);
}
int
--- 270,336 ----
return 1;
}
+ static void
+ destroy_hash_helper (gpointer key, gpointer value, gpointer user_data)
+ {
+ char *fullname = key;
+ gnc_numeric *balance = value;
+
+ g_free (fullname);
+ g_free (balance);
+ }
+
+ static void
+ gnc_new_user_destroy_cb (GtkObject *obj, gpointer user_data)
+ {
+ GHashTable *hash;
+
+ hash = gtk_object_get_data (obj, "balance_hash");
+ if (hash)
+ {
+ g_hash_table_foreach (hash, destroy_hash_helper, NULL);
+ g_hash_table_destroy (hash);
+ gtk_object_set_data (obj, "balance_hash", NULL);
+ }
+ }
+
+ static GtkWidget *
+ gnc_create_newUserDialog (void)
+ {
+ GtkWidget *balance_edit;
+ GtkWidget *dialog;
+ GtkWidget *box;
+ GHashTable *hash;
+
+ dialog = create_newUserDialog();
+
+ balance_edit = gnc_amount_edit_new ();
+ gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (balance_edit), TRUE);
+ gtk_widget_show (balance_edit);
+
+ gtk_signal_connect (GTK_OBJECT (balance_edit), "amount_changed",
+ GTK_SIGNAL_FUNC(on_finalAccountBalanceEdit_changed),
+ NULL);
+
+ box = lookup_widget (dialog, "startBalanceBox");
+ gtk_box_pack_start (GTK_BOX (box), balance_edit, TRUE, TRUE, 0);
+
+ gtk_object_set_data (GTK_OBJECT(dialog), "balance_editor", balance_edit);
+
+ hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+ gtk_object_set_data (GTK_OBJECT(dialog), "balance_hash", hash);
+
+ gtk_signal_connect (GTK_OBJECT(dialog), "destroy",
+ GTK_SIGNAL_FUNC(gnc_new_user_destroy_cb), NULL);
+
+ return dialog;
+ }
+
int
gnc_ui_show_new_user_window(void)
{
! return createit(gnc_create_newUserDialog, &newUserDialog);
}
int
Index: gnucash/src/gnome/new-user-funs.h
diff -c gnucash/src/gnome/new-user-funs.h:1.3 gnucash/src/gnome/new-user-funs.h:1.4
*** gnucash/src/gnome/new-user-funs.h:1.3 Thu May 10 11:15:07 2001
--- gnucash/src/gnome/new-user-funs.h Sat May 12 06:50:33 2001
***************
*** 25,30 ****
--- 25,31 ----
#include <glib.h>
+ #include "gnc-amount-edit.h"
#include "gnc-commodity-edit.h"
#include "Group.h"
***************
*** 37,45 ****
--- 38,57 ----
int gnc_ui_show_nu_account_list(void);
int gnc_ui_delete_nu_account_list(void);
+ void gnc_new_user_set_balance (Account *account, gnc_numeric balance);
+ gnc_numeric gnc_new_user_get_balance (Account *account);
+
GtkCList* gnc_new_user_get_clist(void);
+ GtkCTree * gnc_new_user_get_final_account_tree (void);
GtkWidget* gnc_new_user_get_widget(const char *name);
AccountGroup* gnc_new_user_merge_groups(GSList *dalist);
GNCCommodityEdit * gnc_get_new_user_commodity_editor(void);
+ GNCAmountEdit * gnc_new_user_get_balance_editor(void);
+
+ void gnc_new_user_block_amount_changed (void);
+ void gnc_new_user_unblock_amount_changed (void);
+
+ /* private */
+ void on_finalAccountBalanceEdit_changed (GNCAmountEdit *gae);
#endif /* NEW_USER_FUNS_H */
Index: gnucash/src/gnome/new-user-interface.c
diff -c gnucash/src/gnome/new-user-interface.c:1.9 gnucash/src/gnome/new-user-interface.c:1.10
*** gnucash/src/gnome/new-user-interface.c:1.9 Thu May 10 11:15:07 2001
--- gnucash/src/gnome/new-user-interface.c Sat May 12 06:50:33 2001
***************
*** 45,52 ****
--- 45,54 ----
GtkWidget *newAccountTypesList_TypeLabel;
GtkWidget *newAccountTypesList_DescriptionLabel;
GtkWidget *hbox1;
+ GtkWidget *frame1;
GtkWidget *scrolledwindow2;
GtkWidget *newAccountTypesDescription;
+ GtkWidget *frame2;
GtkWidget *scrolledwindow3;
GtkWidget *viewport1;
GtkWidget *newAccountListTree;
***************
*** 66,74 ****
GtkWidget *checkAccountList_TypeLabel;
GtkWidget *checkAccountList_StartBalanceLabel;
GtkWidget *vbox5;
! GtkWidget *checkAccount_AccountLabel;
! GtkWidget *checkAccount_StartBalanceLabel;
! GtkWidget *checkAccount_StartBalanceEntry;
GtkWidget *newUserDruidFinishPage;
GdkColor newUserDruidFinishPage_bg_color = { 0, 6425, 6425, 28784 };
GdkColor newUserDruidFinishPage_textbox_color = { 0, 65535, 65535, 65535 };
--- 68,75 ----
GtkWidget *checkAccountList_TypeLabel;
GtkWidget *checkAccountList_StartBalanceLabel;
GtkWidget *vbox5;
! GtkWidget *frame3;
! GtkWidget *startBalanceBox;
GtkWidget *newUserDruidFinishPage;
GdkColor newUserDruidFinishPage_bg_color = { 0, 6425, 6425, 28784 };
GdkColor newUserDruidFinishPage_textbox_color = { 0, 65535, 65535, 65535 };
***************
*** 124,130 ****
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "newAccountCurrencyChooser_vbox2", newAccountCurrencyChooser_vbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (newAccountCurrencyChooser_vbox2);
! gtk_container_set_border_width (GTK_CONTAINER (newAccountCurrencyChooser_vbox2), 5);
newUserChooseCurrencyDescrip = gtk_label_new (_("Please choose the currency to use for new accounts."));
gtk_widget_set_name (newUserChooseCurrencyDescrip, "newUserChooseCurrencyDescrip");
--- 125,131 ----
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "newAccountCurrencyChooser_vbox2", newAccountCurrencyChooser_vbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (newAccountCurrencyChooser_vbox2);
! gtk_container_set_border_width (GTK_CONTAINER (newAccountCurrencyChooser_vbox2), 20);
newUserChooseCurrencyDescrip = gtk_label_new (_("Please choose the currency to use for new accounts."));
gtk_widget_set_name (newUserChooseCurrencyDescrip, "newUserChooseCurrencyDescrip");
***************
*** 206,212 ****
gtk_widget_show (newAccountTypesList_DescriptionLabel);
gtk_clist_set_column_widget (GTK_CLIST (newAccountTypesList), 1, newAccountTypesList_DescriptionLabel);
! hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox1, "hbox1");
gtk_widget_ref (hbox1);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "hbox1", hbox1,
--- 207,213 ----
gtk_widget_show (newAccountTypesList_DescriptionLabel);
gtk_clist_set_column_widget (GTK_CLIST (newAccountTypesList), 1, newAccountTypesList_DescriptionLabel);
! hbox1 = gtk_hbox_new (FALSE, 2);
gtk_widget_set_name (hbox1, "hbox1");
gtk_widget_ref (hbox1);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "hbox1", hbox1,
***************
*** 214,226 ****
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (druid_vbox1), hbox1, TRUE, TRUE, 0);
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow2, "scrolledwindow2");
gtk_widget_ref (scrolledwindow2);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "scrolledwindow2", scrolledwindow2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow2);
! gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow2, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
newAccountTypesDescription = gtk_text_new (NULL, NULL);
--- 215,235 ----
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (druid_vbox1), hbox1, TRUE, TRUE, 0);
+ frame1 = gtk_frame_new (_("Long Description"));
+ gtk_widget_set_name (frame1, "frame1");
+ gtk_widget_ref (frame1);
+ gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "frame1", frame1,
+ (GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_show (frame1);
+ gtk_box_pack_start (GTK_BOX (hbox1), frame1, TRUE, TRUE, 0);
+
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow2, "scrolledwindow2");
gtk_widget_ref (scrolledwindow2);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "scrolledwindow2", scrolledwindow2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow2);
! gtk_container_add (GTK_CONTAINER (frame1), scrolledwindow2);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
newAccountTypesDescription = gtk_text_new (NULL, NULL);
***************
*** 232,244 ****
gtk_container_add (GTK_CONTAINER (scrolledwindow2), newAccountTypesDescription);
GTK_WIDGET_UNSET_FLAGS (newAccountTypesDescription, GTK_CAN_FOCUS);
scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow3, "scrolledwindow3");
gtk_widget_ref (scrolledwindow3);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "scrolledwindow3", scrolledwindow3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow3);
! gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow3, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
viewport1 = gtk_viewport_new (NULL, NULL);
--- 241,261 ----
gtk_container_add (GTK_CONTAINER (scrolledwindow2), newAccountTypesDescription);
GTK_WIDGET_UNSET_FLAGS (newAccountTypesDescription, GTK_CAN_FOCUS);
+ frame2 = gtk_frame_new (_("Accounts"));
+ gtk_widget_set_name (frame2, "frame2");
+ gtk_widget_ref (frame2);
+ gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "frame2", frame2,
+ (GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_show (frame2);
+ gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 0);
+
scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow3, "scrolledwindow3");
gtk_widget_ref (scrolledwindow3);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "scrolledwindow3", scrolledwindow3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow3);
! gtk_container_add (GTK_CONTAINER (frame2), scrolledwindow3);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
viewport1 = gtk_viewport_new (NULL, NULL);
***************
*** 299,306 ****
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "druid_vbox3", druid_vbox3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (druid_vbox3);
! finalAccountLabel = gtk_label_new (_("If you would like the accounts to have a starting balance click on the account line and enter the starting balance in the text entry box on the right."));
gtk_widget_set_name (finalAccountLabel, "finalAccountLabel");
gtk_widget_ref (finalAccountLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "finalAccountLabel", finalAccountLabel,
--- 316,324 ----
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "druid_vbox3", druid_vbox3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (druid_vbox3);
+ gtk_container_set_border_width (GTK_CONTAINER (druid_vbox3), 5);
! finalAccountLabel = gtk_label_new (_("If you would like the accounts to have an opening balance click on the account line and enter the starting balance in the box on the right."));
gtk_widget_set_name (finalAccountLabel, "finalAccountLabel");
gtk_widget_ref (finalAccountLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "finalAccountLabel", finalAccountLabel,
***************
*** 309,318 ****
gtk_box_pack_start (GTK_BOX (druid_vbox3), finalAccountLabel, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (finalAccountLabel), GTK_JUSTIFY_FILL);
gtk_label_set_line_wrap (GTK_LABEL (finalAccountLabel), TRUE);
! gtk_misc_set_alignment (GTK_MISC (finalAccountLabel), 0.0800003, 0.08);
gtk_misc_set_padding (GTK_MISC (finalAccountLabel), 1, 1);
! hbox4 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox4, "hbox4");
gtk_widget_ref (hbox4);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "hbox4", hbox4,
--- 327,336 ----
gtk_box_pack_start (GTK_BOX (druid_vbox3), finalAccountLabel, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (finalAccountLabel), GTK_JUSTIFY_FILL);
gtk_label_set_line_wrap (GTK_LABEL (finalAccountLabel), TRUE);
! gtk_misc_set_alignment (GTK_MISC (finalAccountLabel), 0.0200003, 7.45058e-09);
gtk_misc_set_padding (GTK_MISC (finalAccountLabel), 1, 1);
! hbox4 = gtk_hbox_new (FALSE, 2);
gtk_widget_set_name (hbox4, "hbox4");
gtk_widget_ref (hbox4);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "hbox4", hbox4,
***************
*** 327,332 ****
--- 345,351 ----
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow4);
gtk_box_pack_start (GTK_BOX (hbox4), scrolledwindow4, TRUE, TRUE, 0);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
finalAccountCTree = gtk_ctree_new (3, 0);
gtk_widget_set_name (finalAccountCTree, "finalAccountCTree");
***************
*** 356,362 ****
gtk_widget_show (checkAccountList_TypeLabel);
gtk_clist_set_column_widget (GTK_CLIST (finalAccountCTree), 1, checkAccountList_TypeLabel);
! checkAccountList_StartBalanceLabel = gtk_label_new (_("Starting Balance"));
gtk_widget_set_name (checkAccountList_StartBalanceLabel, "checkAccountList_StartBalanceLabel");
gtk_widget_ref (checkAccountList_StartBalanceLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "checkAccountList_StartBalanceLabel", checkAccountList_StartBalanceLabel,
--- 375,381 ----
gtk_widget_show (checkAccountList_TypeLabel);
gtk_clist_set_column_widget (GTK_CLIST (finalAccountCTree), 1, checkAccountList_TypeLabel);
! checkAccountList_StartBalanceLabel = gtk_label_new (_("Opening Balance"));
gtk_widget_set_name (checkAccountList_StartBalanceLabel, "checkAccountList_StartBalanceLabel");
gtk_widget_ref (checkAccountList_StartBalanceLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "checkAccountList_StartBalanceLabel", checkAccountList_StartBalanceLabel,
***************
*** 372,400 ****
gtk_widget_show (vbox5);
gtk_box_pack_start (GTK_BOX (hbox4), vbox5, FALSE, TRUE, 0);
! checkAccount_AccountLabel = gtk_label_new (_("Account:"));
! gtk_widget_set_name (checkAccount_AccountLabel, "checkAccount_AccountLabel");
! gtk_widget_ref (checkAccount_AccountLabel);
! gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "checkAccount_AccountLabel", checkAccount_AccountLabel,
! (GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (checkAccount_AccountLabel);
! gtk_box_pack_start (GTK_BOX (vbox5), checkAccount_AccountLabel, FALSE, FALSE, 0);
!
! checkAccount_StartBalanceLabel = gtk_label_new (_("Enter Starting Balance"));
! gtk_widget_set_name (checkAccount_StartBalanceLabel, "checkAccount_StartBalanceLabel");
! gtk_widget_ref (checkAccount_StartBalanceLabel);
! gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "checkAccount_StartBalanceLabel", checkAccount_StartBalanceLabel,
! (GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (checkAccount_StartBalanceLabel);
! gtk_box_pack_start (GTK_BOX (vbox5), checkAccount_StartBalanceLabel, FALSE, FALSE, 0);
!
! checkAccount_StartBalanceEntry = gtk_entry_new_with_max_length (20);
! gtk_widget_set_name (checkAccount_StartBalanceEntry, "checkAccount_StartBalanceEntry");
! gtk_widget_ref (checkAccount_StartBalanceEntry);
! gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "checkAccount_StartBalanceEntry", checkAccount_StartBalanceEntry,
! (GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (checkAccount_StartBalanceEntry);
! gtk_box_pack_start (GTK_BOX (vbox5), checkAccount_StartBalanceEntry, FALSE, FALSE, 0);
newUserDruidFinishPage = gnome_druid_page_finish_new ();
gtk_widget_set_name (newUserDruidFinishPage, "newUserDruidFinishPage");
--- 391,412 ----
gtk_widget_show (vbox5);
gtk_box_pack_start (GTK_BOX (hbox4), vbox5, FALSE, TRUE, 0);
! frame3 = gtk_frame_new (_("Opening Balance"));
! gtk_widget_set_name (frame3, "frame3");
! gtk_widget_ref (frame3);
! gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "frame3", frame3,
! (GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (frame3);
! gtk_box_pack_start (GTK_BOX (vbox5), frame3, FALSE, FALSE, 0);
!
! startBalanceBox = gtk_vbox_new (FALSE, 0);
! gtk_widget_set_name (startBalanceBox, "startBalanceBox");
! gtk_widget_ref (startBalanceBox);
! gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "startBalanceBox", startBalanceBox,
! (GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (startBalanceBox);
! gtk_container_add (GTK_CONTAINER (frame3), startBalanceBox);
! gtk_container_set_border_width (GTK_CONTAINER (startBalanceBox), 3);
newUserDruidFinishPage = gnome_druid_page_finish_new ();
gtk_widget_set_name (newUserDruidFinishPage, "newUserDruidFinishPage");
***************
*** 431,436 ****
--- 443,451 ----
gtk_signal_connect (GTK_OBJECT (newAccountTypesList), "select_row",
GTK_SIGNAL_FUNC (on_newAccountTypesList_select_row),
NULL);
+ gtk_signal_connect (GTK_OBJECT (newAccountTypesList), "unselect_row",
+ GTK_SIGNAL_FUNC (on_newAccountTypesList_unselect_row),
+ NULL);
gtk_signal_connect (GTK_OBJECT (newAccountsTypeList_SelectAllButton), "clicked",
GTK_SIGNAL_FUNC (on_newAccountsTypeList_SelectAllButton_clicked),
NULL);
***************
*** 439,447 ****
NULL);
gtk_signal_connect (GTK_OBJECT (finalAccountDruidPage), "prepare",
GTK_SIGNAL_FUNC (on_finalAccountDruidPage_prepare),
NULL);
! gtk_signal_connect (GTK_OBJECT (finalAccountCTree), "select_row",
! GTK_SIGNAL_FUNC (on_finalAccountCTree_select_row),
NULL);
gtk_signal_connect (GTK_OBJECT (newUserDruidFinishPage), "finish",
GTK_SIGNAL_FUNC (on_newUserDruidFinishPage_finish),
--- 454,468 ----
NULL);
gtk_signal_connect (GTK_OBJECT (finalAccountDruidPage), "prepare",
GTK_SIGNAL_FUNC (on_finalAccountDruidPage_prepare),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (finalAccountDruidPage), "next",
+ GTK_SIGNAL_FUNC (on_finalAccountDruidPage_next),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (finalAccountCTree), "tree_select_row",
+ GTK_SIGNAL_FUNC (on_finalAccountCTree_tree_select_row),
NULL);
! gtk_signal_connect (GTK_OBJECT (finalAccountCTree), "tree_unselect_row",
! GTK_SIGNAL_FUNC (on_finalAccountCTree_tree_unselect_row),
NULL);
gtk_signal_connect (GTK_OBJECT (newUserDruidFinishPage), "finish",
GTK_SIGNAL_FUNC (on_newUserDruidFinishPage_finish),
Index: gnucash/src/gnome/new-user.glade
diff -c gnucash/src/gnome/new-user.glade:1.9 gnucash/src/gnome/new-user.glade:1.10
*** gnucash/src/gnome/new-user.glade:1.9 Thu May 10 11:15:08 2001
--- gnucash/src/gnome/new-user.glade Sat May 12 06:50:33 2001
***************
*** 85,91 ****
<class>GtkVBox</class>
<child_name>GnomeDruidPageStandard:vbox</child_name>
<name>newAccountCurrencyChooser_vbox2</name>
! <border_width>5</border_width>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<child>
--- 85,91 ----
<class>GtkVBox</class>
<child_name>GnomeDruidPageStandard:vbox</child_name>
<name>newAccountCurrencyChooser_vbox2</name>
! <border_width>20</border_width>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<child>
***************
*** 199,204 ****
--- 199,209 ----
<handler>on_newAccountTypesList_select_row</handler>
<last_modification_time>Thu, 12 Apr 2001 22:01:16 GMT</last_modification_time>
</signal>
+ <signal>
+ <name>unselect_row</name>
+ <handler>on_newAccountTypesList_unselect_row</handler>
+ <last_modification_time>Sat, 12 May 2001 09:23:47 GMT</last_modification_time>
+ </signal>
<columns>2</columns>
<column_widths>144,80</column_widths>
<selection_mode>GTK_SELECTION_MULTIPLE</selection_mode>
***************
*** 237,243 ****
<class>GtkHBox</class>
<name>hbox1</name>
<homogeneous>False</homogeneous>
! <spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
--- 242,248 ----
<class>GtkHBox</class>
<name>hbox1</name>
<homogeneous>False</homogeneous>
! <spacing>2</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
***************
*** 245,256 ****
</child>
<widget>
! <class>GtkScrolledWindow</class>
! <name>scrolledwindow2</name>
! <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
! <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
! <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
! <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
--- 250,260 ----
</child>
<widget>
! <class>GtkFrame</class>
! <name>frame1</name>
! <label>Long Description</label>
! <label_xalign>0</label_xalign>
! <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
***************
*** 258,277 ****
</child>
<widget>
! <class>GtkText</class>
! <name>newAccountTypesDescription</name>
! <editable>False</editable>
! <text></text>
</widget>
</widget>
<widget>
! <class>GtkScrolledWindow</class>
! <name>scrolledwindow3</name>
! <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
! <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
! <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
! <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
--- 262,289 ----
</child>
<widget>
! <class>GtkScrolledWindow</class>
! <name>scrolledwindow2</name>
! <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
! <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
! <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
! <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
!
! <widget>
! <class>GtkText</class>
! <name>newAccountTypesDescription</name>
! <editable>False</editable>
! <text></text>
! </widget>
</widget>
</widget>
<widget>
! <class>GtkFrame</class>
! <name>frame2</name>
! <label>Accounts</label>
! <label_xalign>0</label_xalign>
! <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
***************
*** 279,294 ****
</child>
<widget>
! <class>GtkViewport</class>
! <name>viewport1</name>
! <shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
! <class>GtkTree</class>
! <name>newAccountListTree</name>
! <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
! <view_mode>GTK_TREE_VIEW_LINE</view_mode>
! <view_line>True</view_line>
</widget>
</widget>
</widget>
--- 291,315 ----
</child>
<widget>
! <class>GtkScrolledWindow</class>
! <name>scrolledwindow3</name>
! <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
! <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
! <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
! <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget>
! <class>GtkViewport</class>
! <name>viewport1</name>
! <shadow_type>GTK_SHADOW_IN</shadow_type>
!
! <widget>
! <class>GtkTree</class>
! <name>newAccountListTree</name>
! <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
! <view_mode>GTK_TREE_VIEW_LINE</view_mode>
! <view_line>True</view_line>
! </widget>
</widget>
</widget>
</widget>
***************
*** 352,357 ****
--- 373,383 ----
<handler>on_finalAccountDruidPage_prepare</handler>
<last_modification_time>Thu, 12 Apr 2001 22:49:49 GMT</last_modification_time>
</signal>
+ <signal>
+ <name>next</name>
+ <handler>on_finalAccountDruidPage_next</handler>
+ <last_modification_time>Sat, 12 May 2001 10:43:19 GMT</last_modification_time>
+ </signal>
<title>Check and Enter Final Account Info</title>
<title_color>255,255,255</title_color>
<background_color>25,25,112</background_color>
***************
*** 361,366 ****
--- 387,393 ----
<class>GtkVBox</class>
<child_name>GnomeDruidPageStandard:vbox</child_name>
<name>druid-vbox3</name>
+ <border_width>5</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
***************
*** 372,382 ****
<widget>
<class>GtkLabel</class>
<name>finalAccountLabel</name>
! <label>If you would like the accounts to have a starting balance click on the account line and enter the starting balance in the text entry box on the right.</label>
<justify>GTK_JUSTIFY_FILL</justify>
<wrap>True</wrap>
! <xalign>0.0800003</xalign>
! <yalign>0.08</yalign>
<xpad>1</xpad>
<ypad>1</ypad>
<child>
--- 399,409 ----
<widget>
<class>GtkLabel</class>
<name>finalAccountLabel</name>
! <label>If you would like the accounts to have an opening balance click on the account line and enter the starting balance in the box on the right.</label>
<justify>GTK_JUSTIFY_FILL</justify>
<wrap>True</wrap>
! <xalign>0.0200003</xalign>
! <yalign>7.45058e-09</yalign>
<xpad>1</xpad>
<ypad>1</ypad>
<child>
***************
*** 390,396 ****
<class>GtkHBox</class>
<name>hbox4</name>
<homogeneous>False</homogeneous>
! <spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
--- 417,423 ----
<class>GtkHBox</class>
<name>hbox4</name>
<homogeneous>False</homogeneous>
! <spacing>2</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
***************
*** 400,406 ****
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow4</name>
! <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
--- 427,433 ----
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow4</name>
! <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
***************
*** 415,424 ****
<name>finalAccountCTree</name>
<can_focus>True</can_focus>
<signal>
! <name>select_row</name>
! <handler>on_finalAccountCTree_select_row</handler>
! <last_modification_time>Thu, 19 Apr 2001 17:26:51 GMT</last_modification_time>
</signal>
<columns>3</columns>
<column_widths>285,118,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
--- 442,456 ----
<name>finalAccountCTree</name>
<can_focus>True</can_focus>
<signal>
! <name>tree_select_row</name>
! <handler>on_finalAccountCTree_tree_select_row</handler>
! <last_modification_time>Sat, 12 May 2001 09:28:43 GMT</last_modification_time>
</signal>
+ <signal>
+ <name>tree_unselect_row</name>
+ <handler>on_finalAccountCTree_tree_unselect_row</handler>
+ <last_modification_time>Sat, 12 May 2001 09:42:20 GMT</last_modification_time>
+ </signal>
<columns>3</columns>
<column_widths>285,118,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
***************
*** 455,461 ****
<class>GtkLabel</class>
<child_name>CTree:title</child_name>
<name>checkAccountList_StartBalanceLabel</name>
! <label>Starting Balance</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
--- 487,493 ----
<class>GtkLabel</class>
<child_name>CTree:title</child_name>
<name>checkAccountList_StartBalanceLabel</name>
! <label>Opening Balance</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
***************
*** 478,529 ****
</child>
<widget>
! <class>GtkLabel</class>
! <name>checkAccount_AccountLabel</name>
! <label>Account:</label>
! <justify>GTK_JUSTIFY_CENTER</justify>
! <wrap>False</wrap>
! <xalign>0.5</xalign>
! <yalign>0.5</yalign>
! <xpad>0</xpad>
! <ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
- </widget>
! <widget>
! <class>GtkLabel</class>
! <name>checkAccount_StartBalanceLabel</name>
! <label>Enter Starting Balance</label>
! <justify>GTK_JUSTIFY_CENTER</justify>
! <wrap>False</wrap>
! <xalign>0.5</xalign>
! <yalign>0.5</yalign>
! <xpad>0</xpad>
! <ypad>0</ypad>
! <child>
! <padding>0</padding>
! <expand>False</expand>
! <fill>False</fill>
! </child>
</widget>
<widget>
! <class>GtkEntry</class>
! <name>checkAccount_StartBalanceEntry</name>
! <can_focus>True</can_focus>
! <editable>True</editable>
! <text_visible>True</text_visible>
! <text_max_length>20</text_max_length>
! <text></text>
! <child>
! <padding>0</padding>
! <expand>False</expand>
! <fill>False</fill>
! </child>
</widget>
</widget>
</widget>
--- 510,541 ----
</child>
<widget>
! <class>GtkFrame</class>
! <name>frame3</name>
! <label>Opening Balance</label>
! <label_xalign>0</label_xalign>
! <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
! <widget>
! <class>GtkVBox</class>
! <name>startBalanceBox</name>
! <border_width>3</border_width>
! <homogeneous>False</homogeneous>
! <spacing>0</spacing>
!
! <widget>
! <class>Placeholder</class>
! </widget>
! </widget>
</widget>
<widget>
! <class>Placeholder</class>
</widget>
</widget>
</widget>
Index: gnucash/src/gnome/window-main.c
diff -c gnucash/src/gnome/window-main.c:1.122 gnucash/src/gnome/window-main.c:1.123
*** gnucash/src/gnome/window-main.c:1.122 Thu May 10 17:30:39 2001
--- gnucash/src/gnome/window-main.c Sat May 12 07:47:30 2001
***************
*** 70,78 ****
* Shut down the Gnucash ui windows
********************************************************************/
! static void
gnc_main_window_destroy_cb(GtkObject * w) {
gnc_shutdown (0);
}
--- 70,79 ----
* Shut down the Gnucash ui windows
********************************************************************/
! static int
gnc_main_window_destroy_cb(GtkObject * w) {
gnc_shutdown (0);
+ return TRUE;
}
***************
*** 89,110 ****
GtkWidget *toolbar;
GList * child;
! toolbar = gtk_object_get_user_data (GTK_OBJECT (app));
! if (toolbar)
! gtk_widget_unref (toolbar);
! gtk_object_set_user_data (GTK_OBJECT (app), NULL);
!
! for(child = mainwin->children; child; child = child->next) {
! mc = child->data;
! if(mc && mc->toolbar && mc->app && (mc->app == app)) {
! /* we need to pull the toolbar out to prevent its being
! * destroyed */
! gtk_widget_ref(mc->toolbar);
! gtk_container_remove(GTK_CONTAINER(mc->toolbar->parent), mc->toolbar);
}
}
}
/********************************************************************
* gnc_main_window_app_created_cb()
* called when a new top-level GnomeApp is created.
--- 90,117 ----
GtkWidget *toolbar;
GList * child;
! if(g_list_length(mdi->windows) == 0) {
! gnc_shutdown(0);
! }
! else {
! toolbar = gtk_object_get_user_data (GTK_OBJECT (app));
! if (toolbar)
! gtk_widget_unref (toolbar);
! gtk_object_set_user_data (GTK_OBJECT (app), NULL);
!
! for(child = mainwin->children; child; child = child->next) {
! mc = child->data;
! if(mc && mc->toolbar && mc->app && (mc->app == app)) {
! /* we need to pull the toolbar out to prevent its being
! * destroyed */
! gtk_widget_ref(mc->toolbar);
! gtk_container_remove(GTK_CONTAINER(mc->toolbar->parent), mc->toolbar);
! }
}
}
}
+
/********************************************************************
* gnc_main_window_app_created_cb()
* called when a new top-level GnomeApp is created.
***************
*** 141,155 ****
item = gnome_dock_item_new("Summary Bar", behavior);
gtk_container_add( GTK_CONTAINER (item), summarybar );
! if (app->layout)
! {
gnome_dock_layout_add_item( app->layout,
GNOME_DOCK_ITEM(item),
GNOME_DOCK_TOP,
2, 0, 0 );
}
! else
! {
gnome_dock_add_item( GNOME_DOCK(app->dock),
GNOME_DOCK_ITEM(item),
GNOME_DOCK_TOP,
--- 148,160 ----
item = gnome_dock_item_new("Summary Bar", behavior);
gtk_container_add( GTK_CONTAINER (item), summarybar );
! if (app->layout) {
gnome_dock_layout_add_item( app->layout,
GNOME_DOCK_ITEM(item),
GNOME_DOCK_TOP,
2, 0, 0 );
}
! else {
gnome_dock_add_item( GNOME_DOCK(app->dock),
GNOME_DOCK_ITEM(item),
GNOME_DOCK_TOP,
Index: gnucash/src/gnome/window-report.c
diff -c gnucash/src/gnome/window-report.c:1.44 gnucash/src/gnome/window-report.c:1.45
*** gnucash/src/gnome/window-report.c:1.44 Thu May 10 17:30:40 2001
--- gnucash/src/gnome/window-report.c Sat May 12 07:47:31 2001
***************
*** 353,358 ****
--- 353,361 ----
if(gh_call1(start_editor, report->cur_report) == SCM_BOOL_F) {
gnc_warning_dialog("There are no options for this report.");
}
+ else {
+ gnc_report_window_add_edited_report(report, report->cur_report);
+ }
}
return TRUE;
}
***************
*** 433,442 ****
--- 436,457 ----
SCM inst_options;
SCM inst_options_ed;
+ /* we get this callback if a new report is requested to be loaded OR
+ * if any URL is clicked. If an options URL is clicked, we want to
+ * know about it */
if((type == URL_TYPE_REPORT) && location && (strlen(location) > 3) &&
!strncmp("id=", location, 3)) {
sscanf(location+3, "%d", &report_id);
}
+ else if((type == URL_TYPE_OPTIONS) && location && (strlen(location) > 10) &&
+ !strncmp("report-id=", location, 10)) {
+ sscanf(location+10, "%d", &report_id);
+ inst_report = gh_call1(find_report, gh_int2scm(report_id));
+ if(inst_report != SCM_BOOL_F) {
+ gnc_report_window_add_edited_report(win, inst_report);
+ }
+ return;
+ }
else {
return;
}
***************
*** 768,775 ****
}
void
! gnc_print_report (int report_id)
! {
gnc_html *html;
char * location;
--- 783,789 ----
}
void
! gnc_print_report (int report_id) {
gnc_html *html;
char * location;
***************
*** 833,839 ****
GtkWidget *
gnc_report_window_default_params_editor(SCM options, SCM report) {
SCM get_editor = gh_eval_str("gnc:report-editor-widget");
- SCM set_editor = gh_eval_str("gnc:report-set-editor-widget!");
SCM ptr;
SCM new_edited;
--- 847,852 ----
***************
*** 867,873 ****
gnc_options_dialog_set_close_cb(prm->win,
gnc_options_dialog_close_cb,
(gpointer)prm);
-
return gnc_options_dialog_widget(prm->win);
}
}
--- 880,885 ----
Index: gnucash/src/scm/commodity-utilities.scm
diff -c gnucash/src/scm/commodity-utilities.scm:1.14 gnucash/src/scm/commodity-utilities.scm:1.16
*** gnucash/src/scm/commodity-utilities.scm:1.14 Thu May 10 02:07:46 2001
--- gnucash/src/scm/commodity-utilities.scm Sat May 12 03:40:57 2001
***************
*** 76,81 ****
--- 76,94 ----
(gnc:free-query query)
splits))
+ ;; Returns a sorted list of all splits in the 'currency-accounts' up
+ ;; to 'end-date-tp' which have the 'commodity' and one other commodity
+ ;; involved. The splits are sorted by date.
+ (define (gnc:get-match-commodity-splits-sorted
+ currency-accounts end-date-tp commodity)
+ (sort (gnc:get-match-commodity-splits currency-accounts
+ end-date-tp commodity)
+ (lambda (a b)
+ (gnc:timepair-lt
+ (gnc:transaction-get-date-posted (gnc:split-get-parent a))
+ (gnc:transaction-get-date-posted (gnc:split-get-parent b))))))
+
+
;; Returns a list of all splits in the currency-accounts up to
;; end-date which have two *different* commodities involved.
(define (gnc:get-all-commodity-splits
***************
*** 86,94 ****
;; Create a list of all prices of 'price-commodity' measured in the
;; currency 'report-currency'. The prices are taken from all splits in
;; 'currency-accounts' up until the date 'end-date-tp'. Returns a list
! ;; of lists. Each element-list looks like (time price), where 'time'
! ;; is the timepair when the 'price' was valid.
! (define (gnc:get-commodity-totalaverage-prices
currency-accounts end-date-tp price-commodity report-currency)
(let ((total-foreign (gnc:numeric-zero))
(total-domestic (gnc:numeric-zero)))
--- 99,107 ----
;; Create a list of all prices of 'price-commodity' measured in the
;; currency 'report-currency'. The prices are taken from all splits in
;; 'currency-accounts' up until the date 'end-date-tp'. Returns a list
! ;; of lists. Each listelement looks like the list (time price), where
! ;; 'time' is the timepair when the <gnc:numeric*> 'price' was valid.
! (define (gnc:get-commodity-totalavg-prices
currency-accounts end-date-tp price-commodity report-currency)
(let ((total-foreign (gnc:numeric-zero))
(total-domestic (gnc:numeric-zero)))
***************
*** 112,130 ****
(list transaction-comm
value-amount share-amount))))
! ; (warn "render-scatterplot: value "
! ; (commodity-numeric->string
! ; (first foreignlist) (second foreignlist))
! ; " bought shares "
! ; (commodity-numeric->string
! ; price-commodity (third foreignlist)))
(list
transaction-date
(if (not (gnc:commodity-equiv? (first foreignlist)
report-currency))
(begin
! (warn "totalaverage-prices: "
"Sorry, currency exchange not yet implemented:"
(commodity-numeric->string
(first foreignlist) (second foreignlist))
--- 125,143 ----
(list transaction-comm
value-amount share-amount))))
! ;; (warn "gnc:get-commodity-totalavg-prices: value "
! ;; (commodity-numeric->string
! ;; (first foreignlist) (second foreignlist))
! ;; " bought shares "
! ;; (commodity-numeric->string
! ;; price-commodity (third foreignlist)))
(list
transaction-date
(if (not (gnc:commodity-equiv? (first foreignlist)
report-currency))
(begin
! (warn "gnc:get-commodity-totalavg-prices: "
"Sorry, currency exchange not yet implemented:"
(commodity-numeric->string
(first foreignlist) (second foreignlist))
***************
*** 147,170 ****
(logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND)))))))
;; Get all the interesting splits, and sort them according to the
;; date.
! (sort
! (gnc:get-match-commodity-splits
! currency-accounts
! end-date-tp price-commodity)
! (lambda (a b)
! (gnc:timepair-lt
! (gnc:transaction-get-date-posted
! (gnc:split-get-parent a))
! (gnc:transaction-get-date-posted
! (gnc:split-get-parent b)))))
! )))
!
! ;; Go through all toplevel non-report-commodity balances in sumlist
! ;; and add them to report-commodity, if possible. This function takes
! ;; a sumlist (described below) and returns an alist similar to one
! ;; value of the sumlist's alist, e.g. (cadr (assoc report-commodity
! ;; sumlist))). This resulting alist can immediately be plugged into
! ;; gnc:make-exchange-alist.
(define (gnc:resolve-unknown-comm sumlist report-commodity)
;; reportlist contains all known transactions with the
;; report-commodity, and now the transactions with unknown
--- 160,265 ----
(logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND)))))))
;; Get all the interesting splits, and sort them according to the
;; date.
! (gnc:get-match-commodity-splits-sorted
! currency-accounts
! end-date-tp price-commodity))))
!
! ;; Create a list of prices for all commodities in 'commodity-list',
! ;; i.e. the same thing as in get-commodity-totalavg-prices but
! ;; extended to a commodity-list. Returns an alist. Each pair consists
! ;; of the foreign-currency and the appropriate list from
! ;; gnc:get-commodity-totalavg-prices, see there.
! (define (gnc:get-commoditylist-totalavg-prices
! currency-accounts end-date-tp commodity-list report-currency)
! (map
! (lambda (c)
! (cons c
! (gnc:get-commodity-totalavg-prices
! currency-accounts end-date-tp c report-currency)))
! commodity-list))
!
! ;; Get the instantaneous prices for the 'price-commodity', measured in
! ;; amounts of the 'report-currency'. The prices are taken from all
! ;; splits in 'currency-accounts' up until the date
! ;; 'end-date-tp'. Returns a list of lists. Each listelement looks like
! ;; the list (time price), where 'time' is the timepair when the
! ;; <gnc:numeric*> 'price' was valid.
! (define (gnc:get-commodity-inst-prices
! currency-accounts end-date-tp price-commodity report-currency)
! ;; go through all splits; convert all splits into a price.
! (map-in-order
! (lambda (a)
! (let* ((transaction-comm (gnc:transaction-get-commodity
! (gnc:split-get-parent a)))
! (account-comm (gnc:account-get-commodity
! (gnc:split-get-account a)))
! (share-amount (gnc:numeric-abs
! (gnc:split-get-share-amount a)))
! (value-amount (gnc:numeric-abs
! (gnc:split-get-value a)))
! (transaction-date (gnc:transaction-get-date-posted
! (gnc:split-get-parent a)))
! (foreignlist
! (if (gnc:commodity-equiv? transaction-comm price-commodity)
! (list account-comm
! share-amount value-amount)
! (list transaction-comm
! value-amount share-amount))))
!
! ;;(warn "get-commodity-inst-prices: value "
! ;; (commodity-numeric->string
! ;; (first foreignlist) (second foreignlist))
! ;; " bought shares "
! ;;(commodity-numeric->string
! ;; price-commodity (third foreignlist)))
!
! (list
! transaction-date
! (if (not (gnc:commodity-equiv? (first foreignlist)
! report-currency))
! (begin
! (warn "get-commodity-inst-prices: "
! "Sorry, currency exchange not yet implemented:"
! (commodity-numeric->string
! (first foreignlist) (second foreignlist))
! " (buying "
! (commodity-numeric->string
! price-commodity (third foreignlist))
! ") =? "
! (commodity-numeric->string
! report-currency (gnc:numeric-zero)))
! (gnc:numeric-zero))
! (gnc:numeric-div
! (second foreignlist)
! (third foreignlist)
! GNC-DENOM-AUTO
! (logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND))))))
! ;; Get all the interesting splits, sorted by date.
! (gnc:get-match-commodity-splits-sorted
! currency-accounts
! end-date-tp price-commodity)))
!
! ;; Get the instantaneous prices for all commodities in
! ;; 'commodity-list', i.e. the same thing as get-commodity-inst-prices
! ;; but extended to a commodity-list. Returns an alist. Each pair
! ;; consists of the foreign-currency and the appropriate list from
! ;; gnc:get-commodity-inst-prices, see there.
! (define (gnc:get-commoditylist-inst-prices
! currency-accounts end-date-tp commodity-list report-currency)
! (map
! (lambda (c)
! (cons c
! (gnc:get-commodity-inst-prices
! currency-accounts end-date-tp c report-currency)))
! commodity-list))
!
!
! ;; Go through all toplevel non-'report-commodity' balances in
! ;; 'sumlist' and add them to 'report-commodity', if possible. This
! ;; function takes a sumlist (described in gnc:get-exchange-totals) and
! ;; returns an alist similar to one value of the sumlist's alist,
! ;; e.g. (cadr (assoc report-commodity sumlist))). This resulting alist
! ;; can immediately be plugged into gnc:make-exchange-alist.
(define (gnc:resolve-unknown-comm sumlist report-commodity)
;; reportlist contains all known transactions with the
;; report-commodity, and now the transactions with unknown
***************
*** 447,452 ****
--- 542,563 ----
(gnc:gnc-monetary-commodity foreign)
domestic date))
#f))
+
+ ;; Return a ready-to-use function. Which one is determined by the
+ ;; value of 'source-option', whose possible values are set in
+ ;; gnc:options-add-price-source!.
+ (define (gnc:case-exchange-fn
+ source-option report-currency to-date-tp)
+ (case source-option
+ ('weighted-average (gnc:make-exchange-function
+ (gnc:make-exchange-alist
+ report-currency to-date-tp)))
+ ('pricedb-latest gnc:exchange-by-pricedb-latest)
+ ('pricedb-nearest (lambda (foreign domestic)
+ (gnc:exchange-by-pricedb-nearest
+ foreign domestic to-date-tp)))
+ (else (gnc:warn "gnc:case-exchange-gn: bad price-source value"))))
+
;; Adds all different commodities in the commodity-collector <foreign>
Index: gnucash/src/scm/date-utilities.scm
diff -c gnucash/src/scm/date-utilities.scm:1.34 gnucash/src/scm/date-utilities.scm:1.35
*** gnucash/src/scm/date-utilities.scm:1.34 Sat May 5 14:28:32 2001
--- gnucash/src/scm/date-utilities.scm Sat May 12 03:40:57 2001
***************
*** 467,472 ****
--- 467,493 ----
(set-tm:isdst now -1)
(gnc:date->timepair now)))))
+ (define (gnc:get-end-cur-fin-year)
+ (let ((now (localtime (current-time))))
+ (if (< (tm:mon now) 6)
+ (begin
+ (set-tm:sec now 59)
+ (set-tm:min now 59)
+ (set-tm:hour now 23)
+ (set-tm:mday now 30)
+ (set-tm:mon now 5)
+ (set-tm:isdst now -1)
+ (gnc:date->timepair now))
+ (begin
+ (set-tm:sec now 59)
+ (set-tm:min now 59)
+ (set-tm:hour now 23)
+ (set-tm:mday now 30)
+ (set-tm:mon now 5)
+ (set-tm:year now (+ (tm:year now) 1))
+ (set-tm:isdst now -1)
+ (gnc:date->timepair now)))))
+
(define (gnc:get-start-this-month)
(let ((now (localtime (current-time))))
(set-tm:sec now 0)
***************
*** 686,691 ****
--- 707,719 ----
(N_ "End of the previous Financial year/Accounting Period"))
(gnc:reldate-string-db
+ 'store 'end-cur-fin-year-string
+ (N_ "End Current Financial Year"))
+ (gnc:reldate-string-db
+ 'store 'end-cur-fin-year-desc
+ (N_ "End of the current Financial year/Accounting Period"))
+
+ (gnc:reldate-string-db
'store 'start-this-month-string
(N_ "Start of this month"))
(gnc:reldate-string-db
***************
*** 806,811 ****
--- 834,843 ----
(gnc:reldate-string-db 'lookup 'end-prev-fin-year-string)
(gnc:reldate-string-db 'lookup 'end-prev-fin-year-desc)
gnc:get-end-prev-fin-year)
+ (vector 'end-cur-fin-year
+ (gnc:reldate-string-db 'lookup 'end-cur-fin-year-string)
+ (gnc:reldate-string-db 'lookup 'end-cur-fin-year-desc)
+ gnc:get-end-cur-fin-year)
(vector 'start-this-month
(gnc:reldate-string-db 'lookup 'start-this-month-string)
(gnc:reldate-string-db 'lookup 'start-this-month-desc)
Index: gnucash/src/scm/html-scatter.scm
diff -c gnucash/src/scm/html-scatter.scm:1.1 gnucash/src/scm/html-scatter.scm:1.2
*** gnucash/src/scm/html-scatter.scm:1.1 Thu May 3 03:47:24 2001
--- gnucash/src/scm/html-scatter.scm Sat May 12 02:44:21 2001
***************
*** 163,169 ****
(y-label (gnc:html-scatter-y-axis-label scatter))
(data (gnc:html-scatter-data scatter))
(marker (gnc:html-scatter-marker scatter))
! (markercolor (gnc:html-scatter-markercolor scatter)))
(if (and (list? data)
(not (null? data)))
(begin
--- 163,172 ----
(y-label (gnc:html-scatter-y-axis-label scatter))
(data (gnc:html-scatter-data scatter))
(marker (gnc:html-scatter-marker scatter))
! ;; Workaround to set the alpha channel, since libguppitank
! ;; requires a rgba value here.
! (markercolor (string-append (gnc:html-scatter-markercolor scatter)
! "ff")))
(if (and (list? data)
(not (null? data)))
(begin
Index: gnucash/src/scm/html-utilities.scm
diff -c gnucash/src/scm/html-utilities.scm:1.37 gnucash/src/scm/html-utilities.scm:1.38
*** gnucash/src/scm/html-utilities.scm:1.37 Thu May 10 17:30:42 2001
--- gnucash/src/scm/html-utilities.scm Sat May 12 02:44:21 2001
***************
*** 601,619 ****
table))
! ;; Returns a html-object which is a table of all exchange rates.
! ;; Where the report's commodity is common-commodity.
(define (gnc:html-make-exchangerates
common-commodity exchange-fn accounts)
! (let ((comm-list (delete
! common-commodity
! (delete-duplicates
! (sort (map gnc:account-get-commodity accounts)
! (lambda (a b)
! (string<? (gnc:commodity-get-mnemonic a)
! (gnc:commodity-get-mnemonic b)))))))
(table (gnc:make-html-table)))
!
(if (not (null? comm-list))
;; Do something with each exchange rate.
(begin
--- 601,616 ----
table))
! ;; Create a html-table of all exchange rates. The report-commodity is
! ;; 'common-commodity', the exchange rates are given through the
! ;; function 'exchange-fn' and the 'accounts' determine which
! ;; commodities to show. Returns a html-object, a <html-table>.
(define (gnc:html-make-exchangerates
common-commodity exchange-fn accounts)
! (let ((comm-list
! (gnc:accounts-get-commodities accounts common-commodity))
(table (gnc:make-html-table)))
!
(if (not (null? comm-list))
;; Do something with each exchange rate.
(begin
Index: gnucash/src/scm/main-window.scm
diff -c gnucash/src/scm/main-window.scm:1.6 gnucash/src/scm/main-window.scm:1.8
*** gnucash/src/scm/main-window.scm:1.6 Thu May 10 17:55:07 2001
--- gnucash/src/scm/main-window.scm Sat May 12 01:31:40 2001
***************
*** 108,114 ****
(simple-format
#f " (hash-set! gnc:*acct-tree-options* ~A options)\n" id)
(simple-format
! #f " \"gnc-acct-tree:id=~S\")" id)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--- 108,114 ----
(simple-format
#f " (hash-set! gnc:*acct-tree-options* ~A options)\n" id)
(simple-format
! #f " \"gnc-acct-tree:id=~S\")\n\n" id)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
***************
*** 120,128 ****
(define (gnc:main-window-book-close-handler book-url)
(let* ((conf-file-name (gnc:html-encode-string book-url))
! (file-dir (build-path (getenv "HOME") ".gnucash" "books"))
(book-path #f))
! ;; make sure the books directory is there
(if (not (access? file-dir X_OK)) (mkdir file-dir #o700))
(if conf-file-name
--- 120,134 ----
(define (gnc:main-window-book-close-handler book-url)
(let* ((conf-file-name (gnc:html-encode-string book-url))
! (dotgnucash-dir (build-path (getenv "HOME") ".gnucash"))
! (file-dir (build-path dotgnucash-dir "books"))
(book-path #f))
!
! ;; make sure ~/.gnucash is there
! (if (not (access? dotgnucash-dir X_OK)) (mkdir dotgnucash-dir #o700))
!
! ;; make sure the books directory is there
!
(if (not (access? file-dir X_OK)) (mkdir file-dir #o700))
(if conf-file-name
***************
*** 140,147 ****
(hash-fold
(lambda (k v p)
(display (gnc:acct-tree-generate-restore-forms v k)) #t)
! #t gnc:*acct-tree-options*)))))
! (gnc:main-window-save (gnc:get-ui-data) book-url)
(let ((dead-reports '()))
;; get a list of the reports we'll be needing to nuke
--- 146,155 ----
(hash-fold
(lambda (k v p)
(display (gnc:acct-tree-generate-restore-forms v k)) #t)
! #t gnc:*acct-tree-options*)
!
! (force-output)))
! (gnc:main-window-save (gnc:get-ui-data) book-url)))
(let ((dead-reports '()))
;; get a list of the reports we'll be needing to nuke
Index: gnucash/src/scm/options-utilities.scm
diff -c gnucash/src/scm/options-utilities.scm:1.11 gnucash/src/scm/options-utilities.scm:1.12
*** gnucash/src/scm/options-utilities.scm:1.11 Tue May 8 21:21:05 2001
--- gnucash/src/scm/options-utilities.scm Sat May 12 03:40:58 2001
***************
*** 37,51 ****
pagename optname
sort-tag (N_ "Select a date to report on")
(lambda ()
- ; (cons 'absolute
- ; (gnc:secs->timepair
- ; (car (mktime (localtime (current-time)))))))
(cons 'relative 'today))
#f 'both
! '(end-cal-year end-current-quarter end-this-month
! today end-prev-month end-prev-quarter
! end-prev-year ;;end-prev-fin-year
! ))))
;; This is a date-interval for a report.
--- 37,55 ----
pagename optname
sort-tag (N_ "Select a date to report on")
(lambda ()
(cons 'relative 'today))
#f 'both
! '(
! today
! end-this-month
! end-prev-month
! end-current-quarter
! end-prev-quarter
! end-cal-year
! end-prev-year
! end-cur-fin-year
! end-prev-fin-year
! ))))
;; This is a date-interval for a report.
***************
*** 59,70 ****
(N_ "Start of reporting period")
(lambda () (cons 'relative 'start-cal-year))
#f 'both
! '(start-this-month start-prev-month start-current-quarter
! start-prev-quarter start-cal-year
! ;;start-cur-fin-year
! start-prev-year
! ;;start-prev-fin-year
! )))
(gnc:register-option
options
(gnc:make-date-option
--- 63,78 ----
(N_ "Start of reporting period")
(lambda () (cons 'relative 'start-cal-year))
#f 'both
! '(
! start-this-month
! start-prev-month
! start-current-quarter
! start-prev-quarter
! start-cal-year
! start-prev-year
! start-cur-fin-year
! start-prev-fin-year
! )))
(gnc:register-option
options
(gnc:make-date-option
***************
*** 73,82 ****
(N_ "End of reporting period")
(lambda () (cons 'relative 'today))
#f 'both
! '(end-cal-year end-current-quarter end-this-month
! today end-prev-month end-prev-quarter end-prev-year
! ;;end-prev-fin-year
! ))))
;; A date interval multichoice option.
(define (gnc:options-add-interval-choice!
--- 81,97 ----
(N_ "End of reporting period")
(lambda () (cons 'relative 'today))
#f 'both
! '(
! today
! end-this-month
! end-prev-month
! end-current-quarter
! end-prev-quarter
! end-cal-year
! end-prev-year
! end-cur-fin-year
! end-prev-fin-year
! ))))
;; A date interval multichoice option.
(define (gnc:options-add-interval-choice!
Index: gnucash/src/scm/report-utilities.scm
diff -c gnucash/src/scm/report-utilities.scm:1.64 gnucash/src/scm/report-utilities.scm:1.65
*** gnucash/src/scm/report-utilities.scm:1.64 Thu May 3 02:56:51 2001
--- gnucash/src/scm/report-utilities.scm Sat May 12 02:44:21 2001
***************
*** 114,119 ****
--- 114,130 ----
(cons 'credit-line (_ "Credit Lines")))
type))
+ ;; Get the list of all different commodities that are used within the
+ ;; 'accounts', excluding the 'exclude-commodity'.
+ (define (gnc:accounts-get-commodities accounts exclude-commodity)
+ (delete exclude-commodity
+ (delete-duplicates
+ (sort (map gnc:account-get-commodity accounts)
+ (lambda (a b)
+ (string<? (gnc:commodity-get-mnemonic a)
+ (gnc:commodity-get-mnemonic b)))))))
+
+
;; Returns the depth of the current account hierarchy, that is, the
;; maximum level of subaccounts in the current-group.
(define (gnc:get-current-group-depth)
***************
*** 205,210 ****
--- 216,243 ----
;;; It would be a logical extension to throw in a "slot" for x^2 so
;;; that you could also extract the variance and standard deviation
+
+ ;; An IRC discussion on the performance of this: <cstim> rlb: I was
+ ;; wondering which one would perform better: The directly stored
+ ;; lambda in make-{stats,commodity}-collector, or just a value
+ ;; somewhere with an exhaustive set of functions on it? <rlb> cstim:
+ ;; my guess in the long run, a goops object would be most appropriate,
+ ;; and barring that, a record with a suitable set of functions defined
+ ;; to manipulate it would be faster, but in the short run (i.e. until
+ ;; we switch to requiring goops), it might not be worth changing.
+ ;; However, a record for the data (or vector) and a set of 7 functions
+ ;; would still be faster, if for no other reason than because you
+ ;; don't have to do the "case" lookup. That penalty can be avoided if
+ ;; you follow the other strategy where passing in 'adder simply
+ ;; returns the function, rather than calling it. Then the user's code
+ ;; can cache the value when repeated lookups would be expensive. Also
+ ;; everyone should note that in some tests Bill and I did here, plain
+ ;; old alists were faster than hash tables until you got to a
+ ;; reasonable size (i.e. greater than 10 elements, maybe greater than
+ ;; 30...) <cstim> rlb: hm, that makes sense. However, any change
+ ;; would break existing code, so if I would go for speed optimization
+ ;; I might just go for the record-and-function-set way. <rlb> cstim:
+ ;; yes. I think that would still be faster.
(define (gnc:make-stats-collector)
(let ;;; values
Index: gnucash/src/scm/report.scm
diff -c gnucash/src/scm/report.scm:1.47 gnucash/src/scm/report.scm:1.48
*** gnucash/src/scm/report.scm:1.47 Thu May 10 17:30:43 2001
--- gnucash/src/scm/report.scm Sat May 12 06:50:35 2001
***************
*** 44,49 ****
--- 44,50 ----
(define gnc:menuname-income-expense
(N_ "_Income & Expense"))
(define gnc:menuname-taxes (N_ "_Taxes"))
+ (define gnc:menuname-utility (N_ "_Utility"))
(define gnc:pagename-general (N_ "General"))
(define gnc:pagename-accounts (N_ "Accounts"))
(define gnc:pagename-display (N_ "Display"))
***************
*** 65,70 ****
--- 66,74 ----
(define asset-liability-menu
(gnc:make-menu gnc:menuname-asset-liability
(list "_File" "New _Report" "")))
+ (define utility-menu
+ (gnc:make-menu gnc:menuname-utility
+ (list "_File" "New _Report" "")))
(define menu-hash (make-hash-table 23))
(define (add-report-menu-item name report)
***************
*** 113,118 ****
--- 117,123 ----
; (gnc:add-extension tax-menu)
(gnc:add-extension income-expense-menu)
(gnc:add-extension asset-liability-menu)
+ (gnc:add-extension utility-menu)
;; push reports (new items added on top of menu)
(hash-for-each add-report-menu-item *gnc:_report-templates_*)
***************
*** 121,128 ****
(gnc:add-extension
(gnc:make-menu-item
((menu-namer 'add-name) (_ "Welcome Extravaganza"))
! (_ "Welcome-to-gnucash screen")
! (list "_File" "New _Report" "")
(lambda ()
(gnc:make-welcome-report)))))
--- 126,133 ----
(gnc:add-extension
(gnc:make-menu-item
((menu-namer 'add-name) (_ "Welcome Extravaganza"))
! (_ "Welcome-to-GnuCash screen")
! (list "_File" "New _Report" gnc:menuname-utility "")
(lambda ()
(gnc:make-welcome-report)))))
Index: gnucash/src/scm/report/account-piecharts.scm
diff -c gnucash/src/scm/report/account-piecharts.scm:1.18 gnucash/src/scm/report/account-piecharts.scm:1.19
*** gnucash/src/scm/report/account-piecharts.scm:1.18 Fri May 11 00:40:11 2001
--- gnucash/src/scm/report/account-piecharts.scm Sat May 12 03:41:00 2001
***************
*** 55,60 ****
--- 55,61 ----
(optname-from-date (N_ "From"))
(optname-to-date (N_ "To"))
(optname-report-currency (N_ "Report's currency"))
+ (optname-price-source (N_ "Price Source"))
(optname-accounts (N_ "Accounts"))
(optname-levels (N_ "Show Accounts until level"))
***************
*** 85,90 ****
--- 86,95 ----
(gnc:options-add-currency!
options gnc:pagename-general optname-report-currency "b")
+ (gnc:options-add-price-source!
+ options gnc:pagename-general
+ optname-price-source "c" 'weighted-average)
+
(add-option
(gnc:make-account-list-option
gnc:pagename-accounts optname-accounts
***************
*** 139,145 ****
account-types do-intervals?)
;; This is a helper function for looking up option values.
! (define (op-value section name)
(gnc:option-value
(gnc:lookup-option
(gnc:report-options report-obj) section name)))
--- 144,150 ----
account-types do-intervals?)
;; This is a helper function for looking up option values.
! (define (get-option section name)
(gnc:option-value
(gnc:lookup-option
(gnc:report-options report-obj) section name)))
***************
*** 147,171 ****
;; Get all options
(let ((to-date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
! (op-value gnc:pagename-general optname-to-date))))
(from-date-tp (if do-intervals?
(gnc:timepair-start-day-time
(gnc:date-option-absolute-time
! (op-value gnc:pagename-general
optname-from-date)))
'()))
! (accounts (op-value gnc:pagename-accounts optname-accounts))
! (account-levels (op-value gnc:pagename-accounts optname-levels))
! (report-currency (op-value gnc:pagename-general
optname-report-currency))
! (report-title (op-value gnc:pagename-general
gnc:optname-reportname))
! (show-fullname? (op-value gnc:pagename-display optname-fullname))
! (show-total? (op-value gnc:pagename-display optname-show-total))
! (max-slices (op-value gnc:pagename-display optname-slices))
! (height (op-value gnc:pagename-display optname-plot-height))
! (width (op-value gnc:pagename-display optname-plot-width))
(document (gnc:make-html-document))
(chart (gnc:make-html-piechart))
--- 152,178 ----
;; Get all options
(let ((to-date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
! (get-option gnc:pagename-general optname-to-date))))
(from-date-tp (if do-intervals?
(gnc:timepair-start-day-time
(gnc:date-option-absolute-time
! (get-option gnc:pagename-general
optname-from-date)))
'()))
! (accounts (get-option gnc:pagename-accounts optname-accounts))
! (account-levels (get-option gnc:pagename-accounts optname-levels))
! (report-currency (get-option gnc:pagename-general
optname-report-currency))
! (price-source (get-option gnc:pagename-general
! optname-price-source))
! (report-title (get-option gnc:pagename-general
gnc:optname-reportname))
! (show-fullname? (get-option gnc:pagename-display optname-fullname))
! (show-total? (get-option gnc:pagename-display optname-show-total))
! (max-slices (get-option gnc:pagename-display optname-slices))
! (height (get-option gnc:pagename-display optname-plot-height))
! (width (get-option gnc:pagename-display optname-plot-width))
(document (gnc:make-html-document))
(chart (gnc:make-html-piechart))
***************
*** 191,200 ****
account to-date-tp subaccts?)))
;; Define more helper variables.
! (let* ((exchange-alist (gnc:make-exchange-alist
! report-currency to-date-tp))
! (exchange-fn-internal
! (gnc:make-exchange-function exchange-alist))
(tree-depth (if (equal? account-levels 'all)
(gnc:get-current-group-depth)
account-levels))
--- 198,205 ----
account to-date-tp subaccts?)))
;; Define more helper variables.
! (let* ((exchange-fn (gnc:case-exchange-fn
! price-source report-currency to-date-tp))
(tree-depth (if (equal? account-levels 'all)
(gnc:get-current-group-depth)
account-levels))
***************
*** 204,210 ****
;; Converts a commodity-collector into one single double
;; number, depending on the report currency and the
! ;; exchange-alist calculated above. Returns the absolute value
;; as double.
(define (collector->double c)
;; Future improvement: Let the user choose which kind of
--- 209,215 ----
;; Converts a commodity-collector into one single double
;; number, depending on the report currency and the
! ;; exchange-fn calculated above. Returns the absolute value
;; as double.
(define (collector->double c)
;; Future improvement: Let the user choose which kind of
***************
*** 216,222 ****
(gnc:gnc-monetary-amount
(gnc:sum-collector-commodity
c report-currency
! exchange-fn-internal)))))
;; Calculates all account's balances. Returns a list of
;; balance <=> account pairs, like '((10.0 Earnings) (142.5
--- 221,227 ----
(gnc:gnc-monetary-amount
(gnc:sum-collector-commodity
c report-currency
! exchange-fn)))))
;; Calculates all account's balances. Returns a list of
;; balance <=> account pairs, like '((10.0 Earnings) (142.5
Index: gnucash/src/scm/report/account-summary.scm
diff -c gnucash/src/scm/report/account-summary.scm:1.38 gnucash/src/scm/report/account-summary.scm:1.39
*** gnucash/src/scm/report/account-summary.scm:1.38 Thu May 10 03:24:37 2001
--- gnucash/src/scm/report/account-summary.scm Sat May 12 03:41:01 2001
***************
*** 35,55 ****
;; first define all option's names such that typos etc. are no longer
;; possible.
! (let ((pagename-general (N_ "General"))
! (optname-date (N_ "Date"))
(optname-display-depth (N_ "Account Display Depth"))
(optname-show-foreign (N_ "Show Foreign Currencies/Shares of Stock"))
(optname-report-currency (N_ "Report's currency"))
- (pagename-accounts (N_ "Accounts"))
(optname-show-subaccounts (N_ "Always show sub-accounts"))
(optname-accounts (N_ "Account"))
- (pagename-display (N_ "Display"))
(optname-group-accounts (N_ "Group the accounts"))
(optname-show-parent-balance (N_ "Show balances for parent accounts"))
! (optname-show-parent-total (N_ "Show subtotals")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; options generator
--- 35,54 ----
;; first define all option's names such that typos etc. are no longer
;; possible.
! (let ((optname-date (N_ "Date"))
(optname-display-depth (N_ "Account Display Depth"))
(optname-show-foreign (N_ "Show Foreign Currencies/Shares of Stock"))
(optname-report-currency (N_ "Report's currency"))
+ (optname-price-source (N_ "Price Source"))
(optname-show-subaccounts (N_ "Always show sub-accounts"))
(optname-accounts (N_ "Account"))
(optname-group-accounts (N_ "Group the accounts"))
(optname-show-parent-balance (N_ "Show balances for parent accounts"))
! (optname-show-parent-total (N_ "Show subtotals"))
! (optname-show-rates (N_ "Show Exchange Rates")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; options generator
***************
*** 62,77 ****
(let* ((options (gnc:new-options)))
;; date at which to report balance
(gnc:options-add-report-date!
! options pagename-general optname-date "a")
;; all about currencies
(gnc:options-add-currency!
! options pagename-general
optname-report-currency "b")
;; accounts to work on
(gnc:options-add-account-selection!
! options pagename-accounts
optname-display-depth optname-show-subaccounts
optname-accounts "a" 1
(lambda ()
--- 61,80 ----
(let* ((options (gnc:new-options)))
;; date at which to report balance
(gnc:options-add-report-date!
! options gnc:pagename-general optname-date "a")
;; all about currencies
(gnc:options-add-currency!
! options gnc:pagename-general
optname-report-currency "b")
+ (gnc:options-add-price-source!
+ options gnc:pagename-general
+ optname-price-source "c" 'weighted-average)
+
;; accounts to work on
(gnc:options-add-account-selection!
! options gnc:pagename-accounts
optname-display-depth optname-show-subaccounts
optname-accounts "a" 1
(lambda ()
***************
*** 83,101 ****
;; with or without grouping
(gnc:options-add-group-accounts!
! options pagename-display optname-group-accounts "b" #t)
;; new options here
(gnc:register-option
options
(gnc:make-simple-boolean-option
! pagename-display optname-show-parent-balance
"c" (N_ "Show balances for parent accounts") #t))
(gnc:register-option
options
(gnc:make-simple-boolean-option
! pagename-display optname-show-parent-total
"d" (N_ "Show subtotals for parent accounts") #t))
(gnc:register-option
--- 86,104 ----
;; with or without grouping
(gnc:options-add-group-accounts!
! options gnc:pagename-display optname-group-accounts "b" #t)
;; new options here
(gnc:register-option
options
(gnc:make-simple-boolean-option
! gnc:pagename-display optname-show-parent-balance
"c" (N_ "Show balances for parent accounts") #t))
(gnc:register-option
options
(gnc:make-simple-boolean-option
! gnc:pagename-display optname-show-parent-total
"d" (N_ "Show subtotals for parent accounts") #t))
(gnc:register-option
***************
*** 104,111 ****
gnc:pagename-display optname-show-foreign
"e" (N_ "Display the account's foreign currency amount?") #f))
;; Set the general page as default option tab
! (gnc:options-set-default-section options pagename-general)
options))
--- 107,120 ----
gnc:pagename-display optname-show-foreign
"e" (N_ "Display the account's foreign currency amount?") #f))
+ (gnc:register-option
+ options
+ (gnc:make-simple-boolean-option
+ gnc:pagename-display optname-show-rates
+ "f" (N_ "Show the exchange rates used") #t))
+
;; Set the general page as default option tab
! (gnc:options-set-default-section options gnc:pagename-general)
options))
***************
*** 120,142 ****
(gnc:lookup-option
(gnc:report-options report-obj) pagename optname)))
! (let ((display-depth (get-option pagename-accounts
optname-display-depth ))
! (show-subaccts? (get-option pagename-accounts
optname-show-subaccounts))
! (accounts (get-option pagename-accounts optname-accounts))
! (do-grouping? (get-option pagename-display
optname-group-accounts))
! (show-parent-balance? (get-option pagename-display
optname-show-parent-balance))
! (show-parent-total? (get-option pagename-display
optname-show-parent-total))
! (show-fcur? (get-option pagename-display optname-show-foreign))
! (report-currency (get-option pagename-general
optname-report-currency))
(date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
! (get-option pagename-general
optname-date))))
(doc (gnc:make-html-document))
(txt (gnc:make-html-text)))
--- 129,155 ----
(gnc:lookup-option
(gnc:report-options report-obj) pagename optname)))
! (let ((display-depth (get-option gnc:pagename-accounts
optname-display-depth ))
! (show-subaccts? (get-option gnc:pagename-accounts
optname-show-subaccounts))
! (accounts (get-option gnc:pagename-accounts optname-accounts))
! (do-grouping? (get-option gnc:pagename-display
optname-group-accounts))
! (show-parent-balance? (get-option gnc:pagename-display
optname-show-parent-balance))
! (show-parent-total? (get-option gnc:pagename-display
optname-show-parent-total))
! (show-fcur? (get-option gnc:pagename-display optname-show-foreign))
! (report-currency (get-option gnc:pagename-general
optname-report-currency))
+ (price-source (get-option gnc:pagename-general
+ optname-price-source))
+ (show-rates? (get-option gnc:pagename-display
+ optname-show-rates))
(date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
! (get-option gnc:pagename-general
optname-date))))
(doc (gnc:make-html-document))
(txt (gnc:make-html-text)))
***************
*** 149,157 ****
(gnc:get-current-group-depth)
display-depth)
(if do-grouping? 1 0)))
! (exchange-alist (gnc:make-exchange-alist
! report-currency date-tp))
! (exchange-fn (gnc:make-exchange-function exchange-alist))
;; do the processing here
(table (gnc:html-build-acct-table
#f date-tp
--- 162,169 ----
(gnc:get-current-group-depth)
display-depth)
(if do-grouping? 1 0)))
! (exchange-fn (gnc:case-exchange-fn
! price-source report-currency date-tp))
;; do the processing here
(table (gnc:html-build-acct-table
#f date-tp
***************
*** 164,180 ****
;; add the table
(gnc:html-document-add-object! doc table)
- ;; add the currency information
- ;(gnc:html-print-exchangerates!
- ; txt report-currency exchange-alist)
-
- ;;(if show-fcur?
- (gnc:html-document-add-object!
- doc ;;(gnc:html-markup-p
- (gnc:html-make-exchangerates
- report-currency exchange-fn accounts)));;)
-
;; error condition: no accounts specified
(gnc:html-document-add-object!
doc
--- 176,194 ----
;; add the table
(gnc:html-document-add-object! doc table)
+
+ ;; add currency information
+ (if show-rates?
+ (gnc:html-document-add-object!
+ doc ;;(gnc:html-markup-p
+ (gnc:html-make-exchangerates
+ report-currency exchange-fn
+ (append-map
+ (lambda (a)
+ (gnc:group-get-subaccounts
+ (gnc:account-get-children a)))
+ accounts)))))
;; error condition: no accounts specified
(gnc:html-document-add-object!
doc
Index: gnucash/src/scm/report/balance-sheet.scm
diff -c gnucash/src/scm/report/balance-sheet.scm:1.22 gnucash/src/scm/report/balance-sheet.scm:1.23
*** gnucash/src/scm/report/balance-sheet.scm:1.22 Thu May 10 03:24:37 2001
--- gnucash/src/scm/report/balance-sheet.scm Sat May 12 03:41:01 2001
***************
*** 180,195 ****
(gnc:get-current-group-depth)
display-depth))
;; calculate the exchange rates
! (exchange-fn
! (case price-source
! ('weighted-average (gnc:make-exchange-function
! (gnc:make-exchange-alist
! report-currency to-date-tp)))
! ('pricedb-latest gnc:exchange-by-pricedb-latest)
! ('pricedb-nearest (lambda (foreign domestic)
! (gnc:exchange-by-pricedb-nearest
! foreign domestic to-date-tp)))
! (else (gnc:warn "balance-sheet: bad price-source value"))))
(totals-get-balance (lambda (account)
(gnc:account-get-comm-balance-at-date
account to-date-tp #f))))
--- 180,187 ----
(gnc:get-current-group-depth)
display-depth))
;; calculate the exchange rates
! (exchange-fn (gnc:case-exchange-fn
! price-source report-currency to-date-tp))
(totals-get-balance (lambda (account)
(gnc:account-get-comm-balance-at-date
account to-date-tp #f))))
Index: gnucash/src/scm/report/hello-world.scm
diff -c gnucash/src/scm/report/hello-world.scm:1.27 gnucash/src/scm/report/hello-world.scm:1.28
*** gnucash/src/scm/report/hello-world.scm:1.27 Thu Apr 12 18:03:42 2001
--- gnucash/src/scm/report/hello-world.scm Sat May 12 06:50:36 2001
***************
*** 472,477 ****
--- 472,481 ----
;; report to the user.
'menu-tip (N_ "A sample report with examples.")
+ ;; A path describing where to put the report in the menu system.
+ ;; In this case, it's going under the utility menu.
+ 'menu-path (list gnc:menuname-utility)
+
;; The options generator function defined above.
'options-generator options-generator
Index: gnucash/src/scm/report/iframe-url.scm
diff -c gnucash/src/scm/report/iframe-url.scm:1.1 gnucash/src/scm/report/iframe-url.scm:1.2
*** gnucash/src/scm/report/iframe-url.scm:1.1 Tue Apr 17 14:51:38 2001
--- gnucash/src/scm/report/iframe-url.scm Sat May 12 06:50:36 2001
***************
*** 31,36 ****
(gnc:define-report
'version 1
'name (N_ "Frame URL")
'options-generator options-generator
'renderer renderer))
-
--- 31,36 ----
(gnc:define-report
'version 1
'name (N_ "Frame URL")
+ 'menu-path (list gnc:menuname-utility)
'options-generator options-generator
'renderer renderer))
Index: gnucash/src/scm/report/pnl.scm
diff -c gnucash/src/scm/report/pnl.scm:1.22 gnucash/src/scm/report/pnl.scm:1.23
*** gnucash/src/scm/report/pnl.scm:1.22 Thu May 10 03:24:37 2001
--- gnucash/src/scm/report/pnl.scm Sat May 12 03:41:01 2001
***************
*** 61,66 ****
--- 61,70 ----
options gnc:pagename-general
optname-report-currency "b")
+ (gnc:options-add-price-source!
+ options gnc:pagename-general
+ optname-price-source "c" 'weighted-average)
+
;; accounts to work on
(gnc:options-add-account-selection!
options gnc:pagename-accounts
***************
*** 135,140 ****
--- 139,146 ----
optname-show-foreign))
(report-currency (get-option gnc:pagename-general
optname-report-currency))
+ (price-source (get-option gnc:pagename-general
+ optname-price-source))
(show-rates? (get-option gnc:pagename-display
optname-show-rates))
(to-date-tp (gnc:timepair-end-day-time
***************
*** 160,168 ****
display-depth)
(if do-grouping? 1 0)))
;; calculate the exchange rates
! (exchange-alist (gnc:make-exchange-alist
! report-currency to-date-tp))
! (exchange-fn (gnc:make-exchange-function exchange-alist))
;; do the processing here
(table (gnc:html-build-acct-table
from-date-tp to-date-tp
--- 166,173 ----
display-depth)
(if do-grouping? 1 0)))
;; calculate the exchange rates
! (exchange-fn (gnc:case-exchange-fn
! price-source report-currency to-date-tp))
;; do the processing here
(table (gnc:html-build-acct-table
from-date-tp to-date-tp
Index: gnucash/src/scm/report/price-scatter.scm
diff -c gnucash/src/scm/report/price-scatter.scm:1.6 gnucash/src/scm/report/price-scatter.scm:1.8
*** gnucash/src/scm/report/price-scatter.scm:1.6 Wed May 9 15:46:06 2001
--- gnucash/src/scm/report/price-scatter.scm Sat May 12 03:41:01 2001
***************
*** 28,35 ****
(let ((optname-from-date (N_ "From"))
(optname-to-date (N_ "To"))
(optname-stepsize (N_ "Step Size"))
- (optname-report-currency (N_ "Report's currency"))
(optname-price-commodity (N_ "Price of Commodity"))
(optname-price-source (N_ "Price Source"))
--- 28,36 ----
(let ((optname-from-date (N_ "From"))
(optname-to-date (N_ "To"))
(optname-stepsize (N_ "Step Size"))
+ (pagename-price (N_ "Price"))
+ (optname-report-currency (N_ "Report's currency"))
(optname-price-commodity (N_ "Price of Commodity"))
(optname-price-source (N_ "Price Source"))
***************
*** 61,78 ****
options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
(gnc:options-add-currency!
! options gnc:pagename-general optname-report-currency "d")
(add-option
(gnc:make-currency-option
! gnc:pagename-general optname-price-commodity
"e"
(N_ "Calculate the price of this commodity.")
(gnc:locale-default-currency)))
(add-option
(gnc:make-multichoice-option
! gnc:pagename-general optname-price-source
"f" (N_ "The source of price information")
'actual-transactions
(list (vector 'weighted-average
--- 62,79 ----
options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
(gnc:options-add-currency!
! options pagename-price optname-report-currency "d")
(add-option
(gnc:make-currency-option
! pagename-price optname-price-commodity
"e"
(N_ "Calculate the price of this commodity.")
(gnc:locale-default-currency)))
(add-option
(gnc:make-multichoice-option
! pagename-price optname-price-source
"f" (N_ "The source of price information")
'actual-transactions
(list (vector 'weighted-average
***************
*** 81,89 ****
(vector 'actual-transactions
(N_ "Actual Transactions")
(N_ "The instantaneous price of actual currency transactions in the past"))
! ;;(vector 'pricedb-nearest
! ;; (N_ "Pricedb: Nearest in time")
! ;; (N_ "The price recorded nearest in time to the report date"))
)))
--- 82,90 ----
(vector 'actual-transactions
(N_ "Actual Transactions")
(N_ "The instantaneous price of actual currency transactions in the past"))
! (vector 'pricedb
! (N_ "Price Database")
! (N_ "The recorded prices"))
)))
***************
*** 112,118 ****
(define (renderer report-obj)
;; This is a helper function for looking up option values.
! (define (op-value section name)
(gnc:option-value
(gnc:lookup-option (gnc:report-options report-obj) section name)))
--- 113,119 ----
(define (renderer report-obj)
;; This is a helper function for looking up option values.
! (define (get-option section name)
(gnc:option-value
(gnc:lookup-option (gnc:report-options report-obj) section name)))
***************
*** 124,152 ****
(let* ((to-date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
! (op-value gnc:pagename-general
optname-to-date))))
(from-date-tp (gnc:timepair-start-day-time
(gnc:date-option-absolute-time
! (op-value gnc:pagename-general
optname-from-date))))
! (interval (op-value gnc:pagename-general optname-stepsize))
! (report-title (op-value gnc:pagename-general
gnc:optname-reportname))
! (height (op-value gnc:pagename-display optname-plot-height))
! (width (op-value gnc:pagename-display optname-plot-width))
! (marker (op-value gnc:pagename-display optname-marker))
(mcolor
(gnc:color-option->hex-string
(gnc:lookup-option (gnc:report-options report-obj)
gnc:pagename-display optname-markercolor)))
! (report-currency (op-value gnc:pagename-general
optname-report-currency))
! (price-commodity (op-value gnc:pagename-general
optname-price-commodity))
! (price-source (op-value gnc:pagename-general
optname-price-source))
(dates-list (gnc:make-date-list
--- 125,153 ----
(let* ((to-date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
! (get-option gnc:pagename-general
optname-to-date))))
(from-date-tp (gnc:timepair-start-day-time
(gnc:date-option-absolute-time
! (get-option gnc:pagename-general
optname-from-date))))
! (interval (get-option gnc:pagename-general optname-stepsize))
! (report-title (get-option gnc:pagename-general
gnc:optname-reportname))
! (height (get-option gnc:pagename-display optname-plot-height))
! (width (get-option gnc:pagename-display optname-plot-width))
! (marker (get-option gnc:pagename-display optname-marker))
(mcolor
(gnc:color-option->hex-string
(gnc:lookup-option (gnc:report-options report-obj)
gnc:pagename-display optname-markercolor)))
! (report-currency (get-option pagename-price
optname-report-currency))
! (price-commodity (get-option pagename-price
optname-price-commodity))
! (price-source (get-option pagename-price
optname-price-source))
(dates-list (gnc:make-date-list
***************
*** 166,175 ****
(gnc:html-scatter-set-title!
chart report-title)
(gnc:html-scatter-set-subtitle!
! chart (sprintf #f
! (_ "%s to %s")
! (gnc:timepair-to-datestring from-date-tp)
! (gnc:timepair-to-datestring to-date-tp)))
(gnc:html-scatter-set-width! chart width)
(gnc:html-scatter-set-height! chart height)
(gnc:html-scatter-set-marker! chart
--- 167,179 ----
(gnc:html-scatter-set-title!
chart report-title)
(gnc:html-scatter-set-subtitle!
! chart (string-append
! (gnc:commodity-get-mnemonic price-commodity)
! " - "
! (sprintf #f
! (_ "%s to %s")
! (gnc:timepair-to-datestring from-date-tp)
! (gnc:timepair-to-datestring to-date-tp))))
(gnc:html-scatter-set-width! chart width)
(gnc:html-scatter-set-height! chart height)
(gnc:html-scatter-set-marker! chart
***************
*** 180,188 ****
('asterisk "asterisk")
('filledcircle "filled circle")
('filledsquare "filled square")))
- ;;(warn marker mcolor)
- ;; FIXME: workaround to set the alpha channel
- (set! mcolor (string-append mcolor "ff"))
(gnc:html-scatter-set-markercolor! chart mcolor)
(gnc:html-scatter-set-y-axis-label!
chart (gnc:commodity-get-mnemonic report-currency))
--- 184,189 ----
***************
*** 198,278 ****
(not (gnc:commodity-equiv? report-currency price-commodity))
(begin
(if (not (null? currency-accounts))
- ;; This is an experiment, and if the code is good, it could
- ;; go into commodity-utilities.scm or even start a new file.
(set!
data
(case price-source
('actual-transactions
! ;; go through all splits; convert all splits into a
! ;; price.
! (map
! (lambda (a)
! (let* ((transaction-comm (gnc:transaction-get-commodity
! (gnc:split-get-parent a)))
! (account-comm (gnc:account-get-commodity
! (gnc:split-get-account a)))
! (share-amount (gnc:split-get-share-amount a))
! (value-amount (gnc:split-get-value a))
! (transaction-date (gnc:transaction-get-date-posted
! (gnc:split-get-parent a)))
! (foreignlist
! (if (gnc:commodity-equiv? transaction-comm
! price-commodity)
! (list account-comm
! (gnc:numeric-neg share-amount)
! (gnc:numeric-neg value-amount))
! (list transaction-comm
! value-amount
! share-amount))))
!
! ;;(warn "render-scatterplot: value "
! ;; (commodity-numeric->string
! ;; (first foreignlist) (second foreignlist))
! ;; " bought shares "
! ;;(commodity-numeric->string
! ;; price-commodity (third foreignlist)))
!
! (list
! transaction-date
! (if (not (gnc:commodity-equiv? (first foreignlist)
! report-currency))
! (begin
! (warn "render-scatterplot: "
! "Sorry, currency exchange not yet implemented:"
! (commodity-numeric->string
! (first foreignlist) (second foreignlist))
! " (buying "
! (commodity-numeric->string
! price-commodity (third foreignlist))
! ") =? "
! (commodity-numeric->string
! report-currency (gnc:numeric-zero)))
! (gnc:numeric-zero))
! (gnc:numeric-div
! (second foreignlist)
! (third foreignlist)
! GNC-DENOM-AUTO
! (logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND))))))
! ;; Get all the interesting splits
! (gnc:get-match-commodity-splits
! currency-accounts
! to-date-tp price-commodity)))
('weighted-average
! (gnc:get-commodity-totalaverage-prices
currency-accounts to-date-tp
price-commodity report-currency))
)))
(set! data (filter
(lambda (x)
! (gnc:timepair-lt from-date-tp (first x)))
data))
;; some output
! ;;(warn (map (lambda (x) (list
! ;; (gnc:timepair-to-datestring (car x))
! ;; (gnc:numeric-to-double (second x))))
;;data))
;; convert the gnc:numeric's to doubles
--- 199,235 ----
(not (gnc:commodity-equiv? report-currency price-commodity))
(begin
(if (not (null? currency-accounts))
(set!
data
(case price-source
('actual-transactions
! (gnc:get-commodity-inst-prices
! currency-accounts to-date-tp
! price-commodity report-currency))
('weighted-average
! (gnc:get-commodity-totalavg-prices
currency-accounts to-date-tp
price-commodity report-currency))
+ ('pricedb
+ (map (lambda (p)
+ (list (gnc:price-get-time p)
+ (gnc:price-get-value p)))
+ (gnc:pricedb-get-prices
+ (gnc:book-get-pricedb (gnc:get-current-book))
+ price-commodity report-currency)))
)))
(set! data (filter
(lambda (x)
! (and
! (gnc:timepair-ge to-date-tp (first x))
! (gnc:timepair-ge (first x) from-date-tp)))
data))
;; some output
! ;;(warn "data" (map (lambda (x) (list
! ;; (gnc:timepair-to-datestring (car x))
! ;; (gnc:numeric-to-double (second x))))
;;data))
;; convert the gnc:numeric's to doubles
***************
*** 307,326 ****
(gnc:html-document-add-object! document chart)
! (gnc:html-document-add-object!
! document
! (gnc:make-html-text
! (gnc:html-markup-p
! "This report calculates the 'prices of commodity' transactions \
! versus the 'report commodity'. (I.e. it won't work if there's another \
! commodity involved in between.) cstim.")))
document))
;; Here we define the actual report
(gnc:define-report
'version 1
! 'name (N_ "Price Scatter Plot (Test)")
! ;;'menu-path (list gnc:menuname-asset-liability)
'options-generator options-generator
'renderer renderer))
--- 264,284 ----
(gnc:html-document-add-object! document chart)
! ;; (gnc:html-document-add-object!
! ;; document
! ;; (gnc:make-html-text
! ;; (gnc:html-markup-p
! ;; "This report calculates the 'prices of commodity' transactions \
! ;;versus the 'report commodity'. (I.e. it won't work if there's another \
! ;;commodity involved in between.) cstim.")))
document))
;; Here we define the actual report
(gnc:define-report
'version 1
! 'name (N_ "Price")
! 'menu-path (list gnc:menuname-asset-liability)
! 'menu-name (N_ "Price Scatterplot")
'options-generator options-generator
'renderer renderer))
Index: gnucash/src/scm/report/view-column.scm
diff -c gnucash/src/scm/report/view-column.scm:1.7 gnucash/src/scm/report/view-column.scm:1.9
*** gnucash/src/scm/report/view-column.scm:1.7 Thu May 10 17:30:45 2001
--- gnucash/src/scm/report/view-column.scm Sat May 12 07:47:32 2001
***************
*** 191,197 ****
(reports
(gnc:option-value
(gnc:lookup-option options "__general" "report-list"))))
- (simple-format #t "view options changed cb\n")
(for-each
(lambda (child)
(gnc:report-set-dirty?! (gnc:find-report (car child)) #t))
--- 191,196 ----
***************
*** 217,225 ****
(gnc:define-report
'version 1
'name (N_ "Multicolumn View")
'renderer render-view
'options-generator make-options
'options-editor edit-options
'options-cleanup-cb cleanup-options
'options-changed-cb options-changed-cb))
-
--- 216,224 ----
(gnc:define-report
'version 1
'name (N_ "Multicolumn View")
+ 'menu-path (list gnc:menuname-utility)
'renderer render-view
'options-generator make-options
'options-editor edit-options
'options-cleanup-cb cleanup-options
'options-changed-cb options-changed-cb))
Index: gnucash/src/scm/report/welcome-to-gnucash.scm
diff -c gnucash/src/scm/report/welcome-to-gnucash.scm:1.3 gnucash/src/scm/report/welcome-to-gnucash.scm:1.4
*** gnucash/src/scm/report/welcome-to-gnucash.scm:1.3 Thu May 10 17:30:45 2001
--- gnucash/src/scm/report/welcome-to-gnucash.scm Sat May 12 06:50:36 2001
***************
*** 73,82 ****
(gnc:html-markup-p
"I know this is ugly.")))
doc))
!
(gnc:define-report
'name "Welcome to GnuCash 1.6"
'options-generator options
'renderer renderer))
-
-
--- 73,81 ----
(gnc:html-markup-p
"I know this is ugly.")))
doc))
!
(gnc:define-report
'name "Welcome to GnuCash 1.6"
+ 'in-menu? #f
'options-generator options
'renderer renderer))