diff --git a/ChangeLog b/ChangeLog index 26cb4567ba..c36c8bc3d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-01-27 David Hampton + + * src/scm/printing/print-check.scm: + * src/gnome/glade/print.glade: + * src/gnome/dialog-print-check.c: Add translation and rotation to + the custom printing page. Modify the code so that only the custom + widgets that have an effect for the current setting are sensitive. + 2006-01-27 Derek Atkins Get "make distcheck" to work.... diff --git a/src/gnome/dialog-print-check.c b/src/gnome/dialog-print-check.c index 630f021e57..45c03bec70 100644 --- a/src/gnome/dialog-print-check.c +++ b/src/gnome/dialog-print-check.c @@ -40,7 +40,7 @@ #include "gnc-ui.h" #include "gnc-date-format.h" -#define CHECK_PRINT_NUM_FORMATS 3 +#define CHECK_PRINT_NUM_FORMATS 4 #define CHECK_PRINT_NUM_POSITIONS 4 #define CHECK_PRINT_NUM_UNITS 4 @@ -54,14 +54,15 @@ #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_TRANSLATION "custom_translation" +#define KEY_CUSTOM_ROTATION "custom_rotation" #define KEY_CUSTOM_UNITS "custom_units" /* Used by glade_xml_signal_autoconnect_full */ void gnc_ui_print_check_response_cb(GtkDialog * dialog, gint response, PrintCheckDialog * pcd); +void gnc_print_check_combobox_changed(GtkComboBox *widget, 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 { @@ -76,13 +77,15 @@ struct _print_check_dialog { GtkWidget * format_combobox; GtkWidget * position_combobox; + GtkWidget * custom_table; 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; + GtkSpinButton * translation_x, * translation_y; + GtkSpinButton * check_rotation; + GtkWidget * translation_label; GtkWidget * units_combobox; @@ -157,8 +160,11 @@ gnc_ui_print_save_dialog(PrintCheckDialog * pcd) 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), + save_float_pair(GCONF_SECTION, KEY_CUSTOM_TRANSLATION, + gtk_spin_button_get_value(pcd->translation_x), + gtk_spin_button_get_value(pcd->translation_y)); + gnc_gconf_set_float(GCONF_SECTION, KEY_CUSTOM_ROTATION, + gtk_spin_button_get_value(pcd->check_rotation), NULL); active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox)); gnc_gconf_set_int(GCONF_SECTION, KEY_CUSTOM_UNITS, active, NULL); @@ -203,8 +209,11 @@ gnc_ui_print_restore_dialog(PrintCheckDialog * pcd) 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); + get_float_pair(GCONF_SECTION, KEY_CUSTOM_TRANSLATION, &x, &y); + gtk_spin_button_set_value(pcd->translation_x, x); + gtk_spin_button_set_value(pcd->translation_y, y); + x = gnc_gconf_get_float(GCONF_SECTION, KEY_CUSTOM_ROTATION, NULL); + gtk_spin_button_set_value(pcd->check_rotation, x); active = gnc_gconf_get_int(GCONF_SECTION, KEY_CUSTOM_UNITS, NULL); gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->units_combobox), active); } @@ -244,6 +253,7 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page, pcd->format_combobox = glade_xml_get_widget (xml, "check_format_combobox"); pcd->position_combobox = glade_xml_get_widget (xml, "check_position_combobox"); + pcd->custom_table = glade_xml_get_widget (xml, "custom_table"); 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")); @@ -258,8 +268,11 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page, 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->translation_x = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "translation_x_entry")); + pcd->translation_y = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "translation_y_entry")); + pcd->translation_label = glade_xml_get_widget (xml, "translation_label"); + pcd->check_rotation = + GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "check_rotation_entry")); pcd->units_combobox = glade_xml_get_widget (xml, "units_combobox"); window = GTK_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window); @@ -315,7 +328,7 @@ gnc_ui_print_check_dialog_ok_cb(PrintCheckDialog * pcd) (gnc_date_format_get_custom(GNC_DATE_FORMAT(pcd->date_format))); cust_format = - SCM_LIST6 + SCM_LIST7 (scm_cons(scm_str2symbol("payee"), 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)))), @@ -331,8 +344,11 @@ gnc_ui_print_check_dialog_ok_cb(PrintCheckDialog * pcd) scm_cons(scm_str2symbol("memo"), 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*gtk_spin_button_get_value(pcd->check_position)))); + scm_cons(scm_str2symbol("translate"), + SCM_LIST2(scm_make_real(multip*gtk_spin_button_get_value(pcd->translation_x)), + scm_make_real(multip*gtk_spin_button_get_value(pcd->translation_y)))), + scm_cons(scm_str2symbol("rotate"), + scm_make_real(gtk_spin_button_get_value(pcd->check_rotation)))); /* hide the window */ gtk_widget_hide(pcd->dialog); @@ -354,6 +370,40 @@ gnc_ui_print_check_dialog_ok_cb(PrintCheckDialog * pcd) } +static void +gnc_print_check_set_sensitive (GtkWidget *widget, gpointer data) +{ + gboolean sensitive = GPOINTER_TO_INT(data); + gtk_widget_set_sensitive(widget, sensitive); +} + + +void +gnc_print_check_combobox_changed (GtkComboBox *widget, + PrintCheckDialog * pcd) +{ + gboolean sensitive; + gint value; + + value = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->format_combobox)); + if (-1 == value) + return; + sensitive = (value == (CHECK_PRINT_NUM_FORMATS - 1)); + gtk_container_foreach(GTK_CONTAINER(pcd->custom_table), + gnc_print_check_set_sensitive, + GINT_TO_POINTER(sensitive)); + if (sensitive == TRUE) + return; + + value = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox)); + if (-1 == value) + return; + sensitive = (value == (CHECK_PRINT_NUM_POSITIONS - 1)); + gtk_widget_set_sensitive(GTK_WIDGET(pcd->translation_label), sensitive); + gtk_widget_set_sensitive(GTK_WIDGET(pcd->translation_x), sensitive); + gtk_widget_set_sensitive(GTK_WIDGET(pcd->translation_y), sensitive); +} + void gnc_ui_print_check_response_cb(GtkDialog * dialog, gint response, diff --git a/src/gnome/glade/print.glade b/src/gnome/glade/print.glade index 47cbc8b7cd..2ae57a2213 100644 --- a/src/gnome/glade/print.glade +++ b/src/gnome/glade/print.glade @@ -16,6 +16,7 @@ False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST + True True @@ -111,6 +112,10 @@ 0 0 check_format_combobox + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -136,6 +141,10 @@ 0 0 check_position_combobox + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -160,6 +169,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -180,6 +193,7 @@ Quicken(tm) Wallet Checks w/ side stub Custom False True + 1 @@ -199,6 +213,7 @@ Bottom Custom False True + 1 @@ -229,6 +244,10 @@ Custom 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 tab @@ -236,9 +255,9 @@ Custom - + True - 8 + 9 3 False 0 @@ -257,6 +276,10 @@ Custom 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 1 @@ -281,6 +304,10 @@ Custom 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 2 @@ -306,6 +333,10 @@ Custom 0 0 payee_x_entry + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -331,6 +362,10 @@ Custom 0 0 date_x_entry + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -356,6 +391,10 @@ Custom 0 0 amount_words_x_entry + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -381,6 +420,10 @@ Custom 0 0 amount_numbers_x_entry + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -406,6 +449,10 @@ Custom 0 0 memo_x_entry + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -417,31 +464,6 @@ Custom - - - True - Check po_sition: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - check_position_entry - - - 0 - 1 - 6 - 7 - fill - - - - True @@ -552,28 +574,6 @@ Custom - - - True - True - 1 - 3 - True - GTK_UPDATE_ALWAYS - False - False - 0 0 100000 0.10000000149 10 10 - - - 1 - 2 - 6 - 7 - fill - - - - True @@ -684,6 +684,26 @@ Custom + + + True + Inches +Centimeters +Millimeters +Points + False + True + + + 1 + 2 + 8 + 9 + fill + fill + + + True @@ -698,6 +718,89 @@ Custom 0 0 units_combobox + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 8 + 9 + fill + + + + + + + True + True + 1 + 3 + True + GTK_UPDATE_ALWAYS + False + False + 0 0 100000 0.10000000149 10 10 + + + 1 + 2 + 6 + 7 + + + + + + + True + _Translation: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + translation_x_entry + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 6 + 7 + fill + + + + + + + True + _Rotation + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + check_rotation_entry + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -710,22 +813,44 @@ Custom - + True - Inches -Centimeters -Millimeters -Points - False - True + True + 1 + 3 + True + GTK_UPDATE_ALWAYS + False + True + -160 -180 180 0.00999999977648 10 10 1 2 7 8 - fill - fill + + + + + + + True + True + 1 + 3 + True + GTK_UPDATE_ALWAYS + False + False + 0 0 100000 0.10000000149 10 10 + + + 2 + 3 + 6 + 7 + @@ -748,6 +873,10 @@ Points 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 tab diff --git a/src/scm/printing/print-check.scm b/src/scm/printing/print-check.scm index 490abba871..edb77252ef 100644 --- a/src/scm/printing/print-check.scm +++ b/src/scm/printing/print-check.scm @@ -121,26 +121,33 @@ (if off (set! offset (cdr off))))))) (set! format (print-check-format:custom-info format-info))) - (if (not (or offset (eq? (print-check-format:position format-info) 'custom))) + (if (not (eq? (print-check-format:format format-info) 'custom)) (begin - (set! offset - (cdr (assq (print-check-format:position format-info) - (cdr (assq (print-check-format:format format-info) - gnc:*stock-check-formats*))))) - (if (pair? offset) - (set! offset (cdr offset)))) - (set! offset - (cdr (assq 'position - (print-check-format:custom-info format-info))))) + (if (not (or offset (eq? (print-check-format:position format-info) 'custom))) + (begin + (set! offset + (cdr (assq (print-check-format:position format-info) + (cdr (assq (print-check-format:format format-info) + gnc:*stock-check-formats*))))) + (if (pair? offset) + (set! offset (cdr offset)))) + (set! offset + (caddr (assq 'translate + (print-check-format:custom-info format-info)))))) + (set! offset 0.0)) (let ((fmt (print-check-format:date-format format-info))) (begin (set! date-string (strftime fmt (localtime date))))) + (display "offset is ") (display offset) (newline) (let ((translate-pos (assq 'translate format))) (if translate-pos - (gnc:print-session-translate ps (cadr translate-pos) - (caddr translate-pos)))) + (begin + (display "translate by ") (display (cadr translate-pos)) + (display " ") (display (caddr translate-pos)) (newline) + (gnc:print-session-translate ps (cadr translate-pos) + (caddr translate-pos))))) (let ((rotate-angle (assq 'rotate format))) (if rotate-angle (gnc:print-session-rotate ps (cdr rotate-angle))))