* src/gnome/dialog-progress.c

(gnc_progress_dialog_set_activity_mode): new func

	* src/guile/gnc.gwp: add new progress dialog api

	* src/engine/date.h: remove unneeded includes

	* src/scm/report/income-or-expense-pie.scm: make 'other' slice
	a link to a new pie report

	* src/scm/report.scm (gnc:make-report-options): new func

	* src/register/splitreg.c (configLayout): don't show balance
	column in stock registers

	* src/gnc-ui-util.c (xaccSPrintAmount): put currency symbol
	after quantity for shares values


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3811 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-03-21 00:08:57 +00:00
parent 256be7a33a
commit 75ee724948
12 changed files with 79 additions and 36 deletions

View File

@ -1,5 +1,23 @@
2001-03-20 Dave Peticolas <dave@krondo.com>
* src/gnome/dialog-progress.c
(gnc_progress_dialog_set_activity_mode): new func
* src/guile/gnc.gwp: add new progress dialog api
* src/engine/date.h: remove unneeded includes
* src/scm/report/income-or-expense-pie.scm: make 'other' slice
a link to a new pie report
* src/scm/report.scm (gnc:make-report-options): new func
* src/register/splitreg.c (configLayout): don't show balance
column in stock registers
* src/gnc-ui-util.c (xaccSPrintAmount): put currency symbol
after quantity for shares values
* src/guile/option-util.c (gnc_commit_option): update GUI value
* src/gnome/gnc-html-guppi.c: new func for shutting down guppi

View File

@ -32,8 +32,6 @@
#define __XACC_DATE_H__
#include <time.h>
#include "config.h"
#include "glib.h"
/** Constants *******************************************************/

View File

@ -875,6 +875,7 @@ xaccSPrintAmount (char * bufp, gnc_numeric val, GNCPrintAmountInfo info)
char sign_posn;
gboolean print_sign = TRUE;
gboolean is_shares = FALSE;
if (!bufp)
return 0;
@ -887,6 +888,11 @@ xaccSPrintAmount (char * bufp, gnc_numeric val, GNCPrintAmountInfo info)
currency_symbol = lc->currency_symbol;
else
{
if (info.commodity &&
safe_strcmp (GNC_COMMODITY_NS_ISO,
gnc_commodity_get_namespace (info.commodity)) != 0)
is_shares = TRUE;
currency_symbol = gnc_commodity_get_mnemonic (info.commodity);
info.use_locale = 0;
}
@ -899,8 +905,8 @@ xaccSPrintAmount (char * bufp, gnc_numeric val, GNCPrintAmountInfo info)
if (!info.use_locale)
{
cs_precedes = 1; /* currency symbol precedes amount */
sep_by_space = 1; /* they are separated by a space */
cs_precedes = is_shares ? 0 : 1;
sep_by_space = 1;
}
else
{

View File

@ -269,6 +269,19 @@ gnc_progress_dialog_set_limits (GNCProgressDialog *progress,
gnc_progress_dialog_update (progress);
}
void
gnc_progress_dialog_set_activity_mode (GNCProgressDialog *progress,
gboolean activity_mode)
{
if (progress == NULL)
return;
gtk_progress_set_activity_mode (GTK_PROGRESS (progress->progress_bar),
activity_mode);
gnc_progress_dialog_update (progress);
}
void
gnc_progress_dialog_set_cancel_func (GNCProgressDialog *progress,
GNCProgressCancelFunc cancel_func,

View File

@ -51,6 +51,11 @@ void gnc_progress_dialog_set_heading (GNCProgressDialog *progress,
void gnc_progress_dialog_set_limits (GNCProgressDialog *progress,
gfloat min, gfloat max);
/* Set the activity mode. If TRUE, the dialog just indicates
* that stuff is happening, rather than a percentage complete. */
void gnc_progress_dialog_set_activity_mode (GNCProgressDialog *progress,
gboolean activity_mode);
/* Set the C function which will be called if the user hits the
* 'cancel' button. The cancel function returns a boolean value.
* If the value is TRUE, the window is hidden. */

View File

@ -455,7 +455,6 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, DEBT_CELL, 0, 7);
set_cell (reg, curs, CRED_CELL, 0, 8);
set_cell (reg, curs, SHRBALN_CELL, 0, 9);
set_cell (reg, curs, BALN_CELL, 0, 10);
curs = reg->cursor_ledger_double;
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
@ -471,7 +470,6 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, TDEBT_CELL, 0, 7);
set_cell (reg, curs, TCRED_CELL, 0, 8);
set_cell (reg, curs, TSHRBALN_CELL, 0, 9);
set_cell (reg, curs, TBALN_CELL, 0, 10);
curs = reg->cursor_journal_double;
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);

View File

@ -74,6 +74,8 @@
(let ((dialog (gnc:progress-dialog-new
(gnc:get-ui-data) #f))
(canceled #f))
(gnc:progress-dialog-set-activity-mode dialog #t)
(gnc:progress-dialog-set-heading dialog #f)
(gnc:progress-dialog-set-cancel-scm-func
dialog
(lambda ()
@ -82,8 +84,6 @@
#t))
(let loop ((value 0.0))
(gnc:progress-dialog-set-value dialog value)
(gnc:progress-dialog-set-heading
dialog (number->string value))
(sleep 1)
(if (and (not canceled) (< value 90.0))
(loop (+ value 5.0))))

View File

@ -43,6 +43,11 @@
(gnc:account-anchor-text acct)
(gnc:account-get-name acct))))
(define (gnc:report-anchor-text report-id)
(string-append
"gnc-report:id="
(number->string report-id)))
(define (gnc:assign-colors num-colors)
(define base-colors '("red" "orange" "yellow" "green"
"blue" "purple" "violet"))

View File

@ -205,6 +205,12 @@
(hash-set! *gnc:_reports_* (gnc:report-id r) r)
id))
(define (gnc:make-report-options template-name)
(let ((template (hash-ref *gnc:_report-templates_* template-name)))
(if template
(gnc:report-template-new-options template)
#f)))
(define (gnc:report-remove-by-id id)
(let ((r (hash-ref *gnc:_reports_* id)))
(for-each
@ -214,7 +220,7 @@
(hash-remove! *gnc:_reports_* id)))
(define (gnc:find-report id)
(hash-ref *gnc:_reports_* id))
(hash-ref *gnc:_reports_* id))
(define (gnc:report-tree-collapse tree)
(let ((retval '()))

View File

@ -113,7 +113,8 @@
report-currency #t)))))
profit-collector-list))
(combined (zip double-list accounts))
(accounts-or-names '()))
(accounts-or-names '())
(other-anchor ""))
(set! combined
(filter (lambda (pair) (not (= 0.0 (car pair))))
@ -123,13 +124,27 @@
(sort combined
(lambda (a b) (> (car a) (car b)))))
;; if too many slices, condense them to an 'other' slice
;; and add a link to a new pie report with just those
;; accounts
(if (> (length combined) max-slices)
(let* ((start (take combined (- max-slices 1)))
(finish (drop combined (- max-slices 1)))
(sum (apply + (unzip1 finish))))
(set! combined
(append start
(list (list sum (_ "Other")))))))
(list (list sum (_ "Other")))))
(let* ((name (if is-income? "Income Piechart" "Expense Piechart"))
(options (gnc:make-report-options name))
(account-op (gnc:lookup-option options
"Report Options"
"Accounts")))
(call-with-values (lambda () (unzip2 finish))
(lambda (ds as)
(gnc:option-set-value account-op as)))
(set! other-anchor
(gnc:report-anchor-text
(gnc:make-report name options))))))
(call-with-values (lambda () (unzip2 combined))
(lambda (ds as)
@ -157,7 +172,9 @@
(gnc:html-piechart-set-colors! chart
(gnc:assign-colors (length combined)))
(let ((urls (map (lambda (a)
(if (string? a) "" (gnc:account-anchor-text a)))
(if (string? a)
other-anchor
(gnc:account-anchor-text a)))
accounts-or-names)))
(gnc:html-piechart-set-button-1-slice-urls! chart urls)
(gnc:html-piechart-set-button-1-legend-urls! chart urls))

View File

@ -466,8 +466,7 @@
'in-menu? #f))
(define (gnc:apply-register-report func query journal?)
(let* ((template (hash-ref *gnc:_report-templates_* "Register"))
(options (gnc:report-template-new-options template))
(let* ((options (gnc:make-report-options "Register"))
(qo (gnc:lookup-option options "__reg" "query"))
(jo (gnc:lookup-option options "__reg" "journal")))
(gnc:option-set-value qo query)

View File

@ -566,28 +566,6 @@
(end-string (strftime "%x" (localtime (car end)))))
(string-append (_ "From") " " begin-string (_"To") " " end-string)))
(define (make-account-subheading acc-name from-date)
(let* ((separator (string-ref (gnc:account-separator-char) 0))
(acc (gnc:get-account-from-full-name
(gnc:get-current-group)
acc-name
separator))
(unsigned-balance (d-gnc:account-get-balance-at-date
acc
from-date
#f))
(signed-balance (if (gnc:account-reverse-balance? acc)
(- unsigned-balance)
unsigned-balance)))
(string-append acc-name
" ("
(_ "Opening Balance")
" "
(gnc:amount->string signed-balance
(gnc:account-value-print-info acc #f))
")"
)))
(define (get-primary-subtotal-style options)
(let ((bgcolor (gnc:lookup-option options
(N_ "Colors")