mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Christian Stimming's boolean option patch & de.po update.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4007 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b9621b5c66
commit
aad1d3944c
@ -1,5 +1,9 @@
|
|||||||
2001-04-21 Christian Stimming <stimming@tuhh.de>
|
2001-04-21 Christian Stimming <stimming@tuhh.de>
|
||||||
|
|
||||||
|
* src/scm/options.scm (gnc:make-multichoice-callback-option):
|
||||||
|
Added multichoice option with callback functions, just like the
|
||||||
|
complex-boolean-option.
|
||||||
|
|
||||||
* src/scm/report/transaction-report.scm: Fixed date bug.
|
* src/scm/report/transaction-report.scm: Fixed date bug.
|
||||||
|
|
||||||
2001-04-21 Dave Peticolas <dave@krondo.com>
|
2001-04-21 Dave Peticolas <dave@krondo.com>
|
||||||
|
@ -301,41 +301,36 @@
|
|||||||
(lambda (x) (list #t x))
|
(lambda (x) (list #t x))
|
||||||
#f #f #f #f)))
|
#f #f #f #f)))
|
||||||
|
|
||||||
|
|
||||||
(define (gnc:make-simple-boolean-option
|
(define (gnc:make-simple-boolean-option
|
||||||
section
|
section
|
||||||
name
|
name
|
||||||
sort-tag
|
sort-tag
|
||||||
documentation-string
|
documentation-string
|
||||||
default-value)
|
default-value)
|
||||||
(let* ((value default-value)
|
(gnc:make-complex-boolean-option section
|
||||||
(value->string (lambda () (gnc:value->string value))))
|
name
|
||||||
(gnc:make-option
|
sort-tag
|
||||||
section name sort-tag 'boolean documentation-string
|
documentation-string
|
||||||
(lambda () value)
|
default-value
|
||||||
(lambda (x) (set! value x))
|
#f
|
||||||
(lambda () default-value)
|
#f))
|
||||||
(gnc:restore-form-generator value->string)
|
|
||||||
(lambda (x)
|
|
||||||
(if (boolean? x)
|
|
||||||
(list #t x)
|
|
||||||
(list #f "boolean-option: not a boolean")))
|
|
||||||
#f #f #f #f)))
|
|
||||||
|
|
||||||
|
;; Complex boolean options are the same as simple boolean options (see
|
||||||
;; Complex boolean options are the same as simple boolean options,
|
;; above), with the addition of two function arguments. (If both of
|
||||||
;; with the addition of two function arguments. Both functions should
|
;; them are #f, you have exactly a simple-boolean-option.) Both
|
||||||
;; expect one boolean argument. When the option's value is changed,
|
;; functions should expect one boolean argument. When the option's
|
||||||
;; one function will be called with the new option value at the time
|
;; value is changed, the function option-widget-changed-cb will be
|
||||||
;; that the GUI widget representing the option is changed, and the
|
;; called with the new option value at the time that the GUI widget
|
||||||
;; other function will be called when the option's setter is called
|
;; representing the option is changed, and the function
|
||||||
;; (that is, when the user selects "OK" or "Apply").
|
;; setter-function-called-cb will be called when the option's setter
|
||||||
|
;; is called (that is, when the user selects "OK" or "Apply").
|
||||||
|
|
||||||
;; The option-widget-changed-cb is tested for procedurehood before
|
;; The option-widget-changed-cb is tested for procedurehood before
|
||||||
;; it is called, so it is not validated to be a procedure here.
|
;; it is called, so it is not validated to be a procedure here.
|
||||||
;; However, since there could be an option-widget-changed-cb but not
|
;; However, since there could be an option-widget-changed-cb but not
|
||||||
;; a setter-function-called-cb, the procedurehood of the
|
;; a setter-function-called-cb, the procedurehood of the
|
||||||
;; setter-function-called-cb is checked here.
|
;; setter-function-called-cb is checked here.
|
||||||
|
|
||||||
(define (gnc:make-complex-boolean-option
|
(define (gnc:make-complex-boolean-option
|
||||||
section
|
section
|
||||||
name
|
name
|
||||||
@ -358,7 +353,8 @@
|
|||||||
(if (boolean? x)
|
(if (boolean? x)
|
||||||
(list #t x)
|
(list #t x)
|
||||||
(list #f "boolean-option: not a boolean")))
|
(list #f "boolean-option: not a boolean")))
|
||||||
#f #f #f (lambda (x) (option-widget-changed-cb x)))))
|
#f #f #f (and option-widget-changed-cb
|
||||||
|
(lambda (x) (option-widget-changed-cb x))))))
|
||||||
|
|
||||||
|
|
||||||
(define (gnc:make-pixmap-option
|
(define (gnc:make-pixmap-option
|
||||||
@ -536,6 +532,34 @@
|
|||||||
documentation-string
|
documentation-string
|
||||||
default-value
|
default-value
|
||||||
ok-values)
|
ok-values)
|
||||||
|
(gnc:make-multichoice-callback-option section
|
||||||
|
name
|
||||||
|
sort-tag
|
||||||
|
documentation-string
|
||||||
|
default-value
|
||||||
|
ok-values
|
||||||
|
#f
|
||||||
|
#f))
|
||||||
|
|
||||||
|
;; The multichoice-option with callback function is the same as the
|
||||||
|
;; usual multichoice options (see above), with the addition of two
|
||||||
|
;; function arguments. (If both of them are #f, you have exactly a
|
||||||
|
;; multichoice-option.) Both functions should expect one argument.
|
||||||
|
;; When the option's value is changed, the function
|
||||||
|
;; option-widget-changed-cb will be called with the new option value
|
||||||
|
;; at the time that the GUI widget representing the option is changed,
|
||||||
|
;; and the function setter-function-called-cb will be called when the
|
||||||
|
;; option's setter is called (that is, when the user selects "OK" or
|
||||||
|
;; "Apply").
|
||||||
|
(define (gnc:make-multichoice-callback-option
|
||||||
|
section
|
||||||
|
name
|
||||||
|
sort-tag
|
||||||
|
documentation-string
|
||||||
|
default-value
|
||||||
|
ok-values
|
||||||
|
setter-function-called-cb
|
||||||
|
option-widget-changed-cb)
|
||||||
(define (multichoice-legal val p-vals)
|
(define (multichoice-legal val p-vals)
|
||||||
(cond ((null? p-vals) #f)
|
(cond ((null? p-vals) #f)
|
||||||
((eq? val (vector-ref (car p-vals) 0)) #t)
|
((eq? val (vector-ref (car p-vals) 0)) #t)
|
||||||
@ -556,7 +580,10 @@
|
|||||||
(lambda () value)
|
(lambda () value)
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(if (multichoice-legal x ok-values)
|
(if (multichoice-legal x ok-values)
|
||||||
|
(begin
|
||||||
(set! value x)
|
(set! value x)
|
||||||
|
(if (procedure? setter-function-called-cb)
|
||||||
|
(setter-function-called-cb x)))
|
||||||
(gnc:error "Illegal Multichoice option set")))
|
(gnc:error "Illegal Multichoice option set")))
|
||||||
(lambda () default-value)
|
(lambda () default-value)
|
||||||
(gnc:restore-form-generator value->string)
|
(gnc:restore-form-generator value->string)
|
||||||
@ -571,7 +598,10 @@
|
|||||||
(lambda (x) (vector-ref (list-ref ok-values x) 2))
|
(lambda (x) (vector-ref (list-ref ok-values x) 2))
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(gnc:multichoice-list-lookup ok-values x)))
|
(gnc:multichoice-list-lookup ok-values x)))
|
||||||
(lambda () (multichoice-strings ok-values)) #f)))
|
(lambda () (multichoice-strings ok-values))
|
||||||
|
(and option-widget-changed-cb
|
||||||
|
(lambda (x) (option-widget-changed-cb x))))))
|
||||||
|
|
||||||
|
|
||||||
;; list options use the option-data in the same way as multichoice
|
;; list options use the option-data in the same way as multichoice
|
||||||
;; options. List options allow the user to select more than one option.
|
;; options. List options allow the user to select more than one option.
|
||||||
|
Loading…
Reference in New Issue
Block a user