On 07/18/2006 10:41 AM, Derek Atkins wrote:
Larry Evans <[EMAIL PROTECTED]> writes:
Good point, but a better (IMHO) method is to document the "type"
of report-info with comments somewhere in the file. Something like:
;;Types:
; (<report-id>
; (gnc:make-report
; report-name ; name of report ('name arg to gnc:define-report).
; )
; )
; (<report-info>
; (list
; report-id ; <report-id>
; row-span ; rows occupied by subreport, report-id.
; col-span ; columns occupied by subreport, report-id.
; callback ; either #f or callback to set options for report-id.
; )
; )
Something like this would be good. Feel free to submit a patch like
this.
I searched http://wiki.gnucash.org/wiki/Development for a place to submit
a patch, but found none; so, I'm attaching it here.
The patch is a little different than what was proposed above. Instead
of defining "types", I thought defining a constructor for the type
would be better. Thus, for an argument list, the documentation
follows the scheme:
( arg0 ; make-T0(...)
arg1 ; number? "description"
...
argn ; make-Tn(...)
)
IOW, each argument name (e.g. arg0), is followed by ; and either
a contructor name (e.g. make-T0(...)) for the argument or a predicate
(e.g. number?) and optionally followed by a description in double
quotes.
Hope that'll work.
Index: view-column.scm
===================================================================
--- view-column.scm (revision 14542)
+++ view-column.scm (working copy)
@@ -37,6 +37,21 @@
(gnc:module-load "gnucash/report/report-system" 0)
(gnc:module-load "gnucash/gnome-utils" 0) ;for gnc:html-build-url
+(define
+ (make-report-info
+ report-id ; gnc:make-report(...)
+ rowspan ; number?
+ colspan ; number?
+ callback ; #f or procedure? "maybe options-setter for report-id"
+ )
+ (list
+ report-id
+ rowspan
+ colspan
+ callback
+ )
+)
+
(define (make-options)
(let* ((options (gnc:new-options))
(opt-register
@@ -46,7 +61,11 @@
;; options editor.
(opt-register
(gnc:make-internal-option
- "__general" "report-list" '()))
+ "__general"
+ "report-list"
+ '() ;list of make-report-info(...)
+ )
+ )
(opt-register
(gnc:make-number-range-option
@@ -87,7 +106,9 @@
;; pings the parent
(let ((new-reports '()))
(for-each
- (lambda (report-info)
+ (lambda
+ (report-info ; make-report-info(...)
+ )
(let ((child (car report-info))
(rowspan (cadr report-info))
(colspan (caddr report-info))
@@ -98,7 +119,7 @@
(make-child-options-callback
report (gnc:find-report child)))
(set! report-info
- (list child rowspan colspan callback))))
+ (make-report-info child rowspan colspan callback))))
(set! new-reports (cons report-info new-reports))))
reports)
(gnc:option-set-value report-opt (reverse new-reports)))
@@ -107,7 +128,9 @@
;; report's cached text if possible. For the moment, we'll have
;; to rerun every report, every time... FIXME
(for-each
- (lambda (report-info)
+ (lambda
+ (report-info ;make-report-info(...)
+ )
;; run the report renderer, pick out the document style table
;; and objects from the returned document, then make a new
;; HTML table cell with those objects as content and append
@@ -118,7 +141,6 @@
(let* ((subreport (gnc:find-report (car report-info)))
(colspan (cadr report-info))
(rowspan (caddr report-info))
- (opt-callback (cadddr report-info))
(toplevel-cell (gnc:make-html-table-cell/size rowspan colspan))
(report-table (gnc:make-html-table))
(contents-cell (gnc:make-html-table-cell)))
@@ -226,12 +248,14 @@
(reports (gnc:option-value report-opt))
(new-reports '()))
(for-each
- (lambda (report-info)
+ (lambda
+ (report-info ; make-report-info(...)
+ )
(let ((rep (car report-info))
(rowspan (cadr report-info))
(colspan (caddr report-info)))
(set! report-info
- (list rep rowspan colspan #f))
+ (make-report-info rep rowspan colspan #f))
(set! new-reports (cons report-info new-reports))))
reports)
(gnc:option-set-value report-opt (reverse new-reports))))
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel