From 18ac421c7c0ee83750db7057299bea57834c4ee3 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Mon, 16 Dec 2002 01:41:45 +0000 Subject: [PATCH] Give user feedback during the rendering of a report. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7691 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/report/report-system/html-document.scm | 14 +++++++++++--- src/report/report-system/report-system.scm | 1 + src/report/report-system/report-utilities.scm | 8 ++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/report/report-system/html-document.scm b/src/report/report-system/html-document.scm index 5ca9bb6245..053a5bdeec 100644 --- a/src/report/report-system/html-document.scm +++ b/src/report/report-system/html-document.scm @@ -115,13 +115,17 @@ ;; otherwise, do the trivial render. (let* ((retval '()) - (push (lambda (l) (set! retval (cons l retval))))) + (push (lambda (l) (set! retval (cons l retval)))) + (objs (gnc:html-document-objects doc)) + (work-to-do (length objs)) + (work-done 0)) ;; compile the doc style (gnc:html-style-table-compile (gnc:html-document-style doc) (gnc:html-document-style-stack doc)) ;; push it (gnc:html-document-push-style doc (gnc:html-document-style doc)) + (gnc:report-render-starting (gnc:html-document-title doc)) (if (not (null? headers?)) (begin (push "\n") @@ -138,14 +142,18 @@ ;; now render the children (for-each (lambda (child) - (push (gnc:html-object-render child doc))) - (gnc:html-document-objects doc)) + (begin + (push (gnc:html-object-render child doc)) + (set! work-done (+ 1 work-done)) + (gnc:report-percent-done (* 100 (/ work-done work-to-do))))) + objs) (if (not (null? headers?)) (begin (push "\n") (push "\n"))) + (gnc:report-finished) (gnc:html-document-pop-style doc) (gnc:html-style-table-uncompile (gnc:html-document-style doc)) diff --git a/src/report/report-system/report-system.scm b/src/report/report-system/report-system.scm index 5ae4252c77..0900d52ae7 100644 --- a/src/report/report-system/report-system.scm +++ b/src/report/report-system/report-system.scm @@ -545,6 +545,7 @@ (export gnc:query-set-match-voids-only!) (export gnc:split-voided?) (export gnc:report-starting) +(export gnc:report-render-starting) (export gnc:report-percent-done) (export gnc:report-finished) (export gnc:accounts-count-splits) diff --git a/src/report/report-system/report-utilities.scm b/src/report/report-system/report-utilities.scm index 8e5bdc534a..7c634a148c 100644 --- a/src/report/report-system/report-utilities.scm +++ b/src/report/report-system/report-utilities.scm @@ -674,6 +674,14 @@ (gnc:gettext report-name)) 0)) +(define (gnc:report-render-starting report-name) + (gnc:mdi_show_progress (sprintf #f + (_ "Rendering '%s' report ...") + (if (string-null? report-name) + (gnc:gettext "Untitled") + (gnc:gettext report-name))) + 0)) + (define (gnc:report-percent-done percent) (gnc:mdi_show_progress #f (truncate percent)))