r15758 - gnucash/trunk/src - Add a preference for printing "***" immediately before and after all
David Hampton
hampton at cvs.gnucash.org
Mon Mar 26 21:10:10 EDT 2007
Author: hampton
Date: 2007-03-26 21:10:09 -0400 (Mon, 26 Mar 2007)
New Revision: 15758
Trac: http://svn.gnucash.org/trac/changeset/15758
Modified:
gnucash/trunk/src/gnome-utils/glade/preferences.glade
gnucash/trunk/src/gnome/dialog-print-check.c
gnucash/trunk/src/gnome/schemas/apps_gnucash_dialog_print_checks.schemas.in
Log:
Add a preference for printing "***" immediately before and after all
text fields on checks. Implements enhancement request #420224.
Modified: gnucash/trunk/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check.c 2007-03-26 21:28:48 UTC (rev 15757)
+++ gnucash/trunk/src/gnome/dialog-print-check.c 2007-03-27 01:10:09 UTC (rev 15758)
@@ -1,7 +1,7 @@
/********************************************************************\
* dialog-print-check.c : dialog to control check printing. *
* Copyright (C) 2000 Bill Gribble <grib at billgribble.com> *
- * Copyright (C) 2006 David Hampton <hampton at employees.org> *
+ * Copyright (C) 2006,2007 David Hampton <hampton at 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,7 +1312,11 @@
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);
if (data->font) {
@@ -1324,7 +1329,13 @@
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,7 +1363,11 @@
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);
if (data->w && data->h) {
@@ -1374,7 +1389,13 @@
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
Modified: gnucash/trunk/src/gnome/schemas/apps_gnucash_dialog_print_checks.schemas.in
===================================================================
--- gnucash/trunk/src/gnome/schemas/apps_gnucash_dialog_print_checks.schemas.in 2007-03-26 21:28:48 UTC (rev 15757)
+++ gnucash/trunk/src/gnome/schemas/apps_gnucash_dialog_print_checks.schemas.in 2007-03-27 01:10:09 UTC (rev 15758)
@@ -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>
Modified: gnucash/trunk/src/gnome-utils/glade/preferences.glade
===================================================================
--- gnucash/trunk/src/gnome-utils/glade/preferences.glade 2007-03-26 21:28:48 UTC (rev 15757)
+++ gnucash/trunk/src/gnome-utils/glade/preferences.glade 2007-03-27 01:10:09 UTC (rev 15758)
@@ -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,16 +2346,36 @@
<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>
<property name="xscale">1</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>
More information about the gnucash-changes
mailing list