Add a preference for printing "***" immediately before and after all

text fields on checks.  Implements enhancement request #420224.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15758 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2007-03-27 01:10:09 +00:00
parent b86e5fa33c
commit 9ca73549ce
3 changed files with 117 additions and 23 deletions
+57 -20
View File
@@ -2274,22 +2274,39 @@
</child>
<child>
<widget class="GtkFontButton" id="gconf/dialogs/print_checks/default_font">
<widget class="GtkAlignment" id="alignment7">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_style">True</property>
<property name="show_size">True</property>
<property name="use_font">False</property>
<property name="use_size">False</property>
<property name="focus_on_click">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkCheckButton" id="gconf/dialogs/print_checks/print_date_format">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Below the actual date, print the format of that date in 8 point type.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Print _date format</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="left_attach">0</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="y_options">fill</property>
</packing>
</child>
@@ -2308,7 +2325,7 @@
<child>
<widget class="GtkLabel" id="label116">
<property name="visible">True</property>
<property name="label" translatable="yes">Default _Font:</property>
<property name="label" translatable="yes">Default _font:</property>
<property name="use_underline">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -2329,15 +2346,35 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment7">
<widget class="GtkFontButton" id="gconf/dialogs/print_checks/default_font">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_style">True</property>
<property name="show_size">True</property>
<property name="use_font">False</property>
<property name="use_size">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment8">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
@@ -2349,11 +2386,11 @@
<property name="right_padding">0</property>
<child>
<widget class="GtkCheckButton" id="gconf/dialogs/print_checks/print_date_format">
<widget class="GtkCheckButton" id="gconf/dialogs/print_checks/blocking_chars">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Below the actual date, print the format of that date in 8 point type.</property>
<property name="tooltip" translatable="yes">Print '***' before and after each text field on the check.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Print _Date Format</property>
<property name="label" translatable="yes">Print _blocking chars</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@@ -2366,8 +2403,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
+24 -3
View File
@@ -1,7 +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> *
* Copyright (C) 2006,2007 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 *
@@ -69,6 +69,7 @@
#define KEY_CUSTOM_UNITS "custom_units"
#define KEY_PRINT_DATE_FMT "print_date_format"
#define KEY_DEFAULT_FONT "default_font"
#define KEY_BLOCKING_CHARS "blocking_chars"
#define DEFAULT_FONT "sans 12"
@@ -1311,6 +1312,10 @@ draw_text(GncPrintContext * context, const gchar * text, check_item_t * data,
cairo_t *cr;
gint layout_height, layout_width;
gdouble width, height;
gchar *new_text;
if ((NULL == text) || (strlen(text) == 0))
return 0.0;
/* Initialize for printing text */
layout = gtk_print_context_create_pango_layout(context);
@@ -1324,7 +1329,13 @@ draw_text(GncPrintContext * context, const gchar * text, check_item_t * data,
pango_layout_set_alignment(layout,
data->w ? data->align : PANGO_ALIGN_LEFT);
pango_layout_set_width(layout, data->w ? data->w * PANGO_SCALE : -1);
pango_layout_set_text(layout, text, -1);
if (gnc_gconf_get_bool(GCONF_SECTION, KEY_BLOCKING_CHARS, NULL)) {
new_text = g_strdup_printf("***%s***", text);
pango_layout_set_text(layout, new_text, -1);
g_free(new_text);
} else {
pango_layout_set_text(layout, text, -1);
}
pango_layout_get_size(layout, &layout_width, &layout_height);
width = (gdouble) layout_width / PANGO_SCALE;
height = (gdouble) layout_height / PANGO_SCALE;
@@ -1352,6 +1363,10 @@ draw_text(GncPrintContext * context, const gchar * text, check_item_t * data,
return width;
#else
gdouble x0, x1, y0, y1;
gchar *new_text;
if ((NULL == text) || (strlen(text) == 0))
return 0.0;
/* Clip text to the enclosing rectangle */
gnome_print_gsave(context);
@@ -1374,7 +1389,13 @@ draw_text(GncPrintContext * context, const gchar * text, check_item_t * data,
g_debug("Text move to %f,%f, print '%s'", data->x, data->y,
text ? text : "(null)");
gnome_print_moveto(context, data->x, data->y);
gnome_print_show(context, text);
if (gnc_gconf_get_bool(GCONF_SECTION, KEY_BLOCKING_CHARS, NULL)) {
new_text = g_strdup_printf("***%s***", text);
gnome_print_show(context, new_text);
g_free(new_text);
} else {
gnome_print_show(context, text);
}
gnome_print_grestore(context);
return 0.0;
#endif
@@ -122,5 +122,41 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/gnucash/dialogs/print_checks/print_date_format</key>
<applyto>/apps/gnucash/dialogs/print_checks/print_date_format</applyto>
<owner>gnucash</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Print the date format below the date.</short>
<long>Each time the date is printed, print the date format immediately below in 8 point type using the characters Y, M, and D.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnucash/dialogs/print_checks/default_font</key>
<applyto>/apps/gnucash/dialogs/print_checks/default_font</applyto>
<owner>gnucash</owner>
<type>string</type>
<default>sans 10</default>
<locale name="C">
<short>The default check printing font</short>
<long>The default font to use when printing checks. This value will be overridden by any font specified in a check description file.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnucash/dialogs/print_checks/blocking_chars</key>
<applyto>/apps/gnucash/dialogs/print_checks/blocking_chars</applyto>
<owner>gnucash</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Print '***' before and after strings.</short>
<long>Print '***' before and after strings.</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>