mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Overhaul the print check dialog. Make HIG changes, and make the
dialog remember its state across invocations (including all the custom values). Fix a crash when canceling printing. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12949 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,5 +1,15 @@
|
||||
2006-01-22 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/scm/printing/print-check.scm:
|
||||
* src/gnome/glade/print.glade:
|
||||
* src/gnome/schemas/Makefile.am:
|
||||
* src/gnome/schemas/apps_gnucash_dialog_common.schemas.in:
|
||||
* src/gnome/schemas/apps_gnucash_dialog_print_checks.schemas.in:
|
||||
* src/gnome/dialog-print-check.[ch]: Overhaul the print check
|
||||
dialog. Make HIG changes, and make the dialog remember its state
|
||||
across invocations (including all the custom values). Fix a crash
|
||||
when canceling printing.
|
||||
|
||||
* src/register/ledger-core/dialog-dup-trans.c:
|
||||
* src/gnome-utils/dialog-account.c:
|
||||
* src/gnome-utils/glade/commodity.glade:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/********************************************************************\
|
||||
* dialog-print-check.c : dialog to control check printing. *
|
||||
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
|
||||
* Copyright (C) 2006 David Hampton <hampton@employees.org> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@@ -30,6 +31,7 @@
|
||||
#include <libguile.h>
|
||||
|
||||
#include "gnc-date.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-numeric.h"
|
||||
#include "gnc-plugin-page-register.h"
|
||||
#include "dialog-print-check.h"
|
||||
@@ -42,12 +44,170 @@
|
||||
#define CHECK_PRINT_NUM_POSITIONS 4
|
||||
#define CHECK_PRINT_NUM_UNITS 4
|
||||
|
||||
#define PRINT_CHECK_DATA "print-check-data"
|
||||
#define GCONF_SECTION "dialogs/print_checks"
|
||||
#define KEY_CHECK_FORMAT "check_format"
|
||||
#define KEY_CHECK_POSITION "check_position"
|
||||
#define KEY_DATE_FORMAT "date_format"
|
||||
#define KEY_DATE_FORMAT_USER "date_format_custom"
|
||||
#define KEY_CUSTOM_PAYEE "custom_payee"
|
||||
#define KEY_CUSTOM_DATE "custom_date"
|
||||
#define KEY_CUSTOM_WORDS "custom_amount_words"
|
||||
#define KEY_CUSTOM_NUMBER "custom_amount_number"
|
||||
#define KEY_CUSTOM_MEMO "custom_memo"
|
||||
#define KEY_CUSTOM_POSITION "custom_position"
|
||||
#define KEY_CUSTOM_UNITS "custom_units"
|
||||
|
||||
/* Used by glade_xml_signal_autoconnect_full */
|
||||
void gnc_ui_print_check_dialog_ok_cb(GtkButton * button, gpointer user_data);
|
||||
void gnc_ui_print_check_dialog_cancel_cb(GtkButton * button, gpointer user_data);
|
||||
void gnc_ui_print_check_dialog_help_cb(GtkButton * button, gpointer user_data);
|
||||
void gnc_ui_print_check_response_cb(GtkDialog * dialog, gint response, PrintCheckDialog * pcd);
|
||||
static void gnc_ui_print_save_dialog(PrintCheckDialog * pcd);
|
||||
static void gnc_ui_print_restore_dialog(PrintCheckDialog * pcd);
|
||||
|
||||
void gnc_ui_print_restore_dialog(PrintCheckDialog * pcd);
|
||||
|
||||
struct _print_check_dialog {
|
||||
GladeXML * xml;
|
||||
GtkWidget * dialog;
|
||||
|
||||
GncPluginPageRegister *plugin_page;
|
||||
const char *payee;
|
||||
gnc_numeric amount;
|
||||
time_t date;
|
||||
const char *memo;
|
||||
|
||||
GtkWidget * format_combobox;
|
||||
GtkWidget * position_combobox;
|
||||
GtkSpinButton * payee_x, * payee_y;
|
||||
GtkSpinButton * date_x, * date_y;
|
||||
GtkSpinButton * words_x, * words_y;
|
||||
GtkSpinButton * number_x, * number_y;
|
||||
GtkSpinButton * memo_x, * memo_y;
|
||||
|
||||
GtkSpinButton * check_position;
|
||||
|
||||
GtkWidget * units_combobox;
|
||||
|
||||
GtkWidget * date_format;
|
||||
|
||||
gchar *format_string;
|
||||
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
save_float_pair (const char *section, const char *key, double a, double b)
|
||||
{
|
||||
GSList *coord_list = NULL;
|
||||
|
||||
coord_list = g_slist_append(coord_list, &a);
|
||||
coord_list = g_slist_append(coord_list, &b);
|
||||
gnc_gconf_set_list(section, key, GCONF_VALUE_FLOAT, coord_list, NULL);
|
||||
g_slist_free(coord_list);
|
||||
}
|
||||
|
||||
static void
|
||||
get_float_pair (const char *section, const char *key, double *a, double *b)
|
||||
{
|
||||
GSList *coord_list;
|
||||
|
||||
coord_list = gnc_gconf_get_list (section, key, GCONF_VALUE_FLOAT, NULL);
|
||||
if (NULL == coord_list) {
|
||||
*a = 0;
|
||||
*b = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
*a = *(gdouble*)g_slist_nth_data(coord_list, 0);
|
||||
*b = *(gdouble*)g_slist_nth_data(coord_list, 1);
|
||||
g_slist_free(coord_list);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ui_print_save_dialog(PrintCheckDialog * pcd)
|
||||
{
|
||||
const gchar *format;
|
||||
gint active;
|
||||
|
||||
/* Options page */
|
||||
active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->format_combobox));
|
||||
gnc_gconf_set_int(GCONF_SECTION, KEY_CHECK_FORMAT, active, NULL);
|
||||
active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox));
|
||||
gnc_gconf_set_int(GCONF_SECTION, KEY_CHECK_POSITION, active, NULL);
|
||||
active = gnc_date_format_get_format (GNC_DATE_FORMAT(pcd->date_format));
|
||||
gnc_gconf_set_int(GCONF_SECTION, KEY_DATE_FORMAT, active, NULL);
|
||||
if (active == QOF_DATE_FORMAT_CUSTOM) {
|
||||
format = gnc_date_format_get_custom (GNC_DATE_FORMAT(pcd->date_format));
|
||||
gnc_gconf_set_string(GCONF_SECTION, KEY_DATE_FORMAT_USER, format, NULL);
|
||||
} else {
|
||||
gnc_gconf_unset (GCONF_SECTION, KEY_DATE_FORMAT_USER, NULL);
|
||||
}
|
||||
|
||||
/* Custom format page */
|
||||
save_float_pair(GCONF_SECTION, KEY_CUSTOM_PAYEE,
|
||||
gtk_spin_button_get_value(pcd->payee_x),
|
||||
gtk_spin_button_get_value(pcd->payee_y));
|
||||
save_float_pair(GCONF_SECTION, KEY_CUSTOM_DATE,
|
||||
gtk_spin_button_get_value(pcd->date_x),
|
||||
gtk_spin_button_get_value(pcd->date_y));
|
||||
save_float_pair(GCONF_SECTION, KEY_CUSTOM_WORDS,
|
||||
gtk_spin_button_get_value(pcd->words_x),
|
||||
gtk_spin_button_get_value(pcd->words_y));
|
||||
save_float_pair(GCONF_SECTION, KEY_CUSTOM_NUMBER,
|
||||
gtk_spin_button_get_value(pcd->number_x),
|
||||
gtk_spin_button_get_value(pcd->number_y));
|
||||
save_float_pair(GCONF_SECTION, KEY_CUSTOM_MEMO,
|
||||
gtk_spin_button_get_value(pcd->memo_x),
|
||||
gtk_spin_button_get_value(pcd->memo_y));
|
||||
gnc_gconf_set_float(GCONF_SECTION, KEY_CUSTOM_POSITION,
|
||||
gtk_spin_button_get_value(pcd->check_position),
|
||||
NULL);
|
||||
active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox));
|
||||
gnc_gconf_set_int(GCONF_SECTION, KEY_CUSTOM_UNITS, active, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ui_print_restore_dialog(PrintCheckDialog * pcd)
|
||||
{
|
||||
gchar *format;
|
||||
gdouble x, y;
|
||||
gint active;
|
||||
|
||||
/* Options page */
|
||||
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_FORMAT, NULL);
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), active);
|
||||
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_POSITION, NULL);
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->position_combobox), active);
|
||||
active = gnc_gconf_get_int(GCONF_SECTION, KEY_DATE_FORMAT, NULL);
|
||||
gnc_date_format_set_format(GNC_DATE_FORMAT(pcd->date_format), active);
|
||||
if (active == QOF_DATE_FORMAT_CUSTOM) {
|
||||
format = gnc_gconf_get_string(GCONF_SECTION, KEY_DATE_FORMAT_USER, NULL);
|
||||
if (format) {
|
||||
gnc_date_format_set_custom(GNC_DATE_FORMAT(pcd->date_format), format);
|
||||
g_free(format);
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom format page */
|
||||
get_float_pair(GCONF_SECTION, KEY_CUSTOM_PAYEE, &x, &y);
|
||||
gtk_spin_button_set_value(pcd->payee_x, x);
|
||||
gtk_spin_button_set_value(pcd->payee_y, y);
|
||||
|
||||
get_float_pair(GCONF_SECTION, KEY_CUSTOM_DATE, &x, &y);
|
||||
gtk_spin_button_set_value(pcd->date_x, x);
|
||||
gtk_spin_button_set_value(pcd->date_y, y);
|
||||
get_float_pair(GCONF_SECTION, KEY_CUSTOM_WORDS, &x, &y);
|
||||
gtk_spin_button_set_value(pcd->words_x, x);
|
||||
gtk_spin_button_set_value(pcd->words_y, y);
|
||||
get_float_pair(GCONF_SECTION, KEY_CUSTOM_NUMBER, &x, &y);
|
||||
gtk_spin_button_set_value(pcd->number_x, x);
|
||||
gtk_spin_button_set_value(pcd->number_y, y);
|
||||
get_float_pair(GCONF_SECTION, KEY_CUSTOM_MEMO, &x, &y);
|
||||
gtk_spin_button_set_value(pcd->memo_x, x);
|
||||
gtk_spin_button_set_value(pcd->memo_y, y);
|
||||
x = gnc_gconf_get_float(GCONF_SECTION, KEY_CUSTOM_POSITION, NULL);
|
||||
gtk_spin_button_set_value(pcd->check_position, x);
|
||||
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CUSTOM_UNITS, NULL);
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->units_combobox), active);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
@@ -67,19 +227,7 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
|
||||
GtkWidget *table;
|
||||
GtkWindow *window;
|
||||
|
||||
pcd = g_object_get_data(G_OBJECT(plugin_page), PRINT_CHECK_DATA);
|
||||
if (pcd) {
|
||||
pcd->payee = payee;
|
||||
pcd->amount = amount;
|
||||
pcd->date = date;
|
||||
pcd->memo = memo;
|
||||
gnc_date_format_refresh(GNC_DATE_FORMAT(pcd->date_format));
|
||||
gtk_window_present (GTK_WINDOW(pcd->dialog));
|
||||
return;
|
||||
}
|
||||
|
||||
pcd = g_new0(PrintCheckDialog, 1);
|
||||
g_object_set_data(G_OBJECT(plugin_page), PRINT_CHECK_DATA, pcd);
|
||||
pcd->plugin_page = plugin_page;
|
||||
pcd->payee = payee;
|
||||
pcd->amount = amount;
|
||||
@@ -89,31 +237,30 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
|
||||
xml = gnc_glade_xml_new ("print.glade", "Print Check Dialog");
|
||||
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func, pcd);
|
||||
|
||||
pcd->xml = xml;
|
||||
pcd->dialog = glade_xml_get_widget (xml, "Print Check Dialog");
|
||||
|
||||
/* now pick out the relevant child widgets */
|
||||
pcd->format_picker = glade_xml_get_widget (xml, "check_format_picker");
|
||||
pcd->position_picker = glade_xml_get_widget (xml, "check_position_picker");
|
||||
pcd->format_combobox = glade_xml_get_widget (xml, "check_format_combobox");
|
||||
pcd->position_combobox = glade_xml_get_widget (xml, "check_position_combobox");
|
||||
|
||||
pcd->payee_x = glade_xml_get_widget (xml, "payee_x_entry");
|
||||
pcd->payee_y = glade_xml_get_widget (xml, "payee_y_entry");
|
||||
pcd->date_x = glade_xml_get_widget (xml, "date_x_entry");
|
||||
pcd->date_y = glade_xml_get_widget (xml, "date_y_entry");
|
||||
pcd->words_x = glade_xml_get_widget (xml, "amount_words_x_entry");
|
||||
pcd->words_y = glade_xml_get_widget (xml, "amount_words_y_entry");
|
||||
pcd->number_x = glade_xml_get_widget (xml, "amount_numbers_x_entry");
|
||||
pcd->number_y = glade_xml_get_widget (xml, "amount_numbers_y_entry");
|
||||
pcd->memo_x = glade_xml_get_widget (xml, "memo_x_entry");
|
||||
pcd->memo_y = glade_xml_get_widget (xml, "memo_y_entry");
|
||||
pcd->check_position = glade_xml_get_widget (xml, "check_position_entry");
|
||||
pcd->format_entry = glade_xml_get_widget (xml, "date_format_entry");
|
||||
pcd->units_picker = glade_xml_get_widget (xml, "units_picker");
|
||||
|
||||
/* fix the option menus so we can diagnose which option is
|
||||
selected */
|
||||
gnc_option_menu_init(pcd->format_picker);
|
||||
gnc_option_menu_init(pcd->position_picker);
|
||||
gnc_option_menu_init(pcd->units_picker);
|
||||
pcd->payee_x = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "payee_x_entry"));
|
||||
pcd->payee_y = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "payee_y_entry"));
|
||||
pcd->date_x = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "date_x_entry"));
|
||||
pcd->date_y = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "date_y_entry"));
|
||||
pcd->words_x =
|
||||
GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "amount_words_x_entry"));
|
||||
pcd->words_y =
|
||||
GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "amount_words_y_entry"));
|
||||
pcd->number_x =
|
||||
GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "amount_numbers_x_entry"));
|
||||
pcd->number_y =
|
||||
GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "amount_numbers_y_entry"));
|
||||
pcd->memo_x = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "memo_x_entry"));
|
||||
pcd->memo_y = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "memo_y_entry"));
|
||||
pcd->check_position =
|
||||
GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "check_position_entry"));
|
||||
pcd->units_combobox = glade_xml_get_widget (xml, "units_combobox");
|
||||
|
||||
window = GTK_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(pcd->dialog), window);
|
||||
@@ -121,57 +268,20 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
|
||||
/* Create and attach the date-format chooser */
|
||||
table = glade_xml_get_widget (xml, "options_table");
|
||||
pcd->date_format = gnc_date_format_new_without_label();
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), pcd->date_format, 1, 4, 2, 7);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), pcd->date_format, 1, 3, 2, 7);
|
||||
|
||||
gnc_ui_print_restore_dialog(pcd);
|
||||
gnc_restore_window_size(GCONF_SECTION, GTK_WINDOW(pcd->dialog));
|
||||
gtk_widget_show_all(pcd->dialog);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_print_check_dialog_destroy
|
||||
*
|
||||
* Don't destroy the dialog until the program exits. This will
|
||||
* maintain *all* user settings from invocation to invocation.
|
||||
*
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_print_check_dialog_destroy(PrintCheckDialog * pcd)
|
||||
{
|
||||
gtk_widget_destroy(pcd->dialog);
|
||||
pcd->dialog = NULL;
|
||||
|
||||
g_object_set_data(G_OBJECT(pcd->plugin_page), PRINT_CHECK_DATA, NULL);
|
||||
g_free(pcd);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ui_print_check_dialog_hide(PrintCheckDialog * pcd)
|
||||
{
|
||||
gtk_widget_hide(pcd->dialog);
|
||||
}
|
||||
|
||||
static double
|
||||
entry_to_double(GtkWidget * entry)
|
||||
{
|
||||
const char * text = gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
double retval = 0.0;
|
||||
|
||||
sscanf(text, "%le", &retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_print_check_dialog_ok_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_print_check_dialog_ok_cb(GtkButton * button,
|
||||
gpointer user_data)
|
||||
static void
|
||||
gnc_ui_print_check_dialog_ok_cb(PrintCheckDialog * pcd)
|
||||
{
|
||||
PrintCheckDialog * pcd = user_data;
|
||||
|
||||
SCM make_check_format = scm_c_eval_string("make-print-check-format");
|
||||
SCM print_check = scm_c_eval_string("gnc:print-check");
|
||||
SCM format_data;
|
||||
@@ -182,14 +292,19 @@ gnc_ui_print_check_dialog_ok_cb(GtkButton * button,
|
||||
char * formats[] = { "quicken", "deluxe", "wallet", "custom" };
|
||||
char * positions[] = { "top", "middle", "bottom", "custom" };
|
||||
|
||||
sel_option = gnc_option_menu_get_active(pcd->format_picker);
|
||||
fmt = scm_str2symbol(formats[sel_option]);
|
||||
sel_option = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->format_combobox));
|
||||
if (-1 == sel_option)
|
||||
return;
|
||||
fmt = scm_str2symbol(formats[sel_option]);
|
||||
|
||||
sel_option = gnc_option_menu_get_active(pcd->position_picker);
|
||||
posn = scm_str2symbol(positions[sel_option]);
|
||||
sel_option = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox));
|
||||
if (-1 == sel_option)
|
||||
return;
|
||||
posn = scm_str2symbol(positions[sel_option]);
|
||||
|
||||
sel_option = gnc_option_menu_get_active(pcd->units_picker);
|
||||
sel_option = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox));
|
||||
switch(sel_option) {
|
||||
case -1: return;
|
||||
case 0: multip = 72.0; break; /* inches */
|
||||
case 1: multip = 28.346; break; /* cm */
|
||||
case 2: multip = 2.8346; break; /* mm */
|
||||
@@ -200,29 +315,27 @@ gnc_ui_print_check_dialog_ok_cb(GtkButton * button,
|
||||
(gnc_date_format_get_custom(GNC_DATE_FORMAT(pcd->date_format)));
|
||||
|
||||
cust_format =
|
||||
SCM_LIST7
|
||||
SCM_LIST6
|
||||
(scm_cons(scm_str2symbol("payee"),
|
||||
SCM_LIST2(scm_make_real(multip*entry_to_double(pcd->payee_x)),
|
||||
scm_make_real(multip*entry_to_double(pcd->payee_y)))),
|
||||
SCM_LIST2(scm_make_real(multip*gtk_spin_button_get_value(pcd->payee_x)),
|
||||
scm_make_real(multip*gtk_spin_button_get_value(pcd->payee_y)))),
|
||||
scm_cons(scm_str2symbol("date"),
|
||||
SCM_LIST2(scm_make_real(multip*entry_to_double(pcd->date_x)),
|
||||
scm_make_real(multip*entry_to_double(pcd->date_y)))),
|
||||
SCM_LIST2(scm_make_real(multip*gtk_spin_button_get_value(pcd->date_x)),
|
||||
scm_make_real(multip*gtk_spin_button_get_value(pcd->date_y)))),
|
||||
scm_cons(scm_str2symbol("amount-words"),
|
||||
SCM_LIST2(scm_make_real(multip*entry_to_double(pcd->words_x)),
|
||||
scm_make_real(multip*entry_to_double(pcd->words_y)))),
|
||||
SCM_LIST2(scm_make_real(multip*gtk_spin_button_get_value(pcd->words_x)),
|
||||
scm_make_real(multip*gtk_spin_button_get_value(pcd->words_y)))),
|
||||
scm_cons(scm_str2symbol("amount-number"),
|
||||
SCM_LIST2(scm_make_real(multip*entry_to_double(pcd->number_x)),
|
||||
scm_make_real(multip*entry_to_double(pcd->number_y)))),
|
||||
SCM_LIST2(scm_make_real(multip*gtk_spin_button_get_value(pcd->number_x)),
|
||||
scm_make_real(multip*gtk_spin_button_get_value(pcd->number_y)))),
|
||||
scm_cons(scm_str2symbol("memo"),
|
||||
SCM_LIST2(scm_make_real(multip*entry_to_double(pcd->memo_x)),
|
||||
scm_make_real(multip*entry_to_double(pcd->memo_y)))),
|
||||
SCM_LIST2(scm_make_real(multip*gtk_spin_button_get_value(pcd->memo_x)),
|
||||
scm_make_real(multip*gtk_spin_button_get_value(pcd->memo_y)))),
|
||||
scm_cons(scm_str2symbol("position"),
|
||||
scm_make_real(multip*entry_to_double(pcd->check_position))),
|
||||
scm_cons(scm_str2symbol("date-format"),
|
||||
scm_makfrom0str(gtk_entry_get_text(GTK_ENTRY(pcd->format_entry)))));
|
||||
scm_make_real(multip*gtk_spin_button_get_value(pcd->check_position))));
|
||||
|
||||
/* hide the window */
|
||||
gnc_ui_print_check_dialog_hide(pcd);
|
||||
gtk_widget_hide(pcd->dialog);
|
||||
|
||||
/* now call the callback passed in from the scheme side with
|
||||
the format as an arg */
|
||||
@@ -241,26 +354,27 @@ gnc_ui_print_check_dialog_ok_cb(GtkButton * button,
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_print_check_dialog_cancel_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_print_check_dialog_cancel_cb(GtkButton * button,
|
||||
gpointer user_data)
|
||||
gnc_ui_print_check_response_cb(GtkDialog * dialog,
|
||||
gint response,
|
||||
PrintCheckDialog *pcd)
|
||||
{
|
||||
PrintCheckDialog * pcd = user_data;
|
||||
switch (response) {
|
||||
case GTK_RESPONSE_HELP:
|
||||
gnc_gnome_help(HF_USAGE, HL_PRINTCHECK);
|
||||
return;
|
||||
|
||||
gnc_ui_print_check_dialog_hide(pcd);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_print_check_dialog_help_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_print_check_dialog_help_cb(GtkButton * button,
|
||||
gpointer user_data)
|
||||
{
|
||||
gnc_gnome_help(HF_USAGE, HL_PRINTCHECK);
|
||||
case GTK_RESPONSE_OK:
|
||||
gnc_ui_print_check_dialog_ok_cb(pcd);
|
||||
gnc_ui_print_save_dialog(pcd);
|
||||
/* fall through */
|
||||
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
gnc_save_window_size(GCONF_SECTION, GTK_WINDOW(dialog));
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_widget_destroy(pcd->dialog);
|
||||
g_object_unref(pcd->xml);
|
||||
g_free(pcd);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/********************************************************************\
|
||||
* dialog-print-check.h : dialog to control check printing *
|
||||
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
|
||||
* Copyright (C) 2006 David Hampton <hampton@employees.org> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@@ -29,33 +30,7 @@
|
||||
|
||||
#include "print-session.h"
|
||||
|
||||
typedef struct {
|
||||
GtkWidget * dialog;
|
||||
|
||||
GncPluginPageRegister *plugin_page;
|
||||
const char *payee;
|
||||
gnc_numeric amount;
|
||||
time_t date;
|
||||
const char *memo;
|
||||
|
||||
GtkWidget * format_picker;
|
||||
GtkWidget * position_picker;
|
||||
GtkWidget * payee_x, * payee_y;
|
||||
GtkWidget * date_x, * date_y;
|
||||
GtkWidget * words_x, * words_y;
|
||||
GtkWidget * number_x, * number_y;
|
||||
GtkWidget * memo_x, * memo_y;
|
||||
|
||||
GtkWidget * check_position;
|
||||
GtkWidget * format_entry;
|
||||
|
||||
GtkWidget * units_picker;
|
||||
|
||||
GtkWidget * date_format;
|
||||
|
||||
gchar *format_string;
|
||||
|
||||
} PrintCheckDialog;
|
||||
typedef struct _print_check_dialog PrintCheckDialog;
|
||||
|
||||
void gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
|
||||
const char *payee,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ schemas_in_files = \
|
||||
apps_gnucash_dialog_common.schemas.in \
|
||||
apps_gnucash_dialog_commodities.schemas.in \
|
||||
apps_gnucash_dialog_prices.schemas.in \
|
||||
apps_gnucash_dialog_print_checks.schemas.in \
|
||||
apps_gnucash_dialog_reconcile.schemas.in \
|
||||
apps_gnucash_dialog_totd.schemas.in \
|
||||
apps_gnucash_general.schemas.in \
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<applyto>/apps/gnucash/dialogs/scheduled_trans/transaction_list/window_position</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/tax_info/window_position</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/preferences/window_position</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/window_position</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/reset_warnings/window_position</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/tip_of_the_day/window_position</applyto>
|
||||
<owner>gnucash</owner>
|
||||
@@ -36,6 +37,7 @@
|
||||
<applyto>/apps/gnucash/dialogs/scheduled_trans/transaction_list/window_geometry</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/tax_info/window_geometry</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/preferences/window_geometry</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/window_geometry</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/reset_warnings/window_geometry</applyto>
|
||||
<applyto>/apps/gnucash/dialogs/tip_of_the_day/window_geometry</applyto>
|
||||
<owner>gnucash</owner>
|
||||
|
||||
126
src/gnome/schemas/apps_gnucash_dialog_print_checks.schemas.in
Normal file
126
src/gnome/schemas/apps_gnucash_dialog_print_checks.schemas.in
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0"?>
|
||||
<gconfschemafile>
|
||||
<schemalist>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/check_format</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/check_format</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>The predefined check format to use.</short>
|
||||
<long>This value specifies the predefined check format to use. The number is the 0-based index into the list of known check formats.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/check_position</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/check_position</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Which check position to print.</short>
|
||||
<long>On preprinted checks containing multiple checks per page, this key specifies which check position to print. The legal values are 0, 1 and 2, correspongint to the top, middle and bottom checks on the page.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/date_format</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/date_format</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>The date format to use.</short>
|
||||
<long>This is the nimerical identifier of the predefined date format to use.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/date_format_user</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/date_format_user</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>string</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>The custom date format.</short>
|
||||
<long>If the 'date_format' is set to indicate a custom date format, this value is used as an argument to strftime to produce the date to be printed. It may be any valid strftime string.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/custom_payee</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/custom_payee</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>list</type>
|
||||
<list_type>int</list_type>
|
||||
<locale name="C">
|
||||
<short>Where to print the payee name.</short>
|
||||
<long>This value contains the X,Y coordinates for the start of the payee line on the check.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/custom_date</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/custom_date</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>list</type>
|
||||
<list_type>int</list_type>
|
||||
<locale name="C">
|
||||
<short>Where to print the date.</short>
|
||||
<long>This value contains the X,Y coordinates for the start of the date line on the check. Coordinates are from the lower left corner of the specified check position.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/custom_amount_words</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/custom_amount_words</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>list</type>
|
||||
<list_type>int</list_type>
|
||||
<locale name="C">
|
||||
<short>Where to print the check amount in words.</short>
|
||||
<long>This value contains the X,Y coordinates for the start of the written amount line on the check. Coordinates are from the lower left corner of the specified check position.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/custom_amount_number</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/custom_amount_number</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>list</type>
|
||||
<list_type>int</list_type>
|
||||
<locale name="C">
|
||||
<short>Where to print the check amount in numbers.</short>
|
||||
<long>This value contains the X,Y coordinates for the start of the numerical amount line on the check. Coordinates are from the lower left corner of the specified check position.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/custom_memo</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/custom_memo</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>list</type>
|
||||
<list_type>int</list_type>
|
||||
<locale name="C">
|
||||
<short>Where to print the memo line.</short>
|
||||
<long>This value contains the X,Y coordinates for the start of the memo line on the check. Coordinates are from the lower left corner of the specified check position.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/print_checks/custom_posistion</key>
|
||||
<applyto>/apps/gnucash/dialogs/print_checks/custom_position</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>list</type>
|
||||
<list_type>int</list_type>
|
||||
<locale name="C">
|
||||
<short>Where to place the check on the page.</short>
|
||||
<long>This value contains the Y coordinate for the bottom edge of the check. This coordinate is from the bottom edge of the sheet of paper.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
</gconfschemafile>
|
||||
@@ -108,7 +108,7 @@
|
||||
(payee-stub-text "")
|
||||
(memo-stub-text ""))
|
||||
|
||||
(if (not (null? ps))
|
||||
(if ps
|
||||
(begin
|
||||
(if (not (eq? (print-check-format:format format-info) 'custom))
|
||||
(begin
|
||||
@@ -134,15 +134,8 @@
|
||||
(print-check-format:custom-info format-info)))))
|
||||
|
||||
(let ((fmt (print-check-format:date-format format-info)))
|
||||
(if (string=? fmt "custom")
|
||||
(let* ((custom-info (print-check-format:custom-info format-info))
|
||||
(date-fmt (assq 'date-format custom-info)))
|
||||
(if date-fmt
|
||||
(set! date-fmt (cdr date-fmt)))
|
||||
(set! date-string
|
||||
(strftime date-fmt (localtime date))))
|
||||
(begin
|
||||
(set! date-string (strftime fmt (localtime date))))))
|
||||
(begin
|
||||
(set! date-string (strftime fmt (localtime date)))))
|
||||
|
||||
(let ((translate-pos (assq 'translate format)))
|
||||
(if translate-pos
|
||||
|
||||
Reference in New Issue
Block a user