r18581 - gnucash/trunk - Bug #607522: Add ADDRESS to check printing

Christian Stimming cstim at code.gnucash.org
Sat Jan 23 16:39:21 EST 2010


Author: cstim
Date: 2010-01-23 16:39:21 -0500 (Sat, 23 Jan 2010)
New Revision: 18581
Trac: http://svn.gnucash.org/trac/changeset/18581

Added:
   gnucash/trunk/checks/voucher.chk
Modified:
   gnucash/trunk/checks/Makefile.am
   gnucash/trunk/checks/gnomeprint/quicken.chk
   gnucash/trunk/checks/gnomeprint/quicken_wallet.chk
   gnucash/trunk/checks/quicken.chk
   gnucash/trunk/checks/quicken_wallet.chk
   gnucash/trunk/src/gnome/dialog-print-check.c
   gnucash/trunk/src/gnome/glade/print.glade
Log:
Bug #607522: Add ADDRESS to check printing

Patch by Thomas Troesch: The patch does three things:

1.  Adds the ability to print an address on checks.  The Print Check dialog is
changed to have 5 address lines.
The first field is filled in with the same data as the PAYEE check item.  The
other lines are blank.  The check format keys
have a new check-item type 'ADDRESS'.  It behaves like other text check-item
types.  The address fields on the dialog are set 'not-sensitive'
if the current format does not have an ADDRESS check item defined.  The Custom
Field tab has a new line for the address
location.

2.  Added new check format key - Blocking_Chars.  This is to put the blocking
character feature into the check format file.  It is currently
only in the preferences dialog in the printing tab, and therefore currently
applies (or not) to all text fields in th_e check format.  By
adding the key Blocking_Chars_n to the check format, the blocking characters
can be applied to text type check-items individually.  Its
really useful when printing stubs and so on.  (NOTE:  blocking characters are
printed around a field to protect against alteration
e.g.  ***$100.00***  vs     $100.00)

3. Included a Voucher check template.  This is a full page check with the check
on top and which has two stubs below.  There
are other voucher formats ( middle and bottom ) , but the check printing
functionality would require separate templates for
the different formats.  Also changed the Quicken/Quickbooks US-Letter check
format to include the ADDRESS check item and blocking
around the AMOUNT_NUMBER field.  I made a change to the Quicken-wallet check to
add blocking characters around the
AMOUNT_NUMBER field, and I added a clipping rectangle definition to the NOTES
and PAYEE fields the were placed in the
check stub area ( if the fields were too long, they would print into the check
area ).

Modified: gnucash/trunk/checks/Makefile.am
===================================================================
--- gnucash/trunk/checks/Makefile.am	2010-01-22 01:02:49 UTC (rev 18580)
+++ gnucash/trunk/checks/Makefile.am	2010-01-23 21:39:21 UTC (rev 18581)
@@ -6,6 +6,7 @@
 	deluxe.chk \
 	liberty.chk \
 	quicken.chk \
+	voucher.chk \
 	quicken_wallet.chk
 else
 checks_DATA = \

Modified: gnucash/trunk/checks/gnomeprint/quicken.chk
===================================================================
--- gnucash/trunk/checks/gnomeprint/quicken.chk	2010-01-22 01:02:49 UTC (rev 18580)
+++ gnucash/trunk/checks/gnomeprint/quicken.chk	2010-01-23 21:39:21 UTC (rev 18581)
@@ -25,3 +25,6 @@
 
 Type_5 = NOTES
 Coords_5 = 50.0;40.0
+
+Type_6 = ADDRESS
+Coords_6 = 90.0;52.0

Modified: gnucash/trunk/checks/gnomeprint/quicken_wallet.chk
===================================================================
--- gnucash/trunk/checks/gnomeprint/quicken_wallet.chk	2010-01-22 01:02:49 UTC (rev 18580)
+++ gnucash/trunk/checks/gnomeprint/quicken_wallet.chk	2010-01-23 21:39:21 UTC (rev 18581)
@@ -18,6 +18,7 @@
 Coords_2 = 195.0;125.0
 
 Type_3 = AMOUNT_NUMBER
+Blocking_3 = true
 Coords_3 = 518.0;137.0
 
 Type_4 = DATE
@@ -26,14 +27,16 @@
 Type_5 = NOTES
 Coords_5 = 216.0;37.0
 
+# stub
+
 Type_6 = DATE
 Coords_6 = 36.0;151.0
 
 Type_7 = PAYEE
-Coords_7 = 26.0;126.0
+Coords_7 = 26.0;126.0;150.0;12.0
 
 Type_8 = AMOUNT_NUMBER
 Coords_8 = 50.0;90.0
 
 Type_9 = NOTES
-Coords_9 = 28.0;65.0
+Coords_9 = 28.0;65.0;150.0;12.0

Modified: gnucash/trunk/checks/quicken.chk
===================================================================
--- gnucash/trunk/checks/quicken.chk	2010-01-22 01:02:49 UTC (rev 18580)
+++ gnucash/trunk/checks/quicken.chk	2010-01-23 21:39:21 UTC (rev 18581)
@@ -18,6 +18,7 @@
 Coords_2 = 90.0;132.0
 
 Type_3 = AMOUNT_NUMBER
+Blocking_3 = true
 Coords_3 = 500.0;102.0
 
 Type_4 = DATE
@@ -25,3 +26,6 @@
 
 Type_5 = NOTES
 Coords_5 = 50.0;212.0
+
+Type_6 = ADDRESS
+Coords_6 = 90.0;192.0

Modified: gnucash/trunk/checks/quicken_wallet.chk
===================================================================
--- gnucash/trunk/checks/quicken_wallet.chk	2010-01-22 01:02:49 UTC (rev 18580)
+++ gnucash/trunk/checks/quicken_wallet.chk	2010-01-23 21:39:21 UTC (rev 18581)
@@ -18,6 +18,7 @@
 Coords_2 = 195.0;79.0
 
 Type_3 = AMOUNT_NUMBER
+Blocking_3 = true
 Coords_3 = 518.0;67.0
 
 Type_4 = DATE
@@ -26,14 +27,16 @@
 Type_5 = NOTES
 Coords_5 = 216.0;167.0
 
+# stub
+
 Type_6 = DATE
 Coords_6 = 36.0;53.0
 
 Type_7 = PAYEE
-Coords_7 = 26.0;78.0
+Coords_7 = 26.0;78.0;150.0;12.0
 
 Type_8 = AMOUNT_NUMBER
 Coords_8 = 50.0;114.0
 
 Type_9 = NOTES
-Coords_9 = 28.0;139.0
+Coords_9 = 28.0;139.0;150.0;12.0

Added: gnucash/trunk/checks/voucher.chk
===================================================================
--- gnucash/trunk/checks/voucher.chk	                        (rev 0)
+++ gnucash/trunk/checks/voucher.chk	2010-01-23 21:39:21 UTC (rev 18581)
@@ -0,0 +1,74 @@
+[Top]
+Guid = 0a0a1498-5f06-45ff-abc2-b2d32ad61bc9
+Title = Voucher Check 3-Part US-Letter
+Font = sans 10
+Rotation = 0.0
+# override character blocking from global preferences
+Blocking = false
+Translation = 0.0;0.0
+Show_Grid = false
+Show_Boxes = false
+
+[Check Items]
+Type_1 = PAYEE
+Coords_1 = 90.0;107.0;400.0;20.0
+
+Type_2 = DATE
+Coords_2 = 480.0;67.0
+
+Type_3 = AMOUNT_WORDS
+Blocking_3 = true
+Coords_3 = 70.0;132.0;380.0;12.0
+
+Type_4 = AMOUNT_NUMBER
+Blocking_4 = true
+Coords_4 = 510.0;107.0
+
+Type_5 = ADDRESS
+Font_5 = sans 9
+Coords_5 = 70.0;192.0
+
+Type_6 = NOTES
+Font_6 = sans 8
+Coords_6 = 60.0;220.0;250.0;10.0
+
+# stub 1
+
+Type_7 = PAYEE
+Coords_7 = 50.0;300.0
+
+Type_8 = DATE
+Coords_8 = 480.0;300.0
+
+Type_9 = NOTES
+Coords_9 = 50.0;330.0
+
+Type_10 = MEMO
+Coords_10 = 50.0;342.0
+
+Type_11 = ACTION
+Coords_11 = 50.0;475.0
+
+Type_12 = AMOUNT_NUMBER
+Coords_12 = 500.0;475.0
+
+# stub 2
+
+Type_13 = PAYEE
+Coords_13 = 50.0;550.0
+
+Type_14 = DATE
+Coords_14 = 480.0;550.0
+
+Type_15 = NOTES
+Coords_15 = 50.0;580.0
+
+Type_16 = MEMO
+Coords_16 = 50.0;592.0
+
+Type_17 = ACTION
+Coords_17 = 50.0;725.0
+
+Type_18 = AMOUNT_NUMBER
+Coords_18 = 500.0;725.0
+

Modified: gnucash/trunk/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check.c	2010-01-22 01:02:49 UTC (rev 18580)
+++ gnucash/trunk/src/gnome/dialog-print-check.c	2010-01-23 21:39:21 UTC (rev 18581)
@@ -63,6 +63,7 @@
 #define KEY_CUSTOM_DATE        "custom_date"
 #define KEY_CUSTOM_WORDS       "custom_amount_words"
 #define KEY_CUSTOM_NUMBER      "custom_amount_number"
+#define KEY_CUSTOM_ADDRESS     "custom_address"
 #define KEY_CUSTOM_NOTES       "custom_memo" /* historically misnamed */
 #define KEY_CUSTOM_TRANSLATION "custom_translation"
 #define KEY_CUSTOM_ROTATION    "custom_rotation"
@@ -77,6 +78,9 @@
 #define CHECK_NAME_EXTENSION    ".chk"
 #define DEGREES_TO_RADIANS      (G_PI / 180.0)
 
+#define BLOCKING_CHAR_OFF	0
+#define BLOCKING_CHAR_ON	1
+
 #define KF_GROUP_TOP       "Top"
 #define KF_GROUP_POS       "Check Positions"
 #define KF_GROUP_ITEMS     "Check Items"
@@ -86,6 +90,7 @@
 #define KF_KEY_TRANSLATION "Translation"
 #define KF_KEY_FONT        "Font"
 #define KF_KEY_ALIGN       "Align"
+#define KF_KEY_BLOCKING    "Blocking"
 #define KF_KEY_SHOW_GRID   "Show_Grid"
 #define KF_KEY_SHOW_BOXES  "Show_Boxes"
 #define KF_KEY_NAMES       "Names"
@@ -124,6 +129,8 @@
 void gnc_check_format_title_changed (GtkEditable *editable, GtkWidget *ok_button);
 
 static void initialize_format_combobox (PrintCheckDialog * pcd);
+gchar* get_check_address(PrintCheckDialog *pcd);
+gboolean check_format_has_address(PrintCheckDialog *pcd);
 
 /** This enum defines the types of items that gnucash knows how to
  *  print on checks.  Most refer to specific fields from a gnucash
@@ -142,6 +149,7 @@
         _(AMOUNT_WORDS,) \
                          \
         _(TEXT,) \
+        _(ADDRESS,) \
         _(PICTURE,)
 
 DEFINE_ENUM(CheckItemType, ENUM_CHECK_ITEM_TYPE)
@@ -176,6 +184,10 @@
                                  *   overrides any font in the check format.
                                  *   Unused for non-text items. */
 
+    gboolean blocking;          /**< Optional.  Override blocking in the check format.
+                                 *   Default is no blocking characters are written.
+                                 *   Unused for non-text items. */
+
     PangoAlignment align;       /**< The alignment of a text based item. Only
                                  *   used for text based items when a width is
                                  *   specified.  */
@@ -197,6 +209,9 @@
     gchar *title;               /**< Title of this check format. Displayed to
                                  *   user in the dialog box. */
 
+    gboolean blocking;          /**< Default for printing blocking characters for 
+                                 *   this page of checks.  */
+
     gboolean show_grid;         /**< Print a grid pattern on the page */
 
     gboolean show_boxes;        /**< Print boxes when width and height are
@@ -239,6 +254,7 @@
   GtkSpinButton * date_x,   * date_y;
   GtkSpinButton * words_x,  * words_y;
   GtkSpinButton * number_x, * number_y;
+  GtkSpinButton * address_x, * address_y;
   GtkSpinButton * notes_x,   * notes_y;
   GtkSpinButton * translation_x, * translation_y;
   GtkSpinButton * check_rotation;
@@ -248,6 +264,12 @@
 
   GtkWidget * date_format;
 
+  GtkWidget * check_address_name;
+  GtkWidget * check_address_1;
+  GtkWidget * check_address_2;
+  GtkWidget * check_address_3;
+  GtkWidget * check_address_4;
+
   gchar *default_font;
 
   check_format_t *selected_format;
@@ -316,6 +338,48 @@
   g_slist_free(coord_list);
 }
 
+gchar *
+get_check_address( PrintCheckDialog *pcd)
+{
+  /* return an address in five lines
+   * the string needs to be freed with g_free */
+  gchar *address;
+  address = g_strconcat(gtk_entry_get_text(GTK_ENTRY(pcd->check_address_name)),"\n",   \
+                        gtk_entry_get_text(GTK_ENTRY(pcd->check_address_1)),"\n",   \
+                        gtk_entry_get_text(GTK_ENTRY(pcd->check_address_2)),"\n",   \
+                        gtk_entry_get_text(GTK_ENTRY(pcd->check_address_3)),"\n",   \
+                        gtk_entry_get_text(GTK_ENTRY(pcd->check_address_4)),   \
+                        NULL);
+  return address;
+}
+
+gboolean
+check_format_has_address ( PrintCheckDialog *pcd )
+{
+  /* check format for an ADDRESS item */
+  check_item_t *item = NULL;
+  GSList *elem;
+  check_format_t *format = NULL;
+
+  if ( !pcd ) return FALSE;
+  /* if format is NULL, then the custom format is being used 
+   * which has an ADDRESS item by definition */
+  format = pcd->selected_format;
+  if ( !format ) return TRUE;
+
+  for (elem = pcd->selected_format->items; elem; elem = g_slist_next(elem)) {
+    item = elem->data;
+    switch (item->type) {
+        case ADDRESS:
+          return TRUE;
+          break;
+        default:
+          break;
+    }
+  }
+  return FALSE;
+}
+
 static void
 gnc_ui_print_save_dialog(PrintCheckDialog * pcd)
 {
@@ -360,6 +424,9 @@
   save_float_pair(GCONF_SECTION, KEY_CUSTOM_NOTES,
 		  gtk_spin_button_get_value(pcd->notes_x),
 		  gtk_spin_button_get_value(pcd->notes_y));
+  save_float_pair(GCONF_SECTION, KEY_CUSTOM_ADDRESS,
+		  gtk_spin_button_get_value(pcd->address_x),
+		  gtk_spin_button_get_value(pcd->address_y));
   save_float_pair(GCONF_SECTION, KEY_CUSTOM_TRANSLATION,
 		  gtk_spin_button_get_value(pcd->translation_x),
 		  gtk_spin_button_get_value(pcd->translation_y));
@@ -421,6 +488,9 @@
   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_ADDRESS, &x, &y);
+  gtk_spin_button_set_value(pcd->address_x, x);
+  gtk_spin_button_set_value(pcd->address_y, y);
   get_float_pair(GCONF_SECTION, KEY_CUSTOM_NOTES, &x, &y);
   gtk_spin_button_set_value(pcd->notes_x, x);
   gtk_spin_button_set_value(pcd->notes_y, y);
@@ -528,6 +598,8 @@
                               pcd->words_x, pcd->words_y);
     pcd_key_file_save_item_xy(key_file, i++, AMOUNT_NUMBER, multip,
                               pcd->number_x, pcd->number_y);
+    pcd_key_file_save_item_xy(key_file, i++, ADDRESS, multip,
+                              pcd->address_x, pcd->address_y);
     pcd_key_file_save_item_xy(key_file, i++, NOTES, multip,
                               pcd->notes_x, pcd->notes_y);
 
@@ -637,6 +709,7 @@
     GSList *list = NULL;
     gchar *key, *value, *name;
     int item_num;
+    gboolean bval;
     gdouble *dd;
     gsize dd_len;
 
@@ -700,9 +773,12 @@
         g_free(dd);
         g_free(key);
 
-        /* Any text item can specify a font, and can also an alignment if a
-         * width was provided for the item. These values are optional and do
-         * not cause a failure if they are missing. */
+        /* Any text item can specify:
+         *   a font  FONT_n
+         *   an alignment if a width was provided for the item  ALIGN_n
+         *   blocking chars flag  BLOCKING_n
+         * These values are optional and do not cause a failure if they are missing. */
+
         if (data->type != PICTURE) {
             key = g_strdup_printf("%s_%d", KF_KEY_FONT, item_num);
             data->font =
@@ -743,6 +819,23 @@
                 g_clear_error(&error);
             }
             g_free(key);
+
+            key = g_strdup_printf("%s_%d", KF_KEY_BLOCKING, item_num);
+            bval =
+                g_key_file_get_boolean(key_file, KF_GROUP_ITEMS, key, &error);
+            if (!error) {
+                g_debug("Check file %s, group %s, key %s, value: %d",
+                        file, KF_GROUP_ITEMS, key, bval);
+		data->blocking = bval;
+            } else {
+                if (!((error->domain == G_KEY_FILE_ERROR)
+                      && (error->code == G_KEY_FILE_ERROR_KEY_NOT_FOUND)))
+                    g_warning("Check file %s, group %s, key %s, error: %s",
+                              file, KF_GROUP_ITEMS, key, error->message);
+		data->blocking = format->blocking;
+                g_clear_error(&error);
+            }
+            g_free(key);
         }
         /* Get any extra data for specific items. */
         switch (data->type) {
@@ -906,6 +999,25 @@
         return FALSE;
     }
 
+    format->blocking =
+        g_key_file_get_boolean(key_file, KF_GROUP_TOP, KF_KEY_BLOCKING,
+                               &error);
+    if (!error) {
+        g_debug("Check file %s, group %s, key %s, value: %d",
+                file, KF_GROUP_TOP, KF_KEY_BLOCKING, format->blocking);
+    } else {
+        if (!((error->domain == G_KEY_FILE_ERROR)
+              && (error->code == G_KEY_FILE_ERROR_KEY_NOT_FOUND)))
+            g_warning("Check file %s, group %s, key %s, error: %s",
+                      file, KF_GROUP_TOP, KF_KEY_BLOCKING, error->message);
+           if( gnc_gconf_get_bool(GCONF_SECTION, KEY_BLOCKING_CHARS, NULL) ) {
+		format->blocking = TRUE;
+           } else {
+                format->blocking = FALSE;
+           }
+        g_clear_error(&error);
+    }
+
     format->show_grid =
         g_key_file_get_boolean(key_file, KF_GROUP_TOP, KF_KEY_SHOW_GRID,
                                &error);
@@ -1178,6 +1290,7 @@
   GtkWidget *table;
   GtkWindow *window;
   gchar *font;
+  Transaction *trans;
 
   pcd = g_new0(PrintCheckDialog, 1);
   pcd->plugin_page = plugin_page;
@@ -1208,6 +1321,8 @@
     GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "amount_numbers_y_entry"));
   pcd->notes_x = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "notes_x_entry"));
   pcd->notes_y = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "notes_y_entry"));
+  pcd->address_x = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "address_x_entry"));
+  pcd->address_y = GTK_SPIN_BUTTON(glade_xml_get_widget (xml, "address_y_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");
@@ -1231,6 +1346,22 @@
   /* Update the combo boxes bases on the available check formats */
   initialize_format_combobox(pcd);
 
+  /* address */
+  pcd->check_address_name = glade_xml_get_widget( xml, "check_address_name");
+  pcd->check_address_1 = glade_xml_get_widget( xml, "check_address_1");
+  pcd->check_address_2 = glade_xml_get_widget( xml, "check_address_2");
+  pcd->check_address_3 = glade_xml_get_widget( xml, "check_address_3");
+  pcd->check_address_4 = glade_xml_get_widget( xml, "check_address_4");
+  /* fill in any available address data */
+  /* Can't access business objects e.g. Customer,Vendor,Employee because
+   * it would create build problems */
+  trans = xaccSplitGetParent(pcd->split);
+  if ( trans ) {
+    gtk_entry_set_text(GTK_ENTRY(pcd->check_address_name),xaccTransGetDescription(trans));
+  } else {
+    /* nothing to do - defaults to blank */
+  }
+
 #if USE_GTKPRINT
   gtk_widget_destroy(glade_xml_get_widget (xml, "lower_left"));
 #else
@@ -1346,6 +1477,7 @@
     gint layout_height, layout_width;
     gdouble width, height;
     gchar *new_text;
+    CheckItemType ct;
 
     if ((NULL == text) || (strlen(text) == 0))
       return 0.0;
@@ -1363,7 +1495,7 @@
                                data->w ? data->align : PANGO_ALIGN_LEFT);
     pango_layout_set_width(layout, data->w ? data->w * PANGO_SCALE : -1);
     pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
-    if (gnc_gconf_get_bool(GCONF_SECTION, KEY_BLOCKING_CHARS, NULL)) {
+    if ( data->blocking ) {
         new_text = g_strdup_printf("***%s***", text);
         pango_layout_set_text(layout, new_text, -1);
         g_free(new_text);
@@ -1423,7 +1555,7 @@
     g_debug("Text move to %f,%f, print '%s'", data->x, data->y,
             text ? text : "(null)");
     gnome_print_moveto(context, data->x, data->y);
-    if (gnc_gconf_get_bool(GCONF_SECTION, KEY_BLOCKING_CHARS, NULL)) {
+    if ( data->blocking ) {
         new_text = g_strdup_printf("***%s***", text);
         gnome_print_show(context, new_text);
         g_free(new_text);
@@ -1643,6 +1775,7 @@
     check_item_t *item;
     gdouble width;
     GDate *date;
+    gchar *address = NULL;
 
     trans = xaccSplitGetParent(pcd->split);
     /* This was valid when the check printing dialog was instantiated. */
@@ -1707,6 +1840,12 @@
                 draw_text(context, item->text, item, default_desc);
                 break;
 
+            case ADDRESS:
+                address = get_check_address(pcd);
+                draw_text(context, address, item, default_desc);
+		g_free(address);
+                break;
+
 #if USE_GTKPRINT
             case PICTURE:
                 draw_picture(context, item);
@@ -1751,11 +1890,7 @@
 
 /** Print an entire page based upon the layout in a check description file.
  *  This function takes care of translating/rotating the page, calling the function to print the grid
- *  pattern (if requested), an
-
-each of the items that in the description of a single check.  This
- *  function uses helper functions to print text based and picture based
- *  items. */
+ *  pattern (if requested), and calls a helper function to print all check items */
 static void
 draw_page_format(GncPrintContext * context,
                  gint page_nr, check_format_t * format, gpointer user_data)
@@ -1874,6 +2009,7 @@
     check_item_t item = { 0 };
     gdouble x, y, multip, degrees;
     GDate *date;
+    gchar *address;
 
     trans = xaccSplitGetParent(pcd->split);
     /* This was valid when the check printing dialog was instantiated. */
@@ -1925,6 +2061,12 @@
     draw_text(context, text, &item, desc);
     g_free(text);
 
+    item.x = multip * gtk_spin_button_get_value(pcd->address_x);
+    item.y = multip * gtk_spin_button_get_value(pcd->address_y);
+    address = get_check_address(pcd);
+    draw_text(context, address, &item, desc);
+    g_free(address);
+
     item.x = multip * gtk_spin_button_get_value(pcd->notes_x);
     item.y = multip * gtk_spin_button_get_value(pcd->notes_y);
     draw_text(context, xaccTransGetNotes(trans), &item, desc);
@@ -2030,7 +2172,6 @@
   gtk_widget_set_sensitive(widget, sensitive);
 }
 
-
 void
 gnc_print_check_format_changed (GtkComboBox *widget,
                                 PrintCheckDialog * pcd)
@@ -2079,6 +2220,14 @@
   gtk_container_foreach(GTK_CONTAINER(pcd->custom_table),
 			gnc_print_check_set_sensitive,
 			GINT_TO_POINTER(sensitive));
+
+  /* Update address fields */
+  sensitive = check_format_has_address(pcd);
+  gtk_widget_set_sensitive(pcd->check_address_name,sensitive);
+  gtk_widget_set_sensitive(pcd->check_address_1,sensitive);
+  gtk_widget_set_sensitive(pcd->check_address_2,sensitive);
+  gtk_widget_set_sensitive(pcd->check_address_3,sensitive);
+  gtk_widget_set_sensitive(pcd->check_address_4,sensitive);
 }
 
 void

Modified: gnucash/trunk/src/gnome/glade/print.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/print.glade	2010-01-22 01:02:49 UTC (rev 18580)
+++ gnucash/trunk/src/gnome/glade/print.glade	2010-01-23 21:39:21 UTC (rev 18581)
@@ -19,10 +19,10 @@
               <widget class="GtkTable" id="options_table">
                 <property name="visible">True</property>
                 <property name="border_width">5</property>
-                <property name="n_rows">8</property>
+                <property name="n_rows">14</property>
                 <property name="n_columns">3</property>
                 <property name="column_spacing">12</property>
-                <property name="row_spacing">6</property>
+                <property name="row_spacing">1</property>
                 <child>
                   <widget class="GtkLabel" id="label847677">
                     <property name="visible">True</property>
@@ -65,7 +65,7 @@
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options">GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
@@ -101,6 +101,110 @@
                   </packing>
                 </child>
                 <child>
+                  <widget class="GtkEntry" id="check_address_name">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                    <property name="truncate_multiline">True</property>
+                    <property name="caps_lock_warning">False</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">9</property>
+                    <property name="bottom_attach">10</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkEntry" id="check_address_1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                    <property name="truncate_multiline">True</property>
+                    <property name="caps_lock_warning">False</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">10</property>
+                    <property name="bottom_attach">11</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkEntry" id="check_address_2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                    <property name="truncate_multiline">True</property>
+                    <property name="caps_lock_warning">False</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">11</property>
+                    <property name="bottom_attach">12</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkEntry" id="check_address_3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                    <property name="truncate_multiline">True</property>
+                    <property name="caps_lock_warning">False</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">12</property>
+                    <property name="bottom_attach">13</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkEntry" id="check_address_4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                    <property name="truncate_multiline">True</property>
+                    <property name="caps_lock_warning">False</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">13</property>
+                    <property name="bottom_attach">14</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="check_print_address_label">
+                    <property name="visible">True</property>
+                    <property name="tooltip" translatable="yes">Check format must have an
+ADDRESS item defined in order
+to print an address on the check.</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Address</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">check_address_name</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">9</property>
+                    <property name="bottom_attach">10</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHSeparator" id="hseparator1">
+                    <property name="visible">True</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">8</property>
+                    <property name="bottom_attach">9</property>
+                    <property name="y_options">GTK_FILL</property>
+                    <property name="y_padding">5</property>
+                  </packing>
+                </child>
+                <child>
                   <placeholder/>
                 </child>
                 <child>
@@ -151,11 +255,27 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </widget>
             </child>
             <child>
               <widget class="GtkLabel" id="label847675">
                 <property name="visible">True</property>
+                <property name="xpad">5</property>
                 <property name="label" translatable="yes">Options</property>
                 <property name="justify">center</property>
               </widget>
@@ -167,7 +287,8 @@
             <child>
               <widget class="GtkTable" id="custom_table">
                 <property name="visible">True</property>
-                <property name="n_rows">13</property>
+                <property name="border_width">5</property>
+                <property name="n_rows">14</property>
                 <property name="n_columns">3</property>
                 <child>
                   <widget class="GtkLabel" id="label703">
@@ -269,8 +390,8 @@
                     <property name="mnemonic_widget">notes_x_entry</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -359,8 +480,8 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -449,8 +570,8 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="right_attach">3</property>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -466,8 +587,8 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">8</property>
-                    <property name="bottom_attach">9</property>
+                    <property name="top_attach">9</property>
+                    <property name="bottom_attach">10</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options">GTK_FILL</property>
                   </packing>
@@ -482,8 +603,8 @@
                     <property name="mnemonic_widget">units_combobox</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">8</property>
-                    <property name="bottom_attach">9</property>
+                    <property name="top_attach">9</property>
+                    <property name="bottom_attach">10</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -500,8 +621,8 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">6</property>
-                    <property name="bottom_attach">7</property>
+                    <property name="top_attach">7</property>
+                    <property name="bottom_attach">8</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
@@ -515,8 +636,8 @@
                     <property name="mnemonic_widget">translation_x_entry</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">6</property>
-                    <property name="bottom_attach">7</property>
+                    <property name="top_attach">7</property>
+                    <property name="bottom_attach">8</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -530,8 +651,8 @@
                     <property name="mnemonic_widget">check_rotation_entry</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
+                    <property name="top_attach">8</property>
+                    <property name="bottom_attach">9</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -549,8 +670,8 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
+                    <property name="top_attach">8</property>
+                    <property name="bottom_attach">9</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
@@ -566,8 +687,8 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="right_attach">3</property>
-                    <property name="top_attach">6</property>
-                    <property name="bottom_attach">7</property>
+                    <property name="top_attach">7</property>
+                    <property name="bottom_attach">8</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
@@ -579,10 +700,11 @@
                   </widget>
                   <packing>
                     <property name="right_attach">3</property>
-                    <property name="top_attach">9</property>
-                    <property name="bottom_attach">10</property>
+                    <property name="top_attach">10</property>
+                    <property name="bottom_attach">11</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
+                    <property name="y_padding">5</property>
                   </packing>
                 </child>
                 <child>
@@ -593,10 +715,11 @@
                   </widget>
                   <packing>
                     <property name="right_attach">3</property>
-                    <property name="top_attach">10</property>
-                    <property name="bottom_attach">11</property>
+                    <property name="top_attach">11</property>
+                    <property name="bottom_attach">12</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
+                    <property name="y_padding">5</property>
                   </packing>
                 </child>
                 <child>
@@ -608,8 +731,8 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="right_attach">3</property>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
+                    <property name="top_attach">8</property>
+                    <property name="bottom_attach">9</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                     <property name="x_padding">6</property>
@@ -622,8 +745,8 @@
                     <property name="label"> </property>
                   </widget>
                   <packing>
-                    <property name="top_attach">11</property>
-                    <property name="bottom_attach">12</property>
+                    <property name="top_attach">12</property>
+                    <property name="bottom_attach">13</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -674,13 +797,65 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="right_attach">3</property>
-                    <property name="top_attach">12</property>
-                    <property name="bottom_attach">13</property>
+                    <property name="top_attach">13</property>
+                    <property name="bottom_attach">14</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
+                  <widget class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Address:</property>
+                    <property name="use_underline">True</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkSpinButton" id="address_x_entry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                    <property name="adjustment">0 0 100000 0.10000000149 10 10</property>
+                    <property name="climb_rate">1</property>
+                    <property name="digits">3</property>
+                    <property name="numeric">True</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkSpinButton" id="address_y_entry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                    <property name="adjustment">0 0 100000 0.10000000149 10 10</property>
+                    <property name="climb_rate">1</property>
+                    <property name="digits">3</property>
+                    <property name="numeric">True</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
                   <placeholder/>
                 </child>
                 <child>
@@ -706,6 +881,7 @@
             <child>
               <widget class="GtkLabel" id="label847676">
                 <property name="visible">True</property>
+                <property name="xpad">5</property>
                 <property name="label" translatable="yes">Custom format</property>
                 <property name="justify">center</property>
               </widget>



More information about the gnucash-changes mailing list