options-utilities.scm (gnucash-5.0.tar.bz2) | : | options-utilities.scm (gnucash-5.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
(export gnc:options-add-sort-method!) | (export gnc:options-add-sort-method!) | |||
(export gnc:options-add-subtotal-view!) | (export gnc:options-add-subtotal-view!) | |||
;; These are just a bunch of options which were useful in several | ;; These are just a bunch of options which were useful in several | |||
;; reports and hence they got defined in a separate function. | ;; reports and hence they got defined in a separate function. | |||
(define (evaluate arg) | (define (evaluate arg) | |||
(if (procedure? arg) (arg) arg)) | (if (procedure? arg) (arg) arg)) | |||
;; This is one single end-date of a report. | ;; This is one single end-date of a report. | |||
(define (gnc:options-add-report-date! | (define (gnc:options-add-report-date! | |||
options pagename optname sort-tag) | options pagename optname sort-tag) | |||
(gnc-register-end-date-option (gnc:optiondb options) pagename optname sort-tag | (gnc-register-end-date-option (gnc:optiondb options) pagename optname sort-tag | |||
(N_ "Select a date to report on."))) | (N_ "Select a date to report on."))) | |||
;; This is a date-interval for a report. | ;; This is a date-interval for a report. | |||
(define (gnc:options-add-date-interval! | (define (gnc:options-add-date-interval! | |||
options pagename name-from name-to sort-tag) | options pagename name-from name-to sort-tag) | |||
(gnc:options-make-date-interval! options pagename | (gnc:options-make-date-interval! options pagename | |||
name-from (N_ "Start of reporting period.") | name-from (N_ "Start of reporting period.") | |||
name-to (N_ "End of reporting period.") | name-to (N_ "End of reporting period.") | |||
sort-tag)) | sort-tag)) | |||
;; A date interval multichoice option. | ;; A date interval multichoice option. | |||
(define (gnc:options-add-interval-choice! | (define (gnc:options-add-interval-choice! | |||
options pagename optname sort-tag default) | options pagename optname sort-tag default) | |||
(gnc-register-multichoice-option (gnc:optiondb options) | (gnc-register-multichoice-option (gnc:optiondb options) | |||
pagename optname | pagename optname | |||
sort-tag (N_ "The amount of time between data points.") | sort-tag (N_ "The amount of time between data points.") | |||
(symbol->string (evaluate default)) | (symbol->string (evaluate default)) | |||
(list (vector 'DayDelta (N_ "One Day")) | (list (vector 'DayDelta (N_ "One Day")) | |||
(vector 'WeekDelta (N_ "One Week")) | (vector 'WeekDelta (N_ "One Week")) | |||
(vector 'TwoWeekDelta (N_ "Two Weeks")) | (vector 'TwoWeekDelta (N_ "Two Weeks")) | |||
(vector 'MonthDelta (N_ "One Month")) | (vector 'MonthDelta (N_ "One Month")) | |||
(vector 'QuarterDelta (N_ "Quarter Year")) | (vector 'QuarterDelta (N_ "Quarter Year")) | |||
(vector 'HalfYearDelta (N_ "Half Year")) | (vector 'HalfYearDelta (N_ "Half Year")) | |||
(vector 'YearDelta (N_ "One Year"))))) | (vector 'YearDelta (N_ "One Year"))))) | |||
;; A multichoice option intended to chose the account level. Different | ;; A multichoice option intended to chose the account level. Different | |||
;; from the other functions the help string can still be given. Used | ;; from the other functions the help string can still be given. Used | |||
;; below. | ;; below. | |||
(define (gnc:options-add-account-levels! | (define (gnc:options-add-account-levels! | |||
options pagename name-display-depth | options pagename name-display-depth | |||
sort-tag help-string default-depth) | sort-tag help-string default-depth) | |||
(gnc-register-multichoice-option | (gnc-register-multichoice-option | |||
(gnc:optiondb options) | (gnc:optiondb options) | |||
pagename name-display-depth sort-tag help-string | pagename name-display-depth sort-tag help-string | |||
(let ((default (evaluate default-depth))) | (let ((default (evaluate default-depth))) | |||
(if (number? default) (number->string default) (symbol->string default))) | (if (number? default) (number->string default) (symbol->string default))) | |||
(list (vector 'all (N_ "All")) | (list (vector 'all (N_ "All")) | |||
(vector 1 "1") | (vector 1 "1") | |||
(vector 2 "2") | (vector 2 "2") | |||
(vector 3 "3") | (vector 3 "3") | |||
(vector 4 "4") | (vector 4 "4") | |||
(vector 5 "5") | (vector 5 "5") | |||
(vector 6 "6")))) | (vector 6 "6")))) | |||
;; These help for selecting a bunch of accounts. | ;; These help for selecting a bunch of accounts. | |||
(define (gnc:options-add-account-selection! | (define (gnc:options-add-account-selection! | |||
options pagename | options pagename | |||
name-display-depth name-show-subaccounts name-accounts | name-display-depth name-show-subaccounts name-accounts | |||
sort-tag default-depth default-accounts default-show-subaccounts) | sort-tag default-depth default-accounts default-show-subaccounts) | |||
(gnc:options-add-account-levels! | (gnc:options-add-account-levels! | |||
options pagename name-display-depth | options pagename name-display-depth | |||
(string-append sort-tag "a") | (string-append sort-tag "a") | |||
(N_ "Show accounts to this depth, overriding any other option.") | (N_ "Show accounts to this depth, overriding any other option.") | |||
default-depth) | default-depth) | |||
(gnc-register-simple-boolean-option (gnc:optiondb options) | (gnc-register-simple-boolean-option (gnc:optiondb options) | |||
pagename name-show-subaccounts | pagename name-show-subaccounts | |||
(string-append sort-tag "b") | (string-append sort-tag "b") | |||
(N_ "Override account-selection and show sub-accounts of all selected accoun ts?") | (N_ "Override account-selection and show sub-accounts of all selected accoun ts?") | |||
skipping to change at line 125 | skipping to change at line 125 | |||
;; selector OR ( always show sub-accounts is selected AND one of | ;; selector OR ( always show sub-accounts is selected AND one of | |||
;; the parents is selected in the account selector. ))) | ;; the parents is selected in the account selector. ))) | |||
(gnc-register-account-list-option (gnc:optiondb options) | (gnc-register-account-list-option (gnc:optiondb options) | |||
pagename name-accounts | pagename name-accounts | |||
(string-append sort-tag "c") | (string-append sort-tag "c") | |||
(N_ "Report on these accounts, if display depth allows.") | (N_ "Report on these accounts, if display depth allows.") | |||
(evaluate default-accounts))) | (evaluate default-accounts))) | |||
;; To let the user select a currency for the report. | ;; To let the user select a currency for the report. | |||
(define (gnc:options-add-currency! | (define (gnc:options-add-currency! | |||
options pagename name-report-currency sort-tag) | options pagename name-report-currency sort-tag) | |||
(gnc-register-currency-option (gnc:optiondb options) | (gnc-register-currency-option (gnc:optiondb options) | |||
pagename name-report-currency | pagename name-report-currency | |||
sort-tag | sort-tag | |||
(N_ "Select the currency to display the values of this report in.") | (N_ "Select the currency to display the values of this report in.") | |||
(gnc-default-report-currency))) | (gnc-default-report-currency))) | |||
;; A multichoice option for the source of prices | ;; A multichoice option for the source of prices | |||
(define (gnc:options-add-price-source! | (define (gnc:options-add-price-source! | |||
options pagename optname sort-tag default) | options pagename optname sort-tag default) | |||
(gnc-register-multichoice-option | (gnc-register-multichoice-option | |||
(gnc:optiondb options) | (gnc:optiondb options) | |||
pagename optname | pagename optname | |||
sort-tag (N_ "The source of price information.") | sort-tag (N_ "The source of price information.") | |||
(symbol->string (evaluate default)) | (symbol->string (evaluate default)) | |||
(list (vector 'average-cost (N_ "Average cost of purchases weighted by volum e")) | (list (vector 'average-cost (N_ "Average cost of purchases weighted by volum e")) | |||
(vector 'weighted-average (N_ "Weighted average of all transactions in the past")) | (vector 'weighted-average (N_ "Weighted average of all transactions in the past")) | |||
(vector 'pricedb-before (N_ "Last up through report date")) | (vector 'pricedb-before (N_ "Last up through report date")) | |||
(vector 'pricedb-nearest (N_ "Closest to report date")) | (vector 'pricedb-nearest (N_ "Closest to report date")) | |||
(vector 'pricedb-latest (N_ "Most recent"))))) | (vector 'pricedb-latest (N_ "Most recent"))))) | |||
;; The width- and height- options for charts | ;; The width- and height- options for charts | |||
(define (gnc:options-add-plot-size! | (define (gnc:options-add-plot-size! | |||
options pagename | options pagename | |||
name-width name-height sort-tag | name-width name-height sort-tag | |||
default-width default-height) | default-width default-height) | |||
(let* ((widthv (evaluate default-width)) | (let* ((widthv (evaluate default-width)) | |||
(heightv (evaluate default-height)) | (heightv (evaluate default-height)) | |||
(width (if (pair? widthv) (cdr widthv) widthv)) | (width (if (pair? widthv) (cdr widthv) widthv)) | |||
(height (if (pair? heightv) (cdr heightv) heightv))) | (height (if (pair? heightv) (cdr heightv) heightv))) | |||
(gnc-register-number-plot-size-option (gnc:optiondb options) | (gnc-register-number-plot-size-option (gnc:optiondb options) | |||
pagename name-width | pagename name-width | |||
(string-append sort-tag "a") | (string-append sort-tag "a") | |||
(N_ "Width of plot, 10 - 100 in percent, above in pixels.") | (N_ "Width of plot, 10 - 100 in percent, above in pixels.") | |||
width) | width) | |||
(gnc-register-number-plot-size-option (gnc:optiondb options) | (gnc-register-number-plot-size-option (gnc:optiondb options) | |||
pagename name-height | pagename name-height | |||
(string-append sort-tag "b") | (string-append sort-tag "b") | |||
(N_ "Height of plot, 10 - 100 in percent, above in pixels.") | (N_ "Height of plot, 10 - 100 in percent, above in pixels.") | |||
height))) | height))) | |||
;; A multicoice option for the marker of a scatter plot. | ;; A multicoice option for the marker of a scatter plot. | |||
(define (gnc:options-add-marker-choice! | (define (gnc:options-add-marker-choice! | |||
options pagename optname sort-tag default) | options pagename optname sort-tag default) | |||
(gnc-register-multichoice-option (gnc:optiondb options) | (gnc-register-multichoice-option (gnc:optiondb options) | |||
pagename optname | pagename optname | |||
sort-tag | sort-tag | |||
(N_ "Choose the marker for each data point.") | (N_ "Choose the marker for each data point.") | |||
(symbol->string (evaluate default)) | (symbol->string (evaluate default)) | |||
(list | (list | |||
(vector 'diamond (N_ "Diamond")) | (vector 'diamond (N_ "Diamond")) | |||
(vector 'circle (N_ "Circle")) | (vector 'circle (N_ "Circle")) | |||
(vector 'square (N_ "Square")) | (vector 'square (N_ "Square")) | |||
(vector 'cross (N_ "Cross")) | (vector 'cross (N_ "Cross")) | |||
(vector 'plus (N_ "Plus")) | (vector 'plus (N_ "Plus")) | |||
(vector 'dash (N_ "Dash")) | (vector 'dash (N_ "Dash")) | |||
(vector 'filleddiamond (N_ "Filled diamond")) | (vector 'filleddiamond (N_ "Filled diamond")) | |||
(vector 'filledcircle (N_ "Filled circle")) | (vector 'filledcircle (N_ "Filled circle")) | |||
(vector 'filledsquare (N_ "Filled square"))))) | (vector 'filledsquare (N_ "Filled square"))))) | |||
(define (gnc:options-add-sort-method! | (define (gnc:options-add-sort-method! | |||
options pagename optname sort-tag default) | options pagename optname sort-tag default) | |||
(gnc-register-multichoice-option (gnc:optiondb options) | (gnc-register-multichoice-option (gnc:optiondb options) | |||
pagename optname | pagename optname | |||
sort-tag | sort-tag | |||
(N_ "Choose the method for sorting accounts.") | (N_ "Choose the method for sorting accounts.") | |||
(symbol->string (evaluate default)) | (symbol->string (evaluate default)) | |||
(list | (list | |||
(vector 'acct-code (N_ "Alphabetical by account code")) | (vector 'acct-code (N_ "Alphabetical by account code")) | |||
(vector 'alphabetical (N_ "Alphabetical by account name")) | (vector 'alphabetical (N_ "Alphabetical by account name")) | |||
(vector 'amount (N_ "Numerical by descending amount"))))) | (vector 'amount (N_ "Numerical by descending amount"))))) | |||
;; These control the calculation and view mode of subtotal balances | ;; These control the calculation and view mode of subtotal balances | |||
(define (gnc:options-add-subtotal-view! | (define (gnc:options-add-subtotal-view! | |||
options pagename | options pagename | |||
optname-parent-balance-mode optname-parent-total-mode | optname-parent-balance-mode optname-parent-total-mode | |||
sort-tag) | sort-tag) | |||
;; what to show for non-leaf accounts | ;; what to show for non-leaf accounts | |||
(gnc-register-multichoice-option (gnc:optiondb options) | (gnc-register-multichoice-option (gnc:optiondb options) | |||
pagename | pagename | |||
;; usually the option name is: (N_ "Parent account balances") | ;; usually the option name is: (N_ "Parent account balances") | |||
optname-parent-balance-mode | optname-parent-balance-mode | |||
(string-append sort-tag "a") | (string-append sort-tag "a") | |||
(string-join | (string-join | |||
(list | (list | |||
(G_ "How to show the balances of parent accounts.") | (G_ "How to show the balances of parent accounts.") | |||
(G_ "Account Balance in the parent account, excluding any subaccounts.") | (G_ "Account Balance in the parent account, excluding any subaccounts.") | |||
End of changes. 13 change blocks. | ||||
22 lines changed or deleted | 22 lines changed or added |