From 17e78bdd2995a3ffb72ad00d164fd484e80b52de Mon Sep 17 00:00:00 2001 From: Joshua Sled Date: Sat, 4 Feb 2006 20:49:00 +0000 Subject: [PATCH] Seperate report titles from headlines; leave title as a string, use headline for richer markup. Related to Bug#329369. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13102 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 18 +++++++ src/business/business-reports/aging.scm | 24 ++++++---- .../business-reports/owner-report.scm | 24 ++++++---- .../locale-specific/us/taxtxf-de_DE.scm | 3 +- src/report/locale-specific/us/taxtxf.scm | 3 +- src/report/report-system/html-document.scm | 14 +++++- src/report/report-system/html-style-sheet.scm | 5 ++ src/report/report-system/report-system.scm | 2 + src/report/stylesheets/stylesheet-easy.scm | 45 +++++++++--------- src/report/stylesheets/stylesheet-fancy.scm | 47 ++++++++++--------- src/report/stylesheets/stylesheet-plain.scm | 9 ++-- 11 files changed, 124 insertions(+), 70 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5da51f6c7..65b869d67d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2006-02-04 Joshua Sled + + * 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 * src/gnome-utils/gnc-tree-view-commodity.c: diff --git a/src/business/business-reports/aging.scm b/src/business/business-reports/aging.scm index fa9afe7b66..2cdae71952 100644 --- a/src/business/business-reports/aging.scm +++ b/src/business/business-reports/aging.scm @@ -530,16 +530,22 @@ totals to report currency") (document (gnc:make-html-document))) ; (gnc:debug "Account: " account) - (if account - (set! report-title (gnc:html-markup - "!" - report-title - ": " - (gnc:html-markup-anchor - (gnc:account-anchor-text account) - (gnc:account-get-name account))))) - + ;; set default title (gnc:html-document-set-title! document report-title) + ;; maybe redefine better... + (if 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-table-set-col-headers! table heading-list) (if account diff --git a/src/business/business-reports/owner-report.scm b/src/business/business-reports/owner-report.scm index 543eb7b5dc..6d4b1df315 100644 --- a/src/business/business-reports/owner-report.scm +++ b/src/business/business-reports/owner-report.scm @@ -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! document title) + (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)))) + (if account (begin (set! table (make-txn-table (gnc:report-options report-obj) diff --git a/src/report/locale-specific/us/taxtxf-de_DE.scm b/src/report/locale-specific/us/taxtxf-de_DE.scm index 9fc4570dc9..7420e43db4 100644 --- a/src/report/locale-specific/us/taxtxf-de_DE.scm +++ b/src/report/locale-specific/us/taxtxf-de_DE.scm @@ -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 diff --git a/src/report/locale-specific/us/taxtxf.scm b/src/report/locale-specific/us/taxtxf.scm index 072f6b6b76..656ab114b0 100644 --- a/src/report/locale-specific/us/taxtxf.scm +++ b/src/report/locale-specific/us/taxtxf.scm @@ -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 diff --git a/src/report/report-system/html-document.scm b/src/report/report-system/html-document.scm index 91e48006ac..7ca3901f46 100644 --- a/src/report/report-system/html-document.scm +++ b/src/report/report-system/html-document.scm @@ -29,7 +29,7 @@ (define (make-record-type "" - '(style-sheet style-stack style title objects))) + '(style-sheet style-stack style title headline objects))) (define gnc:html-document? (record-predicate )) @@ -43,6 +43,7 @@ '() ;; style stack (gnc:make-html-style-table) ;; document style info "" ;; document title + #f ;; headline '() ;; subobjects )) @@ -52,6 +53,15 @@ (define gnc:html-document-title (record-accessor 'title)) +(define gnc:html-document-set-headline! + (record-modifier 'headline)) + +(define gnc:html-document-headline + (record-accessor 'headline)) + +(define gnc:html-document-set-style-sheet! + (record-modifier 'style-sheet)) + (define gnc:html-document-set-style-sheet! (record-modifier '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 "\n") diff --git a/src/report/report-system/html-style-sheet.scm b/src/report/report-system/html-style-sheet.scm index 565560dcd5..177f9403e4 100644 --- a/src/report/report-system/html-style-sheet.scm +++ b/src/report/report-system/html-style-sheet.scm @@ -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)) diff --git a/src/report/report-system/report-system.scm b/src/report/report-system/report-system.scm index 0050bf4e99..4c18aa0b56 100644 --- a/src/report/report-system/report-system.scm +++ b/src/report/report-system/report-system.scm @@ -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!) diff --git a/src/report/stylesheets/stylesheet-easy.scm b/src/report/stylesheets/stylesheet-easy.scm index 697b60d0f8..75f8243a8c 100644 --- a/src/report/stylesheets/stylesheet-easy.scm +++ b/src/report/stylesheets/stylesheet-easy.scm @@ -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)) diff --git a/src/report/stylesheets/stylesheet-fancy.scm b/src/report/stylesheets/stylesheet-fancy.scm index fe2d68909d..1a7f26e48a 100644 --- a/src/report/stylesheets/stylesheet-fancy.scm +++ b/src/report/stylesheets/stylesheet-fancy.scm @@ -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 ""))) diff --git a/src/report/stylesheets/stylesheet-plain.scm b/src/report/stylesheets/stylesheet-plain.scm index b059b4e646..70d7d39233 100644 --- a/src/report/stylesheets/stylesheet-plain.scm +++ b/src/report/stylesheets/stylesheet-plain.scm @@ -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))