Bill Gribble's main window report patch.

* src/gnome/dialog-column-view.{c,h}: new files.  Options editor
	for the multicolumn report view.

	* src/gnome/dialog-options.{c,h}: add API to get notebook widget
	from standard options dialog

	* src/gnome/gnc-html.c: add handler for gnc-options:report-id=%d
	url... pops up the options editor for that report.

	* src/gnome/window-main.c: make the app main widget a notebook
	with side tabs.  When a report is run from the menu, it makes a
	new tab and put itself there (via gnc_report_in_main_window).

	* src/gnome/window-report.c: ask the report how to edit its
	options. Redo options dialog handling.  Add a "open in new window"
	option to the report toolbar/popup

	* src/scm/report.scm: add 'options-editor field to report template
	struct.  It's optional (there's a default).  Add a "Report name"
	option for all reports. Not used yet but will be soon.

	* src/scm/report/view-column.scm: a generic table layout for
	multiple reports.  Each report is in a table cell with a
	configurable rowspan and colspan.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3834 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-03-26 23:21:38 +00:00
parent 6ecf215be2
commit 446eb887c1
21 changed files with 1826 additions and 163 deletions

View File

@ -1,3 +1,30 @@
2001-03-26 Bill Gribble <grib@billgribble.com>
* src/gnome/dialog-column-view.{c,h}: new files. Options editor
for the multicolumn report view.
* src/gnome/dialog-options.{c,h}: add API to get notebook widget
from standard options dialog
* src/gnome/gnc-html.c: add handler for gnc-options:report-id=%d
url... pops up the options editor for that report.
* src/gnome/window-main.c: make the app main widget a notebook
with side tabs. When a report is run from the menu, it makes a
new tab and put itself there (via gnc_report_in_main_window).
* src/gnome/window-report.c: ask the report how to edit its
options. Redo options dialog handling. Add a "open in new window"
option to the report toolbar/popup
* src/scm/report.scm: add 'options-editor field to report template
struct. It's optional (there's a default). Add a "Report name"
option for all reports. Not used yet but will be soon.
* src/scm/report/view-column.scm: a generic table layout for
multiple reports. Each report is in a table cell with a
configurable rowspan and colspan.
2001-03-26 Dave Peticolas <dave@krondo.com>
* src/scm/report/transaction-report.scm: fix i18n bug

View File

@ -7,6 +7,7 @@ libgncgnome_a_SOURCES = \
dialog-account-picker.c \
dialog-account.c \
dialog-budget.c \
dialog-column-view.c \
dialog-commodity.c \
dialog-dup-trans.c \
dialog-filebox.c \
@ -69,6 +70,7 @@ noinst_HEADERS = \
dialog-account-picker.h \
dialog-account.h \
dialog-budget.h \
dialog-column-view.h \
dialog-commodity.h \
dialog-fincalc.h \
dialog-find-transactions.h \

View File

@ -0,0 +1,394 @@
/********************************************************************
* dialog-column-view.c -- editor for simple column view of reports *
* Copyright (C) 2001 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#include "config.h"
#include <gnome.h>
#include <guile/gh.h>
#include "option-util.h"
#include "glade-cb-gnc-dialogs.h"
#include "glade-gnc-dialogs.h"
#include "dialog-options.h"
#include "dialog-column-view.h"
struct gncp_column_view_edit {
GNCOptionWin * optwin;
GtkCList * available;
GtkCList * contents;
SCM options;
SCM view;
GNCOptionDB * odb;
SCM available_list;
int available_selected;
SCM contents_list;
int contents_selected;
};
static void
update_display_lists(gnc_column_view_edit * view) {
SCM get_names = gh_eval_str("gnc:all-report-template-names");
SCM find_report = gh_eval_str("gnc:find-report");
SCM get_options = gh_eval_str("gnc:report-options");
SCM get_option = gh_eval_str("gnc:lookup-option");
SCM get_value = gh_eval_str("gnc:option-value");
SCM names = gh_call0(get_names);
SCM contents =
gnc_option_db_lookup_option(view->odb, "__general", "report-list",
SCM_BOOL_F);
SCM this_report, this_options, this_name;
char * name[3];
scm_unprotect_object(view->available_list);
view->available_list = names;
scm_protect_object(view->available_list);
gtk_clist_clear(view->available);
if(gh_list_p(names)) {
for(; !gh_null_p(names); names = gh_cdr(names)) {
name[0] = gh_scm2newstr(gh_car(names), NULL);
gtk_clist_append(view->available, name);
free(name[0]);
}
}
gtk_clist_select_row(view->available, view->available_selected, 0);
scm_unprotect_object(view->contents_list);
view->contents_list = contents;
scm_protect_object(view->contents_list);
gtk_clist_clear(view->contents);
if(gh_list_p(contents)) {
for(; !gh_null_p(contents); contents = gh_cdr(contents)) {
this_report = gh_call1(find_report, gh_caar(contents));
this_options = gh_call1(get_options, this_report);
this_name = gh_call1(get_value,
gh_call3(get_option, this_options,
gh_str02scm("General"),
gh_str02scm("Report name")));
name[0] = gh_scm2newstr(this_name, NULL);
name[1] = g_strdup_printf("%d", gh_scm2int(gh_cadr(gh_car(contents))));
name[2] = g_strdup_printf("%d", gh_scm2int(gh_caddr(gh_car(contents))));
gtk_clist_append(view->contents, name);
free(name[0]);
g_free(name[1]);
g_free(name[2]);
}
}
gtk_clist_select_row(view->contents, view->contents_selected, 0);
}
static void
gnc_column_view_select_avail_cb(GtkCList * clist, gint row, gint col,
GdkEvent * ev, gpointer data) {
gnc_column_view_edit * r = data;
r->available_selected = row;
}
static void
gnc_column_view_select_contents_cb(GtkCList * clist, gint row, gint col,
GdkEvent * ev, gpointer data) {
gnc_column_view_edit * r = data;
r->contents_selected = row;
}
static void
gnc_column_view_edit_apply_cb(GNCOptionWin * win, gpointer user_data) {
gnc_column_view_edit * r = user_data;
gnc_option_db_commit(r->odb);
}
static void
gnc_column_view_edit_close_cb(GNCOptionWin * win, gpointer user_data) {
gnc_column_view_edit * r = user_data;
gnc_column_view_edit_destroy(r);
}
/********************************************************************
* gnc_column_view_edit_new
* create the editor.
********************************************************************/
gnc_column_view_edit *
gnc_column_view_edit_new(SCM options, SCM view) {
gnc_column_view_edit * r = g_new0(gnc_column_view_edit, 1);
GtkObject * tlo;
GtkWidget * editor;
r->optwin = gnc_options_dialog_new(TRUE);
tlo = GTK_OBJECT(create_Edit_Column_View_Page());
editor = gtk_object_get_data(tlo, "view_contents_hbox");
r->available = gtk_object_get_data(tlo, "available_list");
r->contents = gtk_object_get_data(tlo, "contents_list");
r->options = options;
r->view = view;
r->available_selected = 0;
r->available_list = SCM_EOL;
r->contents_selected = 0;
r->contents_list = SCM_EOL;
r->odb = gnc_option_db_new(r->options);
gnc_build_options_dialog_contents(r->optwin, r->odb);
gtk_widget_ref(editor);
gtk_container_remove(GTK_CONTAINER(tlo), editor);
gtk_notebook_append_page(GTK_NOTEBOOK(gnc_options_dialog_notebook
(r->optwin)),
editor,
gtk_label_new(_("Contents")));
scm_protect_object(r->options);
scm_protect_object(r->view);
scm_protect_object(r->available_list);
scm_protect_object(r->contents_list);
gtk_object_set_data(tlo, "view_edit_struct", (gpointer)r);
gtk_signal_connect(GTK_OBJECT(r->available), "select_row",
gnc_column_view_select_avail_cb, (gpointer)r);
gtk_signal_connect(GTK_OBJECT(r->contents), "select_row",
gnc_column_view_select_contents_cb, (gpointer)r);
update_display_lists(r);
gnc_options_dialog_set_apply_cb(r->optwin,
gnc_column_view_edit_apply_cb, r);
gnc_options_dialog_set_close_cb(r->optwin,
gnc_column_view_edit_close_cb, r);
gtk_widget_show_all(gnc_options_dialog_widget(r->optwin));
return r;
}
void
gnc_column_view_edit_destroy(gnc_column_view_edit * view) {
gnc_options_dialog_destroy(view->optwin);
scm_unprotect_object(view->options);
scm_unprotect_object(view->view);
gnc_option_db_destroy(view->odb);
g_free(view);
}
void
gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r =
gtk_object_get_data(GTK_OBJECT(user_data), "view_edit_struct");
SCM make_report = gh_eval_str("gnc:make-report");
SCM template_name;
SCM set_value = gh_eval_str("gnc:option-set-value");
SCM new_report;
SCM newlist = SCM_EOL;
SCM oldlist = r->contents_list;
int count;
int oldlength;
if(gh_list_p(r->available_list) &&
(gh_length(r->available_list) > r->available_selected)) {
template_name = gh_list_ref(r->available_list,
gh_int2scm(r->available_selected));
new_report = gh_call1(make_report, template_name);
oldlength = gh_length(r->contents_list);
if(oldlength > r->contents_selected) {
for(count = 0; count < r->contents_selected; count++) {
newlist = gh_cons(gh_car(oldlist), newlist);
oldlist = gh_cdr(oldlist);
}
newlist = gh_append2(gh_reverse(gh_cons(SCM_LIST3(new_report,
gh_int2scm(1),
gh_int2scm(1)),
newlist)),
oldlist);
}
else {
newlist = gh_append2(oldlist,
SCM_LIST1(SCM_LIST3(new_report,
gh_int2scm(1),
gh_int2scm(1))));
r->contents_selected = oldlength;
}
scm_unprotect_object(r->contents_list);
r->contents_list = newlist;
scm_protect_object(r->contents_list);
gnc_option_db_set_option(r->odb, "__general", "report-list",
r->contents_list);
}
update_display_lists(r);
}
void
gnc_column_view_edit_remove_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r =
gtk_object_get_data(GTK_OBJECT(user_data), "view_edit_struct");
SCM newlist = SCM_EOL;
SCM oldlist = r->contents_list;
int count;
int oldlength;
printf("remove cb\n");
if(gh_list_p(r->contents_list)) {
oldlength = gh_length(r->contents_list);
if(oldlength > r->contents_selected) {
for(count=0; count < r->contents_selected; count++) {
newlist = gh_cons(gh_car(oldlist), newlist);
oldlist = gh_cdr(oldlist);
}
if(count <= oldlength) {
newlist = gh_append2(gh_reverse(newlist), gh_cdr(oldlist));
}
}
if(oldlength == r->contents_selected + 1) {
r->contents_selected --;
}
scm_unprotect_object(r->contents_list);
r->contents_list = newlist;
scm_protect_object(r->contents_list);
gnc_option_db_set_option(r->odb, "__general", "report-list",
r->contents_list);
}
update_display_lists(r);
}
void
gnc_edit_column_view_move_up_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r =
gtk_object_get_data(GTK_OBJECT(user_data), "view_edit_struct");
SCM oldlist = r->contents_list;
SCM newlist = SCM_EOL;
SCM temp;
int oldlength;
int count;
oldlength = gh_length(r->contents_list);
if((r->contents_selected > 0) && (oldlength > r->contents_selected)) {
for(count = 1; count < r->contents_selected; count++) {
newlist = gh_cons(gh_car(oldlist), newlist);
oldlist = gh_cdr(oldlist);
}
temp = gh_car(oldlist);
oldlist = gh_cdr(oldlist);
newlist = gh_cons(temp, gh_cons(gh_car(oldlist), newlist));
newlist = gh_append2(gh_reverse(newlist), gh_cdr(oldlist));
scm_unprotect_object(r->contents_list);
r->contents_list = newlist;
scm_protect_object(r->contents_list);
r->contents_selected = r->contents_selected - 1;
gnc_option_db_set_option(r->odb, "__general", "report-list",
r->contents_list);
update_display_lists(r);
}
}
void
gnc_edit_column_view_move_down_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r =
gtk_object_get_data(GTK_OBJECT(user_data), "view_edit_struct");
SCM oldlist = r->contents_list;
SCM newlist = SCM_EOL;
SCM temp;
int oldlength;
int count;
oldlength = gh_length(r->contents_list);
if(oldlength > (r->contents_selected + 1)) {
for(count = 0; count < r->contents_selected; count++) {
newlist = gh_cons(gh_car(oldlist), newlist);
oldlist = gh_cdr(oldlist);
}
temp = gh_car(oldlist);
oldlist = gh_cdr(oldlist);
newlist = gh_cons(temp, gh_cons(gh_car(oldlist), newlist));
newlist = gh_append2(gh_reverse(newlist), gh_cdr(oldlist));
scm_unprotect_object(r->contents_list);
r->contents_list = newlist;
scm_protect_object(r->contents_list);
r->contents_selected = r->contents_selected + 1;
gnc_option_db_set_option(r->odb, "__general", "report-list",
r->contents_list);
update_display_lists(r);
}
}
void
gnc_column_view_edit_size_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r =
gtk_object_get_data(GTK_OBJECT(user_data), "view_edit_struct");
GtkWidget * dlg = create_Edit_Report_Size();
SCM current;
int length;
int dlg_ret;
/* get the spinner widgets */
GtkWidget * rowspin = gtk_object_get_data(GTK_OBJECT(dlg),
"row_spin");
GtkWidget * colspin = gtk_object_get_data(GTK_OBJECT(dlg),
"col_spin");
length = gh_length(r->contents_list);
if(length > r->contents_selected) {
current = gh_list_ref(r->contents_list,
gh_int2scm(r->contents_selected));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(colspin),
(float)gh_scm2int(gh_cadr(current)));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(rowspin),
(float)gh_scm2int(gh_caddr(current)));
dlg_ret = gnome_dialog_run_and_close(GNOME_DIALOG(dlg));
if(dlg_ret == 0) {
current = SCM_LIST3(gh_car(current),
gh_int2scm(gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(colspin))),
gh_int2scm(gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(rowspin))));
scm_unprotect_object(r->contents_list);
r->contents_list = scm_list_set_x(r->contents_list,
gh_int2scm(r->contents_selected),
current);
scm_protect_object(r->contents_list);
update_display_lists(r);
}
}
}

View File

@ -0,0 +1,28 @@
/********************************************************************
* dialog-column-view.h -- editor for simple column view *
* Copyright (C) 2001 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#include <guile/gh.h>
typedef struct gncp_column_view_edit gnc_column_view_edit;
gnc_column_view_edit * gnc_column_view_edit_new(SCM options, SCM view);
void gnc_column_view_edit_destroy(gnc_column_view_edit * e);

View File

@ -1797,6 +1797,11 @@ gnc_options_dialog_widget(GNCOptionWin * win) {
return win->container;
}
GtkWidget *
gnc_options_dialog_notebook(GNCOptionWin * win) {
return win->notebook;
}
static int
gnc_options_dialog_apply_stub_cb(GtkWidget * w, gpointer data) {
GNCOptionWin * window = data;
@ -1901,7 +1906,7 @@ gnc_options_dialog_new(gboolean make_toplevel) {
gtk_box_pack_start(GTK_BOX(buttonbox), close_button, TRUE, TRUE, 0);
retval->notebook = gtk_notebook_new();
gtk_box_pack_start(GTK_BOX(vbox), retval->notebook, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), retval->notebook, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(buttonbox), FALSE, TRUE, 0);
if(make_toplevel) {
@ -1910,6 +1915,10 @@ gnc_options_dialog_new(gboolean make_toplevel) {
gtk_widget_show_all(vbox);
if(make_toplevel) {
gtk_widget_show_all(retval->container);
}
return retval;
}

View File

@ -36,6 +36,7 @@ GNCOptionWin * gnc_options_dialog_new(gboolean make_toplevel);
void gnc_options_dialog_destroy(GNCOptionWin * win);
GtkWidget * gnc_options_dialog_widget(GNCOptionWin * win);
GtkWidget * gnc_options_dialog_notebook(GNCOptionWin * win);
void gnc_options_dialog_set_apply_cb(GNCOptionWin * win,
GNCOptionWinCallback thunk,

View File

@ -227,3 +227,39 @@ gnc_help_window_search_button_cb (GtkButton *button,
void
gnc_help_window_search_help_button_cb (GtkButton *button,
gpointer user_data);
void
gnc_column_view_edit_add_cb (GtkButton *button,
gpointer user_data);
void
gnc_column_view_edit_remove_cb (GtkButton *button,
gpointer user_data);
void
gnc_edit_column_view_move_up_cb (GtkButton *button,
gpointer user_data);
void
gnc_edit_column_view_move_down_cb (GtkButton *button,
gpointer user_data);
void
gnc_column_view_edit_add_cb (GtkButton *button,
gpointer user_data);
void
gnc_column_view_edit_remove_cb (GtkButton *button,
gpointer user_data);
void
gnc_edit_column_view_move_up_cb (GtkButton *button,
gpointer user_data);
void
gnc_edit_column_view_move_down_cb (GtkButton *button,
gpointer user_data);
void
gnc_column_view_edit_size_cb (GtkButton *button,
gpointer user_data);

View File

@ -5536,7 +5536,7 @@ create_Report_Window (void)
GtkWidget *report_vbox;
GtkWidget *handlebox2;
GtkWidget *report_toolbar;
GtkWidget *report_paned;
GtkWidget *report_frame;
Report_Window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_object_set_data (GTK_OBJECT (Report_Window), "Report_Window", Report_Window);
@ -5565,13 +5565,13 @@ create_Report_Window (void)
gtk_toolbar_set_space_style (GTK_TOOLBAR (report_toolbar), GTK_TOOLBAR_SPACE_LINE);
gtk_toolbar_set_button_relief (GTK_TOOLBAR (report_toolbar), GTK_RELIEF_NONE);
report_paned = gtk_hpaned_new ();
gtk_widget_ref (report_paned);
gtk_object_set_data_full (GTK_OBJECT (Report_Window), "report_paned", report_paned,
report_frame = gtk_frame_new (NULL);
gtk_widget_ref (report_frame);
gtk_object_set_data_full (GTK_OBJECT (Report_Window), "report_frame", report_frame,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (report_paned);
gtk_box_pack_start (GTK_BOX (report_vbox), report_paned, TRUE, TRUE, 0);
gtk_paned_set_position (GTK_PANED (report_paned), 0);
gtk_widget_show (report_frame);
gtk_box_pack_start (GTK_BOX (report_vbox), report_frame, TRUE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (report_frame), GTK_SHADOW_NONE);
return Report_Window;
}
@ -6748,3 +6748,323 @@ create_Username_Password_Dialog (void)
return Username_Password_Dialog;
}
GtkWidget*
create_Edit_Column_View_Page (void)
{
GtkWidget *Edit_Column_View_Page;
GtkWidget *view_contents_hbox;
GtkWidget *scrolledwindow26;
GtkWidget *available_list;
GtkWidget *label847720;
GtkWidget *vbox109;
GtkWidget *label847721;
GtkWidget *button85;
GtkWidget *button86;
GtkWidget *label847722;
GtkWidget *button87;
GtkWidget *button88;
GtkWidget *label847723;
GtkWidget *button89;
GtkWidget *label847728;
GtkWidget *scrolledwindow27;
GtkWidget *contents_list;
GtkWidget *label847725;
GtkWidget *label847726;
GtkWidget *label847727;
Edit_Column_View_Page = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_object_set_data (GTK_OBJECT (Edit_Column_View_Page), "Edit_Column_View_Page", Edit_Column_View_Page);
gtk_window_set_title (GTK_WINDOW (Edit_Column_View_Page), _("window1"));
gtk_window_set_policy (GTK_WINDOW (Edit_Column_View_Page), TRUE, TRUE, FALSE);
view_contents_hbox = gtk_hbox_new (FALSE, 5);
gtk_widget_ref (view_contents_hbox);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "view_contents_hbox", view_contents_hbox,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (view_contents_hbox);
gtk_container_add (GTK_CONTAINER (Edit_Column_View_Page), view_contents_hbox);
gtk_container_set_border_width (GTK_CONTAINER (view_contents_hbox), 3);
scrolledwindow26 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow26);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "scrolledwindow26", scrolledwindow26,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow26);
gtk_box_pack_start (GTK_BOX (view_contents_hbox), scrolledwindow26, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow26), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
available_list = gtk_clist_new (1);
gtk_widget_ref (available_list);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "available_list", available_list,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (available_list);
gtk_container_add (GTK_CONTAINER (scrolledwindow26), available_list);
gtk_clist_set_column_width (GTK_CLIST (available_list), 0, 80);
gtk_clist_column_titles_show (GTK_CLIST (available_list));
label847720 = gtk_label_new (_("Available reports"));
gtk_widget_ref (label847720);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "label847720", label847720,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847720);
gtk_clist_set_column_widget (GTK_CLIST (available_list), 0, label847720);
vbox109 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox109);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "vbox109", vbox109,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox109);
gtk_box_pack_start (GTK_BOX (view_contents_hbox), vbox109, FALSE, FALSE, 0);
label847721 = gtk_label_new (_(" "));
gtk_widget_ref (label847721);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "label847721", label847721,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847721);
gtk_box_pack_start (GTK_BOX (vbox109), label847721, TRUE, TRUE, 0);
button85 = gtk_button_new_with_label (_("Add >>"));
gtk_widget_ref (button85);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "button85", button85,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button85);
gtk_box_pack_start (GTK_BOX (vbox109), button85, FALSE, FALSE, 0);
button86 = gtk_button_new_with_label (_("<< Remove"));
gtk_widget_ref (button86);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "button86", button86,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button86);
gtk_box_pack_start (GTK_BOX (vbox109), button86, FALSE, FALSE, 0);
label847722 = gtk_label_new ("");
gtk_widget_ref (label847722);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "label847722", label847722,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847722);
gtk_box_pack_start (GTK_BOX (vbox109), label847722, FALSE, TRUE, 0);
button87 = gtk_button_new_with_label (_("Move up"));
gtk_widget_ref (button87);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "button87", button87,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button87);
gtk_box_pack_start (GTK_BOX (vbox109), button87, FALSE, FALSE, 0);
button88 = gtk_button_new_with_label (_("Move down"));
gtk_widget_ref (button88);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "button88", button88,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button88);
gtk_box_pack_start (GTK_BOX (vbox109), button88, FALSE, FALSE, 0);
label847723 = gtk_label_new ("");
gtk_widget_ref (label847723);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "label847723", label847723,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847723);
gtk_box_pack_start (GTK_BOX (vbox109), label847723, FALSE, FALSE, 0);
button89 = gtk_button_new_with_label (_("Size ..."));
gtk_widget_ref (button89);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "button89", button89,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button89);
gtk_box_pack_start (GTK_BOX (vbox109), button89, FALSE, FALSE, 0);
label847728 = gtk_label_new ("");
gtk_widget_ref (label847728);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "label847728", label847728,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847728);
gtk_box_pack_start (GTK_BOX (vbox109), label847728, TRUE, TRUE, 0);
scrolledwindow27 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow27);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "scrolledwindow27", scrolledwindow27,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow27);
gtk_box_pack_start (GTK_BOX (view_contents_hbox), scrolledwindow27, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow27), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
contents_list = gtk_clist_new (3);
gtk_widget_ref (contents_list);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "contents_list", contents_list,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (contents_list);
gtk_container_add (GTK_CONTAINER (scrolledwindow27), contents_list);
gtk_clist_set_column_width (GTK_CLIST (contents_list), 0, 150);
gtk_clist_set_column_width (GTK_CLIST (contents_list), 1, 34);
gtk_clist_set_column_width (GTK_CLIST (contents_list), 2, 25);
gtk_clist_column_titles_show (GTK_CLIST (contents_list));
label847725 = gtk_label_new (_("Report"));
gtk_widget_ref (label847725);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "label847725", label847725,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847725);
gtk_clist_set_column_widget (GTK_CLIST (contents_list), 0, label847725);
label847726 = gtk_label_new (_("Cols"));
gtk_widget_ref (label847726);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "label847726", label847726,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847726);
gtk_clist_set_column_widget (GTK_CLIST (contents_list), 1, label847726);
label847727 = gtk_label_new (_("Rows"));
gtk_widget_ref (label847727);
gtk_object_set_data_full (GTK_OBJECT (Edit_Column_View_Page), "label847727", label847727,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847727);
gtk_clist_set_column_widget (GTK_CLIST (contents_list), 2, label847727);
gtk_signal_connect (GTK_OBJECT (button85), "clicked",
GTK_SIGNAL_FUNC (gnc_column_view_edit_add_cb),
Edit_Column_View_Page);
gtk_signal_connect (GTK_OBJECT (button86), "clicked",
GTK_SIGNAL_FUNC (gnc_column_view_edit_remove_cb),
Edit_Column_View_Page);
gtk_signal_connect (GTK_OBJECT (button87), "clicked",
GTK_SIGNAL_FUNC (gnc_edit_column_view_move_up_cb),
Edit_Column_View_Page);
gtk_signal_connect (GTK_OBJECT (button88), "clicked",
GTK_SIGNAL_FUNC (gnc_edit_column_view_move_down_cb),
Edit_Column_View_Page);
gtk_signal_connect (GTK_OBJECT (button89), "clicked",
GTK_SIGNAL_FUNC (gnc_column_view_edit_size_cb),
Edit_Column_View_Page);
return Edit_Column_View_Page;
}
GtkWidget*
create_Edit_Report_Size (void)
{
GtkWidget *Edit_Report_Size;
GtkWidget *dialog_vbox17;
GtkWidget *frame48;
GtkWidget *hbox97;
GtkWidget *vbox111;
GtkWidget *label847729;
GtkWidget *label847730;
GtkWidget *label847731;
GtkWidget *vbox112;
GtkObject *row_spin_adj;
GtkWidget *row_spin;
GtkObject *col_spin_adj;
GtkWidget *col_spin;
GtkWidget *label847732;
GtkWidget *dialog_action_area17;
GtkWidget *button90;
GtkWidget *button92;
Edit_Report_Size = gnome_dialog_new (NULL, NULL);
gtk_object_set_data (GTK_OBJECT (Edit_Report_Size), "Edit_Report_Size", Edit_Report_Size);
gtk_window_set_modal (GTK_WINDOW (Edit_Report_Size), TRUE);
gtk_window_set_policy (GTK_WINDOW (Edit_Report_Size), FALSE, FALSE, FALSE);
gnome_dialog_close_hides (GNOME_DIALOG (Edit_Report_Size), TRUE);
dialog_vbox17 = GNOME_DIALOG (Edit_Report_Size)->vbox;
gtk_object_set_data (GTK_OBJECT (Edit_Report_Size), "dialog_vbox17", dialog_vbox17);
gtk_widget_show (dialog_vbox17);
frame48 = gtk_frame_new (_("Enter report row/column span"));
gtk_widget_ref (frame48);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "frame48", frame48,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame48);
gtk_box_pack_start (GTK_BOX (dialog_vbox17), frame48, TRUE, TRUE, 0);
hbox97 = gtk_hbox_new (FALSE, 4);
gtk_widget_ref (hbox97);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "hbox97", hbox97,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox97);
gtk_container_add (GTK_CONTAINER (frame48), hbox97);
vbox111 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox111);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "vbox111", vbox111,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox111);
gtk_box_pack_start (GTK_BOX (hbox97), vbox111, TRUE, TRUE, 0);
label847729 = gtk_label_new (_("Row span:"));
gtk_widget_ref (label847729);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "label847729", label847729,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847729);
gtk_box_pack_start (GTK_BOX (vbox111), label847729, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label847729), 1, 0.5);
label847730 = gtk_label_new (_("Column span:"));
gtk_widget_ref (label847730);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "label847730", label847730,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847730);
gtk_box_pack_start (GTK_BOX (vbox111), label847730, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label847730), 1, 0.5);
label847731 = gtk_label_new ("");
gtk_widget_ref (label847731);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "label847731", label847731,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847731);
gtk_box_pack_start (GTK_BOX (vbox111), label847731, FALSE, FALSE, 0);
vbox112 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox112);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "vbox112", vbox112,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox112);
gtk_box_pack_start (GTK_BOX (hbox97), vbox112, TRUE, TRUE, 0);
row_spin_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
row_spin = gtk_spin_button_new (GTK_ADJUSTMENT (row_spin_adj), 1, 0);
gtk_widget_ref (row_spin);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "row_spin", row_spin,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (row_spin);
gtk_box_pack_start (GTK_BOX (vbox112), row_spin, FALSE, FALSE, 0);
col_spin_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
col_spin = gtk_spin_button_new (GTK_ADJUSTMENT (col_spin_adj), 1, 0);
gtk_widget_ref (col_spin);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "col_spin", col_spin,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (col_spin);
gtk_box_pack_start (GTK_BOX (vbox112), col_spin, FALSE, FALSE, 0);
label847732 = gtk_label_new ("");
gtk_widget_ref (label847732);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "label847732", label847732,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847732);
gtk_box_pack_start (GTK_BOX (vbox112), label847732, FALSE, FALSE, 0);
dialog_action_area17 = GNOME_DIALOG (Edit_Report_Size)->action_area;
gtk_object_set_data (GTK_OBJECT (Edit_Report_Size), "dialog_action_area17", dialog_action_area17);
gtk_widget_show (dialog_action_area17);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area17), GTK_BUTTONBOX_SPREAD);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area17), 8);
gnome_dialog_append_button (GNOME_DIALOG (Edit_Report_Size), GNOME_STOCK_BUTTON_OK);
button90 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Edit_Report_Size)->buttons)->data);
gtk_widget_ref (button90);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "button90", button90,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button90);
GTK_WIDGET_SET_FLAGS (button90, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Edit_Report_Size), GNOME_STOCK_BUTTON_CANCEL);
button92 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Edit_Report_Size)->buttons)->data);
gtk_widget_ref (button92);
gtk_object_set_data_full (GTK_OBJECT (Edit_Report_Size), "button92", button92,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button92);
GTK_WIDGET_SET_FLAGS (button92, GTK_CAN_DEFAULT);
return Edit_Report_Size;
}

View File

@ -23,3 +23,5 @@ GtkWidget* create_Duplicate_Transaction_Dialog (void);
GtkWidget* create_HTML_Style_Sheet_Dialog (void);
GtkWidget* create_Stock_Split_Druid (void);
GtkWidget* create_Username_Password_Dialog (void);
GtkWidget* create_Edit_Column_View_Page (void);
GtkWidget* create_Edit_Report_Size (void);

View File

@ -8229,11 +8229,10 @@ words.
</widget>
<widget>
<class>GtkHPaned</class>
<name>report_paned</name>
<handle_size>10</handle_size>
<gutter_size>6</gutter_size>
<position>0</position>
<class>GtkFrame</class>
<name>report_frame</name>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_NONE</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
@ -8243,10 +8242,6 @@ words.
<widget>
<class>Placeholder</class>
</widget>
<widget>
<class>Placeholder</class>
</widget>
</widget>
</widget>
</widget>
@ -9986,4 +9981,519 @@ quit without making any changes.</text>
</widget>
</widget>
<widget>
<class>GtkWindow</class>
<name>Edit Column View Page</name>
<title>window1</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkHBox</class>
<name>view_contents_hbox</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow26</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkCList</class>
<name>available_list</name>
<can_focus>True</can_focus>
<columns>1</columns>
<column_widths>80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label847720</name>
<label>Available reports</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox109</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label847721</name>
<label> </label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button85</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_column_view_edit_add_cb</handler>
<data>Edit_Column_View_Page</data>
<last_modification_time>Fri, 23 Mar 2001 21:37:59 GMT</last_modification_time>
</signal>
<label>Add &gt;&gt;</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button86</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_column_view_edit_remove_cb</handler>
<data>Edit_Column_View_Page</data>
<last_modification_time>Fri, 23 Mar 2001 21:38:06 GMT</last_modification_time>
</signal>
<label>&lt;&lt; Remove</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label847722</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button87</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_edit_column_view_move_up_cb</handler>
<data>Edit_Column_View_Page</data>
<last_modification_time>Fri, 23 Mar 2001 21:38:13 GMT</last_modification_time>
</signal>
<label>Move up</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button88</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_edit_column_view_move_down_cb</handler>
<data>Edit_Column_View_Page</data>
<last_modification_time>Fri, 23 Mar 2001 21:38:19 GMT</last_modification_time>
</signal>
<label>Move down</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label847723</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button89</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_column_view_edit_size_cb</handler>
<data>Edit_Column_View_Page</data>
<last_modification_time>Sat, 24 Mar 2001 17:51:58 GMT</last_modification_time>
</signal>
<label>Size ...</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label847728</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow27</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkCList</class>
<name>contents_list</name>
<can_focus>True</can_focus>
<columns>3</columns>
<column_widths>150,34,25</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label847725</name>
<label>Report</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label847726</name>
<label>Cols</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label847727</name>
<label>Rows</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>Edit Report Size</name>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>True</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>True</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox17</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area17</name>
<layout_style>GTK_BUTTONBOX_SPREAD</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button90</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>button92</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame48</name>
<label>Enter report row/column span</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox97</name>
<homogeneous>False</homogeneous>
<spacing>4</spacing>
<widget>
<class>GtkVBox</class>
<name>vbox111</name>
<homogeneous>True</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label847729</name>
<label>Row span:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label847730</name>
<label>Column span:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label847731</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox112</name>
<homogeneous>True</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkSpinButton</class>
<name>row_spin</name>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
<numeric>False</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>1</value>
<lower>0</lower>
<upper>100</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkSpinButton</class>
<name>col_spin</name>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
<numeric>False</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>1</value>
<lower>0</lower>
<upper>100</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label847732</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -200,6 +200,9 @@ gnc_html_parse_url(gnc_html * html, const gchar * url,
else if(!strcmp(protocol, "gnc-report")) {
retval = URL_TYPE_REPORT;
}
else if(!strcmp(protocol, "gnc-options")) {
retval = URL_TYPE_OPTIONS;
}
else if(!strcmp(protocol, "gnc-scm")) {
retval = URL_TYPE_SCHEME;
}
@ -344,7 +347,7 @@ extract_base_name(URLType type, const gchar * path) {
static char * url_type_names[] = {
"file:", "", "http:", "ftp:", "https:",
"gnc-register:", "gnc-report:", "gnc-scm:",
"gnc-register:", "gnc-report:", "gnc-options:", "gnc-scm:",
"gnc-help:", "gnc-xml:", "gnc-action:", ""
};
@ -587,6 +590,7 @@ gnc_html_load_to_stream(gnc_html * html, GtkHTMLStream * handle,
break;
case URL_TYPE_REGISTER:
case URL_TYPE_OPTIONS:
case URL_TYPE_SCHEME:
case URL_TYPE_FTP:
default:
@ -1044,6 +1048,35 @@ gnc_html_open_register(gnc_html * html, const gchar * location) {
}
}
/********************************************************************
* gnc_html_open_options
* open an editor for report parameters
********************************************************************/
static void
gnc_html_open_options(gnc_html * html, const gchar * location) {
int report_id;
SCM find_report = gh_eval_str("gnc:find-report");
SCM get_options = gh_eval_str("gnc:report-options");
SCM get_editor = gh_eval_str("gnc:report-options-editor");
SCM report;
SCM options;
SCM editor;
/* href="gnc-options:report-id=2676" */
if(!strncmp("report-id=", location, 10)) {
sscanf(location+10, "%d", &report_id);
report = gh_call1(find_report, gh_int2scm(report_id));
options = gh_call1(get_options, report);
editor = gh_call1(get_editor, report);
gh_call2(editor, options, report);
}
else {
gnc_warning_dialog(_("Badly formed gnc-options: URL."));
}
}
/********************************************************************
* gnc_html_open_report
@ -1164,7 +1197,11 @@ gnc_html_show_url(gnc_html * html, URLType type,
case URL_TYPE_REPORT:
gnc_html_open_report(html, location, label, newwin);
break;
case URL_TYPE_OPTIONS:
gnc_html_open_options(html, location);
break;
case URL_TYPE_HELP:
gnc_html_open_help(html, location, label, newwin);
break;

View File

@ -33,6 +33,7 @@ typedef enum { URL_TYPE_FILE, URL_TYPE_JUMP,
URL_TYPE_SECURE,
URL_TYPE_REGISTER, /* for gnucash register popups */
URL_TYPE_REPORT, /* for gnucash report popups */
URL_TYPE_OPTIONS, /* for editing report options */
URL_TYPE_SCHEME, /* for scheme code evaluation */
URL_TYPE_HELP, /* for a gnucash help window */
URL_TYPE_XMLDATA, /* links to gnucash XML data files */

View File

@ -3,7 +3,7 @@
* and callback functions for GnuCash *
* Copyright (C) 1998,1999 Jeremy Collins *
* Copyright (C) 1998,1999,2000 Linas Vepstas *
* *
* Copyright (C) 2001 Bill Gribble *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
@ -74,6 +74,7 @@ struct _GNCMainInfo
{
GtkWidget *account_tree;
GtkWidget *totals_combo;
GtkWidget *notebook;
GList *totals_list;
SCM main_window_change_callback_id;
@ -1609,10 +1610,21 @@ mainWindow (void)
"General", "Toolbar Buttons");
/* create scrolled window */
main_info->notebook = gtk_notebook_new();
gtk_notebook_set_show_border(GTK_NOTEBOOK(main_info->notebook), TRUE);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_info->notebook), TRUE);
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_info->notebook),
GTK_POS_LEFT);
main_info->account_tree = gnc_mainwin_account_tree_new();
gnome_app_set_contents(GNOME_APP(app), main_info->account_tree);
gtk_notebook_append_page(GTK_NOTEBOOK(main_info->notebook),
main_info->account_tree,
gtk_label_new("Accounts"));
/* gnome_app_set_contents(GNOME_APP(app), main_info->account_tree); */
gnome_app_set_contents(GNOME_APP(app), main_info->notebook);
gnc_main_create_menus(GNOME_APP(app), main_info->account_tree, main_info);
gtk_signal_connect(GTK_OBJECT(main_info->account_tree), "activate_account",
@ -1641,6 +1653,7 @@ mainWindow (void)
/* Show everything now that it is created */
gtk_widget_show (summarybar);
gtk_widget_show (statusbar);
gtk_widget_show_all (main_info->notebook);
gtk_widget_show (main_info->account_tree);
gnc_configure_account_tree (main_info);
@ -1677,4 +1690,26 @@ gnc_ui_destroy_all_subwindows (void)
gnc_resume_gui_refresh ();
}
void
gnc_report_in_main_window (int report_id) {
GNCMainInfo * mainwin = gnc_get_main_info();
GtkWidget * fr = gtk_frame_new(NULL);
gnc_report_window * reptwin = gnc_report_window_new(fr);
SCM get_report = gh_eval_str("gnc:find-report");
SCM get_name = gh_eval_str("gnc:report-name");
char * report_name;
gtk_frame_set_shadow_type(GTK_FRAME(fr), GTK_SHADOW_NONE);
report_name = gh_scm2newstr(gh_call1(get_name,
gh_call1(get_report,
gh_int2scm(report_id))),
NULL);
gtk_widget_show_all(fr);
gtk_notebook_append_page(GTK_NOTEBOOK(mainwin->notebook),
fr, gtk_label_new(report_name));
gnc_report_window_show_report(reptwin, report_id);
}
/********************* END OF FILE **********************************/

View File

@ -35,4 +35,6 @@ void gnc_ui_mainWindow_save_size(void);
void gnc_default_ui_start(void);
int gnucash_ui_init(void);
void gnc_report_in_main_window (int report_id);
#endif

View File

@ -30,6 +30,8 @@
#include <gnome.h>
#include <guile/gh.h>
#include <g-wrap-runtime-guile.h>
#include "dialog-options.h"
#include "dialog-utils.h"
#include "glade-gnc-dialogs.h"
@ -44,20 +46,16 @@
#define WINDOW_REPORT_CM_CLASS "window-report"
struct _gnc_report_window {
GtkWidget * container;
GtkWidget * paned;
GtkWidget * container;
gboolean top_level;
GtkWidget * popup;
GtkWidget * popup;
GtkWidget * back_widg;
GtkWidget * fwd_widg;
GNCOptionWin * option_dialog;
GNCOptionDB * odb;
SCM scm_report;
SCM scm_options;
SCM scm_options_edit;
gnc_html * html;
};
@ -128,6 +126,7 @@ gnc_report_window_stop_button_cb(GtkWidget * w, gpointer data) {
return TRUE;
}
static int
gnc_report_window_export_button_cb(GtkWidget * w, gpointer data) {
gnc_report_window * report = data;
@ -136,6 +135,39 @@ gnc_report_window_export_button_cb(GtkWidget * w, gpointer data) {
return TRUE;
}
static int
gnc_report_window_params_cb(GtkWidget * w, gpointer data) {
gnc_report_window * report = data;
SCM scm_wintype = gh_eval_str("<gnc:report-window*>");
if(gh_procedure_p(report->scm_options_edit)) {
gh_call2(report->scm_options_edit,
report->scm_options,
report->scm_report);
}
else {
gnc_report_window_default_params_editor(report->scm_options,
report->scm_report);
}
return TRUE;
}
static int
gnc_report_window_newwin_cb(GtkWidget * w, gpointer data) {
gnc_report_window * report = data;
gnc_report_window * newwin = gnc_report_window_new(NULL);
SCM get_id = gh_eval_str("gnc:report-id");
SCM id = gh_call1(get_id, report->scm_report);
if(gh_number_p(id)) {
gnc_report_window_show_report(newwin, gh_scm2int(id));
}
return TRUE;
}
static int
gnc_report_window_reload_button_cb(GtkWidget * w, gpointer data) {
gnc_report_window * report = data;
@ -146,45 +178,17 @@ gnc_report_window_reload_button_cb(GtkWidget * w, gpointer data) {
return TRUE;
}
static void
gnc_report_window_set_back_button(gnc_report_window * win, int enabled) {
gtk_widget_set_sensitive(win->back_widg, enabled);
}
static void
gnc_report_window_set_fwd_button(gnc_report_window * win, int enabled) {
gtk_widget_set_sensitive(win->fwd_widg, enabled);
}
static void
gnc_options_dialog_apply_cb(GNCOptionWin * propertybox,
gpointer user_data) {
SCM dirty_report = gh_eval_str("gnc:report-set-dirty?!");
gnc_report_window * win = user_data;
gnc_option_db_commit(win->odb);
gh_call2(dirty_report, win->scm_report, SCM_BOOL_T);
gnc_html_reload(win->html);
}
static void
gnc_options_dialog_help_cb(GNCOptionWin * propertybox,
gpointer user_data) {
gnome_ok_dialog("Set the report options you want using this dialog.");
}
static void
gnc_options_dialog_close_cb(GNCOptionWin * propertybox,
gpointer user_data) {
gnc_report_window * win = user_data;
gtk_widget_hide(gnc_options_dialog_widget(win->option_dialog));
gtk_paned_set_position(GTK_PANED(win->paned), 0);
}
/********************************************************************
* gnc_report_window_load_cb
* called after a report is loaded into the gnc_html widget
@ -198,8 +202,10 @@ gnc_report_window_load_cb(gnc_html * html, URLType type,
int report_id;
SCM find_report = gh_eval_str("gnc:find-report");
SCM get_options = gh_eval_str("gnc:report-options");
SCM get_editor = gh_eval_str("gnc:report-options-editor");
SCM inst_report;
SCM inst_options;
SCM inst_options_ed;
if(!strncmp("id=", location, 3)) {
sscanf(location+3, "%d", &report_id);
@ -209,59 +215,22 @@ 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) {
* options and editor thunk */
if((inst_report = gh_call1(find_report, gh_int2scm(report_id))) ==
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)
gnc_option_db_destroy(win->odb);
if(win->option_dialog)
gnc_options_dialog_destroy(win->option_dialog);
win->odb = NULL;
win->option_dialog = NULL;
}
if(inst_options != SCM_BOOL_F) {
if(!win->odb) {
win->odb = gnc_option_db_new(inst_options);
gnc_option_db_clean(win->odb);
}
if(!win->option_dialog) {
win->option_dialog = gnc_options_dialog_new(FALSE);
gtk_paned_add1(GTK_PANED(win->paned),
gnc_options_dialog_widget(win->option_dialog));
gnc_build_options_dialog_contents(win->option_dialog,
win->odb);
gtk_widget_show_all(win->paned);
gtk_widget_hide(gnc_options_dialog_widget(win->option_dialog));
}
gnc_options_dialog_set_apply_cb(win->option_dialog,
gnc_options_dialog_apply_cb,
win);
gnc_options_dialog_set_help_cb(win->option_dialog,
gnc_options_dialog_help_cb,
win);
gnc_options_dialog_set_close_cb(win->option_dialog,
gnc_options_dialog_close_cb,
win);
}
inst_options = gh_call1(get_options, inst_report);
inst_options_ed = gh_call1(get_editor, inst_report);
scm_unprotect_object(win->scm_options);
win->scm_options = inst_options;
scm_protect_object(win->scm_options);
scm_unprotect_object(win->scm_options_edit);
win->scm_options_edit = inst_options_ed;
scm_protect_object(win->scm_options_edit);
scm_unprotect_object(win->scm_report);
win->scm_report = inst_report;
scm_protect_object(win->scm_report);
@ -282,7 +251,6 @@ gnc_report_window_load_cb(gnc_html * html, URLType type,
}
/********************************************************************
* gnc_report_window_destroy_cb
********************************************************************/
@ -290,25 +258,27 @@ gnc_report_window_load_cb(gnc_html * html, URLType type,
static void
gnc_report_window_destroy_cb(GtkWidget * w, gpointer data) {
gnc_report_window * win = data;
SCM scm_wintype = gh_eval_str("<gnc:report-window*>");
/* make sure we don't get a double dose -o- destruction */
gtk_signal_disconnect_by_data(GTK_OBJECT(win->container),
data);
/* delete the window from the open list */
if (win->top_level)
if(win->top_level) {
gnc_unregister_gui_component_by_data (WINDOW_REPORT_CM_CLASS, win);
}
gnc_html_destroy(win->html);
if(win->option_dialog) {
gnc_options_dialog_destroy(win->option_dialog);
if(win->popup) {
gtk_widget_destroy(win->popup);
}
if(win->odb) gnc_option_db_destroy(win->odb);
win->popup = NULL;
win->container = NULL;
win->option_dialog = NULL;
win->odb = NULL;
win->html = NULL;
scm_unprotect_object(win->scm_options);
scm_unprotect_object(win->scm_options_edit);
scm_unprotect_object(win->scm_report);
g_free(win);
@ -323,7 +293,12 @@ static void
gnc_report_window_close_cb(GtkWidget * w, gpointer data) {
gnc_report_window * rw = data;
gnc_close_gui_component_by_data (WINDOW_REPORT_CM_CLASS, rw);
if(rw->top_level) {
gnc_close_gui_component_by_data (WINDOW_REPORT_CM_CLASS, rw);
}
else {
gtk_widget_destroy(rw->container);
}
}
@ -349,16 +324,6 @@ gnc_report_window_button_cb(gnc_html * html, GdkEventButton * event,
return FALSE;
}
static int
gnc_report_window_params_cb(GtkWidget * w, gpointer data) {
gnc_report_window * win = data;
if (!win->option_dialog)
return TRUE;
gtk_widget_show(gnc_options_dialog_widget(win->option_dialog));
gtk_paned_set_position(GTK_PANED(win->paned), 400);
return TRUE;
}
static void
gnc_report_window_print_cb(GtkWidget * w, gpointer data) {
gnc_report_window * win = data;
@ -391,15 +356,15 @@ static void
close_handler (gpointer user_data)
{
gnc_report_window *win = user_data;
if (win->top_level)
{
gdk_window_get_geometry (GTK_WIDGET(win->container)->window, NULL, NULL,
&last_width, &last_height, NULL);
gnc_save_window_size ("report_win", last_width, last_height);
}
gnc_report_window_destroy (win);
}
@ -413,6 +378,7 @@ gnc_report_window_new(GtkWidget * container) {
gnc_report_window * report = g_new0(gnc_report_window, 1);
GtkObject * tlo;
GtkWidget * cframe = NULL;
GtkWidget * toolbar = NULL;
GnomeUIInfo toolbar_data[] =
@ -482,6 +448,15 @@ gnc_report_window_new(GtkWidget * container) {
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM,
_("New window"),
_("Open this report in a new window"),
gnc_report_window_newwin_cb, report,
NULL,
GNOME_APP_PIXMAP_STOCK,
GNOME_STOCK_PIXMAP_NEW,
0, 0, NULL
},
{ GNOME_APP_UI_ITEM,
_("Close"),
_("Close this report window"),
@ -494,48 +469,44 @@ gnc_report_window_new(GtkWidget * container) {
GNOMEUIINFO_END
};
report->html = gnc_html_new();
report->scm_options = SCM_BOOL_F;
report->scm_report = SCM_BOOL_F;
report->html = gnc_html_new();
report->scm_options = SCM_BOOL_F;
report->scm_options_edit = SCM_BOOL_F;
report->scm_report = SCM_BOOL_F;
gnc_html_history_set_node_destroy_cb(gnc_html_get_history(report->html),
gnc_report_window_history_destroy_cb,
(gpointer)report);
scm_protect_object(report->scm_options);
scm_protect_object(report->scm_options_edit);
scm_protect_object(report->scm_report);
if(container) {
report->container = container;
report->top_level = FALSE;
report->paned = gtk_hpaned_new();
gtk_paned_add2(GTK_PANED(report->paned),
gnc_html_get_widget(report->html));
gtk_container_add(GTK_CONTAINER(container), report->paned);
report->popup = gnome_popup_menu_new(toolbar_data);
gtk_container_add(GTK_CONTAINER(container),
gnc_html_get_widget(report->html));
}
else {
report->container = create_Report_Window();
report->top_level = TRUE;
report->popup = NULL;
tlo = GTK_OBJECT(report->container);
toolbar = gtk_object_get_data(tlo, "report_toolbar");
report->paned = gtk_object_get_data(tlo, "report_paned");
cframe = gtk_object_get_data(tlo, "report_frame");
gnome_app_fill_toolbar(GTK_TOOLBAR(toolbar), toolbar_data, NULL);
gtk_paned_add2(GTK_PANED(report->paned),
gnc_html_get_widget(report->html));
gtk_container_add(GTK_CONTAINER(cframe),
gnc_html_get_widget(report->html));
gnc_register_gui_component (WINDOW_REPORT_CM_CLASS, NULL,
close_handler, report);
}
report->back_widg = toolbar_data[0].widget;
report->fwd_widg = toolbar_data[1].widget;
gtk_paned_set_gutter_size(GTK_PANED(report->paned), 20);
gtk_paned_set_position(GTK_PANED(report->paned), 0);
gnc_html_set_urltype_cb(report->html, gnc_report_window_check_urltype);
gnc_html_set_load_cb(report->html, gnc_report_window_load_cb, report);
gnc_html_set_button_cb(report->html, gnc_report_window_button_cb, report);
@ -544,22 +515,18 @@ gnc_report_window_new(GtkWidget * container) {
GTK_SIGNAL_FUNC(gnc_report_window_destroy_cb),
report);
report->option_dialog = NULL;
report->odb = NULL;
if (report->top_level)
{
if (report->top_level) {
if (last_width == 0)
gnc_get_window_size("report_win", &last_width, &last_height);
gtk_window_set_default_size(GTK_WINDOW(report->container),
last_width, last_height);
gnc_window_adjust_for_screen (GTK_WINDOW(report->container));
}
gtk_widget_show_all(report->container);
return report;
}
@ -617,3 +584,66 @@ gnc_print_report (int report_id)
gnc_html_destroy (html);
}
struct report_default_params_data {
GNCOptionWin * win;
GNCOptionDB * db;
SCM scm_options;
SCM scm_report;
};
static void
gnc_options_dialog_apply_cb(GNCOptionWin * propertybox,
gpointer user_data) {
SCM dirty_report = gh_eval_str("gnc:report-set-dirty?!");
struct report_default_params_data * win = user_data;
if(!win) return;
gnc_option_db_commit(win->db);
gh_call2(dirty_report, win->scm_report, SCM_BOOL_T);
}
static void
gnc_options_dialog_help_cb(GNCOptionWin * propertybox,
gpointer user_data) {
gnome_ok_dialog("Set the report options you want using this dialog.");
}
static void
gnc_options_dialog_close_cb(GNCOptionWin * propertybox,
gpointer user_data) {
struct report_default_params_data * win = user_data;
gnc_option_db_destroy(win->db);
scm_unprotect_object(win->scm_options);
gnc_options_dialog_destroy(win->win);
g_free(win);
}
void
gnc_report_window_default_params_editor(SCM options, SCM report) {
struct report_default_params_data * prm =
g_new0(struct report_default_params_data, 1);
prm->scm_options = options;
prm->scm_report = report;
prm->db = gnc_option_db_new(prm->scm_options);
prm->win = gnc_options_dialog_new(TRUE);
scm_protect_object(prm->scm_options);
scm_protect_object(prm->scm_report);
gnc_build_options_dialog_contents(prm->win, prm->db);
gnc_options_dialog_set_apply_cb(prm->win,
gnc_options_dialog_apply_cb,
(gpointer)prm);
gnc_options_dialog_set_help_cb(prm->win,
gnc_options_dialog_help_cb,
(gpointer)prm);
gnc_options_dialog_set_close_cb(prm->win,
gnc_options_dialog_close_cb,
(gpointer)prm);
}

View File

@ -38,6 +38,8 @@ void gnc_report_window_destroy(gnc_report_window * rep);
void gnc_report_window_show_report(gnc_report_window * rw, int id);
gnc_html * gnc_report_window_get_html(gnc_report_window * rw);
void gnc_report_window_default_params_editor(SCM options, SCM report);
void reportWindow(int id);
void gnc_print_report (int report_id);

View File

@ -401,6 +401,7 @@
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

View File

@ -55,7 +55,7 @@
(lambda ()
(let ((rept (gnc:make-report
(gnc:report-template-name report))))
(gnc:report-window rept)))))
(gnc:report-in-main-window rept)))))
(gnc:add-extension item))))
;; add the menu option to edit style sheets
@ -77,22 +77,20 @@
(define <report-template>
(make-record-type "<report-template>"
;; The data items in a report record
'(version name options-generator renderer in-menu?)))
'(version name options-generator options-editor
renderer in-menu?)))
(define (gnc:define-report . args)
;; For now the version is ignored, but in the future it'll let us
;; change behaviors without breaking older reports.
;;
;; The generator should be a function that accepts one argument, a
;; set of options, and generates the report.
;;
;; This code must return as its final value a string representing
;; the contents of the HTML document. preferably this should be
;; generated via the <html-document> class, but it's not required.
;; The renderer should be a function that accepts one argument, a
;; set of options, and generates the report. the renderer must
;; return as its final value an <html-document> object.
(define (blank-report)
;; Number of #f's == Number of data members
((record-constructor <report-template>) #f #f #f #f #t))
((record-constructor <report-template>) #f #f #f gnc:default-options-editor #f #t))
(define (args-to-defn in-report-rec args)
(let ((report-rec (if in-report-rec
@ -119,6 +117,8 @@
(record-accessor <report-template> 'name))
(define gnc:report-template-options-generator
(record-accessor <report-template> 'options-generator))
(define gnc:report-template-options-editor
(record-accessor <report-template> 'options-editor))
(define gnc:report-template-renderer
(record-accessor <report-template> 'renderer))
(define gnc:report-in-menu?
@ -126,9 +126,14 @@
(define (gnc:report-template-new-options report-template)
(let ((generator (gnc:report-template-options-generator report-template))
(namer
(gnc:make-string-option
(N_ "General") (N_ "Report name") "0a"
(N_ "Enter a descriptive name for this report")
(gnc:report-template-name report-template)))
(stylesheet
(gnc:make-multichoice-option
(N_ "General") (N_ "Stylesheet") "0a"
(N_ "General") (N_ "Stylesheet") "0b"
(N_ "Select a stylesheet for the report.")
(string->symbol (N_ "Default"))
(map
@ -139,12 +144,15 @@
(string-append (gnc:html-style-sheet-name ss)
(_ " Stylesheet"))))
(gnc:get-html-style-sheets)))))
(if (procedure? generator)
(let ((options (generator)))
(gnc:register-option options stylesheet)
(gnc:register-option options namer)
options)
(let ((options (gnc:new-options)))
(gnc:register-option options stylesheet)
(gnc:register-option options names)
options))))
(define <report>
@ -211,6 +219,50 @@
(gnc:report-template-new-options template)
#f)))
(define (gnc:report-options-editor report)
(let ((template
(hash-ref *gnc:_report-templates_*
(gnc:report-type report))))
(if template
(gnc:report-template-options-editor template)
#f)))
(define (gnc:report-name report)
(gnc:option-value
(gnc:lookup-option (gnc:report-options report)
(N_ "General") (N_ "Report name"))))
;;; (define (gnc:report-default-options-editor)
;;; (let* ((option-db #f)
;;; (option-dlg #f))
;;; (define (editor options action report-win)
;;; (if (string? action)
;;; (cond
;;; ;; open: start the options editor.
;;; ((string=? action "open")
;;; (set! option-db
;;; (gnc:option-db-new options))
;;; (set! option-dlg
;;; (gnc:options-dialog-new #t))
;;; (gnc:build-options-dialog-contents
;;; option-dlg option-db)
;;; ;; set up the default callbacks
;;; (gnc:report-default-options-setup option-dlg report-win))
;;; ;; close: shut it down, probably because the report window
;;; ;; is getting closed.
;;; ((string=? action "close")
;;; (gnc:options-dialog-destroy option-dlg)))
(define (gnc:all-report-template-names)
(sort
(hash-fold
(lambda (k v p)
(cons k p))
'() *gnc:_report-templates_*)
string<?))
(define (gnc:report-remove-by-id id)
(let ((r (hash-ref *gnc:_reports_* id)))
(for-each

View File

@ -16,7 +16,8 @@ gncscm_DATA = \
taxtxf.scm \
txf-export.scm \
txf-export-help.scm \
transaction-report.scm
transaction-report.scm \
view-column.scm
EXTRA_DIST = \
.cvsignore \

View File

@ -24,3 +24,6 @@
;; style sheets
(gnc:depend "report/stylesheet-plain.scm")
(gnc:depend "report/stylesheet-fancy.scm")
;; view templates
(gnc:depend "report/view-column.scm")

View File

@ -0,0 +1,170 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; view-column.scm : simple multi-column table view.
;; Copyright 2001 Bill Gribble <grib@gnumatic.com>
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, contact:
;;
;; Free Software Foundation Voice: +1-617-542-5942
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "report/view-column.scm")
;; multi-column view. this is the no brainer. The only parameters
;; are the list of reports to display (with rowspan and colspan for
;; each), in order, and the number of columns in the table. It gets
;; edited in a special window. Every view gets a stylesheet so we
;; don't have to worry about that here.
(let ()
(define (make-options)
(let* ((options (gnc:new-options))
(opt-register
(lambda (opt)
(gnc:register-option options opt))))
;; the report-list is edited by a special add-on page for the
;; options editor.
(opt-register
(gnc:make-internal-option
"__general" "report-list" '()))
(opt-register
(gnc:make-number-range-option
(N_ "General") (N_ "Number of columns") "a"
(N_ "Number of columns before wrapping to a new row")
1 0 20 0 1))
options))
(define (edit-options option-obj report-obj)
(gnc:column-view-edit-new option-obj report-obj))
(define (render-view report)
(let* ((view-doc (gnc:make-html-document))
(options (gnc:report-options report))
(reports
(gnc:option-value
(gnc:lookup-option options "__general" "report-list")))
(table-width
(gnc:option-value
(gnc:lookup-option
options (N_ "General") (N_ "Number of columns"))))
(column-allocs (make-hash-table 11))
(column-tab (gnc:make-html-table))
(current-row '())
(current-width 0)
(current-row-num 0))
;; we really would rather do something smart here with the
;; report's cached text if possible. For the moment, we'll have
;; to rerun every report, every time... FIXME
(for-each
(lambda (report-info)
;; run the report renderer, pick out the document style table
;; and objects from the returned document, then make a new
;; HTML table cell with those objects as content and append
;; it to the table. The weird stuff with the column-allocs
;; hash is an attempt to compute how many columnc are
;; actually used in a row; items with non-1 rowspans will take
;; up cells in the row without actually being in the row.
(let* ((report (gnc:find-report (car report-info)))
(colspan (cadr report-info))
(rowspan (caddr report-info))
(template (hash-ref *gnc:_report-templates_*
(gnc:report-type report)))
(renderer (gnc:report-template-renderer template))
(report-doc (renderer report))
(report-style (gnc:html-document-style report-doc))
(report-objects (gnc:html-document-objects report-doc))
(report-table (gnc:make-html-table))
(contents-cell
(apply gnc:make-html-table-cell report-objects))
(toplevel-cell
(gnc:make-html-table-cell/size rowspan colspan)))
;; increment the alloc number for each occupied row
(let loop ((row current-row-num))
(let ((allocation (hash-ref column-allocs row)))
(if (not allocation)
(set! allocation 0))
(hash-set! column-allocs row (+ colspan allocation))
(if (< (- row current-row-num) rowspan)
(loop (+ 1 row)))))
(gnc:html-table-cell-set-style-internal!
contents-cell report-style)
(gnc:html-table-cell-set-style!
toplevel-cell "td"
'attribute (list "valign" "top")
'inheritable? #f)
;; put the report in the contents-cell
(gnc:html-table-append-row!
report-table (list contents-cell))
;; and a parameter editor
(gnc:html-table-append-row!
report-table
(list (gnc:make-html-text
(gnc:html-markup-anchor
(sprintf #f "gnc-options:report-id=%a" (car report-info))
"Edit Options"))))
;; add the report-table to the toplevel-cell
(gnc:html-table-cell-append-objects!
toplevel-cell report-table)
(set! current-row (append current-row (list toplevel-cell)))
(set! current-width (+ current-width colspan))
(if (>= current-width table-width)
(begin
(gnc:html-table-append-row! column-tab current-row)
;; cells above with non-1 rowspan can force 'pre-allocation'
;; of space on this row
(set! current-row-num (+ 1 current-row-num))
(set! current-width (hash-ref column-allocs current-row-num))
(if (not current-width) (set! current-width 0))
(set! current-row '())))))
reports)
(if (not (null? current-row))
(gnc:html-table-append-row! column-tab current-row))
;; make sure the table is nice and big
(gnc:html-table-set-style!
column-tab "table"
'attribute (list "width" "100%"))
(gnc:html-document-add-object! view-doc column-tab)
;; and we're done.
view-doc))
;; define the view now.
(gnc:define-report
'version 1.0
'name "Multicolumn View"
'renderer render-view
'options-generator make-options
'options-editor edit-options))
#### End of Patch data ####