[Gnucash-changes] r13102 - gnucash/trunk - Seperate report titles from headlines; leave title as a string, use headline for richer markup. Related to Bug#329369.

Joshua Sled jsled at cvs.gnucash.org
Sat Feb 4 15:49:01 EST 2006


Author: jsled
Date: 2006-02-04 15:49:00 -0500 (Sat, 04 Feb 2006)
New Revision: 13102
Trac: http://svn.gnucash.org/trac/changeset/13102

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/business/business-reports/aging.scm
   gnucash/trunk/src/business/business-reports/owner-report.scm
   gnucash/trunk/src/report/locale-specific/us/taxtxf-de_DE.scm
   gnucash/trunk/src/report/locale-specific/us/taxtxf.scm
   gnucash/trunk/src/report/report-system/html-document.scm
   gnucash/trunk/src/report/report-system/html-style-sheet.scm
   gnucash/trunk/src/report/report-system/report-system.scm
   gnucash/trunk/src/report/stylesheets/stylesheet-easy.scm
   gnucash/trunk/src/report/stylesheets/stylesheet-fancy.scm
   gnucash/trunk/src/report/stylesheets/stylesheet-plain.scm
Log:
Seperate report titles from headlines; leave title as a string, use headline for richer markup. Related to Bug#329369.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/ChangeLog	2006-02-04 20:49:00 UTC (rev 13102)
@@ -1,3 +1,21 @@
+2006-02-04  Joshua Sled  <jsled at asynchronous.org>
+
+	* src/report/report-system/html-document.scm
+	(gnc:html-document-headline): Add a headline property to the
+	html-document record.
+
+	* src/report/report-system/html-style-sheet.scm
+	(gnc:html-style-sheet-render): Add headline-copy, better comment.
+
+	* src/report/stylesheets/stylesheet-plain.scm (plain-renderer) 
+	* src/report/stylesheets/stylesheet-fancy.scm (fancy-renderer) 
+	* src/report/stylesheets/stylesheet-easy.scm (easy-renderer):
+	Use headline if available, fallback to title. 
+
+	* src/business/business-reports/aging.scm (aging-renderer)
+	* src/business/business-reports/owner-report.scm (reg-renderer): 
+	Use strings in titles, markup for the richer headline. Bug#329369.
+
 2006-02-04  David Hampton  <hampton at employees.org>
 
 	* src/gnome-utils/gnc-tree-view-commodity.c:

Modified: gnucash/trunk/src/business/business-reports/aging.scm
===================================================================
--- gnucash/trunk/src/business/business-reports/aging.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/business/business-reports/aging.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -530,16 +530,22 @@
         (document (gnc:make-html-document)))
 ;    (gnc:debug "Account: " account)
 
+    ;; set default title
+    (gnc:html-document-set-title! document report-title)
+    ;; maybe redefine better...
     (if account
-	(set! report-title (gnc:html-markup
-			    "!" 
-			    report-title
-			    ": "
-			    (gnc:html-markup-anchor
-			     (gnc:account-anchor-text account)
-			     (gnc:account-get-name account)))))
+        (begin
+          (gnc:html-document-set-title!
+           document (string-append report-title ": " (gnc:account-get-name account)))
+          (gnc:html-document-set-headline! document
+                                           (gnc:html-markup
+                                            "!" 
+                                            report-title
+                                            ": "
+                                            (gnc:html-markup-anchor
+                                             (gnc:account-anchor-text account)
+                                             (gnc:account-get-name account))))))
 
-    (gnc:html-document-set-title! document report-title)
     (gnc:html-table-set-col-headers! table heading-list)
 				     
     (if account

Modified: gnucash/trunk/src/business/business-reports/owner-report.scm
===================================================================
--- gnucash/trunk/src/business/business-reports/owner-report.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/business/business-reports/owner-report.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -540,7 +540,7 @@
 	 (end-date (gnc:timepair-end-day-time 
 		       (gnc:date-option-absolute-time
 			(opt-val gnc:pagename-general (N_ "To")))))
-	 (title #f)
+	 (title (string-append (_ type-str) (_ " Report"))))
 	 (book (gnc:get-current-book)) ;XXX Grab this from elsewhere
 	 (owner-type (opt-val "__reg" "owner-type"))
 	 (type-str ""))
@@ -553,20 +553,24 @@
       ((gnc-owner-employee)
        (set! type-str (N_ "Employee"))))
 
+    (gnc:html-document-set-title! document title)
+
     (if (gnc:owner-is-valid? owner)
 	(begin
 	  (setup-query query owner account end-date)
 
-	  (set! title (gnc:html-markup
-		       "!" 
-		       (_ type-str )
-		       (_ " Report: ")
-		       (gnc:html-markup-anchor
-			(gnc:owner-anchor-text owner)
-			(gnc:owner-get-name owner))))
+	  (gnc:html-document-set-title!
+           (string-append (_ type-str ) (_ " Report: ") (gnc:owner-get-name owner)))
+
+           (gnc:html-document-set-headline!
+            document (gnc:html-markup
+                      "!" 
+                      (_ type-str )
+                      (_ " Report: ")
+                      (gnc:html-markup-anchor
+                       (gnc:owner-anchor-text owner)
+                       (gnc:owner-get-name owner))))
 	  
-	  (gnc:html-document-set-title! document title)
-
 	  (if account
 	      (begin
 		(set! table (make-txn-table (gnc:report-options report-obj)

Modified: gnucash/trunk/src/report/locale-specific/us/taxtxf-de_DE.scm
===================================================================
--- gnucash/trunk/src/report/locale-specific/us/taxtxf-de_DE.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/report/locale-specific/us/taxtxf-de_DE.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -820,8 +820,7 @@
              'tag "th"
              'attribute (list "align" "left"))
             
-            (gnc:html-document-set-title! 
-             doc report-name)
+            (gnc:html-document-set-title! doc report-name)
             
             (gnc:html-document-add-object! 
              doc (gnc:make-html-text         

Modified: gnucash/trunk/src/report/locale-specific/us/taxtxf.scm
===================================================================
--- gnucash/trunk/src/report/locale-specific/us/taxtxf.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/report/locale-specific/us/taxtxf.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -780,8 +780,7 @@
              'tag "th"
              'attribute (list "align" "left"))
             
-            (gnc:html-document-set-title! 
-             doc report-name)
+            (gnc:html-document-set-title! doc report-name)
             
             (gnc:html-document-add-object! 
              doc (gnc:make-html-text         

Modified: gnucash/trunk/src/report/report-system/html-document.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-document.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/report/report-system/html-document.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -29,7 +29,7 @@
 
 (define <html-document> 
   (make-record-type "<html-document>" 
-                    '(style-sheet style-stack style title objects)))
+                    '(style-sheet style-stack style title headline objects)))
 
 (define gnc:html-document? 
   (record-predicate <html-document>))
@@ -43,6 +43,7 @@
    '()                   ;; style stack
    (gnc:make-html-style-table) ;; document style info
    ""                    ;; document title
+   #f                    ;; headline
    '()                   ;; subobjects 
    ))
 
@@ -52,9 +53,18 @@
 (define gnc:html-document-title
   (record-accessor <html-document> 'title))
 
+(define gnc:html-document-set-headline!
+  (record-modifier <html-document> 'headline))
+
+(define gnc:html-document-headline
+  (record-accessor <html-document> 'headline))
+
 (define gnc:html-document-set-style-sheet!
   (record-modifier <html-document> 'style-sheet))
 
+(define gnc:html-document-set-style-sheet!
+  (record-modifier <html-document> 'style-sheet))
+
 (define gnc:html-document-style-sheet
   (record-accessor <html-document> 'style-sheet))
 
@@ -127,7 +137,7 @@
           ;; push it 
           (gnc:html-document-push-style doc (gnc:html-document-style doc))
 
-	  (gnc:report-render-starting (gnc:html-document-title doc))
+          (gnc:report-render-starting (gnc:html-document-title doc))
           (if (not (null? headers?))
               (begin 
                 (push "<html>\n")

Modified: gnucash/trunk/src/report/report-system/html-style-sheet.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-style-sheet.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/report/report-system/html-style-sheet.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -235,7 +235,12 @@
                  doc))
         (headers? (if (null? rest) #f (if (car rest) #t #f))))
 
+    ;; Copy values over to stylesheet-produced document.  note that this is a
+    ;; bug that should probably better be fixed by having the stylesheets
+    ;; emit documents that are correct.  this, however, is a slightly easier
+    ;; place to enforce it. :p
     (gnc:html-document-set-title! newdoc (gnc:html-document-title doc))
+    (gnc:html-document-set-headline! newdoc (gnc:html-document-headline doc))
     
     ;; push the style sheet's default styles 
     (gnc:html-document-push-style newdoc (gnc:html-style-sheet-style sheet))

Modified: gnucash/trunk/src/report/report-system/report-system.scm
===================================================================
--- gnucash/trunk/src/report/report-system/report-system.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/report/report-system/report-system.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -213,6 +213,8 @@
 (export gnc:make-html-document)
 (export gnc:html-document-set-title!)
 (export gnc:html-document-title)
+(export gnc:html-document-set-headline!)
+(export gnc:html-document-headline)
 (export gnc:html-document-set-style-sheet!)
 (export gnc:html-document-style-sheet)
 (export gnc:html-document-set-style-stack!)

Modified: gnucash/trunk/src/report/stylesheets/stylesheet-easy.scm
===================================================================
--- gnucash/trunk/src/report/stylesheets/stylesheet-easy.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/report/stylesheets/stylesheet-easy.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -309,28 +309,31 @@
       (if (and logopixmap (> (string-length logopixmap) 0))
         (set! headcolumn 1))
 
-      (gnc:html-table-set-cell! 
-       t 1 headcolumn
-       (if show-preparer? 
-	   ;; title plus preparer info 
-	   (gnc:make-html-text
-	    (gnc:html-markup-b 
-	     (gnc:html-document-title doc))  
-	    (gnc:html-markup-br)
-	    (_ "Prepared by: ")
-	    (gnc:html-markup-b preparer)
-	    (gnc:html-markup-br)
-	    (_ "Prepared for: ")
-	    (gnc:html-markup-b prepared-for)
-	    (gnc:html-markup-br)
-	    (_ "Date: ")
-	    (gnc:print-date 
-	     (cons (current-time) 0)))
+      (let* ((title (gnc:html-document-title doc))
+             (doc-headline (gnc:html-document-headline doc))
+             (headline (if (eq? doc-headline #f) title doc-headline)))
 
-	   ;; title only 
-	   (gnc:make-html-text
-	    (gnc:html-markup-b 
-	     (gnc:html-document-title doc)))))
+        (gnc:html-table-set-cell! 
+         t 1 headcolumn
+         (if show-preparer? 
+             ;; title plus preparer info 
+             (gnc:make-html-text
+              (gnc:html-markup-b headline)
+              (gnc:html-markup-br)
+              (_ "Prepared by: ")
+              (gnc:html-markup-b preparer)
+              (gnc:html-markup-br)
+              (_ "Prepared for: ")
+              (gnc:html-markup-b prepared-for)
+              (gnc:html-markup-br)
+              (_ "Date: ")
+              (gnc:print-date 
+               (cons (current-time) 0)))
+
+             ;; title only 
+             (gnc:make-html-text
+              (gnc:html-markup-b headline))))
+        )
       
       ; only setup an image if we specified one
       (if (and logopixmap (> (string-length logopixmap) 0))

Modified: gnucash/trunk/src/report/stylesheets/stylesheet-fancy.scm
===================================================================
--- gnucash/trunk/src/report/stylesheets/stylesheet-fancy.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/report/stylesheets/stylesheet-fancy.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -276,28 +276,33 @@
        'attribute (list "border" 0)
        'inheritable? #f)
 
-      (gnc:html-table-set-cell! 
-       t 1 1
-       (if show-preparer? 
-	   ;; title plus preparer info 
-	   (gnc:make-html-text
-	    (gnc:html-markup-b 
-	     (gnc:html-document-title doc))  
-	    (gnc:html-markup-br)
-	    (_ "Prepared by: ")
-	    (gnc:html-markup-b preparer)
-	    (gnc:html-markup-br)
-	    (_ "Prepared for: ")
-	    (gnc:html-markup-b prepared-for)
-	    (gnc:html-markup-br)
-	    (_ "Date: ")
-	    (gnc:print-date 
-	     (cons (current-time) 0)))
+      (let* ((title (gnc:html-document-title doc))
+             (doc-headline (gnc:html-document-headline doc))
+             (headline (if (eq? doc-headline #f) title doc-headline)))
 
-	   ;; title only 
-	   (gnc:make-html-text
-	    (gnc:html-markup-b 
-	     (gnc:html-document-title doc)))))
+        (gnc:html-table-set-cell! 
+         t 1 1
+         (if show-preparer? 
+             ;; title plus preparer info 
+             (gnc:make-html-text
+              (gnc:html-markup-b 
+               (gnc:html-document-title doc))  
+              (gnc:html-markup-br)
+              (_ "Prepared by: ")
+              (gnc:html-markup-b preparer)
+              (gnc:html-markup-br)
+              (_ "Prepared for: ")
+              (gnc:html-markup-b prepared-for)
+              (gnc:html-markup-br)
+              (_ "Date: ")
+              (gnc:print-date 
+               (cons (current-time) 0)))
+
+             ;; title only 
+             (gnc:make-html-text
+              (gnc:html-markup-b 
+               (gnc:html-document-title doc)))))
+        )
       
       (if (and logopixmap
 	       (not (string=? logopixmap "")))

Modified: gnucash/trunk/src/report/stylesheets/stylesheet-plain.scm
===================================================================
--- gnucash/trunk/src/report/stylesheets/stylesheet-plain.scm	2006-02-04 20:46:32 UTC (rev 13101)
+++ gnucash/trunk/src/report/stylesheets/stylesheet-plain.scm	2006-02-04 20:49:00 UTC (rev 13102)
@@ -160,13 +160,16 @@
 	 ssdoc "a"
 	 'tag ""))
     
-    (let ((title (gnc:html-document-title doc)))
-      (if title
+    (let* ((title (gnc:html-document-title doc))
+           (doc-headline (gnc:html-document-headline doc))
+           (headline (if (eq? doc-headline #f)
+                         title doc-headline)))
+      (if headline
 	  (gnc:html-document-add-object!
 	   ssdoc
 	   (gnc:make-html-text
 	    (gnc:html-markup-p
-	     (gnc:html-markup-h3 title))))))
+	     (gnc:html-markup-h3 headline))))))
     
     (gnc:html-document-append-objects! ssdoc
 				       (gnc:html-document-objects doc))



More information about the gnucash-changes mailing list