diff options
author | Ludovic Courtès | 2007-11-29 18:02:09 +0100 |
---|---|---|
committer | Ludovic Courtès | 2007-11-29 18:02:09 +0100 |
commit | 26be10e348d19ac5b373cc63c8e0c4bc9b39786a (patch) | |
tree | 045686c5203408d82fa67fbeb8759119d60a7bd9 /src/guile | |
parent | 57e103394f1500eb7ad21c350638e6481a4fb9d6 (diff) | |
download | skribilo-26be10e348d19ac5b373cc63c8e0c4bc9b39786a.tar.gz skribilo-26be10e348d19ac5b373cc63c8e0c4bc9b39786a.tar.lz skribilo-26be10e348d19ac5b373cc63c8e0c4bc9b39786a.zip |
Clean up `color' module.
* src/guile/skribilo/color.scm (*used-colors*): Remove.
(*skribe-rgb-alist*): Rename to...
(%rgb-alist): New.
(skribe-color->rgb): Rename to...
(color->rgb): New.
(skribe-get-used-colors, skribe-use-color!): Remove.
Update users.
* src/guile/skribilo/utils/compat.scm (skribe-color->rgb,
skribe-use-color!, skribe-get-used-colors): New.
Diffstat (limited to 'src/guile')
-rw-r--r-- | src/guile/skribilo/color.scm | 29 | ||||
-rw-r--r-- | src/guile/skribilo/engine/context.scm | 7 | ||||
-rw-r--r-- | src/guile/skribilo/engine/latex.scm | 5 | ||||
-rw-r--r-- | src/guile/skribilo/engine/lout.scm | 4 | ||||
-rw-r--r-- | src/guile/skribilo/package/base.scm | 11 | ||||
-rw-r--r-- | src/guile/skribilo/package/pie.scm | 4 | ||||
-rw-r--r-- | src/guile/skribilo/package/slide.scm | 9 | ||||
-rw-r--r-- | src/guile/skribilo/utils/compat.scm | 16 |
8 files changed, 39 insertions, 46 deletions
diff --git a/src/guile/skribilo/color.scm b/src/guile/skribilo/color.scm index b8f6eac..5c50e36 100644 --- a/src/guile/skribilo/color.scm +++ b/src/guile/skribilo/color.scm @@ -25,19 +25,13 @@ :autoload (skribilo ast) (search-down) :autoload (srfi srfi-1) (append-map) :autoload (srfi srfi-60) (bitwise-and arithmetic-shift) - :export (skribe-color->rgb skribe-get-used-colors skribe-use-color! - document-used-colors)) + :export (color->rgb document-used-colors)) (fluid-set! current-reader %skribilo-module-reader) -;; FIXME: This module should be generalized and the `skribe-' procedures -;; moved to `compat.scm'. -;; FIXME: Use a fluid? Or remove it? -(define *used-colors* '()) - -(define *skribe-rgb-alist* '( +(define %rgb-alist '( ("snow" . "255 250 250") ("ghostwhite" . "248 248 255") ("whitesmoke" . "245 245 245") @@ -583,7 +577,7 @@ (define (%convert-color str) - (let ((col (assoc str *skribe-rgb-alist*))) + (let ((col (assoc str %rgb-alist))) (cond (col (let* ((p (open-input-string (cdr col))) @@ -603,9 +597,9 @@ (values 0 0 0))))) ;;; -;;; SKRIBE-COLOR->RGB +;;; COLOR->RGB ;;; -(define (skribe-color->rgb spec) +(define (color->rgb spec) (cond ((string? spec) (%convert-color spec)) ((integer? spec) @@ -616,19 +610,6 @@ (values 0 0 0)))) ;;; -;;; SKRIBE-GET-USED-COLORS -;;; -(define (skribe-get-used-colors) - *used-colors*) - -;;; -;;; SKRIBE-USE-COLOR! -;;; -(define (skribe-use-color! color) - (set! *used-colors* (cons color *used-colors*)) - color) - -;;; ;;; DOCUMENT-USED-COLORS ;;; (define (document-used-colors doc) diff --git a/src/guile/skribilo/engine/context.scm b/src/guile/skribilo/engine/context.scm index 4a47b3a..c56c9cf 100644 --- a/src/guile/skribilo/engine/context.scm +++ b/src/guile/skribilo/engine/context.scm @@ -31,9 +31,8 @@ :autoload (skribilo utils images) (convert-image) :autoload (skribilo evaluator) (evaluate-document) :autoload (skribilo output) (output *document-being-output*) - :autoload (skribilo color) (skribe-color->rgb - document-used-colors - skribe-use-color!) + :autoload (skribilo color) (color->rgb + document-used-colors) :autoload (skribilo config) (skribilo-release) :use-module (ice-9 optargs) :use-module (ice-9 receive) @@ -356,7 +355,7 @@ ;;; ====================================================================== (define (skribe-color->context-color spec) (receive (r g b) - (skribe-color->rgb spec) + (color->rgb spec) (let ((ff (exact->inexact #xff))) (format #f "r=~a,g=~a,b=~a" (number->string (/ r ff)) diff --git a/src/guile/skribilo/engine/latex.scm b/src/guile/skribilo/engine/latex.scm index 727f127..bb7e15e 100644 --- a/src/guile/skribilo/engine/latex.scm +++ b/src/guile/skribilo/engine/latex.scm @@ -32,8 +32,7 @@ :autoload (skribilo evaluator) (evaluate-document) :autoload (skribilo output) (output) :autoload (skribilo debug) (*debug*) - :autoload (skribilo color) (skribe-color->rgb - skribe-use-color!) + :autoload (skribilo color) (color->rgb) :use-module (srfi srfi-13) :use-module (ice-9 optargs) :use-module (ice-9 receive) @@ -457,7 +456,7 @@ ;*---------------------------------------------------------------------*/ (define (skribe-color->latex-rgb spec) (receive (r g b) - (skribe-color->rgb spec) + (color->rgb spec) (cond ((and (= r 0) (= g 0) (= b 0)) "0.,0.,0.") diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm index d0819bf..6be8546 100644 --- a/src/guile/skribilo/engine/lout.scm +++ b/src/guile/skribilo/engine/lout.scm @@ -32,7 +32,7 @@ :autoload (skribilo utils images) (convert-image) :autoload (skribilo evaluator) (evaluate-document) :autoload (skribilo output) (output) - :autoload (skribilo color) (skribe-color->rgb) + :autoload (skribilo color) (color->rgb) :use-module (srfi srfi-1) :use-module (srfi srfi-2) :use-module (srfi srfi-11) @@ -997,7 +997,7 @@ 16) skribe-color))) (let-values (((r g b) - (skribe-color->rgb actual-color))) + (color->rgb actual-color))) (apply format #f (cons "rgb ~a ~a ~a" (map (if b&w? diff --git a/src/guile/skribilo/package/base.scm b/src/guile/skribilo/package/base.scm index 66f1df1..a4443dc 100644 --- a/src/guile/skribilo/package/base.scm +++ b/src/guile/skribilo/package/base.scm @@ -1,7 +1,7 @@ ;;; base.scm -- The base markup package of Skribe/Skribilo. ;;; +;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludo@gnu.org> ;;; Copyright 2003, 2004 Manuel Serrano -;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludovic.courtes@laas.fr> ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -35,7 +35,6 @@ ;; optional ``sub-packages'' :autoload (skribilo biblio) (*bib-table* resolve-bib bib-load! bib-add! bib-sort-refs/number) - :autoload (skribilo color) (skribe-use-color!) :autoload (skribilo source) (language? source-read-lines source-fontify) :autoload (skribilo prog) (make-prog-body resolve-line) :autoload (skribilo index) (make-index-table default-index) @@ -394,8 +393,8 @@ (class class) (loc &invocation-location) (required-options '(:bg :fg :width)) - (options `((:bg ,(if bg (skribe-use-color! bg) bg)) - (:fg ,(if fg (skribe-use-color! fg) fg)) + (options `((:bg ,bg) + (:fg ,fg) ,@(the-options opts :ident :class :bg :fg))) (body (the-body opts)))) @@ -754,7 +753,7 @@ (class class) (loc &invocation-location) (required-options '()) - (options `(,@(if bg `((:bg ,(if bg (skribe-use-color! bg) bg))) '()) + (options `(,@(if bg `((:bg ,bg)) '()) ,@(the-options opts :ident :class :bg))) (body (parse-list-of 'tr 'tc (the-body opts))))) @@ -801,7 +800,7 @@ (:valign ,valign) (:colspan ,colspan) ,@(if bg - `((:bg ,(if bg (skribe-use-color! bg) bg))) + `((:bg ,bg)) '()) ,@(the-options opts :ident :class :bg :align :valign))) (body (the-body opts))))))) diff --git a/src/guile/skribilo/package/pie.scm b/src/guile/skribilo/package/pie.scm index 0292ccf..ee3c187 100644 --- a/src/guile/skribilo/package/pie.scm +++ b/src/guile/skribilo/package/pie.scm @@ -27,7 +27,7 @@ :use-module (skribilo utils syntax) :use-module (skribilo utils keywords) ;; `the-options', etc. :use-module (skribilo utils strings) ;; `make-string-replace' - :autoload (skribilo color) (skribe-color->rgb) + :autoload (skribilo color) (color->rgb) :autoload (skribilo package base) (bold) :autoload (srfi srfi-13) (string-concatenate) :autoload (ice-9 popen) (open-output-pipe) @@ -157,7 +157,7 @@ the string \"hello\". Implement `sliceweight' markups too." (define (color-spec->ploticus color-spec) (define round (make-rounder 2)) - (call-with-values (lambda () (skribe-color->rgb color-spec)) + (call-with-values (lambda () (color->rgb color-spec)) (lambda (r g b) (format #f "rgb(~a,~a,~a)" (round (/ r 255.0)) diff --git a/src/guile/skribilo/package/slide.scm b/src/guile/skribilo/package/slide.scm index b00efa2..5a62a20 100644 --- a/src/guile/skribilo/package/slide.scm +++ b/src/guile/skribilo/package/slide.scm @@ -28,7 +28,6 @@ :use-module (skribilo engine) :use-module (skribilo evaluator) ;; `*load-options*' - :autoload (skribilo color) (skribe-use-color!) :autoload (skribilo utils keywords) (the-options the-body) :use-module (srfi srfi-1) @@ -213,7 +212,7 @@ (ident ident) (class class) (loc &invocation-location) - (options `((:color ,(if color (skribe-use-color! color) #f)) + (options `((:color ,color) ,@(the-options opt :color))) (body (the-body opt))))) @@ -226,15 +225,15 @@ (for-each (lambda (lbl) (match lbl ((id col) - (skribe-use-color! col)))) + col))) body) (new markup (markup 'slide-play*) (ident ident) (class class) (loc &invocation-location) - (options `((:color ,(if color (skribe-use-color! color) #f)) - (:scolor ,(if color (skribe-use-color! scolor) #f)) + (options `((:color ,color) + (:scolor ,scolor) ,@(the-options opt :color :scolor))) (body body)))) diff --git a/src/guile/skribilo/utils/compat.scm b/src/guile/skribilo/utils/compat.scm index 6ba066b..8ba4a7d 100644 --- a/src/guile/skribilo/utils/compat.scm +++ b/src/guile/skribilo/utils/compat.scm @@ -24,6 +24,7 @@ :use-module (skribilo utils files) :use-module (skribilo parameters) :use-module (skribilo evaluator) + :use-module (skribilo color) :use-module (skribilo lib) :use-module (srfi srfi-1) :autoload (srfi srfi-13) (string-rindex) @@ -216,6 +217,21 @@ ;;; +;;; Colors. +;;; + +(define-public skribe-color->rgb color->rgb) +(define-public (skribe-use-color! c) c) +(define-public (skribe-get-used-colors) + (let ((doc (or (*document-being-output*) + (*document-being-resolved*)))) + (if doc + (document-used-colors doc) + '()))) + + + +;;; ;;; Bibliography. ;;; |