Bill Gribble's patch.

* src/gnome/druid-qif-import.c: restructure druid a bit to
        allow more flexible navigation (in particular, so we can have
        a global pref to skip documentation pages)

        * src/scm/html-*.scm: change rendering model to speed up reports.
        use a "string tree" instead of the old with-output-to-string and
        compile style tables where possible.  Strangely enough, alists
        are faster than hash tables.

        * src/scm/html-table.scm: clean up row/col style stuff a little.
        semantics changed a wee bit: now row style takes precedence over
        column style.  this was necessary for performance.

        * src/scm/prefs.scm: add a global pref to skip doc pages in the
        QIF importer.

        * src/scm/report.scm: shuffle around a bit for the new rendering
        model.

        * src/gnome/window-report.c: back out some overly-aggressive
        memory reclamation.  I need to figure out how to do this right.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3626 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-02-08 23:31:54 +00:00
parent fed1fcd1fe
commit fc35747a45
18 changed files with 1592 additions and 772 deletions

View File

@ -1,3 +1,27 @@
2001-02-08 Bill Gribble <grib@billgribble.com>
* src/gnome/druid-qif-import.c: restructure druid a bit to
allow more flexible navigation (in particular, so we can have
a global pref to skip documentation pages)
* src/scm/html-*.scm: change rendering model to speed up reports.
use a "string tree" instead of the old with-output-to-string and
compile style tables where possible. Strangely enough, alists
are faster than hash tables.
* src/scm/html-table.scm: clean up row/col style stuff a little.
semantics changed a wee bit: now row style takes precedence over
column style. this was necessary for performance.
* src/scm/prefs.scm: add a global pref to skip doc pages in the
QIF importer.
* src/scm/report.scm: shuffle around a bit for the new rendering
model.
* src/gnome/window-report.c: back out some overly-aggressive
memory reclamation. I need to figure out how to do this right.
2001-02-08 Christian Stimming <stimming@tuhh.de>
* src/scm/date-utilities.scm Added (gnc:timepair-previous-day).

View File

@ -34,6 +34,7 @@
#include "druid-qif-import.h"
#include "dialog-account-picker.h"
#include "dialog-commodity.h"
#include "global-options.h"
#include "window-help.h"
#include "messages.h"
#include "gnc-ui.h"
@ -78,8 +79,13 @@ struct _qifimportwindow {
GtkWidget * match_duplicates_page;
GtkWidget * end_page;
GList * pages;
GList * pre_comm_pages;
GList * commodity_pages;
GList * post_comm_pages;
GList * doc_pages;
gboolean show_doc_pages;
SCM imported_files;
SCM selected_file;
@ -117,6 +123,15 @@ static GdkColor std_bg_color = { 0, 39835, 49087, 40092 };
static GdkColor std_logo_bg_color = { 0, 65535, 65535, 65535 };
static GdkColor std_title_color = { 0, 65535, 65535, 65535 };
#define NUM_PRE_PAGES 11
#define NUM_POST_PAGES 3
#define NUM_DOC_PAGES 5
static GnomeDruidPage *
get_named_page(QIFImportWindow * w, const char * name) {
GtkObject * o = GTK_OBJECT(w->window);
return GNOME_DRUID_PAGE(gtk_object_get_data(o, name));
}
/********************************************************************
* gnc_ui_qif_import_druid_make()
@ -127,12 +142,27 @@ QIFImportWindow *
gnc_ui_qif_import_druid_make(void) {
QIFImportWindow * retval;
GtkObject * wobj;
GtkObject * wobj;
SCM load_map_prefs;
SCM mapping_info;
SCM lookup_option;
SCM lookup_value;
int i;
char * pre_page_names[NUM_PRE_PAGES] = {
"start_page", "load_file_page", "date_format_page", "account_name_page",
"loaded_files_page", "account_doc_page", "account_match_page",
"category_doc_page", "category_match_page", "currency_page",
"commodity_doc_page"
};
char * post_page_names[NUM_POST_PAGES] = {
"match_doc_page", "match_duplicates_page", "end_page"
};
char * doc_page_names[NUM_DOC_PAGES] = {
"start_page", "account_doc_page", "category_doc_page",
"commodity_doc_page", "match_doc_page"
};
retval = g_new0(QIFImportWindow, 1);
retval->window = create_QIF_Import_Druid();
@ -165,35 +195,36 @@ gnc_ui_qif_import_druid_make(void) {
retval->old_transaction_list =
gtk_object_get_data(wobj, "old_transaction_list");
retval->start_page = gtk_object_get_data(wobj, "start_page");
retval->load_file_page = gtk_object_get_data(wobj, "load_file_page");
retval->loaded_files_page = gtk_object_get_data(wobj, "loaded_files_page");
retval->date_format_page = gtk_object_get_data(wobj, "date_format_page");
retval->account_name_page = gtk_object_get_data(wobj, "account_name_page");
retval->account_doc_page = gtk_object_get_data(wobj, "account_doc_page");
retval->account_match_page =
gtk_object_get_data(wobj, "account_match_page");
retval->category_doc_page = gtk_object_get_data(wobj, "category_doc_page");
retval->category_match_page =
gtk_object_get_data(wobj, "category_match_page");
retval->currency_page = gtk_object_get_data(wobj, "currency_page");
retval->commodity_doc_page =
gtk_object_get_data(wobj, "commodity_doc_page");
retval->match_doc_page =
gtk_object_get_data(wobj, "match_doc_page");
retval->match_duplicates_page =
gtk_object_get_data(wobj, "match_duplicates_page");
retval->end_page = gtk_object_get_data(wobj, "end_page");
retval->pages = NULL;
retval->pre_comm_pages = NULL;
retval->post_comm_pages = NULL;
retval->doc_pages = NULL;
retval->commodity_pages = NULL;
retval->show_doc_pages =
gnc_lookup_boolean_option(_("QIF Import"),
_("Verbose documentation"),
TRUE);
for(i=0; i < NUM_PRE_PAGES; i++) {
retval->pre_comm_pages =
g_list_append(retval->pre_comm_pages,
gtk_object_get_data(wobj, pre_page_names[i]));
}
for(i=0; i < NUM_POST_PAGES; i++) {
retval->post_comm_pages =
g_list_append(retval->post_comm_pages,
gtk_object_get_data(wobj, post_page_names[i]));
}
for(i=0; i < NUM_DOC_PAGES; i++) {
retval->doc_pages =
g_list_append(retval->doc_pages,
gtk_object_get_data(wobj, doc_page_names[i]));
}
gtk_object_set_data(wobj, "qif_window_struct", retval);
/* load the saved-state of the mappings from Quicken accounts and
* categories to gnucash accounts */
load_map_prefs = gh_eval_str("qif-import:load-map-prefs");
lookup_option = gh_eval_str("gnc:lookup-global-option");
lookup_value = gh_eval_str("gnc:option-value");
mapping_info = gh_call0(load_map_prefs);
retval->gnc_acct_info = gh_car(mapping_info);
@ -217,6 +248,11 @@ gnc_ui_qif_import_druid_make(void) {
gnc_commodity_get_printname
(gnc_locale_default_currency()));
if(!retval->show_doc_pages) {
gnome_druid_set_page(GNOME_DRUID(retval->druid),
get_named_page(retval, "load_file_page"));
}
gtk_widget_show_all(retval->window);
return retval;
@ -233,6 +269,8 @@ gnc_ui_qif_import_druid_destroy (QIFImportWindow * window) {
if (!window)
return;
/* FIXME -- commodity pages */
gtk_widget_destroy(window->window);
scm_unprotect_object(window->imported_files);
@ -249,6 +287,160 @@ gnc_ui_qif_import_druid_destroy (QIFImportWindow * window) {
g_free(window);
}
static GtkWidget *
get_next_druid_page(QIFImportWindow * wind, GnomeDruidPage * page) {
GList * current = NULL;
GList * next;
int where = 0;
if((current = g_list_find(wind->pre_comm_pages, page)) == NULL) {
if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
/* where are we? */
printf("QIF import: I'm lost!\n");
return FALSE;
}
else {
where = 3;
}
}
else {
where = 2;
}
}
else {
where = 1;
}
next = current->next;
while(!next ||
(!wind->show_doc_pages &&
g_list_find(wind->doc_pages, next->data))) {
if(next && next->next) {
next = next->next;
}
else {
where ++;
switch(where) {
case 2:
next = wind->commodity_pages;
break;
case 3:
next = wind->post_comm_pages;
break;
default:
printf("QIF import: something fishy.\n");
next = NULL;
break;
}
}
}
if(next) return (GtkWidget *)next->data;
else return NULL;
}
static GtkWidget *
get_prev_druid_page(QIFImportWindow * wind, GnomeDruidPage * page) {
GList * current = NULL;
GList * prev;
int where = 0;
if((current = g_list_find(wind->pre_comm_pages, page)) == NULL) {
if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
/* where are we? */
printf("QIF import: I'm lost!\n");
return FALSE;
}
else {
where = 3;
}
}
else {
where = 2;
}
}
else {
where = 1;
}
prev = current->prev;
while(!prev ||
(!wind->show_doc_pages &&
g_list_find(wind->doc_pages, prev->data))) {
if(prev && prev->prev) {
prev = prev->prev;
}
else {
where --;
switch(where) {
case 1:
prev = g_list_last(wind->pre_comm_pages);
break;
case 2:
prev = g_list_last(wind->commodity_pages);
break;
default:
printf("QIF import: something fishy.\n");
prev = NULL;
break;
}
}
}
if(prev)
return (GtkWidget *)prev->data;
else
return NULL;
}
/********************************************************************
* gnc_ui_qif_import_generic_next_cb
* close the QIF Import druid window
********************************************************************/
gboolean
gnc_ui_qif_import_generic_next_cb(GnomeDruidPage * page, gpointer arg1,
gpointer user_data) {
GtkWidget * druid = GTK_WIDGET(user_data);
QIFImportWindow * wind =
gtk_object_get_data(GTK_OBJECT(druid), "qif_window_struct");
GtkWidget * next_page = get_next_druid_page(wind, page);
if(next_page) {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(next_page));
return TRUE;
}
else {
return FALSE;
}
}
/********************************************************************
* gnc_ui_qif_import_generic_back_cb
* close the QIF Import druid window
********************************************************************/
gboolean
gnc_ui_qif_import_generic_back_cb(GnomeDruidPage * page, gpointer arg1,
gpointer user_data) {
GtkWidget * druid = GTK_WIDGET(user_data);
QIFImportWindow * wind =
gtk_object_get_data(GTK_OBJECT(druid), "qif_window_struct");
GtkWidget * back_page = get_prev_druid_page(wind, page);
if(back_page) {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(back_page));
return TRUE;
}
else {
return FALSE;
}
}
/********************************************************************
* gnc_ui_qif_import_select_file_cb
@ -465,19 +657,18 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page,
if(ask_date_format) {
/* we need to get a date format, so go to the next page */
return FALSE;
return gnc_ui_qif_import_generic_next_cb(page, arg1, user_data);
}
else if(gh_call1(check_from_acct, gh_car(imported_files)) != SCM_BOOL_T) {
/* skip to the "ask account name" page */
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->account_name_page));
get_named_page(wind, "account_name_page"));
return TRUE;
}
else {
/* skip ahead to the "loaded files" page */
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->loaded_files_page));
get_named_page(wind, "loaded_files_page"));
return TRUE;
}
}
@ -506,7 +697,7 @@ gnc_ui_qif_import_date_format_next_cb(GnomeDruidPage * page,
else {
/* skip ahead to the "loaded files" page */
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->loaded_files_page));
get_named_page(wind, "loaded_files_page"));
return TRUE;
}
@ -568,7 +759,7 @@ gnc_ui_qif_import_load_another_cb(GtkButton * button,
gtk_object_get_data(GTK_OBJECT(user_data), "qif_window_struct");
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->load_file_page));
get_named_page(wind, "load_file_page"));
gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
TRUE, TRUE, TRUE);
}
@ -977,6 +1168,137 @@ gnc_ui_qif_import_categories_prepare_cb(GnomeDruidPage * page,
}
/****************************************************************
* gnc_ui_qif_import_convert
* do the work of actually translating QIF xtns to GNC xtns. Fill in
* the match page if there are matches.
****************************************************************/
static gboolean
gnc_ui_qif_import_convert(QIFImportWindow * wind) {
SCM qif_to_gnc = gh_eval_str("qif-import:qif-to-gnc");
SCM find_duplicates = gh_eval_str("gnc:group-find-duplicates");
SCM retval;
SCM current_xtn;
GnomeDruidPage * gtkpage;
QIFDruidPage * page;
GList * pageptr;
Transaction * gnc_xtn;
Split * gnc_split;
char * mnemonic = NULL;
char * namespace = NULL;
char * fullname = NULL;
gchar * row_text[4] = { NULL, NULL, NULL, NULL };
int rownum;
/* get the default currency */
char * currname = gtk_entry_get_text(GTK_ENTRY(wind->currency_entry));
/* busy cursor */
gnc_suspend_gui_refresh ();
gnc_set_busy_cursor(NULL);
/* get any changes to the imported stocks */
for(pageptr = wind->commodity_pages; pageptr; pageptr=pageptr->next) {
gtkpage = GNOME_DRUID_PAGE(pageptr->data);
page = gtk_object_get_data(GTK_OBJECT(gtkpage), "page_struct");
mnemonic = gtk_entry_get_text(GTK_ENTRY(page->new_mnemonic_entry));
namespace = gtk_entry_get_text(GTK_ENTRY(page->new_type_entry));
fullname = gtk_entry_get_text(GTK_ENTRY(page->new_name_entry));
gnc_commodity_set_namespace(page->commodity, namespace);
gnc_commodity_set_fullname(page->commodity, fullname);
gnc_commodity_set_mnemonic(page->commodity, mnemonic);
gnc_commodity_table_insert(gnc_engine_commodities(), page->commodity);
}
/* call a scheme function to do the work. The return value is an
* account group containing all the new accounts and transactions */
retval = gh_apply(qif_to_gnc,
SCM_LIST5(wind->imported_files,
wind->acct_map_info,
wind->cat_map_info,
wind->stock_hash,
gh_str02scm(currname)));
gnc_unset_busy_cursor(NULL);
if(retval == SCM_BOOL_F) {
gnc_error_dialog_parented(GTK_WINDOW(wind->window),
_("An error occurred while importing "
"QIF transactions into Gnucash. Your "
"accounts are unchanged."));
scm_unprotect_object(wind->imported_account_group);
wind->imported_account_group = SCM_BOOL_F;
scm_protect_object(wind->imported_account_group);
}
else {
scm_unprotect_object(wind->imported_account_group);
wind->imported_account_group = retval;
scm_protect_object(wind->imported_account_group);
/* now detect duplicate transactions */
gnc_set_busy_cursor(NULL);
retval = gh_call2(find_duplicates,
gh_eval_str("(gnc:get-current-group)"),
wind->imported_account_group);
gnc_unset_busy_cursor(NULL);
scm_unprotect_object(wind->match_transactions);
wind->match_transactions = retval;
scm_protect_object(wind->match_transactions);
/* skip to the last page if we couldn't find duplicates
* in the new group */
if((retval == SCM_BOOL_F) ||
(gh_null_p(retval))) {
gnc_resume_gui_refresh();
return FALSE;
}
/* otherwise, make up the display for the duplicates page */
gtk_clist_clear(GTK_CLIST(wind->new_transaction_list));
gtk_clist_freeze(GTK_CLIST(wind->new_transaction_list));
while(!gh_null_p(retval)) {
current_xtn = gh_caar(retval);
gnc_xtn = (Transaction *)gw_wcp_get_ptr(current_xtn);
gnc_split = xaccTransGetSplit(gnc_xtn, 0);
row_text[0] = gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn));
row_text[1] = xaccTransGetDescription(gnc_xtn);
if(xaccTransCountSplits(gnc_xtn) > 2) {
row_text[2] = g_strdup(_("(split)"));
}
else {
row_text[2] =
xaccPrintAmount(gnc_numeric_abs(xaccSplitGetValue(gnc_split)),
gnc_account_value_print_info
(xaccSplitGetAccount(gnc_split), TRUE));
}
rownum = gtk_clist_append(GTK_CLIST(wind->new_transaction_list),
row_text);
retval = gh_cdr(retval);
}
gtk_clist_thaw(GTK_CLIST(wind->new_transaction_list));
gtk_clist_select_row(GTK_CLIST(wind->new_transaction_list), 0, 0);
}
gnc_resume_gui_refresh();
return TRUE;
}
/********************************************************************
* gnc_ui_qif_import_categories_next_cb
********************************************************************/
@ -990,30 +1312,55 @@ gnc_ui_qif_import_categories_next_cb(GnomeDruidPage * page,
SCM any_new = gh_eval_str("qif-import:any-new-accts?");
SCM any_stock = gh_eval_str("qif-import:any-new-stock-accts?");
int show_matches;
/* if any accounts are new, ask about the currency; else,
* just skip that page */
if((gh_call1(any_new, wind->acct_map_info) == SCM_BOOL_T) ||
(gh_call1(any_new, wind->cat_map_info) == SCM_BOOL_T)) {
return FALSE;
/* go to currency page */
return gnc_ui_qif_import_generic_next_cb(page, arg1, user_data);
}
else {
/* if we need to look at stocks, do that, otherwise go
* to the end page */
/* if we need to look at stocks, do that, otherwise import
* xtns and go to the duplicates page */
if(gh_call1(any_stock, wind->acct_map_info) == SCM_BOOL_T) {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->commodity_doc_page));
if(wind->show_doc_pages) {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
get_named_page(wind, "commodity_doc_page"));
}
else {
gnc_ui_qif_import_commodity_prepare_cb(page, arg1, user_data);
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->commodity_pages->data));
}
return TRUE;
}
else {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->match_doc_page));
/* it's time to import the accounts. */
show_matches = gnc_ui_qif_import_convert(wind);
if(show_matches) {
if(wind->show_doc_pages) {
/* check for matches .. the docpage does it automatically */
gnome_druid_set_page(GNOME_DRUID(wind->druid),
get_named_page(wind, "match_doc_page"));
}
else {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
get_named_page(wind, "match_duplicates_page"));
}
}
else {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
get_named_page(wind, "end_page"));
}
return TRUE;
}
}
}
/********************************************************************
* gnc_ui_qif_import_currency_next_cb
********************************************************************/
@ -1025,17 +1372,44 @@ gnc_ui_qif_import_currency_next_cb(GnomeDruidPage * page,
QIFImportWindow * wind =
gtk_object_get_data(GTK_OBJECT(user_data), "qif_window_struct");
SCM any_stock = gh_eval_str("qif-import:any-new-stock-accts?");
int show_matches;
if(gh_call1(any_stock, wind->acct_map_info) == SCM_BOOL_T) {
return FALSE;
if(wind->show_doc_pages) {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
get_named_page(wind, "commodity_doc_page"));
}
else {
gnc_ui_qif_import_commodity_prepare_cb(page, arg1, user_data);
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->commodity_pages->data));
}
return TRUE;
}
else {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->match_doc_page));
/* it's time to import the accounts. */
show_matches = gnc_ui_qif_import_convert(wind);
if(show_matches) {
if(wind->show_doc_pages) {
/* check for matches .. the docpage does it automatically */
gnome_druid_set_page(GNOME_DRUID(wind->druid),
get_named_page(wind, "match_doc_page"));
}
else {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
get_named_page(wind, "match_duplicates_page"));
}
}
else {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
get_named_page(wind, "end_page"));
}
return TRUE;
}
}
static gboolean
gnc_ui_qif_import_comm_check_cb(GnomeDruidPage * page,
gpointer arg1,
@ -1087,7 +1461,7 @@ gnc_ui_qif_import_commodity_prepare_cb(GnomeDruidPage * page,
QIFDruidPage * new_page;
/* only set up once */
if(wind->pages) return;
if(wind->commodity_pages) return;
/* make a list of the new stocks that we need info about */
setup_info = gh_call1(setup_stock_hash, wind->acct_map_info);
@ -1108,7 +1482,8 @@ gnc_ui_qif_import_commodity_prepare_cb(GnomeDruidPage * page,
GTK_SIGNAL_FUNC(gnc_ui_qif_import_comm_check_cb),
wind->window);
wind->pages = g_list_append(wind->pages, new_page);
wind->commodity_pages = g_list_append(wind->commodity_pages,
new_page->page);
gnome_druid_insert_page(GNOME_DRUID(wind->druid),
back_page,
@ -1231,136 +1606,6 @@ make_qif_druid_page(gnc_commodity * comm) {
}
/****************************************************************
* qif_import_convert_cb
* do the work of actually translating QIF xtns to GNC xtns.
****************************************************************/
gboolean
gnc_ui_qif_import_convert_cb(GnomeDruidPage * gpage,
gpointer arg1,
gpointer user_data) {
SCM qif_to_gnc = gh_eval_str("qif-import:qif-to-gnc");
SCM find_duplicates = gh_eval_str("gnc:group-find-duplicates");
SCM retval;
SCM current_xtn;
QIFImportWindow * wind =
gtk_object_get_data(GTK_OBJECT(user_data), "qif_window_struct");
QIFDruidPage * page;
GList * pageptr;
Transaction * gnc_xtn;
Split * gnc_split;
char * mnemonic = NULL;
char * namespace = NULL;
char * fullname = NULL;
gchar * row_text[4] = { NULL, NULL, NULL, NULL };
int rownum;
/* get the default currency */
char * currname = gtk_entry_get_text(GTK_ENTRY(wind->currency_entry));
/* busy cursor */
gnc_suspend_gui_refresh ();
gnc_set_busy_cursor(NULL);
/* get any changes to the imported stocks */
for(pageptr = wind->pages; pageptr; pageptr=pageptr->next) {
page = (QIFDruidPage *)(pageptr->data);
mnemonic = gtk_entry_get_text(GTK_ENTRY(page->new_mnemonic_entry));
namespace = gtk_entry_get_text(GTK_ENTRY(page->new_type_entry));
fullname = gtk_entry_get_text(GTK_ENTRY(page->new_name_entry));
gnc_commodity_set_namespace(page->commodity, namespace);
gnc_commodity_set_fullname(page->commodity, fullname);
gnc_commodity_set_mnemonic(page->commodity, mnemonic);
gnc_commodity_table_insert(gnc_engine_commodities(), page->commodity);
}
/* call a scheme function to do the work. The return value is an
* account group containing all the new accounts and transactions */
retval = gh_apply(qif_to_gnc,
SCM_LIST5(wind->imported_files,
wind->acct_map_info,
wind->cat_map_info,
wind->stock_hash,
gh_str02scm(currname)));
gnc_unset_busy_cursor(NULL);
if(retval == SCM_BOOL_F) {
gnc_error_dialog_parented(GTK_WINDOW(wind->window),
_("An error occurred while importing "
"QIF transactions into Gnucash. Your "
"accounts are unchanged."));
scm_unprotect_object(wind->imported_account_group);
wind->imported_account_group = SCM_BOOL_F;
scm_protect_object(wind->imported_account_group);
}
else {
scm_unprotect_object(wind->imported_account_group);
wind->imported_account_group = retval;
scm_protect_object(wind->imported_account_group);
/* now detect duplicate transactions */
gnc_set_busy_cursor(NULL);
retval = gh_call2(find_duplicates,
gh_eval_str("(gnc:get-current-group)"),
wind->imported_account_group);
gnc_unset_busy_cursor(NULL);
scm_unprotect_object(wind->match_transactions);
wind->match_transactions = retval;
scm_protect_object(wind->match_transactions);
/* skip to the last page if we couldn't find duplicates
* in the new group */
if((retval == SCM_BOOL_F) ||
(gh_null_p(retval))) {
gnome_druid_set_page(GNOME_DRUID(wind->druid),
GNOME_DRUID_PAGE(wind->end_page));
gnc_resume_gui_refresh();
return TRUE;
}
/* otherwise, make up the display for the duplicates page */
gtk_clist_clear(GTK_CLIST(wind->new_transaction_list));
gtk_clist_freeze(GTK_CLIST(wind->new_transaction_list));
while(!gh_null_p(retval)) {
current_xtn = gh_caar(retval);
gnc_xtn = (Transaction *)gw_wcp_get_ptr(current_xtn);
gnc_split = xaccTransGetSplit(gnc_xtn, 0);
row_text[0] = gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn));
row_text[1] = xaccTransGetDescription(gnc_xtn);
if(xaccTransCountSplits(gnc_xtn) > 2) {
row_text[2] = g_strdup(_("(split)"));
}
else {
row_text[2] =
xaccPrintAmount(gnc_numeric_abs(xaccSplitGetValue(gnc_split)),
gnc_account_value_print_info
(xaccSplitGetAccount(gnc_split), TRUE));
}
rownum = gtk_clist_append(GTK_CLIST(wind->new_transaction_list),
row_text);
retval = gh_cdr(retval);
}
gtk_clist_thaw(GTK_CLIST(wind->new_transaction_list));
gtk_clist_select_row(GTK_CLIST(wind->new_transaction_list), 0, 0);
}
gnc_resume_gui_refresh();
return FALSE;
}
static void
refresh_old_transactions(QIFImportWindow * wind, int selection) {
SCM possible_matches;

View File

@ -219,3 +219,18 @@ gnc_ui_qif_import_duplicate_old_select_cb
gint column,
GdkEvent *event,
gpointer user_data);
gboolean
gnc_ui_qif_import_generic_next_cb (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data);
gboolean
gnc_ui_qif_import_generic_back_cb (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data);
gboolean
gnc_ui_qif_import_generic_next_cb (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data);

View File

@ -198,7 +198,7 @@ create_QIF_Import_Account_Picker (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox1), 8);
gnome_dialog_append_button (GNOME_DIALOG (QIF_Import_Account_Picker), GNOME_STOCK_BUTTON_OK);
button1 = g_list_last (GNOME_DIALOG (QIF_Import_Account_Picker)->buttons)->data;
button1 = GTK_WIDGET (g_list_last (GNOME_DIALOG (QIF_Import_Account_Picker)->buttons)->data);
gtk_widget_ref (button1);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "button1", button1,
(GtkDestroyNotify) gtk_widget_unref);
@ -206,7 +206,7 @@ create_QIF_Import_Account_Picker (void)
GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (QIF_Import_Account_Picker), GNOME_STOCK_BUTTON_CANCEL);
button2 = g_list_last (GNOME_DIALOG (QIF_Import_Account_Picker)->buttons)->data;
button2 = GTK_WIDGET (g_list_last (GNOME_DIALOG (QIF_Import_Account_Picker)->buttons)->data);
gtk_widget_ref (button2);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "button2", button2,
(GtkDestroyNotify) gtk_widget_unref);
@ -737,7 +737,7 @@ create_Print_Check_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area6), 8);
gnome_dialog_append_button (GNOME_DIALOG (Print_Check_Dialog), GNOME_STOCK_BUTTON_OK);
button21 = g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data;
button21 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data);
gtk_widget_ref (button21);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "button21", button21,
(GtkDestroyNotify) gtk_widget_unref);
@ -745,7 +745,7 @@ create_Print_Check_Dialog (void)
GTK_WIDGET_SET_FLAGS (button21, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Print_Check_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button22 = g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data;
button22 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data);
gtk_widget_ref (button22);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "button22", button22,
(GtkDestroyNotify) gtk_widget_unref);
@ -753,7 +753,7 @@ create_Print_Check_Dialog (void)
GTK_WIDGET_SET_FLAGS (button22, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Print_Check_Dialog), GNOME_STOCK_BUTTON_HELP);
button23 = g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data;
button23 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data);
gtk_widget_ref (button23);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "button23", button23,
(GtkDestroyNotify) gtk_widget_unref);
@ -1763,7 +1763,7 @@ create_Find_Transactions (void)
gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (Find_Transactions),
_("Find"), GNOME_STOCK_PIXMAP_SEARCH);
button26 = g_list_last (GNOME_DIALOG (Find_Transactions)->buttons)->data;
button26 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Find_Transactions)->buttons)->data);
gtk_widget_ref (button26);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "button26", button26,
(GtkDestroyNotify) gtk_widget_unref);
@ -1771,7 +1771,7 @@ create_Find_Transactions (void)
GTK_WIDGET_SET_FLAGS (button26, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Find_Transactions), GNOME_STOCK_BUTTON_CANCEL);
button27 = g_list_last (GNOME_DIALOG (Find_Transactions)->buttons)->data;
button27 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Find_Transactions)->buttons)->data);
gtk_widget_ref (button27);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "button27", button27,
(GtkDestroyNotify) gtk_widget_unref);
@ -1779,7 +1779,7 @@ create_Find_Transactions (void)
GTK_WIDGET_SET_FLAGS (button27, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Find_Transactions), GNOME_STOCK_BUTTON_HELP);
button28 = g_list_last (GNOME_DIALOG (Find_Transactions)->buttons)->data;
button28 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Find_Transactions)->buttons)->data);
gtk_widget_ref (button28);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "button28", button28,
(GtkDestroyNotify) gtk_widget_unref);
@ -2316,7 +2316,7 @@ create_Budget_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area9), 8);
gnome_dialog_append_button (GNOME_DIALOG (Budget_Dialog), GNOME_STOCK_BUTTON_OK);
ok_button = g_list_last (GNOME_DIALOG (Budget_Dialog)->buttons)->data;
ok_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Budget_Dialog)->buttons)->data);
gtk_widget_ref (ok_button);
gtk_object_set_data_full (GTK_OBJECT (Budget_Dialog), "ok_button", ok_button,
(GtkDestroyNotify) gtk_widget_unref);
@ -2324,7 +2324,7 @@ create_Budget_Dialog (void)
GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Budget_Dialog), GNOME_STOCK_BUTTON_APPLY);
apply_button = g_list_last (GNOME_DIALOG (Budget_Dialog)->buttons)->data;
apply_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Budget_Dialog)->buttons)->data);
gtk_widget_ref (apply_button);
gtk_object_set_data_full (GTK_OBJECT (Budget_Dialog), "apply_button", apply_button,
(GtkDestroyNotify) gtk_widget_unref);
@ -2332,7 +2332,7 @@ create_Budget_Dialog (void)
GTK_WIDGET_SET_FLAGS (apply_button, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Budget_Dialog), GNOME_STOCK_BUTTON_CANCEL);
cancel_button = g_list_last (GNOME_DIALOG (Budget_Dialog)->buttons)->data;
cancel_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Budget_Dialog)->buttons)->data);
gtk_widget_ref (cancel_button);
gtk_object_set_data_full (GTK_OBJECT (Budget_Dialog), "cancel_button", cancel_button,
(GtkDestroyNotify) gtk_widget_unref);
@ -2340,7 +2340,7 @@ create_Budget_Dialog (void)
GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Budget_Dialog), GNOME_STOCK_BUTTON_HELP);
help_button = g_list_last (GNOME_DIALOG (Budget_Dialog)->buttons)->data;
help_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Budget_Dialog)->buttons)->data);
gtk_widget_ref (help_button);
gtk_object_set_data_full (GTK_OBJECT (Budget_Dialog), "help_button", help_button,
(GtkDestroyNotify) gtk_widget_unref);
@ -2891,7 +2891,7 @@ create_Financial_Calculator_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area10), 8);
gnome_dialog_append_button (GNOME_DIALOG (Financial_Calculator_Dialog), _("Schedule"));
schedule_button = g_list_last (GNOME_DIALOG (Financial_Calculator_Dialog)->buttons)->data;
schedule_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Financial_Calculator_Dialog)->buttons)->data);
gtk_widget_ref (schedule_button);
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "schedule_button", schedule_button,
(GtkDestroyNotify) gtk_widget_unref);
@ -2899,7 +2899,7 @@ create_Financial_Calculator_Dialog (void)
GTK_WIDGET_SET_FLAGS (schedule_button, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Financial_Calculator_Dialog), GNOME_STOCK_BUTTON_CLOSE);
close_button = g_list_last (GNOME_DIALOG (Financial_Calculator_Dialog)->buttons)->data;
close_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Financial_Calculator_Dialog)->buttons)->data);
gtk_widget_ref (close_button);
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "close_button", close_button,
(GtkDestroyNotify) gtk_widget_unref);
@ -3105,7 +3105,7 @@ create_Amortization_Schedule_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area11), 8);
gnome_dialog_append_button (GNOME_DIALOG (Amortization_Schedule_Dialog), GNOME_STOCK_BUTTON_OK);
button60 = g_list_last (GNOME_DIALOG (Amortization_Schedule_Dialog)->buttons)->data;
button60 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Amortization_Schedule_Dialog)->buttons)->data);
gtk_widget_ref (button60);
gtk_object_set_data_full (GTK_OBJECT (Amortization_Schedule_Dialog), "button60", button60,
(GtkDestroyNotify) gtk_widget_unref);
@ -3113,7 +3113,7 @@ create_Amortization_Schedule_Dialog (void)
GTK_WIDGET_SET_FLAGS (button60, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Amortization_Schedule_Dialog), GNOME_STOCK_BUTTON_APPLY);
button61 = g_list_last (GNOME_DIALOG (Amortization_Schedule_Dialog)->buttons)->data;
button61 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Amortization_Schedule_Dialog)->buttons)->data);
gtk_widget_ref (button61);
gtk_object_set_data_full (GTK_OBJECT (Amortization_Schedule_Dialog), "button61", button61,
(GtkDestroyNotify) gtk_widget_unref);
@ -3121,7 +3121,7 @@ create_Amortization_Schedule_Dialog (void)
GTK_WIDGET_SET_FLAGS (button61, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Amortization_Schedule_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button62 = g_list_last (GNOME_DIALOG (Amortization_Schedule_Dialog)->buttons)->data;
button62 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Amortization_Schedule_Dialog)->buttons)->data);
gtk_widget_ref (button62);
gtk_object_set_data_full (GTK_OBJECT (Amortization_Schedule_Dialog), "button62", button62,
(GtkDestroyNotify) gtk_widget_unref);
@ -3233,7 +3233,7 @@ create_Commodity_Selector_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area12), 8);
gnome_dialog_append_button (GNOME_DIALOG (Commodity_Selector_Dialog), GNOME_STOCK_BUTTON_OK);
button63 = g_list_last (GNOME_DIALOG (Commodity_Selector_Dialog)->buttons)->data;
button63 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Commodity_Selector_Dialog)->buttons)->data);
gtk_widget_ref (button63);
gtk_object_set_data_full (GTK_OBJECT (Commodity_Selector_Dialog), "button63", button63,
(GtkDestroyNotify) gtk_widget_unref);
@ -3241,7 +3241,7 @@ create_Commodity_Selector_Dialog (void)
GTK_WIDGET_SET_FLAGS (button63, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Commodity_Selector_Dialog), _("New..."));
button64 = g_list_last (GNOME_DIALOG (Commodity_Selector_Dialog)->buttons)->data;
button64 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Commodity_Selector_Dialog)->buttons)->data);
gtk_widget_ref (button64);
gtk_object_set_data_full (GTK_OBJECT (Commodity_Selector_Dialog), "button64", button64,
(GtkDestroyNotify) gtk_widget_unref);
@ -3249,7 +3249,7 @@ create_Commodity_Selector_Dialog (void)
GTK_WIDGET_SET_FLAGS (button64, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Commodity_Selector_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button65 = g_list_last (GNOME_DIALOG (Commodity_Selector_Dialog)->buttons)->data;
button65 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Commodity_Selector_Dialog)->buttons)->data);
gtk_widget_ref (button65);
gtk_object_set_data_full (GTK_OBJECT (Commodity_Selector_Dialog), "button65", button65,
(GtkDestroyNotify) gtk_widget_unref);
@ -3437,7 +3437,7 @@ create_New_Commodity_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area13), 8);
gnome_dialog_append_button (GNOME_DIALOG (New_Commodity_Dialog), GNOME_STOCK_BUTTON_OK);
button66 = g_list_last (GNOME_DIALOG (New_Commodity_Dialog)->buttons)->data;
button66 = GTK_WIDGET (g_list_last (GNOME_DIALOG (New_Commodity_Dialog)->buttons)->data);
gtk_widget_ref (button66);
gtk_object_set_data_full (GTK_OBJECT (New_Commodity_Dialog), "button66", button66,
(GtkDestroyNotify) gtk_widget_unref);
@ -3445,7 +3445,7 @@ create_New_Commodity_Dialog (void)
GTK_WIDGET_SET_FLAGS (button66, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (New_Commodity_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button67 = g_list_last (GNOME_DIALOG (New_Commodity_Dialog)->buttons)->data;
button67 = GTK_WIDGET (g_list_last (GNOME_DIALOG (New_Commodity_Dialog)->buttons)->data);
gtk_widget_ref (button67);
gtk_object_set_data_full (GTK_OBJECT (New_Commodity_Dialog), "button67", button67,
(GtkDestroyNotify) gtk_widget_unref);
@ -3453,7 +3453,7 @@ create_New_Commodity_Dialog (void)
GTK_WIDGET_SET_FLAGS (button67, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (New_Commodity_Dialog), GNOME_STOCK_BUTTON_HELP);
button68 = g_list_last (GNOME_DIALOG (New_Commodity_Dialog)->buttons)->data;
button68 = GTK_WIDGET (g_list_last (GNOME_DIALOG (New_Commodity_Dialog)->buttons)->data);
gtk_widget_ref (button68);
gtk_object_set_data_full (GTK_OBJECT (New_Commodity_Dialog), "button68", button68,
(GtkDestroyNotify) gtk_widget_unref);
@ -3761,7 +3761,7 @@ create_Account_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area12), 8);
gnome_dialog_append_button (GNOME_DIALOG (Account_Dialog), GNOME_STOCK_BUTTON_OK);
button63 = g_list_last (GNOME_DIALOG (Account_Dialog)->buttons)->data;
button63 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Account_Dialog)->buttons)->data);
gtk_widget_ref (button63);
gtk_object_set_data_full (GTK_OBJECT (Account_Dialog), "button63", button63,
(GtkDestroyNotify) gtk_widget_unref);
@ -3769,7 +3769,7 @@ create_Account_Dialog (void)
GTK_WIDGET_SET_FLAGS (button63, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Account_Dialog), GNOME_STOCK_BUTTON_CANCEL);
cancel_button = g_list_last (GNOME_DIALOG (Account_Dialog)->buttons)->data;
cancel_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Account_Dialog)->buttons)->data);
gtk_widget_ref (cancel_button);
gtk_object_set_data_full (GTK_OBJECT (Account_Dialog), "cancel_button", cancel_button,
(GtkDestroyNotify) gtk_widget_unref);
@ -3777,7 +3777,7 @@ create_Account_Dialog (void)
GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Account_Dialog), GNOME_STOCK_BUTTON_HELP);
button72 = g_list_last (GNOME_DIALOG (Account_Dialog)->buttons)->data;
button72 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Account_Dialog)->buttons)->data);
gtk_widget_ref (button72);
gtk_object_set_data_full (GTK_OBJECT (Account_Dialog), "button72", button72,
(GtkDestroyNotify) gtk_widget_unref);
@ -4647,15 +4647,24 @@ create_QIF_Import_Druid (void)
gtk_signal_connect (GTK_OBJECT (qif_import_druid), "cancel",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_cancel_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (start_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (load_file_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_load_file_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (load_file_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (button71), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_select_file_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (date_format_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_date_format_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (date_format_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (account_name_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_default_acct_next_cb),
QIF_Import_Druid);
@ -4665,6 +4674,12 @@ create_QIF_Import_Druid (void)
gtk_signal_connect (GTK_OBJECT (loaded_files_page), "prepare",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_loaded_files_prepare_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (loaded_files_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (loaded_files_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (selected_file_list), "select_row",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_select_loaded_file_cb),
QIF_Import_Druid);
@ -4674,29 +4689,68 @@ create_QIF_Import_Druid (void)
gtk_signal_connect (GTK_OBJECT (button70), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_unload_file_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (account_doc_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (account_doc_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (account_match_page), "prepare",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_accounts_prepare_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (account_match_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (account_match_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (account_page_list), "select_row",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_account_line_select_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (category_doc_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (category_doc_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (category_match_page), "prepare",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_categories_prepare_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (category_match_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_categories_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (category_match_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (category_page_list), "select_row",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_category_line_select_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (currency_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_currency_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (currency_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (commodity_doc_page), "prepare",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_commodity_prepare_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (commodity_doc_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (commodity_doc_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (match_doc_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_convert_cb),
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (match_doc_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (match_duplicates_page), "next",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_next_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (match_duplicates_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (new_transaction_list), "select_row",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_duplicate_new_select_cb),
@ -4707,6 +4761,9 @@ create_QIF_Import_Druid (void)
gtk_signal_connect (GTK_OBJECT (end_page), "finish",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_finish_cb),
QIF_Import_Druid);
gtk_signal_connect (GTK_OBJECT (end_page), "back",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_generic_back_cb),
QIF_Import_Druid);
gtk_widget_grab_default (qif_filename_entry);
return QIF_Import_Druid;
@ -5100,7 +5157,7 @@ create_Transfer_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area13), 8);
gnome_dialog_append_button (GNOME_DIALOG (Transfer_Dialog), GNOME_STOCK_BUTTON_OK);
button66 = g_list_last (GNOME_DIALOG (Transfer_Dialog)->buttons)->data;
button66 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Transfer_Dialog)->buttons)->data);
gtk_widget_ref (button66);
gtk_object_set_data_full (GTK_OBJECT (Transfer_Dialog), "button66", button66,
(GtkDestroyNotify) gtk_widget_unref);
@ -5108,7 +5165,7 @@ create_Transfer_Dialog (void)
GTK_WIDGET_SET_FLAGS (button66, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Transfer_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button68 = g_list_last (GNOME_DIALOG (Transfer_Dialog)->buttons)->data;
button68 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Transfer_Dialog)->buttons)->data);
gtk_widget_ref (button68);
gtk_object_set_data_full (GTK_OBJECT (Transfer_Dialog), "button68", button68,
(GtkDestroyNotify) gtk_widget_unref);
@ -5562,7 +5619,7 @@ create_New_Style_Sheet_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area15), 8);
gnome_dialog_append_button (GNOME_DIALOG (New_Style_Sheet_Dialog), GNOME_STOCK_BUTTON_OK);
button73 = g_list_last (GNOME_DIALOG (New_Style_Sheet_Dialog)->buttons)->data;
button73 = GTK_WIDGET (g_list_last (GNOME_DIALOG (New_Style_Sheet_Dialog)->buttons)->data);
gtk_widget_ref (button73);
gtk_object_set_data_full (GTK_OBJECT (New_Style_Sheet_Dialog), "button73", button73,
(GtkDestroyNotify) gtk_widget_unref);
@ -5570,7 +5627,7 @@ create_New_Style_Sheet_Dialog (void)
GTK_WIDGET_SET_FLAGS (button73, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (New_Style_Sheet_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button75 = g_list_last (GNOME_DIALOG (New_Style_Sheet_Dialog)->buttons)->data;
button75 = GTK_WIDGET (g_list_last (GNOME_DIALOG (New_Style_Sheet_Dialog)->buttons)->data);
gtk_widget_ref (button75);
gtk_object_set_data_full (GTK_OBJECT (New_Style_Sheet_Dialog), "button75", button75,
(GtkDestroyNotify) gtk_widget_unref);
@ -5787,7 +5844,7 @@ create_Tax_Information_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area14), 8);
gnome_dialog_append_button (GNOME_DIALOG (Tax_Information_Dialog), GNOME_STOCK_BUTTON_OK);
button73 = g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data;
button73 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data);
gtk_widget_ref (button73);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "button73", button73,
(GtkDestroyNotify) gtk_widget_unref);
@ -5795,7 +5852,7 @@ create_Tax_Information_Dialog (void)
GTK_WIDGET_SET_FLAGS (button73, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Tax_Information_Dialog), GNOME_STOCK_BUTTON_APPLY);
button74 = g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data;
button74 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data);
gtk_widget_ref (button74);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "button74", button74,
(GtkDestroyNotify) gtk_widget_unref);
@ -5803,7 +5860,7 @@ create_Tax_Information_Dialog (void)
GTK_WIDGET_SET_FLAGS (button74, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Tax_Information_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button75 = g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data;
button75 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data);
gtk_widget_ref (button75);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "button75", button75,
(GtkDestroyNotify) gtk_widget_unref);
@ -5908,7 +5965,7 @@ create_Duplicate_Transaction_Dialog (void)
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area15), 8);
gnome_dialog_append_button (GNOME_DIALOG (Duplicate_Transaction_Dialog), GNOME_STOCK_BUTTON_OK);
button76 = g_list_last (GNOME_DIALOG (Duplicate_Transaction_Dialog)->buttons)->data;
button76 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Duplicate_Transaction_Dialog)->buttons)->data);
gtk_widget_ref (button76);
gtk_object_set_data_full (GTK_OBJECT (Duplicate_Transaction_Dialog), "button76", button76,
(GtkDestroyNotify) gtk_widget_unref);
@ -5916,7 +5973,7 @@ create_Duplicate_Transaction_Dialog (void)
GTK_WIDGET_SET_FLAGS (button76, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Duplicate_Transaction_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button77 = g_list_last (GNOME_DIALOG (Duplicate_Transaction_Dialog)->buttons)->data;
button77 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Duplicate_Transaction_Dialog)->buttons)->data);
gtk_widget_ref (button77);
gtk_object_set_data_full (GTK_OBJECT (Duplicate_Transaction_Dialog), "button77", button77,
(GtkDestroyNotify) gtk_widget_unref);

View File

@ -2970,6 +2970,7 @@ Exactly
<can_default>True</can_default>
<can_focus>True</can_focus>
<label>Add</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
@ -2979,6 +2980,7 @@ Exactly
<can_default>True</can_default>
<can_focus>True</can_focus>
<label>Delete</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
@ -2999,6 +3001,7 @@ Exactly
<tooltip>Move the selected item up</tooltip>
<can_focus>True</can_focus>
<label></label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3012,6 +3015,7 @@ Exactly
<tooltip>Move the selected item down</tooltip>
<can_focus>True</can_focus>
<label></label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3165,6 +3169,7 @@ No Total
<name>match_button</name>
<can_focus>True</can_focus>
<label>Matching Transactions...</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>True</expand>
@ -3586,6 +3591,7 @@ Contingency
<tooltip>Clear the entry</tooltip>
<can_focus>True</can_focus>
<label>Clear</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3599,6 +3605,7 @@ Contingency
<name>payment_periods_calc_button</name>
<can_focus>True</can_focus>
<label>Calculate</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3670,6 +3677,7 @@ Contingency
<tooltip>Clear the entry</tooltip>
<can_focus>True</can_focus>
<label>Clear</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3683,6 +3691,7 @@ Contingency
<name>interest_rate_calc_button</name>
<can_focus>True</can_focus>
<label>Calculate</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3754,6 +3763,7 @@ Contingency
<tooltip>Clear the entry</tooltip>
<can_focus>True</can_focus>
<label>Clear</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3767,6 +3777,7 @@ Contingency
<name>present_value_calc_button</name>
<can_focus>True</can_focus>
<label>Calculate</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3838,6 +3849,7 @@ Contingency
<tooltip>Clear the entry</tooltip>
<can_focus>True</can_focus>
<label>Clear</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3851,6 +3863,7 @@ Contingency
<name>periodic_payment_calc_button</name>
<can_focus>True</can_focus>
<label>Calculate</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3922,6 +3935,7 @@ Contingency
<tooltip>Clear the entry</tooltip>
<can_focus>True</can_focus>
<label>Clear</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -3935,6 +3949,7 @@ Contingency
<name>future_value_calc_button</name>
<can_focus>True</can_focus>
<label>Calculate</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -5605,6 +5620,12 @@ Click &quot;Back&quot; to review your currency selections.</text>
<widget>
<class>GnomeDruidPageStart</class>
<name>start_page</name>
<signal>
<name>next</name>
<handler>gnc_ui_qif_import_generic_next_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:04:30 GMT</last_modification_time>
</signal>
<title>Import QIF files</title>
<text>Gnucash can import financial data from QIF (Quicken
Interchange Format) files written by Quicken/Quickbooks,
@ -5632,6 +5653,12 @@ to abort the process. </text>
<data>QIF_Import_Druid</data>
<last_modification_time>Wed, 30 Aug 2000 14:30:37 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:05:58 GMT</last_modification_time>
</signal>
<title>Select a QIF file to load</title>
<title_color>255,255,255</title_color>
<background_color>153,191,154</background_color>
@ -5728,6 +5755,7 @@ worry if your data is in multiple files.
<last_modification_time>Wed, 30 Aug 2000 17:33:50 GMT</last_modification_time>
</signal>
<label>Select...</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>3</padding>
<expand>False</expand>
@ -5747,6 +5775,12 @@ worry if your data is in multiple files.
<data>QIF_Import_Druid</data>
<last_modification_time>Wed, 04 Oct 2000 15:56:16 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:06:44 GMT</last_modification_time>
</signal>
<title>Set a date format for this QIF file</title>
<title_color>255,255,255</title_color>
<background_color>153,191,154</background_color>
@ -5929,6 +5963,18 @@ in that program.
<data>QIF_Import_Druid</data>
<last_modification_time>Wed, 30 Aug 2000 22:42:22 GMT</last_modification_time>
</signal>
<signal>
<name>next</name>
<handler>gnc_ui_qif_import_generic_next_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:07:56 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:08:05 GMT</last_modification_time>
</signal>
<title>QIF files you have loaded</title>
<title_color>255,255,255</title_color>
<background_color>153,191,153</background_color>
@ -6041,6 +6087,7 @@ of the QIF import process. </label>
<last_modification_time>Wed, 30 Aug 2000 15:32:12 GMT</last_modification_time>
</signal>
<label>Load another file</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>True</expand>
@ -6059,6 +6106,7 @@ of the QIF import process. </label>
<last_modification_time>Wed, 30 Aug 2000 15:34:33 GMT</last_modification_time>
</signal>
<label>Unload selected file</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>True</expand>
@ -6072,6 +6120,18 @@ of the QIF import process. </label>
<widget>
<class>GnomeDruidPageStandard</class>
<name>account_doc_page</name>
<signal>
<name>next</name>
<handler>gnc_ui_qif_import_generic_next_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:08:41 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:08:52 GMT</last_modification_time>
</signal>
<title>Your accounts and stock holdings</title>
<title_color>255,255,255</title_color>
<background_color>153,191,153</background_color>
@ -6130,6 +6190,18 @@ page so you can change them if you want to, but it is safe to leave them alone.
<data>QIF_Import_Druid</data>
<last_modification_time>Thu, 31 Aug 2000 14:19:54 GMT</last_modification_time>
</signal>
<signal>
<name>next</name>
<handler>gnc_ui_qif_import_generic_next_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:09:25 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:09:37 GMT</last_modification_time>
</signal>
<title>Match QIF accounts with Gnucash accounts</title>
<title_color>255,255,255</title_color>
<background_color>153,191,153</background_color>
@ -6239,6 +6311,18 @@ page so you can change them if you want to, but it is safe to leave them alone.
<widget>
<class>GnomeDruidPageStandard</class>
<name>category_doc_page</name>
<signal>
<name>next</name>
<handler>gnc_ui_qif_import_generic_next_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:10:09 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:10:35 GMT</last_modification_time>
</signal>
<title>Income and expense categories</title>
<title_color>255,255,255</title_color>
<background_color>153,191,154</background_color>
@ -6299,6 +6383,12 @@ within GnuCash.</label>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 05 Sep 2000 17:18:38 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:12:18 GMT</last_modification_time>
</signal>
<title>Match QIF categories with Gnucash accounts</title>
<title_color>255,255,255</title_color>
<background_color>154,191,154</background_color>
@ -6414,6 +6504,12 @@ within GnuCash.</label>
<data>QIF_Import_Druid</data>
<last_modification_time>Wed, 06 Sep 2000 15:12:05 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:12:42 GMT</last_modification_time>
</signal>
<title>Enter the currency used for new accounts</title>
<title_color>255,255,255</title_color>
<background_color>153,191,154</background_color>
@ -6510,6 +6606,18 @@ mutual funds in the imported data.</label>
<data>QIF_Import_Druid</data>
<last_modification_time>Wed, 06 Sep 2000 17:24:11 GMT</last_modification_time>
</signal>
<signal>
<name>next</name>
<handler>gnc_ui_qif_import_generic_next_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:13:29 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:13:38 GMT</last_modification_time>
</signal>
<title>Tradable commodities</title>
<title_color>255,255,255</title_color>
<background_color>153,191,154</background_color>
@ -6564,9 +6672,15 @@ or listing for its type.
<name>match_doc_page</name>
<signal>
<name>next</name>
<handler>gnc_ui_qif_import_convert_cb</handler>
<handler>gnc_ui_qif_import_generic_next_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Sat, 03 Feb 2001 19:33:19 GMT</last_modification_time>
<last_modification_time>Tue, 06 Feb 2001 20:54:18 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:14:04 GMT</last_modification_time>
</signal>
<title>Match duplicate transactions</title>
<title_color>255,255,255</title_color>
@ -6622,6 +6736,18 @@ Click &quot;Next&quot; to find duplicate transactions. </label>
<widget>
<class>GnomeDruidPageStandard</class>
<name>match_duplicates_page</name>
<signal>
<name>next</name>
<handler>gnc_ui_qif_import_generic_next_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:15:14 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:15:23 GMT</last_modification_time>
</signal>
<title>Select possible duplicates</title>
<title_color>255,255,255</title_color>
<background_color>153,191,154</background_color>
@ -6831,6 +6957,12 @@ Click &quot;Next&quot; to find duplicate transactions. </label>
<data>QIF_Import_Druid</data>
<last_modification_time>Wed, 30 Aug 2000 15:07:20 GMT</last_modification_time>
</signal>
<signal>
<name>back</name>
<handler>gnc_ui_qif_import_generic_back_cb</handler>
<data>QIF_Import_Druid</data>
<last_modification_time>Tue, 06 Feb 2001 17:16:05 GMT</last_modification_time>
</signal>
<title>Update your Gnucash accounts</title>
<text>Click &quot;Finish&quot; to import data from the staging area and update
your Gnucash accounts. The account and category matching
@ -7588,6 +7720,7 @@ Click &quot;Cancel&quot; to abort the QIF import process.</text>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
@ -7597,6 +7730,7 @@ Click &quot;Cancel&quot; to abort the QIF import process.</text>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
@ -7809,6 +7943,7 @@ words.
<last_modification_time>Fri, 15 Dec 2000 18:13:53 GMT</last_modification_time>
</signal>
<label>Search</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>True</expand>
@ -7827,6 +7962,7 @@ words.
<last_modification_time>Fri, 15 Dec 2000 18:14:21 GMT</last_modification_time>
</signal>
<label>Help</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>True</expand>
@ -8308,6 +8444,7 @@ words.
<border_width>3</border_width>
<can_focus>True</can_focus>
<label>Select Subaccounts</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -8321,6 +8458,7 @@ words.
<border_width>3</border_width>
<can_focus>True</can_focus>
<label>Unselect Subaccounts</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@ -8778,6 +8916,7 @@ words.
<name>new_button</name>
<can_focus>True</can_focus>
<label>New...</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>True</expand>
@ -8790,6 +8929,7 @@ words.
<name>delete_button</name>
<can_focus>True</can_focus>
<label>Delete</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>True</expand>

View File

@ -864,6 +864,7 @@ gnc_html_submit_cb(GtkHTML * html, const gchar * method,
printf("POST submit: m='%s', a='%s', e='%s'\n",
method, action, encoding);
}
return TRUE;
}
@ -911,6 +912,7 @@ gnc_html_open_report(gnc_html * html, const gchar * location,
gnc_html_history_append(html->history,
gnc_html_history_node_new(URL_TYPE_REPORT,
location, label));
g_free(html->base_location);
html->base_type = URL_TYPE_FILE;
html->base_location = NULL;

View File

@ -191,8 +191,13 @@ gnc_report_window_load_cb(gnc_html * html, URLType type,
/* get the inst-report from the Scheme-side hash, and get its
* options */
inst_report = gh_call1(find_report, gh_int2scm(report_id));
if(inst_report == SCM_BOOL_F) {
return;
}
inst_options = gh_call1(get_options, inst_report);
/* get rid of the options dialog, unless it's just for a reload */
if(!gh_eq_p(inst_options, win->scm_options)) {
if(win->odb)
@ -321,8 +326,8 @@ gnc_report_window_history_destroy_cb(gnc_html_history_node * node,
(node->type == URL_TYPE_REPORT) &&
!strncmp("id=", node->location, 3)) {
sscanf(node->location+3, "%d", &report_id);
printf("unreffing report %d and children\n", report_id);
gh_call1(remover, gh_int2scm(report_id));
/* printf("unreffing report %d and children\n", report_id);
gh_call1(remover, gh_int2scm(report_id)); */
}
else {
return;

View File

@ -225,86 +225,89 @@
(display " ")))
nlist)))))
(with-output-to-string
(lambda ()
(let ((title (gnc:html-barchart-title barchart))
(subtitle (gnc:html-barchart-subtitle barchart))
(x-label (gnc:html-barchart-x-axis-label barchart))
(y-label (gnc:html-barchart-y-axis-label barchart))
(data (gnc:html-barchart-data barchart))
(row-labels (catenate-escaped-strings
(gnc:html-barchart-row-labels barchart)))
(col-labels (catenate-escaped-strings
(gnc:html-barchart-col-labels barchart)))
(col-colors (catenate-escaped-strings
(gnc:html-barchart-col-colors barchart))))
(if (and (list? data)
(not (null? data)))
(begin
(display "<object classid=\"gnc-guppi-bar\" width=")
(display (gnc:html-barchart-width barchart))
(display " height=")
(display (gnc:html-barchart-height barchart))
(display ">\n")
(if title
(begin
(display " <param name=\"title\" value=\"")
(display title) (display "\">\n")))
(if subtitle
(begin
(display " <param name=\"subtitle\" value=\"")
(display subtitle) (display "\">\n")))
(if (and data (list? data))
(let ((rows (length data))
(cols 0))
(display " <param name=\"data_rows\" value=\"")
(display rows) (display "\">\n")
(if (list? (car data))
(begin
(set! cols (length (car data)))
(display " <param name=\"data_cols\" value=\"")
(display cols)
(display "\">\n")))
(display " <param name=\"data\" value=\"")
(let loop ((col 0))
(for-each-in-order
(lambda (row)
(display (ensure-numeric (list-ref-safe row col)))
(display " "))
data)
(if (< col (- cols 1))
(loop (+ 1 col))))
(display "\">\n")))
(if (and (string? x-label) (> (string-length x-label) 0))
(begin
(display " <param name=\"x_axis_label\" value=\"")
(display x-label)
(display "\">\n")))
(if (and (string? y-label) (> (string-length y-label) 0))
(begin
(display " <param name=\"y_axis_label\" value=\"")
(display y-label)
(display "\">\n")))
(if (and (string? col-colors) (> (string-length col-colors) 0))
(begin
(display " <param name=\"col_colors\" value=\"")
(display col-colors)
(display "\">\n")))
(if (and (string? row-labels) (> (string-length row-labels) 0))
(begin
(display " <param name=\"row_labels\" value=\"")
(display row-labels)
(display "\">\n")))
(if (and (string? col-labels) (> (string-length col-labels) 0))
(begin
(display " <param name=\"col_labels\" value=\"")
(display col-labels)
(display "\">\n")))
(let ((rot? (gnc:html-barchart-row-labels-rotated? barchart)))
(display " <param name=\"rotate_row_labels\" value=\"")
(if rot?
(display "1\">\n")
(display "0\">\n")))
(display "Unable to display bar chart\n")
(display "</object>"))
" ")))))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval))))
(title (gnc:html-barchart-title barchart))
(subtitle (gnc:html-barchart-subtitle barchart))
(x-label (gnc:html-barchart-x-axis-label barchart))
(y-label (gnc:html-barchart-y-axis-label barchart))
(data (gnc:html-barchart-data barchart))
(row-labels (catenate-escaped-strings
(gnc:html-barchart-row-labels barchart)))
(col-labels (catenate-escaped-strings
(gnc:html-barchart-col-labels barchart)))
(col-colors (catenate-escaped-strings
(gnc:html-barchart-col-colors barchart))))
(if (and (list? data)
(not (null? data)))
(begin
(push "<object classid=\"gnc-guppi-bar\" width=")
(push (gnc:html-barchart-width barchart))
(push " height=")
(push (gnc:html-barchart-height barchart))
(push ">\n")
(if title
(begin
(push " <param name=\"title\" value=\"")
(push title) (push "\">\n")))
(if subtitle
(begin
(push " <param name=\"subtitle\" value=\"")
(push subtitle) (push "\">\n")))
(if (and data (list? data))
(let ((rows (length data))
(cols 0))
(push " <param name=\"data_rows\" value=\"")
(push rows) (push "\">\n")
(if (list? (car data))
(begin
(set! cols (length (car data)))
(push " <param name=\"data_cols\" value=\"")
(push cols)
(push "\">\n")))
(push " <param name=\"data\" value=\"")
(let loop ((col 0))
(for-each-in-order
(lambda (row)
(push (ensure-numeric (list-ref-safe row col)))
(push " "))
data)
(if (< col (- cols 1))
(loop (+ 1 col))))
(push "\">\n")))
(if (and (string? x-label) (> (string-length x-label) 0))
(begin
(push " <param name=\"x_axis_label\" value=\"")
(push x-label)
(push "\">\n")))
(if (and (string? y-label) (> (string-length y-label) 0))
(begin
(push " <param name=\"y_axis_label\" value=\"")
(push y-label)
(push "\">\n")))
(if (and (string? col-colors) (> (string-length col-colors) 0))
(begin
(push " <param name=\"col_colors\" value=\"")
(push col-colors)
(push "\">\n")))
(if (and (string? row-labels) (> (string-length row-labels) 0))
(begin
(push " <param name=\"row_labels\" value=\"")
(push row-labels)
(push "\">\n")))
(if (and (string? col-labels) (> (string-length col-labels) 0))
(begin
(push " <param name=\"col_labels\" value=\"")
(push col-labels)
(push "\">\n")))
(let ((rot? (gnc:html-barchart-row-labels-rotated? barchart)))
(push " <param name=\"rotate_row_labels\" value=\"")
(if rot?
(push "1\">\n")
(push "0\">\n")))
(push "Unable to push bar chart\n")
(push "</object>"))
" ")
retval))

View File

@ -44,7 +44,7 @@
(gnc:make-html-document-internal
#f ;; the stylesheet
'() ;; style stack
(make-hash-table 7) ;; document style info
(gnc:make-html-style-table) ;; document style info
"" ;; document title
'() ;; subobjects
))
@ -90,7 +90,7 @@
(apply gnc:make-html-data-style-info rest))
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(hash-set! (gnc:html-document-style doc) tag newstyle)))
(gnc:html-style-table-set! (gnc:html-document-style doc) tag newstyle)))
(define (gnc:html-document-render doc)
@ -100,29 +100,36 @@
(gnc:html-style-sheet-render stylesheet doc)
;; otherwise, do the trivial render.
(with-output-to-string
(lambda ()
(gnc:html-document-push-style doc (gnc:html-document-style doc))
(display "<html>\n")
(display "<head>\n")
(let ((title (gnc:html-document-title doc)))
(if title
(display (string-append "<title>" title "</title>\n"))))
(display "</head>\n")
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval)))))
;; compile the doc style
(gnc:html-style-table-compile (gnc:html-document-style doc)
(gnc:html-document-style-stack doc))
;; push it
(gnc:html-document-push-style doc (gnc:html-document-style doc))
(push "<html>\n")
(push "<head>\n")
(let ((title (gnc:html-document-title doc)))
(if title
(push (list "</title>" title "<title>\n"))))
(push "</head>\n")
;; this lovely little number just makes sure that <body>
;; attributes like bgcolor get included
(push ((gnc:html-markup/no-end "body") doc))
;; now render the children
(for-each-in-order
(lambda (child)
(push (gnc:html-object-render child doc)))
(gnc:html-document-objects doc))
(push "</body>\n")
(push "</html>\n")
(gnc:html-document-pop-style doc)
(gnc:html-style-table-uncompile (gnc:html-document-style doc))
retval))))
;; this lovely little number just makes sure that <body>
;; attributes like bgcolor get included
(display ((gnc:html-markup/no-end "body") doc))
;; now render the children
(for-each-in-order
(lambda (child)
(display (gnc:html-object-render child doc)))
(gnc:html-document-objects doc))
(display "</body>\n")
(display "</html>\n")
(gnc:html-document-pop-style doc))))))
(define (gnc:html-document-push-style doc style)
(gnc:html-document-set-style-stack!
doc (cons style (gnc:html-document-style-stack doc))))
@ -132,9 +139,6 @@
(gnc:html-document-set-style-stack!
doc (cdr (gnc:html-document-style-stack doc)))))
(define (gnc:html-document-set-markup-style! doc tag style-info)
(hash-set! (gnc:html-document-style doc) tag style-info))
(define (gnc:html-document-add-object! doc obj)
(gnc:html-document-set-objects!
doc
@ -145,7 +149,33 @@
(gnc:html-document-set-objects!
doc
(append (gnc:html-document-objects doc) objects)))
(define (gnc:html-document-fetch-markup-style doc markup)
(let ((style-info #f))
(if (not (null? (gnc:html-document-style-stack doc)))
(set! style-info
(gnc:html-style-table-fetch
(car (gnc:html-document-style-stack doc))
(cdr (gnc:html-document-style-stack doc))
markup)))
(if (not style-info)
(gnc:make-html-markup-style-info)
style-info)))
(define (gnc:html-document-fetch-data-style doc markup)
(let ((style-info #f))
(if (not (null? (gnc:html-document-style-stack doc)))
(set! style-info
(gnc:html-style-table-fetch
(car (gnc:html-document-style-stack doc))
(cdr (gnc:html-document-style-stack doc))
markup)))
(if (not style-info)
(gnc:make-html-data-style-info
(lambda (datum parms)
(sprintf #f "%a %a" markup datum))
#f)
style-info)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; markup-rendering functions : markup-start and markup-end return
@ -156,104 +186,64 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (gnc:html-document-markup-start doc markup . rest)
(let ((childinfo #f)
(let ((childinfo (gnc:html-document-fetch-markup-style doc markup))
(extra-attrib
(if (not (null? rest))
rest #f))
(show-result #f))
;; merge the style stack to get a complete markup-style-info
;; record ... should we cache these?
(for-each-in-order
(lambda (newstyle)
(if newstyle
(let ((parentinfo
(hash-ref newstyle markup)))
(if (and (gnc:html-markup-style-info? parentinfo)
(or
(gnc:html-markup-style-info-inheritable? parentinfo)
(eq? newstyle
(car (gnc:html-document-style-stack doc)))))
(set! childinfo
(gnc:html-markup-style-info-merge
childinfo parentinfo))))))
(gnc:html-document-style-stack doc))
(if (not childinfo)
(set! childinfo
(gnc:make-html-markup-style-info)))
;; now generate the start tag
(let ((tag (gnc:html-markup-style-info-tag childinfo))
(attr (gnc:html-markup-style-info-attributes childinfo))
(face (gnc:html-markup-style-info-font-face childinfo))
(size (gnc:html-markup-style-info-font-size childinfo))
(color (gnc:html-markup-style-info-font-color childinfo)))
;; "" tags mean "show no tag"; #f tags means use default.
(cond ((not tag)
(set! tag markup))
((string=? tag "")
(set! tag #f)))
(with-output-to-string
(lambda ()
(if tag
(begin
(display "\n<")
(display tag)
(if attr
(hash-fold
(lambda (key value prior)
(display (sprintf #f " %a=%a" key value))
#t)
#f
attr))
(if extra-attrib
(for-each
(lambda (attr)
(if (string? attr)
(begin
(display " ") (display attr))))
extra-attrib))
(display ">")))
(if (or face size color)
(begin
(display "<font ")
(if face
(begin
(display "face=\"") (display face) (display "\" ")))
(if size
(begin
(display "size=\"") (display size) (display "\" ")))
(if color
(begin
(display "color=\"") (display color) (display "\" ")))
(display ">"))))))))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval)))))
(if tag
(begin
(push "\n<")
(push tag)
(if attr
(hash-fold
(lambda (key value prior)
(push " ") (push key) (push "=")
(push value)
#t)
#f
attr))
(if extra-attrib
(for-each
(lambda (attr)
(if (string? attr)
(begin
(push " ") (push attr))))
extra-attrib))
(push ">")))
(if (or face size color)
(begin
(push "<font ")
(if face
(begin
(push "face=\"") (push face) (push "\" ")))
(if size
(begin
(push "size=\"") (push size) (push "\" ")))
(if color
(begin
(push "color=\"") (push color) (push "\" ")))
(push ">")))
retval))))
(define (gnc:html-document-markup-end doc markup)
(let ((childinfo #f))
;; merge the style stack to get a complete markup-style-info
;; record ... should we cache these?
(for-each-in-order
(lambda (newstyle)
(if newstyle
(let ((parentinfo
(hash-ref newstyle markup)))
(if (and (gnc:html-markup-style-info? parentinfo)
(or
(gnc:html-markup-style-info-inheritable? parentinfo)
(eq? newstyle
(car (gnc:html-document-style-stack doc)))))
(set! childinfo
(gnc:html-markup-style-info-merge
childinfo parentinfo))))))
(gnc:html-document-style-stack doc))
(if (not childinfo)
(set! childinfo
(gnc:make-html-markup-style-info)))
(let ((childinfo (gnc:html-document-fetch-markup-style doc markup)))
;; now generate the end tag
(let ((tag (gnc:html-markup-style-info-tag childinfo))
(face (gnc:html-markup-style-info-font-face childinfo))
@ -264,16 +254,17 @@
(set! tag markup))
((string=? tag "")
(set! tag #f)))
(with-output-to-string
(lambda ()
(if (or face size color)
(display "</font>\n"))
(if tag
(begin
(display "</")
(display tag)
;; newline after every close tag... just temporary
(display ">\n"))))))))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval)))))
(if (or face size color)
(push "</font>\n"))
(if tag
(begin
(push "</")
(push tag)
;; newline after every close tag... just temporary
(push ">\n")))
retval))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; html-document-render-data
@ -291,27 +282,11 @@
((boolean? data)
(set! data-type "<boolean>"))
((record? data)
(set! data-type (record-type-name (record-type-descriptor data)))))
(set! data-type (record-type-name (record-type-descriptor data))))
(#t
(set! data-type "<generic>")))
;; for data, we just want to find the first style stack
;; frame that has a renderer
(let loop ((stack (gnc:html-document-style-stack doc)))
(let* ((style (car stack))
(info #f))
(if style
(set! info (hash-ref style data-type)))
(if (and info
(gnc:html-data-style-info? info))
(set! style-info info)
(if (not (null? (cdr stack)))
(loop (cdr stack))))))
(if (not style-info)
(set! style-info
(gnc:make-html-data-style-info
(lambda (datum parms)
(sprintf #f "%a %a" data-type datum))
#f)))
(set! style-info (gnc:html-document-fetch-data-style doc data-type))
((gnc:html-data-style-info-renderer style-info)
data (gnc:html-data-style-info-data style-info))))
@ -389,3 +364,8 @@
(let ((htmlo (gnc:make-html-object obj)))
(gnc:html-object-render htmlo doc))))

View File

@ -160,104 +160,114 @@
(display " ")))
nlist)))))
(with-output-to-string
(lambda ()
(let ((title (gnc:html-piechart-title piechart))
(subtitle (gnc:html-piechart-subtitle piechart))
(url-1
(catenate-escaped-strings
(gnc:html-piechart-button-1-slice-urls piechart)))
(url-2
(catenate-escaped-strings
(gnc:html-piechart-button-2-slice--urls piechart)))
(url-3
(catenate-escaped-strings
(gnc:html-piechart-button-3-slice--urls piechart)))
(legend-1
(catenate-escaped-strings
(gnc:html-piechart-button-1-legend-urls piechart)))
(legend-2
(catenate-escaped-strings
(gnc:html-piechart-button-2-legend-urls piechart)))
(legend-3
(catenate-escaped-strings
(gnc:html-piechart-button-3-legend-urls piechart)))
(data
(ensure-positive-numbers (gnc:html-piechart-data piechart)))
(labels
(catenate-escaped-strings (gnc:html-piechart-labels piechart)))
(colors
(catenate-escaped-strings (gnc:html-piechart-colors piechart))))
(if (and (list? data)
(not (null? data)))
(begin
(display "<object classid=\"gnc-guppi-pie\" width=")
(display (gnc:html-piechart-width piechart))
(display " height=")
(display (gnc:html-piechart-height piechart))
(display ">\n")
(if title
(begin
(display " <param name=\"title\" value=\"")
(display title) (display "\">\n")))
(if subtitle
(begin
(display " <param name=\"subtitle\" value=\"")
(display subtitle) (display "\">\n")))
(if (and data (list? data))
(begin
(display " <param name=\"datasize\" value=\"")
(display (length data)) (display "\">\n")
(display " <param name=\"data\" value=\"")
(for-each-in-order
(lambda (datum)
(display datum)
(display " "))
data)
(display "\">\n")))
(if (and (string? colors)
(> (string-length colors) 0))
(begin
(display " <param name=\"colors\" value=\"")
(dispaly colors)
(display "\">\n")))
(if (and (string? labels)
(> (string-length labels) 0))
(begin
(display " <param name=\"labels\" value=\"")
(display labels)
(display "\">\n")))
(if url-1
(begin
(display " <param name=\"slice_urls_1\" value=\"")
(display url-1)
(display "\">\n")))
(if url-2
(begin
(display " <param name=\"slice_urls_2\" value=\"")
(display url-2)
(display "\">\n")))
(if url-3
(begin
(display " <param name=\"slice_urls_3\" value=\"")
(display url-3)
(display "\">\n")))
(if legend-1
(begin
(display " <param name=\"legend_urls_1\" value=\"")
(display legend-1)
(display "\">\n")))
(if legend-2
(begin
(display " <param name=\"legend_urls_2\" value=\"")
(display legend-2)
(display "\">\n")))
(if legend-3
(begin
(display " <param name=\"legend_urls_3\" value=\"")
(display legend-3)
(display "\">\n")))
(display "Unable to display pie chart\n")
(display "</object>"))
" ")))))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval))))
(title (gnc:html-piechart-title piechart))
(subtitle (gnc:html-piechart-subtitle piechart))
(url-1
(catenate-escaped-strings
(gnc:html-piechart-button-1-slice-urls piechart)))
(url-2
(catenate-escaped-strings
(gnc:html-piechart-button-2-slice--urls piechart)))
(url-3
(catenate-escaped-strings
(gnc:html-piechart-button-3-slice--urls piechart)))
(legend-1
(catenate-escaped-strings
(gnc:html-piechart-button-1-legend-urls piechart)))
(legend-2
(catenate-escaped-strings
(gnc:html-piechart-button-2-legend-urls piechart)))
(legend-3
(catenate-escaped-strings
(gnc:html-piechart-button-3-legend-urls piechart)))
(data
(ensure-positive-numbers (gnc:html-piechart-data piechart)))
(labels
(catenate-escaped-strings (gnc:html-piechart-labels piechart)))
(colors
(catenate-escaped-strings (gnc:html-piechart-colors piechart))))
(if (and (list? data)
(not (null? data)))
(begin
(push "<object classid=\"gnc-guppi-pie\" width=")
(push (gnc:html-piechart-width piechart))
(push " height=")
(push (gnc:html-piechart-height piechart))
(push ">\n")
(if title
(begin
(push " <param name=\"title\" value=\"")
(push title) (push "\">\n")))
(if subtitle
(begin
(push " <param name=\"subtitle\" value=\"")
(push subtitle) (push "\">\n")))
(if (and data (list? data))
(begin
(push " <param name=\"datasize\" value=\"")
(push (length data)) (push "\">\n")
(push " <param name=\"data\" value=\"")
(for-each-in-order
(lambda (datum)
(push datum)
(push " "))
data)
(push "\">\n")))
(if (and (string? colors)
(> (string-length colors) 0))
(begin
(push " <param name=\"colors\" value=\"")
(dispaly colors)
(push "\">\n")))
(if (and (string? labels)
(> (string-length labels) 0))
(begin
(push " <param name=\"labels\" value=\"")
(push labels)
(push "\">\n")))
(if url-1
(begin
(push " <param name=\"slice_urls_1\" value=\"")
(push url-1)
(push "\">\n")))
(if url-2
(begin
(push " <param name=\"slice_urls_2\" value=\"")
(push url-2)
(push "\">\n")))
(if url-3
(begin
(push " <param name=\"slice_urls_3\" value=\"")
(push url-3)
(push "\">\n")))
(if legend-1
(begin
(push " <param name=\"legend_urls_1\" value=\"")
(push legend-1)
(push "\">\n")))
(if legend-2
(begin
(push " <param name=\"legend_urls_2\" value=\"")
(push legend-2)
(push "\">\n")))
(if legend-3
(begin
(push " <param name=\"legend_urls_3\" value=\"")
(push legend-3)
(push "\">\n")))
(push "Unable to display pie chart\n")
(push "</object>"))
" ")
retval))

View File

@ -23,7 +23,6 @@
(gnc:support "html-style-info.scm")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-markup-style-info> class
;; this is what's stored for tags in the style hash tables.
@ -42,6 +41,27 @@
;; font-color : color (a valid HTML color spec)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (make-kvtable)
;; (make-hash-table 7))
(make-vector 1 '()))
(define (kvt-ref kvtable key)
;; (hash-ref kvtable key))
(assoc-ref (vector-ref kvtable 0) key))
(define (kvt-set! kvtable key value)
;; (hash-set! kvtable key value))
(vector-set! kvtable 0 (assoc-set! (vector-ref kvtable 0) key value)))
(define (kvt-fold proc init-value kvtable)
;; (hash-fold proc init-value kvtable))
(let ((chain init-value))
(for-each
(lambda (elt)
(set! chain (proc (car elt) (cdr elt) chain)))
(vector-ref kvtable 0))))
(define <html-markup-style-info>
(make-record-type "<html-markup-style-info>"
'(tag
@ -59,7 +79,7 @@
(define (gnc:make-html-markup-style-info . rest)
(let ((retval (gnc:make-html-markup-style-info-internal
#f (make-hash-table 7) #f #f #f #t)))
#f (make-kvtable) #f #f #f #t)))
(apply gnc:html-markup-style-info-set! retval rest)
retval))
@ -117,60 +137,54 @@
(record-modifier <html-markup-style-info> 'inheritable?))
(define (gnc:html-markup-style-info-set-attribute! info attr val)
(hash-set! (gnc:html-markup-style-info-attributes info) attr val))
(kvt-set! (gnc:html-markup-style-info-attributes info) attr val))
(define (gnc:html-markup-style-info-merge s1 s2)
(if (not (gnc:html-markup-style-info? s1))
s2
(if (not (gnc:html-markup-style-info? s2))
s1
(let ((st
(gnc:make-html-markup-style-info-internal
(gnc:html-markup-style-info-tag s1)
(make-hash-table 7)
(gnc:html-markup-style-info-font-face s1)
(gnc:html-markup-style-info-font-size s1)
(gnc:html-markup-style-info-font-color s1)
(gnc:html-markup-style-info-inheritable? s1))))
(let* ((tag-1 (gnc:html-markup-style-info-tag s1))
(face-1 (gnc:html-markup-style-info-font-face s1))
(size-1 (gnc:html-markup-style-info-font-size s1))
(color-1 (gnc:html-markup-style-info-font-color s1)))
(gnc:make-html-markup-style-info-internal
;; tag
(if tag-1 tag-1 (gnc:html-markup-style-info-tag s2))
;; attributes: if the child is overriding the
;; parent tag, don't initialize the attribute table
;; to the parent's attributes. Otherwise, load
;; parent attrs then load child attrs over them.
(let ((ht (make-kvtable)))
(if (not tag-1)
(kvt-fold
(lambda (k v p) (kvt-set! ht k v) #f) #f
(gnc:html-markup-style-info-attributes s2)))
(kvt-fold
(lambda (k v p) (kvt-set! ht k v) #f) #f
(gnc:html-markup-style-info-attributes s1))
ht)
;; font face
(if face-1 face-1 (gnc:html-markup-style-info-font-face s2))
;; font size
(if size-1 size-1 (gnc:html-markup-style-info-font-size s2))
;; color
(if color-1 color-1
(gnc:html-markup-style-info-font-color s2))
;; inheritable (get this always from child)
(gnc:html-markup-style-info-inheritable? s1))))))
;; merge the tag name and attributes. If the child is
;; overriding the parent's key, don't inherit the parent's
;; attributes.
(let ((s1t (gnc:html-markup-style-info-tag s1))
(s2t (gnc:html-markup-style-info-tag s2)))
(if (not s1t)
(begin
(gnc:html-markup-style-info-set-tag! st s2t)
;; merge the attributes
(hash-fold
(lambda (key value prior)
(gnc:html-markup-style-info-set-attribute!
st key value)
#t)
#t
(gnc:html-markup-style-info-attributes s2))
(hash-fold
(lambda (key value prior)
(gnc:html-markup-style-info-set-attribute!
st key value)
#t)
#t
(gnc:html-markup-style-info-attributes s1)))))
(let ((s1s (gnc:html-markup-style-info-font-face s1))
(s2s (gnc:html-markup-style-info-font-face s2)))
(if (not s1s)
(gnc:html-markup-style-info-set-font-face! st s2s)))
(let ((s1s (gnc:html-markup-style-info-font-size s1))
(s2s (gnc:html-markup-style-info-font-size s2)))
(if (not s1s)
(gnc:html-markup-style-info-set-font-size! st s2s)))
(let ((s1s (gnc:html-markup-style-info-font-color s1))
(s2s (gnc:html-markup-style-info-font-color s2)))
(if (not s1s)
(gnc:html-markup-style-info-set-font-color! st s2s)))
st))))
(define (gnc:html-style-info-merge s1 s2)
(if (or (gnc:html-markup-style-info? s1)
(gnc:html-markup-style-info? s2))
(gnc:html-markup-style-info-merge s1 s2)
(if (or (gnc:html-data-style-info? s1)
(gnc:html-data-style-info? s2))
(gnc:html-data-style-info-merge s1 s2)
#f)))
(define (gnc:html-data-style-info-merge s1 s2)
(if (gnc:html-data-style-info? s1) s1 s2))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-data-style-info> class
@ -187,14 +201,17 @@
(define <html-data-style-info>
(make-record-type "<html-data-style-info>"
'(renderer data)))
'(renderer data inheritable?)))
(define gnc:html-data-style-info?
(record-predicate <html-data-style-info>))
(define gnc:make-html-data-style-info
(define gnc:make-html-data-style-info-internal
(record-constructor <html-data-style-info>))
(define (gnc:make-html-data-style-info renderer data)
(gnc:make-html-data-style-info-internal renderer data #t))
(define gnc:html-data-style-info?
(record-predicate <html-data-style-info>))
@ -210,6 +227,13 @@
(define gnc:html-data-style-info-set-data!
(record-modifier <html-data-style-info> 'data))
(define gnc:html-data-style-info-inheritable?
(record-accessor <html-data-style-info> 'inheritable?))
(define gnc:html-data-style-info-set-inheritable?!
(record-modifier <html-data-style-info> 'inheritable?))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; default renderers for some data types.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -218,15 +242,146 @@
datum)
(define (gnc:default-html-gnc-numeric-renderer datum params)
; (gnc:numeric-to-string datum))
(sprintf #f "%.2f" (gnc:numeric-to-double datum)))
(gnc:amount->string-helper datum (gnc:default-print-info #f)))
; (sprintf #f "%.2f" (gnc:numeric-to-double datum)))
(define (gnc:default-html-gnc-monetary-renderer datum params)
(gnc:amount->string-helper
(gnc:gnc-monetary-amount datum)
(gnc:commodity-print-info (gnc:gnc-monetary-commodity datum) #t)))
(define (gnc:default-html-number-renderer datum params)
(sprintf #f "%.2f" datum))
(define (gnc:default-html-number-renderer datum params)
(gnc:amount->string-helper
(gnc:double-to-gnc-numeric datum 100 GNC-RND-ROUND)
(gnc:default-print-info #f)))
; (gnc:print-double-amount datum))
; (sprintf #f "%.2f" datum))
; (format #f "~,2f" datum))
; "(NUM)")
; (sprintf 20 "%.2f" datum))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-style-table> class
;;
;; this used to just be bare kvt tables stuck in the <html-object>
;; but since we now support caching and compilation I think it
;; deserves a record structure.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-style-table>
(make-record-type "<html-style-table>"
'(primary compiled inheritable)))
(define gnc:html-style-table?
(record-predicate <html-style-table>))
(define gnc:make-html-style-table-internal
(record-constructor <html-style-table>))
(define (gnc:make-html-style-table)
(gnc:make-html-style-table-internal (make-kvtable) #f #f))
(define gnc:html-style-table-primary
(record-accessor <html-style-table> 'primary))
(define gnc:html-style-table-compiled
(record-accessor <html-style-table> 'compiled))
(define gnc:html-style-table-set-compiled!
(record-modifier <html-style-table> 'compiled))
(define gnc:html-style-table-inheritable
(record-accessor <html-style-table> 'inheritable))
(define gnc:html-style-table-set-inheritable!
(record-modifier <html-style-table> 'inheritable))
(define (gnc:html-style-table-compiled? table)
(if (gnc:html-style-table-compiled table)
#t #f))
(define (gnc:html-style-table-compile table antecedents)
;; merge a key-value pair from an antecedent into the
;; compiled table. Only add values to the inheritable table
;; that are inheritable.
(define (key-merger key value ign)
(let* ((compiled (gnc:html-style-table-compiled table))
(inheritable (gnc:html-style-table-inheritable table))
(old-val (kvt-ref compiled key))
(new-val (gnc:html-style-info-merge old-val value)))
(kvt-set! compiled key new-val)
(if (and (gnc:html-markup-style-info? value)
(gnc:html-markup-style-info-inheritable? value))
(kvt-set! inheritable key new-val))
(if (and (gnc:html-data-style-info? value)
(gnc:html-data-style-info-inheritable? value))
(kvt-set! inheritable key new-val))))
;; walk up the list of antecedents merging in style info
(define (compile-worker table-list)
(let ((next (car table-list)))
(if (gnc:html-style-table-compiled? next)
(begin
(kvt-fold key-merger #f (gnc:html-style-table-compiled next))
#t)
(begin
(kvt-fold key-merger #f (gnc:html-style-table-primary next))
(if (not (null? (cdr antecedents)))
(compile-worker (cdr antecedents))
#t)))))
;; make the compiled kvt table
(gnc:html-style-table-set-compiled! table (make-kvtable))
(gnc:html-style-table-set-inheritable! table (make-kvtable))
;; merge the contents of the primary kvt into the compiled table
(kvt-fold key-merger #f (gnc:html-style-table-primary table))
;; now merge in the antecedents
(compile-worker antecedents))
(define (gnc:html-style-table-uncompile table)
(gnc:html-style-table-set-compiled! table #f)
(gnc:html-style-table-set-inheritable! table #f))
(define (gnc:html-style-table-fetch table antecedents markup)
(define (get-inheritable-style ht)
(let ((s (kvt-ref ht markup)))
(if (or (and (gnc:html-markup-style-info? s)
(gnc:html-markup-style-info-inheritable? s))
(and (gnc:html-data-style-info? s)
(gnc:html-data-style-info-inheritable? s)))
s #f)))
(define (fetch-worker style antecedents)
(if (null? antecedents)
style
(let ((parent (car antecedents)))
(if (not parent)
(fetch-worker style (cdr antecedents))
(if (gnc:html-style-table-compiled? parent)
(gnc:html-style-info-merge
style
(kvt-ref (gnc:html-style-table-inheritable parent) markup))
(fetch-worker
(gnc:html-style-info-merge
style (get-inheritable-style
(gnc:html-style-table-primary parent)))
(cdr antecedents)))))))
(if (and table (gnc:html-style-table-compiled? table))
(kvt-ref (gnc:html-style-table-compiled table) markup)
(fetch-worker
(if table
(kvt-ref (gnc:html-style-table-primary table) markup)
#f)
antecedents)))
(define (gnc:html-style-table-set! table markup style-info)
(kvt-set! (gnc:html-style-table-primary table) markup style-info))

View File

@ -128,7 +128,8 @@
(apply gnc:make-html-data-style-info rest))
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(hash-set! (gnc:html-style-sheet-style sheet) tag newstyle)))
(gnc:html-style-table-set!
(gnc:html-style-sheet-style sheet) tag newstyle)))
(define (gnc:make-html-style-sheet template-name style-sheet-name)
(let* ((template (gnc:html-style-sheet-template-find template-name)))
@ -137,7 +138,7 @@
style-sheet-name
((gnc:html-style-sheet-template-options-generator template))
(gnc:html-style-sheet-template-renderer template)
(make-hash-table 7))))
(gnc:make-html-style-table))))
;; set up the fallback data styles for every rendered document
(gnc:html-style-sheet-set-style!
rv "<string>"
@ -177,7 +178,9 @@
;; swap the original document's default styles with the style
;; sheet document styles
;; ... first push the style sheet template document's style on the
;; stack
;; stack (compiling before pushing)
(gnc:html-style-table-compile (gnc:html-document-style newdoc)
(gnc:html-document-style-stack newdoc))
(gnc:html-document-push-style newdoc (gnc:html-document-style newdoc))
;; ... then set the rendered document's style to be the user

View File

@ -46,18 +46,20 @@
(record-constructor <html-table-cell>))
(define (gnc:make-html-table-cell . objects)
(gnc:make-html-table-cell-internal 1 1 "td" objects (make-hash-table 7)))
(gnc:make-html-table-cell-internal 1 1 "td" objects
(gnc:make-html-style-table)))
(define (gnc:make-html-table-cell/size rowspan colspan . objects)
(gnc:make-html-table-cell-internal rowspan colspan "td"
objects (make-hash-table 7)))
objects (gnc:make-html-style-table)))
(define (gnc:make-html-table-header-cell . objects)
(gnc:make-html-table-cell-internal 1 1 "th" objects (make-hash-table 7)))
(gnc:make-html-table-cell-internal 1 1 "th" objects
(gnc:make-html-style-table)))
(define (gnc:make-html-table-header-cell/size rowspan colspan . objects)
(gnc:make-html-table-cell-internal rowspan colspan "th"
objects (make-hash-table 7)))
objects (gnc:make-html-style-table)))
(define gnc:html-table-cell?
(record-predicate <html-table-cell>))
@ -93,34 +95,37 @@
(record-modifier <html-table-cell> 'style))
(define (gnc:html-table-cell-set-style! cell tag . rest)
(let ((newstyle #f))
(let ((newstyle #f)
(styletable (gnc:html-table-cell-style cell)))
(if (and (= (length rest) 2)
(procedure? (car rest)))
(set! newstyle
(apply gnc:make-html-data-style-info rest))
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(hash-set! (gnc:html-table-cell-style cell) tag newstyle)))
(gnc:html-style-table-set! styletable tag newstyle)))
(define (gnc:html-table-cell-append-objects! cell . objects)
(gnc:html-table-cell-set-data-internal!
cell (append (gnc:html-table-cell-data cell) objects)))
(define (gnc:html-table-cell-render cell doc)
(with-output-to-string
(lambda ()
(gnc:html-document-push-style doc (gnc:html-table-cell-style cell))
(display (gnc:html-document-markup-start
doc (gnc:html-table-cell-tag cell)
(sprintf #f "rowspan=%a" (gnc:html-table-cell-rowspan cell))
(sprintf #f "colspan=%a" (gnc:html-table-cell-colspan cell))))
(for-each-in-order
(lambda (child)
(display (gnc:html-object-render child doc)))
(gnc:html-table-cell-data cell))
(display (gnc:html-document-markup-end
doc (gnc:html-table-cell-tag cell)))
(gnc:html-document-pop-style doc))))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval))))
(style (gnc:html-table-cell-style cell)))
(gnc:html-document-push-style doc style)
(push (gnc:html-document-markup-start
doc (gnc:html-table-cell-tag cell)
(sprintf #f "rowspan=%a" (gnc:html-table-cell-rowspan cell))
(sprintf #f "colspan=%a" (gnc:html-table-cell-colspan cell))))
(for-each-in-order
(lambda (child)
(push (gnc:html-object-render child doc)))
(gnc:html-table-cell-data cell))
(push (gnc:html-document-markup-end
doc (gnc:html-table-cell-tag cell)))
(gnc:html-document-pop-style doc)
retval))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-table> class
@ -136,11 +141,11 @@
#f ;; row-headers
#f ;; caption
'() ;; data
(make-hash-table 7) ;; style
'() ;; col-styles
'() ;; row-styles
(make-hash-table 7) ;; col-headers-style
(make-hash-table 7) ;; row-headers-style
(gnc:make-html-style-table) ;; style
(make-hash-table 21) ;; col-styles
(make-hash-table 21) ;; row-styles
(gnc:make-html-style-table) ;; col-headers-style
(gnc:make-html-style-table) ;; row-headers-style
))
(define gnc:html-table-data
@ -188,24 +193,41 @@
(define gnc:html-table-col-headers-style
(record-accessor <html-table> 'col-headers-style))
(define gnc:html-table-set-col-headers-style!
(record-modifier <html-table> 'col-headers-style))
(define gnc:html-table-row-headers-style
(record-accessor <html-table> 'row-headers-style))
(define gnc:html-table-set-row-headers-style!
(record-modifier <html-table> 'row-headers-style))
(define (gnc:html-table-set-style! table tag . rest)
(let ((newstyle #f))
(define (gnc:html-table-set-col-headers-style! table tag . rest)
(let ((newstyle #f)
(style (gnc:html-table-col-headers-style table)))
(if (and (= (length rest) 2)
(procedure? (car rest)))
(set! newstyle
(apply gnc:make-html-data-style-info rest))
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(hash-set! (gnc:html-table-style table) tag newstyle)))
(gnc:html-style-table-set! style tag newstyle)))
(define gnc:html-table-row-headers-style
(record-accessor <html-table> 'row-headers-style))
(define (gnc:html-table-set-row-headers-style! table tag . rest)
(let ((newstyle #f)
(style (gnc:html-table-row-headers-style table)))
(if (and (= (length rest) 2)
(procedure? (car rest)))
(set! newstyle
(apply gnc:make-html-data-style-info rest))
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(gnc:html-style-table-set! style tag newstyle)))
(define (gnc:html-table-set-style! table tag . rest)
(let ((newstyle #f)
(style (gnc:html-table-style table)))
(if (and (= (length rest) 2)
(procedure? (car rest)))
(set! newstyle
(apply gnc:make-html-data-style-info rest))
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(gnc:html-style-table-set! style tag newstyle)))
(define (gnc:html-table-set-col-style! table col tag . rest)
(let ((newstyle #f)
@ -218,17 +240,14 @@
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(set! style
(list-ref-safe (gnc:html-table-col-styles table) col))
(gnc:html-table-col-style table col))
(if (not style)
(begin
(set! style (make-hash-table 7))
(set! style (gnc:make-html-style-table))
(set! newhash #t)))
(hash-set! style tag newstyle)
(gnc:html-style-table-set! style tag newstyle)
(if newhash
(gnc:html-table-set-col-styles!
table
(list-set-safe! (gnc:html-table-col-styles table) col style)))))
(hash-set! (gnc:html-table-col-styles table) col style))))
(define (gnc:html-table-set-row-style! table row tag . rest)
(let ((newstyle #f)
@ -241,16 +260,21 @@
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(set! style
(list-ref-safe (gnc:html-table-row-styles table) row))
(gnc:html-table-row-style table row))
(if (not style)
(begin
(set! style (make-hash-table 7))
(set! style (gnc:make-html-style-table))
(set! newhash #t)))
(hash-set! style tag newstyle)
(gnc:html-style-table-set! style tag newstyle)
(if newhash
(gnc:html-table-set-row-styles!
table
(list-set-safe! (gnc:html-table-row-styles table) row style)))))
(hash-set!
(gnc:html-table-row-styles table) row style))))
(define (gnc:html-table-row-style table row)
(hash-ref (gnc:html-table-row-styles table) row))
(define (gnc:html-table-col-style table col)
(hash-ref (gnc:html-table-col-styles table) col))
(define (gnc:html-table-num-rows table)
(length (gnc:html-table-data table)))
@ -293,7 +317,6 @@
table
(list-set-safe! (gnc:html-table-data table) row rowdata))))
(define (gnc:html-table-append-column! table newcol)
(let ((colnum 0)
(rownum 0)
@ -361,77 +384,124 @@
newcol)))
(define (gnc:html-table-render table doc)
(with-output-to-string
(lambda ()
(gnc:html-document-push-style doc (gnc:html-table-style table))
(display (gnc:html-document-markup-start doc "table"))
;; render the caption
(let ((c (gnc:html-table-caption table)))
(if c
(begin
(display (gnc:html-document-markup-start doc "caption"))
(display (gnc:html-object-render c doc))
(display (gnc:html-document-markup-end doc "caption")))))
;; the first row is the column headers. Columns styles apply.
(let ((ch (gnc:html-table-col-headers table))
(colnum 0))
(if ch
(begin
(gnc:html-document-push-style
doc (gnc:html-table-col-headers-style table))
(display (gnc:html-document-markup-start doc "tr"))
(for-each-in-order
(lambda (hdr)
(gnc:html-document-push-style
doc (list-ref-safe (gnc:html-table-col-styles table) colnum))
(if (not (gnc:html-table-cell? hdr))
(display (gnc:html-document-markup-start doc "th")))
(display (gnc:html-object-render hdr doc))
(if (not (gnc:html-table-cell? hdr))
(display (gnc:html-document-markup-end doc "th")))
(gnc:html-document-pop-style doc)
(if (not (gnc:html-table-cell? hdr))
(set! colnum (+ 1 colnum))
(set! colnum (+ (gnc:html-table-cell-colspan hdr)
colnum))))
ch)
(gnc:html-document-pop-style doc)
)))
;; now iterate over the rows
(let ((rownum 0) (colnum 0))
(for-each-in-order
(lambda (row)
;; push the style for this row and write the start tag
(gnc:html-document-push-style
doc (list-ref-safe (gnc:html-table-row-styles table) rownum))
(display (gnc:html-document-markup-start doc "tr"))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval)))))
;; compile the table style to make other compiles faster
(gnc:html-style-table-compile
(gnc:html-table-style table) (gnc:html-document-style-stack doc))
(gnc:html-document-push-style doc (gnc:html-table-style table))
(push (gnc:html-document-markup-start doc "table"))
;; render the caption
(let ((c (gnc:html-table-caption table)))
(if c
(begin
(push (gnc:html-document-markup-start doc "caption"))
(push (gnc:html-object-render c doc))
(push (gnc:html-document-markup-end doc "caption")))))
;; the first row is the column headers. Columns styles apply.
;; compile the col styles with the header style pushed; we'll
;; recompile them later, but this will have the benefit of
;; compiling in the col-header-style.
(let ((ch (gnc:html-table-col-headers table))
(colnum 0))
(if ch
(begin
(gnc:html-document-push-style
doc (gnc:html-table-col-headers-style table))
(push (gnc:html-document-markup-start doc "tr"))
;; compile the column styles just in case there's
;; something interesting in the table header cells.
(hash-fold
(lambda (col style init)
(if style
(gnc:html-style-table-compile
style (gnc:html-document-style-stack doc)))
#f)
#f (gnc:html-table-col-styles table))
;; render the headers
(for-each-in-order
(lambda (hdr)
(gnc:html-document-push-style
doc (gnc:html-table-col-style table colnum))
(if (not (gnc:html-table-cell? hdr))
(push (gnc:html-document-markup-start doc "th")))
(push (gnc:html-object-render hdr doc))
(if (not (gnc:html-table-cell? hdr))
(push (gnc:html-document-markup-end doc "th")))
(gnc:html-document-pop-style doc)
(if (not (gnc:html-table-cell? hdr))
(set! colnum (+ 1 colnum))
(set! colnum (+ (gnc:html-table-cell-colspan hdr)
colnum))))
ch)
;; pop the col header style
(gnc:html-document-pop-style doc))))
;; recompile the column styles. We won't worry about the row
;; styles; if they're there, we may lose, but not much, and they
;; will be pretty rare (I think).
(hash-fold
(lambda (col style init)
(if style
(gnc:html-style-table-compile
style (gnc:html-document-style-stack doc)))
#f)
#f (gnc:html-table-col-styles table))
;; now iterate over the rows
(let ((rownum 0) (colnum 0))
(for-each-in-order
(lambda (row)
(let ((rowstyle
(gnc:html-table-row-style table rownum)))
;; push the style for this row and write the start tag, then
;; pop it again.
(if rowstyle (gnc:html-document-push-style doc rowstyle))
(push (gnc:html-document-markup-start doc "tr"))
(if rowstyle (gnc:html-document-pop-style doc))
;; write the column data, pushing the right column style
;; each time
;; each time, then the row style.
(for-each-in-order
(lambda (datum)
(gnc:html-document-push-style
doc (list-ref-safe (gnc:html-table-col-styles table) colnum))
(if (not (gnc:html-table-cell? datum))
(display (gnc:html-document-markup-start doc "td")))
(display (gnc:html-object-render datum doc))
(if (not (gnc:html-table-cell? datum))
(display (gnc:html-document-markup-end doc "td")))
(gnc:html-document-pop-style doc)
(set! colnum (+ 1 colnum)))
(let ((colstyle
(gnc:html-table-col-style table colnum)))
;; push col and row styles
(if colstyle (gnc:html-document-push-style doc colstyle))
(if rowstyle (gnc:html-document-push-style doc rowstyle))
;; render the cell contents
(if (not (gnc:html-table-cell? datum))
(push (gnc:html-document-markup-start doc "td")))
(push (gnc:html-object-render datum doc))
(if (not (gnc:html-table-cell? datum))
(push (gnc:html-document-markup-end doc "td")))
;; pop styles
(if rowstyle (gnc:html-document-pop-style doc))
(if colstyle (gnc:html-document-pop-style doc))
(set! colnum (+ 1 colnum))))
row)
;; write the row end tag and pop the row style
(display (gnc:html-document-markup-end doc "tr"))
(gnc:html-document-pop-style doc)
(if rowstyle (gnc:html-document-push-style doc rowstyle))
(push (gnc:html-document-markup-end doc "tr"))
(if rowstyle (gnc:html-document-pop-style doc))
(set! colnum 0)
(set! rownum (+ 1 rownum)))
(gnc:html-table-data table)))
;; write the table end tag and pop the table style
(display (gnc:html-document-markup-end doc "table"))
(gnc:html-document-pop-style doc))))
(set! rownum (+ 1 rownum))))
(gnc:html-table-data table)))
;; write the table end tag and pop the table style
(push (gnc:html-document-markup-end doc "table"))
(gnc:html-document-pop-style doc)
retval))

View File

@ -47,7 +47,7 @@
(define (gnc:make-html-text . body)
(gnc:make-html-text-internal
body
(make-hash-table 7)))
(gnc:make-html-style-table)))
(define gnc:html-text?
(record-predicate <html-text>))
@ -75,7 +75,7 @@
(apply gnc:make-html-data-style-info rest))
(set! newstyle
(apply gnc:make-html-markup-style-info rest)))
(hash-set! (gnc:html-text-style text) tag newstyle)))
(gnc:html-style-table-set! (gnc:html-text-style text) tag newstyle)))
(define (gnc:html-text-append! text . body)
(gnc:html-text-set-body-internal!
@ -175,27 +175,33 @@
rest)))))
(define (gnc:html-text-render p doc)
(with-output-to-string
(lambda ()
(gnc:html-document-push-style doc (gnc:html-text-style p))
(for-each-in-order
(lambda (elt)
(if (procedure? elt)
(display (elt doc))
(display (gnc:html-document-render-data doc elt))))
(gnc:html-text-body p))
(gnc:html-document-pop-style doc))))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval)))))
(gnc:html-style-table-compile (gnc:html-text-style p)
(gnc:html-document-style-stack doc))
(gnc:html-document-push-style doc (gnc:html-text-style p))
(for-each-in-order
(lambda (elt)
(if (procedure? elt)
(push (elt doc))
(push (gnc:html-document-render-data doc elt))))
(gnc:html-text-body p))
(gnc:html-document-pop-style doc)
(gnc:html-style-table-uncompile (gnc:html-text-style p))
retval))
(define (gnc:html-text-render-markup doc markup attrib end-tag? . entities)
(with-output-to-string
(lambda ()
(display (gnc:html-document-markup-start doc markup attrib))
(for-each-in-order
(lambda (elt)
(if (procedure? elt)
(display (elt doc))
(display (gnc:html-document-render-data doc elt))))
entities)
(if end-tag?
(display (gnc:html-document-markup-end doc markup))))))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval)))))
(push (gnc:html-document-markup-start doc markup attrib))
(for-each-in-order
(lambda (elt)
(if (procedure? elt)
(push (elt doc))
(push (gnc:html-document-render-data doc elt))))
entities)
(if end-tag?
(push (gnc:html-document-markup-end doc markup)))
retval))

View File

@ -468,6 +468,14 @@ transaction.") #t))
))
;; QIF Import options.
(gnc:register-configuration-option
(gnc:make-simple-boolean-option
(N_ "QIF Import") (N_ "Verbose documentation")
"a" (N_ "Show some documentation-only pages in QIF Import druid")
#t))
;;; Configuation variables
(define gnc:*arg-show-version*

View File

@ -432,6 +432,79 @@
(qif-map-entry:qif-name b)))))
retval))
;; UNFINISHED (and currently not connected to anything)
;; this one's like the other display builders, it just looks at the
;; payee and memo too.
(define (qif-dialog:make-memo-display qif-files memo-hash gnc-acct-info)
(let ((retval '()))
;; clear the display flags for existing items
(for-each
(lambda (bin)
(for-each
(lambda (elt)
(qif-map-entry:set-display?! (cdr elt) #f))
bin))
(vector->list memo-hash))
;; iterate over every imported transaction. If there's no
;; category in the transaction, look at the payee to get a clue.
;; of there's no payee, look at the split memo.
(for-each
(lambda (file)
(for-each
(lambda (xtn)
(let ((payee (qif-xtn:payee xtn))
(splits (qif-xtn:splits xtn)))
(for-each
(lambda (split)
(let ((cat (qif-split:category split))
(memo (qif-split:memo split)))
;; for each split: if there's a category, do nothing.
;; if there's a payee, use that as the
;; key. otherwise, use the split memo.
(cond ((and cat
(or (not (string? cat))
(string=? cat "")))
(set! key-string #f))
(payee
(set! key-string payee))
(memo
(set! ley-string memo)))
(if key-string
(let ((entry (hash-ref memo-hash key-string)))
(if (not entry)
(set! entry
(qif-import:guess-acct
payee
(if (> (qif-split:amount split) 0)
(list GNC-INCOME-TYPE)
(list GNC-EXPENSE-TYPE)))))
(qif-map-entry:set-display?! entry #t)
(hash-set! memo-hash key-string entry)))))
splits)))
(qif-file:xtns file)))
qif-files)
;; build display list
(for-each
(lambda (bin)
(for-each
(lambda (elt)
(if (qif-map-entry:display? (cdr elt))
(set! retval (cons (cdr elt) retval))))
bin))
(vector->list memo-hash))
;; sort by qif memo/payee name
(set! retval (sort retval
(lambda (a b)
(string<? (qif-map-entry:qif-name a)
(qif-map-entry:qif-name b)))))
retval))
(define (qif-dialog:qif-file-loaded? filename list-of-files)
(let ((status (map

View File

@ -53,11 +53,17 @@
children-list)
names)))
;; we'll be returning a list of 3 elements:
(define (safe-read)
(false-if-exception
(read)))
;; we'll be returning a list of 4 elements:
;; - a list of all the known gnucash accounts in
;; (shortname fullname account) format.
;; - a hash of QIF account name to gnucash account info
;; - a hash of QIF category to gnucash account info
;; - a hash of QIF memo/payee to gnucash account info <-- not yet
;; (older saved prefs may not have this one)
(let* ((pref-dir (build-path (getenv "HOME") ".gnucash"))
(pref-filename (build-path pref-dir "qif-accounts-map"))
(results '()))
@ -71,21 +77,33 @@
(lambda ()
(let ((qif-account-list #f)
(qif-cat-list #f)
(qif-memo-list #f)
(qif-account-hash #f)
(qif-cat-hash #f))
(set! qif-account-list (read))
(qif-cat-hash #f)
(qif-memo-hash #f))
(set! qif-account-list (safe-read))
(if (not (list? qif-account-list))
(set! qif-account-hash (make-hash-table 20))
(set! qif-account-hash
(qif-import:read-map qif-account-list)))
(set! qif-cat-list (read))
(set! qif-cat-list (safe-read))
(if (not (list? qif-cat-list))
(set! qif-cat-hash (make-hash-table 20))
(set! qif-cat-hash (qif-import:read-map qif-cat-list)))
(set! results (list qif-account-hash qif-cat-hash)))))
;;; (set! qif-memo-list (safe-read))
;;; (if (not (list? qif-cat-list))
;;; (set! qif-memo-hash (make-hash-table 20))
;;; (set! qif-memo-hash (qif-import:read-map qif-memo-list)))
;;; (set! results
;;; (list qif-account-hash qif-cat-hash qif-memo-hash)))))
(set! results
(list qif-account-hash qif-cat-hash)))))
(begin
(set! results (list (make-hash-table 20)
;;; (make-hash-table 20)
(make-hash-table 20)))))
;; now build the list of all known account names
@ -95,7 +113,6 @@
results))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; dump the mapping hash tables to a file. The hash tables are
;; updated when the user clicks the big "OK" button on the dialog,
@ -129,14 +146,10 @@
tablist)
table))
(define (qif-import:save-map-prefs acct-map cat-map)
(define (qif-import:save-map-prefs acct-map cat-map) ;; memo-map)
(let* ((pref-dir (build-path (getenv "HOME") ".gnucash"))
(pref-filename (build-path pref-dir "qif-accounts-map"))
(save-ok #f))
;; test for the existence of the directory and create it
;; if necessary
;; does the file exist? if not, create it; in either case,
;; make sure it's a directory and we have write and execute
;; permission.
@ -155,12 +168,15 @@
(display ";;; qif-accounts-map\n")
(display ";;; automatically generated by GNUcash. DO NOT EDIT\n")
(display ";;; (unless you really, really want to).\n")
(display ";;; map from QIF accounts to GNC accounts") (newline)
(qif-import:write-map acct-map)
(display ";;; map from QIF categories to GNC accounts") (newline)
(qif-import:write-map cat-map)
;;; (display ";;; map from QIF payee/memo to GNC accounts") (newline)
;;; (qif-import:write-map memo-map)
(newline))))))

View File

@ -212,6 +212,24 @@
(define (gnc:find-report id)
(hash-ref *gnc:_reports_* id))
(define (gnc:report-tree-collapse tree)
(let ((retval '()))
(define (do-list list)
(for-each
(lambda (elt)
(if (string? elt)
(set! retval (cons elt retval))
(if (not (list? elt))
(set! retval
(cons (with-output-to-string
(lambda () (display elt)))
retval))
(do-list elt))))
list))
(do-list tree)
retval))
(define (gnc:report-run id)
(define (dumper key . args)
(let ((stack (make-stack #t dumper)))
@ -228,10 +246,10 @@
(lambda (key . args)
#f)))
(define (gnc:report-run-unsafe id)
(let ((report (gnc:find-report id))
(start-time #f)
(end-time #f))
(start-time (gettimeofday)))
(if report
(if (and (not (gnc:report-dirty? report))
(gnc:report-ctext report))
@ -252,34 +270,24 @@
(_ "General") (_ "Stylesheet")))))
(stylesheet
(gnc:html-style-sheet-find stylesheet-name))
(doc #f)
(html #f))
(display "rerunning report.\n")
(if (gnc:debugging?)
(set! start-time (gettimeofday)))
(set! doc (renderer report))
(if (gnc:debugging?)
(begin
(set! end-time (gettimeofday))
(display "time to generate report: ")
(display (gnc:time-elapsed start-time end-time))
(newline)
(set! start-time (gettimeofday))))
(doc (renderer report))
(html #f)
(formlist #f)
(collapsed-list #f))
(gnc:html-document-set-style-sheet! doc stylesheet)
(set! html (gnc:html-document-render doc))
(if (gnc:debugging?)
(begin
(set! end-time (gettimeofday))
(display "time to render report to HTML: ")
(display (gnc:time-elapsed start-time end-time))
(newline)))
(set! formlist (gnc:html-document-render doc))
(set! collapsed-list (gnc:report-tree-collapse formlist))
(set! html (apply string-append collapsed-list))
(gnc:report-set-ctext! report html)
(gnc:report-set-dirty?! report #f)
(display "total time to run report: ")
(display (gnc:time-elapsed start-time (gettimeofday)))
(newline)
html)
#f)))
#f)))
(gnc:hook-add-dangler gnc:*main-window-opened-hook* gnc:report-menu-setup)